Line data Source code
1 : // MACHINE GENERATED SOURCE FILE WITH ROSE (Grammar.h)--- DO NOT MODIFY!
2 :
3 : #include "sage3basic.h"
4 :
5 : #ifndef ROSE_USE_INTERNAL_FRONTEND_DEVELOPMENT
6 : #include "AST_FILE_IO.h"
7 : #endif
8 : // The header file ("rose_config.h") should only be included by source files that require it.
9 : #include "rose_config.h"
10 :
11 : #if _MSC_VER
12 : #define USE_CPP_NEW_DELETE_OPERATORS 0
13 : #endif
14 :
15 : #define ROSE_ALLOC_TRACE 0
16 : #undef mprintf
17 : #define mprintf Rose::Diagnostics::mfprintf(Rose::ir_node_mlog[Rose::Diagnostics::DEBUG])
18 :
19 :
20 : using namespace std;
21 :
22 : #include "Cxx_GrammarMemoryPoolSupport.h"
23 :
24 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
25 : void
26 5342 : SgNode::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
27 : {
28 : // This function traverses the memory pool for only a specific IR node
29 : // and calls the visit function of the input class execute a traversal
30 : // similar to the style of the attribute based traversals within ROSE.
31 : // This traversal will visit ALL nodes of the AST where as the other
32 : // attribute based traversals visit only the embedded tree within the AST.
33 :
34 : // Initialize array to the address of the first element of the STL vector
35 : // (which is guaranteed to be contiguous storage).
36 : // SgNode objectArray [] = *(Memory_Block_List.begin());
37 5342 : if (SgNode::pools.empty() == false)
38 : {
39 : // Generate an array of memory pools
40 0 : SgNode** objectArray = (SgNode**) &(SgNode::pools[0]);
41 :
42 : // Build a local variable for better performance
43 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
44 : #if 0
45 : // Iterate over the memory pools
46 : for (unsigned int i=0; i < SgNode::pools.size(); i++)
47 : {
48 : // objectArray[i] is a single memory pool
49 : for (int j=0; j < SgNode::pool_size; j++)
50 : {
51 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
52 : {
53 : traversal.visit(&(objectArray[i][j]));
54 : }
55 : }
56 : }
57 : #else
58 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
59 : // compute the list first and then call the visit function on each list element.
60 :
61 : // printf ("Inside of SgNode::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
62 :
63 0 : std::vector<SgNode*> nodeList;
64 :
65 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
66 0 : for (unsigned int i=0; i < SgNode::pools.size(); i++)
67 : {
68 : // objectArray[i] is a single memory pool
69 0 : for (unsigned j=0; j < SgNode::pool_size; j++)
70 : {
71 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
72 : {
73 0 : nodeList.push_back(&(objectArray[i][j]));
74 : }
75 : }
76 : }
77 :
78 : // Iterate over the saved list
79 0 : size_t nodeListSize = nodeList.size();
80 0 : for (size_t i=0; i < nodeListSize; i++)
81 : {
82 0 : ROSE_ASSERT(nodeList[i] != NULL);
83 : #if 0
84 : traversal.visit(nodeList[i]);
85 : #else
86 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
87 : {
88 0 : traversal.visit(nodeList[i]);
89 : }
90 : #endif
91 : }
92 : #endif
93 : }
94 :
95 : // This should not be required since all previously static data members are
96 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
97 :
98 5342 : }
99 :
100 :
101 : void
102 194 : SgNode::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
103 : {
104 : // This function traverses the memory pool for an IR node and
105 : // calls the function to execute the visitor object.
106 :
107 : // Initialize array to the address of the first element of the STL vector
108 : // (which is guarenteed to be contiguous storage).
109 : // SgNode objectArray [] = *(Memory_Block_List.begin());
110 194 : if (SgNode::pools.empty() == false)
111 : {
112 : // Generate an array of memory pools
113 0 : SgNode** objectArray = (SgNode**) &(SgNode::pools[0]);
114 :
115 : // Build a local variable for better performance
116 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
117 :
118 : // Iterate over the memory pools
119 0 : for (unsigned int i=0; i < SgNode::pools.size(); i++)
120 : {
121 : // objectArray[i] is a single memory pool
122 0 : for (unsigned j=0; j < SgNode::pool_size; j++)
123 : {
124 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
125 : {
126 : // printf ("Found a valid SgNode object in the memory pool %d at position %d \n",i,j);
127 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
128 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
129 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
130 : }
131 : else
132 : {
133 : // printf ("Found a INVALID SgNode object in the memory pool \n");
134 : }
135 : }
136 : }
137 : }
138 :
139 : // This should not be required since all previously static data members are
140 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
141 :
142 194 : }
143 :
144 : void
145 0 : SgNode::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
146 : {
147 : // This function visits only a single IR node of the memory pool.
148 : // it is typically called once for each type of IR node within
149 : // the automatically generated function: traverseRepresentativeNodes().
150 :
151 : // Initialize array to the address of the first element of the STL vector
152 : // (which is guarenteed to be contiguous storage).
153 : // SgNode objectArray [] = *(Memory_Block_List.begin());
154 0 : if (SgNode::pools.empty() == false)
155 : {
156 : // Generate an array of memory pools
157 0 : SgNode** objectArray = (SgNode**) &(SgNode::pools[0]);
158 :
159 : // Build a local variable for better performance
160 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
161 :
162 : // Iterate over the memory pools
163 0 : bool done = false;
164 0 : unsigned i=0;
165 :
166 : // find the first valid IR node, call visit function, and then leave
167 0 : while ( done == false && i < SgNode::pools.size() )
168 : {
169 : // objectArray[i] is a single memory pool
170 : unsigned j=0;
171 0 : while (done == false && j < SgNode::pool_size)
172 : {
173 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
174 : {
175 0 : traversal.visit(&(objectArray[i][j]));
176 0 : done = true;
177 : }
178 0 : j++;
179 : }
180 0 : i++;
181 : }
182 :
183 : #if 0
184 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
185 : if (done == false)
186 : {
187 : printf ("No representative for SgNode found in memory pools \n");
188 : }
189 : #endif
190 : }
191 0 : }
192 :
193 :
194 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
195 : // using values that overflow signed values of int.
196 : size_t
197 4 : SgNode::numberOfNodes()
198 : {
199 : // This function traverses the memory pool for an IR node and
200 : // counts the number of IR nodes of a particular Sage III IR
201 : // nodes type.
202 :
203 4 : size_t count = 0;
204 4 : if (SgNode::pools.empty() == false)
205 : {
206 : // Generate an array of memory pools (this is actually a STL vector,
207 : // but it is contiguious, so OK to treat this way).
208 0 : SgNode** objectArray = (SgNode**) &(SgNode::pools[0]);
209 :
210 : // Build a local variable for better performance (make it a loop invariant variable).
211 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
212 :
213 : // Iterate over all of the memory pools for this IR node.
214 0 : for (unsigned int i=0; i < SgNode::pools.size(); i++)
215 : {
216 : // objectArray[i] is a single memory pool, iterate over all the
217 : // IR nodes and only count those that are valid IR nodes used in
218 : // the AST (i.e. allocated IR nodes).
219 0 : for (unsigned j=0; j < SgNode::pool_size; j++)
220 : {
221 : // This is indexing the STL vector of C/C++ style arrays as a doubly
222 : // indexed array access. It is OK since we have leveraged the semantics
223 : // of STL vector memory as contigous and cast the memory as an array
224 : // of arrays to use the 2D array indexing. Hope this is not confusing,
225 : // but it s very fast as an implementation.
226 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
227 : {
228 0 : count++;
229 : }
230 : }
231 : }
232 : }
233 :
234 :
235 :
236 4 : return count;
237 : }
238 :
239 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
240 : // using values that overflow signed values of int.
241 : size_t
242 0 : SgNode::memoryUsage()
243 : {
244 : // This function is required because we need the class name as a type when we call sizeof
245 : // There might be another way to implement this if we have a traversal that only called a
246 : // representative object (one call for each type of Sage IIIIR node).
247 0 : size_t memory = numberOfNodes() * sizeof(SgNode);
248 :
249 0 : return memory;
250 : }
251 :
252 : /* #line 253 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
253 :
254 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
255 : void
256 5342 : SgSupport::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
257 : {
258 : // This function traverses the memory pool for only a specific IR node
259 : // and calls the visit function of the input class execute a traversal
260 : // similar to the style of the attribute based traversals within ROSE.
261 : // This traversal will visit ALL nodes of the AST where as the other
262 : // attribute based traversals visit only the embedded tree within the AST.
263 :
264 : // Initialize array to the address of the first element of the STL vector
265 : // (which is guaranteed to be contiguous storage).
266 : // SgSupport objectArray [] = *(Memory_Block_List.begin());
267 5342 : if (SgSupport::pools.empty() == false)
268 : {
269 : // Generate an array of memory pools
270 0 : SgSupport** objectArray = (SgSupport**) &(SgSupport::pools[0]);
271 :
272 : // Build a local variable for better performance
273 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
274 : #if 0
275 : // Iterate over the memory pools
276 : for (unsigned int i=0; i < SgSupport::pools.size(); i++)
277 : {
278 : // objectArray[i] is a single memory pool
279 : for (int j=0; j < SgSupport::pool_size; j++)
280 : {
281 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
282 : {
283 : traversal.visit(&(objectArray[i][j]));
284 : }
285 : }
286 : }
287 : #else
288 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
289 : // compute the list first and then call the visit function on each list element.
290 :
291 : // printf ("Inside of SgSupport::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
292 :
293 0 : std::vector<SgSupport*> nodeList;
294 :
295 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
296 0 : for (unsigned int i=0; i < SgSupport::pools.size(); i++)
297 : {
298 : // objectArray[i] is a single memory pool
299 0 : for (unsigned j=0; j < SgSupport::pool_size; j++)
300 : {
301 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
302 : {
303 0 : nodeList.push_back(&(objectArray[i][j]));
304 : }
305 : }
306 : }
307 :
308 : // Iterate over the saved list
309 0 : size_t nodeListSize = nodeList.size();
310 0 : for (size_t i=0; i < nodeListSize; i++)
311 : {
312 0 : ROSE_ASSERT(nodeList[i] != NULL);
313 : #if 0
314 : traversal.visit(nodeList[i]);
315 : #else
316 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
317 : {
318 0 : traversal.visit(nodeList[i]);
319 : }
320 : #endif
321 : }
322 : #endif
323 : }
324 :
325 : // This should not be required since all previously static data members are
326 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
327 :
328 5342 : }
329 :
330 :
331 : void
332 194 : SgSupport::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
333 : {
334 : // This function traverses the memory pool for an IR node and
335 : // calls the function to execute the visitor object.
336 :
337 : // Initialize array to the address of the first element of the STL vector
338 : // (which is guarenteed to be contiguous storage).
339 : // SgSupport objectArray [] = *(Memory_Block_List.begin());
340 194 : if (SgSupport::pools.empty() == false)
341 : {
342 : // Generate an array of memory pools
343 0 : SgSupport** objectArray = (SgSupport**) &(SgSupport::pools[0]);
344 :
345 : // Build a local variable for better performance
346 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
347 :
348 : // Iterate over the memory pools
349 0 : for (unsigned int i=0; i < SgSupport::pools.size(); i++)
350 : {
351 : // objectArray[i] is a single memory pool
352 0 : for (unsigned j=0; j < SgSupport::pool_size; j++)
353 : {
354 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
355 : {
356 : // printf ("Found a valid SgSupport object in the memory pool %d at position %d \n",i,j);
357 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
358 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
359 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
360 : }
361 : else
362 : {
363 : // printf ("Found a INVALID SgSupport object in the memory pool \n");
364 : }
365 : }
366 : }
367 : }
368 :
369 : // This should not be required since all previously static data members are
370 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
371 :
372 194 : }
373 :
374 : void
375 0 : SgSupport::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
376 : {
377 : // This function visits only a single IR node of the memory pool.
378 : // it is typically called once for each type of IR node within
379 : // the automatically generated function: traverseRepresentativeNodes().
380 :
381 : // Initialize array to the address of the first element of the STL vector
382 : // (which is guarenteed to be contiguous storage).
383 : // SgSupport objectArray [] = *(Memory_Block_List.begin());
384 0 : if (SgSupport::pools.empty() == false)
385 : {
386 : // Generate an array of memory pools
387 0 : SgSupport** objectArray = (SgSupport**) &(SgSupport::pools[0]);
388 :
389 : // Build a local variable for better performance
390 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
391 :
392 : // Iterate over the memory pools
393 0 : bool done = false;
394 0 : unsigned i=0;
395 :
396 : // find the first valid IR node, call visit function, and then leave
397 0 : while ( done == false && i < SgSupport::pools.size() )
398 : {
399 : // objectArray[i] is a single memory pool
400 : unsigned j=0;
401 0 : while (done == false && j < SgSupport::pool_size)
402 : {
403 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
404 : {
405 0 : traversal.visit(&(objectArray[i][j]));
406 0 : done = true;
407 : }
408 0 : j++;
409 : }
410 0 : i++;
411 : }
412 :
413 : #if 0
414 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
415 : if (done == false)
416 : {
417 : printf ("No representative for SgSupport found in memory pools \n");
418 : }
419 : #endif
420 : }
421 0 : }
422 :
423 :
424 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
425 : // using values that overflow signed values of int.
426 : size_t
427 4 : SgSupport::numberOfNodes()
428 : {
429 : // This function traverses the memory pool for an IR node and
430 : // counts the number of IR nodes of a particular Sage III IR
431 : // nodes type.
432 :
433 4 : size_t count = 0;
434 4 : if (SgSupport::pools.empty() == false)
435 : {
436 : // Generate an array of memory pools (this is actually a STL vector,
437 : // but it is contiguious, so OK to treat this way).
438 0 : SgSupport** objectArray = (SgSupport**) &(SgSupport::pools[0]);
439 :
440 : // Build a local variable for better performance (make it a loop invariant variable).
441 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
442 :
443 : // Iterate over all of the memory pools for this IR node.
444 0 : for (unsigned int i=0; i < SgSupport::pools.size(); i++)
445 : {
446 : // objectArray[i] is a single memory pool, iterate over all the
447 : // IR nodes and only count those that are valid IR nodes used in
448 : // the AST (i.e. allocated IR nodes).
449 0 : for (unsigned j=0; j < SgSupport::pool_size; j++)
450 : {
451 : // This is indexing the STL vector of C/C++ style arrays as a doubly
452 : // indexed array access. It is OK since we have leveraged the semantics
453 : // of STL vector memory as contigous and cast the memory as an array
454 : // of arrays to use the 2D array indexing. Hope this is not confusing,
455 : // but it s very fast as an implementation.
456 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
457 : {
458 0 : count++;
459 : }
460 : }
461 : }
462 : }
463 :
464 :
465 :
466 4 : return count;
467 : }
468 :
469 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
470 : // using values that overflow signed values of int.
471 : size_t
472 0 : SgSupport::memoryUsage()
473 : {
474 : // This function is required because we need the class name as a type when we call sizeof
475 : // There might be another way to implement this if we have a traversal that only called a
476 : // representative object (one call for each type of Sage IIIIR node).
477 0 : size_t memory = numberOfNodes() * sizeof(SgSupport);
478 :
479 0 : return memory;
480 : }
481 :
482 : /* #line 483 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
483 :
484 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
485 : void
486 5342 : SgModifier::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
487 : {
488 : // This function traverses the memory pool for only a specific IR node
489 : // and calls the visit function of the input class execute a traversal
490 : // similar to the style of the attribute based traversals within ROSE.
491 : // This traversal will visit ALL nodes of the AST where as the other
492 : // attribute based traversals visit only the embedded tree within the AST.
493 :
494 : // Initialize array to the address of the first element of the STL vector
495 : // (which is guaranteed to be contiguous storage).
496 : // SgModifier objectArray [] = *(Memory_Block_List.begin());
497 5342 : if (SgModifier::pools.empty() == false)
498 : {
499 : // Generate an array of memory pools
500 0 : SgModifier** objectArray = (SgModifier**) &(SgModifier::pools[0]);
501 :
502 : // Build a local variable for better performance
503 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
504 : #if 0
505 : // Iterate over the memory pools
506 : for (unsigned int i=0; i < SgModifier::pools.size(); i++)
507 : {
508 : // objectArray[i] is a single memory pool
509 : for (int j=0; j < SgModifier::pool_size; j++)
510 : {
511 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
512 : {
513 : traversal.visit(&(objectArray[i][j]));
514 : }
515 : }
516 : }
517 : #else
518 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
519 : // compute the list first and then call the visit function on each list element.
520 :
521 : // printf ("Inside of SgModifier::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
522 :
523 0 : std::vector<SgModifier*> nodeList;
524 :
525 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
526 0 : for (unsigned int i=0; i < SgModifier::pools.size(); i++)
527 : {
528 : // objectArray[i] is a single memory pool
529 0 : for (unsigned j=0; j < SgModifier::pool_size; j++)
530 : {
531 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
532 : {
533 0 : nodeList.push_back(&(objectArray[i][j]));
534 : }
535 : }
536 : }
537 :
538 : // Iterate over the saved list
539 0 : size_t nodeListSize = nodeList.size();
540 0 : for (size_t i=0; i < nodeListSize; i++)
541 : {
542 0 : ROSE_ASSERT(nodeList[i] != NULL);
543 : #if 0
544 : traversal.visit(nodeList[i]);
545 : #else
546 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
547 : {
548 0 : traversal.visit(nodeList[i]);
549 : }
550 : #endif
551 : }
552 : #endif
553 : }
554 :
555 : // This should not be required since all previously static data members are
556 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
557 :
558 5342 : }
559 :
560 :
561 : void
562 194 : SgModifier::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
563 : {
564 : // This function traverses the memory pool for an IR node and
565 : // calls the function to execute the visitor object.
566 :
567 : // Initialize array to the address of the first element of the STL vector
568 : // (which is guarenteed to be contiguous storage).
569 : // SgModifier objectArray [] = *(Memory_Block_List.begin());
570 194 : if (SgModifier::pools.empty() == false)
571 : {
572 : // Generate an array of memory pools
573 0 : SgModifier** objectArray = (SgModifier**) &(SgModifier::pools[0]);
574 :
575 : // Build a local variable for better performance
576 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
577 :
578 : // Iterate over the memory pools
579 0 : for (unsigned int i=0; i < SgModifier::pools.size(); i++)
580 : {
581 : // objectArray[i] is a single memory pool
582 0 : for (unsigned j=0; j < SgModifier::pool_size; j++)
583 : {
584 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
585 : {
586 : // printf ("Found a valid SgModifier object in the memory pool %d at position %d \n",i,j);
587 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
588 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
589 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
590 : }
591 : else
592 : {
593 : // printf ("Found a INVALID SgModifier object in the memory pool \n");
594 : }
595 : }
596 : }
597 : }
598 :
599 : // This should not be required since all previously static data members are
600 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
601 :
602 194 : }
603 :
604 : void
605 0 : SgModifier::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
606 : {
607 : // This function visits only a single IR node of the memory pool.
608 : // it is typically called once for each type of IR node within
609 : // the automatically generated function: traverseRepresentativeNodes().
610 :
611 : // Initialize array to the address of the first element of the STL vector
612 : // (which is guarenteed to be contiguous storage).
613 : // SgModifier objectArray [] = *(Memory_Block_List.begin());
614 0 : if (SgModifier::pools.empty() == false)
615 : {
616 : // Generate an array of memory pools
617 0 : SgModifier** objectArray = (SgModifier**) &(SgModifier::pools[0]);
618 :
619 : // Build a local variable for better performance
620 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
621 :
622 : // Iterate over the memory pools
623 0 : bool done = false;
624 0 : unsigned i=0;
625 :
626 : // find the first valid IR node, call visit function, and then leave
627 0 : while ( done == false && i < SgModifier::pools.size() )
628 : {
629 : // objectArray[i] is a single memory pool
630 : unsigned j=0;
631 0 : while (done == false && j < SgModifier::pool_size)
632 : {
633 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
634 : {
635 0 : traversal.visit(&(objectArray[i][j]));
636 0 : done = true;
637 : }
638 0 : j++;
639 : }
640 0 : i++;
641 : }
642 :
643 : #if 0
644 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
645 : if (done == false)
646 : {
647 : printf ("No representative for SgModifier found in memory pools \n");
648 : }
649 : #endif
650 : }
651 0 : }
652 :
653 :
654 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
655 : // using values that overflow signed values of int.
656 : size_t
657 4 : SgModifier::numberOfNodes()
658 : {
659 : // This function traverses the memory pool for an IR node and
660 : // counts the number of IR nodes of a particular Sage III IR
661 : // nodes type.
662 :
663 4 : size_t count = 0;
664 4 : if (SgModifier::pools.empty() == false)
665 : {
666 : // Generate an array of memory pools (this is actually a STL vector,
667 : // but it is contiguious, so OK to treat this way).
668 0 : SgModifier** objectArray = (SgModifier**) &(SgModifier::pools[0]);
669 :
670 : // Build a local variable for better performance (make it a loop invariant variable).
671 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
672 :
673 : // Iterate over all of the memory pools for this IR node.
674 0 : for (unsigned int i=0; i < SgModifier::pools.size(); i++)
675 : {
676 : // objectArray[i] is a single memory pool, iterate over all the
677 : // IR nodes and only count those that are valid IR nodes used in
678 : // the AST (i.e. allocated IR nodes).
679 0 : for (unsigned j=0; j < SgModifier::pool_size; j++)
680 : {
681 : // This is indexing the STL vector of C/C++ style arrays as a doubly
682 : // indexed array access. It is OK since we have leveraged the semantics
683 : // of STL vector memory as contigous and cast the memory as an array
684 : // of arrays to use the 2D array indexing. Hope this is not confusing,
685 : // but it s very fast as an implementation.
686 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
687 : {
688 0 : count++;
689 : }
690 : }
691 : }
692 : }
693 :
694 :
695 :
696 4 : return count;
697 : }
698 :
699 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
700 : // using values that overflow signed values of int.
701 : size_t
702 0 : SgModifier::memoryUsage()
703 : {
704 : // This function is required because we need the class name as a type when we call sizeof
705 : // There might be another way to implement this if we have a traversal that only called a
706 : // representative object (one call for each type of Sage IIIIR node).
707 0 : size_t memory = numberOfNodes() * sizeof(SgModifier);
708 :
709 0 : return memory;
710 : }
711 :
712 : /* #line 713 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
713 :
714 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
715 : void
716 5342 : SgModifierNodes::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
717 : {
718 : // This function traverses the memory pool for only a specific IR node
719 : // and calls the visit function of the input class execute a traversal
720 : // similar to the style of the attribute based traversals within ROSE.
721 : // This traversal will visit ALL nodes of the AST where as the other
722 : // attribute based traversals visit only the embedded tree within the AST.
723 :
724 : // Initialize array to the address of the first element of the STL vector
725 : // (which is guaranteed to be contiguous storage).
726 : // SgModifierNodes objectArray [] = *(Memory_Block_List.begin());
727 5342 : if (SgModifierNodes::pools.empty() == false)
728 : {
729 : // Generate an array of memory pools
730 0 : SgModifierNodes** objectArray = (SgModifierNodes**) &(SgModifierNodes::pools[0]);
731 :
732 : // Build a local variable for better performance
733 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
734 : #if 0
735 : // Iterate over the memory pools
736 : for (unsigned int i=0; i < SgModifierNodes::pools.size(); i++)
737 : {
738 : // objectArray[i] is a single memory pool
739 : for (int j=0; j < SgModifierNodes::pool_size; j++)
740 : {
741 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
742 : {
743 : traversal.visit(&(objectArray[i][j]));
744 : }
745 : }
746 : }
747 : #else
748 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
749 : // compute the list first and then call the visit function on each list element.
750 :
751 : // printf ("Inside of SgModifierNodes::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
752 :
753 0 : std::vector<SgModifierNodes*> nodeList;
754 :
755 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
756 0 : for (unsigned int i=0; i < SgModifierNodes::pools.size(); i++)
757 : {
758 : // objectArray[i] is a single memory pool
759 0 : for (unsigned j=0; j < SgModifierNodes::pool_size; j++)
760 : {
761 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
762 : {
763 0 : nodeList.push_back(&(objectArray[i][j]));
764 : }
765 : }
766 : }
767 :
768 : // Iterate over the saved list
769 0 : size_t nodeListSize = nodeList.size();
770 0 : for (size_t i=0; i < nodeListSize; i++)
771 : {
772 0 : ROSE_ASSERT(nodeList[i] != NULL);
773 : #if 0
774 : traversal.visit(nodeList[i]);
775 : #else
776 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
777 : {
778 0 : traversal.visit(nodeList[i]);
779 : }
780 : #endif
781 : }
782 : #endif
783 : }
784 :
785 : // This should not be required since all previously static data members are
786 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
787 :
788 5342 : }
789 :
790 :
791 : void
792 194 : SgModifierNodes::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
793 : {
794 : // This function traverses the memory pool for an IR node and
795 : // calls the function to execute the visitor object.
796 :
797 : // Initialize array to the address of the first element of the STL vector
798 : // (which is guarenteed to be contiguous storage).
799 : // SgModifierNodes objectArray [] = *(Memory_Block_List.begin());
800 194 : if (SgModifierNodes::pools.empty() == false)
801 : {
802 : // Generate an array of memory pools
803 0 : SgModifierNodes** objectArray = (SgModifierNodes**) &(SgModifierNodes::pools[0]);
804 :
805 : // Build a local variable for better performance
806 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
807 :
808 : // Iterate over the memory pools
809 0 : for (unsigned int i=0; i < SgModifierNodes::pools.size(); i++)
810 : {
811 : // objectArray[i] is a single memory pool
812 0 : for (unsigned j=0; j < SgModifierNodes::pool_size; j++)
813 : {
814 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
815 : {
816 : // printf ("Found a valid SgModifierNodes object in the memory pool %d at position %d \n",i,j);
817 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
818 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
819 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
820 : }
821 : else
822 : {
823 : // printf ("Found a INVALID SgModifierNodes object in the memory pool \n");
824 : }
825 : }
826 : }
827 : }
828 :
829 : // This should not be required since all previously static data members are
830 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
831 :
832 194 : }
833 :
834 : void
835 0 : SgModifierNodes::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
836 : {
837 : // This function visits only a single IR node of the memory pool.
838 : // it is typically called once for each type of IR node within
839 : // the automatically generated function: traverseRepresentativeNodes().
840 :
841 : // Initialize array to the address of the first element of the STL vector
842 : // (which is guarenteed to be contiguous storage).
843 : // SgModifierNodes objectArray [] = *(Memory_Block_List.begin());
844 0 : if (SgModifierNodes::pools.empty() == false)
845 : {
846 : // Generate an array of memory pools
847 0 : SgModifierNodes** objectArray = (SgModifierNodes**) &(SgModifierNodes::pools[0]);
848 :
849 : // Build a local variable for better performance
850 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
851 :
852 : // Iterate over the memory pools
853 0 : bool done = false;
854 0 : unsigned i=0;
855 :
856 : // find the first valid IR node, call visit function, and then leave
857 0 : while ( done == false && i < SgModifierNodes::pools.size() )
858 : {
859 : // objectArray[i] is a single memory pool
860 : unsigned j=0;
861 0 : while (done == false && j < SgModifierNodes::pool_size)
862 : {
863 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
864 : {
865 0 : traversal.visit(&(objectArray[i][j]));
866 0 : done = true;
867 : }
868 0 : j++;
869 : }
870 0 : i++;
871 : }
872 :
873 : #if 0
874 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
875 : if (done == false)
876 : {
877 : printf ("No representative for SgModifierNodes found in memory pools \n");
878 : }
879 : #endif
880 : }
881 0 : }
882 :
883 :
884 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
885 : // using values that overflow signed values of int.
886 : size_t
887 4 : SgModifierNodes::numberOfNodes()
888 : {
889 : // This function traverses the memory pool for an IR node and
890 : // counts the number of IR nodes of a particular Sage III IR
891 : // nodes type.
892 :
893 4 : size_t count = 0;
894 4 : if (SgModifierNodes::pools.empty() == false)
895 : {
896 : // Generate an array of memory pools (this is actually a STL vector,
897 : // but it is contiguious, so OK to treat this way).
898 0 : SgModifierNodes** objectArray = (SgModifierNodes**) &(SgModifierNodes::pools[0]);
899 :
900 : // Build a local variable for better performance (make it a loop invariant variable).
901 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
902 :
903 : // Iterate over all of the memory pools for this IR node.
904 0 : for (unsigned int i=0; i < SgModifierNodes::pools.size(); i++)
905 : {
906 : // objectArray[i] is a single memory pool, iterate over all the
907 : // IR nodes and only count those that are valid IR nodes used in
908 : // the AST (i.e. allocated IR nodes).
909 0 : for (unsigned j=0; j < SgModifierNodes::pool_size; j++)
910 : {
911 : // This is indexing the STL vector of C/C++ style arrays as a doubly
912 : // indexed array access. It is OK since we have leveraged the semantics
913 : // of STL vector memory as contigous and cast the memory as an array
914 : // of arrays to use the 2D array indexing. Hope this is not confusing,
915 : // but it s very fast as an implementation.
916 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
917 : {
918 0 : count++;
919 : }
920 : }
921 : }
922 : }
923 :
924 :
925 :
926 4 : return count;
927 : }
928 :
929 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
930 : // using values that overflow signed values of int.
931 : size_t
932 0 : SgModifierNodes::memoryUsage()
933 : {
934 : // This function is required because we need the class name as a type when we call sizeof
935 : // There might be another way to implement this if we have a traversal that only called a
936 : // representative object (one call for each type of Sage IIIIR node).
937 0 : size_t memory = numberOfNodes() * sizeof(SgModifierNodes);
938 :
939 0 : return memory;
940 : }
941 :
942 : /* #line 943 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
943 :
944 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
945 : void
946 5342 : SgConstVolatileModifier::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
947 : {
948 : // This function traverses the memory pool for only a specific IR node
949 : // and calls the visit function of the input class execute a traversal
950 : // similar to the style of the attribute based traversals within ROSE.
951 : // This traversal will visit ALL nodes of the AST where as the other
952 : // attribute based traversals visit only the embedded tree within the AST.
953 :
954 : // Initialize array to the address of the first element of the STL vector
955 : // (which is guaranteed to be contiguous storage).
956 : // SgConstVolatileModifier objectArray [] = *(Memory_Block_List.begin());
957 5342 : if (SgConstVolatileModifier::pools.empty() == false)
958 : {
959 : // Generate an array of memory pools
960 0 : SgConstVolatileModifier** objectArray = (SgConstVolatileModifier**) &(SgConstVolatileModifier::pools[0]);
961 :
962 : // Build a local variable for better performance
963 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
964 : #if 0
965 : // Iterate over the memory pools
966 : for (unsigned int i=0; i < SgConstVolatileModifier::pools.size(); i++)
967 : {
968 : // objectArray[i] is a single memory pool
969 : for (int j=0; j < SgConstVolatileModifier::pool_size; j++)
970 : {
971 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
972 : {
973 : traversal.visit(&(objectArray[i][j]));
974 : }
975 : }
976 : }
977 : #else
978 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
979 : // compute the list first and then call the visit function on each list element.
980 :
981 : // printf ("Inside of SgConstVolatileModifier::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
982 :
983 0 : std::vector<SgConstVolatileModifier*> nodeList;
984 :
985 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
986 0 : for (unsigned int i=0; i < SgConstVolatileModifier::pools.size(); i++)
987 : {
988 : // objectArray[i] is a single memory pool
989 0 : for (unsigned j=0; j < SgConstVolatileModifier::pool_size; j++)
990 : {
991 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
992 : {
993 0 : nodeList.push_back(&(objectArray[i][j]));
994 : }
995 : }
996 : }
997 :
998 : // Iterate over the saved list
999 0 : size_t nodeListSize = nodeList.size();
1000 0 : for (size_t i=0; i < nodeListSize; i++)
1001 : {
1002 0 : ROSE_ASSERT(nodeList[i] != NULL);
1003 : #if 0
1004 : traversal.visit(nodeList[i]);
1005 : #else
1006 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
1007 : {
1008 0 : traversal.visit(nodeList[i]);
1009 : }
1010 : #endif
1011 : }
1012 : #endif
1013 : }
1014 :
1015 : // This should not be required since all previously static data members are
1016 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
1017 :
1018 5342 : }
1019 :
1020 :
1021 : void
1022 194 : SgConstVolatileModifier::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
1023 : {
1024 : // This function traverses the memory pool for an IR node and
1025 : // calls the function to execute the visitor object.
1026 :
1027 : // Initialize array to the address of the first element of the STL vector
1028 : // (which is guarenteed to be contiguous storage).
1029 : // SgConstVolatileModifier objectArray [] = *(Memory_Block_List.begin());
1030 194 : if (SgConstVolatileModifier::pools.empty() == false)
1031 : {
1032 : // Generate an array of memory pools
1033 0 : SgConstVolatileModifier** objectArray = (SgConstVolatileModifier**) &(SgConstVolatileModifier::pools[0]);
1034 :
1035 : // Build a local variable for better performance
1036 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
1037 :
1038 : // Iterate over the memory pools
1039 0 : for (unsigned int i=0; i < SgConstVolatileModifier::pools.size(); i++)
1040 : {
1041 : // objectArray[i] is a single memory pool
1042 0 : for (unsigned j=0; j < SgConstVolatileModifier::pool_size; j++)
1043 : {
1044 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
1045 : {
1046 : // printf ("Found a valid SgConstVolatileModifier object in the memory pool %d at position %d \n",i,j);
1047 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
1048 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
1049 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
1050 : }
1051 : else
1052 : {
1053 : // printf ("Found a INVALID SgConstVolatileModifier object in the memory pool \n");
1054 : }
1055 : }
1056 : }
1057 : }
1058 :
1059 : // This should not be required since all previously static data members are
1060 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
1061 :
1062 194 : }
1063 :
1064 : void
1065 0 : SgConstVolatileModifier::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
1066 : {
1067 : // This function visits only a single IR node of the memory pool.
1068 : // it is typically called once for each type of IR node within
1069 : // the automatically generated function: traverseRepresentativeNodes().
1070 :
1071 : // Initialize array to the address of the first element of the STL vector
1072 : // (which is guarenteed to be contiguous storage).
1073 : // SgConstVolatileModifier objectArray [] = *(Memory_Block_List.begin());
1074 0 : if (SgConstVolatileModifier::pools.empty() == false)
1075 : {
1076 : // Generate an array of memory pools
1077 0 : SgConstVolatileModifier** objectArray = (SgConstVolatileModifier**) &(SgConstVolatileModifier::pools[0]);
1078 :
1079 : // Build a local variable for better performance
1080 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
1081 :
1082 : // Iterate over the memory pools
1083 0 : bool done = false;
1084 0 : unsigned i=0;
1085 :
1086 : // find the first valid IR node, call visit function, and then leave
1087 0 : while ( done == false && i < SgConstVolatileModifier::pools.size() )
1088 : {
1089 : // objectArray[i] is a single memory pool
1090 : unsigned j=0;
1091 0 : while (done == false && j < SgConstVolatileModifier::pool_size)
1092 : {
1093 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
1094 : {
1095 0 : traversal.visit(&(objectArray[i][j]));
1096 0 : done = true;
1097 : }
1098 0 : j++;
1099 : }
1100 0 : i++;
1101 : }
1102 :
1103 : #if 0
1104 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
1105 : if (done == false)
1106 : {
1107 : printf ("No representative for SgConstVolatileModifier found in memory pools \n");
1108 : }
1109 : #endif
1110 : }
1111 0 : }
1112 :
1113 :
1114 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
1115 : // using values that overflow signed values of int.
1116 : size_t
1117 4 : SgConstVolatileModifier::numberOfNodes()
1118 : {
1119 : // This function traverses the memory pool for an IR node and
1120 : // counts the number of IR nodes of a particular Sage III IR
1121 : // nodes type.
1122 :
1123 4 : size_t count = 0;
1124 4 : if (SgConstVolatileModifier::pools.empty() == false)
1125 : {
1126 : // Generate an array of memory pools (this is actually a STL vector,
1127 : // but it is contiguious, so OK to treat this way).
1128 0 : SgConstVolatileModifier** objectArray = (SgConstVolatileModifier**) &(SgConstVolatileModifier::pools[0]);
1129 :
1130 : // Build a local variable for better performance (make it a loop invariant variable).
1131 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
1132 :
1133 : // Iterate over all of the memory pools for this IR node.
1134 0 : for (unsigned int i=0; i < SgConstVolatileModifier::pools.size(); i++)
1135 : {
1136 : // objectArray[i] is a single memory pool, iterate over all the
1137 : // IR nodes and only count those that are valid IR nodes used in
1138 : // the AST (i.e. allocated IR nodes).
1139 0 : for (unsigned j=0; j < SgConstVolatileModifier::pool_size; j++)
1140 : {
1141 : // This is indexing the STL vector of C/C++ style arrays as a doubly
1142 : // indexed array access. It is OK since we have leveraged the semantics
1143 : // of STL vector memory as contigous and cast the memory as an array
1144 : // of arrays to use the 2D array indexing. Hope this is not confusing,
1145 : // but it s very fast as an implementation.
1146 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
1147 : {
1148 0 : count++;
1149 : }
1150 : }
1151 : }
1152 : }
1153 :
1154 :
1155 :
1156 4 : return count;
1157 : }
1158 :
1159 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
1160 : // using values that overflow signed values of int.
1161 : size_t
1162 0 : SgConstVolatileModifier::memoryUsage()
1163 : {
1164 : // This function is required because we need the class name as a type when we call sizeof
1165 : // There might be another way to implement this if we have a traversal that only called a
1166 : // representative object (one call for each type of Sage IIIIR node).
1167 0 : size_t memory = numberOfNodes() * sizeof(SgConstVolatileModifier);
1168 :
1169 0 : return memory;
1170 : }
1171 :
1172 : /* #line 1173 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
1173 :
1174 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
1175 : void
1176 5342 : SgStorageModifier::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
1177 : {
1178 : // This function traverses the memory pool for only a specific IR node
1179 : // and calls the visit function of the input class execute a traversal
1180 : // similar to the style of the attribute based traversals within ROSE.
1181 : // This traversal will visit ALL nodes of the AST where as the other
1182 : // attribute based traversals visit only the embedded tree within the AST.
1183 :
1184 : // Initialize array to the address of the first element of the STL vector
1185 : // (which is guaranteed to be contiguous storage).
1186 : // SgStorageModifier objectArray [] = *(Memory_Block_List.begin());
1187 5342 : if (SgStorageModifier::pools.empty() == false)
1188 : {
1189 : // Generate an array of memory pools
1190 5119 : SgStorageModifier** objectArray = (SgStorageModifier**) &(SgStorageModifier::pools[0]);
1191 :
1192 : // Build a local variable for better performance
1193 5119 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
1194 : #if 0
1195 : // Iterate over the memory pools
1196 : for (unsigned int i=0; i < SgStorageModifier::pools.size(); i++)
1197 : {
1198 : // objectArray[i] is a single memory pool
1199 : for (int j=0; j < SgStorageModifier::pool_size; j++)
1200 : {
1201 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
1202 : {
1203 : traversal.visit(&(objectArray[i][j]));
1204 : }
1205 : }
1206 : }
1207 : #else
1208 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
1209 : // compute the list first and then call the visit function on each list element.
1210 :
1211 : // printf ("Inside of SgStorageModifier::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
1212 :
1213 10238 : std::vector<SgStorageModifier*> nodeList;
1214 :
1215 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
1216 54591 : for (unsigned int i=0; i < SgStorageModifier::pools.size(); i++)
1217 : {
1218 : // objectArray[i] is a single memory pool
1219 98993500 : for (unsigned j=0; j < SgStorageModifier::pool_size; j++)
1220 : {
1221 98944000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
1222 : {
1223 94199700 : nodeList.push_back(&(objectArray[i][j]));
1224 : }
1225 : }
1226 : }
1227 :
1228 : // Iterate over the saved list
1229 5119 : size_t nodeListSize = nodeList.size();
1230 94204800 : for (size_t i=0; i < nodeListSize; i++)
1231 : {
1232 94199700 : ROSE_ASSERT(nodeList[i] != NULL);
1233 : #if 0
1234 : traversal.visit(nodeList[i]);
1235 : #else
1236 94199700 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
1237 : {
1238 94199700 : traversal.visit(nodeList[i]);
1239 : }
1240 : #endif
1241 : }
1242 : #endif
1243 : }
1244 :
1245 : // This should not be required since all previously static data members are
1246 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
1247 :
1248 5342 : }
1249 :
1250 :
1251 : void
1252 194 : SgStorageModifier::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
1253 : {
1254 : // This function traverses the memory pool for an IR node and
1255 : // calls the function to execute the visitor object.
1256 :
1257 : // Initialize array to the address of the first element of the STL vector
1258 : // (which is guarenteed to be contiguous storage).
1259 : // SgStorageModifier objectArray [] = *(Memory_Block_List.begin());
1260 194 : if (SgStorageModifier::pools.empty() == false)
1261 : {
1262 : // Generate an array of memory pools
1263 194 : SgStorageModifier** objectArray = (SgStorageModifier**) &(SgStorageModifier::pools[0]);
1264 :
1265 : // Build a local variable for better performance
1266 194 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
1267 :
1268 : // Iterate over the memory pools
1269 3368 : for (unsigned int i=0; i < SgStorageModifier::pools.size(); i++)
1270 : {
1271 : // objectArray[i] is a single memory pool
1272 6351170 : for (unsigned j=0; j < SgStorageModifier::pool_size; j++)
1273 : {
1274 6348000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
1275 : {
1276 : // printf ("Found a valid SgStorageModifier object in the memory pool %d at position %d \n",i,j);
1277 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
1278 6131590 : objectArray[i][j].executeVisitorMemberFunction(visitor);
1279 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
1280 : }
1281 : else
1282 : {
1283 : // printf ("Found a INVALID SgStorageModifier object in the memory pool \n");
1284 : }
1285 : }
1286 : }
1287 : }
1288 :
1289 : // This should not be required since all previously static data members are
1290 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
1291 :
1292 194 : }
1293 :
1294 : void
1295 0 : SgStorageModifier::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
1296 : {
1297 : // This function visits only a single IR node of the memory pool.
1298 : // it is typically called once for each type of IR node within
1299 : // the automatically generated function: traverseRepresentativeNodes().
1300 :
1301 : // Initialize array to the address of the first element of the STL vector
1302 : // (which is guarenteed to be contiguous storage).
1303 : // SgStorageModifier objectArray [] = *(Memory_Block_List.begin());
1304 0 : if (SgStorageModifier::pools.empty() == false)
1305 : {
1306 : // Generate an array of memory pools
1307 0 : SgStorageModifier** objectArray = (SgStorageModifier**) &(SgStorageModifier::pools[0]);
1308 :
1309 : // Build a local variable for better performance
1310 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
1311 :
1312 : // Iterate over the memory pools
1313 0 : bool done = false;
1314 0 : unsigned i=0;
1315 :
1316 : // find the first valid IR node, call visit function, and then leave
1317 0 : while ( done == false && i < SgStorageModifier::pools.size() )
1318 : {
1319 : // objectArray[i] is a single memory pool
1320 : unsigned j=0;
1321 0 : while (done == false && j < SgStorageModifier::pool_size)
1322 : {
1323 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
1324 : {
1325 0 : traversal.visit(&(objectArray[i][j]));
1326 0 : done = true;
1327 : }
1328 0 : j++;
1329 : }
1330 0 : i++;
1331 : }
1332 :
1333 : #if 0
1334 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
1335 : if (done == false)
1336 : {
1337 : printf ("No representative for SgStorageModifier found in memory pools \n");
1338 : }
1339 : #endif
1340 : }
1341 0 : }
1342 :
1343 :
1344 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
1345 : // using values that overflow signed values of int.
1346 : size_t
1347 4 : SgStorageModifier::numberOfNodes()
1348 : {
1349 : // This function traverses the memory pool for an IR node and
1350 : // counts the number of IR nodes of a particular Sage III IR
1351 : // nodes type.
1352 :
1353 4 : size_t count = 0;
1354 4 : if (SgStorageModifier::pools.empty() == false)
1355 : {
1356 : // Generate an array of memory pools (this is actually a STL vector,
1357 : // but it is contiguious, so OK to treat this way).
1358 3 : SgStorageModifier** objectArray = (SgStorageModifier**) &(SgStorageModifier::pools[0]);
1359 :
1360 : // Build a local variable for better performance (make it a loop invariant variable).
1361 3 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
1362 :
1363 : // Iterate over all of the memory pools for this IR node.
1364 33 : for (unsigned int i=0; i < SgStorageModifier::pools.size(); i++)
1365 : {
1366 : // objectArray[i] is a single memory pool, iterate over all the
1367 : // IR nodes and only count those that are valid IR nodes used in
1368 : // the AST (i.e. allocated IR nodes).
1369 60030 : for (unsigned j=0; j < SgStorageModifier::pool_size; j++)
1370 : {
1371 : // This is indexing the STL vector of C/C++ style arrays as a doubly
1372 : // indexed array access. It is OK since we have leveraged the semantics
1373 : // of STL vector memory as contigous and cast the memory as an array
1374 : // of arrays to use the 2D array indexing. Hope this is not confusing,
1375 : // but it s very fast as an implementation.
1376 60000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
1377 : {
1378 55229 : count++;
1379 : }
1380 : }
1381 : }
1382 : }
1383 :
1384 :
1385 :
1386 4 : return count;
1387 : }
1388 :
1389 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
1390 : // using values that overflow signed values of int.
1391 : size_t
1392 0 : SgStorageModifier::memoryUsage()
1393 : {
1394 : // This function is required because we need the class name as a type when we call sizeof
1395 : // There might be another way to implement this if we have a traversal that only called a
1396 : // representative object (one call for each type of Sage IIIIR node).
1397 0 : size_t memory = numberOfNodes() * sizeof(SgStorageModifier);
1398 :
1399 0 : return memory;
1400 : }
1401 :
1402 : /* #line 1403 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
1403 :
1404 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
1405 : void
1406 5342 : SgAccessModifier::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
1407 : {
1408 : // This function traverses the memory pool for only a specific IR node
1409 : // and calls the visit function of the input class execute a traversal
1410 : // similar to the style of the attribute based traversals within ROSE.
1411 : // This traversal will visit ALL nodes of the AST where as the other
1412 : // attribute based traversals visit only the embedded tree within the AST.
1413 :
1414 : // Initialize array to the address of the first element of the STL vector
1415 : // (which is guaranteed to be contiguous storage).
1416 : // SgAccessModifier objectArray [] = *(Memory_Block_List.begin());
1417 5342 : if (SgAccessModifier::pools.empty() == false)
1418 : {
1419 : // Generate an array of memory pools
1420 0 : SgAccessModifier** objectArray = (SgAccessModifier**) &(SgAccessModifier::pools[0]);
1421 :
1422 : // Build a local variable for better performance
1423 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
1424 : #if 0
1425 : // Iterate over the memory pools
1426 : for (unsigned int i=0; i < SgAccessModifier::pools.size(); i++)
1427 : {
1428 : // objectArray[i] is a single memory pool
1429 : for (int j=0; j < SgAccessModifier::pool_size; j++)
1430 : {
1431 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
1432 : {
1433 : traversal.visit(&(objectArray[i][j]));
1434 : }
1435 : }
1436 : }
1437 : #else
1438 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
1439 : // compute the list first and then call the visit function on each list element.
1440 :
1441 : // printf ("Inside of SgAccessModifier::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
1442 :
1443 0 : std::vector<SgAccessModifier*> nodeList;
1444 :
1445 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
1446 0 : for (unsigned int i=0; i < SgAccessModifier::pools.size(); i++)
1447 : {
1448 : // objectArray[i] is a single memory pool
1449 0 : for (unsigned j=0; j < SgAccessModifier::pool_size; j++)
1450 : {
1451 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
1452 : {
1453 0 : nodeList.push_back(&(objectArray[i][j]));
1454 : }
1455 : }
1456 : }
1457 :
1458 : // Iterate over the saved list
1459 0 : size_t nodeListSize = nodeList.size();
1460 0 : for (size_t i=0; i < nodeListSize; i++)
1461 : {
1462 0 : ROSE_ASSERT(nodeList[i] != NULL);
1463 : #if 0
1464 : traversal.visit(nodeList[i]);
1465 : #else
1466 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
1467 : {
1468 0 : traversal.visit(nodeList[i]);
1469 : }
1470 : #endif
1471 : }
1472 : #endif
1473 : }
1474 :
1475 : // This should not be required since all previously static data members are
1476 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
1477 :
1478 5342 : }
1479 :
1480 :
1481 : void
1482 194 : SgAccessModifier::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
1483 : {
1484 : // This function traverses the memory pool for an IR node and
1485 : // calls the function to execute the visitor object.
1486 :
1487 : // Initialize array to the address of the first element of the STL vector
1488 : // (which is guarenteed to be contiguous storage).
1489 : // SgAccessModifier objectArray [] = *(Memory_Block_List.begin());
1490 194 : if (SgAccessModifier::pools.empty() == false)
1491 : {
1492 : // Generate an array of memory pools
1493 0 : SgAccessModifier** objectArray = (SgAccessModifier**) &(SgAccessModifier::pools[0]);
1494 :
1495 : // Build a local variable for better performance
1496 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
1497 :
1498 : // Iterate over the memory pools
1499 0 : for (unsigned int i=0; i < SgAccessModifier::pools.size(); i++)
1500 : {
1501 : // objectArray[i] is a single memory pool
1502 0 : for (unsigned j=0; j < SgAccessModifier::pool_size; j++)
1503 : {
1504 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
1505 : {
1506 : // printf ("Found a valid SgAccessModifier object in the memory pool %d at position %d \n",i,j);
1507 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
1508 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
1509 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
1510 : }
1511 : else
1512 : {
1513 : // printf ("Found a INVALID SgAccessModifier object in the memory pool \n");
1514 : }
1515 : }
1516 : }
1517 : }
1518 :
1519 : // This should not be required since all previously static data members are
1520 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
1521 :
1522 194 : }
1523 :
1524 : void
1525 0 : SgAccessModifier::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
1526 : {
1527 : // This function visits only a single IR node of the memory pool.
1528 : // it is typically called once for each type of IR node within
1529 : // the automatically generated function: traverseRepresentativeNodes().
1530 :
1531 : // Initialize array to the address of the first element of the STL vector
1532 : // (which is guarenteed to be contiguous storage).
1533 : // SgAccessModifier objectArray [] = *(Memory_Block_List.begin());
1534 0 : if (SgAccessModifier::pools.empty() == false)
1535 : {
1536 : // Generate an array of memory pools
1537 0 : SgAccessModifier** objectArray = (SgAccessModifier**) &(SgAccessModifier::pools[0]);
1538 :
1539 : // Build a local variable for better performance
1540 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
1541 :
1542 : // Iterate over the memory pools
1543 0 : bool done = false;
1544 0 : unsigned i=0;
1545 :
1546 : // find the first valid IR node, call visit function, and then leave
1547 0 : while ( done == false && i < SgAccessModifier::pools.size() )
1548 : {
1549 : // objectArray[i] is a single memory pool
1550 : unsigned j=0;
1551 0 : while (done == false && j < SgAccessModifier::pool_size)
1552 : {
1553 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
1554 : {
1555 0 : traversal.visit(&(objectArray[i][j]));
1556 0 : done = true;
1557 : }
1558 0 : j++;
1559 : }
1560 0 : i++;
1561 : }
1562 :
1563 : #if 0
1564 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
1565 : if (done == false)
1566 : {
1567 : printf ("No representative for SgAccessModifier found in memory pools \n");
1568 : }
1569 : #endif
1570 : }
1571 0 : }
1572 :
1573 :
1574 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
1575 : // using values that overflow signed values of int.
1576 : size_t
1577 4 : SgAccessModifier::numberOfNodes()
1578 : {
1579 : // This function traverses the memory pool for an IR node and
1580 : // counts the number of IR nodes of a particular Sage III IR
1581 : // nodes type.
1582 :
1583 4 : size_t count = 0;
1584 4 : if (SgAccessModifier::pools.empty() == false)
1585 : {
1586 : // Generate an array of memory pools (this is actually a STL vector,
1587 : // but it is contiguious, so OK to treat this way).
1588 0 : SgAccessModifier** objectArray = (SgAccessModifier**) &(SgAccessModifier::pools[0]);
1589 :
1590 : // Build a local variable for better performance (make it a loop invariant variable).
1591 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
1592 :
1593 : // Iterate over all of the memory pools for this IR node.
1594 0 : for (unsigned int i=0; i < SgAccessModifier::pools.size(); i++)
1595 : {
1596 : // objectArray[i] is a single memory pool, iterate over all the
1597 : // IR nodes and only count those that are valid IR nodes used in
1598 : // the AST (i.e. allocated IR nodes).
1599 0 : for (unsigned j=0; j < SgAccessModifier::pool_size; j++)
1600 : {
1601 : // This is indexing the STL vector of C/C++ style arrays as a doubly
1602 : // indexed array access. It is OK since we have leveraged the semantics
1603 : // of STL vector memory as contigous and cast the memory as an array
1604 : // of arrays to use the 2D array indexing. Hope this is not confusing,
1605 : // but it s very fast as an implementation.
1606 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
1607 : {
1608 0 : count++;
1609 : }
1610 : }
1611 : }
1612 : }
1613 :
1614 :
1615 :
1616 4 : return count;
1617 : }
1618 :
1619 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
1620 : // using values that overflow signed values of int.
1621 : size_t
1622 0 : SgAccessModifier::memoryUsage()
1623 : {
1624 : // This function is required because we need the class name as a type when we call sizeof
1625 : // There might be another way to implement this if we have a traversal that only called a
1626 : // representative object (one call for each type of Sage IIIIR node).
1627 0 : size_t memory = numberOfNodes() * sizeof(SgAccessModifier);
1628 :
1629 0 : return memory;
1630 : }
1631 :
1632 : /* #line 1633 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
1633 :
1634 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
1635 : void
1636 5342 : SgFunctionModifier::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
1637 : {
1638 : // This function traverses the memory pool for only a specific IR node
1639 : // and calls the visit function of the input class execute a traversal
1640 : // similar to the style of the attribute based traversals within ROSE.
1641 : // This traversal will visit ALL nodes of the AST where as the other
1642 : // attribute based traversals visit only the embedded tree within the AST.
1643 :
1644 : // Initialize array to the address of the first element of the STL vector
1645 : // (which is guaranteed to be contiguous storage).
1646 : // SgFunctionModifier objectArray [] = *(Memory_Block_List.begin());
1647 5342 : if (SgFunctionModifier::pools.empty() == false)
1648 : {
1649 : // Generate an array of memory pools
1650 0 : SgFunctionModifier** objectArray = (SgFunctionModifier**) &(SgFunctionModifier::pools[0]);
1651 :
1652 : // Build a local variable for better performance
1653 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
1654 : #if 0
1655 : // Iterate over the memory pools
1656 : for (unsigned int i=0; i < SgFunctionModifier::pools.size(); i++)
1657 : {
1658 : // objectArray[i] is a single memory pool
1659 : for (int j=0; j < SgFunctionModifier::pool_size; j++)
1660 : {
1661 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
1662 : {
1663 : traversal.visit(&(objectArray[i][j]));
1664 : }
1665 : }
1666 : }
1667 : #else
1668 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
1669 : // compute the list first and then call the visit function on each list element.
1670 :
1671 : // printf ("Inside of SgFunctionModifier::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
1672 :
1673 0 : std::vector<SgFunctionModifier*> nodeList;
1674 :
1675 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
1676 0 : for (unsigned int i=0; i < SgFunctionModifier::pools.size(); i++)
1677 : {
1678 : // objectArray[i] is a single memory pool
1679 0 : for (unsigned j=0; j < SgFunctionModifier::pool_size; j++)
1680 : {
1681 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
1682 : {
1683 0 : nodeList.push_back(&(objectArray[i][j]));
1684 : }
1685 : }
1686 : }
1687 :
1688 : // Iterate over the saved list
1689 0 : size_t nodeListSize = nodeList.size();
1690 0 : for (size_t i=0; i < nodeListSize; i++)
1691 : {
1692 0 : ROSE_ASSERT(nodeList[i] != NULL);
1693 : #if 0
1694 : traversal.visit(nodeList[i]);
1695 : #else
1696 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
1697 : {
1698 0 : traversal.visit(nodeList[i]);
1699 : }
1700 : #endif
1701 : }
1702 : #endif
1703 : }
1704 :
1705 : // This should not be required since all previously static data members are
1706 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
1707 :
1708 5342 : }
1709 :
1710 :
1711 : void
1712 194 : SgFunctionModifier::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
1713 : {
1714 : // This function traverses the memory pool for an IR node and
1715 : // calls the function to execute the visitor object.
1716 :
1717 : // Initialize array to the address of the first element of the STL vector
1718 : // (which is guarenteed to be contiguous storage).
1719 : // SgFunctionModifier objectArray [] = *(Memory_Block_List.begin());
1720 194 : if (SgFunctionModifier::pools.empty() == false)
1721 : {
1722 : // Generate an array of memory pools
1723 0 : SgFunctionModifier** objectArray = (SgFunctionModifier**) &(SgFunctionModifier::pools[0]);
1724 :
1725 : // Build a local variable for better performance
1726 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
1727 :
1728 : // Iterate over the memory pools
1729 0 : for (unsigned int i=0; i < SgFunctionModifier::pools.size(); i++)
1730 : {
1731 : // objectArray[i] is a single memory pool
1732 0 : for (unsigned j=0; j < SgFunctionModifier::pool_size; j++)
1733 : {
1734 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
1735 : {
1736 : // printf ("Found a valid SgFunctionModifier object in the memory pool %d at position %d \n",i,j);
1737 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
1738 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
1739 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
1740 : }
1741 : else
1742 : {
1743 : // printf ("Found a INVALID SgFunctionModifier object in the memory pool \n");
1744 : }
1745 : }
1746 : }
1747 : }
1748 :
1749 : // This should not be required since all previously static data members are
1750 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
1751 :
1752 194 : }
1753 :
1754 : void
1755 0 : SgFunctionModifier::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
1756 : {
1757 : // This function visits only a single IR node of the memory pool.
1758 : // it is typically called once for each type of IR node within
1759 : // the automatically generated function: traverseRepresentativeNodes().
1760 :
1761 : // Initialize array to the address of the first element of the STL vector
1762 : // (which is guarenteed to be contiguous storage).
1763 : // SgFunctionModifier objectArray [] = *(Memory_Block_List.begin());
1764 0 : if (SgFunctionModifier::pools.empty() == false)
1765 : {
1766 : // Generate an array of memory pools
1767 0 : SgFunctionModifier** objectArray = (SgFunctionModifier**) &(SgFunctionModifier::pools[0]);
1768 :
1769 : // Build a local variable for better performance
1770 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
1771 :
1772 : // Iterate over the memory pools
1773 0 : bool done = false;
1774 0 : unsigned i=0;
1775 :
1776 : // find the first valid IR node, call visit function, and then leave
1777 0 : while ( done == false && i < SgFunctionModifier::pools.size() )
1778 : {
1779 : // objectArray[i] is a single memory pool
1780 : unsigned j=0;
1781 0 : while (done == false && j < SgFunctionModifier::pool_size)
1782 : {
1783 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
1784 : {
1785 0 : traversal.visit(&(objectArray[i][j]));
1786 0 : done = true;
1787 : }
1788 0 : j++;
1789 : }
1790 0 : i++;
1791 : }
1792 :
1793 : #if 0
1794 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
1795 : if (done == false)
1796 : {
1797 : printf ("No representative for SgFunctionModifier found in memory pools \n");
1798 : }
1799 : #endif
1800 : }
1801 0 : }
1802 :
1803 :
1804 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
1805 : // using values that overflow signed values of int.
1806 : size_t
1807 4 : SgFunctionModifier::numberOfNodes()
1808 : {
1809 : // This function traverses the memory pool for an IR node and
1810 : // counts the number of IR nodes of a particular Sage III IR
1811 : // nodes type.
1812 :
1813 4 : size_t count = 0;
1814 4 : if (SgFunctionModifier::pools.empty() == false)
1815 : {
1816 : // Generate an array of memory pools (this is actually a STL vector,
1817 : // but it is contiguious, so OK to treat this way).
1818 0 : SgFunctionModifier** objectArray = (SgFunctionModifier**) &(SgFunctionModifier::pools[0]);
1819 :
1820 : // Build a local variable for better performance (make it a loop invariant variable).
1821 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
1822 :
1823 : // Iterate over all of the memory pools for this IR node.
1824 0 : for (unsigned int i=0; i < SgFunctionModifier::pools.size(); i++)
1825 : {
1826 : // objectArray[i] is a single memory pool, iterate over all the
1827 : // IR nodes and only count those that are valid IR nodes used in
1828 : // the AST (i.e. allocated IR nodes).
1829 0 : for (unsigned j=0; j < SgFunctionModifier::pool_size; j++)
1830 : {
1831 : // This is indexing the STL vector of C/C++ style arrays as a doubly
1832 : // indexed array access. It is OK since we have leveraged the semantics
1833 : // of STL vector memory as contigous and cast the memory as an array
1834 : // of arrays to use the 2D array indexing. Hope this is not confusing,
1835 : // but it s very fast as an implementation.
1836 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
1837 : {
1838 0 : count++;
1839 : }
1840 : }
1841 : }
1842 : }
1843 :
1844 :
1845 :
1846 4 : return count;
1847 : }
1848 :
1849 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
1850 : // using values that overflow signed values of int.
1851 : size_t
1852 0 : SgFunctionModifier::memoryUsage()
1853 : {
1854 : // This function is required because we need the class name as a type when we call sizeof
1855 : // There might be another way to implement this if we have a traversal that only called a
1856 : // representative object (one call for each type of Sage IIIIR node).
1857 0 : size_t memory = numberOfNodes() * sizeof(SgFunctionModifier);
1858 :
1859 0 : return memory;
1860 : }
1861 :
1862 : /* #line 1863 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
1863 :
1864 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
1865 : void
1866 5342 : SgUPC_AccessModifier::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
1867 : {
1868 : // This function traverses the memory pool for only a specific IR node
1869 : // and calls the visit function of the input class execute a traversal
1870 : // similar to the style of the attribute based traversals within ROSE.
1871 : // This traversal will visit ALL nodes of the AST where as the other
1872 : // attribute based traversals visit only the embedded tree within the AST.
1873 :
1874 : // Initialize array to the address of the first element of the STL vector
1875 : // (which is guaranteed to be contiguous storage).
1876 : // SgUPC_AccessModifier objectArray [] = *(Memory_Block_List.begin());
1877 5342 : if (SgUPC_AccessModifier::pools.empty() == false)
1878 : {
1879 : // Generate an array of memory pools
1880 0 : SgUPC_AccessModifier** objectArray = (SgUPC_AccessModifier**) &(SgUPC_AccessModifier::pools[0]);
1881 :
1882 : // Build a local variable for better performance
1883 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
1884 : #if 0
1885 : // Iterate over the memory pools
1886 : for (unsigned int i=0; i < SgUPC_AccessModifier::pools.size(); i++)
1887 : {
1888 : // objectArray[i] is a single memory pool
1889 : for (int j=0; j < SgUPC_AccessModifier::pool_size; j++)
1890 : {
1891 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
1892 : {
1893 : traversal.visit(&(objectArray[i][j]));
1894 : }
1895 : }
1896 : }
1897 : #else
1898 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
1899 : // compute the list first and then call the visit function on each list element.
1900 :
1901 : // printf ("Inside of SgUPC_AccessModifier::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
1902 :
1903 0 : std::vector<SgUPC_AccessModifier*> nodeList;
1904 :
1905 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
1906 0 : for (unsigned int i=0; i < SgUPC_AccessModifier::pools.size(); i++)
1907 : {
1908 : // objectArray[i] is a single memory pool
1909 0 : for (unsigned j=0; j < SgUPC_AccessModifier::pool_size; j++)
1910 : {
1911 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
1912 : {
1913 0 : nodeList.push_back(&(objectArray[i][j]));
1914 : }
1915 : }
1916 : }
1917 :
1918 : // Iterate over the saved list
1919 0 : size_t nodeListSize = nodeList.size();
1920 0 : for (size_t i=0; i < nodeListSize; i++)
1921 : {
1922 0 : ROSE_ASSERT(nodeList[i] != NULL);
1923 : #if 0
1924 : traversal.visit(nodeList[i]);
1925 : #else
1926 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
1927 : {
1928 0 : traversal.visit(nodeList[i]);
1929 : }
1930 : #endif
1931 : }
1932 : #endif
1933 : }
1934 :
1935 : // This should not be required since all previously static data members are
1936 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
1937 :
1938 5342 : }
1939 :
1940 :
1941 : void
1942 194 : SgUPC_AccessModifier::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
1943 : {
1944 : // This function traverses the memory pool for an IR node and
1945 : // calls the function to execute the visitor object.
1946 :
1947 : // Initialize array to the address of the first element of the STL vector
1948 : // (which is guarenteed to be contiguous storage).
1949 : // SgUPC_AccessModifier objectArray [] = *(Memory_Block_List.begin());
1950 194 : if (SgUPC_AccessModifier::pools.empty() == false)
1951 : {
1952 : // Generate an array of memory pools
1953 0 : SgUPC_AccessModifier** objectArray = (SgUPC_AccessModifier**) &(SgUPC_AccessModifier::pools[0]);
1954 :
1955 : // Build a local variable for better performance
1956 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
1957 :
1958 : // Iterate over the memory pools
1959 0 : for (unsigned int i=0; i < SgUPC_AccessModifier::pools.size(); i++)
1960 : {
1961 : // objectArray[i] is a single memory pool
1962 0 : for (unsigned j=0; j < SgUPC_AccessModifier::pool_size; j++)
1963 : {
1964 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
1965 : {
1966 : // printf ("Found a valid SgUPC_AccessModifier object in the memory pool %d at position %d \n",i,j);
1967 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
1968 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
1969 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
1970 : }
1971 : else
1972 : {
1973 : // printf ("Found a INVALID SgUPC_AccessModifier object in the memory pool \n");
1974 : }
1975 : }
1976 : }
1977 : }
1978 :
1979 : // This should not be required since all previously static data members are
1980 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
1981 :
1982 194 : }
1983 :
1984 : void
1985 0 : SgUPC_AccessModifier::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
1986 : {
1987 : // This function visits only a single IR node of the memory pool.
1988 : // it is typically called once for each type of IR node within
1989 : // the automatically generated function: traverseRepresentativeNodes().
1990 :
1991 : // Initialize array to the address of the first element of the STL vector
1992 : // (which is guarenteed to be contiguous storage).
1993 : // SgUPC_AccessModifier objectArray [] = *(Memory_Block_List.begin());
1994 0 : if (SgUPC_AccessModifier::pools.empty() == false)
1995 : {
1996 : // Generate an array of memory pools
1997 0 : SgUPC_AccessModifier** objectArray = (SgUPC_AccessModifier**) &(SgUPC_AccessModifier::pools[0]);
1998 :
1999 : // Build a local variable for better performance
2000 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
2001 :
2002 : // Iterate over the memory pools
2003 0 : bool done = false;
2004 0 : unsigned i=0;
2005 :
2006 : // find the first valid IR node, call visit function, and then leave
2007 0 : while ( done == false && i < SgUPC_AccessModifier::pools.size() )
2008 : {
2009 : // objectArray[i] is a single memory pool
2010 : unsigned j=0;
2011 0 : while (done == false && j < SgUPC_AccessModifier::pool_size)
2012 : {
2013 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
2014 : {
2015 0 : traversal.visit(&(objectArray[i][j]));
2016 0 : done = true;
2017 : }
2018 0 : j++;
2019 : }
2020 0 : i++;
2021 : }
2022 :
2023 : #if 0
2024 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
2025 : if (done == false)
2026 : {
2027 : printf ("No representative for SgUPC_AccessModifier found in memory pools \n");
2028 : }
2029 : #endif
2030 : }
2031 0 : }
2032 :
2033 :
2034 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
2035 : // using values that overflow signed values of int.
2036 : size_t
2037 4 : SgUPC_AccessModifier::numberOfNodes()
2038 : {
2039 : // This function traverses the memory pool for an IR node and
2040 : // counts the number of IR nodes of a particular Sage III IR
2041 : // nodes type.
2042 :
2043 4 : size_t count = 0;
2044 4 : if (SgUPC_AccessModifier::pools.empty() == false)
2045 : {
2046 : // Generate an array of memory pools (this is actually a STL vector,
2047 : // but it is contiguious, so OK to treat this way).
2048 0 : SgUPC_AccessModifier** objectArray = (SgUPC_AccessModifier**) &(SgUPC_AccessModifier::pools[0]);
2049 :
2050 : // Build a local variable for better performance (make it a loop invariant variable).
2051 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
2052 :
2053 : // Iterate over all of the memory pools for this IR node.
2054 0 : for (unsigned int i=0; i < SgUPC_AccessModifier::pools.size(); i++)
2055 : {
2056 : // objectArray[i] is a single memory pool, iterate over all the
2057 : // IR nodes and only count those that are valid IR nodes used in
2058 : // the AST (i.e. allocated IR nodes).
2059 0 : for (unsigned j=0; j < SgUPC_AccessModifier::pool_size; j++)
2060 : {
2061 : // This is indexing the STL vector of C/C++ style arrays as a doubly
2062 : // indexed array access. It is OK since we have leveraged the semantics
2063 : // of STL vector memory as contigous and cast the memory as an array
2064 : // of arrays to use the 2D array indexing. Hope this is not confusing,
2065 : // but it s very fast as an implementation.
2066 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
2067 : {
2068 0 : count++;
2069 : }
2070 : }
2071 : }
2072 : }
2073 :
2074 :
2075 :
2076 4 : return count;
2077 : }
2078 :
2079 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
2080 : // using values that overflow signed values of int.
2081 : size_t
2082 0 : SgUPC_AccessModifier::memoryUsage()
2083 : {
2084 : // This function is required because we need the class name as a type when we call sizeof
2085 : // There might be another way to implement this if we have a traversal that only called a
2086 : // representative object (one call for each type of Sage IIIIR node).
2087 0 : size_t memory = numberOfNodes() * sizeof(SgUPC_AccessModifier);
2088 :
2089 0 : return memory;
2090 : }
2091 :
2092 : /* #line 2093 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
2093 :
2094 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
2095 : void
2096 5342 : SgSpecialFunctionModifier::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
2097 : {
2098 : // This function traverses the memory pool for only a specific IR node
2099 : // and calls the visit function of the input class execute a traversal
2100 : // similar to the style of the attribute based traversals within ROSE.
2101 : // This traversal will visit ALL nodes of the AST where as the other
2102 : // attribute based traversals visit only the embedded tree within the AST.
2103 :
2104 : // Initialize array to the address of the first element of the STL vector
2105 : // (which is guaranteed to be contiguous storage).
2106 : // SgSpecialFunctionModifier objectArray [] = *(Memory_Block_List.begin());
2107 5342 : if (SgSpecialFunctionModifier::pools.empty() == false)
2108 : {
2109 : // Generate an array of memory pools
2110 0 : SgSpecialFunctionModifier** objectArray = (SgSpecialFunctionModifier**) &(SgSpecialFunctionModifier::pools[0]);
2111 :
2112 : // Build a local variable for better performance
2113 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
2114 : #if 0
2115 : // Iterate over the memory pools
2116 : for (unsigned int i=0; i < SgSpecialFunctionModifier::pools.size(); i++)
2117 : {
2118 : // objectArray[i] is a single memory pool
2119 : for (int j=0; j < SgSpecialFunctionModifier::pool_size; j++)
2120 : {
2121 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
2122 : {
2123 : traversal.visit(&(objectArray[i][j]));
2124 : }
2125 : }
2126 : }
2127 : #else
2128 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
2129 : // compute the list first and then call the visit function on each list element.
2130 :
2131 : // printf ("Inside of SgSpecialFunctionModifier::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
2132 :
2133 0 : std::vector<SgSpecialFunctionModifier*> nodeList;
2134 :
2135 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
2136 0 : for (unsigned int i=0; i < SgSpecialFunctionModifier::pools.size(); i++)
2137 : {
2138 : // objectArray[i] is a single memory pool
2139 0 : for (unsigned j=0; j < SgSpecialFunctionModifier::pool_size; j++)
2140 : {
2141 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
2142 : {
2143 0 : nodeList.push_back(&(objectArray[i][j]));
2144 : }
2145 : }
2146 : }
2147 :
2148 : // Iterate over the saved list
2149 0 : size_t nodeListSize = nodeList.size();
2150 0 : for (size_t i=0; i < nodeListSize; i++)
2151 : {
2152 0 : ROSE_ASSERT(nodeList[i] != NULL);
2153 : #if 0
2154 : traversal.visit(nodeList[i]);
2155 : #else
2156 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
2157 : {
2158 0 : traversal.visit(nodeList[i]);
2159 : }
2160 : #endif
2161 : }
2162 : #endif
2163 : }
2164 :
2165 : // This should not be required since all previously static data members are
2166 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
2167 :
2168 5342 : }
2169 :
2170 :
2171 : void
2172 194 : SgSpecialFunctionModifier::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
2173 : {
2174 : // This function traverses the memory pool for an IR node and
2175 : // calls the function to execute the visitor object.
2176 :
2177 : // Initialize array to the address of the first element of the STL vector
2178 : // (which is guarenteed to be contiguous storage).
2179 : // SgSpecialFunctionModifier objectArray [] = *(Memory_Block_List.begin());
2180 194 : if (SgSpecialFunctionModifier::pools.empty() == false)
2181 : {
2182 : // Generate an array of memory pools
2183 0 : SgSpecialFunctionModifier** objectArray = (SgSpecialFunctionModifier**) &(SgSpecialFunctionModifier::pools[0]);
2184 :
2185 : // Build a local variable for better performance
2186 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
2187 :
2188 : // Iterate over the memory pools
2189 0 : for (unsigned int i=0; i < SgSpecialFunctionModifier::pools.size(); i++)
2190 : {
2191 : // objectArray[i] is a single memory pool
2192 0 : for (unsigned j=0; j < SgSpecialFunctionModifier::pool_size; j++)
2193 : {
2194 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
2195 : {
2196 : // printf ("Found a valid SgSpecialFunctionModifier object in the memory pool %d at position %d \n",i,j);
2197 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
2198 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
2199 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
2200 : }
2201 : else
2202 : {
2203 : // printf ("Found a INVALID SgSpecialFunctionModifier object in the memory pool \n");
2204 : }
2205 : }
2206 : }
2207 : }
2208 :
2209 : // This should not be required since all previously static data members are
2210 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
2211 :
2212 194 : }
2213 :
2214 : void
2215 0 : SgSpecialFunctionModifier::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
2216 : {
2217 : // This function visits only a single IR node of the memory pool.
2218 : // it is typically called once for each type of IR node within
2219 : // the automatically generated function: traverseRepresentativeNodes().
2220 :
2221 : // Initialize array to the address of the first element of the STL vector
2222 : // (which is guarenteed to be contiguous storage).
2223 : // SgSpecialFunctionModifier objectArray [] = *(Memory_Block_List.begin());
2224 0 : if (SgSpecialFunctionModifier::pools.empty() == false)
2225 : {
2226 : // Generate an array of memory pools
2227 0 : SgSpecialFunctionModifier** objectArray = (SgSpecialFunctionModifier**) &(SgSpecialFunctionModifier::pools[0]);
2228 :
2229 : // Build a local variable for better performance
2230 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
2231 :
2232 : // Iterate over the memory pools
2233 0 : bool done = false;
2234 0 : unsigned i=0;
2235 :
2236 : // find the first valid IR node, call visit function, and then leave
2237 0 : while ( done == false && i < SgSpecialFunctionModifier::pools.size() )
2238 : {
2239 : // objectArray[i] is a single memory pool
2240 : unsigned j=0;
2241 0 : while (done == false && j < SgSpecialFunctionModifier::pool_size)
2242 : {
2243 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
2244 : {
2245 0 : traversal.visit(&(objectArray[i][j]));
2246 0 : done = true;
2247 : }
2248 0 : j++;
2249 : }
2250 0 : i++;
2251 : }
2252 :
2253 : #if 0
2254 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
2255 : if (done == false)
2256 : {
2257 : printf ("No representative for SgSpecialFunctionModifier found in memory pools \n");
2258 : }
2259 : #endif
2260 : }
2261 0 : }
2262 :
2263 :
2264 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
2265 : // using values that overflow signed values of int.
2266 : size_t
2267 4 : SgSpecialFunctionModifier::numberOfNodes()
2268 : {
2269 : // This function traverses the memory pool for an IR node and
2270 : // counts the number of IR nodes of a particular Sage III IR
2271 : // nodes type.
2272 :
2273 4 : size_t count = 0;
2274 4 : if (SgSpecialFunctionModifier::pools.empty() == false)
2275 : {
2276 : // Generate an array of memory pools (this is actually a STL vector,
2277 : // but it is contiguious, so OK to treat this way).
2278 0 : SgSpecialFunctionModifier** objectArray = (SgSpecialFunctionModifier**) &(SgSpecialFunctionModifier::pools[0]);
2279 :
2280 : // Build a local variable for better performance (make it a loop invariant variable).
2281 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
2282 :
2283 : // Iterate over all of the memory pools for this IR node.
2284 0 : for (unsigned int i=0; i < SgSpecialFunctionModifier::pools.size(); i++)
2285 : {
2286 : // objectArray[i] is a single memory pool, iterate over all the
2287 : // IR nodes and only count those that are valid IR nodes used in
2288 : // the AST (i.e. allocated IR nodes).
2289 0 : for (unsigned j=0; j < SgSpecialFunctionModifier::pool_size; j++)
2290 : {
2291 : // This is indexing the STL vector of C/C++ style arrays as a doubly
2292 : // indexed array access. It is OK since we have leveraged the semantics
2293 : // of STL vector memory as contigous and cast the memory as an array
2294 : // of arrays to use the 2D array indexing. Hope this is not confusing,
2295 : // but it s very fast as an implementation.
2296 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
2297 : {
2298 0 : count++;
2299 : }
2300 : }
2301 : }
2302 : }
2303 :
2304 :
2305 :
2306 4 : return count;
2307 : }
2308 :
2309 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
2310 : // using values that overflow signed values of int.
2311 : size_t
2312 0 : SgSpecialFunctionModifier::memoryUsage()
2313 : {
2314 : // This function is required because we need the class name as a type when we call sizeof
2315 : // There might be another way to implement this if we have a traversal that only called a
2316 : // representative object (one call for each type of Sage IIIIR node).
2317 0 : size_t memory = numberOfNodes() * sizeof(SgSpecialFunctionModifier);
2318 :
2319 0 : return memory;
2320 : }
2321 :
2322 : /* #line 2323 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
2323 :
2324 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
2325 : void
2326 5342 : SgElaboratedTypeModifier::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
2327 : {
2328 : // This function traverses the memory pool for only a specific IR node
2329 : // and calls the visit function of the input class execute a traversal
2330 : // similar to the style of the attribute based traversals within ROSE.
2331 : // This traversal will visit ALL nodes of the AST where as the other
2332 : // attribute based traversals visit only the embedded tree within the AST.
2333 :
2334 : // Initialize array to the address of the first element of the STL vector
2335 : // (which is guaranteed to be contiguous storage).
2336 : // SgElaboratedTypeModifier objectArray [] = *(Memory_Block_List.begin());
2337 5342 : if (SgElaboratedTypeModifier::pools.empty() == false)
2338 : {
2339 : // Generate an array of memory pools
2340 0 : SgElaboratedTypeModifier** objectArray = (SgElaboratedTypeModifier**) &(SgElaboratedTypeModifier::pools[0]);
2341 :
2342 : // Build a local variable for better performance
2343 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
2344 : #if 0
2345 : // Iterate over the memory pools
2346 : for (unsigned int i=0; i < SgElaboratedTypeModifier::pools.size(); i++)
2347 : {
2348 : // objectArray[i] is a single memory pool
2349 : for (int j=0; j < SgElaboratedTypeModifier::pool_size; j++)
2350 : {
2351 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
2352 : {
2353 : traversal.visit(&(objectArray[i][j]));
2354 : }
2355 : }
2356 : }
2357 : #else
2358 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
2359 : // compute the list first and then call the visit function on each list element.
2360 :
2361 : // printf ("Inside of SgElaboratedTypeModifier::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
2362 :
2363 0 : std::vector<SgElaboratedTypeModifier*> nodeList;
2364 :
2365 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
2366 0 : for (unsigned int i=0; i < SgElaboratedTypeModifier::pools.size(); i++)
2367 : {
2368 : // objectArray[i] is a single memory pool
2369 0 : for (unsigned j=0; j < SgElaboratedTypeModifier::pool_size; j++)
2370 : {
2371 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
2372 : {
2373 0 : nodeList.push_back(&(objectArray[i][j]));
2374 : }
2375 : }
2376 : }
2377 :
2378 : // Iterate over the saved list
2379 0 : size_t nodeListSize = nodeList.size();
2380 0 : for (size_t i=0; i < nodeListSize; i++)
2381 : {
2382 0 : ROSE_ASSERT(nodeList[i] != NULL);
2383 : #if 0
2384 : traversal.visit(nodeList[i]);
2385 : #else
2386 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
2387 : {
2388 0 : traversal.visit(nodeList[i]);
2389 : }
2390 : #endif
2391 : }
2392 : #endif
2393 : }
2394 :
2395 : // This should not be required since all previously static data members are
2396 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
2397 :
2398 5342 : }
2399 :
2400 :
2401 : void
2402 194 : SgElaboratedTypeModifier::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
2403 : {
2404 : // This function traverses the memory pool for an IR node and
2405 : // calls the function to execute the visitor object.
2406 :
2407 : // Initialize array to the address of the first element of the STL vector
2408 : // (which is guarenteed to be contiguous storage).
2409 : // SgElaboratedTypeModifier objectArray [] = *(Memory_Block_List.begin());
2410 194 : if (SgElaboratedTypeModifier::pools.empty() == false)
2411 : {
2412 : // Generate an array of memory pools
2413 0 : SgElaboratedTypeModifier** objectArray = (SgElaboratedTypeModifier**) &(SgElaboratedTypeModifier::pools[0]);
2414 :
2415 : // Build a local variable for better performance
2416 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
2417 :
2418 : // Iterate over the memory pools
2419 0 : for (unsigned int i=0; i < SgElaboratedTypeModifier::pools.size(); i++)
2420 : {
2421 : // objectArray[i] is a single memory pool
2422 0 : for (unsigned j=0; j < SgElaboratedTypeModifier::pool_size; j++)
2423 : {
2424 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
2425 : {
2426 : // printf ("Found a valid SgElaboratedTypeModifier object in the memory pool %d at position %d \n",i,j);
2427 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
2428 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
2429 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
2430 : }
2431 : else
2432 : {
2433 : // printf ("Found a INVALID SgElaboratedTypeModifier object in the memory pool \n");
2434 : }
2435 : }
2436 : }
2437 : }
2438 :
2439 : // This should not be required since all previously static data members are
2440 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
2441 :
2442 194 : }
2443 :
2444 : void
2445 0 : SgElaboratedTypeModifier::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
2446 : {
2447 : // This function visits only a single IR node of the memory pool.
2448 : // it is typically called once for each type of IR node within
2449 : // the automatically generated function: traverseRepresentativeNodes().
2450 :
2451 : // Initialize array to the address of the first element of the STL vector
2452 : // (which is guarenteed to be contiguous storage).
2453 : // SgElaboratedTypeModifier objectArray [] = *(Memory_Block_List.begin());
2454 0 : if (SgElaboratedTypeModifier::pools.empty() == false)
2455 : {
2456 : // Generate an array of memory pools
2457 0 : SgElaboratedTypeModifier** objectArray = (SgElaboratedTypeModifier**) &(SgElaboratedTypeModifier::pools[0]);
2458 :
2459 : // Build a local variable for better performance
2460 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
2461 :
2462 : // Iterate over the memory pools
2463 0 : bool done = false;
2464 0 : unsigned i=0;
2465 :
2466 : // find the first valid IR node, call visit function, and then leave
2467 0 : while ( done == false && i < SgElaboratedTypeModifier::pools.size() )
2468 : {
2469 : // objectArray[i] is a single memory pool
2470 : unsigned j=0;
2471 0 : while (done == false && j < SgElaboratedTypeModifier::pool_size)
2472 : {
2473 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
2474 : {
2475 0 : traversal.visit(&(objectArray[i][j]));
2476 0 : done = true;
2477 : }
2478 0 : j++;
2479 : }
2480 0 : i++;
2481 : }
2482 :
2483 : #if 0
2484 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
2485 : if (done == false)
2486 : {
2487 : printf ("No representative for SgElaboratedTypeModifier found in memory pools \n");
2488 : }
2489 : #endif
2490 : }
2491 0 : }
2492 :
2493 :
2494 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
2495 : // using values that overflow signed values of int.
2496 : size_t
2497 4 : SgElaboratedTypeModifier::numberOfNodes()
2498 : {
2499 : // This function traverses the memory pool for an IR node and
2500 : // counts the number of IR nodes of a particular Sage III IR
2501 : // nodes type.
2502 :
2503 4 : size_t count = 0;
2504 4 : if (SgElaboratedTypeModifier::pools.empty() == false)
2505 : {
2506 : // Generate an array of memory pools (this is actually a STL vector,
2507 : // but it is contiguious, so OK to treat this way).
2508 0 : SgElaboratedTypeModifier** objectArray = (SgElaboratedTypeModifier**) &(SgElaboratedTypeModifier::pools[0]);
2509 :
2510 : // Build a local variable for better performance (make it a loop invariant variable).
2511 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
2512 :
2513 : // Iterate over all of the memory pools for this IR node.
2514 0 : for (unsigned int i=0; i < SgElaboratedTypeModifier::pools.size(); i++)
2515 : {
2516 : // objectArray[i] is a single memory pool, iterate over all the
2517 : // IR nodes and only count those that are valid IR nodes used in
2518 : // the AST (i.e. allocated IR nodes).
2519 0 : for (unsigned j=0; j < SgElaboratedTypeModifier::pool_size; j++)
2520 : {
2521 : // This is indexing the STL vector of C/C++ style arrays as a doubly
2522 : // indexed array access. It is OK since we have leveraged the semantics
2523 : // of STL vector memory as contigous and cast the memory as an array
2524 : // of arrays to use the 2D array indexing. Hope this is not confusing,
2525 : // but it s very fast as an implementation.
2526 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
2527 : {
2528 0 : count++;
2529 : }
2530 : }
2531 : }
2532 : }
2533 :
2534 :
2535 :
2536 4 : return count;
2537 : }
2538 :
2539 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
2540 : // using values that overflow signed values of int.
2541 : size_t
2542 0 : SgElaboratedTypeModifier::memoryUsage()
2543 : {
2544 : // This function is required because we need the class name as a type when we call sizeof
2545 : // There might be another way to implement this if we have a traversal that only called a
2546 : // representative object (one call for each type of Sage IIIIR node).
2547 0 : size_t memory = numberOfNodes() * sizeof(SgElaboratedTypeModifier);
2548 :
2549 0 : return memory;
2550 : }
2551 :
2552 : /* #line 2553 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
2553 :
2554 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
2555 : void
2556 5342 : SgLinkageModifier::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
2557 : {
2558 : // This function traverses the memory pool for only a specific IR node
2559 : // and calls the visit function of the input class execute a traversal
2560 : // similar to the style of the attribute based traversals within ROSE.
2561 : // This traversal will visit ALL nodes of the AST where as the other
2562 : // attribute based traversals visit only the embedded tree within the AST.
2563 :
2564 : // Initialize array to the address of the first element of the STL vector
2565 : // (which is guaranteed to be contiguous storage).
2566 : // SgLinkageModifier objectArray [] = *(Memory_Block_List.begin());
2567 5342 : if (SgLinkageModifier::pools.empty() == false)
2568 : {
2569 : // Generate an array of memory pools
2570 0 : SgLinkageModifier** objectArray = (SgLinkageModifier**) &(SgLinkageModifier::pools[0]);
2571 :
2572 : // Build a local variable for better performance
2573 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
2574 : #if 0
2575 : // Iterate over the memory pools
2576 : for (unsigned int i=0; i < SgLinkageModifier::pools.size(); i++)
2577 : {
2578 : // objectArray[i] is a single memory pool
2579 : for (int j=0; j < SgLinkageModifier::pool_size; j++)
2580 : {
2581 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
2582 : {
2583 : traversal.visit(&(objectArray[i][j]));
2584 : }
2585 : }
2586 : }
2587 : #else
2588 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
2589 : // compute the list first and then call the visit function on each list element.
2590 :
2591 : // printf ("Inside of SgLinkageModifier::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
2592 :
2593 0 : std::vector<SgLinkageModifier*> nodeList;
2594 :
2595 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
2596 0 : for (unsigned int i=0; i < SgLinkageModifier::pools.size(); i++)
2597 : {
2598 : // objectArray[i] is a single memory pool
2599 0 : for (unsigned j=0; j < SgLinkageModifier::pool_size; j++)
2600 : {
2601 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
2602 : {
2603 0 : nodeList.push_back(&(objectArray[i][j]));
2604 : }
2605 : }
2606 : }
2607 :
2608 : // Iterate over the saved list
2609 0 : size_t nodeListSize = nodeList.size();
2610 0 : for (size_t i=0; i < nodeListSize; i++)
2611 : {
2612 0 : ROSE_ASSERT(nodeList[i] != NULL);
2613 : #if 0
2614 : traversal.visit(nodeList[i]);
2615 : #else
2616 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
2617 : {
2618 0 : traversal.visit(nodeList[i]);
2619 : }
2620 : #endif
2621 : }
2622 : #endif
2623 : }
2624 :
2625 : // This should not be required since all previously static data members are
2626 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
2627 :
2628 5342 : }
2629 :
2630 :
2631 : void
2632 194 : SgLinkageModifier::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
2633 : {
2634 : // This function traverses the memory pool for an IR node and
2635 : // calls the function to execute the visitor object.
2636 :
2637 : // Initialize array to the address of the first element of the STL vector
2638 : // (which is guarenteed to be contiguous storage).
2639 : // SgLinkageModifier objectArray [] = *(Memory_Block_List.begin());
2640 194 : if (SgLinkageModifier::pools.empty() == false)
2641 : {
2642 : // Generate an array of memory pools
2643 0 : SgLinkageModifier** objectArray = (SgLinkageModifier**) &(SgLinkageModifier::pools[0]);
2644 :
2645 : // Build a local variable for better performance
2646 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
2647 :
2648 : // Iterate over the memory pools
2649 0 : for (unsigned int i=0; i < SgLinkageModifier::pools.size(); i++)
2650 : {
2651 : // objectArray[i] is a single memory pool
2652 0 : for (unsigned j=0; j < SgLinkageModifier::pool_size; j++)
2653 : {
2654 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
2655 : {
2656 : // printf ("Found a valid SgLinkageModifier object in the memory pool %d at position %d \n",i,j);
2657 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
2658 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
2659 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
2660 : }
2661 : else
2662 : {
2663 : // printf ("Found a INVALID SgLinkageModifier object in the memory pool \n");
2664 : }
2665 : }
2666 : }
2667 : }
2668 :
2669 : // This should not be required since all previously static data members are
2670 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
2671 :
2672 194 : }
2673 :
2674 : void
2675 0 : SgLinkageModifier::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
2676 : {
2677 : // This function visits only a single IR node of the memory pool.
2678 : // it is typically called once for each type of IR node within
2679 : // the automatically generated function: traverseRepresentativeNodes().
2680 :
2681 : // Initialize array to the address of the first element of the STL vector
2682 : // (which is guarenteed to be contiguous storage).
2683 : // SgLinkageModifier objectArray [] = *(Memory_Block_List.begin());
2684 0 : if (SgLinkageModifier::pools.empty() == false)
2685 : {
2686 : // Generate an array of memory pools
2687 0 : SgLinkageModifier** objectArray = (SgLinkageModifier**) &(SgLinkageModifier::pools[0]);
2688 :
2689 : // Build a local variable for better performance
2690 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
2691 :
2692 : // Iterate over the memory pools
2693 0 : bool done = false;
2694 0 : unsigned i=0;
2695 :
2696 : // find the first valid IR node, call visit function, and then leave
2697 0 : while ( done == false && i < SgLinkageModifier::pools.size() )
2698 : {
2699 : // objectArray[i] is a single memory pool
2700 : unsigned j=0;
2701 0 : while (done == false && j < SgLinkageModifier::pool_size)
2702 : {
2703 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
2704 : {
2705 0 : traversal.visit(&(objectArray[i][j]));
2706 0 : done = true;
2707 : }
2708 0 : j++;
2709 : }
2710 0 : i++;
2711 : }
2712 :
2713 : #if 0
2714 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
2715 : if (done == false)
2716 : {
2717 : printf ("No representative for SgLinkageModifier found in memory pools \n");
2718 : }
2719 : #endif
2720 : }
2721 0 : }
2722 :
2723 :
2724 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
2725 : // using values that overflow signed values of int.
2726 : size_t
2727 4 : SgLinkageModifier::numberOfNodes()
2728 : {
2729 : // This function traverses the memory pool for an IR node and
2730 : // counts the number of IR nodes of a particular Sage III IR
2731 : // nodes type.
2732 :
2733 4 : size_t count = 0;
2734 4 : if (SgLinkageModifier::pools.empty() == false)
2735 : {
2736 : // Generate an array of memory pools (this is actually a STL vector,
2737 : // but it is contiguious, so OK to treat this way).
2738 0 : SgLinkageModifier** objectArray = (SgLinkageModifier**) &(SgLinkageModifier::pools[0]);
2739 :
2740 : // Build a local variable for better performance (make it a loop invariant variable).
2741 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
2742 :
2743 : // Iterate over all of the memory pools for this IR node.
2744 0 : for (unsigned int i=0; i < SgLinkageModifier::pools.size(); i++)
2745 : {
2746 : // objectArray[i] is a single memory pool, iterate over all the
2747 : // IR nodes and only count those that are valid IR nodes used in
2748 : // the AST (i.e. allocated IR nodes).
2749 0 : for (unsigned j=0; j < SgLinkageModifier::pool_size; j++)
2750 : {
2751 : // This is indexing the STL vector of C/C++ style arrays as a doubly
2752 : // indexed array access. It is OK since we have leveraged the semantics
2753 : // of STL vector memory as contigous and cast the memory as an array
2754 : // of arrays to use the 2D array indexing. Hope this is not confusing,
2755 : // but it s very fast as an implementation.
2756 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
2757 : {
2758 0 : count++;
2759 : }
2760 : }
2761 : }
2762 : }
2763 :
2764 :
2765 :
2766 4 : return count;
2767 : }
2768 :
2769 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
2770 : // using values that overflow signed values of int.
2771 : size_t
2772 0 : SgLinkageModifier::memoryUsage()
2773 : {
2774 : // This function is required because we need the class name as a type when we call sizeof
2775 : // There might be another way to implement this if we have a traversal that only called a
2776 : // representative object (one call for each type of Sage IIIIR node).
2777 0 : size_t memory = numberOfNodes() * sizeof(SgLinkageModifier);
2778 :
2779 0 : return memory;
2780 : }
2781 :
2782 : /* #line 2783 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
2783 :
2784 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
2785 : void
2786 5342 : SgBaseClassModifier::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
2787 : {
2788 : // This function traverses the memory pool for only a specific IR node
2789 : // and calls the visit function of the input class execute a traversal
2790 : // similar to the style of the attribute based traversals within ROSE.
2791 : // This traversal will visit ALL nodes of the AST where as the other
2792 : // attribute based traversals visit only the embedded tree within the AST.
2793 :
2794 : // Initialize array to the address of the first element of the STL vector
2795 : // (which is guaranteed to be contiguous storage).
2796 : // SgBaseClassModifier objectArray [] = *(Memory_Block_List.begin());
2797 5342 : if (SgBaseClassModifier::pools.empty() == false)
2798 : {
2799 : // Generate an array of memory pools
2800 138 : SgBaseClassModifier** objectArray = (SgBaseClassModifier**) &(SgBaseClassModifier::pools[0]);
2801 :
2802 : // Build a local variable for better performance
2803 138 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
2804 : #if 0
2805 : // Iterate over the memory pools
2806 : for (unsigned int i=0; i < SgBaseClassModifier::pools.size(); i++)
2807 : {
2808 : // objectArray[i] is a single memory pool
2809 : for (int j=0; j < SgBaseClassModifier::pool_size; j++)
2810 : {
2811 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
2812 : {
2813 : traversal.visit(&(objectArray[i][j]));
2814 : }
2815 : }
2816 : }
2817 : #else
2818 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
2819 : // compute the list first and then call the visit function on each list element.
2820 :
2821 : // printf ("Inside of SgBaseClassModifier::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
2822 :
2823 276 : std::vector<SgBaseClassModifier*> nodeList;
2824 :
2825 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
2826 276 : for (unsigned int i=0; i < SgBaseClassModifier::pools.size(); i++)
2827 : {
2828 : // objectArray[i] is a single memory pool
2829 276138 : for (unsigned j=0; j < SgBaseClassModifier::pool_size; j++)
2830 : {
2831 276000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
2832 : {
2833 79993 : nodeList.push_back(&(objectArray[i][j]));
2834 : }
2835 : }
2836 : }
2837 :
2838 : // Iterate over the saved list
2839 138 : size_t nodeListSize = nodeList.size();
2840 80131 : for (size_t i=0; i < nodeListSize; i++)
2841 : {
2842 79993 : ROSE_ASSERT(nodeList[i] != NULL);
2843 : #if 0
2844 : traversal.visit(nodeList[i]);
2845 : #else
2846 79993 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
2847 : {
2848 79993 : traversal.visit(nodeList[i]);
2849 : }
2850 : #endif
2851 : }
2852 : #endif
2853 : }
2854 :
2855 : // This should not be required since all previously static data members are
2856 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
2857 :
2858 5342 : }
2859 :
2860 :
2861 : void
2862 194 : SgBaseClassModifier::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
2863 : {
2864 : // This function traverses the memory pool for an IR node and
2865 : // calls the function to execute the visitor object.
2866 :
2867 : // Initialize array to the address of the first element of the STL vector
2868 : // (which is guarenteed to be contiguous storage).
2869 : // SgBaseClassModifier objectArray [] = *(Memory_Block_List.begin());
2870 194 : if (SgBaseClassModifier::pools.empty() == false)
2871 : {
2872 : // Generate an array of memory pools
2873 137 : SgBaseClassModifier** objectArray = (SgBaseClassModifier**) &(SgBaseClassModifier::pools[0]);
2874 :
2875 : // Build a local variable for better performance
2876 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
2877 :
2878 : // Iterate over the memory pools
2879 274 : for (unsigned int i=0; i < SgBaseClassModifier::pools.size(); i++)
2880 : {
2881 : // objectArray[i] is a single memory pool
2882 274137 : for (unsigned j=0; j < SgBaseClassModifier::pool_size; j++)
2883 : {
2884 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
2885 : {
2886 : // printf ("Found a valid SgBaseClassModifier object in the memory pool %d at position %d \n",i,j);
2887 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
2888 85560 : objectArray[i][j].executeVisitorMemberFunction(visitor);
2889 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
2890 : }
2891 : else
2892 : {
2893 : // printf ("Found a INVALID SgBaseClassModifier object in the memory pool \n");
2894 : }
2895 : }
2896 : }
2897 : }
2898 :
2899 : // This should not be required since all previously static data members are
2900 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
2901 :
2902 194 : }
2903 :
2904 : void
2905 0 : SgBaseClassModifier::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
2906 : {
2907 : // This function visits only a single IR node of the memory pool.
2908 : // it is typically called once for each type of IR node within
2909 : // the automatically generated function: traverseRepresentativeNodes().
2910 :
2911 : // Initialize array to the address of the first element of the STL vector
2912 : // (which is guarenteed to be contiguous storage).
2913 : // SgBaseClassModifier objectArray [] = *(Memory_Block_List.begin());
2914 0 : if (SgBaseClassModifier::pools.empty() == false)
2915 : {
2916 : // Generate an array of memory pools
2917 0 : SgBaseClassModifier** objectArray = (SgBaseClassModifier**) &(SgBaseClassModifier::pools[0]);
2918 :
2919 : // Build a local variable for better performance
2920 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
2921 :
2922 : // Iterate over the memory pools
2923 0 : bool done = false;
2924 0 : unsigned i=0;
2925 :
2926 : // find the first valid IR node, call visit function, and then leave
2927 0 : while ( done == false && i < SgBaseClassModifier::pools.size() )
2928 : {
2929 : // objectArray[i] is a single memory pool
2930 : unsigned j=0;
2931 0 : while (done == false && j < SgBaseClassModifier::pool_size)
2932 : {
2933 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
2934 : {
2935 0 : traversal.visit(&(objectArray[i][j]));
2936 0 : done = true;
2937 : }
2938 0 : j++;
2939 : }
2940 0 : i++;
2941 : }
2942 :
2943 : #if 0
2944 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
2945 : if (done == false)
2946 : {
2947 : printf ("No representative for SgBaseClassModifier found in memory pools \n");
2948 : }
2949 : #endif
2950 : }
2951 0 : }
2952 :
2953 :
2954 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
2955 : // using values that overflow signed values of int.
2956 : size_t
2957 4 : SgBaseClassModifier::numberOfNodes()
2958 : {
2959 : // This function traverses the memory pool for an IR node and
2960 : // counts the number of IR nodes of a particular Sage III IR
2961 : // nodes type.
2962 :
2963 4 : size_t count = 0;
2964 4 : if (SgBaseClassModifier::pools.empty() == false)
2965 : {
2966 : // Generate an array of memory pools (this is actually a STL vector,
2967 : // but it is contiguious, so OK to treat this way).
2968 1 : SgBaseClassModifier** objectArray = (SgBaseClassModifier**) &(SgBaseClassModifier::pools[0]);
2969 :
2970 : // Build a local variable for better performance (make it a loop invariant variable).
2971 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
2972 :
2973 : // Iterate over all of the memory pools for this IR node.
2974 2 : for (unsigned int i=0; i < SgBaseClassModifier::pools.size(); i++)
2975 : {
2976 : // objectArray[i] is a single memory pool, iterate over all the
2977 : // IR nodes and only count those that are valid IR nodes used in
2978 : // the AST (i.e. allocated IR nodes).
2979 2001 : for (unsigned j=0; j < SgBaseClassModifier::pool_size; j++)
2980 : {
2981 : // This is indexing the STL vector of C/C++ style arrays as a doubly
2982 : // indexed array access. It is OK since we have leveraged the semantics
2983 : // of STL vector memory as contigous and cast the memory as an array
2984 : // of arrays to use the 2D array indexing. Hope this is not confusing,
2985 : // but it s very fast as an implementation.
2986 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
2987 : {
2988 620 : count++;
2989 : }
2990 : }
2991 : }
2992 : }
2993 :
2994 :
2995 :
2996 4 : return count;
2997 : }
2998 :
2999 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
3000 : // using values that overflow signed values of int.
3001 : size_t
3002 0 : SgBaseClassModifier::memoryUsage()
3003 : {
3004 : // This function is required because we need the class name as a type when we call sizeof
3005 : // There might be another way to implement this if we have a traversal that only called a
3006 : // representative object (one call for each type of Sage IIIIR node).
3007 0 : size_t memory = numberOfNodes() * sizeof(SgBaseClassModifier);
3008 :
3009 0 : return memory;
3010 : }
3011 :
3012 : /* #line 3013 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
3013 :
3014 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
3015 : void
3016 5342 : SgStructureModifier::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
3017 : {
3018 : // This function traverses the memory pool for only a specific IR node
3019 : // and calls the visit function of the input class execute a traversal
3020 : // similar to the style of the attribute based traversals within ROSE.
3021 : // This traversal will visit ALL nodes of the AST where as the other
3022 : // attribute based traversals visit only the embedded tree within the AST.
3023 :
3024 : // Initialize array to the address of the first element of the STL vector
3025 : // (which is guaranteed to be contiguous storage).
3026 : // SgStructureModifier objectArray [] = *(Memory_Block_List.begin());
3027 5342 : if (SgStructureModifier::pools.empty() == false)
3028 : {
3029 : // Generate an array of memory pools
3030 0 : SgStructureModifier** objectArray = (SgStructureModifier**) &(SgStructureModifier::pools[0]);
3031 :
3032 : // Build a local variable for better performance
3033 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
3034 : #if 0
3035 : // Iterate over the memory pools
3036 : for (unsigned int i=0; i < SgStructureModifier::pools.size(); i++)
3037 : {
3038 : // objectArray[i] is a single memory pool
3039 : for (int j=0; j < SgStructureModifier::pool_size; j++)
3040 : {
3041 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
3042 : {
3043 : traversal.visit(&(objectArray[i][j]));
3044 : }
3045 : }
3046 : }
3047 : #else
3048 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
3049 : // compute the list first and then call the visit function on each list element.
3050 :
3051 : // printf ("Inside of SgStructureModifier::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
3052 :
3053 0 : std::vector<SgStructureModifier*> nodeList;
3054 :
3055 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
3056 0 : for (unsigned int i=0; i < SgStructureModifier::pools.size(); i++)
3057 : {
3058 : // objectArray[i] is a single memory pool
3059 0 : for (unsigned j=0; j < SgStructureModifier::pool_size; j++)
3060 : {
3061 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
3062 : {
3063 0 : nodeList.push_back(&(objectArray[i][j]));
3064 : }
3065 : }
3066 : }
3067 :
3068 : // Iterate over the saved list
3069 0 : size_t nodeListSize = nodeList.size();
3070 0 : for (size_t i=0; i < nodeListSize; i++)
3071 : {
3072 0 : ROSE_ASSERT(nodeList[i] != NULL);
3073 : #if 0
3074 : traversal.visit(nodeList[i]);
3075 : #else
3076 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
3077 : {
3078 0 : traversal.visit(nodeList[i]);
3079 : }
3080 : #endif
3081 : }
3082 : #endif
3083 : }
3084 :
3085 : // This should not be required since all previously static data members are
3086 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
3087 :
3088 5342 : }
3089 :
3090 :
3091 : void
3092 194 : SgStructureModifier::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
3093 : {
3094 : // This function traverses the memory pool for an IR node and
3095 : // calls the function to execute the visitor object.
3096 :
3097 : // Initialize array to the address of the first element of the STL vector
3098 : // (which is guarenteed to be contiguous storage).
3099 : // SgStructureModifier objectArray [] = *(Memory_Block_List.begin());
3100 194 : if (SgStructureModifier::pools.empty() == false)
3101 : {
3102 : // Generate an array of memory pools
3103 0 : SgStructureModifier** objectArray = (SgStructureModifier**) &(SgStructureModifier::pools[0]);
3104 :
3105 : // Build a local variable for better performance
3106 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
3107 :
3108 : // Iterate over the memory pools
3109 0 : for (unsigned int i=0; i < SgStructureModifier::pools.size(); i++)
3110 : {
3111 : // objectArray[i] is a single memory pool
3112 0 : for (unsigned j=0; j < SgStructureModifier::pool_size; j++)
3113 : {
3114 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
3115 : {
3116 : // printf ("Found a valid SgStructureModifier object in the memory pool %d at position %d \n",i,j);
3117 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
3118 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
3119 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
3120 : }
3121 : else
3122 : {
3123 : // printf ("Found a INVALID SgStructureModifier object in the memory pool \n");
3124 : }
3125 : }
3126 : }
3127 : }
3128 :
3129 : // This should not be required since all previously static data members are
3130 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
3131 :
3132 194 : }
3133 :
3134 : void
3135 0 : SgStructureModifier::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
3136 : {
3137 : // This function visits only a single IR node of the memory pool.
3138 : // it is typically called once for each type of IR node within
3139 : // the automatically generated function: traverseRepresentativeNodes().
3140 :
3141 : // Initialize array to the address of the first element of the STL vector
3142 : // (which is guarenteed to be contiguous storage).
3143 : // SgStructureModifier objectArray [] = *(Memory_Block_List.begin());
3144 0 : if (SgStructureModifier::pools.empty() == false)
3145 : {
3146 : // Generate an array of memory pools
3147 0 : SgStructureModifier** objectArray = (SgStructureModifier**) &(SgStructureModifier::pools[0]);
3148 :
3149 : // Build a local variable for better performance
3150 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
3151 :
3152 : // Iterate over the memory pools
3153 0 : bool done = false;
3154 0 : unsigned i=0;
3155 :
3156 : // find the first valid IR node, call visit function, and then leave
3157 0 : while ( done == false && i < SgStructureModifier::pools.size() )
3158 : {
3159 : // objectArray[i] is a single memory pool
3160 : unsigned j=0;
3161 0 : while (done == false && j < SgStructureModifier::pool_size)
3162 : {
3163 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
3164 : {
3165 0 : traversal.visit(&(objectArray[i][j]));
3166 0 : done = true;
3167 : }
3168 0 : j++;
3169 : }
3170 0 : i++;
3171 : }
3172 :
3173 : #if 0
3174 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
3175 : if (done == false)
3176 : {
3177 : printf ("No representative for SgStructureModifier found in memory pools \n");
3178 : }
3179 : #endif
3180 : }
3181 0 : }
3182 :
3183 :
3184 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
3185 : // using values that overflow signed values of int.
3186 : size_t
3187 4 : SgStructureModifier::numberOfNodes()
3188 : {
3189 : // This function traverses the memory pool for an IR node and
3190 : // counts the number of IR nodes of a particular Sage III IR
3191 : // nodes type.
3192 :
3193 4 : size_t count = 0;
3194 4 : if (SgStructureModifier::pools.empty() == false)
3195 : {
3196 : // Generate an array of memory pools (this is actually a STL vector,
3197 : // but it is contiguious, so OK to treat this way).
3198 0 : SgStructureModifier** objectArray = (SgStructureModifier**) &(SgStructureModifier::pools[0]);
3199 :
3200 : // Build a local variable for better performance (make it a loop invariant variable).
3201 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
3202 :
3203 : // Iterate over all of the memory pools for this IR node.
3204 0 : for (unsigned int i=0; i < SgStructureModifier::pools.size(); i++)
3205 : {
3206 : // objectArray[i] is a single memory pool, iterate over all the
3207 : // IR nodes and only count those that are valid IR nodes used in
3208 : // the AST (i.e. allocated IR nodes).
3209 0 : for (unsigned j=0; j < SgStructureModifier::pool_size; j++)
3210 : {
3211 : // This is indexing the STL vector of C/C++ style arrays as a doubly
3212 : // indexed array access. It is OK since we have leveraged the semantics
3213 : // of STL vector memory as contigous and cast the memory as an array
3214 : // of arrays to use the 2D array indexing. Hope this is not confusing,
3215 : // but it s very fast as an implementation.
3216 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
3217 : {
3218 0 : count++;
3219 : }
3220 : }
3221 : }
3222 : }
3223 :
3224 :
3225 :
3226 4 : return count;
3227 : }
3228 :
3229 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
3230 : // using values that overflow signed values of int.
3231 : size_t
3232 0 : SgStructureModifier::memoryUsage()
3233 : {
3234 : // This function is required because we need the class name as a type when we call sizeof
3235 : // There might be another way to implement this if we have a traversal that only called a
3236 : // representative object (one call for each type of Sage IIIIR node).
3237 0 : size_t memory = numberOfNodes() * sizeof(SgStructureModifier);
3238 :
3239 0 : return memory;
3240 : }
3241 :
3242 : /* #line 3243 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
3243 :
3244 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
3245 : void
3246 5342 : SgTypeModifier::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
3247 : {
3248 : // This function traverses the memory pool for only a specific IR node
3249 : // and calls the visit function of the input class execute a traversal
3250 : // similar to the style of the attribute based traversals within ROSE.
3251 : // This traversal will visit ALL nodes of the AST where as the other
3252 : // attribute based traversals visit only the embedded tree within the AST.
3253 :
3254 : // Initialize array to the address of the first element of the STL vector
3255 : // (which is guaranteed to be contiguous storage).
3256 : // SgTypeModifier objectArray [] = *(Memory_Block_List.begin());
3257 5342 : if (SgTypeModifier::pools.empty() == false)
3258 : {
3259 : // Generate an array of memory pools
3260 0 : SgTypeModifier** objectArray = (SgTypeModifier**) &(SgTypeModifier::pools[0]);
3261 :
3262 : // Build a local variable for better performance
3263 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
3264 : #if 0
3265 : // Iterate over the memory pools
3266 : for (unsigned int i=0; i < SgTypeModifier::pools.size(); i++)
3267 : {
3268 : // objectArray[i] is a single memory pool
3269 : for (int j=0; j < SgTypeModifier::pool_size; j++)
3270 : {
3271 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
3272 : {
3273 : traversal.visit(&(objectArray[i][j]));
3274 : }
3275 : }
3276 : }
3277 : #else
3278 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
3279 : // compute the list first and then call the visit function on each list element.
3280 :
3281 : // printf ("Inside of SgTypeModifier::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
3282 :
3283 0 : std::vector<SgTypeModifier*> nodeList;
3284 :
3285 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
3286 0 : for (unsigned int i=0; i < SgTypeModifier::pools.size(); i++)
3287 : {
3288 : // objectArray[i] is a single memory pool
3289 0 : for (unsigned j=0; j < SgTypeModifier::pool_size; j++)
3290 : {
3291 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
3292 : {
3293 0 : nodeList.push_back(&(objectArray[i][j]));
3294 : }
3295 : }
3296 : }
3297 :
3298 : // Iterate over the saved list
3299 0 : size_t nodeListSize = nodeList.size();
3300 0 : for (size_t i=0; i < nodeListSize; i++)
3301 : {
3302 0 : ROSE_ASSERT(nodeList[i] != NULL);
3303 : #if 0
3304 : traversal.visit(nodeList[i]);
3305 : #else
3306 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
3307 : {
3308 0 : traversal.visit(nodeList[i]);
3309 : }
3310 : #endif
3311 : }
3312 : #endif
3313 : }
3314 :
3315 : // This should not be required since all previously static data members are
3316 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
3317 :
3318 5342 : }
3319 :
3320 :
3321 : void
3322 194 : SgTypeModifier::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
3323 : {
3324 : // This function traverses the memory pool for an IR node and
3325 : // calls the function to execute the visitor object.
3326 :
3327 : // Initialize array to the address of the first element of the STL vector
3328 : // (which is guarenteed to be contiguous storage).
3329 : // SgTypeModifier objectArray [] = *(Memory_Block_List.begin());
3330 194 : if (SgTypeModifier::pools.empty() == false)
3331 : {
3332 : // Generate an array of memory pools
3333 0 : SgTypeModifier** objectArray = (SgTypeModifier**) &(SgTypeModifier::pools[0]);
3334 :
3335 : // Build a local variable for better performance
3336 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
3337 :
3338 : // Iterate over the memory pools
3339 0 : for (unsigned int i=0; i < SgTypeModifier::pools.size(); i++)
3340 : {
3341 : // objectArray[i] is a single memory pool
3342 0 : for (unsigned j=0; j < SgTypeModifier::pool_size; j++)
3343 : {
3344 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
3345 : {
3346 : // printf ("Found a valid SgTypeModifier object in the memory pool %d at position %d \n",i,j);
3347 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
3348 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
3349 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
3350 : }
3351 : else
3352 : {
3353 : // printf ("Found a INVALID SgTypeModifier object in the memory pool \n");
3354 : }
3355 : }
3356 : }
3357 : }
3358 :
3359 : // This should not be required since all previously static data members are
3360 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
3361 :
3362 194 : }
3363 :
3364 : void
3365 0 : SgTypeModifier::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
3366 : {
3367 : // This function visits only a single IR node of the memory pool.
3368 : // it is typically called once for each type of IR node within
3369 : // the automatically generated function: traverseRepresentativeNodes().
3370 :
3371 : // Initialize array to the address of the first element of the STL vector
3372 : // (which is guarenteed to be contiguous storage).
3373 : // SgTypeModifier objectArray [] = *(Memory_Block_List.begin());
3374 0 : if (SgTypeModifier::pools.empty() == false)
3375 : {
3376 : // Generate an array of memory pools
3377 0 : SgTypeModifier** objectArray = (SgTypeModifier**) &(SgTypeModifier::pools[0]);
3378 :
3379 : // Build a local variable for better performance
3380 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
3381 :
3382 : // Iterate over the memory pools
3383 0 : bool done = false;
3384 0 : unsigned i=0;
3385 :
3386 : // find the first valid IR node, call visit function, and then leave
3387 0 : while ( done == false && i < SgTypeModifier::pools.size() )
3388 : {
3389 : // objectArray[i] is a single memory pool
3390 : unsigned j=0;
3391 0 : while (done == false && j < SgTypeModifier::pool_size)
3392 : {
3393 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
3394 : {
3395 0 : traversal.visit(&(objectArray[i][j]));
3396 0 : done = true;
3397 : }
3398 0 : j++;
3399 : }
3400 0 : i++;
3401 : }
3402 :
3403 : #if 0
3404 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
3405 : if (done == false)
3406 : {
3407 : printf ("No representative for SgTypeModifier found in memory pools \n");
3408 : }
3409 : #endif
3410 : }
3411 0 : }
3412 :
3413 :
3414 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
3415 : // using values that overflow signed values of int.
3416 : size_t
3417 4 : SgTypeModifier::numberOfNodes()
3418 : {
3419 : // This function traverses the memory pool for an IR node and
3420 : // counts the number of IR nodes of a particular Sage III IR
3421 : // nodes type.
3422 :
3423 4 : size_t count = 0;
3424 4 : if (SgTypeModifier::pools.empty() == false)
3425 : {
3426 : // Generate an array of memory pools (this is actually a STL vector,
3427 : // but it is contiguious, so OK to treat this way).
3428 0 : SgTypeModifier** objectArray = (SgTypeModifier**) &(SgTypeModifier::pools[0]);
3429 :
3430 : // Build a local variable for better performance (make it a loop invariant variable).
3431 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
3432 :
3433 : // Iterate over all of the memory pools for this IR node.
3434 0 : for (unsigned int i=0; i < SgTypeModifier::pools.size(); i++)
3435 : {
3436 : // objectArray[i] is a single memory pool, iterate over all the
3437 : // IR nodes and only count those that are valid IR nodes used in
3438 : // the AST (i.e. allocated IR nodes).
3439 0 : for (unsigned j=0; j < SgTypeModifier::pool_size; j++)
3440 : {
3441 : // This is indexing the STL vector of C/C++ style arrays as a doubly
3442 : // indexed array access. It is OK since we have leveraged the semantics
3443 : // of STL vector memory as contigous and cast the memory as an array
3444 : // of arrays to use the 2D array indexing. Hope this is not confusing,
3445 : // but it s very fast as an implementation.
3446 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
3447 : {
3448 0 : count++;
3449 : }
3450 : }
3451 : }
3452 : }
3453 :
3454 :
3455 :
3456 4 : return count;
3457 : }
3458 :
3459 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
3460 : // using values that overflow signed values of int.
3461 : size_t
3462 0 : SgTypeModifier::memoryUsage()
3463 : {
3464 : // This function is required because we need the class name as a type when we call sizeof
3465 : // There might be another way to implement this if we have a traversal that only called a
3466 : // representative object (one call for each type of Sage IIIIR node).
3467 0 : size_t memory = numberOfNodes() * sizeof(SgTypeModifier);
3468 :
3469 0 : return memory;
3470 : }
3471 :
3472 : /* #line 3473 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
3473 :
3474 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
3475 : void
3476 5342 : SgDeclarationModifier::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
3477 : {
3478 : // This function traverses the memory pool for only a specific IR node
3479 : // and calls the visit function of the input class execute a traversal
3480 : // similar to the style of the attribute based traversals within ROSE.
3481 : // This traversal will visit ALL nodes of the AST where as the other
3482 : // attribute based traversals visit only the embedded tree within the AST.
3483 :
3484 : // Initialize array to the address of the first element of the STL vector
3485 : // (which is guaranteed to be contiguous storage).
3486 : // SgDeclarationModifier objectArray [] = *(Memory_Block_List.begin());
3487 5342 : if (SgDeclarationModifier::pools.empty() == false)
3488 : {
3489 : // Generate an array of memory pools
3490 0 : SgDeclarationModifier** objectArray = (SgDeclarationModifier**) &(SgDeclarationModifier::pools[0]);
3491 :
3492 : // Build a local variable for better performance
3493 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
3494 : #if 0
3495 : // Iterate over the memory pools
3496 : for (unsigned int i=0; i < SgDeclarationModifier::pools.size(); i++)
3497 : {
3498 : // objectArray[i] is a single memory pool
3499 : for (int j=0; j < SgDeclarationModifier::pool_size; j++)
3500 : {
3501 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
3502 : {
3503 : traversal.visit(&(objectArray[i][j]));
3504 : }
3505 : }
3506 : }
3507 : #else
3508 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
3509 : // compute the list first and then call the visit function on each list element.
3510 :
3511 : // printf ("Inside of SgDeclarationModifier::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
3512 :
3513 0 : std::vector<SgDeclarationModifier*> nodeList;
3514 :
3515 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
3516 0 : for (unsigned int i=0; i < SgDeclarationModifier::pools.size(); i++)
3517 : {
3518 : // objectArray[i] is a single memory pool
3519 0 : for (unsigned j=0; j < SgDeclarationModifier::pool_size; j++)
3520 : {
3521 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
3522 : {
3523 0 : nodeList.push_back(&(objectArray[i][j]));
3524 : }
3525 : }
3526 : }
3527 :
3528 : // Iterate over the saved list
3529 0 : size_t nodeListSize = nodeList.size();
3530 0 : for (size_t i=0; i < nodeListSize; i++)
3531 : {
3532 0 : ROSE_ASSERT(nodeList[i] != NULL);
3533 : #if 0
3534 : traversal.visit(nodeList[i]);
3535 : #else
3536 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
3537 : {
3538 0 : traversal.visit(nodeList[i]);
3539 : }
3540 : #endif
3541 : }
3542 : #endif
3543 : }
3544 :
3545 : // This should not be required since all previously static data members are
3546 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
3547 :
3548 5342 : }
3549 :
3550 :
3551 : void
3552 194 : SgDeclarationModifier::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
3553 : {
3554 : // This function traverses the memory pool for an IR node and
3555 : // calls the function to execute the visitor object.
3556 :
3557 : // Initialize array to the address of the first element of the STL vector
3558 : // (which is guarenteed to be contiguous storage).
3559 : // SgDeclarationModifier objectArray [] = *(Memory_Block_List.begin());
3560 194 : if (SgDeclarationModifier::pools.empty() == false)
3561 : {
3562 : // Generate an array of memory pools
3563 0 : SgDeclarationModifier** objectArray = (SgDeclarationModifier**) &(SgDeclarationModifier::pools[0]);
3564 :
3565 : // Build a local variable for better performance
3566 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
3567 :
3568 : // Iterate over the memory pools
3569 0 : for (unsigned int i=0; i < SgDeclarationModifier::pools.size(); i++)
3570 : {
3571 : // objectArray[i] is a single memory pool
3572 0 : for (unsigned j=0; j < SgDeclarationModifier::pool_size; j++)
3573 : {
3574 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
3575 : {
3576 : // printf ("Found a valid SgDeclarationModifier object in the memory pool %d at position %d \n",i,j);
3577 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
3578 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
3579 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
3580 : }
3581 : else
3582 : {
3583 : // printf ("Found a INVALID SgDeclarationModifier object in the memory pool \n");
3584 : }
3585 : }
3586 : }
3587 : }
3588 :
3589 : // This should not be required since all previously static data members are
3590 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
3591 :
3592 194 : }
3593 :
3594 : void
3595 0 : SgDeclarationModifier::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
3596 : {
3597 : // This function visits only a single IR node of the memory pool.
3598 : // it is typically called once for each type of IR node within
3599 : // the automatically generated function: traverseRepresentativeNodes().
3600 :
3601 : // Initialize array to the address of the first element of the STL vector
3602 : // (which is guarenteed to be contiguous storage).
3603 : // SgDeclarationModifier objectArray [] = *(Memory_Block_List.begin());
3604 0 : if (SgDeclarationModifier::pools.empty() == false)
3605 : {
3606 : // Generate an array of memory pools
3607 0 : SgDeclarationModifier** objectArray = (SgDeclarationModifier**) &(SgDeclarationModifier::pools[0]);
3608 :
3609 : // Build a local variable for better performance
3610 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
3611 :
3612 : // Iterate over the memory pools
3613 0 : bool done = false;
3614 0 : unsigned i=0;
3615 :
3616 : // find the first valid IR node, call visit function, and then leave
3617 0 : while ( done == false && i < SgDeclarationModifier::pools.size() )
3618 : {
3619 : // objectArray[i] is a single memory pool
3620 : unsigned j=0;
3621 0 : while (done == false && j < SgDeclarationModifier::pool_size)
3622 : {
3623 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
3624 : {
3625 0 : traversal.visit(&(objectArray[i][j]));
3626 0 : done = true;
3627 : }
3628 0 : j++;
3629 : }
3630 0 : i++;
3631 : }
3632 :
3633 : #if 0
3634 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
3635 : if (done == false)
3636 : {
3637 : printf ("No representative for SgDeclarationModifier found in memory pools \n");
3638 : }
3639 : #endif
3640 : }
3641 0 : }
3642 :
3643 :
3644 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
3645 : // using values that overflow signed values of int.
3646 : size_t
3647 4 : SgDeclarationModifier::numberOfNodes()
3648 : {
3649 : // This function traverses the memory pool for an IR node and
3650 : // counts the number of IR nodes of a particular Sage III IR
3651 : // nodes type.
3652 :
3653 4 : size_t count = 0;
3654 4 : if (SgDeclarationModifier::pools.empty() == false)
3655 : {
3656 : // Generate an array of memory pools (this is actually a STL vector,
3657 : // but it is contiguious, so OK to treat this way).
3658 0 : SgDeclarationModifier** objectArray = (SgDeclarationModifier**) &(SgDeclarationModifier::pools[0]);
3659 :
3660 : // Build a local variable for better performance (make it a loop invariant variable).
3661 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
3662 :
3663 : // Iterate over all of the memory pools for this IR node.
3664 0 : for (unsigned int i=0; i < SgDeclarationModifier::pools.size(); i++)
3665 : {
3666 : // objectArray[i] is a single memory pool, iterate over all the
3667 : // IR nodes and only count those that are valid IR nodes used in
3668 : // the AST (i.e. allocated IR nodes).
3669 0 : for (unsigned j=0; j < SgDeclarationModifier::pool_size; j++)
3670 : {
3671 : // This is indexing the STL vector of C/C++ style arrays as a doubly
3672 : // indexed array access. It is OK since we have leveraged the semantics
3673 : // of STL vector memory as contigous and cast the memory as an array
3674 : // of arrays to use the 2D array indexing. Hope this is not confusing,
3675 : // but it s very fast as an implementation.
3676 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
3677 : {
3678 0 : count++;
3679 : }
3680 : }
3681 : }
3682 : }
3683 :
3684 :
3685 :
3686 4 : return count;
3687 : }
3688 :
3689 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
3690 : // using values that overflow signed values of int.
3691 : size_t
3692 0 : SgDeclarationModifier::memoryUsage()
3693 : {
3694 : // This function is required because we need the class name as a type when we call sizeof
3695 : // There might be another way to implement this if we have a traversal that only called a
3696 : // representative object (one call for each type of Sage IIIIR node).
3697 0 : size_t memory = numberOfNodes() * sizeof(SgDeclarationModifier);
3698 :
3699 0 : return memory;
3700 : }
3701 :
3702 : /* #line 3703 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
3703 :
3704 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
3705 : void
3706 5342 : SgOpenclAccessModeModifier::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
3707 : {
3708 : // This function traverses the memory pool for only a specific IR node
3709 : // and calls the visit function of the input class execute a traversal
3710 : // similar to the style of the attribute based traversals within ROSE.
3711 : // This traversal will visit ALL nodes of the AST where as the other
3712 : // attribute based traversals visit only the embedded tree within the AST.
3713 :
3714 : // Initialize array to the address of the first element of the STL vector
3715 : // (which is guaranteed to be contiguous storage).
3716 : // SgOpenclAccessModeModifier objectArray [] = *(Memory_Block_List.begin());
3717 5342 : if (SgOpenclAccessModeModifier::pools.empty() == false)
3718 : {
3719 : // Generate an array of memory pools
3720 0 : SgOpenclAccessModeModifier** objectArray = (SgOpenclAccessModeModifier**) &(SgOpenclAccessModeModifier::pools[0]);
3721 :
3722 : // Build a local variable for better performance
3723 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
3724 : #if 0
3725 : // Iterate over the memory pools
3726 : for (unsigned int i=0; i < SgOpenclAccessModeModifier::pools.size(); i++)
3727 : {
3728 : // objectArray[i] is a single memory pool
3729 : for (int j=0; j < SgOpenclAccessModeModifier::pool_size; j++)
3730 : {
3731 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
3732 : {
3733 : traversal.visit(&(objectArray[i][j]));
3734 : }
3735 : }
3736 : }
3737 : #else
3738 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
3739 : // compute the list first and then call the visit function on each list element.
3740 :
3741 : // printf ("Inside of SgOpenclAccessModeModifier::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
3742 :
3743 0 : std::vector<SgOpenclAccessModeModifier*> nodeList;
3744 :
3745 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
3746 0 : for (unsigned int i=0; i < SgOpenclAccessModeModifier::pools.size(); i++)
3747 : {
3748 : // objectArray[i] is a single memory pool
3749 0 : for (unsigned j=0; j < SgOpenclAccessModeModifier::pool_size; j++)
3750 : {
3751 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
3752 : {
3753 0 : nodeList.push_back(&(objectArray[i][j]));
3754 : }
3755 : }
3756 : }
3757 :
3758 : // Iterate over the saved list
3759 0 : size_t nodeListSize = nodeList.size();
3760 0 : for (size_t i=0; i < nodeListSize; i++)
3761 : {
3762 0 : ROSE_ASSERT(nodeList[i] != NULL);
3763 : #if 0
3764 : traversal.visit(nodeList[i]);
3765 : #else
3766 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
3767 : {
3768 0 : traversal.visit(nodeList[i]);
3769 : }
3770 : #endif
3771 : }
3772 : #endif
3773 : }
3774 :
3775 : // This should not be required since all previously static data members are
3776 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
3777 :
3778 5342 : }
3779 :
3780 :
3781 : void
3782 194 : SgOpenclAccessModeModifier::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
3783 : {
3784 : // This function traverses the memory pool for an IR node and
3785 : // calls the function to execute the visitor object.
3786 :
3787 : // Initialize array to the address of the first element of the STL vector
3788 : // (which is guarenteed to be contiguous storage).
3789 : // SgOpenclAccessModeModifier objectArray [] = *(Memory_Block_List.begin());
3790 194 : if (SgOpenclAccessModeModifier::pools.empty() == false)
3791 : {
3792 : // Generate an array of memory pools
3793 0 : SgOpenclAccessModeModifier** objectArray = (SgOpenclAccessModeModifier**) &(SgOpenclAccessModeModifier::pools[0]);
3794 :
3795 : // Build a local variable for better performance
3796 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
3797 :
3798 : // Iterate over the memory pools
3799 0 : for (unsigned int i=0; i < SgOpenclAccessModeModifier::pools.size(); i++)
3800 : {
3801 : // objectArray[i] is a single memory pool
3802 0 : for (unsigned j=0; j < SgOpenclAccessModeModifier::pool_size; j++)
3803 : {
3804 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
3805 : {
3806 : // printf ("Found a valid SgOpenclAccessModeModifier object in the memory pool %d at position %d \n",i,j);
3807 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
3808 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
3809 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
3810 : }
3811 : else
3812 : {
3813 : // printf ("Found a INVALID SgOpenclAccessModeModifier object in the memory pool \n");
3814 : }
3815 : }
3816 : }
3817 : }
3818 :
3819 : // This should not be required since all previously static data members are
3820 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
3821 :
3822 194 : }
3823 :
3824 : void
3825 0 : SgOpenclAccessModeModifier::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
3826 : {
3827 : // This function visits only a single IR node of the memory pool.
3828 : // it is typically called once for each type of IR node within
3829 : // the automatically generated function: traverseRepresentativeNodes().
3830 :
3831 : // Initialize array to the address of the first element of the STL vector
3832 : // (which is guarenteed to be contiguous storage).
3833 : // SgOpenclAccessModeModifier objectArray [] = *(Memory_Block_List.begin());
3834 0 : if (SgOpenclAccessModeModifier::pools.empty() == false)
3835 : {
3836 : // Generate an array of memory pools
3837 0 : SgOpenclAccessModeModifier** objectArray = (SgOpenclAccessModeModifier**) &(SgOpenclAccessModeModifier::pools[0]);
3838 :
3839 : // Build a local variable for better performance
3840 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
3841 :
3842 : // Iterate over the memory pools
3843 0 : bool done = false;
3844 0 : unsigned i=0;
3845 :
3846 : // find the first valid IR node, call visit function, and then leave
3847 0 : while ( done == false && i < SgOpenclAccessModeModifier::pools.size() )
3848 : {
3849 : // objectArray[i] is a single memory pool
3850 : unsigned j=0;
3851 0 : while (done == false && j < SgOpenclAccessModeModifier::pool_size)
3852 : {
3853 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
3854 : {
3855 0 : traversal.visit(&(objectArray[i][j]));
3856 0 : done = true;
3857 : }
3858 0 : j++;
3859 : }
3860 0 : i++;
3861 : }
3862 :
3863 : #if 0
3864 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
3865 : if (done == false)
3866 : {
3867 : printf ("No representative for SgOpenclAccessModeModifier found in memory pools \n");
3868 : }
3869 : #endif
3870 : }
3871 0 : }
3872 :
3873 :
3874 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
3875 : // using values that overflow signed values of int.
3876 : size_t
3877 4 : SgOpenclAccessModeModifier::numberOfNodes()
3878 : {
3879 : // This function traverses the memory pool for an IR node and
3880 : // counts the number of IR nodes of a particular Sage III IR
3881 : // nodes type.
3882 :
3883 4 : size_t count = 0;
3884 4 : if (SgOpenclAccessModeModifier::pools.empty() == false)
3885 : {
3886 : // Generate an array of memory pools (this is actually a STL vector,
3887 : // but it is contiguious, so OK to treat this way).
3888 0 : SgOpenclAccessModeModifier** objectArray = (SgOpenclAccessModeModifier**) &(SgOpenclAccessModeModifier::pools[0]);
3889 :
3890 : // Build a local variable for better performance (make it a loop invariant variable).
3891 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
3892 :
3893 : // Iterate over all of the memory pools for this IR node.
3894 0 : for (unsigned int i=0; i < SgOpenclAccessModeModifier::pools.size(); i++)
3895 : {
3896 : // objectArray[i] is a single memory pool, iterate over all the
3897 : // IR nodes and only count those that are valid IR nodes used in
3898 : // the AST (i.e. allocated IR nodes).
3899 0 : for (unsigned j=0; j < SgOpenclAccessModeModifier::pool_size; j++)
3900 : {
3901 : // This is indexing the STL vector of C/C++ style arrays as a doubly
3902 : // indexed array access. It is OK since we have leveraged the semantics
3903 : // of STL vector memory as contigous and cast the memory as an array
3904 : // of arrays to use the 2D array indexing. Hope this is not confusing,
3905 : // but it s very fast as an implementation.
3906 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
3907 : {
3908 0 : count++;
3909 : }
3910 : }
3911 : }
3912 : }
3913 :
3914 :
3915 :
3916 4 : return count;
3917 : }
3918 :
3919 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
3920 : // using values that overflow signed values of int.
3921 : size_t
3922 0 : SgOpenclAccessModeModifier::memoryUsage()
3923 : {
3924 : // This function is required because we need the class name as a type when we call sizeof
3925 : // There might be another way to implement this if we have a traversal that only called a
3926 : // representative object (one call for each type of Sage IIIIR node).
3927 0 : size_t memory = numberOfNodes() * sizeof(SgOpenclAccessModeModifier);
3928 :
3929 0 : return memory;
3930 : }
3931 :
3932 : /* #line 3933 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
3933 :
3934 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
3935 : void
3936 5342 : SgName::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
3937 : {
3938 : // This function traverses the memory pool for only a specific IR node
3939 : // and calls the visit function of the input class execute a traversal
3940 : // similar to the style of the attribute based traversals within ROSE.
3941 : // This traversal will visit ALL nodes of the AST where as the other
3942 : // attribute based traversals visit only the embedded tree within the AST.
3943 :
3944 : // Initialize array to the address of the first element of the STL vector
3945 : // (which is guaranteed to be contiguous storage).
3946 : // SgName objectArray [] = *(Memory_Block_List.begin());
3947 5342 : if (SgName::pools.empty() == false)
3948 : {
3949 : // Generate an array of memory pools
3950 7 : SgName** objectArray = (SgName**) &(SgName::pools[0]);
3951 :
3952 : // Build a local variable for better performance
3953 7 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
3954 : #if 0
3955 : // Iterate over the memory pools
3956 : for (unsigned int i=0; i < SgName::pools.size(); i++)
3957 : {
3958 : // objectArray[i] is a single memory pool
3959 : for (int j=0; j < SgName::pool_size; j++)
3960 : {
3961 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
3962 : {
3963 : traversal.visit(&(objectArray[i][j]));
3964 : }
3965 : }
3966 : }
3967 : #else
3968 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
3969 : // compute the list first and then call the visit function on each list element.
3970 :
3971 : // printf ("Inside of SgName::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
3972 :
3973 14 : std::vector<SgName*> nodeList;
3974 :
3975 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
3976 14 : for (unsigned int i=0; i < SgName::pools.size(); i++)
3977 : {
3978 : // objectArray[i] is a single memory pool
3979 14007 : for (unsigned j=0; j < SgName::pool_size; j++)
3980 : {
3981 14000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
3982 : {
3983 196 : nodeList.push_back(&(objectArray[i][j]));
3984 : }
3985 : }
3986 : }
3987 :
3988 : // Iterate over the saved list
3989 7 : size_t nodeListSize = nodeList.size();
3990 203 : for (size_t i=0; i < nodeListSize; i++)
3991 : {
3992 196 : ROSE_ASSERT(nodeList[i] != NULL);
3993 : #if 0
3994 : traversal.visit(nodeList[i]);
3995 : #else
3996 196 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
3997 : {
3998 196 : traversal.visit(nodeList[i]);
3999 : }
4000 : #endif
4001 : }
4002 : #endif
4003 : }
4004 :
4005 : // This should not be required since all previously static data members are
4006 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
4007 :
4008 5342 : }
4009 :
4010 :
4011 : void
4012 194 : SgName::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
4013 : {
4014 : // This function traverses the memory pool for an IR node and
4015 : // calls the function to execute the visitor object.
4016 :
4017 : // Initialize array to the address of the first element of the STL vector
4018 : // (which is guarenteed to be contiguous storage).
4019 : // SgName objectArray [] = *(Memory_Block_List.begin());
4020 194 : if (SgName::pools.empty() == false)
4021 : {
4022 : // Generate an array of memory pools
4023 0 : SgName** objectArray = (SgName**) &(SgName::pools[0]);
4024 :
4025 : // Build a local variable for better performance
4026 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
4027 :
4028 : // Iterate over the memory pools
4029 0 : for (unsigned int i=0; i < SgName::pools.size(); i++)
4030 : {
4031 : // objectArray[i] is a single memory pool
4032 0 : for (unsigned j=0; j < SgName::pool_size; j++)
4033 : {
4034 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
4035 : {
4036 : // printf ("Found a valid SgName object in the memory pool %d at position %d \n",i,j);
4037 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
4038 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
4039 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
4040 : }
4041 : else
4042 : {
4043 : // printf ("Found a INVALID SgName object in the memory pool \n");
4044 : }
4045 : }
4046 : }
4047 : }
4048 :
4049 : // This should not be required since all previously static data members are
4050 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
4051 :
4052 194 : }
4053 :
4054 : void
4055 0 : SgName::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
4056 : {
4057 : // This function visits only a single IR node of the memory pool.
4058 : // it is typically called once for each type of IR node within
4059 : // the automatically generated function: traverseRepresentativeNodes().
4060 :
4061 : // Initialize array to the address of the first element of the STL vector
4062 : // (which is guarenteed to be contiguous storage).
4063 : // SgName objectArray [] = *(Memory_Block_List.begin());
4064 0 : if (SgName::pools.empty() == false)
4065 : {
4066 : // Generate an array of memory pools
4067 0 : SgName** objectArray = (SgName**) &(SgName::pools[0]);
4068 :
4069 : // Build a local variable for better performance
4070 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
4071 :
4072 : // Iterate over the memory pools
4073 0 : bool done = false;
4074 0 : unsigned i=0;
4075 :
4076 : // find the first valid IR node, call visit function, and then leave
4077 0 : while ( done == false && i < SgName::pools.size() )
4078 : {
4079 : // objectArray[i] is a single memory pool
4080 : unsigned j=0;
4081 0 : while (done == false && j < SgName::pool_size)
4082 : {
4083 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
4084 : {
4085 0 : traversal.visit(&(objectArray[i][j]));
4086 0 : done = true;
4087 : }
4088 0 : j++;
4089 : }
4090 0 : i++;
4091 : }
4092 :
4093 : #if 0
4094 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
4095 : if (done == false)
4096 : {
4097 : printf ("No representative for SgName found in memory pools \n");
4098 : }
4099 : #endif
4100 : }
4101 0 : }
4102 :
4103 :
4104 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
4105 : // using values that overflow signed values of int.
4106 : size_t
4107 4 : SgName::numberOfNodes()
4108 : {
4109 : // This function traverses the memory pool for an IR node and
4110 : // counts the number of IR nodes of a particular Sage III IR
4111 : // nodes type.
4112 :
4113 4 : size_t count = 0;
4114 4 : if (SgName::pools.empty() == false)
4115 : {
4116 : // Generate an array of memory pools (this is actually a STL vector,
4117 : // but it is contiguious, so OK to treat this way).
4118 0 : SgName** objectArray = (SgName**) &(SgName::pools[0]);
4119 :
4120 : // Build a local variable for better performance (make it a loop invariant variable).
4121 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
4122 :
4123 : // Iterate over all of the memory pools for this IR node.
4124 0 : for (unsigned int i=0; i < SgName::pools.size(); i++)
4125 : {
4126 : // objectArray[i] is a single memory pool, iterate over all the
4127 : // IR nodes and only count those that are valid IR nodes used in
4128 : // the AST (i.e. allocated IR nodes).
4129 0 : for (unsigned j=0; j < SgName::pool_size; j++)
4130 : {
4131 : // This is indexing the STL vector of C/C++ style arrays as a doubly
4132 : // indexed array access. It is OK since we have leveraged the semantics
4133 : // of STL vector memory as contigous and cast the memory as an array
4134 : // of arrays to use the 2D array indexing. Hope this is not confusing,
4135 : // but it s very fast as an implementation.
4136 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
4137 : {
4138 0 : count++;
4139 : }
4140 : }
4141 : }
4142 : }
4143 :
4144 :
4145 :
4146 4 : return count;
4147 : }
4148 :
4149 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
4150 : // using values that overflow signed values of int.
4151 : size_t
4152 0 : SgName::memoryUsage()
4153 : {
4154 : // This function is required because we need the class name as a type when we call sizeof
4155 : // There might be another way to implement this if we have a traversal that only called a
4156 : // representative object (one call for each type of Sage IIIIR node).
4157 0 : size_t memory = numberOfNodes() * sizeof(SgName);
4158 :
4159 0 : return memory;
4160 : }
4161 :
4162 : /* #line 4163 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
4163 :
4164 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
4165 : void
4166 5342 : SgSymbolTable::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
4167 : {
4168 : // This function traverses the memory pool for only a specific IR node
4169 : // and calls the visit function of the input class execute a traversal
4170 : // similar to the style of the attribute based traversals within ROSE.
4171 : // This traversal will visit ALL nodes of the AST where as the other
4172 : // attribute based traversals visit only the embedded tree within the AST.
4173 :
4174 : // Initialize array to the address of the first element of the STL vector
4175 : // (which is guaranteed to be contiguous storage).
4176 : // SgSymbolTable objectArray [] = *(Memory_Block_List.begin());
4177 5342 : if (SgSymbolTable::pools.empty() == false)
4178 : {
4179 : // Generate an array of memory pools
4180 5342 : SgSymbolTable** objectArray = (SgSymbolTable**) &(SgSymbolTable::pools[0]);
4181 :
4182 : // Build a local variable for better performance
4183 5342 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
4184 : #if 0
4185 : // Iterate over the memory pools
4186 : for (unsigned int i=0; i < SgSymbolTable::pools.size(); i++)
4187 : {
4188 : // objectArray[i] is a single memory pool
4189 : for (int j=0; j < SgSymbolTable::pool_size; j++)
4190 : {
4191 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
4192 : {
4193 : traversal.visit(&(objectArray[i][j]));
4194 : }
4195 : }
4196 : }
4197 : #else
4198 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
4199 : // compute the list first and then call the visit function on each list element.
4200 :
4201 : // printf ("Inside of SgSymbolTable::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
4202 :
4203 10684 : std::vector<SgSymbolTable*> nodeList;
4204 :
4205 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
4206 12381 : for (unsigned int i=0; i < SgSymbolTable::pools.size(); i++)
4207 : {
4208 : // objectArray[i] is a single memory pool
4209 14085000 : for (unsigned j=0; j < SgSymbolTable::pool_size; j++)
4210 : {
4211 14078000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
4212 : {
4213 3859890 : nodeList.push_back(&(objectArray[i][j]));
4214 : }
4215 : }
4216 : }
4217 :
4218 : // Iterate over the saved list
4219 5342 : size_t nodeListSize = nodeList.size();
4220 3865230 : for (size_t i=0; i < nodeListSize; i++)
4221 : {
4222 3859890 : ROSE_ASSERT(nodeList[i] != NULL);
4223 : #if 0
4224 : traversal.visit(nodeList[i]);
4225 : #else
4226 3859890 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
4227 : {
4228 3859890 : traversal.visit(nodeList[i]);
4229 : }
4230 : #endif
4231 : }
4232 : #endif
4233 : }
4234 :
4235 : // This should not be required since all previously static data members are
4236 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
4237 :
4238 5342 : }
4239 :
4240 :
4241 : void
4242 194 : SgSymbolTable::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
4243 : {
4244 : // This function traverses the memory pool for an IR node and
4245 : // calls the function to execute the visitor object.
4246 :
4247 : // Initialize array to the address of the first element of the STL vector
4248 : // (which is guarenteed to be contiguous storage).
4249 : // SgSymbolTable objectArray [] = *(Memory_Block_List.begin());
4250 194 : if (SgSymbolTable::pools.empty() == false)
4251 : {
4252 : // Generate an array of memory pools
4253 194 : SgSymbolTable** objectArray = (SgSymbolTable**) &(SgSymbolTable::pools[0]);
4254 :
4255 : // Build a local variable for better performance
4256 194 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
4257 :
4258 : // Iterate over the memory pools
4259 2205 : for (unsigned int i=0; i < SgSymbolTable::pools.size(); i++)
4260 : {
4261 : // objectArray[i] is a single memory pool
4262 4024010 : for (unsigned j=0; j < SgSymbolTable::pool_size; j++)
4263 : {
4264 4022000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
4265 : {
4266 : // printf ("Found a valid SgSymbolTable object in the memory pool %d at position %d \n",i,j);
4267 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
4268 3750340 : objectArray[i][j].executeVisitorMemberFunction(visitor);
4269 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
4270 : }
4271 : else
4272 : {
4273 : // printf ("Found a INVALID SgSymbolTable object in the memory pool \n");
4274 : }
4275 : }
4276 : }
4277 : }
4278 :
4279 : // This should not be required since all previously static data members are
4280 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
4281 :
4282 194 : }
4283 :
4284 : void
4285 0 : SgSymbolTable::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
4286 : {
4287 : // This function visits only a single IR node of the memory pool.
4288 : // it is typically called once for each type of IR node within
4289 : // the automatically generated function: traverseRepresentativeNodes().
4290 :
4291 : // Initialize array to the address of the first element of the STL vector
4292 : // (which is guarenteed to be contiguous storage).
4293 : // SgSymbolTable objectArray [] = *(Memory_Block_List.begin());
4294 0 : if (SgSymbolTable::pools.empty() == false)
4295 : {
4296 : // Generate an array of memory pools
4297 0 : SgSymbolTable** objectArray = (SgSymbolTable**) &(SgSymbolTable::pools[0]);
4298 :
4299 : // Build a local variable for better performance
4300 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
4301 :
4302 : // Iterate over the memory pools
4303 0 : bool done = false;
4304 0 : unsigned i=0;
4305 :
4306 : // find the first valid IR node, call visit function, and then leave
4307 0 : while ( done == false && i < SgSymbolTable::pools.size() )
4308 : {
4309 : // objectArray[i] is a single memory pool
4310 : unsigned j=0;
4311 0 : while (done == false && j < SgSymbolTable::pool_size)
4312 : {
4313 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
4314 : {
4315 0 : traversal.visit(&(objectArray[i][j]));
4316 0 : done = true;
4317 : }
4318 0 : j++;
4319 : }
4320 0 : i++;
4321 : }
4322 :
4323 : #if 0
4324 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
4325 : if (done == false)
4326 : {
4327 : printf ("No representative for SgSymbolTable found in memory pools \n");
4328 : }
4329 : #endif
4330 : }
4331 0 : }
4332 :
4333 :
4334 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
4335 : // using values that overflow signed values of int.
4336 : size_t
4337 4 : SgSymbolTable::numberOfNodes()
4338 : {
4339 : // This function traverses the memory pool for an IR node and
4340 : // counts the number of IR nodes of a particular Sage III IR
4341 : // nodes type.
4342 :
4343 4 : size_t count = 0;
4344 4 : if (SgSymbolTable::pools.empty() == false)
4345 : {
4346 : // Generate an array of memory pools (this is actually a STL vector,
4347 : // but it is contiguious, so OK to treat this way).
4348 4 : SgSymbolTable** objectArray = (SgSymbolTable**) &(SgSymbolTable::pools[0]);
4349 :
4350 : // Build a local variable for better performance (make it a loop invariant variable).
4351 4 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
4352 :
4353 : // Iterate over all of the memory pools for this IR node.
4354 21 : for (unsigned int i=0; i < SgSymbolTable::pools.size(); i++)
4355 : {
4356 : // objectArray[i] is a single memory pool, iterate over all the
4357 : // IR nodes and only count those that are valid IR nodes used in
4358 : // the AST (i.e. allocated IR nodes).
4359 34017 : for (unsigned j=0; j < SgSymbolTable::pool_size; j++)
4360 : {
4361 : // This is indexing the STL vector of C/C++ style arrays as a doubly
4362 : // indexed array access. It is OK since we have leveraged the semantics
4363 : // of STL vector memory as contigous and cast the memory as an array
4364 : // of arrays to use the 2D array indexing. Hope this is not confusing,
4365 : // but it s very fast as an implementation.
4366 34000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
4367 : {
4368 26936 : count++;
4369 : }
4370 : }
4371 : }
4372 : }
4373 :
4374 :
4375 :
4376 4 : return count;
4377 : }
4378 :
4379 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
4380 : // using values that overflow signed values of int.
4381 : size_t
4382 0 : SgSymbolTable::memoryUsage()
4383 : {
4384 : // This function is required because we need the class name as a type when we call sizeof
4385 : // There might be another way to implement this if we have a traversal that only called a
4386 : // representative object (one call for each type of Sage IIIIR node).
4387 0 : size_t memory = numberOfNodes() * sizeof(SgSymbolTable);
4388 :
4389 0 : return memory;
4390 : }
4391 :
4392 : /* #line 4393 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
4393 :
4394 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
4395 : void
4396 5342 : SgAttribute::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
4397 : {
4398 : // This function traverses the memory pool for only a specific IR node
4399 : // and calls the visit function of the input class execute a traversal
4400 : // similar to the style of the attribute based traversals within ROSE.
4401 : // This traversal will visit ALL nodes of the AST where as the other
4402 : // attribute based traversals visit only the embedded tree within the AST.
4403 :
4404 : // Initialize array to the address of the first element of the STL vector
4405 : // (which is guaranteed to be contiguous storage).
4406 : // SgAttribute objectArray [] = *(Memory_Block_List.begin());
4407 5342 : if (SgAttribute::pools.empty() == false)
4408 : {
4409 : // Generate an array of memory pools
4410 0 : SgAttribute** objectArray = (SgAttribute**) &(SgAttribute::pools[0]);
4411 :
4412 : // Build a local variable for better performance
4413 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
4414 : #if 0
4415 : // Iterate over the memory pools
4416 : for (unsigned int i=0; i < SgAttribute::pools.size(); i++)
4417 : {
4418 : // objectArray[i] is a single memory pool
4419 : for (int j=0; j < SgAttribute::pool_size; j++)
4420 : {
4421 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
4422 : {
4423 : traversal.visit(&(objectArray[i][j]));
4424 : }
4425 : }
4426 : }
4427 : #else
4428 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
4429 : // compute the list first and then call the visit function on each list element.
4430 :
4431 : // printf ("Inside of SgAttribute::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
4432 :
4433 0 : std::vector<SgAttribute*> nodeList;
4434 :
4435 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
4436 0 : for (unsigned int i=0; i < SgAttribute::pools.size(); i++)
4437 : {
4438 : // objectArray[i] is a single memory pool
4439 0 : for (unsigned j=0; j < SgAttribute::pool_size; j++)
4440 : {
4441 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
4442 : {
4443 0 : nodeList.push_back(&(objectArray[i][j]));
4444 : }
4445 : }
4446 : }
4447 :
4448 : // Iterate over the saved list
4449 0 : size_t nodeListSize = nodeList.size();
4450 0 : for (size_t i=0; i < nodeListSize; i++)
4451 : {
4452 0 : ROSE_ASSERT(nodeList[i] != NULL);
4453 : #if 0
4454 : traversal.visit(nodeList[i]);
4455 : #else
4456 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
4457 : {
4458 0 : traversal.visit(nodeList[i]);
4459 : }
4460 : #endif
4461 : }
4462 : #endif
4463 : }
4464 :
4465 : // This should not be required since all previously static data members are
4466 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
4467 :
4468 5342 : }
4469 :
4470 :
4471 : void
4472 194 : SgAttribute::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
4473 : {
4474 : // This function traverses the memory pool for an IR node and
4475 : // calls the function to execute the visitor object.
4476 :
4477 : // Initialize array to the address of the first element of the STL vector
4478 : // (which is guarenteed to be contiguous storage).
4479 : // SgAttribute objectArray [] = *(Memory_Block_List.begin());
4480 194 : if (SgAttribute::pools.empty() == false)
4481 : {
4482 : // Generate an array of memory pools
4483 0 : SgAttribute** objectArray = (SgAttribute**) &(SgAttribute::pools[0]);
4484 :
4485 : // Build a local variable for better performance
4486 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
4487 :
4488 : // Iterate over the memory pools
4489 0 : for (unsigned int i=0; i < SgAttribute::pools.size(); i++)
4490 : {
4491 : // objectArray[i] is a single memory pool
4492 0 : for (unsigned j=0; j < SgAttribute::pool_size; j++)
4493 : {
4494 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
4495 : {
4496 : // printf ("Found a valid SgAttribute object in the memory pool %d at position %d \n",i,j);
4497 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
4498 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
4499 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
4500 : }
4501 : else
4502 : {
4503 : // printf ("Found a INVALID SgAttribute object in the memory pool \n");
4504 : }
4505 : }
4506 : }
4507 : }
4508 :
4509 : // This should not be required since all previously static data members are
4510 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
4511 :
4512 194 : }
4513 :
4514 : void
4515 0 : SgAttribute::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
4516 : {
4517 : // This function visits only a single IR node of the memory pool.
4518 : // it is typically called once for each type of IR node within
4519 : // the automatically generated function: traverseRepresentativeNodes().
4520 :
4521 : // Initialize array to the address of the first element of the STL vector
4522 : // (which is guarenteed to be contiguous storage).
4523 : // SgAttribute objectArray [] = *(Memory_Block_List.begin());
4524 0 : if (SgAttribute::pools.empty() == false)
4525 : {
4526 : // Generate an array of memory pools
4527 0 : SgAttribute** objectArray = (SgAttribute**) &(SgAttribute::pools[0]);
4528 :
4529 : // Build a local variable for better performance
4530 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
4531 :
4532 : // Iterate over the memory pools
4533 0 : bool done = false;
4534 0 : unsigned i=0;
4535 :
4536 : // find the first valid IR node, call visit function, and then leave
4537 0 : while ( done == false && i < SgAttribute::pools.size() )
4538 : {
4539 : // objectArray[i] is a single memory pool
4540 : unsigned j=0;
4541 0 : while (done == false && j < SgAttribute::pool_size)
4542 : {
4543 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
4544 : {
4545 0 : traversal.visit(&(objectArray[i][j]));
4546 0 : done = true;
4547 : }
4548 0 : j++;
4549 : }
4550 0 : i++;
4551 : }
4552 :
4553 : #if 0
4554 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
4555 : if (done == false)
4556 : {
4557 : printf ("No representative for SgAttribute found in memory pools \n");
4558 : }
4559 : #endif
4560 : }
4561 0 : }
4562 :
4563 :
4564 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
4565 : // using values that overflow signed values of int.
4566 : size_t
4567 4 : SgAttribute::numberOfNodes()
4568 : {
4569 : // This function traverses the memory pool for an IR node and
4570 : // counts the number of IR nodes of a particular Sage III IR
4571 : // nodes type.
4572 :
4573 4 : size_t count = 0;
4574 4 : if (SgAttribute::pools.empty() == false)
4575 : {
4576 : // Generate an array of memory pools (this is actually a STL vector,
4577 : // but it is contiguious, so OK to treat this way).
4578 0 : SgAttribute** objectArray = (SgAttribute**) &(SgAttribute::pools[0]);
4579 :
4580 : // Build a local variable for better performance (make it a loop invariant variable).
4581 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
4582 :
4583 : // Iterate over all of the memory pools for this IR node.
4584 0 : for (unsigned int i=0; i < SgAttribute::pools.size(); i++)
4585 : {
4586 : // objectArray[i] is a single memory pool, iterate over all the
4587 : // IR nodes and only count those that are valid IR nodes used in
4588 : // the AST (i.e. allocated IR nodes).
4589 0 : for (unsigned j=0; j < SgAttribute::pool_size; j++)
4590 : {
4591 : // This is indexing the STL vector of C/C++ style arrays as a doubly
4592 : // indexed array access. It is OK since we have leveraged the semantics
4593 : // of STL vector memory as contigous and cast the memory as an array
4594 : // of arrays to use the 2D array indexing. Hope this is not confusing,
4595 : // but it s very fast as an implementation.
4596 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
4597 : {
4598 0 : count++;
4599 : }
4600 : }
4601 : }
4602 : }
4603 :
4604 :
4605 :
4606 4 : return count;
4607 : }
4608 :
4609 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
4610 : // using values that overflow signed values of int.
4611 : size_t
4612 0 : SgAttribute::memoryUsage()
4613 : {
4614 : // This function is required because we need the class name as a type when we call sizeof
4615 : // There might be another way to implement this if we have a traversal that only called a
4616 : // representative object (one call for each type of Sage IIIIR node).
4617 0 : size_t memory = numberOfNodes() * sizeof(SgAttribute);
4618 :
4619 0 : return memory;
4620 : }
4621 :
4622 : /* #line 4623 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
4623 :
4624 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
4625 : void
4626 5342 : SgPragma::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
4627 : {
4628 : // This function traverses the memory pool for only a specific IR node
4629 : // and calls the visit function of the input class execute a traversal
4630 : // similar to the style of the attribute based traversals within ROSE.
4631 : // This traversal will visit ALL nodes of the AST where as the other
4632 : // attribute based traversals visit only the embedded tree within the AST.
4633 :
4634 : // Initialize array to the address of the first element of the STL vector
4635 : // (which is guaranteed to be contiguous storage).
4636 : // SgPragma objectArray [] = *(Memory_Block_List.begin());
4637 5342 : if (SgPragma::pools.empty() == false)
4638 : {
4639 : // Generate an array of memory pools
4640 3872 : SgPragma** objectArray = (SgPragma**) &(SgPragma::pools[0]);
4641 :
4642 : // Build a local variable for better performance
4643 3872 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
4644 : #if 0
4645 : // Iterate over the memory pools
4646 : for (unsigned int i=0; i < SgPragma::pools.size(); i++)
4647 : {
4648 : // objectArray[i] is a single memory pool
4649 : for (int j=0; j < SgPragma::pool_size; j++)
4650 : {
4651 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
4652 : {
4653 : traversal.visit(&(objectArray[i][j]));
4654 : }
4655 : }
4656 : }
4657 : #else
4658 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
4659 : // compute the list first and then call the visit function on each list element.
4660 :
4661 : // printf ("Inside of SgPragma::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
4662 :
4663 7744 : std::vector<SgPragma*> nodeList;
4664 :
4665 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
4666 7744 : for (unsigned int i=0; i < SgPragma::pools.size(); i++)
4667 : {
4668 : // objectArray[i] is a single memory pool
4669 7747870 : for (unsigned j=0; j < SgPragma::pool_size; j++)
4670 : {
4671 7744000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
4672 : {
4673 25667 : nodeList.push_back(&(objectArray[i][j]));
4674 : }
4675 : }
4676 : }
4677 :
4678 : // Iterate over the saved list
4679 3872 : size_t nodeListSize = nodeList.size();
4680 29539 : for (size_t i=0; i < nodeListSize; i++)
4681 : {
4682 25667 : ROSE_ASSERT(nodeList[i] != NULL);
4683 : #if 0
4684 : traversal.visit(nodeList[i]);
4685 : #else
4686 25667 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
4687 : {
4688 25667 : traversal.visit(nodeList[i]);
4689 : }
4690 : #endif
4691 : }
4692 : #endif
4693 : }
4694 :
4695 : // This should not be required since all previously static data members are
4696 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
4697 :
4698 5342 : }
4699 :
4700 :
4701 : void
4702 194 : SgPragma::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
4703 : {
4704 : // This function traverses the memory pool for an IR node and
4705 : // calls the function to execute the visitor object.
4706 :
4707 : // Initialize array to the address of the first element of the STL vector
4708 : // (which is guarenteed to be contiguous storage).
4709 : // SgPragma objectArray [] = *(Memory_Block_List.begin());
4710 194 : if (SgPragma::pools.empty() == false)
4711 : {
4712 : // Generate an array of memory pools
4713 137 : SgPragma** objectArray = (SgPragma**) &(SgPragma::pools[0]);
4714 :
4715 : // Build a local variable for better performance
4716 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
4717 :
4718 : // Iterate over the memory pools
4719 274 : for (unsigned int i=0; i < SgPragma::pools.size(); i++)
4720 : {
4721 : // objectArray[i] is a single memory pool
4722 274137 : for (unsigned j=0; j < SgPragma::pool_size; j++)
4723 : {
4724 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
4725 : {
4726 : // printf ("Found a valid SgPragma object in the memory pool %d at position %d \n",i,j);
4727 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
4728 13512 : objectArray[i][j].executeVisitorMemberFunction(visitor);
4729 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
4730 : }
4731 : else
4732 : {
4733 : // printf ("Found a INVALID SgPragma object in the memory pool \n");
4734 : }
4735 : }
4736 : }
4737 : }
4738 :
4739 : // This should not be required since all previously static data members are
4740 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
4741 :
4742 194 : }
4743 :
4744 : void
4745 0 : SgPragma::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
4746 : {
4747 : // This function visits only a single IR node of the memory pool.
4748 : // it is typically called once for each type of IR node within
4749 : // the automatically generated function: traverseRepresentativeNodes().
4750 :
4751 : // Initialize array to the address of the first element of the STL vector
4752 : // (which is guarenteed to be contiguous storage).
4753 : // SgPragma objectArray [] = *(Memory_Block_List.begin());
4754 0 : if (SgPragma::pools.empty() == false)
4755 : {
4756 : // Generate an array of memory pools
4757 0 : SgPragma** objectArray = (SgPragma**) &(SgPragma::pools[0]);
4758 :
4759 : // Build a local variable for better performance
4760 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
4761 :
4762 : // Iterate over the memory pools
4763 0 : bool done = false;
4764 0 : unsigned i=0;
4765 :
4766 : // find the first valid IR node, call visit function, and then leave
4767 0 : while ( done == false && i < SgPragma::pools.size() )
4768 : {
4769 : // objectArray[i] is a single memory pool
4770 : unsigned j=0;
4771 0 : while (done == false && j < SgPragma::pool_size)
4772 : {
4773 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
4774 : {
4775 0 : traversal.visit(&(objectArray[i][j]));
4776 0 : done = true;
4777 : }
4778 0 : j++;
4779 : }
4780 0 : i++;
4781 : }
4782 :
4783 : #if 0
4784 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
4785 : if (done == false)
4786 : {
4787 : printf ("No representative for SgPragma found in memory pools \n");
4788 : }
4789 : #endif
4790 : }
4791 0 : }
4792 :
4793 :
4794 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
4795 : // using values that overflow signed values of int.
4796 : size_t
4797 4 : SgPragma::numberOfNodes()
4798 : {
4799 : // This function traverses the memory pool for an IR node and
4800 : // counts the number of IR nodes of a particular Sage III IR
4801 : // nodes type.
4802 :
4803 4 : size_t count = 0;
4804 4 : if (SgPragma::pools.empty() == false)
4805 : {
4806 : // Generate an array of memory pools (this is actually a STL vector,
4807 : // but it is contiguious, so OK to treat this way).
4808 1 : SgPragma** objectArray = (SgPragma**) &(SgPragma::pools[0]);
4809 :
4810 : // Build a local variable for better performance (make it a loop invariant variable).
4811 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
4812 :
4813 : // Iterate over all of the memory pools for this IR node.
4814 2 : for (unsigned int i=0; i < SgPragma::pools.size(); i++)
4815 : {
4816 : // objectArray[i] is a single memory pool, iterate over all the
4817 : // IR nodes and only count those that are valid IR nodes used in
4818 : // the AST (i.e. allocated IR nodes).
4819 2001 : for (unsigned j=0; j < SgPragma::pool_size; j++)
4820 : {
4821 : // This is indexing the STL vector of C/C++ style arrays as a doubly
4822 : // indexed array access. It is OK since we have leveraged the semantics
4823 : // of STL vector memory as contigous and cast the memory as an array
4824 : // of arrays to use the 2D array indexing. Hope this is not confusing,
4825 : // but it s very fast as an implementation.
4826 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
4827 : {
4828 97 : count++;
4829 : }
4830 : }
4831 : }
4832 : }
4833 :
4834 :
4835 :
4836 4 : return count;
4837 : }
4838 :
4839 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
4840 : // using values that overflow signed values of int.
4841 : size_t
4842 0 : SgPragma::memoryUsage()
4843 : {
4844 : // This function is required because we need the class name as a type when we call sizeof
4845 : // There might be another way to implement this if we have a traversal that only called a
4846 : // representative object (one call for each type of Sage IIIIR node).
4847 0 : size_t memory = numberOfNodes() * sizeof(SgPragma);
4848 :
4849 0 : return memory;
4850 : }
4851 :
4852 : /* #line 4853 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
4853 :
4854 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
4855 : void
4856 5342 : SgBitAttribute::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
4857 : {
4858 : // This function traverses the memory pool for only a specific IR node
4859 : // and calls the visit function of the input class execute a traversal
4860 : // similar to the style of the attribute based traversals within ROSE.
4861 : // This traversal will visit ALL nodes of the AST where as the other
4862 : // attribute based traversals visit only the embedded tree within the AST.
4863 :
4864 : // Initialize array to the address of the first element of the STL vector
4865 : // (which is guaranteed to be contiguous storage).
4866 : // SgBitAttribute objectArray [] = *(Memory_Block_List.begin());
4867 5342 : if (SgBitAttribute::pools.empty() == false)
4868 : {
4869 : // Generate an array of memory pools
4870 0 : SgBitAttribute** objectArray = (SgBitAttribute**) &(SgBitAttribute::pools[0]);
4871 :
4872 : // Build a local variable for better performance
4873 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
4874 : #if 0
4875 : // Iterate over the memory pools
4876 : for (unsigned int i=0; i < SgBitAttribute::pools.size(); i++)
4877 : {
4878 : // objectArray[i] is a single memory pool
4879 : for (int j=0; j < SgBitAttribute::pool_size; j++)
4880 : {
4881 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
4882 : {
4883 : traversal.visit(&(objectArray[i][j]));
4884 : }
4885 : }
4886 : }
4887 : #else
4888 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
4889 : // compute the list first and then call the visit function on each list element.
4890 :
4891 : // printf ("Inside of SgBitAttribute::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
4892 :
4893 0 : std::vector<SgBitAttribute*> nodeList;
4894 :
4895 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
4896 0 : for (unsigned int i=0; i < SgBitAttribute::pools.size(); i++)
4897 : {
4898 : // objectArray[i] is a single memory pool
4899 0 : for (unsigned j=0; j < SgBitAttribute::pool_size; j++)
4900 : {
4901 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
4902 : {
4903 0 : nodeList.push_back(&(objectArray[i][j]));
4904 : }
4905 : }
4906 : }
4907 :
4908 : // Iterate over the saved list
4909 0 : size_t nodeListSize = nodeList.size();
4910 0 : for (size_t i=0; i < nodeListSize; i++)
4911 : {
4912 0 : ROSE_ASSERT(nodeList[i] != NULL);
4913 : #if 0
4914 : traversal.visit(nodeList[i]);
4915 : #else
4916 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
4917 : {
4918 0 : traversal.visit(nodeList[i]);
4919 : }
4920 : #endif
4921 : }
4922 : #endif
4923 : }
4924 :
4925 : // This should not be required since all previously static data members are
4926 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
4927 :
4928 5342 : }
4929 :
4930 :
4931 : void
4932 194 : SgBitAttribute::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
4933 : {
4934 : // This function traverses the memory pool for an IR node and
4935 : // calls the function to execute the visitor object.
4936 :
4937 : // Initialize array to the address of the first element of the STL vector
4938 : // (which is guarenteed to be contiguous storage).
4939 : // SgBitAttribute objectArray [] = *(Memory_Block_List.begin());
4940 194 : if (SgBitAttribute::pools.empty() == false)
4941 : {
4942 : // Generate an array of memory pools
4943 0 : SgBitAttribute** objectArray = (SgBitAttribute**) &(SgBitAttribute::pools[0]);
4944 :
4945 : // Build a local variable for better performance
4946 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
4947 :
4948 : // Iterate over the memory pools
4949 0 : for (unsigned int i=0; i < SgBitAttribute::pools.size(); i++)
4950 : {
4951 : // objectArray[i] is a single memory pool
4952 0 : for (unsigned j=0; j < SgBitAttribute::pool_size; j++)
4953 : {
4954 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
4955 : {
4956 : // printf ("Found a valid SgBitAttribute object in the memory pool %d at position %d \n",i,j);
4957 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
4958 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
4959 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
4960 : }
4961 : else
4962 : {
4963 : // printf ("Found a INVALID SgBitAttribute object in the memory pool \n");
4964 : }
4965 : }
4966 : }
4967 : }
4968 :
4969 : // This should not be required since all previously static data members are
4970 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
4971 :
4972 194 : }
4973 :
4974 : void
4975 0 : SgBitAttribute::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
4976 : {
4977 : // This function visits only a single IR node of the memory pool.
4978 : // it is typically called once for each type of IR node within
4979 : // the automatically generated function: traverseRepresentativeNodes().
4980 :
4981 : // Initialize array to the address of the first element of the STL vector
4982 : // (which is guarenteed to be contiguous storage).
4983 : // SgBitAttribute objectArray [] = *(Memory_Block_List.begin());
4984 0 : if (SgBitAttribute::pools.empty() == false)
4985 : {
4986 : // Generate an array of memory pools
4987 0 : SgBitAttribute** objectArray = (SgBitAttribute**) &(SgBitAttribute::pools[0]);
4988 :
4989 : // Build a local variable for better performance
4990 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
4991 :
4992 : // Iterate over the memory pools
4993 0 : bool done = false;
4994 0 : unsigned i=0;
4995 :
4996 : // find the first valid IR node, call visit function, and then leave
4997 0 : while ( done == false && i < SgBitAttribute::pools.size() )
4998 : {
4999 : // objectArray[i] is a single memory pool
5000 : unsigned j=0;
5001 0 : while (done == false && j < SgBitAttribute::pool_size)
5002 : {
5003 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
5004 : {
5005 0 : traversal.visit(&(objectArray[i][j]));
5006 0 : done = true;
5007 : }
5008 0 : j++;
5009 : }
5010 0 : i++;
5011 : }
5012 :
5013 : #if 0
5014 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
5015 : if (done == false)
5016 : {
5017 : printf ("No representative for SgBitAttribute found in memory pools \n");
5018 : }
5019 : #endif
5020 : }
5021 0 : }
5022 :
5023 :
5024 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
5025 : // using values that overflow signed values of int.
5026 : size_t
5027 4 : SgBitAttribute::numberOfNodes()
5028 : {
5029 : // This function traverses the memory pool for an IR node and
5030 : // counts the number of IR nodes of a particular Sage III IR
5031 : // nodes type.
5032 :
5033 4 : size_t count = 0;
5034 4 : if (SgBitAttribute::pools.empty() == false)
5035 : {
5036 : // Generate an array of memory pools (this is actually a STL vector,
5037 : // but it is contiguious, so OK to treat this way).
5038 0 : SgBitAttribute** objectArray = (SgBitAttribute**) &(SgBitAttribute::pools[0]);
5039 :
5040 : // Build a local variable for better performance (make it a loop invariant variable).
5041 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
5042 :
5043 : // Iterate over all of the memory pools for this IR node.
5044 0 : for (unsigned int i=0; i < SgBitAttribute::pools.size(); i++)
5045 : {
5046 : // objectArray[i] is a single memory pool, iterate over all the
5047 : // IR nodes and only count those that are valid IR nodes used in
5048 : // the AST (i.e. allocated IR nodes).
5049 0 : for (unsigned j=0; j < SgBitAttribute::pool_size; j++)
5050 : {
5051 : // This is indexing the STL vector of C/C++ style arrays as a doubly
5052 : // indexed array access. It is OK since we have leveraged the semantics
5053 : // of STL vector memory as contigous and cast the memory as an array
5054 : // of arrays to use the 2D array indexing. Hope this is not confusing,
5055 : // but it s very fast as an implementation.
5056 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
5057 : {
5058 0 : count++;
5059 : }
5060 : }
5061 : }
5062 : }
5063 :
5064 :
5065 :
5066 4 : return count;
5067 : }
5068 :
5069 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
5070 : // using values that overflow signed values of int.
5071 : size_t
5072 0 : SgBitAttribute::memoryUsage()
5073 : {
5074 : // This function is required because we need the class name as a type when we call sizeof
5075 : // There might be another way to implement this if we have a traversal that only called a
5076 : // representative object (one call for each type of Sage IIIIR node).
5077 0 : size_t memory = numberOfNodes() * sizeof(SgBitAttribute);
5078 :
5079 0 : return memory;
5080 : }
5081 :
5082 : /* #line 5083 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
5083 :
5084 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
5085 : void
5086 5342 : SgFuncDecl_attr::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
5087 : {
5088 : // This function traverses the memory pool for only a specific IR node
5089 : // and calls the visit function of the input class execute a traversal
5090 : // similar to the style of the attribute based traversals within ROSE.
5091 : // This traversal will visit ALL nodes of the AST where as the other
5092 : // attribute based traversals visit only the embedded tree within the AST.
5093 :
5094 : // Initialize array to the address of the first element of the STL vector
5095 : // (which is guaranteed to be contiguous storage).
5096 : // SgFuncDecl_attr objectArray [] = *(Memory_Block_List.begin());
5097 5342 : if (SgFuncDecl_attr::pools.empty() == false)
5098 : {
5099 : // Generate an array of memory pools
5100 0 : SgFuncDecl_attr** objectArray = (SgFuncDecl_attr**) &(SgFuncDecl_attr::pools[0]);
5101 :
5102 : // Build a local variable for better performance
5103 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
5104 : #if 0
5105 : // Iterate over the memory pools
5106 : for (unsigned int i=0; i < SgFuncDecl_attr::pools.size(); i++)
5107 : {
5108 : // objectArray[i] is a single memory pool
5109 : for (int j=0; j < SgFuncDecl_attr::pool_size; j++)
5110 : {
5111 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
5112 : {
5113 : traversal.visit(&(objectArray[i][j]));
5114 : }
5115 : }
5116 : }
5117 : #else
5118 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
5119 : // compute the list first and then call the visit function on each list element.
5120 :
5121 : // printf ("Inside of SgFuncDecl_attr::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
5122 :
5123 0 : std::vector<SgFuncDecl_attr*> nodeList;
5124 :
5125 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
5126 0 : for (unsigned int i=0; i < SgFuncDecl_attr::pools.size(); i++)
5127 : {
5128 : // objectArray[i] is a single memory pool
5129 0 : for (unsigned j=0; j < SgFuncDecl_attr::pool_size; j++)
5130 : {
5131 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
5132 : {
5133 0 : nodeList.push_back(&(objectArray[i][j]));
5134 : }
5135 : }
5136 : }
5137 :
5138 : // Iterate over the saved list
5139 0 : size_t nodeListSize = nodeList.size();
5140 0 : for (size_t i=0; i < nodeListSize; i++)
5141 : {
5142 0 : ROSE_ASSERT(nodeList[i] != NULL);
5143 : #if 0
5144 : traversal.visit(nodeList[i]);
5145 : #else
5146 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
5147 : {
5148 0 : traversal.visit(nodeList[i]);
5149 : }
5150 : #endif
5151 : }
5152 : #endif
5153 : }
5154 :
5155 : // This should not be required since all previously static data members are
5156 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
5157 :
5158 5342 : }
5159 :
5160 :
5161 : void
5162 194 : SgFuncDecl_attr::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
5163 : {
5164 : // This function traverses the memory pool for an IR node and
5165 : // calls the function to execute the visitor object.
5166 :
5167 : // Initialize array to the address of the first element of the STL vector
5168 : // (which is guarenteed to be contiguous storage).
5169 : // SgFuncDecl_attr objectArray [] = *(Memory_Block_List.begin());
5170 194 : if (SgFuncDecl_attr::pools.empty() == false)
5171 : {
5172 : // Generate an array of memory pools
5173 0 : SgFuncDecl_attr** objectArray = (SgFuncDecl_attr**) &(SgFuncDecl_attr::pools[0]);
5174 :
5175 : // Build a local variable for better performance
5176 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
5177 :
5178 : // Iterate over the memory pools
5179 0 : for (unsigned int i=0; i < SgFuncDecl_attr::pools.size(); i++)
5180 : {
5181 : // objectArray[i] is a single memory pool
5182 0 : for (unsigned j=0; j < SgFuncDecl_attr::pool_size; j++)
5183 : {
5184 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
5185 : {
5186 : // printf ("Found a valid SgFuncDecl_attr object in the memory pool %d at position %d \n",i,j);
5187 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
5188 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
5189 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
5190 : }
5191 : else
5192 : {
5193 : // printf ("Found a INVALID SgFuncDecl_attr object in the memory pool \n");
5194 : }
5195 : }
5196 : }
5197 : }
5198 :
5199 : // This should not be required since all previously static data members are
5200 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
5201 :
5202 194 : }
5203 :
5204 : void
5205 0 : SgFuncDecl_attr::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
5206 : {
5207 : // This function visits only a single IR node of the memory pool.
5208 : // it is typically called once for each type of IR node within
5209 : // the automatically generated function: traverseRepresentativeNodes().
5210 :
5211 : // Initialize array to the address of the first element of the STL vector
5212 : // (which is guarenteed to be contiguous storage).
5213 : // SgFuncDecl_attr objectArray [] = *(Memory_Block_List.begin());
5214 0 : if (SgFuncDecl_attr::pools.empty() == false)
5215 : {
5216 : // Generate an array of memory pools
5217 0 : SgFuncDecl_attr** objectArray = (SgFuncDecl_attr**) &(SgFuncDecl_attr::pools[0]);
5218 :
5219 : // Build a local variable for better performance
5220 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
5221 :
5222 : // Iterate over the memory pools
5223 0 : bool done = false;
5224 0 : unsigned i=0;
5225 :
5226 : // find the first valid IR node, call visit function, and then leave
5227 0 : while ( done == false && i < SgFuncDecl_attr::pools.size() )
5228 : {
5229 : // objectArray[i] is a single memory pool
5230 : unsigned j=0;
5231 0 : while (done == false && j < SgFuncDecl_attr::pool_size)
5232 : {
5233 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
5234 : {
5235 0 : traversal.visit(&(objectArray[i][j]));
5236 0 : done = true;
5237 : }
5238 0 : j++;
5239 : }
5240 0 : i++;
5241 : }
5242 :
5243 : #if 0
5244 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
5245 : if (done == false)
5246 : {
5247 : printf ("No representative for SgFuncDecl_attr found in memory pools \n");
5248 : }
5249 : #endif
5250 : }
5251 0 : }
5252 :
5253 :
5254 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
5255 : // using values that overflow signed values of int.
5256 : size_t
5257 4 : SgFuncDecl_attr::numberOfNodes()
5258 : {
5259 : // This function traverses the memory pool for an IR node and
5260 : // counts the number of IR nodes of a particular Sage III IR
5261 : // nodes type.
5262 :
5263 4 : size_t count = 0;
5264 4 : if (SgFuncDecl_attr::pools.empty() == false)
5265 : {
5266 : // Generate an array of memory pools (this is actually a STL vector,
5267 : // but it is contiguious, so OK to treat this way).
5268 0 : SgFuncDecl_attr** objectArray = (SgFuncDecl_attr**) &(SgFuncDecl_attr::pools[0]);
5269 :
5270 : // Build a local variable for better performance (make it a loop invariant variable).
5271 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
5272 :
5273 : // Iterate over all of the memory pools for this IR node.
5274 0 : for (unsigned int i=0; i < SgFuncDecl_attr::pools.size(); i++)
5275 : {
5276 : // objectArray[i] is a single memory pool, iterate over all the
5277 : // IR nodes and only count those that are valid IR nodes used in
5278 : // the AST (i.e. allocated IR nodes).
5279 0 : for (unsigned j=0; j < SgFuncDecl_attr::pool_size; j++)
5280 : {
5281 : // This is indexing the STL vector of C/C++ style arrays as a doubly
5282 : // indexed array access. It is OK since we have leveraged the semantics
5283 : // of STL vector memory as contigous and cast the memory as an array
5284 : // of arrays to use the 2D array indexing. Hope this is not confusing,
5285 : // but it s very fast as an implementation.
5286 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
5287 : {
5288 0 : count++;
5289 : }
5290 : }
5291 : }
5292 : }
5293 :
5294 :
5295 :
5296 4 : return count;
5297 : }
5298 :
5299 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
5300 : // using values that overflow signed values of int.
5301 : size_t
5302 0 : SgFuncDecl_attr::memoryUsage()
5303 : {
5304 : // This function is required because we need the class name as a type when we call sizeof
5305 : // There might be another way to implement this if we have a traversal that only called a
5306 : // representative object (one call for each type of Sage IIIIR node).
5307 0 : size_t memory = numberOfNodes() * sizeof(SgFuncDecl_attr);
5308 :
5309 0 : return memory;
5310 : }
5311 :
5312 : /* #line 5313 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
5313 :
5314 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
5315 : void
5316 5342 : SgClassDecl_attr::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
5317 : {
5318 : // This function traverses the memory pool for only a specific IR node
5319 : // and calls the visit function of the input class execute a traversal
5320 : // similar to the style of the attribute based traversals within ROSE.
5321 : // This traversal will visit ALL nodes of the AST where as the other
5322 : // attribute based traversals visit only the embedded tree within the AST.
5323 :
5324 : // Initialize array to the address of the first element of the STL vector
5325 : // (which is guaranteed to be contiguous storage).
5326 : // SgClassDecl_attr objectArray [] = *(Memory_Block_List.begin());
5327 5342 : if (SgClassDecl_attr::pools.empty() == false)
5328 : {
5329 : // Generate an array of memory pools
5330 0 : SgClassDecl_attr** objectArray = (SgClassDecl_attr**) &(SgClassDecl_attr::pools[0]);
5331 :
5332 : // Build a local variable for better performance
5333 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
5334 : #if 0
5335 : // Iterate over the memory pools
5336 : for (unsigned int i=0; i < SgClassDecl_attr::pools.size(); i++)
5337 : {
5338 : // objectArray[i] is a single memory pool
5339 : for (int j=0; j < SgClassDecl_attr::pool_size; j++)
5340 : {
5341 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
5342 : {
5343 : traversal.visit(&(objectArray[i][j]));
5344 : }
5345 : }
5346 : }
5347 : #else
5348 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
5349 : // compute the list first and then call the visit function on each list element.
5350 :
5351 : // printf ("Inside of SgClassDecl_attr::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
5352 :
5353 0 : std::vector<SgClassDecl_attr*> nodeList;
5354 :
5355 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
5356 0 : for (unsigned int i=0; i < SgClassDecl_attr::pools.size(); i++)
5357 : {
5358 : // objectArray[i] is a single memory pool
5359 0 : for (unsigned j=0; j < SgClassDecl_attr::pool_size; j++)
5360 : {
5361 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
5362 : {
5363 0 : nodeList.push_back(&(objectArray[i][j]));
5364 : }
5365 : }
5366 : }
5367 :
5368 : // Iterate over the saved list
5369 0 : size_t nodeListSize = nodeList.size();
5370 0 : for (size_t i=0; i < nodeListSize; i++)
5371 : {
5372 0 : ROSE_ASSERT(nodeList[i] != NULL);
5373 : #if 0
5374 : traversal.visit(nodeList[i]);
5375 : #else
5376 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
5377 : {
5378 0 : traversal.visit(nodeList[i]);
5379 : }
5380 : #endif
5381 : }
5382 : #endif
5383 : }
5384 :
5385 : // This should not be required since all previously static data members are
5386 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
5387 :
5388 5342 : }
5389 :
5390 :
5391 : void
5392 194 : SgClassDecl_attr::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
5393 : {
5394 : // This function traverses the memory pool for an IR node and
5395 : // calls the function to execute the visitor object.
5396 :
5397 : // Initialize array to the address of the first element of the STL vector
5398 : // (which is guarenteed to be contiguous storage).
5399 : // SgClassDecl_attr objectArray [] = *(Memory_Block_List.begin());
5400 194 : if (SgClassDecl_attr::pools.empty() == false)
5401 : {
5402 : // Generate an array of memory pools
5403 0 : SgClassDecl_attr** objectArray = (SgClassDecl_attr**) &(SgClassDecl_attr::pools[0]);
5404 :
5405 : // Build a local variable for better performance
5406 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
5407 :
5408 : // Iterate over the memory pools
5409 0 : for (unsigned int i=0; i < SgClassDecl_attr::pools.size(); i++)
5410 : {
5411 : // objectArray[i] is a single memory pool
5412 0 : for (unsigned j=0; j < SgClassDecl_attr::pool_size; j++)
5413 : {
5414 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
5415 : {
5416 : // printf ("Found a valid SgClassDecl_attr object in the memory pool %d at position %d \n",i,j);
5417 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
5418 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
5419 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
5420 : }
5421 : else
5422 : {
5423 : // printf ("Found a INVALID SgClassDecl_attr object in the memory pool \n");
5424 : }
5425 : }
5426 : }
5427 : }
5428 :
5429 : // This should not be required since all previously static data members are
5430 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
5431 :
5432 194 : }
5433 :
5434 : void
5435 0 : SgClassDecl_attr::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
5436 : {
5437 : // This function visits only a single IR node of the memory pool.
5438 : // it is typically called once for each type of IR node within
5439 : // the automatically generated function: traverseRepresentativeNodes().
5440 :
5441 : // Initialize array to the address of the first element of the STL vector
5442 : // (which is guarenteed to be contiguous storage).
5443 : // SgClassDecl_attr objectArray [] = *(Memory_Block_List.begin());
5444 0 : if (SgClassDecl_attr::pools.empty() == false)
5445 : {
5446 : // Generate an array of memory pools
5447 0 : SgClassDecl_attr** objectArray = (SgClassDecl_attr**) &(SgClassDecl_attr::pools[0]);
5448 :
5449 : // Build a local variable for better performance
5450 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
5451 :
5452 : // Iterate over the memory pools
5453 0 : bool done = false;
5454 0 : unsigned i=0;
5455 :
5456 : // find the first valid IR node, call visit function, and then leave
5457 0 : while ( done == false && i < SgClassDecl_attr::pools.size() )
5458 : {
5459 : // objectArray[i] is a single memory pool
5460 : unsigned j=0;
5461 0 : while (done == false && j < SgClassDecl_attr::pool_size)
5462 : {
5463 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
5464 : {
5465 0 : traversal.visit(&(objectArray[i][j]));
5466 0 : done = true;
5467 : }
5468 0 : j++;
5469 : }
5470 0 : i++;
5471 : }
5472 :
5473 : #if 0
5474 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
5475 : if (done == false)
5476 : {
5477 : printf ("No representative for SgClassDecl_attr found in memory pools \n");
5478 : }
5479 : #endif
5480 : }
5481 0 : }
5482 :
5483 :
5484 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
5485 : // using values that overflow signed values of int.
5486 : size_t
5487 4 : SgClassDecl_attr::numberOfNodes()
5488 : {
5489 : // This function traverses the memory pool for an IR node and
5490 : // counts the number of IR nodes of a particular Sage III IR
5491 : // nodes type.
5492 :
5493 4 : size_t count = 0;
5494 4 : if (SgClassDecl_attr::pools.empty() == false)
5495 : {
5496 : // Generate an array of memory pools (this is actually a STL vector,
5497 : // but it is contiguious, so OK to treat this way).
5498 0 : SgClassDecl_attr** objectArray = (SgClassDecl_attr**) &(SgClassDecl_attr::pools[0]);
5499 :
5500 : // Build a local variable for better performance (make it a loop invariant variable).
5501 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
5502 :
5503 : // Iterate over all of the memory pools for this IR node.
5504 0 : for (unsigned int i=0; i < SgClassDecl_attr::pools.size(); i++)
5505 : {
5506 : // objectArray[i] is a single memory pool, iterate over all the
5507 : // IR nodes and only count those that are valid IR nodes used in
5508 : // the AST (i.e. allocated IR nodes).
5509 0 : for (unsigned j=0; j < SgClassDecl_attr::pool_size; j++)
5510 : {
5511 : // This is indexing the STL vector of C/C++ style arrays as a doubly
5512 : // indexed array access. It is OK since we have leveraged the semantics
5513 : // of STL vector memory as contigous and cast the memory as an array
5514 : // of arrays to use the 2D array indexing. Hope this is not confusing,
5515 : // but it s very fast as an implementation.
5516 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
5517 : {
5518 0 : count++;
5519 : }
5520 : }
5521 : }
5522 : }
5523 :
5524 :
5525 :
5526 4 : return count;
5527 : }
5528 :
5529 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
5530 : // using values that overflow signed values of int.
5531 : size_t
5532 0 : SgClassDecl_attr::memoryUsage()
5533 : {
5534 : // This function is required because we need the class name as a type when we call sizeof
5535 : // There might be another way to implement this if we have a traversal that only called a
5536 : // representative object (one call for each type of Sage IIIIR node).
5537 0 : size_t memory = numberOfNodes() * sizeof(SgClassDecl_attr);
5538 :
5539 0 : return memory;
5540 : }
5541 :
5542 : /* #line 5543 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
5543 :
5544 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
5545 : void
5546 5342 : Sg_File_Info::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
5547 : {
5548 : // This function traverses the memory pool for only a specific IR node
5549 : // and calls the visit function of the input class execute a traversal
5550 : // similar to the style of the attribute based traversals within ROSE.
5551 : // This traversal will visit ALL nodes of the AST where as the other
5552 : // attribute based traversals visit only the embedded tree within the AST.
5553 :
5554 : // Initialize array to the address of the first element of the STL vector
5555 : // (which is guaranteed to be contiguous storage).
5556 : // Sg_File_Info objectArray [] = *(Memory_Block_List.begin());
5557 5342 : if (Sg_File_Info::pools.empty() == false)
5558 : {
5559 : // Generate an array of memory pools
5560 5342 : Sg_File_Info** objectArray = (Sg_File_Info**) &(Sg_File_Info::pools[0]);
5561 :
5562 : // Build a local variable for better performance
5563 5342 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
5564 : #if 0
5565 : // Iterate over the memory pools
5566 : for (unsigned int i=0; i < Sg_File_Info::pools.size(); i++)
5567 : {
5568 : // objectArray[i] is a single memory pool
5569 : for (int j=0; j < Sg_File_Info::pool_size; j++)
5570 : {
5571 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
5572 : {
5573 : traversal.visit(&(objectArray[i][j]));
5574 : }
5575 : }
5576 : }
5577 : #else
5578 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
5579 : // compute the list first and then call the visit function on each list element.
5580 :
5581 : // printf ("Inside of Sg_File_Info::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
5582 :
5583 10684 : std::vector<Sg_File_Info*> nodeList;
5584 :
5585 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
5586 230707 : for (unsigned int i=0; i < Sg_File_Info::pools.size(); i++)
5587 : {
5588 : // objectArray[i] is a single memory pool
5589 450955000 : for (unsigned j=0; j < Sg_File_Info::pool_size; j++)
5590 : {
5591 450730000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
5592 : {
5593 442413000 : nodeList.push_back(&(objectArray[i][j]));
5594 : }
5595 : }
5596 : }
5597 :
5598 : // Iterate over the saved list
5599 5342 : size_t nodeListSize = nodeList.size();
5600 442419000 : for (size_t i=0; i < nodeListSize; i++)
5601 : {
5602 442413000 : ROSE_ASSERT(nodeList[i] != NULL);
5603 : #if 0
5604 : traversal.visit(nodeList[i]);
5605 : #else
5606 442413000 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
5607 : {
5608 442413000 : traversal.visit(nodeList[i]);
5609 : }
5610 : #endif
5611 : }
5612 : #endif
5613 : }
5614 :
5615 : // This should not be required since all previously static data members are
5616 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
5617 :
5618 5342 : }
5619 :
5620 :
5621 : void
5622 194 : Sg_File_Info::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
5623 : {
5624 : // This function traverses the memory pool for an IR node and
5625 : // calls the function to execute the visitor object.
5626 :
5627 : // Initialize array to the address of the first element of the STL vector
5628 : // (which is guarenteed to be contiguous storage).
5629 : // Sg_File_Info objectArray [] = *(Memory_Block_List.begin());
5630 194 : if (Sg_File_Info::pools.empty() == false)
5631 : {
5632 : // Generate an array of memory pools
5633 194 : Sg_File_Info** objectArray = (Sg_File_Info**) &(Sg_File_Info::pools[0]);
5634 :
5635 : // Build a local variable for better performance
5636 194 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
5637 :
5638 : // Iterate over the memory pools
5639 35483 : for (unsigned int i=0; i < Sg_File_Info::pools.size(); i++)
5640 : {
5641 : // objectArray[i] is a single memory pool
5642 70613300 : for (unsigned j=0; j < Sg_File_Info::pool_size; j++)
5643 : {
5644 70578000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
5645 : {
5646 : // printf ("Found a valid Sg_File_Info object in the memory pool %d at position %d \n",i,j);
5647 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
5648 70392000 : objectArray[i][j].executeVisitorMemberFunction(visitor);
5649 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
5650 : }
5651 : else
5652 : {
5653 : // printf ("Found a INVALID Sg_File_Info object in the memory pool \n");
5654 : }
5655 : }
5656 : }
5657 : }
5658 :
5659 : // This should not be required since all previously static data members are
5660 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
5661 :
5662 194 : }
5663 :
5664 : void
5665 0 : Sg_File_Info::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
5666 : {
5667 : // This function visits only a single IR node of the memory pool.
5668 : // it is typically called once for each type of IR node within
5669 : // the automatically generated function: traverseRepresentativeNodes().
5670 :
5671 : // Initialize array to the address of the first element of the STL vector
5672 : // (which is guarenteed to be contiguous storage).
5673 : // Sg_File_Info objectArray [] = *(Memory_Block_List.begin());
5674 0 : if (Sg_File_Info::pools.empty() == false)
5675 : {
5676 : // Generate an array of memory pools
5677 0 : Sg_File_Info** objectArray = (Sg_File_Info**) &(Sg_File_Info::pools[0]);
5678 :
5679 : // Build a local variable for better performance
5680 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
5681 :
5682 : // Iterate over the memory pools
5683 0 : bool done = false;
5684 0 : unsigned i=0;
5685 :
5686 : // find the first valid IR node, call visit function, and then leave
5687 0 : while ( done == false && i < Sg_File_Info::pools.size() )
5688 : {
5689 : // objectArray[i] is a single memory pool
5690 : unsigned j=0;
5691 0 : while (done == false && j < Sg_File_Info::pool_size)
5692 : {
5693 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
5694 : {
5695 0 : traversal.visit(&(objectArray[i][j]));
5696 0 : done = true;
5697 : }
5698 0 : j++;
5699 : }
5700 0 : i++;
5701 : }
5702 :
5703 : #if 0
5704 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
5705 : if (done == false)
5706 : {
5707 : printf ("No representative for Sg_File_Info found in memory pools \n");
5708 : }
5709 : #endif
5710 : }
5711 0 : }
5712 :
5713 :
5714 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
5715 : // using values that overflow signed values of int.
5716 : size_t
5717 10 : Sg_File_Info::numberOfNodes()
5718 : {
5719 : // This function traverses the memory pool for an IR node and
5720 : // counts the number of IR nodes of a particular Sage III IR
5721 : // nodes type.
5722 :
5723 10 : size_t count = 0;
5724 10 : if (Sg_File_Info::pools.empty() == false)
5725 : {
5726 : // Generate an array of memory pools (this is actually a STL vector,
5727 : // but it is contiguious, so OK to treat this way).
5728 10 : Sg_File_Info** objectArray = (Sg_File_Info**) &(Sg_File_Info::pools[0]);
5729 :
5730 : // Build a local variable for better performance (make it a loop invariant variable).
5731 10 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
5732 :
5733 : // Iterate over all of the memory pools for this IR node.
5734 989 : for (unsigned int i=0; i < Sg_File_Info::pools.size(); i++)
5735 : {
5736 : // objectArray[i] is a single memory pool, iterate over all the
5737 : // IR nodes and only count those that are valid IR nodes used in
5738 : // the AST (i.e. allocated IR nodes).
5739 1958980 : for (unsigned j=0; j < Sg_File_Info::pool_size; j++)
5740 : {
5741 : // This is indexing the STL vector of C/C++ style arrays as a doubly
5742 : // indexed array access. It is OK since we have leveraged the semantics
5743 : // of STL vector memory as contigous and cast the memory as an array
5744 : // of arrays to use the 2D array indexing. Hope this is not confusing,
5745 : // but it s very fast as an implementation.
5746 1958000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
5747 : {
5748 1944130 : count++;
5749 : }
5750 : }
5751 : }
5752 : }
5753 :
5754 :
5755 :
5756 10 : return count;
5757 : }
5758 :
5759 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
5760 : // using values that overflow signed values of int.
5761 : size_t
5762 0 : Sg_File_Info::memoryUsage()
5763 : {
5764 : // This function is required because we need the class name as a type when we call sizeof
5765 : // There might be another way to implement this if we have a traversal that only called a
5766 : // representative object (one call for each type of Sage IIIIR node).
5767 0 : size_t memory = numberOfNodes() * sizeof(Sg_File_Info);
5768 :
5769 0 : return memory;
5770 : }
5771 :
5772 : /* #line 5773 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
5773 :
5774 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
5775 : void
5776 5342 : SgFile::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
5777 : {
5778 : // This function traverses the memory pool for only a specific IR node
5779 : // and calls the visit function of the input class execute a traversal
5780 : // similar to the style of the attribute based traversals within ROSE.
5781 : // This traversal will visit ALL nodes of the AST where as the other
5782 : // attribute based traversals visit only the embedded tree within the AST.
5783 :
5784 : // Initialize array to the address of the first element of the STL vector
5785 : // (which is guaranteed to be contiguous storage).
5786 : // SgFile objectArray [] = *(Memory_Block_List.begin());
5787 5342 : if (SgFile::pools.empty() == false)
5788 : {
5789 : // Generate an array of memory pools
5790 0 : SgFile** objectArray = (SgFile**) &(SgFile::pools[0]);
5791 :
5792 : // Build a local variable for better performance
5793 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
5794 : #if 0
5795 : // Iterate over the memory pools
5796 : for (unsigned int i=0; i < SgFile::pools.size(); i++)
5797 : {
5798 : // objectArray[i] is a single memory pool
5799 : for (int j=0; j < SgFile::pool_size; j++)
5800 : {
5801 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
5802 : {
5803 : traversal.visit(&(objectArray[i][j]));
5804 : }
5805 : }
5806 : }
5807 : #else
5808 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
5809 : // compute the list first and then call the visit function on each list element.
5810 :
5811 : // printf ("Inside of SgFile::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
5812 :
5813 0 : std::vector<SgFile*> nodeList;
5814 :
5815 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
5816 0 : for (unsigned int i=0; i < SgFile::pools.size(); i++)
5817 : {
5818 : // objectArray[i] is a single memory pool
5819 0 : for (unsigned j=0; j < SgFile::pool_size; j++)
5820 : {
5821 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
5822 : {
5823 0 : nodeList.push_back(&(objectArray[i][j]));
5824 : }
5825 : }
5826 : }
5827 :
5828 : // Iterate over the saved list
5829 0 : size_t nodeListSize = nodeList.size();
5830 0 : for (size_t i=0; i < nodeListSize; i++)
5831 : {
5832 0 : ROSE_ASSERT(nodeList[i] != NULL);
5833 : #if 0
5834 : traversal.visit(nodeList[i]);
5835 : #else
5836 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
5837 : {
5838 0 : traversal.visit(nodeList[i]);
5839 : }
5840 : #endif
5841 : }
5842 : #endif
5843 : }
5844 :
5845 : // This should not be required since all previously static data members are
5846 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
5847 :
5848 5342 : }
5849 :
5850 :
5851 : void
5852 194 : SgFile::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
5853 : {
5854 : // This function traverses the memory pool for an IR node and
5855 : // calls the function to execute the visitor object.
5856 :
5857 : // Initialize array to the address of the first element of the STL vector
5858 : // (which is guarenteed to be contiguous storage).
5859 : // SgFile objectArray [] = *(Memory_Block_List.begin());
5860 194 : if (SgFile::pools.empty() == false)
5861 : {
5862 : // Generate an array of memory pools
5863 0 : SgFile** objectArray = (SgFile**) &(SgFile::pools[0]);
5864 :
5865 : // Build a local variable for better performance
5866 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
5867 :
5868 : // Iterate over the memory pools
5869 0 : for (unsigned int i=0; i < SgFile::pools.size(); i++)
5870 : {
5871 : // objectArray[i] is a single memory pool
5872 0 : for (unsigned j=0; j < SgFile::pool_size; j++)
5873 : {
5874 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
5875 : {
5876 : // printf ("Found a valid SgFile object in the memory pool %d at position %d \n",i,j);
5877 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
5878 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
5879 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
5880 : }
5881 : else
5882 : {
5883 : // printf ("Found a INVALID SgFile object in the memory pool \n");
5884 : }
5885 : }
5886 : }
5887 : }
5888 :
5889 : // This should not be required since all previously static data members are
5890 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
5891 :
5892 194 : }
5893 :
5894 : void
5895 0 : SgFile::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
5896 : {
5897 : // This function visits only a single IR node of the memory pool.
5898 : // it is typically called once for each type of IR node within
5899 : // the automatically generated function: traverseRepresentativeNodes().
5900 :
5901 : // Initialize array to the address of the first element of the STL vector
5902 : // (which is guarenteed to be contiguous storage).
5903 : // SgFile objectArray [] = *(Memory_Block_List.begin());
5904 0 : if (SgFile::pools.empty() == false)
5905 : {
5906 : // Generate an array of memory pools
5907 0 : SgFile** objectArray = (SgFile**) &(SgFile::pools[0]);
5908 :
5909 : // Build a local variable for better performance
5910 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
5911 :
5912 : // Iterate over the memory pools
5913 0 : bool done = false;
5914 0 : unsigned i=0;
5915 :
5916 : // find the first valid IR node, call visit function, and then leave
5917 0 : while ( done == false && i < SgFile::pools.size() )
5918 : {
5919 : // objectArray[i] is a single memory pool
5920 : unsigned j=0;
5921 0 : while (done == false && j < SgFile::pool_size)
5922 : {
5923 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
5924 : {
5925 0 : traversal.visit(&(objectArray[i][j]));
5926 0 : done = true;
5927 : }
5928 0 : j++;
5929 : }
5930 0 : i++;
5931 : }
5932 :
5933 : #if 0
5934 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
5935 : if (done == false)
5936 : {
5937 : printf ("No representative for SgFile found in memory pools \n");
5938 : }
5939 : #endif
5940 : }
5941 0 : }
5942 :
5943 :
5944 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
5945 : // using values that overflow signed values of int.
5946 : size_t
5947 4 : SgFile::numberOfNodes()
5948 : {
5949 : // This function traverses the memory pool for an IR node and
5950 : // counts the number of IR nodes of a particular Sage III IR
5951 : // nodes type.
5952 :
5953 4 : size_t count = 0;
5954 4 : if (SgFile::pools.empty() == false)
5955 : {
5956 : // Generate an array of memory pools (this is actually a STL vector,
5957 : // but it is contiguious, so OK to treat this way).
5958 0 : SgFile** objectArray = (SgFile**) &(SgFile::pools[0]);
5959 :
5960 : // Build a local variable for better performance (make it a loop invariant variable).
5961 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
5962 :
5963 : // Iterate over all of the memory pools for this IR node.
5964 0 : for (unsigned int i=0; i < SgFile::pools.size(); i++)
5965 : {
5966 : // objectArray[i] is a single memory pool, iterate over all the
5967 : // IR nodes and only count those that are valid IR nodes used in
5968 : // the AST (i.e. allocated IR nodes).
5969 0 : for (unsigned j=0; j < SgFile::pool_size; j++)
5970 : {
5971 : // This is indexing the STL vector of C/C++ style arrays as a doubly
5972 : // indexed array access. It is OK since we have leveraged the semantics
5973 : // of STL vector memory as contigous and cast the memory as an array
5974 : // of arrays to use the 2D array indexing. Hope this is not confusing,
5975 : // but it s very fast as an implementation.
5976 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
5977 : {
5978 0 : count++;
5979 : }
5980 : }
5981 : }
5982 : }
5983 :
5984 :
5985 :
5986 4 : return count;
5987 : }
5988 :
5989 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
5990 : // using values that overflow signed values of int.
5991 : size_t
5992 0 : SgFile::memoryUsage()
5993 : {
5994 : // This function is required because we need the class name as a type when we call sizeof
5995 : // There might be another way to implement this if we have a traversal that only called a
5996 : // representative object (one call for each type of Sage IIIIR node).
5997 0 : size_t memory = numberOfNodes() * sizeof(SgFile);
5998 :
5999 0 : return memory;
6000 : }
6001 :
6002 : /* #line 6003 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
6003 :
6004 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
6005 : void
6006 5342 : SgSourceFile::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
6007 : {
6008 : // This function traverses the memory pool for only a specific IR node
6009 : // and calls the visit function of the input class execute a traversal
6010 : // similar to the style of the attribute based traversals within ROSE.
6011 : // This traversal will visit ALL nodes of the AST where as the other
6012 : // attribute based traversals visit only the embedded tree within the AST.
6013 :
6014 : // Initialize array to the address of the first element of the STL vector
6015 : // (which is guaranteed to be contiguous storage).
6016 : // SgSourceFile objectArray [] = *(Memory_Block_List.begin());
6017 5342 : if (SgSourceFile::pools.empty() == false)
6018 : {
6019 : // Generate an array of memory pools
6020 5342 : SgSourceFile** objectArray = (SgSourceFile**) &(SgSourceFile::pools[0]);
6021 :
6022 : // Build a local variable for better performance
6023 5342 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
6024 : #if 0
6025 : // Iterate over the memory pools
6026 : for (unsigned int i=0; i < SgSourceFile::pools.size(); i++)
6027 : {
6028 : // objectArray[i] is a single memory pool
6029 : for (int j=0; j < SgSourceFile::pool_size; j++)
6030 : {
6031 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
6032 : {
6033 : traversal.visit(&(objectArray[i][j]));
6034 : }
6035 : }
6036 : }
6037 : #else
6038 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
6039 : // compute the list first and then call the visit function on each list element.
6040 :
6041 : // printf ("Inside of SgSourceFile::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
6042 :
6043 10684 : std::vector<SgSourceFile*> nodeList;
6044 :
6045 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
6046 10684 : for (unsigned int i=0; i < SgSourceFile::pools.size(); i++)
6047 : {
6048 : // objectArray[i] is a single memory pool
6049 10689300 : for (unsigned j=0; j < SgSourceFile::pool_size; j++)
6050 : {
6051 10684000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
6052 : {
6053 167237 : nodeList.push_back(&(objectArray[i][j]));
6054 : }
6055 : }
6056 : }
6057 :
6058 : // Iterate over the saved list
6059 5342 : size_t nodeListSize = nodeList.size();
6060 172579 : for (size_t i=0; i < nodeListSize; i++)
6061 : {
6062 167237 : ROSE_ASSERT(nodeList[i] != NULL);
6063 : #if 0
6064 : traversal.visit(nodeList[i]);
6065 : #else
6066 167237 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
6067 : {
6068 167237 : traversal.visit(nodeList[i]);
6069 : }
6070 : #endif
6071 : }
6072 : #endif
6073 : }
6074 :
6075 : // This should not be required since all previously static data members are
6076 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
6077 :
6078 5342 : }
6079 :
6080 :
6081 : void
6082 194 : SgSourceFile::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
6083 : {
6084 : // This function traverses the memory pool for an IR node and
6085 : // calls the function to execute the visitor object.
6086 :
6087 : // Initialize array to the address of the first element of the STL vector
6088 : // (which is guarenteed to be contiguous storage).
6089 : // SgSourceFile objectArray [] = *(Memory_Block_List.begin());
6090 194 : if (SgSourceFile::pools.empty() == false)
6091 : {
6092 : // Generate an array of memory pools
6093 194 : SgSourceFile** objectArray = (SgSourceFile**) &(SgSourceFile::pools[0]);
6094 :
6095 : // Build a local variable for better performance
6096 194 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
6097 :
6098 : // Iterate over the memory pools
6099 388 : for (unsigned int i=0; i < SgSourceFile::pools.size(); i++)
6100 : {
6101 : // objectArray[i] is a single memory pool
6102 388194 : for (unsigned j=0; j < SgSourceFile::pool_size; j++)
6103 : {
6104 388000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
6105 : {
6106 : // printf ("Found a valid SgSourceFile object in the memory pool %d at position %d \n",i,j);
6107 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
6108 23799 : objectArray[i][j].executeVisitorMemberFunction(visitor);
6109 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
6110 : }
6111 : else
6112 : {
6113 : // printf ("Found a INVALID SgSourceFile object in the memory pool \n");
6114 : }
6115 : }
6116 : }
6117 : }
6118 :
6119 : // This should not be required since all previously static data members are
6120 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
6121 :
6122 194 : }
6123 :
6124 : void
6125 0 : SgSourceFile::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
6126 : {
6127 : // This function visits only a single IR node of the memory pool.
6128 : // it is typically called once for each type of IR node within
6129 : // the automatically generated function: traverseRepresentativeNodes().
6130 :
6131 : // Initialize array to the address of the first element of the STL vector
6132 : // (which is guarenteed to be contiguous storage).
6133 : // SgSourceFile objectArray [] = *(Memory_Block_List.begin());
6134 0 : if (SgSourceFile::pools.empty() == false)
6135 : {
6136 : // Generate an array of memory pools
6137 0 : SgSourceFile** objectArray = (SgSourceFile**) &(SgSourceFile::pools[0]);
6138 :
6139 : // Build a local variable for better performance
6140 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
6141 :
6142 : // Iterate over the memory pools
6143 0 : bool done = false;
6144 0 : unsigned i=0;
6145 :
6146 : // find the first valid IR node, call visit function, and then leave
6147 0 : while ( done == false && i < SgSourceFile::pools.size() )
6148 : {
6149 : // objectArray[i] is a single memory pool
6150 : unsigned j=0;
6151 0 : while (done == false && j < SgSourceFile::pool_size)
6152 : {
6153 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
6154 : {
6155 0 : traversal.visit(&(objectArray[i][j]));
6156 0 : done = true;
6157 : }
6158 0 : j++;
6159 : }
6160 0 : i++;
6161 : }
6162 :
6163 : #if 0
6164 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
6165 : if (done == false)
6166 : {
6167 : printf ("No representative for SgSourceFile found in memory pools \n");
6168 : }
6169 : #endif
6170 : }
6171 0 : }
6172 :
6173 :
6174 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
6175 : // using values that overflow signed values of int.
6176 : size_t
6177 4 : SgSourceFile::numberOfNodes()
6178 : {
6179 : // This function traverses the memory pool for an IR node and
6180 : // counts the number of IR nodes of a particular Sage III IR
6181 : // nodes type.
6182 :
6183 4 : size_t count = 0;
6184 4 : if (SgSourceFile::pools.empty() == false)
6185 : {
6186 : // Generate an array of memory pools (this is actually a STL vector,
6187 : // but it is contiguious, so OK to treat this way).
6188 4 : SgSourceFile** objectArray = (SgSourceFile**) &(SgSourceFile::pools[0]);
6189 :
6190 : // Build a local variable for better performance (make it a loop invariant variable).
6191 4 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
6192 :
6193 : // Iterate over all of the memory pools for this IR node.
6194 8 : for (unsigned int i=0; i < SgSourceFile::pools.size(); i++)
6195 : {
6196 : // objectArray[i] is a single memory pool, iterate over all the
6197 : // IR nodes and only count those that are valid IR nodes used in
6198 : // the AST (i.e. allocated IR nodes).
6199 8004 : for (unsigned j=0; j < SgSourceFile::pool_size; j++)
6200 : {
6201 : // This is indexing the STL vector of C/C++ style arrays as a doubly
6202 : // indexed array access. It is OK since we have leveraged the semantics
6203 : // of STL vector memory as contigous and cast the memory as an array
6204 : // of arrays to use the 2D array indexing. Hope this is not confusing,
6205 : // but it s very fast as an implementation.
6206 8000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
6207 : {
6208 199 : count++;
6209 : }
6210 : }
6211 : }
6212 : }
6213 :
6214 :
6215 :
6216 4 : return count;
6217 : }
6218 :
6219 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
6220 : // using values that overflow signed values of int.
6221 : size_t
6222 0 : SgSourceFile::memoryUsage()
6223 : {
6224 : // This function is required because we need the class name as a type when we call sizeof
6225 : // There might be another way to implement this if we have a traversal that only called a
6226 : // representative object (one call for each type of Sage IIIIR node).
6227 0 : size_t memory = numberOfNodes() * sizeof(SgSourceFile);
6228 :
6229 0 : return memory;
6230 : }
6231 :
6232 : /* #line 6233 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
6233 :
6234 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
6235 : void
6236 5342 : SgUnknownFile::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
6237 : {
6238 : // This function traverses the memory pool for only a specific IR node
6239 : // and calls the visit function of the input class execute a traversal
6240 : // similar to the style of the attribute based traversals within ROSE.
6241 : // This traversal will visit ALL nodes of the AST where as the other
6242 : // attribute based traversals visit only the embedded tree within the AST.
6243 :
6244 : // Initialize array to the address of the first element of the STL vector
6245 : // (which is guaranteed to be contiguous storage).
6246 : // SgUnknownFile objectArray [] = *(Memory_Block_List.begin());
6247 5342 : if (SgUnknownFile::pools.empty() == false)
6248 : {
6249 : // Generate an array of memory pools
6250 0 : SgUnknownFile** objectArray = (SgUnknownFile**) &(SgUnknownFile::pools[0]);
6251 :
6252 : // Build a local variable for better performance
6253 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
6254 : #if 0
6255 : // Iterate over the memory pools
6256 : for (unsigned int i=0; i < SgUnknownFile::pools.size(); i++)
6257 : {
6258 : // objectArray[i] is a single memory pool
6259 : for (int j=0; j < SgUnknownFile::pool_size; j++)
6260 : {
6261 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
6262 : {
6263 : traversal.visit(&(objectArray[i][j]));
6264 : }
6265 : }
6266 : }
6267 : #else
6268 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
6269 : // compute the list first and then call the visit function on each list element.
6270 :
6271 : // printf ("Inside of SgUnknownFile::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
6272 :
6273 0 : std::vector<SgUnknownFile*> nodeList;
6274 :
6275 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
6276 0 : for (unsigned int i=0; i < SgUnknownFile::pools.size(); i++)
6277 : {
6278 : // objectArray[i] is a single memory pool
6279 0 : for (unsigned j=0; j < SgUnknownFile::pool_size; j++)
6280 : {
6281 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
6282 : {
6283 0 : nodeList.push_back(&(objectArray[i][j]));
6284 : }
6285 : }
6286 : }
6287 :
6288 : // Iterate over the saved list
6289 0 : size_t nodeListSize = nodeList.size();
6290 0 : for (size_t i=0; i < nodeListSize; i++)
6291 : {
6292 0 : ROSE_ASSERT(nodeList[i] != NULL);
6293 : #if 0
6294 : traversal.visit(nodeList[i]);
6295 : #else
6296 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
6297 : {
6298 0 : traversal.visit(nodeList[i]);
6299 : }
6300 : #endif
6301 : }
6302 : #endif
6303 : }
6304 :
6305 : // This should not be required since all previously static data members are
6306 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
6307 :
6308 5342 : }
6309 :
6310 :
6311 : void
6312 194 : SgUnknownFile::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
6313 : {
6314 : // This function traverses the memory pool for an IR node and
6315 : // calls the function to execute the visitor object.
6316 :
6317 : // Initialize array to the address of the first element of the STL vector
6318 : // (which is guarenteed to be contiguous storage).
6319 : // SgUnknownFile objectArray [] = *(Memory_Block_List.begin());
6320 194 : if (SgUnknownFile::pools.empty() == false)
6321 : {
6322 : // Generate an array of memory pools
6323 0 : SgUnknownFile** objectArray = (SgUnknownFile**) &(SgUnknownFile::pools[0]);
6324 :
6325 : // Build a local variable for better performance
6326 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
6327 :
6328 : // Iterate over the memory pools
6329 0 : for (unsigned int i=0; i < SgUnknownFile::pools.size(); i++)
6330 : {
6331 : // objectArray[i] is a single memory pool
6332 0 : for (unsigned j=0; j < SgUnknownFile::pool_size; j++)
6333 : {
6334 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
6335 : {
6336 : // printf ("Found a valid SgUnknownFile object in the memory pool %d at position %d \n",i,j);
6337 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
6338 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
6339 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
6340 : }
6341 : else
6342 : {
6343 : // printf ("Found a INVALID SgUnknownFile object in the memory pool \n");
6344 : }
6345 : }
6346 : }
6347 : }
6348 :
6349 : // This should not be required since all previously static data members are
6350 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
6351 :
6352 194 : }
6353 :
6354 : void
6355 0 : SgUnknownFile::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
6356 : {
6357 : // This function visits only a single IR node of the memory pool.
6358 : // it is typically called once for each type of IR node within
6359 : // the automatically generated function: traverseRepresentativeNodes().
6360 :
6361 : // Initialize array to the address of the first element of the STL vector
6362 : // (which is guarenteed to be contiguous storage).
6363 : // SgUnknownFile objectArray [] = *(Memory_Block_List.begin());
6364 0 : if (SgUnknownFile::pools.empty() == false)
6365 : {
6366 : // Generate an array of memory pools
6367 0 : SgUnknownFile** objectArray = (SgUnknownFile**) &(SgUnknownFile::pools[0]);
6368 :
6369 : // Build a local variable for better performance
6370 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
6371 :
6372 : // Iterate over the memory pools
6373 0 : bool done = false;
6374 0 : unsigned i=0;
6375 :
6376 : // find the first valid IR node, call visit function, and then leave
6377 0 : while ( done == false && i < SgUnknownFile::pools.size() )
6378 : {
6379 : // objectArray[i] is a single memory pool
6380 : unsigned j=0;
6381 0 : while (done == false && j < SgUnknownFile::pool_size)
6382 : {
6383 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
6384 : {
6385 0 : traversal.visit(&(objectArray[i][j]));
6386 0 : done = true;
6387 : }
6388 0 : j++;
6389 : }
6390 0 : i++;
6391 : }
6392 :
6393 : #if 0
6394 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
6395 : if (done == false)
6396 : {
6397 : printf ("No representative for SgUnknownFile found in memory pools \n");
6398 : }
6399 : #endif
6400 : }
6401 0 : }
6402 :
6403 :
6404 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
6405 : // using values that overflow signed values of int.
6406 : size_t
6407 4 : SgUnknownFile::numberOfNodes()
6408 : {
6409 : // This function traverses the memory pool for an IR node and
6410 : // counts the number of IR nodes of a particular Sage III IR
6411 : // nodes type.
6412 :
6413 4 : size_t count = 0;
6414 4 : if (SgUnknownFile::pools.empty() == false)
6415 : {
6416 : // Generate an array of memory pools (this is actually a STL vector,
6417 : // but it is contiguious, so OK to treat this way).
6418 0 : SgUnknownFile** objectArray = (SgUnknownFile**) &(SgUnknownFile::pools[0]);
6419 :
6420 : // Build a local variable for better performance (make it a loop invariant variable).
6421 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
6422 :
6423 : // Iterate over all of the memory pools for this IR node.
6424 0 : for (unsigned int i=0; i < SgUnknownFile::pools.size(); i++)
6425 : {
6426 : // objectArray[i] is a single memory pool, iterate over all the
6427 : // IR nodes and only count those that are valid IR nodes used in
6428 : // the AST (i.e. allocated IR nodes).
6429 0 : for (unsigned j=0; j < SgUnknownFile::pool_size; j++)
6430 : {
6431 : // This is indexing the STL vector of C/C++ style arrays as a doubly
6432 : // indexed array access. It is OK since we have leveraged the semantics
6433 : // of STL vector memory as contigous and cast the memory as an array
6434 : // of arrays to use the 2D array indexing. Hope this is not confusing,
6435 : // but it s very fast as an implementation.
6436 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
6437 : {
6438 0 : count++;
6439 : }
6440 : }
6441 : }
6442 : }
6443 :
6444 :
6445 :
6446 4 : return count;
6447 : }
6448 :
6449 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
6450 : // using values that overflow signed values of int.
6451 : size_t
6452 0 : SgUnknownFile::memoryUsage()
6453 : {
6454 : // This function is required because we need the class name as a type when we call sizeof
6455 : // There might be another way to implement this if we have a traversal that only called a
6456 : // representative object (one call for each type of Sage IIIIR node).
6457 0 : size_t memory = numberOfNodes() * sizeof(SgUnknownFile);
6458 :
6459 0 : return memory;
6460 : }
6461 :
6462 : /* #line 6463 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
6463 :
6464 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
6465 : void
6466 5422 : SgProject::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
6467 : {
6468 : // This function traverses the memory pool for only a specific IR node
6469 : // and calls the visit function of the input class execute a traversal
6470 : // similar to the style of the attribute based traversals within ROSE.
6471 : // This traversal will visit ALL nodes of the AST where as the other
6472 : // attribute based traversals visit only the embedded tree within the AST.
6473 :
6474 : // Initialize array to the address of the first element of the STL vector
6475 : // (which is guaranteed to be contiguous storage).
6476 : // SgProject objectArray [] = *(Memory_Block_List.begin());
6477 5422 : if (SgProject::pools.empty() == false)
6478 : {
6479 : // Generate an array of memory pools
6480 5422 : SgProject** objectArray = (SgProject**) &(SgProject::pools[0]);
6481 :
6482 : // Build a local variable for better performance
6483 5422 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
6484 : #if 0
6485 : // Iterate over the memory pools
6486 : for (unsigned int i=0; i < SgProject::pools.size(); i++)
6487 : {
6488 : // objectArray[i] is a single memory pool
6489 : for (int j=0; j < SgProject::pool_size; j++)
6490 : {
6491 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
6492 : {
6493 : traversal.visit(&(objectArray[i][j]));
6494 : }
6495 : }
6496 : }
6497 : #else
6498 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
6499 : // compute the list first and then call the visit function on each list element.
6500 :
6501 : // printf ("Inside of SgProject::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
6502 :
6503 10844 : std::vector<SgProject*> nodeList;
6504 :
6505 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
6506 10844 : for (unsigned int i=0; i < SgProject::pools.size(); i++)
6507 : {
6508 : // objectArray[i] is a single memory pool
6509 10849400 : for (unsigned j=0; j < SgProject::pool_size; j++)
6510 : {
6511 10844000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
6512 : {
6513 5480 : nodeList.push_back(&(objectArray[i][j]));
6514 : }
6515 : }
6516 : }
6517 :
6518 : // Iterate over the saved list
6519 5422 : size_t nodeListSize = nodeList.size();
6520 10902 : for (size_t i=0; i < nodeListSize; i++)
6521 : {
6522 5480 : ROSE_ASSERT(nodeList[i] != NULL);
6523 : #if 0
6524 : traversal.visit(nodeList[i]);
6525 : #else
6526 5480 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
6527 : {
6528 5480 : traversal.visit(nodeList[i]);
6529 : }
6530 : #endif
6531 : }
6532 : #endif
6533 : }
6534 :
6535 : // This should not be required since all previously static data members are
6536 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
6537 :
6538 5422 : }
6539 :
6540 :
6541 : void
6542 194 : SgProject::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
6543 : {
6544 : // This function traverses the memory pool for an IR node and
6545 : // calls the function to execute the visitor object.
6546 :
6547 : // Initialize array to the address of the first element of the STL vector
6548 : // (which is guarenteed to be contiguous storage).
6549 : // SgProject objectArray [] = *(Memory_Block_List.begin());
6550 194 : if (SgProject::pools.empty() == false)
6551 : {
6552 : // Generate an array of memory pools
6553 194 : SgProject** objectArray = (SgProject**) &(SgProject::pools[0]);
6554 :
6555 : // Build a local variable for better performance
6556 194 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
6557 :
6558 : // Iterate over the memory pools
6559 388 : for (unsigned int i=0; i < SgProject::pools.size(); i++)
6560 : {
6561 : // objectArray[i] is a single memory pool
6562 388194 : for (unsigned j=0; j < SgProject::pool_size; j++)
6563 : {
6564 388000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
6565 : {
6566 : // printf ("Found a valid SgProject object in the memory pool %d at position %d \n",i,j);
6567 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
6568 194 : objectArray[i][j].executeVisitorMemberFunction(visitor);
6569 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
6570 : }
6571 : else
6572 : {
6573 : // printf ("Found a INVALID SgProject object in the memory pool \n");
6574 : }
6575 : }
6576 : }
6577 : }
6578 :
6579 : // This should not be required since all previously static data members are
6580 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
6581 :
6582 194 : }
6583 :
6584 : void
6585 0 : SgProject::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
6586 : {
6587 : // This function visits only a single IR node of the memory pool.
6588 : // it is typically called once for each type of IR node within
6589 : // the automatically generated function: traverseRepresentativeNodes().
6590 :
6591 : // Initialize array to the address of the first element of the STL vector
6592 : // (which is guarenteed to be contiguous storage).
6593 : // SgProject objectArray [] = *(Memory_Block_List.begin());
6594 0 : if (SgProject::pools.empty() == false)
6595 : {
6596 : // Generate an array of memory pools
6597 0 : SgProject** objectArray = (SgProject**) &(SgProject::pools[0]);
6598 :
6599 : // Build a local variable for better performance
6600 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
6601 :
6602 : // Iterate over the memory pools
6603 0 : bool done = false;
6604 0 : unsigned i=0;
6605 :
6606 : // find the first valid IR node, call visit function, and then leave
6607 0 : while ( done == false && i < SgProject::pools.size() )
6608 : {
6609 : // objectArray[i] is a single memory pool
6610 : unsigned j=0;
6611 0 : while (done == false && j < SgProject::pool_size)
6612 : {
6613 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
6614 : {
6615 0 : traversal.visit(&(objectArray[i][j]));
6616 0 : done = true;
6617 : }
6618 0 : j++;
6619 : }
6620 0 : i++;
6621 : }
6622 :
6623 : #if 0
6624 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
6625 : if (done == false)
6626 : {
6627 : printf ("No representative for SgProject found in memory pools \n");
6628 : }
6629 : #endif
6630 : }
6631 0 : }
6632 :
6633 :
6634 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
6635 : // using values that overflow signed values of int.
6636 : size_t
6637 4 : SgProject::numberOfNodes()
6638 : {
6639 : // This function traverses the memory pool for an IR node and
6640 : // counts the number of IR nodes of a particular Sage III IR
6641 : // nodes type.
6642 :
6643 4 : size_t count = 0;
6644 4 : if (SgProject::pools.empty() == false)
6645 : {
6646 : // Generate an array of memory pools (this is actually a STL vector,
6647 : // but it is contiguious, so OK to treat this way).
6648 4 : SgProject** objectArray = (SgProject**) &(SgProject::pools[0]);
6649 :
6650 : // Build a local variable for better performance (make it a loop invariant variable).
6651 4 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
6652 :
6653 : // Iterate over all of the memory pools for this IR node.
6654 8 : for (unsigned int i=0; i < SgProject::pools.size(); i++)
6655 : {
6656 : // objectArray[i] is a single memory pool, iterate over all the
6657 : // IR nodes and only count those that are valid IR nodes used in
6658 : // the AST (i.e. allocated IR nodes).
6659 8004 : for (unsigned j=0; j < SgProject::pool_size; j++)
6660 : {
6661 : // This is indexing the STL vector of C/C++ style arrays as a doubly
6662 : // indexed array access. It is OK since we have leveraged the semantics
6663 : // of STL vector memory as contigous and cast the memory as an array
6664 : // of arrays to use the 2D array indexing. Hope this is not confusing,
6665 : // but it s very fast as an implementation.
6666 8000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
6667 : {
6668 6 : count++;
6669 : }
6670 : }
6671 : }
6672 : }
6673 :
6674 :
6675 :
6676 4 : return count;
6677 : }
6678 :
6679 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
6680 : // using values that overflow signed values of int.
6681 : size_t
6682 0 : SgProject::memoryUsage()
6683 : {
6684 : // This function is required because we need the class name as a type when we call sizeof
6685 : // There might be another way to implement this if we have a traversal that only called a
6686 : // representative object (one call for each type of Sage IIIIR node).
6687 0 : size_t memory = numberOfNodes() * sizeof(SgProject);
6688 :
6689 0 : return memory;
6690 : }
6691 :
6692 : /* #line 6693 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
6693 :
6694 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
6695 : void
6696 5342 : SgOptions::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
6697 : {
6698 : // This function traverses the memory pool for only a specific IR node
6699 : // and calls the visit function of the input class execute a traversal
6700 : // similar to the style of the attribute based traversals within ROSE.
6701 : // This traversal will visit ALL nodes of the AST where as the other
6702 : // attribute based traversals visit only the embedded tree within the AST.
6703 :
6704 : // Initialize array to the address of the first element of the STL vector
6705 : // (which is guaranteed to be contiguous storage).
6706 : // SgOptions objectArray [] = *(Memory_Block_List.begin());
6707 5342 : if (SgOptions::pools.empty() == false)
6708 : {
6709 : // Generate an array of memory pools
6710 0 : SgOptions** objectArray = (SgOptions**) &(SgOptions::pools[0]);
6711 :
6712 : // Build a local variable for better performance
6713 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
6714 : #if 0
6715 : // Iterate over the memory pools
6716 : for (unsigned int i=0; i < SgOptions::pools.size(); i++)
6717 : {
6718 : // objectArray[i] is a single memory pool
6719 : for (int j=0; j < SgOptions::pool_size; j++)
6720 : {
6721 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
6722 : {
6723 : traversal.visit(&(objectArray[i][j]));
6724 : }
6725 : }
6726 : }
6727 : #else
6728 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
6729 : // compute the list first and then call the visit function on each list element.
6730 :
6731 : // printf ("Inside of SgOptions::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
6732 :
6733 0 : std::vector<SgOptions*> nodeList;
6734 :
6735 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
6736 0 : for (unsigned int i=0; i < SgOptions::pools.size(); i++)
6737 : {
6738 : // objectArray[i] is a single memory pool
6739 0 : for (unsigned j=0; j < SgOptions::pool_size; j++)
6740 : {
6741 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
6742 : {
6743 0 : nodeList.push_back(&(objectArray[i][j]));
6744 : }
6745 : }
6746 : }
6747 :
6748 : // Iterate over the saved list
6749 0 : size_t nodeListSize = nodeList.size();
6750 0 : for (size_t i=0; i < nodeListSize; i++)
6751 : {
6752 0 : ROSE_ASSERT(nodeList[i] != NULL);
6753 : #if 0
6754 : traversal.visit(nodeList[i]);
6755 : #else
6756 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
6757 : {
6758 0 : traversal.visit(nodeList[i]);
6759 : }
6760 : #endif
6761 : }
6762 : #endif
6763 : }
6764 :
6765 : // This should not be required since all previously static data members are
6766 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
6767 :
6768 5342 : }
6769 :
6770 :
6771 : void
6772 194 : SgOptions::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
6773 : {
6774 : // This function traverses the memory pool for an IR node and
6775 : // calls the function to execute the visitor object.
6776 :
6777 : // Initialize array to the address of the first element of the STL vector
6778 : // (which is guarenteed to be contiguous storage).
6779 : // SgOptions objectArray [] = *(Memory_Block_List.begin());
6780 194 : if (SgOptions::pools.empty() == false)
6781 : {
6782 : // Generate an array of memory pools
6783 0 : SgOptions** objectArray = (SgOptions**) &(SgOptions::pools[0]);
6784 :
6785 : // Build a local variable for better performance
6786 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
6787 :
6788 : // Iterate over the memory pools
6789 0 : for (unsigned int i=0; i < SgOptions::pools.size(); i++)
6790 : {
6791 : // objectArray[i] is a single memory pool
6792 0 : for (unsigned j=0; j < SgOptions::pool_size; j++)
6793 : {
6794 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
6795 : {
6796 : // printf ("Found a valid SgOptions object in the memory pool %d at position %d \n",i,j);
6797 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
6798 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
6799 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
6800 : }
6801 : else
6802 : {
6803 : // printf ("Found a INVALID SgOptions object in the memory pool \n");
6804 : }
6805 : }
6806 : }
6807 : }
6808 :
6809 : // This should not be required since all previously static data members are
6810 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
6811 :
6812 194 : }
6813 :
6814 : void
6815 0 : SgOptions::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
6816 : {
6817 : // This function visits only a single IR node of the memory pool.
6818 : // it is typically called once for each type of IR node within
6819 : // the automatically generated function: traverseRepresentativeNodes().
6820 :
6821 : // Initialize array to the address of the first element of the STL vector
6822 : // (which is guarenteed to be contiguous storage).
6823 : // SgOptions objectArray [] = *(Memory_Block_List.begin());
6824 0 : if (SgOptions::pools.empty() == false)
6825 : {
6826 : // Generate an array of memory pools
6827 0 : SgOptions** objectArray = (SgOptions**) &(SgOptions::pools[0]);
6828 :
6829 : // Build a local variable for better performance
6830 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
6831 :
6832 : // Iterate over the memory pools
6833 0 : bool done = false;
6834 0 : unsigned i=0;
6835 :
6836 : // find the first valid IR node, call visit function, and then leave
6837 0 : while ( done == false && i < SgOptions::pools.size() )
6838 : {
6839 : // objectArray[i] is a single memory pool
6840 : unsigned j=0;
6841 0 : while (done == false && j < SgOptions::pool_size)
6842 : {
6843 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
6844 : {
6845 0 : traversal.visit(&(objectArray[i][j]));
6846 0 : done = true;
6847 : }
6848 0 : j++;
6849 : }
6850 0 : i++;
6851 : }
6852 :
6853 : #if 0
6854 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
6855 : if (done == false)
6856 : {
6857 : printf ("No representative for SgOptions found in memory pools \n");
6858 : }
6859 : #endif
6860 : }
6861 0 : }
6862 :
6863 :
6864 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
6865 : // using values that overflow signed values of int.
6866 : size_t
6867 4 : SgOptions::numberOfNodes()
6868 : {
6869 : // This function traverses the memory pool for an IR node and
6870 : // counts the number of IR nodes of a particular Sage III IR
6871 : // nodes type.
6872 :
6873 4 : size_t count = 0;
6874 4 : if (SgOptions::pools.empty() == false)
6875 : {
6876 : // Generate an array of memory pools (this is actually a STL vector,
6877 : // but it is contiguious, so OK to treat this way).
6878 0 : SgOptions** objectArray = (SgOptions**) &(SgOptions::pools[0]);
6879 :
6880 : // Build a local variable for better performance (make it a loop invariant variable).
6881 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
6882 :
6883 : // Iterate over all of the memory pools for this IR node.
6884 0 : for (unsigned int i=0; i < SgOptions::pools.size(); i++)
6885 : {
6886 : // objectArray[i] is a single memory pool, iterate over all the
6887 : // IR nodes and only count those that are valid IR nodes used in
6888 : // the AST (i.e. allocated IR nodes).
6889 0 : for (unsigned j=0; j < SgOptions::pool_size; j++)
6890 : {
6891 : // This is indexing the STL vector of C/C++ style arrays as a doubly
6892 : // indexed array access. It is OK since we have leveraged the semantics
6893 : // of STL vector memory as contigous and cast the memory as an array
6894 : // of arrays to use the 2D array indexing. Hope this is not confusing,
6895 : // but it s very fast as an implementation.
6896 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
6897 : {
6898 0 : count++;
6899 : }
6900 : }
6901 : }
6902 : }
6903 :
6904 :
6905 :
6906 4 : return count;
6907 : }
6908 :
6909 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
6910 : // using values that overflow signed values of int.
6911 : size_t
6912 0 : SgOptions::memoryUsage()
6913 : {
6914 : // This function is required because we need the class name as a type when we call sizeof
6915 : // There might be another way to implement this if we have a traversal that only called a
6916 : // representative object (one call for each type of Sage IIIIR node).
6917 0 : size_t memory = numberOfNodes() * sizeof(SgOptions);
6918 :
6919 0 : return memory;
6920 : }
6921 :
6922 : /* #line 6923 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
6923 :
6924 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
6925 : void
6926 5342 : SgUnparse_Info::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
6927 : {
6928 : // This function traverses the memory pool for only a specific IR node
6929 : // and calls the visit function of the input class execute a traversal
6930 : // similar to the style of the attribute based traversals within ROSE.
6931 : // This traversal will visit ALL nodes of the AST where as the other
6932 : // attribute based traversals visit only the embedded tree within the AST.
6933 :
6934 : // Initialize array to the address of the first element of the STL vector
6935 : // (which is guaranteed to be contiguous storage).
6936 : // SgUnparse_Info objectArray [] = *(Memory_Block_List.begin());
6937 5342 : if (SgUnparse_Info::pools.empty() == false)
6938 : {
6939 : // Generate an array of memory pools
6940 3497 : SgUnparse_Info** objectArray = (SgUnparse_Info**) &(SgUnparse_Info::pools[0]);
6941 :
6942 : // Build a local variable for better performance
6943 3497 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
6944 : #if 0
6945 : // Iterate over the memory pools
6946 : for (unsigned int i=0; i < SgUnparse_Info::pools.size(); i++)
6947 : {
6948 : // objectArray[i] is a single memory pool
6949 : for (int j=0; j < SgUnparse_Info::pool_size; j++)
6950 : {
6951 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
6952 : {
6953 : traversal.visit(&(objectArray[i][j]));
6954 : }
6955 : }
6956 : }
6957 : #else
6958 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
6959 : // compute the list first and then call the visit function on each list element.
6960 :
6961 : // printf ("Inside of SgUnparse_Info::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
6962 :
6963 6994 : std::vector<SgUnparse_Info*> nodeList;
6964 :
6965 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
6966 6994 : for (unsigned int i=0; i < SgUnparse_Info::pools.size(); i++)
6967 : {
6968 : // objectArray[i] is a single memory pool
6969 6997500 : for (unsigned j=0; j < SgUnparse_Info::pool_size; j++)
6970 : {
6971 6994000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
6972 : {
6973 3568 : nodeList.push_back(&(objectArray[i][j]));
6974 : }
6975 : }
6976 : }
6977 :
6978 : // Iterate over the saved list
6979 3497 : size_t nodeListSize = nodeList.size();
6980 7065 : for (size_t i=0; i < nodeListSize; i++)
6981 : {
6982 3568 : ROSE_ASSERT(nodeList[i] != NULL);
6983 : #if 0
6984 : traversal.visit(nodeList[i]);
6985 : #else
6986 3568 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
6987 : {
6988 3568 : traversal.visit(nodeList[i]);
6989 : }
6990 : #endif
6991 : }
6992 : #endif
6993 : }
6994 :
6995 : // This should not be required since all previously static data members are
6996 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
6997 :
6998 5342 : }
6999 :
7000 :
7001 : void
7002 194 : SgUnparse_Info::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
7003 : {
7004 : // This function traverses the memory pool for an IR node and
7005 : // calls the function to execute the visitor object.
7006 :
7007 : // Initialize array to the address of the first element of the STL vector
7008 : // (which is guarenteed to be contiguous storage).
7009 : // SgUnparse_Info objectArray [] = *(Memory_Block_List.begin());
7010 194 : if (SgUnparse_Info::pools.empty() == false)
7011 : {
7012 : // Generate an array of memory pools
7013 137 : SgUnparse_Info** objectArray = (SgUnparse_Info**) &(SgUnparse_Info::pools[0]);
7014 :
7015 : // Build a local variable for better performance
7016 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
7017 :
7018 : // Iterate over the memory pools
7019 274 : for (unsigned int i=0; i < SgUnparse_Info::pools.size(); i++)
7020 : {
7021 : // objectArray[i] is a single memory pool
7022 274137 : for (unsigned j=0; j < SgUnparse_Info::pool_size; j++)
7023 : {
7024 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
7025 : {
7026 : // printf ("Found a valid SgUnparse_Info object in the memory pool %d at position %d \n",i,j);
7027 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
7028 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
7029 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
7030 : }
7031 : else
7032 : {
7033 : // printf ("Found a INVALID SgUnparse_Info object in the memory pool \n");
7034 : }
7035 : }
7036 : }
7037 : }
7038 :
7039 : // This should not be required since all previously static data members are
7040 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
7041 :
7042 194 : }
7043 :
7044 : void
7045 0 : SgUnparse_Info::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
7046 : {
7047 : // This function visits only a single IR node of the memory pool.
7048 : // it is typically called once for each type of IR node within
7049 : // the automatically generated function: traverseRepresentativeNodes().
7050 :
7051 : // Initialize array to the address of the first element of the STL vector
7052 : // (which is guarenteed to be contiguous storage).
7053 : // SgUnparse_Info objectArray [] = *(Memory_Block_List.begin());
7054 0 : if (SgUnparse_Info::pools.empty() == false)
7055 : {
7056 : // Generate an array of memory pools
7057 0 : SgUnparse_Info** objectArray = (SgUnparse_Info**) &(SgUnparse_Info::pools[0]);
7058 :
7059 : // Build a local variable for better performance
7060 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
7061 :
7062 : // Iterate over the memory pools
7063 0 : bool done = false;
7064 0 : unsigned i=0;
7065 :
7066 : // find the first valid IR node, call visit function, and then leave
7067 0 : while ( done == false && i < SgUnparse_Info::pools.size() )
7068 : {
7069 : // objectArray[i] is a single memory pool
7070 : unsigned j=0;
7071 0 : while (done == false && j < SgUnparse_Info::pool_size)
7072 : {
7073 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
7074 : {
7075 0 : traversal.visit(&(objectArray[i][j]));
7076 0 : done = true;
7077 : }
7078 0 : j++;
7079 : }
7080 0 : i++;
7081 : }
7082 :
7083 : #if 0
7084 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
7085 : if (done == false)
7086 : {
7087 : printf ("No representative for SgUnparse_Info found in memory pools \n");
7088 : }
7089 : #endif
7090 : }
7091 0 : }
7092 :
7093 :
7094 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
7095 : // using values that overflow signed values of int.
7096 : size_t
7097 4 : SgUnparse_Info::numberOfNodes()
7098 : {
7099 : // This function traverses the memory pool for an IR node and
7100 : // counts the number of IR nodes of a particular Sage III IR
7101 : // nodes type.
7102 :
7103 4 : size_t count = 0;
7104 4 : if (SgUnparse_Info::pools.empty() == false)
7105 : {
7106 : // Generate an array of memory pools (this is actually a STL vector,
7107 : // but it is contiguious, so OK to treat this way).
7108 0 : SgUnparse_Info** objectArray = (SgUnparse_Info**) &(SgUnparse_Info::pools[0]);
7109 :
7110 : // Build a local variable for better performance (make it a loop invariant variable).
7111 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
7112 :
7113 : // Iterate over all of the memory pools for this IR node.
7114 0 : for (unsigned int i=0; i < SgUnparse_Info::pools.size(); i++)
7115 : {
7116 : // objectArray[i] is a single memory pool, iterate over all the
7117 : // IR nodes and only count those that are valid IR nodes used in
7118 : // the AST (i.e. allocated IR nodes).
7119 0 : for (unsigned j=0; j < SgUnparse_Info::pool_size; j++)
7120 : {
7121 : // This is indexing the STL vector of C/C++ style arrays as a doubly
7122 : // indexed array access. It is OK since we have leveraged the semantics
7123 : // of STL vector memory as contigous and cast the memory as an array
7124 : // of arrays to use the 2D array indexing. Hope this is not confusing,
7125 : // but it s very fast as an implementation.
7126 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
7127 : {
7128 0 : count++;
7129 : }
7130 : }
7131 : }
7132 : }
7133 :
7134 :
7135 :
7136 4 : return count;
7137 : }
7138 :
7139 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
7140 : // using values that overflow signed values of int.
7141 : size_t
7142 0 : SgUnparse_Info::memoryUsage()
7143 : {
7144 : // This function is required because we need the class name as a type when we call sizeof
7145 : // There might be another way to implement this if we have a traversal that only called a
7146 : // representative object (one call for each type of Sage IIIIR node).
7147 0 : size_t memory = numberOfNodes() * sizeof(SgUnparse_Info);
7148 :
7149 0 : return memory;
7150 : }
7151 :
7152 : /* #line 7153 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
7153 :
7154 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
7155 : void
7156 5342 : SgBaseClass::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
7157 : {
7158 : // This function traverses the memory pool for only a specific IR node
7159 : // and calls the visit function of the input class execute a traversal
7160 : // similar to the style of the attribute based traversals within ROSE.
7161 : // This traversal will visit ALL nodes of the AST where as the other
7162 : // attribute based traversals visit only the embedded tree within the AST.
7163 :
7164 : // Initialize array to the address of the first element of the STL vector
7165 : // (which is guaranteed to be contiguous storage).
7166 : // SgBaseClass objectArray [] = *(Memory_Block_List.begin());
7167 5342 : if (SgBaseClass::pools.empty() == false)
7168 : {
7169 : // Generate an array of memory pools
7170 138 : SgBaseClass** objectArray = (SgBaseClass**) &(SgBaseClass::pools[0]);
7171 :
7172 : // Build a local variable for better performance
7173 138 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
7174 : #if 0
7175 : // Iterate over the memory pools
7176 : for (unsigned int i=0; i < SgBaseClass::pools.size(); i++)
7177 : {
7178 : // objectArray[i] is a single memory pool
7179 : for (int j=0; j < SgBaseClass::pool_size; j++)
7180 : {
7181 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
7182 : {
7183 : traversal.visit(&(objectArray[i][j]));
7184 : }
7185 : }
7186 : }
7187 : #else
7188 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
7189 : // compute the list first and then call the visit function on each list element.
7190 :
7191 : // printf ("Inside of SgBaseClass::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
7192 :
7193 276 : std::vector<SgBaseClass*> nodeList;
7194 :
7195 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
7196 276 : for (unsigned int i=0; i < SgBaseClass::pools.size(); i++)
7197 : {
7198 : // objectArray[i] is a single memory pool
7199 276138 : for (unsigned j=0; j < SgBaseClass::pool_size; j++)
7200 : {
7201 276000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
7202 : {
7203 53471 : nodeList.push_back(&(objectArray[i][j]));
7204 : }
7205 : }
7206 : }
7207 :
7208 : // Iterate over the saved list
7209 138 : size_t nodeListSize = nodeList.size();
7210 53609 : for (size_t i=0; i < nodeListSize; i++)
7211 : {
7212 53471 : ROSE_ASSERT(nodeList[i] != NULL);
7213 : #if 0
7214 : traversal.visit(nodeList[i]);
7215 : #else
7216 53471 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
7217 : {
7218 53471 : traversal.visit(nodeList[i]);
7219 : }
7220 : #endif
7221 : }
7222 : #endif
7223 : }
7224 :
7225 : // This should not be required since all previously static data members are
7226 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
7227 :
7228 5342 : }
7229 :
7230 :
7231 : void
7232 194 : SgBaseClass::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
7233 : {
7234 : // This function traverses the memory pool for an IR node and
7235 : // calls the function to execute the visitor object.
7236 :
7237 : // Initialize array to the address of the first element of the STL vector
7238 : // (which is guarenteed to be contiguous storage).
7239 : // SgBaseClass objectArray [] = *(Memory_Block_List.begin());
7240 194 : if (SgBaseClass::pools.empty() == false)
7241 : {
7242 : // Generate an array of memory pools
7243 137 : SgBaseClass** objectArray = (SgBaseClass**) &(SgBaseClass::pools[0]);
7244 :
7245 : // Build a local variable for better performance
7246 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
7247 :
7248 : // Iterate over the memory pools
7249 274 : for (unsigned int i=0; i < SgBaseClass::pools.size(); i++)
7250 : {
7251 : // objectArray[i] is a single memory pool
7252 274137 : for (unsigned j=0; j < SgBaseClass::pool_size; j++)
7253 : {
7254 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
7255 : {
7256 : // printf ("Found a valid SgBaseClass object in the memory pool %d at position %d \n",i,j);
7257 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
7258 58016 : objectArray[i][j].executeVisitorMemberFunction(visitor);
7259 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
7260 : }
7261 : else
7262 : {
7263 : // printf ("Found a INVALID SgBaseClass object in the memory pool \n");
7264 : }
7265 : }
7266 : }
7267 : }
7268 :
7269 : // This should not be required since all previously static data members are
7270 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
7271 :
7272 194 : }
7273 :
7274 : void
7275 0 : SgBaseClass::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
7276 : {
7277 : // This function visits only a single IR node of the memory pool.
7278 : // it is typically called once for each type of IR node within
7279 : // the automatically generated function: traverseRepresentativeNodes().
7280 :
7281 : // Initialize array to the address of the first element of the STL vector
7282 : // (which is guarenteed to be contiguous storage).
7283 : // SgBaseClass objectArray [] = *(Memory_Block_List.begin());
7284 0 : if (SgBaseClass::pools.empty() == false)
7285 : {
7286 : // Generate an array of memory pools
7287 0 : SgBaseClass** objectArray = (SgBaseClass**) &(SgBaseClass::pools[0]);
7288 :
7289 : // Build a local variable for better performance
7290 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
7291 :
7292 : // Iterate over the memory pools
7293 0 : bool done = false;
7294 0 : unsigned i=0;
7295 :
7296 : // find the first valid IR node, call visit function, and then leave
7297 0 : while ( done == false && i < SgBaseClass::pools.size() )
7298 : {
7299 : // objectArray[i] is a single memory pool
7300 : unsigned j=0;
7301 0 : while (done == false && j < SgBaseClass::pool_size)
7302 : {
7303 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
7304 : {
7305 0 : traversal.visit(&(objectArray[i][j]));
7306 0 : done = true;
7307 : }
7308 0 : j++;
7309 : }
7310 0 : i++;
7311 : }
7312 :
7313 : #if 0
7314 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
7315 : if (done == false)
7316 : {
7317 : printf ("No representative for SgBaseClass found in memory pools \n");
7318 : }
7319 : #endif
7320 : }
7321 0 : }
7322 :
7323 :
7324 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
7325 : // using values that overflow signed values of int.
7326 : size_t
7327 4 : SgBaseClass::numberOfNodes()
7328 : {
7329 : // This function traverses the memory pool for an IR node and
7330 : // counts the number of IR nodes of a particular Sage III IR
7331 : // nodes type.
7332 :
7333 4 : size_t count = 0;
7334 4 : if (SgBaseClass::pools.empty() == false)
7335 : {
7336 : // Generate an array of memory pools (this is actually a STL vector,
7337 : // but it is contiguious, so OK to treat this way).
7338 1 : SgBaseClass** objectArray = (SgBaseClass**) &(SgBaseClass::pools[0]);
7339 :
7340 : // Build a local variable for better performance (make it a loop invariant variable).
7341 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
7342 :
7343 : // Iterate over all of the memory pools for this IR node.
7344 2 : for (unsigned int i=0; i < SgBaseClass::pools.size(); i++)
7345 : {
7346 : // objectArray[i] is a single memory pool, iterate over all the
7347 : // IR nodes and only count those that are valid IR nodes used in
7348 : // the AST (i.e. allocated IR nodes).
7349 2001 : for (unsigned j=0; j < SgBaseClass::pool_size; j++)
7350 : {
7351 : // This is indexing the STL vector of C/C++ style arrays as a doubly
7352 : // indexed array access. It is OK since we have leveraged the semantics
7353 : // of STL vector memory as contigous and cast the memory as an array
7354 : // of arrays to use the 2D array indexing. Hope this is not confusing,
7355 : // but it s very fast as an implementation.
7356 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
7357 : {
7358 420 : count++;
7359 : }
7360 : }
7361 : }
7362 : }
7363 :
7364 :
7365 :
7366 4 : return count;
7367 : }
7368 :
7369 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
7370 : // using values that overflow signed values of int.
7371 : size_t
7372 0 : SgBaseClass::memoryUsage()
7373 : {
7374 : // This function is required because we need the class name as a type when we call sizeof
7375 : // There might be another way to implement this if we have a traversal that only called a
7376 : // representative object (one call for each type of Sage IIIIR node).
7377 0 : size_t memory = numberOfNodes() * sizeof(SgBaseClass);
7378 :
7379 0 : return memory;
7380 : }
7381 :
7382 : /* #line 7383 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
7383 :
7384 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
7385 : void
7386 5342 : SgExpBaseClass::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
7387 : {
7388 : // This function traverses the memory pool for only a specific IR node
7389 : // and calls the visit function of the input class execute a traversal
7390 : // similar to the style of the attribute based traversals within ROSE.
7391 : // This traversal will visit ALL nodes of the AST where as the other
7392 : // attribute based traversals visit only the embedded tree within the AST.
7393 :
7394 : // Initialize array to the address of the first element of the STL vector
7395 : // (which is guaranteed to be contiguous storage).
7396 : // SgExpBaseClass objectArray [] = *(Memory_Block_List.begin());
7397 5342 : if (SgExpBaseClass::pools.empty() == false)
7398 : {
7399 : // Generate an array of memory pools
7400 0 : SgExpBaseClass** objectArray = (SgExpBaseClass**) &(SgExpBaseClass::pools[0]);
7401 :
7402 : // Build a local variable for better performance
7403 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
7404 : #if 0
7405 : // Iterate over the memory pools
7406 : for (unsigned int i=0; i < SgExpBaseClass::pools.size(); i++)
7407 : {
7408 : // objectArray[i] is a single memory pool
7409 : for (int j=0; j < SgExpBaseClass::pool_size; j++)
7410 : {
7411 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
7412 : {
7413 : traversal.visit(&(objectArray[i][j]));
7414 : }
7415 : }
7416 : }
7417 : #else
7418 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
7419 : // compute the list first and then call the visit function on each list element.
7420 :
7421 : // printf ("Inside of SgExpBaseClass::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
7422 :
7423 0 : std::vector<SgExpBaseClass*> nodeList;
7424 :
7425 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
7426 0 : for (unsigned int i=0; i < SgExpBaseClass::pools.size(); i++)
7427 : {
7428 : // objectArray[i] is a single memory pool
7429 0 : for (unsigned j=0; j < SgExpBaseClass::pool_size; j++)
7430 : {
7431 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
7432 : {
7433 0 : nodeList.push_back(&(objectArray[i][j]));
7434 : }
7435 : }
7436 : }
7437 :
7438 : // Iterate over the saved list
7439 0 : size_t nodeListSize = nodeList.size();
7440 0 : for (size_t i=0; i < nodeListSize; i++)
7441 : {
7442 0 : ROSE_ASSERT(nodeList[i] != NULL);
7443 : #if 0
7444 : traversal.visit(nodeList[i]);
7445 : #else
7446 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
7447 : {
7448 0 : traversal.visit(nodeList[i]);
7449 : }
7450 : #endif
7451 : }
7452 : #endif
7453 : }
7454 :
7455 : // This should not be required since all previously static data members are
7456 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
7457 :
7458 5342 : }
7459 :
7460 :
7461 : void
7462 194 : SgExpBaseClass::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
7463 : {
7464 : // This function traverses the memory pool for an IR node and
7465 : // calls the function to execute the visitor object.
7466 :
7467 : // Initialize array to the address of the first element of the STL vector
7468 : // (which is guarenteed to be contiguous storage).
7469 : // SgExpBaseClass objectArray [] = *(Memory_Block_List.begin());
7470 194 : if (SgExpBaseClass::pools.empty() == false)
7471 : {
7472 : // Generate an array of memory pools
7473 0 : SgExpBaseClass** objectArray = (SgExpBaseClass**) &(SgExpBaseClass::pools[0]);
7474 :
7475 : // Build a local variable for better performance
7476 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
7477 :
7478 : // Iterate over the memory pools
7479 0 : for (unsigned int i=0; i < SgExpBaseClass::pools.size(); i++)
7480 : {
7481 : // objectArray[i] is a single memory pool
7482 0 : for (unsigned j=0; j < SgExpBaseClass::pool_size; j++)
7483 : {
7484 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
7485 : {
7486 : // printf ("Found a valid SgExpBaseClass object in the memory pool %d at position %d \n",i,j);
7487 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
7488 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
7489 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
7490 : }
7491 : else
7492 : {
7493 : // printf ("Found a INVALID SgExpBaseClass object in the memory pool \n");
7494 : }
7495 : }
7496 : }
7497 : }
7498 :
7499 : // This should not be required since all previously static data members are
7500 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
7501 :
7502 194 : }
7503 :
7504 : void
7505 0 : SgExpBaseClass::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
7506 : {
7507 : // This function visits only a single IR node of the memory pool.
7508 : // it is typically called once for each type of IR node within
7509 : // the automatically generated function: traverseRepresentativeNodes().
7510 :
7511 : // Initialize array to the address of the first element of the STL vector
7512 : // (which is guarenteed to be contiguous storage).
7513 : // SgExpBaseClass objectArray [] = *(Memory_Block_List.begin());
7514 0 : if (SgExpBaseClass::pools.empty() == false)
7515 : {
7516 : // Generate an array of memory pools
7517 0 : SgExpBaseClass** objectArray = (SgExpBaseClass**) &(SgExpBaseClass::pools[0]);
7518 :
7519 : // Build a local variable for better performance
7520 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
7521 :
7522 : // Iterate over the memory pools
7523 0 : bool done = false;
7524 0 : unsigned i=0;
7525 :
7526 : // find the first valid IR node, call visit function, and then leave
7527 0 : while ( done == false && i < SgExpBaseClass::pools.size() )
7528 : {
7529 : // objectArray[i] is a single memory pool
7530 : unsigned j=0;
7531 0 : while (done == false && j < SgExpBaseClass::pool_size)
7532 : {
7533 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
7534 : {
7535 0 : traversal.visit(&(objectArray[i][j]));
7536 0 : done = true;
7537 : }
7538 0 : j++;
7539 : }
7540 0 : i++;
7541 : }
7542 :
7543 : #if 0
7544 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
7545 : if (done == false)
7546 : {
7547 : printf ("No representative for SgExpBaseClass found in memory pools \n");
7548 : }
7549 : #endif
7550 : }
7551 0 : }
7552 :
7553 :
7554 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
7555 : // using values that overflow signed values of int.
7556 : size_t
7557 4 : SgExpBaseClass::numberOfNodes()
7558 : {
7559 : // This function traverses the memory pool for an IR node and
7560 : // counts the number of IR nodes of a particular Sage III IR
7561 : // nodes type.
7562 :
7563 4 : size_t count = 0;
7564 4 : if (SgExpBaseClass::pools.empty() == false)
7565 : {
7566 : // Generate an array of memory pools (this is actually a STL vector,
7567 : // but it is contiguious, so OK to treat this way).
7568 0 : SgExpBaseClass** objectArray = (SgExpBaseClass**) &(SgExpBaseClass::pools[0]);
7569 :
7570 : // Build a local variable for better performance (make it a loop invariant variable).
7571 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
7572 :
7573 : // Iterate over all of the memory pools for this IR node.
7574 0 : for (unsigned int i=0; i < SgExpBaseClass::pools.size(); i++)
7575 : {
7576 : // objectArray[i] is a single memory pool, iterate over all the
7577 : // IR nodes and only count those that are valid IR nodes used in
7578 : // the AST (i.e. allocated IR nodes).
7579 0 : for (unsigned j=0; j < SgExpBaseClass::pool_size; j++)
7580 : {
7581 : // This is indexing the STL vector of C/C++ style arrays as a doubly
7582 : // indexed array access. It is OK since we have leveraged the semantics
7583 : // of STL vector memory as contigous and cast the memory as an array
7584 : // of arrays to use the 2D array indexing. Hope this is not confusing,
7585 : // but it s very fast as an implementation.
7586 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
7587 : {
7588 0 : count++;
7589 : }
7590 : }
7591 : }
7592 : }
7593 :
7594 :
7595 :
7596 4 : return count;
7597 : }
7598 :
7599 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
7600 : // using values that overflow signed values of int.
7601 : size_t
7602 0 : SgExpBaseClass::memoryUsage()
7603 : {
7604 : // This function is required because we need the class name as a type when we call sizeof
7605 : // There might be another way to implement this if we have a traversal that only called a
7606 : // representative object (one call for each type of Sage IIIIR node).
7607 0 : size_t memory = numberOfNodes() * sizeof(SgExpBaseClass);
7608 :
7609 0 : return memory;
7610 : }
7611 :
7612 : /* #line 7613 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
7613 :
7614 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
7615 : void
7616 5342 : SgNonrealBaseClass::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
7617 : {
7618 : // This function traverses the memory pool for only a specific IR node
7619 : // and calls the visit function of the input class execute a traversal
7620 : // similar to the style of the attribute based traversals within ROSE.
7621 : // This traversal will visit ALL nodes of the AST where as the other
7622 : // attribute based traversals visit only the embedded tree within the AST.
7623 :
7624 : // Initialize array to the address of the first element of the STL vector
7625 : // (which is guaranteed to be contiguous storage).
7626 : // SgNonrealBaseClass objectArray [] = *(Memory_Block_List.begin());
7627 5342 : if (SgNonrealBaseClass::pools.empty() == false)
7628 : {
7629 : // Generate an array of memory pools
7630 138 : SgNonrealBaseClass** objectArray = (SgNonrealBaseClass**) &(SgNonrealBaseClass::pools[0]);
7631 :
7632 : // Build a local variable for better performance
7633 138 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
7634 : #if 0
7635 : // Iterate over the memory pools
7636 : for (unsigned int i=0; i < SgNonrealBaseClass::pools.size(); i++)
7637 : {
7638 : // objectArray[i] is a single memory pool
7639 : for (int j=0; j < SgNonrealBaseClass::pool_size; j++)
7640 : {
7641 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
7642 : {
7643 : traversal.visit(&(objectArray[i][j]));
7644 : }
7645 : }
7646 : }
7647 : #else
7648 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
7649 : // compute the list first and then call the visit function on each list element.
7650 :
7651 : // printf ("Inside of SgNonrealBaseClass::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
7652 :
7653 276 : std::vector<SgNonrealBaseClass*> nodeList;
7654 :
7655 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
7656 276 : for (unsigned int i=0; i < SgNonrealBaseClass::pools.size(); i++)
7657 : {
7658 : // objectArray[i] is a single memory pool
7659 276138 : for (unsigned j=0; j < SgNonrealBaseClass::pool_size; j++)
7660 : {
7661 276000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
7662 : {
7663 26522 : nodeList.push_back(&(objectArray[i][j]));
7664 : }
7665 : }
7666 : }
7667 :
7668 : // Iterate over the saved list
7669 138 : size_t nodeListSize = nodeList.size();
7670 26660 : for (size_t i=0; i < nodeListSize; i++)
7671 : {
7672 26522 : ROSE_ASSERT(nodeList[i] != NULL);
7673 : #if 0
7674 : traversal.visit(nodeList[i]);
7675 : #else
7676 26522 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
7677 : {
7678 26522 : traversal.visit(nodeList[i]);
7679 : }
7680 : #endif
7681 : }
7682 : #endif
7683 : }
7684 :
7685 : // This should not be required since all previously static data members are
7686 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
7687 :
7688 5342 : }
7689 :
7690 :
7691 : void
7692 194 : SgNonrealBaseClass::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
7693 : {
7694 : // This function traverses the memory pool for an IR node and
7695 : // calls the function to execute the visitor object.
7696 :
7697 : // Initialize array to the address of the first element of the STL vector
7698 : // (which is guarenteed to be contiguous storage).
7699 : // SgNonrealBaseClass objectArray [] = *(Memory_Block_List.begin());
7700 194 : if (SgNonrealBaseClass::pools.empty() == false)
7701 : {
7702 : // Generate an array of memory pools
7703 137 : SgNonrealBaseClass** objectArray = (SgNonrealBaseClass**) &(SgNonrealBaseClass::pools[0]);
7704 :
7705 : // Build a local variable for better performance
7706 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
7707 :
7708 : // Iterate over the memory pools
7709 274 : for (unsigned int i=0; i < SgNonrealBaseClass::pools.size(); i++)
7710 : {
7711 : // objectArray[i] is a single memory pool
7712 274137 : for (unsigned j=0; j < SgNonrealBaseClass::pool_size; j++)
7713 : {
7714 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
7715 : {
7716 : // printf ("Found a valid SgNonrealBaseClass object in the memory pool %d at position %d \n",i,j);
7717 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
7718 27544 : objectArray[i][j].executeVisitorMemberFunction(visitor);
7719 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
7720 : }
7721 : else
7722 : {
7723 : // printf ("Found a INVALID SgNonrealBaseClass object in the memory pool \n");
7724 : }
7725 : }
7726 : }
7727 : }
7728 :
7729 : // This should not be required since all previously static data members are
7730 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
7731 :
7732 194 : }
7733 :
7734 : void
7735 0 : SgNonrealBaseClass::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
7736 : {
7737 : // This function visits only a single IR node of the memory pool.
7738 : // it is typically called once for each type of IR node within
7739 : // the automatically generated function: traverseRepresentativeNodes().
7740 :
7741 : // Initialize array to the address of the first element of the STL vector
7742 : // (which is guarenteed to be contiguous storage).
7743 : // SgNonrealBaseClass objectArray [] = *(Memory_Block_List.begin());
7744 0 : if (SgNonrealBaseClass::pools.empty() == false)
7745 : {
7746 : // Generate an array of memory pools
7747 0 : SgNonrealBaseClass** objectArray = (SgNonrealBaseClass**) &(SgNonrealBaseClass::pools[0]);
7748 :
7749 : // Build a local variable for better performance
7750 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
7751 :
7752 : // Iterate over the memory pools
7753 0 : bool done = false;
7754 0 : unsigned i=0;
7755 :
7756 : // find the first valid IR node, call visit function, and then leave
7757 0 : while ( done == false && i < SgNonrealBaseClass::pools.size() )
7758 : {
7759 : // objectArray[i] is a single memory pool
7760 : unsigned j=0;
7761 0 : while (done == false && j < SgNonrealBaseClass::pool_size)
7762 : {
7763 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
7764 : {
7765 0 : traversal.visit(&(objectArray[i][j]));
7766 0 : done = true;
7767 : }
7768 0 : j++;
7769 : }
7770 0 : i++;
7771 : }
7772 :
7773 : #if 0
7774 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
7775 : if (done == false)
7776 : {
7777 : printf ("No representative for SgNonrealBaseClass found in memory pools \n");
7778 : }
7779 : #endif
7780 : }
7781 0 : }
7782 :
7783 :
7784 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
7785 : // using values that overflow signed values of int.
7786 : size_t
7787 4 : SgNonrealBaseClass::numberOfNodes()
7788 : {
7789 : // This function traverses the memory pool for an IR node and
7790 : // counts the number of IR nodes of a particular Sage III IR
7791 : // nodes type.
7792 :
7793 4 : size_t count = 0;
7794 4 : if (SgNonrealBaseClass::pools.empty() == false)
7795 : {
7796 : // Generate an array of memory pools (this is actually a STL vector,
7797 : // but it is contiguious, so OK to treat this way).
7798 1 : SgNonrealBaseClass** objectArray = (SgNonrealBaseClass**) &(SgNonrealBaseClass::pools[0]);
7799 :
7800 : // Build a local variable for better performance (make it a loop invariant variable).
7801 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
7802 :
7803 : // Iterate over all of the memory pools for this IR node.
7804 2 : for (unsigned int i=0; i < SgNonrealBaseClass::pools.size(); i++)
7805 : {
7806 : // objectArray[i] is a single memory pool, iterate over all the
7807 : // IR nodes and only count those that are valid IR nodes used in
7808 : // the AST (i.e. allocated IR nodes).
7809 2001 : for (unsigned j=0; j < SgNonrealBaseClass::pool_size; j++)
7810 : {
7811 : // This is indexing the STL vector of C/C++ style arrays as a doubly
7812 : // indexed array access. It is OK since we have leveraged the semantics
7813 : // of STL vector memory as contigous and cast the memory as an array
7814 : // of arrays to use the 2D array indexing. Hope this is not confusing,
7815 : // but it s very fast as an implementation.
7816 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
7817 : {
7818 200 : count++;
7819 : }
7820 : }
7821 : }
7822 : }
7823 :
7824 :
7825 :
7826 4 : return count;
7827 : }
7828 :
7829 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
7830 : // using values that overflow signed values of int.
7831 : size_t
7832 0 : SgNonrealBaseClass::memoryUsage()
7833 : {
7834 : // This function is required because we need the class name as a type when we call sizeof
7835 : // There might be another way to implement this if we have a traversal that only called a
7836 : // representative object (one call for each type of Sage IIIIR node).
7837 0 : size_t memory = numberOfNodes() * sizeof(SgNonrealBaseClass);
7838 :
7839 0 : return memory;
7840 : }
7841 :
7842 : /* #line 7843 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
7843 :
7844 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
7845 : void
7846 5342 : SgTypedefSeq::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
7847 : {
7848 : // This function traverses the memory pool for only a specific IR node
7849 : // and calls the visit function of the input class execute a traversal
7850 : // similar to the style of the attribute based traversals within ROSE.
7851 : // This traversal will visit ALL nodes of the AST where as the other
7852 : // attribute based traversals visit only the embedded tree within the AST.
7853 :
7854 : // Initialize array to the address of the first element of the STL vector
7855 : // (which is guaranteed to be contiguous storage).
7856 : // SgTypedefSeq objectArray [] = *(Memory_Block_List.begin());
7857 5342 : if (SgTypedefSeq::pools.empty() == false)
7858 : {
7859 : // Generate an array of memory pools
7860 5303 : SgTypedefSeq** objectArray = (SgTypedefSeq**) &(SgTypedefSeq::pools[0]);
7861 :
7862 : // Build a local variable for better performance
7863 5303 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
7864 : #if 0
7865 : // Iterate over the memory pools
7866 : for (unsigned int i=0; i < SgTypedefSeq::pools.size(); i++)
7867 : {
7868 : // objectArray[i] is a single memory pool
7869 : for (int j=0; j < SgTypedefSeq::pool_size; j++)
7870 : {
7871 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
7872 : {
7873 : traversal.visit(&(objectArray[i][j]));
7874 : }
7875 : }
7876 : }
7877 : #else
7878 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
7879 : // compute the list first and then call the visit function on each list element.
7880 :
7881 : // printf ("Inside of SgTypedefSeq::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
7882 :
7883 10606 : std::vector<SgTypedefSeq*> nodeList;
7884 :
7885 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
7886 11512 : for (unsigned int i=0; i < SgTypedefSeq::pools.size(); i++)
7887 : {
7888 : // objectArray[i] is a single memory pool
7889 12424200 : for (unsigned j=0; j < SgTypedefSeq::pool_size; j++)
7890 : {
7891 12418000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
7892 : {
7893 6429790 : nodeList.push_back(&(objectArray[i][j]));
7894 : }
7895 : }
7896 : }
7897 :
7898 : // Iterate over the saved list
7899 5303 : size_t nodeListSize = nodeList.size();
7900 6435100 : for (size_t i=0; i < nodeListSize; i++)
7901 : {
7902 6429790 : ROSE_ASSERT(nodeList[i] != NULL);
7903 : #if 0
7904 : traversal.visit(nodeList[i]);
7905 : #else
7906 6429790 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
7907 : {
7908 6429790 : traversal.visit(nodeList[i]);
7909 : }
7910 : #endif
7911 : }
7912 : #endif
7913 : }
7914 :
7915 : // This should not be required since all previously static data members are
7916 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
7917 :
7918 5342 : }
7919 :
7920 :
7921 : void
7922 194 : SgTypedefSeq::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
7923 : {
7924 : // This function traverses the memory pool for an IR node and
7925 : // calls the function to execute the visitor object.
7926 :
7927 : // Initialize array to the address of the first element of the STL vector
7928 : // (which is guarenteed to be contiguous storage).
7929 : // SgTypedefSeq objectArray [] = *(Memory_Block_List.begin());
7930 194 : if (SgTypedefSeq::pools.empty() == false)
7931 : {
7932 : // Generate an array of memory pools
7933 194 : SgTypedefSeq** objectArray = (SgTypedefSeq**) &(SgTypedefSeq::pools[0]);
7934 :
7935 : // Build a local variable for better performance
7936 194 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
7937 :
7938 : // Iterate over the memory pools
7939 1365 : for (unsigned int i=0; i < SgTypedefSeq::pools.size(); i++)
7940 : {
7941 : // objectArray[i] is a single memory pool
7942 2343170 : for (unsigned j=0; j < SgTypedefSeq::pool_size; j++)
7943 : {
7944 2342000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
7945 : {
7946 : // printf ("Found a valid SgTypedefSeq object in the memory pool %d at position %d \n",i,j);
7947 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
7948 2202800 : objectArray[i][j].executeVisitorMemberFunction(visitor);
7949 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
7950 : }
7951 : else
7952 : {
7953 : // printf ("Found a INVALID SgTypedefSeq object in the memory pool \n");
7954 : }
7955 : }
7956 : }
7957 : }
7958 :
7959 : // This should not be required since all previously static data members are
7960 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
7961 :
7962 194 : }
7963 :
7964 : void
7965 0 : SgTypedefSeq::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
7966 : {
7967 : // This function visits only a single IR node of the memory pool.
7968 : // it is typically called once for each type of IR node within
7969 : // the automatically generated function: traverseRepresentativeNodes().
7970 :
7971 : // Initialize array to the address of the first element of the STL vector
7972 : // (which is guarenteed to be contiguous storage).
7973 : // SgTypedefSeq objectArray [] = *(Memory_Block_List.begin());
7974 0 : if (SgTypedefSeq::pools.empty() == false)
7975 : {
7976 : // Generate an array of memory pools
7977 0 : SgTypedefSeq** objectArray = (SgTypedefSeq**) &(SgTypedefSeq::pools[0]);
7978 :
7979 : // Build a local variable for better performance
7980 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
7981 :
7982 : // Iterate over the memory pools
7983 0 : bool done = false;
7984 0 : unsigned i=0;
7985 :
7986 : // find the first valid IR node, call visit function, and then leave
7987 0 : while ( done == false && i < SgTypedefSeq::pools.size() )
7988 : {
7989 : // objectArray[i] is a single memory pool
7990 : unsigned j=0;
7991 0 : while (done == false && j < SgTypedefSeq::pool_size)
7992 : {
7993 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
7994 : {
7995 0 : traversal.visit(&(objectArray[i][j]));
7996 0 : done = true;
7997 : }
7998 0 : j++;
7999 : }
8000 0 : i++;
8001 : }
8002 :
8003 : #if 0
8004 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
8005 : if (done == false)
8006 : {
8007 : printf ("No representative for SgTypedefSeq found in memory pools \n");
8008 : }
8009 : #endif
8010 : }
8011 0 : }
8012 :
8013 :
8014 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
8015 : // using values that overflow signed values of int.
8016 : size_t
8017 4 : SgTypedefSeq::numberOfNodes()
8018 : {
8019 : // This function traverses the memory pool for an IR node and
8020 : // counts the number of IR nodes of a particular Sage III IR
8021 : // nodes type.
8022 :
8023 4 : size_t count = 0;
8024 4 : if (SgTypedefSeq::pools.empty() == false)
8025 : {
8026 : // Generate an array of memory pools (this is actually a STL vector,
8027 : // but it is contiguious, so OK to treat this way).
8028 4 : SgTypedefSeq** objectArray = (SgTypedefSeq**) &(SgTypedefSeq::pools[0]);
8029 :
8030 : // Build a local variable for better performance (make it a loop invariant variable).
8031 4 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
8032 :
8033 : // Iterate over all of the memory pools for this IR node.
8034 15 : for (unsigned int i=0; i < SgTypedefSeq::pools.size(); i++)
8035 : {
8036 : // objectArray[i] is a single memory pool, iterate over all the
8037 : // IR nodes and only count those that are valid IR nodes used in
8038 : // the AST (i.e. allocated IR nodes).
8039 22011 : for (unsigned j=0; j < SgTypedefSeq::pool_size; j++)
8040 : {
8041 : // This is indexing the STL vector of C/C++ style arrays as a doubly
8042 : // indexed array access. It is OK since we have leveraged the semantics
8043 : // of STL vector memory as contigous and cast the memory as an array
8044 : // of arrays to use the 2D array indexing. Hope this is not confusing,
8045 : // but it s very fast as an implementation.
8046 22000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
8047 : {
8048 16451 : count++;
8049 : }
8050 : }
8051 : }
8052 : }
8053 :
8054 :
8055 :
8056 4 : return count;
8057 : }
8058 :
8059 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
8060 : // using values that overflow signed values of int.
8061 : size_t
8062 0 : SgTypedefSeq::memoryUsage()
8063 : {
8064 : // This function is required because we need the class name as a type when we call sizeof
8065 : // There might be another way to implement this if we have a traversal that only called a
8066 : // representative object (one call for each type of Sage IIIIR node).
8067 0 : size_t memory = numberOfNodes() * sizeof(SgTypedefSeq);
8068 :
8069 0 : return memory;
8070 : }
8071 :
8072 : /* #line 8073 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
8073 :
8074 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
8075 : void
8076 5342 : SgTemplateParameter::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
8077 : {
8078 : // This function traverses the memory pool for only a specific IR node
8079 : // and calls the visit function of the input class execute a traversal
8080 : // similar to the style of the attribute based traversals within ROSE.
8081 : // This traversal will visit ALL nodes of the AST where as the other
8082 : // attribute based traversals visit only the embedded tree within the AST.
8083 :
8084 : // Initialize array to the address of the first element of the STL vector
8085 : // (which is guaranteed to be contiguous storage).
8086 : // SgTemplateParameter objectArray [] = *(Memory_Block_List.begin());
8087 5342 : if (SgTemplateParameter::pools.empty() == false)
8088 : {
8089 : // Generate an array of memory pools
8090 145 : SgTemplateParameter** objectArray = (SgTemplateParameter**) &(SgTemplateParameter::pools[0]);
8091 :
8092 : // Build a local variable for better performance
8093 145 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
8094 : #if 0
8095 : // Iterate over the memory pools
8096 : for (unsigned int i=0; i < SgTemplateParameter::pools.size(); i++)
8097 : {
8098 : // objectArray[i] is a single memory pool
8099 : for (int j=0; j < SgTemplateParameter::pool_size; j++)
8100 : {
8101 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
8102 : {
8103 : traversal.visit(&(objectArray[i][j]));
8104 : }
8105 : }
8106 : }
8107 : #else
8108 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
8109 : // compute the list first and then call the visit function on each list element.
8110 :
8111 : // printf ("Inside of SgTemplateParameter::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
8112 :
8113 290 : std::vector<SgTemplateParameter*> nodeList;
8114 :
8115 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
8116 405 : for (unsigned int i=0; i < SgTemplateParameter::pools.size(); i++)
8117 : {
8118 : // objectArray[i] is a single memory pool
8119 520260 : for (unsigned j=0; j < SgTemplateParameter::pool_size; j++)
8120 : {
8121 520000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
8122 : {
8123 290890 : nodeList.push_back(&(objectArray[i][j]));
8124 : }
8125 : }
8126 : }
8127 :
8128 : // Iterate over the saved list
8129 145 : size_t nodeListSize = nodeList.size();
8130 291035 : for (size_t i=0; i < nodeListSize; i++)
8131 : {
8132 290890 : ROSE_ASSERT(nodeList[i] != NULL);
8133 : #if 0
8134 : traversal.visit(nodeList[i]);
8135 : #else
8136 290890 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
8137 : {
8138 290890 : traversal.visit(nodeList[i]);
8139 : }
8140 : #endif
8141 : }
8142 : #endif
8143 : }
8144 :
8145 : // This should not be required since all previously static data members are
8146 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
8147 :
8148 5342 : }
8149 :
8150 :
8151 : void
8152 194 : SgTemplateParameter::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
8153 : {
8154 : // This function traverses the memory pool for an IR node and
8155 : // calls the function to execute the visitor object.
8156 :
8157 : // Initialize array to the address of the first element of the STL vector
8158 : // (which is guarenteed to be contiguous storage).
8159 : // SgTemplateParameter objectArray [] = *(Memory_Block_List.begin());
8160 194 : if (SgTemplateParameter::pools.empty() == false)
8161 : {
8162 : // Generate an array of memory pools
8163 137 : SgTemplateParameter** objectArray = (SgTemplateParameter**) &(SgTemplateParameter::pools[0]);
8164 :
8165 : // Build a local variable for better performance
8166 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
8167 :
8168 : // Iterate over the memory pools
8169 411 : for (unsigned int i=0; i < SgTemplateParameter::pools.size(); i++)
8170 : {
8171 : // objectArray[i] is a single memory pool
8172 548274 : for (unsigned j=0; j < SgTemplateParameter::pool_size; j++)
8173 : {
8174 548000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
8175 : {
8176 : // printf ("Found a valid SgTemplateParameter object in the memory pool %d at position %d \n",i,j);
8177 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
8178 300839 : objectArray[i][j].executeVisitorMemberFunction(visitor);
8179 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
8180 : }
8181 : else
8182 : {
8183 : // printf ("Found a INVALID SgTemplateParameter object in the memory pool \n");
8184 : }
8185 : }
8186 : }
8187 : }
8188 :
8189 : // This should not be required since all previously static data members are
8190 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
8191 :
8192 194 : }
8193 :
8194 : void
8195 0 : SgTemplateParameter::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
8196 : {
8197 : // This function visits only a single IR node of the memory pool.
8198 : // it is typically called once for each type of IR node within
8199 : // the automatically generated function: traverseRepresentativeNodes().
8200 :
8201 : // Initialize array to the address of the first element of the STL vector
8202 : // (which is guarenteed to be contiguous storage).
8203 : // SgTemplateParameter objectArray [] = *(Memory_Block_List.begin());
8204 0 : if (SgTemplateParameter::pools.empty() == false)
8205 : {
8206 : // Generate an array of memory pools
8207 0 : SgTemplateParameter** objectArray = (SgTemplateParameter**) &(SgTemplateParameter::pools[0]);
8208 :
8209 : // Build a local variable for better performance
8210 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
8211 :
8212 : // Iterate over the memory pools
8213 0 : bool done = false;
8214 0 : unsigned i=0;
8215 :
8216 : // find the first valid IR node, call visit function, and then leave
8217 0 : while ( done == false && i < SgTemplateParameter::pools.size() )
8218 : {
8219 : // objectArray[i] is a single memory pool
8220 : unsigned j=0;
8221 0 : while (done == false && j < SgTemplateParameter::pool_size)
8222 : {
8223 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
8224 : {
8225 0 : traversal.visit(&(objectArray[i][j]));
8226 0 : done = true;
8227 : }
8228 0 : j++;
8229 : }
8230 0 : i++;
8231 : }
8232 :
8233 : #if 0
8234 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
8235 : if (done == false)
8236 : {
8237 : printf ("No representative for SgTemplateParameter found in memory pools \n");
8238 : }
8239 : #endif
8240 : }
8241 0 : }
8242 :
8243 :
8244 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
8245 : // using values that overflow signed values of int.
8246 : size_t
8247 4 : SgTemplateParameter::numberOfNodes()
8248 : {
8249 : // This function traverses the memory pool for an IR node and
8250 : // counts the number of IR nodes of a particular Sage III IR
8251 : // nodes type.
8252 :
8253 4 : size_t count = 0;
8254 4 : if (SgTemplateParameter::pools.empty() == false)
8255 : {
8256 : // Generate an array of memory pools (this is actually a STL vector,
8257 : // but it is contiguious, so OK to treat this way).
8258 1 : SgTemplateParameter** objectArray = (SgTemplateParameter**) &(SgTemplateParameter::pools[0]);
8259 :
8260 : // Build a local variable for better performance (make it a loop invariant variable).
8261 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
8262 :
8263 : // Iterate over all of the memory pools for this IR node.
8264 3 : for (unsigned int i=0; i < SgTemplateParameter::pools.size(); i++)
8265 : {
8266 : // objectArray[i] is a single memory pool, iterate over all the
8267 : // IR nodes and only count those that are valid IR nodes used in
8268 : // the AST (i.e. allocated IR nodes).
8269 4002 : for (unsigned j=0; j < SgTemplateParameter::pool_size; j++)
8270 : {
8271 : // This is indexing the STL vector of C/C++ style arrays as a doubly
8272 : // indexed array access. It is OK since we have leveraged the semantics
8273 : // of STL vector memory as contigous and cast the memory as an array
8274 : // of arrays to use the 2D array indexing. Hope this is not confusing,
8275 : // but it s very fast as an implementation.
8276 4000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
8277 : {
8278 2167 : count++;
8279 : }
8280 : }
8281 : }
8282 : }
8283 :
8284 :
8285 :
8286 4 : return count;
8287 : }
8288 :
8289 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
8290 : // using values that overflow signed values of int.
8291 : size_t
8292 0 : SgTemplateParameter::memoryUsage()
8293 : {
8294 : // This function is required because we need the class name as a type when we call sizeof
8295 : // There might be another way to implement this if we have a traversal that only called a
8296 : // representative object (one call for each type of Sage IIIIR node).
8297 0 : size_t memory = numberOfNodes() * sizeof(SgTemplateParameter);
8298 :
8299 0 : return memory;
8300 : }
8301 :
8302 : /* #line 8303 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
8303 :
8304 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
8305 : void
8306 5342 : SgTemplateArgument::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
8307 : {
8308 : // This function traverses the memory pool for only a specific IR node
8309 : // and calls the visit function of the input class execute a traversal
8310 : // similar to the style of the attribute based traversals within ROSE.
8311 : // This traversal will visit ALL nodes of the AST where as the other
8312 : // attribute based traversals visit only the embedded tree within the AST.
8313 :
8314 : // Initialize array to the address of the first element of the STL vector
8315 : // (which is guaranteed to be contiguous storage).
8316 : // SgTemplateArgument objectArray [] = *(Memory_Block_List.begin());
8317 5342 : if (SgTemplateArgument::pools.empty() == false)
8318 : {
8319 : // Generate an array of memory pools
8320 138 : SgTemplateArgument** objectArray = (SgTemplateArgument**) &(SgTemplateArgument::pools[0]);
8321 :
8322 : // Build a local variable for better performance
8323 138 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
8324 : #if 0
8325 : // Iterate over the memory pools
8326 : for (unsigned int i=0; i < SgTemplateArgument::pools.size(); i++)
8327 : {
8328 : // objectArray[i] is a single memory pool
8329 : for (int j=0; j < SgTemplateArgument::pool_size; j++)
8330 : {
8331 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
8332 : {
8333 : traversal.visit(&(objectArray[i][j]));
8334 : }
8335 : }
8336 : }
8337 : #else
8338 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
8339 : // compute the list first and then call the visit function on each list element.
8340 :
8341 : // printf ("Inside of SgTemplateArgument::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
8342 :
8343 276 : std::vector<SgTemplateArgument*> nodeList;
8344 :
8345 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
8346 667 : for (unsigned int i=0; i < SgTemplateArgument::pools.size(); i++)
8347 : {
8348 : // objectArray[i] is a single memory pool
8349 1058530 : for (unsigned j=0; j < SgTemplateArgument::pool_size; j++)
8350 : {
8351 1058000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
8352 : {
8353 876678 : nodeList.push_back(&(objectArray[i][j]));
8354 : }
8355 : }
8356 : }
8357 :
8358 : // Iterate over the saved list
8359 138 : size_t nodeListSize = nodeList.size();
8360 876816 : for (size_t i=0; i < nodeListSize; i++)
8361 : {
8362 876678 : ROSE_ASSERT(nodeList[i] != NULL);
8363 : #if 0
8364 : traversal.visit(nodeList[i]);
8365 : #else
8366 876678 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
8367 : {
8368 876678 : traversal.visit(nodeList[i]);
8369 : }
8370 : #endif
8371 : }
8372 : #endif
8373 : }
8374 :
8375 : // This should not be required since all previously static data members are
8376 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
8377 :
8378 5342 : }
8379 :
8380 :
8381 : void
8382 194 : SgTemplateArgument::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
8383 : {
8384 : // This function traverses the memory pool for an IR node and
8385 : // calls the function to execute the visitor object.
8386 :
8387 : // Initialize array to the address of the first element of the STL vector
8388 : // (which is guarenteed to be contiguous storage).
8389 : // SgTemplateArgument objectArray [] = *(Memory_Block_List.begin());
8390 194 : if (SgTemplateArgument::pools.empty() == false)
8391 : {
8392 : // Generate an array of memory pools
8393 137 : SgTemplateArgument** objectArray = (SgTemplateArgument**) &(SgTemplateArgument::pools[0]);
8394 :
8395 : // Build a local variable for better performance
8396 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
8397 :
8398 : // Iterate over the memory pools
8399 685 : for (unsigned int i=0; i < SgTemplateArgument::pools.size(); i++)
8400 : {
8401 : // objectArray[i] is a single memory pool
8402 1096550 : for (unsigned j=0; j < SgTemplateArgument::pool_size; j++)
8403 : {
8404 1096000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
8405 : {
8406 : // printf ("Found a valid SgTemplateArgument object in the memory pool %d at position %d \n",i,j);
8407 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
8408 935333 : objectArray[i][j].executeVisitorMemberFunction(visitor);
8409 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
8410 : }
8411 : else
8412 : {
8413 : // printf ("Found a INVALID SgTemplateArgument object in the memory pool \n");
8414 : }
8415 : }
8416 : }
8417 : }
8418 :
8419 : // This should not be required since all previously static data members are
8420 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
8421 :
8422 194 : }
8423 :
8424 : void
8425 0 : SgTemplateArgument::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
8426 : {
8427 : // This function visits only a single IR node of the memory pool.
8428 : // it is typically called once for each type of IR node within
8429 : // the automatically generated function: traverseRepresentativeNodes().
8430 :
8431 : // Initialize array to the address of the first element of the STL vector
8432 : // (which is guarenteed to be contiguous storage).
8433 : // SgTemplateArgument objectArray [] = *(Memory_Block_List.begin());
8434 0 : if (SgTemplateArgument::pools.empty() == false)
8435 : {
8436 : // Generate an array of memory pools
8437 0 : SgTemplateArgument** objectArray = (SgTemplateArgument**) &(SgTemplateArgument::pools[0]);
8438 :
8439 : // Build a local variable for better performance
8440 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
8441 :
8442 : // Iterate over the memory pools
8443 0 : bool done = false;
8444 0 : unsigned i=0;
8445 :
8446 : // find the first valid IR node, call visit function, and then leave
8447 0 : while ( done == false && i < SgTemplateArgument::pools.size() )
8448 : {
8449 : // objectArray[i] is a single memory pool
8450 : unsigned j=0;
8451 0 : while (done == false && j < SgTemplateArgument::pool_size)
8452 : {
8453 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
8454 : {
8455 0 : traversal.visit(&(objectArray[i][j]));
8456 0 : done = true;
8457 : }
8458 0 : j++;
8459 : }
8460 0 : i++;
8461 : }
8462 :
8463 : #if 0
8464 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
8465 : if (done == false)
8466 : {
8467 : printf ("No representative for SgTemplateArgument found in memory pools \n");
8468 : }
8469 : #endif
8470 : }
8471 0 : }
8472 :
8473 :
8474 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
8475 : // using values that overflow signed values of int.
8476 : size_t
8477 4 : SgTemplateArgument::numberOfNodes()
8478 : {
8479 : // This function traverses the memory pool for an IR node and
8480 : // counts the number of IR nodes of a particular Sage III IR
8481 : // nodes type.
8482 :
8483 4 : size_t count = 0;
8484 4 : if (SgTemplateArgument::pools.empty() == false)
8485 : {
8486 : // Generate an array of memory pools (this is actually a STL vector,
8487 : // but it is contiguious, so OK to treat this way).
8488 1 : SgTemplateArgument** objectArray = (SgTemplateArgument**) &(SgTemplateArgument::pools[0]);
8489 :
8490 : // Build a local variable for better performance (make it a loop invariant variable).
8491 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
8492 :
8493 : // Iterate over all of the memory pools for this IR node.
8494 5 : for (unsigned int i=0; i < SgTemplateArgument::pools.size(); i++)
8495 : {
8496 : // objectArray[i] is a single memory pool, iterate over all the
8497 : // IR nodes and only count those that are valid IR nodes used in
8498 : // the AST (i.e. allocated IR nodes).
8499 8004 : for (unsigned j=0; j < SgTemplateArgument::pool_size; j++)
8500 : {
8501 : // This is indexing the STL vector of C/C++ style arrays as a doubly
8502 : // indexed array access. It is OK since we have leveraged the semantics
8503 : // of STL vector memory as contigous and cast the memory as an array
8504 : // of arrays to use the 2D array indexing. Hope this is not confusing,
8505 : // but it s very fast as an implementation.
8506 8000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
8507 : {
8508 6725 : count++;
8509 : }
8510 : }
8511 : }
8512 : }
8513 :
8514 :
8515 :
8516 4 : return count;
8517 : }
8518 :
8519 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
8520 : // using values that overflow signed values of int.
8521 : size_t
8522 0 : SgTemplateArgument::memoryUsage()
8523 : {
8524 : // This function is required because we need the class name as a type when we call sizeof
8525 : // There might be another way to implement this if we have a traversal that only called a
8526 : // representative object (one call for each type of Sage IIIIR node).
8527 0 : size_t memory = numberOfNodes() * sizeof(SgTemplateArgument);
8528 :
8529 0 : return memory;
8530 : }
8531 :
8532 : /* #line 8533 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
8533 :
8534 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
8535 : void
8536 5342 : SgDirectory::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
8537 : {
8538 : // This function traverses the memory pool for only a specific IR node
8539 : // and calls the visit function of the input class execute a traversal
8540 : // similar to the style of the attribute based traversals within ROSE.
8541 : // This traversal will visit ALL nodes of the AST where as the other
8542 : // attribute based traversals visit only the embedded tree within the AST.
8543 :
8544 : // Initialize array to the address of the first element of the STL vector
8545 : // (which is guaranteed to be contiguous storage).
8546 : // SgDirectory objectArray [] = *(Memory_Block_List.begin());
8547 5342 : if (SgDirectory::pools.empty() == false)
8548 : {
8549 : // Generate an array of memory pools
8550 0 : SgDirectory** objectArray = (SgDirectory**) &(SgDirectory::pools[0]);
8551 :
8552 : // Build a local variable for better performance
8553 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
8554 : #if 0
8555 : // Iterate over the memory pools
8556 : for (unsigned int i=0; i < SgDirectory::pools.size(); i++)
8557 : {
8558 : // objectArray[i] is a single memory pool
8559 : for (int j=0; j < SgDirectory::pool_size; j++)
8560 : {
8561 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
8562 : {
8563 : traversal.visit(&(objectArray[i][j]));
8564 : }
8565 : }
8566 : }
8567 : #else
8568 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
8569 : // compute the list first and then call the visit function on each list element.
8570 :
8571 : // printf ("Inside of SgDirectory::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
8572 :
8573 0 : std::vector<SgDirectory*> nodeList;
8574 :
8575 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
8576 0 : for (unsigned int i=0; i < SgDirectory::pools.size(); i++)
8577 : {
8578 : // objectArray[i] is a single memory pool
8579 0 : for (unsigned j=0; j < SgDirectory::pool_size; j++)
8580 : {
8581 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
8582 : {
8583 0 : nodeList.push_back(&(objectArray[i][j]));
8584 : }
8585 : }
8586 : }
8587 :
8588 : // Iterate over the saved list
8589 0 : size_t nodeListSize = nodeList.size();
8590 0 : for (size_t i=0; i < nodeListSize; i++)
8591 : {
8592 0 : ROSE_ASSERT(nodeList[i] != NULL);
8593 : #if 0
8594 : traversal.visit(nodeList[i]);
8595 : #else
8596 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
8597 : {
8598 0 : traversal.visit(nodeList[i]);
8599 : }
8600 : #endif
8601 : }
8602 : #endif
8603 : }
8604 :
8605 : // This should not be required since all previously static data members are
8606 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
8607 :
8608 5342 : }
8609 :
8610 :
8611 : void
8612 194 : SgDirectory::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
8613 : {
8614 : // This function traverses the memory pool for an IR node and
8615 : // calls the function to execute the visitor object.
8616 :
8617 : // Initialize array to the address of the first element of the STL vector
8618 : // (which is guarenteed to be contiguous storage).
8619 : // SgDirectory objectArray [] = *(Memory_Block_List.begin());
8620 194 : if (SgDirectory::pools.empty() == false)
8621 : {
8622 : // Generate an array of memory pools
8623 0 : SgDirectory** objectArray = (SgDirectory**) &(SgDirectory::pools[0]);
8624 :
8625 : // Build a local variable for better performance
8626 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
8627 :
8628 : // Iterate over the memory pools
8629 0 : for (unsigned int i=0; i < SgDirectory::pools.size(); i++)
8630 : {
8631 : // objectArray[i] is a single memory pool
8632 0 : for (unsigned j=0; j < SgDirectory::pool_size; j++)
8633 : {
8634 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
8635 : {
8636 : // printf ("Found a valid SgDirectory object in the memory pool %d at position %d \n",i,j);
8637 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
8638 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
8639 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
8640 : }
8641 : else
8642 : {
8643 : // printf ("Found a INVALID SgDirectory object in the memory pool \n");
8644 : }
8645 : }
8646 : }
8647 : }
8648 :
8649 : // This should not be required since all previously static data members are
8650 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
8651 :
8652 194 : }
8653 :
8654 : void
8655 0 : SgDirectory::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
8656 : {
8657 : // This function visits only a single IR node of the memory pool.
8658 : // it is typically called once for each type of IR node within
8659 : // the automatically generated function: traverseRepresentativeNodes().
8660 :
8661 : // Initialize array to the address of the first element of the STL vector
8662 : // (which is guarenteed to be contiguous storage).
8663 : // SgDirectory objectArray [] = *(Memory_Block_List.begin());
8664 0 : if (SgDirectory::pools.empty() == false)
8665 : {
8666 : // Generate an array of memory pools
8667 0 : SgDirectory** objectArray = (SgDirectory**) &(SgDirectory::pools[0]);
8668 :
8669 : // Build a local variable for better performance
8670 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
8671 :
8672 : // Iterate over the memory pools
8673 0 : bool done = false;
8674 0 : unsigned i=0;
8675 :
8676 : // find the first valid IR node, call visit function, and then leave
8677 0 : while ( done == false && i < SgDirectory::pools.size() )
8678 : {
8679 : // objectArray[i] is a single memory pool
8680 : unsigned j=0;
8681 0 : while (done == false && j < SgDirectory::pool_size)
8682 : {
8683 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
8684 : {
8685 0 : traversal.visit(&(objectArray[i][j]));
8686 0 : done = true;
8687 : }
8688 0 : j++;
8689 : }
8690 0 : i++;
8691 : }
8692 :
8693 : #if 0
8694 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
8695 : if (done == false)
8696 : {
8697 : printf ("No representative for SgDirectory found in memory pools \n");
8698 : }
8699 : #endif
8700 : }
8701 0 : }
8702 :
8703 :
8704 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
8705 : // using values that overflow signed values of int.
8706 : size_t
8707 4 : SgDirectory::numberOfNodes()
8708 : {
8709 : // This function traverses the memory pool for an IR node and
8710 : // counts the number of IR nodes of a particular Sage III IR
8711 : // nodes type.
8712 :
8713 4 : size_t count = 0;
8714 4 : if (SgDirectory::pools.empty() == false)
8715 : {
8716 : // Generate an array of memory pools (this is actually a STL vector,
8717 : // but it is contiguious, so OK to treat this way).
8718 0 : SgDirectory** objectArray = (SgDirectory**) &(SgDirectory::pools[0]);
8719 :
8720 : // Build a local variable for better performance (make it a loop invariant variable).
8721 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
8722 :
8723 : // Iterate over all of the memory pools for this IR node.
8724 0 : for (unsigned int i=0; i < SgDirectory::pools.size(); i++)
8725 : {
8726 : // objectArray[i] is a single memory pool, iterate over all the
8727 : // IR nodes and only count those that are valid IR nodes used in
8728 : // the AST (i.e. allocated IR nodes).
8729 0 : for (unsigned j=0; j < SgDirectory::pool_size; j++)
8730 : {
8731 : // This is indexing the STL vector of C/C++ style arrays as a doubly
8732 : // indexed array access. It is OK since we have leveraged the semantics
8733 : // of STL vector memory as contigous and cast the memory as an array
8734 : // of arrays to use the 2D array indexing. Hope this is not confusing,
8735 : // but it s very fast as an implementation.
8736 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
8737 : {
8738 0 : count++;
8739 : }
8740 : }
8741 : }
8742 : }
8743 :
8744 :
8745 :
8746 4 : return count;
8747 : }
8748 :
8749 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
8750 : // using values that overflow signed values of int.
8751 : size_t
8752 0 : SgDirectory::memoryUsage()
8753 : {
8754 : // This function is required because we need the class name as a type when we call sizeof
8755 : // There might be another way to implement this if we have a traversal that only called a
8756 : // representative object (one call for each type of Sage IIIIR node).
8757 0 : size_t memory = numberOfNodes() * sizeof(SgDirectory);
8758 :
8759 0 : return memory;
8760 : }
8761 :
8762 : /* #line 8763 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
8763 :
8764 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
8765 : void
8766 5342 : SgFileList::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
8767 : {
8768 : // This function traverses the memory pool for only a specific IR node
8769 : // and calls the visit function of the input class execute a traversal
8770 : // similar to the style of the attribute based traversals within ROSE.
8771 : // This traversal will visit ALL nodes of the AST where as the other
8772 : // attribute based traversals visit only the embedded tree within the AST.
8773 :
8774 : // Initialize array to the address of the first element of the STL vector
8775 : // (which is guaranteed to be contiguous storage).
8776 : // SgFileList objectArray [] = *(Memory_Block_List.begin());
8777 5342 : if (SgFileList::pools.empty() == false)
8778 : {
8779 : // Generate an array of memory pools
8780 5342 : SgFileList** objectArray = (SgFileList**) &(SgFileList::pools[0]);
8781 :
8782 : // Build a local variable for better performance
8783 5342 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
8784 : #if 0
8785 : // Iterate over the memory pools
8786 : for (unsigned int i=0; i < SgFileList::pools.size(); i++)
8787 : {
8788 : // objectArray[i] is a single memory pool
8789 : for (int j=0; j < SgFileList::pool_size; j++)
8790 : {
8791 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
8792 : {
8793 : traversal.visit(&(objectArray[i][j]));
8794 : }
8795 : }
8796 : }
8797 : #else
8798 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
8799 : // compute the list first and then call the visit function on each list element.
8800 :
8801 : // printf ("Inside of SgFileList::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
8802 :
8803 10684 : std::vector<SgFileList*> nodeList;
8804 :
8805 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
8806 10684 : for (unsigned int i=0; i < SgFileList::pools.size(); i++)
8807 : {
8808 : // objectArray[i] is a single memory pool
8809 10689300 : for (unsigned j=0; j < SgFileList::pool_size; j++)
8810 : {
8811 10684000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
8812 : {
8813 5400 : nodeList.push_back(&(objectArray[i][j]));
8814 : }
8815 : }
8816 : }
8817 :
8818 : // Iterate over the saved list
8819 5342 : size_t nodeListSize = nodeList.size();
8820 10742 : for (size_t i=0; i < nodeListSize; i++)
8821 : {
8822 5400 : ROSE_ASSERT(nodeList[i] != NULL);
8823 : #if 0
8824 : traversal.visit(nodeList[i]);
8825 : #else
8826 5400 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
8827 : {
8828 5400 : traversal.visit(nodeList[i]);
8829 : }
8830 : #endif
8831 : }
8832 : #endif
8833 : }
8834 :
8835 : // This should not be required since all previously static data members are
8836 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
8837 :
8838 5342 : }
8839 :
8840 :
8841 : void
8842 194 : SgFileList::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
8843 : {
8844 : // This function traverses the memory pool for an IR node and
8845 : // calls the function to execute the visitor object.
8846 :
8847 : // Initialize array to the address of the first element of the STL vector
8848 : // (which is guarenteed to be contiguous storage).
8849 : // SgFileList objectArray [] = *(Memory_Block_List.begin());
8850 194 : if (SgFileList::pools.empty() == false)
8851 : {
8852 : // Generate an array of memory pools
8853 194 : SgFileList** objectArray = (SgFileList**) &(SgFileList::pools[0]);
8854 :
8855 : // Build a local variable for better performance
8856 194 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
8857 :
8858 : // Iterate over the memory pools
8859 388 : for (unsigned int i=0; i < SgFileList::pools.size(); i++)
8860 : {
8861 : // objectArray[i] is a single memory pool
8862 388194 : for (unsigned j=0; j < SgFileList::pool_size; j++)
8863 : {
8864 388000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
8865 : {
8866 : // printf ("Found a valid SgFileList object in the memory pool %d at position %d \n",i,j);
8867 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
8868 194 : objectArray[i][j].executeVisitorMemberFunction(visitor);
8869 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
8870 : }
8871 : else
8872 : {
8873 : // printf ("Found a INVALID SgFileList object in the memory pool \n");
8874 : }
8875 : }
8876 : }
8877 : }
8878 :
8879 : // This should not be required since all previously static data members are
8880 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
8881 :
8882 194 : }
8883 :
8884 : void
8885 0 : SgFileList::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
8886 : {
8887 : // This function visits only a single IR node of the memory pool.
8888 : // it is typically called once for each type of IR node within
8889 : // the automatically generated function: traverseRepresentativeNodes().
8890 :
8891 : // Initialize array to the address of the first element of the STL vector
8892 : // (which is guarenteed to be contiguous storage).
8893 : // SgFileList objectArray [] = *(Memory_Block_List.begin());
8894 0 : if (SgFileList::pools.empty() == false)
8895 : {
8896 : // Generate an array of memory pools
8897 0 : SgFileList** objectArray = (SgFileList**) &(SgFileList::pools[0]);
8898 :
8899 : // Build a local variable for better performance
8900 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
8901 :
8902 : // Iterate over the memory pools
8903 0 : bool done = false;
8904 0 : unsigned i=0;
8905 :
8906 : // find the first valid IR node, call visit function, and then leave
8907 0 : while ( done == false && i < SgFileList::pools.size() )
8908 : {
8909 : // objectArray[i] is a single memory pool
8910 : unsigned j=0;
8911 0 : while (done == false && j < SgFileList::pool_size)
8912 : {
8913 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
8914 : {
8915 0 : traversal.visit(&(objectArray[i][j]));
8916 0 : done = true;
8917 : }
8918 0 : j++;
8919 : }
8920 0 : i++;
8921 : }
8922 :
8923 : #if 0
8924 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
8925 : if (done == false)
8926 : {
8927 : printf ("No representative for SgFileList found in memory pools \n");
8928 : }
8929 : #endif
8930 : }
8931 0 : }
8932 :
8933 :
8934 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
8935 : // using values that overflow signed values of int.
8936 : size_t
8937 4 : SgFileList::numberOfNodes()
8938 : {
8939 : // This function traverses the memory pool for an IR node and
8940 : // counts the number of IR nodes of a particular Sage III IR
8941 : // nodes type.
8942 :
8943 4 : size_t count = 0;
8944 4 : if (SgFileList::pools.empty() == false)
8945 : {
8946 : // Generate an array of memory pools (this is actually a STL vector,
8947 : // but it is contiguious, so OK to treat this way).
8948 4 : SgFileList** objectArray = (SgFileList**) &(SgFileList::pools[0]);
8949 :
8950 : // Build a local variable for better performance (make it a loop invariant variable).
8951 4 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
8952 :
8953 : // Iterate over all of the memory pools for this IR node.
8954 8 : for (unsigned int i=0; i < SgFileList::pools.size(); i++)
8955 : {
8956 : // objectArray[i] is a single memory pool, iterate over all the
8957 : // IR nodes and only count those that are valid IR nodes used in
8958 : // the AST (i.e. allocated IR nodes).
8959 8004 : for (unsigned j=0; j < SgFileList::pool_size; j++)
8960 : {
8961 : // This is indexing the STL vector of C/C++ style arrays as a doubly
8962 : // indexed array access. It is OK since we have leveraged the semantics
8963 : // of STL vector memory as contigous and cast the memory as an array
8964 : // of arrays to use the 2D array indexing. Hope this is not confusing,
8965 : // but it s very fast as an implementation.
8966 8000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
8967 : {
8968 6 : count++;
8969 : }
8970 : }
8971 : }
8972 : }
8973 :
8974 :
8975 :
8976 4 : return count;
8977 : }
8978 :
8979 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
8980 : // using values that overflow signed values of int.
8981 : size_t
8982 0 : SgFileList::memoryUsage()
8983 : {
8984 : // This function is required because we need the class name as a type when we call sizeof
8985 : // There might be another way to implement this if we have a traversal that only called a
8986 : // representative object (one call for each type of Sage IIIIR node).
8987 0 : size_t memory = numberOfNodes() * sizeof(SgFileList);
8988 :
8989 0 : return memory;
8990 : }
8991 :
8992 : /* #line 8993 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
8993 :
8994 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
8995 : void
8996 5342 : SgDirectoryList::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
8997 : {
8998 : // This function traverses the memory pool for only a specific IR node
8999 : // and calls the visit function of the input class execute a traversal
9000 : // similar to the style of the attribute based traversals within ROSE.
9001 : // This traversal will visit ALL nodes of the AST where as the other
9002 : // attribute based traversals visit only the embedded tree within the AST.
9003 :
9004 : // Initialize array to the address of the first element of the STL vector
9005 : // (which is guaranteed to be contiguous storage).
9006 : // SgDirectoryList objectArray [] = *(Memory_Block_List.begin());
9007 5342 : if (SgDirectoryList::pools.empty() == false)
9008 : {
9009 : // Generate an array of memory pools
9010 5342 : SgDirectoryList** objectArray = (SgDirectoryList**) &(SgDirectoryList::pools[0]);
9011 :
9012 : // Build a local variable for better performance
9013 5342 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
9014 : #if 0
9015 : // Iterate over the memory pools
9016 : for (unsigned int i=0; i < SgDirectoryList::pools.size(); i++)
9017 : {
9018 : // objectArray[i] is a single memory pool
9019 : for (int j=0; j < SgDirectoryList::pool_size; j++)
9020 : {
9021 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
9022 : {
9023 : traversal.visit(&(objectArray[i][j]));
9024 : }
9025 : }
9026 : }
9027 : #else
9028 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
9029 : // compute the list first and then call the visit function on each list element.
9030 :
9031 : // printf ("Inside of SgDirectoryList::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
9032 :
9033 10684 : std::vector<SgDirectoryList*> nodeList;
9034 :
9035 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
9036 10684 : for (unsigned int i=0; i < SgDirectoryList::pools.size(); i++)
9037 : {
9038 : // objectArray[i] is a single memory pool
9039 10689300 : for (unsigned j=0; j < SgDirectoryList::pool_size; j++)
9040 : {
9041 10684000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
9042 : {
9043 5400 : nodeList.push_back(&(objectArray[i][j]));
9044 : }
9045 : }
9046 : }
9047 :
9048 : // Iterate over the saved list
9049 5342 : size_t nodeListSize = nodeList.size();
9050 10742 : for (size_t i=0; i < nodeListSize; i++)
9051 : {
9052 5400 : ROSE_ASSERT(nodeList[i] != NULL);
9053 : #if 0
9054 : traversal.visit(nodeList[i]);
9055 : #else
9056 5400 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
9057 : {
9058 5400 : traversal.visit(nodeList[i]);
9059 : }
9060 : #endif
9061 : }
9062 : #endif
9063 : }
9064 :
9065 : // This should not be required since all previously static data members are
9066 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
9067 :
9068 5342 : }
9069 :
9070 :
9071 : void
9072 194 : SgDirectoryList::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
9073 : {
9074 : // This function traverses the memory pool for an IR node and
9075 : // calls the function to execute the visitor object.
9076 :
9077 : // Initialize array to the address of the first element of the STL vector
9078 : // (which is guarenteed to be contiguous storage).
9079 : // SgDirectoryList objectArray [] = *(Memory_Block_List.begin());
9080 194 : if (SgDirectoryList::pools.empty() == false)
9081 : {
9082 : // Generate an array of memory pools
9083 194 : SgDirectoryList** objectArray = (SgDirectoryList**) &(SgDirectoryList::pools[0]);
9084 :
9085 : // Build a local variable for better performance
9086 194 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
9087 :
9088 : // Iterate over the memory pools
9089 388 : for (unsigned int i=0; i < SgDirectoryList::pools.size(); i++)
9090 : {
9091 : // objectArray[i] is a single memory pool
9092 388194 : for (unsigned j=0; j < SgDirectoryList::pool_size; j++)
9093 : {
9094 388000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
9095 : {
9096 : // printf ("Found a valid SgDirectoryList object in the memory pool %d at position %d \n",i,j);
9097 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
9098 194 : objectArray[i][j].executeVisitorMemberFunction(visitor);
9099 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
9100 : }
9101 : else
9102 : {
9103 : // printf ("Found a INVALID SgDirectoryList object in the memory pool \n");
9104 : }
9105 : }
9106 : }
9107 : }
9108 :
9109 : // This should not be required since all previously static data members are
9110 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
9111 :
9112 194 : }
9113 :
9114 : void
9115 0 : SgDirectoryList::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
9116 : {
9117 : // This function visits only a single IR node of the memory pool.
9118 : // it is typically called once for each type of IR node within
9119 : // the automatically generated function: traverseRepresentativeNodes().
9120 :
9121 : // Initialize array to the address of the first element of the STL vector
9122 : // (which is guarenteed to be contiguous storage).
9123 : // SgDirectoryList objectArray [] = *(Memory_Block_List.begin());
9124 0 : if (SgDirectoryList::pools.empty() == false)
9125 : {
9126 : // Generate an array of memory pools
9127 0 : SgDirectoryList** objectArray = (SgDirectoryList**) &(SgDirectoryList::pools[0]);
9128 :
9129 : // Build a local variable for better performance
9130 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
9131 :
9132 : // Iterate over the memory pools
9133 0 : bool done = false;
9134 0 : unsigned i=0;
9135 :
9136 : // find the first valid IR node, call visit function, and then leave
9137 0 : while ( done == false && i < SgDirectoryList::pools.size() )
9138 : {
9139 : // objectArray[i] is a single memory pool
9140 : unsigned j=0;
9141 0 : while (done == false && j < SgDirectoryList::pool_size)
9142 : {
9143 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
9144 : {
9145 0 : traversal.visit(&(objectArray[i][j]));
9146 0 : done = true;
9147 : }
9148 0 : j++;
9149 : }
9150 0 : i++;
9151 : }
9152 :
9153 : #if 0
9154 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
9155 : if (done == false)
9156 : {
9157 : printf ("No representative for SgDirectoryList found in memory pools \n");
9158 : }
9159 : #endif
9160 : }
9161 0 : }
9162 :
9163 :
9164 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
9165 : // using values that overflow signed values of int.
9166 : size_t
9167 4 : SgDirectoryList::numberOfNodes()
9168 : {
9169 : // This function traverses the memory pool for an IR node and
9170 : // counts the number of IR nodes of a particular Sage III IR
9171 : // nodes type.
9172 :
9173 4 : size_t count = 0;
9174 4 : if (SgDirectoryList::pools.empty() == false)
9175 : {
9176 : // Generate an array of memory pools (this is actually a STL vector,
9177 : // but it is contiguious, so OK to treat this way).
9178 4 : SgDirectoryList** objectArray = (SgDirectoryList**) &(SgDirectoryList::pools[0]);
9179 :
9180 : // Build a local variable for better performance (make it a loop invariant variable).
9181 4 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
9182 :
9183 : // Iterate over all of the memory pools for this IR node.
9184 8 : for (unsigned int i=0; i < SgDirectoryList::pools.size(); i++)
9185 : {
9186 : // objectArray[i] is a single memory pool, iterate over all the
9187 : // IR nodes and only count those that are valid IR nodes used in
9188 : // the AST (i.e. allocated IR nodes).
9189 8004 : for (unsigned j=0; j < SgDirectoryList::pool_size; j++)
9190 : {
9191 : // This is indexing the STL vector of C/C++ style arrays as a doubly
9192 : // indexed array access. It is OK since we have leveraged the semantics
9193 : // of STL vector memory as contigous and cast the memory as an array
9194 : // of arrays to use the 2D array indexing. Hope this is not confusing,
9195 : // but it s very fast as an implementation.
9196 8000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
9197 : {
9198 6 : count++;
9199 : }
9200 : }
9201 : }
9202 : }
9203 :
9204 :
9205 :
9206 4 : return count;
9207 : }
9208 :
9209 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
9210 : // using values that overflow signed values of int.
9211 : size_t
9212 0 : SgDirectoryList::memoryUsage()
9213 : {
9214 : // This function is required because we need the class name as a type when we call sizeof
9215 : // There might be another way to implement this if we have a traversal that only called a
9216 : // representative object (one call for each type of Sage IIIIR node).
9217 0 : size_t memory = numberOfNodes() * sizeof(SgDirectoryList);
9218 :
9219 0 : return memory;
9220 : }
9221 :
9222 : /* #line 9223 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
9223 :
9224 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
9225 : void
9226 5342 : SgFunctionParameterTypeList::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
9227 : {
9228 : // This function traverses the memory pool for only a specific IR node
9229 : // and calls the visit function of the input class execute a traversal
9230 : // similar to the style of the attribute based traversals within ROSE.
9231 : // This traversal will visit ALL nodes of the AST where as the other
9232 : // attribute based traversals visit only the embedded tree within the AST.
9233 :
9234 : // Initialize array to the address of the first element of the STL vector
9235 : // (which is guaranteed to be contiguous storage).
9236 : // SgFunctionParameterTypeList objectArray [] = *(Memory_Block_List.begin());
9237 5342 : if (SgFunctionParameterTypeList::pools.empty() == false)
9238 : {
9239 : // Generate an array of memory pools
9240 5303 : SgFunctionParameterTypeList** objectArray = (SgFunctionParameterTypeList**) &(SgFunctionParameterTypeList::pools[0]);
9241 :
9242 : // Build a local variable for better performance
9243 5303 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
9244 : #if 0
9245 : // Iterate over the memory pools
9246 : for (unsigned int i=0; i < SgFunctionParameterTypeList::pools.size(); i++)
9247 : {
9248 : // objectArray[i] is a single memory pool
9249 : for (int j=0; j < SgFunctionParameterTypeList::pool_size; j++)
9250 : {
9251 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
9252 : {
9253 : traversal.visit(&(objectArray[i][j]));
9254 : }
9255 : }
9256 : }
9257 : #else
9258 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
9259 : // compute the list first and then call the visit function on each list element.
9260 :
9261 : // printf ("Inside of SgFunctionParameterTypeList::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
9262 :
9263 10606 : std::vector<SgFunctionParameterTypeList*> nodeList;
9264 :
9265 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
9266 10983 : for (unsigned int i=0; i < SgFunctionParameterTypeList::pools.size(); i++)
9267 : {
9268 : // objectArray[i] is a single memory pool
9269 11365700 : for (unsigned j=0; j < SgFunctionParameterTypeList::pool_size; j++)
9270 : {
9271 11360000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
9272 : {
9273 4015220 : nodeList.push_back(&(objectArray[i][j]));
9274 : }
9275 : }
9276 : }
9277 :
9278 : // Iterate over the saved list
9279 5303 : size_t nodeListSize = nodeList.size();
9280 4020520 : for (size_t i=0; i < nodeListSize; i++)
9281 : {
9282 4015220 : ROSE_ASSERT(nodeList[i] != NULL);
9283 : #if 0
9284 : traversal.visit(nodeList[i]);
9285 : #else
9286 4015220 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
9287 : {
9288 4015220 : traversal.visit(nodeList[i]);
9289 : }
9290 : #endif
9291 : }
9292 : #endif
9293 : }
9294 :
9295 : // This should not be required since all previously static data members are
9296 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
9297 :
9298 5342 : }
9299 :
9300 :
9301 : void
9302 194 : SgFunctionParameterTypeList::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
9303 : {
9304 : // This function traverses the memory pool for an IR node and
9305 : // calls the function to execute the visitor object.
9306 :
9307 : // Initialize array to the address of the first element of the STL vector
9308 : // (which is guarenteed to be contiguous storage).
9309 : // SgFunctionParameterTypeList objectArray [] = *(Memory_Block_List.begin());
9310 194 : if (SgFunctionParameterTypeList::pools.empty() == false)
9311 : {
9312 : // Generate an array of memory pools
9313 194 : SgFunctionParameterTypeList** objectArray = (SgFunctionParameterTypeList**) &(SgFunctionParameterTypeList::pools[0]);
9314 :
9315 : // Build a local variable for better performance
9316 194 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
9317 :
9318 : // Iterate over the memory pools
9319 817 : for (unsigned int i=0; i < SgFunctionParameterTypeList::pools.size(); i++)
9320 : {
9321 : // objectArray[i] is a single memory pool
9322 1246620 : for (unsigned j=0; j < SgFunctionParameterTypeList::pool_size; j++)
9323 : {
9324 1246000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
9325 : {
9326 : // printf ("Found a valid SgFunctionParameterTypeList object in the memory pool %d at position %d \n",i,j);
9327 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
9328 1115420 : objectArray[i][j].executeVisitorMemberFunction(visitor);
9329 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
9330 : }
9331 : else
9332 : {
9333 : // printf ("Found a INVALID SgFunctionParameterTypeList object in the memory pool \n");
9334 : }
9335 : }
9336 : }
9337 : }
9338 :
9339 : // This should not be required since all previously static data members are
9340 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
9341 :
9342 194 : }
9343 :
9344 : void
9345 0 : SgFunctionParameterTypeList::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
9346 : {
9347 : // This function visits only a single IR node of the memory pool.
9348 : // it is typically called once for each type of IR node within
9349 : // the automatically generated function: traverseRepresentativeNodes().
9350 :
9351 : // Initialize array to the address of the first element of the STL vector
9352 : // (which is guarenteed to be contiguous storage).
9353 : // SgFunctionParameterTypeList objectArray [] = *(Memory_Block_List.begin());
9354 0 : if (SgFunctionParameterTypeList::pools.empty() == false)
9355 : {
9356 : // Generate an array of memory pools
9357 0 : SgFunctionParameterTypeList** objectArray = (SgFunctionParameterTypeList**) &(SgFunctionParameterTypeList::pools[0]);
9358 :
9359 : // Build a local variable for better performance
9360 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
9361 :
9362 : // Iterate over the memory pools
9363 0 : bool done = false;
9364 0 : unsigned i=0;
9365 :
9366 : // find the first valid IR node, call visit function, and then leave
9367 0 : while ( done == false && i < SgFunctionParameterTypeList::pools.size() )
9368 : {
9369 : // objectArray[i] is a single memory pool
9370 : unsigned j=0;
9371 0 : while (done == false && j < SgFunctionParameterTypeList::pool_size)
9372 : {
9373 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
9374 : {
9375 0 : traversal.visit(&(objectArray[i][j]));
9376 0 : done = true;
9377 : }
9378 0 : j++;
9379 : }
9380 0 : i++;
9381 : }
9382 :
9383 : #if 0
9384 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
9385 : if (done == false)
9386 : {
9387 : printf ("No representative for SgFunctionParameterTypeList found in memory pools \n");
9388 : }
9389 : #endif
9390 : }
9391 0 : }
9392 :
9393 :
9394 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
9395 : // using values that overflow signed values of int.
9396 : size_t
9397 4 : SgFunctionParameterTypeList::numberOfNodes()
9398 : {
9399 : // This function traverses the memory pool for an IR node and
9400 : // counts the number of IR nodes of a particular Sage III IR
9401 : // nodes type.
9402 :
9403 4 : size_t count = 0;
9404 4 : if (SgFunctionParameterTypeList::pools.empty() == false)
9405 : {
9406 : // Generate an array of memory pools (this is actually a STL vector,
9407 : // but it is contiguious, so OK to treat this way).
9408 4 : SgFunctionParameterTypeList** objectArray = (SgFunctionParameterTypeList**) &(SgFunctionParameterTypeList::pools[0]);
9409 :
9410 : // Build a local variable for better performance (make it a loop invariant variable).
9411 4 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
9412 :
9413 : // Iterate over all of the memory pools for this IR node.
9414 11 : for (unsigned int i=0; i < SgFunctionParameterTypeList::pools.size(); i++)
9415 : {
9416 : // objectArray[i] is a single memory pool, iterate over all the
9417 : // IR nodes and only count those that are valid IR nodes used in
9418 : // the AST (i.e. allocated IR nodes).
9419 14007 : for (unsigned j=0; j < SgFunctionParameterTypeList::pool_size; j++)
9420 : {
9421 : // This is indexing the STL vector of C/C++ style arrays as a doubly
9422 : // indexed array access. It is OK since we have leveraged the semantics
9423 : // of STL vector memory as contigous and cast the memory as an array
9424 : // of arrays to use the 2D array indexing. Hope this is not confusing,
9425 : // but it s very fast as an implementation.
9426 14000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
9427 : {
9428 8415 : count++;
9429 : }
9430 : }
9431 : }
9432 : }
9433 :
9434 :
9435 :
9436 4 : return count;
9437 : }
9438 :
9439 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
9440 : // using values that overflow signed values of int.
9441 : size_t
9442 0 : SgFunctionParameterTypeList::memoryUsage()
9443 : {
9444 : // This function is required because we need the class name as a type when we call sizeof
9445 : // There might be another way to implement this if we have a traversal that only called a
9446 : // representative object (one call for each type of Sage IIIIR node).
9447 0 : size_t memory = numberOfNodes() * sizeof(SgFunctionParameterTypeList);
9448 :
9449 0 : return memory;
9450 : }
9451 :
9452 : /* #line 9453 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
9453 :
9454 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
9455 : void
9456 5342 : SgQualifiedName::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
9457 : {
9458 : // This function traverses the memory pool for only a specific IR node
9459 : // and calls the visit function of the input class execute a traversal
9460 : // similar to the style of the attribute based traversals within ROSE.
9461 : // This traversal will visit ALL nodes of the AST where as the other
9462 : // attribute based traversals visit only the embedded tree within the AST.
9463 :
9464 : // Initialize array to the address of the first element of the STL vector
9465 : // (which is guaranteed to be contiguous storage).
9466 : // SgQualifiedName objectArray [] = *(Memory_Block_List.begin());
9467 5342 : if (SgQualifiedName::pools.empty() == false)
9468 : {
9469 : // Generate an array of memory pools
9470 0 : SgQualifiedName** objectArray = (SgQualifiedName**) &(SgQualifiedName::pools[0]);
9471 :
9472 : // Build a local variable for better performance
9473 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
9474 : #if 0
9475 : // Iterate over the memory pools
9476 : for (unsigned int i=0; i < SgQualifiedName::pools.size(); i++)
9477 : {
9478 : // objectArray[i] is a single memory pool
9479 : for (int j=0; j < SgQualifiedName::pool_size; j++)
9480 : {
9481 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
9482 : {
9483 : traversal.visit(&(objectArray[i][j]));
9484 : }
9485 : }
9486 : }
9487 : #else
9488 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
9489 : // compute the list first and then call the visit function on each list element.
9490 :
9491 : // printf ("Inside of SgQualifiedName::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
9492 :
9493 0 : std::vector<SgQualifiedName*> nodeList;
9494 :
9495 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
9496 0 : for (unsigned int i=0; i < SgQualifiedName::pools.size(); i++)
9497 : {
9498 : // objectArray[i] is a single memory pool
9499 0 : for (unsigned j=0; j < SgQualifiedName::pool_size; j++)
9500 : {
9501 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
9502 : {
9503 0 : nodeList.push_back(&(objectArray[i][j]));
9504 : }
9505 : }
9506 : }
9507 :
9508 : // Iterate over the saved list
9509 0 : size_t nodeListSize = nodeList.size();
9510 0 : for (size_t i=0; i < nodeListSize; i++)
9511 : {
9512 0 : ROSE_ASSERT(nodeList[i] != NULL);
9513 : #if 0
9514 : traversal.visit(nodeList[i]);
9515 : #else
9516 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
9517 : {
9518 0 : traversal.visit(nodeList[i]);
9519 : }
9520 : #endif
9521 : }
9522 : #endif
9523 : }
9524 :
9525 : // This should not be required since all previously static data members are
9526 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
9527 :
9528 5342 : }
9529 :
9530 :
9531 : void
9532 194 : SgQualifiedName::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
9533 : {
9534 : // This function traverses the memory pool for an IR node and
9535 : // calls the function to execute the visitor object.
9536 :
9537 : // Initialize array to the address of the first element of the STL vector
9538 : // (which is guarenteed to be contiguous storage).
9539 : // SgQualifiedName objectArray [] = *(Memory_Block_List.begin());
9540 194 : if (SgQualifiedName::pools.empty() == false)
9541 : {
9542 : // Generate an array of memory pools
9543 0 : SgQualifiedName** objectArray = (SgQualifiedName**) &(SgQualifiedName::pools[0]);
9544 :
9545 : // Build a local variable for better performance
9546 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
9547 :
9548 : // Iterate over the memory pools
9549 0 : for (unsigned int i=0; i < SgQualifiedName::pools.size(); i++)
9550 : {
9551 : // objectArray[i] is a single memory pool
9552 0 : for (unsigned j=0; j < SgQualifiedName::pool_size; j++)
9553 : {
9554 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
9555 : {
9556 : // printf ("Found a valid SgQualifiedName object in the memory pool %d at position %d \n",i,j);
9557 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
9558 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
9559 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
9560 : }
9561 : else
9562 : {
9563 : // printf ("Found a INVALID SgQualifiedName object in the memory pool \n");
9564 : }
9565 : }
9566 : }
9567 : }
9568 :
9569 : // This should not be required since all previously static data members are
9570 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
9571 :
9572 194 : }
9573 :
9574 : void
9575 0 : SgQualifiedName::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
9576 : {
9577 : // This function visits only a single IR node of the memory pool.
9578 : // it is typically called once for each type of IR node within
9579 : // the automatically generated function: traverseRepresentativeNodes().
9580 :
9581 : // Initialize array to the address of the first element of the STL vector
9582 : // (which is guarenteed to be contiguous storage).
9583 : // SgQualifiedName objectArray [] = *(Memory_Block_List.begin());
9584 0 : if (SgQualifiedName::pools.empty() == false)
9585 : {
9586 : // Generate an array of memory pools
9587 0 : SgQualifiedName** objectArray = (SgQualifiedName**) &(SgQualifiedName::pools[0]);
9588 :
9589 : // Build a local variable for better performance
9590 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
9591 :
9592 : // Iterate over the memory pools
9593 0 : bool done = false;
9594 0 : unsigned i=0;
9595 :
9596 : // find the first valid IR node, call visit function, and then leave
9597 0 : while ( done == false && i < SgQualifiedName::pools.size() )
9598 : {
9599 : // objectArray[i] is a single memory pool
9600 : unsigned j=0;
9601 0 : while (done == false && j < SgQualifiedName::pool_size)
9602 : {
9603 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
9604 : {
9605 0 : traversal.visit(&(objectArray[i][j]));
9606 0 : done = true;
9607 : }
9608 0 : j++;
9609 : }
9610 0 : i++;
9611 : }
9612 :
9613 : #if 0
9614 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
9615 : if (done == false)
9616 : {
9617 : printf ("No representative for SgQualifiedName found in memory pools \n");
9618 : }
9619 : #endif
9620 : }
9621 0 : }
9622 :
9623 :
9624 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
9625 : // using values that overflow signed values of int.
9626 : size_t
9627 4 : SgQualifiedName::numberOfNodes()
9628 : {
9629 : // This function traverses the memory pool for an IR node and
9630 : // counts the number of IR nodes of a particular Sage III IR
9631 : // nodes type.
9632 :
9633 4 : size_t count = 0;
9634 4 : if (SgQualifiedName::pools.empty() == false)
9635 : {
9636 : // Generate an array of memory pools (this is actually a STL vector,
9637 : // but it is contiguious, so OK to treat this way).
9638 0 : SgQualifiedName** objectArray = (SgQualifiedName**) &(SgQualifiedName::pools[0]);
9639 :
9640 : // Build a local variable for better performance (make it a loop invariant variable).
9641 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
9642 :
9643 : // Iterate over all of the memory pools for this IR node.
9644 0 : for (unsigned int i=0; i < SgQualifiedName::pools.size(); i++)
9645 : {
9646 : // objectArray[i] is a single memory pool, iterate over all the
9647 : // IR nodes and only count those that are valid IR nodes used in
9648 : // the AST (i.e. allocated IR nodes).
9649 0 : for (unsigned j=0; j < SgQualifiedName::pool_size; j++)
9650 : {
9651 : // This is indexing the STL vector of C/C++ style arrays as a doubly
9652 : // indexed array access. It is OK since we have leveraged the semantics
9653 : // of STL vector memory as contigous and cast the memory as an array
9654 : // of arrays to use the 2D array indexing. Hope this is not confusing,
9655 : // but it s very fast as an implementation.
9656 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
9657 : {
9658 0 : count++;
9659 : }
9660 : }
9661 : }
9662 : }
9663 :
9664 :
9665 :
9666 4 : return count;
9667 : }
9668 :
9669 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
9670 : // using values that overflow signed values of int.
9671 : size_t
9672 0 : SgQualifiedName::memoryUsage()
9673 : {
9674 : // This function is required because we need the class name as a type when we call sizeof
9675 : // There might be another way to implement this if we have a traversal that only called a
9676 : // representative object (one call for each type of Sage IIIIR node).
9677 0 : size_t memory = numberOfNodes() * sizeof(SgQualifiedName);
9678 :
9679 0 : return memory;
9680 : }
9681 :
9682 : /* #line 9683 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
9683 :
9684 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
9685 : void
9686 5342 : SgTemplateArgumentList::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
9687 : {
9688 : // This function traverses the memory pool for only a specific IR node
9689 : // and calls the visit function of the input class execute a traversal
9690 : // similar to the style of the attribute based traversals within ROSE.
9691 : // This traversal will visit ALL nodes of the AST where as the other
9692 : // attribute based traversals visit only the embedded tree within the AST.
9693 :
9694 : // Initialize array to the address of the first element of the STL vector
9695 : // (which is guaranteed to be contiguous storage).
9696 : // SgTemplateArgumentList objectArray [] = *(Memory_Block_List.begin());
9697 5342 : if (SgTemplateArgumentList::pools.empty() == false)
9698 : {
9699 : // Generate an array of memory pools
9700 0 : SgTemplateArgumentList** objectArray = (SgTemplateArgumentList**) &(SgTemplateArgumentList::pools[0]);
9701 :
9702 : // Build a local variable for better performance
9703 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
9704 : #if 0
9705 : // Iterate over the memory pools
9706 : for (unsigned int i=0; i < SgTemplateArgumentList::pools.size(); i++)
9707 : {
9708 : // objectArray[i] is a single memory pool
9709 : for (int j=0; j < SgTemplateArgumentList::pool_size; j++)
9710 : {
9711 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
9712 : {
9713 : traversal.visit(&(objectArray[i][j]));
9714 : }
9715 : }
9716 : }
9717 : #else
9718 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
9719 : // compute the list first and then call the visit function on each list element.
9720 :
9721 : // printf ("Inside of SgTemplateArgumentList::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
9722 :
9723 0 : std::vector<SgTemplateArgumentList*> nodeList;
9724 :
9725 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
9726 0 : for (unsigned int i=0; i < SgTemplateArgumentList::pools.size(); i++)
9727 : {
9728 : // objectArray[i] is a single memory pool
9729 0 : for (unsigned j=0; j < SgTemplateArgumentList::pool_size; j++)
9730 : {
9731 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
9732 : {
9733 0 : nodeList.push_back(&(objectArray[i][j]));
9734 : }
9735 : }
9736 : }
9737 :
9738 : // Iterate over the saved list
9739 0 : size_t nodeListSize = nodeList.size();
9740 0 : for (size_t i=0; i < nodeListSize; i++)
9741 : {
9742 0 : ROSE_ASSERT(nodeList[i] != NULL);
9743 : #if 0
9744 : traversal.visit(nodeList[i]);
9745 : #else
9746 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
9747 : {
9748 0 : traversal.visit(nodeList[i]);
9749 : }
9750 : #endif
9751 : }
9752 : #endif
9753 : }
9754 :
9755 : // This should not be required since all previously static data members are
9756 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
9757 :
9758 5342 : }
9759 :
9760 :
9761 : void
9762 194 : SgTemplateArgumentList::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
9763 : {
9764 : // This function traverses the memory pool for an IR node and
9765 : // calls the function to execute the visitor object.
9766 :
9767 : // Initialize array to the address of the first element of the STL vector
9768 : // (which is guarenteed to be contiguous storage).
9769 : // SgTemplateArgumentList objectArray [] = *(Memory_Block_List.begin());
9770 194 : if (SgTemplateArgumentList::pools.empty() == false)
9771 : {
9772 : // Generate an array of memory pools
9773 0 : SgTemplateArgumentList** objectArray = (SgTemplateArgumentList**) &(SgTemplateArgumentList::pools[0]);
9774 :
9775 : // Build a local variable for better performance
9776 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
9777 :
9778 : // Iterate over the memory pools
9779 0 : for (unsigned int i=0; i < SgTemplateArgumentList::pools.size(); i++)
9780 : {
9781 : // objectArray[i] is a single memory pool
9782 0 : for (unsigned j=0; j < SgTemplateArgumentList::pool_size; j++)
9783 : {
9784 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
9785 : {
9786 : // printf ("Found a valid SgTemplateArgumentList object in the memory pool %d at position %d \n",i,j);
9787 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
9788 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
9789 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
9790 : }
9791 : else
9792 : {
9793 : // printf ("Found a INVALID SgTemplateArgumentList object in the memory pool \n");
9794 : }
9795 : }
9796 : }
9797 : }
9798 :
9799 : // This should not be required since all previously static data members are
9800 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
9801 :
9802 194 : }
9803 :
9804 : void
9805 0 : SgTemplateArgumentList::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
9806 : {
9807 : // This function visits only a single IR node of the memory pool.
9808 : // it is typically called once for each type of IR node within
9809 : // the automatically generated function: traverseRepresentativeNodes().
9810 :
9811 : // Initialize array to the address of the first element of the STL vector
9812 : // (which is guarenteed to be contiguous storage).
9813 : // SgTemplateArgumentList objectArray [] = *(Memory_Block_List.begin());
9814 0 : if (SgTemplateArgumentList::pools.empty() == false)
9815 : {
9816 : // Generate an array of memory pools
9817 0 : SgTemplateArgumentList** objectArray = (SgTemplateArgumentList**) &(SgTemplateArgumentList::pools[0]);
9818 :
9819 : // Build a local variable for better performance
9820 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
9821 :
9822 : // Iterate over the memory pools
9823 0 : bool done = false;
9824 0 : unsigned i=0;
9825 :
9826 : // find the first valid IR node, call visit function, and then leave
9827 0 : while ( done == false && i < SgTemplateArgumentList::pools.size() )
9828 : {
9829 : // objectArray[i] is a single memory pool
9830 : unsigned j=0;
9831 0 : while (done == false && j < SgTemplateArgumentList::pool_size)
9832 : {
9833 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
9834 : {
9835 0 : traversal.visit(&(objectArray[i][j]));
9836 0 : done = true;
9837 : }
9838 0 : j++;
9839 : }
9840 0 : i++;
9841 : }
9842 :
9843 : #if 0
9844 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
9845 : if (done == false)
9846 : {
9847 : printf ("No representative for SgTemplateArgumentList found in memory pools \n");
9848 : }
9849 : #endif
9850 : }
9851 0 : }
9852 :
9853 :
9854 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
9855 : // using values that overflow signed values of int.
9856 : size_t
9857 4 : SgTemplateArgumentList::numberOfNodes()
9858 : {
9859 : // This function traverses the memory pool for an IR node and
9860 : // counts the number of IR nodes of a particular Sage III IR
9861 : // nodes type.
9862 :
9863 4 : size_t count = 0;
9864 4 : if (SgTemplateArgumentList::pools.empty() == false)
9865 : {
9866 : // Generate an array of memory pools (this is actually a STL vector,
9867 : // but it is contiguious, so OK to treat this way).
9868 0 : SgTemplateArgumentList** objectArray = (SgTemplateArgumentList**) &(SgTemplateArgumentList::pools[0]);
9869 :
9870 : // Build a local variable for better performance (make it a loop invariant variable).
9871 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
9872 :
9873 : // Iterate over all of the memory pools for this IR node.
9874 0 : for (unsigned int i=0; i < SgTemplateArgumentList::pools.size(); i++)
9875 : {
9876 : // objectArray[i] is a single memory pool, iterate over all the
9877 : // IR nodes and only count those that are valid IR nodes used in
9878 : // the AST (i.e. allocated IR nodes).
9879 0 : for (unsigned j=0; j < SgTemplateArgumentList::pool_size; j++)
9880 : {
9881 : // This is indexing the STL vector of C/C++ style arrays as a doubly
9882 : // indexed array access. It is OK since we have leveraged the semantics
9883 : // of STL vector memory as contigous and cast the memory as an array
9884 : // of arrays to use the 2D array indexing. Hope this is not confusing,
9885 : // but it s very fast as an implementation.
9886 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
9887 : {
9888 0 : count++;
9889 : }
9890 : }
9891 : }
9892 : }
9893 :
9894 :
9895 :
9896 4 : return count;
9897 : }
9898 :
9899 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
9900 : // using values that overflow signed values of int.
9901 : size_t
9902 0 : SgTemplateArgumentList::memoryUsage()
9903 : {
9904 : // This function is required because we need the class name as a type when we call sizeof
9905 : // There might be another way to implement this if we have a traversal that only called a
9906 : // representative object (one call for each type of Sage IIIIR node).
9907 0 : size_t memory = numberOfNodes() * sizeof(SgTemplateArgumentList);
9908 :
9909 0 : return memory;
9910 : }
9911 :
9912 : /* #line 9913 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
9913 :
9914 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
9915 : void
9916 5342 : SgTemplateParameterList::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
9917 : {
9918 : // This function traverses the memory pool for only a specific IR node
9919 : // and calls the visit function of the input class execute a traversal
9920 : // similar to the style of the attribute based traversals within ROSE.
9921 : // This traversal will visit ALL nodes of the AST where as the other
9922 : // attribute based traversals visit only the embedded tree within the AST.
9923 :
9924 : // Initialize array to the address of the first element of the STL vector
9925 : // (which is guaranteed to be contiguous storage).
9926 : // SgTemplateParameterList objectArray [] = *(Memory_Block_List.begin());
9927 5342 : if (SgTemplateParameterList::pools.empty() == false)
9928 : {
9929 : // Generate an array of memory pools
9930 0 : SgTemplateParameterList** objectArray = (SgTemplateParameterList**) &(SgTemplateParameterList::pools[0]);
9931 :
9932 : // Build a local variable for better performance
9933 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
9934 : #if 0
9935 : // Iterate over the memory pools
9936 : for (unsigned int i=0; i < SgTemplateParameterList::pools.size(); i++)
9937 : {
9938 : // objectArray[i] is a single memory pool
9939 : for (int j=0; j < SgTemplateParameterList::pool_size; j++)
9940 : {
9941 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
9942 : {
9943 : traversal.visit(&(objectArray[i][j]));
9944 : }
9945 : }
9946 : }
9947 : #else
9948 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
9949 : // compute the list first and then call the visit function on each list element.
9950 :
9951 : // printf ("Inside of SgTemplateParameterList::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
9952 :
9953 0 : std::vector<SgTemplateParameterList*> nodeList;
9954 :
9955 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
9956 0 : for (unsigned int i=0; i < SgTemplateParameterList::pools.size(); i++)
9957 : {
9958 : // objectArray[i] is a single memory pool
9959 0 : for (unsigned j=0; j < SgTemplateParameterList::pool_size; j++)
9960 : {
9961 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
9962 : {
9963 0 : nodeList.push_back(&(objectArray[i][j]));
9964 : }
9965 : }
9966 : }
9967 :
9968 : // Iterate over the saved list
9969 0 : size_t nodeListSize = nodeList.size();
9970 0 : for (size_t i=0; i < nodeListSize; i++)
9971 : {
9972 0 : ROSE_ASSERT(nodeList[i] != NULL);
9973 : #if 0
9974 : traversal.visit(nodeList[i]);
9975 : #else
9976 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
9977 : {
9978 0 : traversal.visit(nodeList[i]);
9979 : }
9980 : #endif
9981 : }
9982 : #endif
9983 : }
9984 :
9985 : // This should not be required since all previously static data members are
9986 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
9987 :
9988 5342 : }
9989 :
9990 :
9991 : void
9992 194 : SgTemplateParameterList::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
9993 : {
9994 : // This function traverses the memory pool for an IR node and
9995 : // calls the function to execute the visitor object.
9996 :
9997 : // Initialize array to the address of the first element of the STL vector
9998 : // (which is guarenteed to be contiguous storage).
9999 : // SgTemplateParameterList objectArray [] = *(Memory_Block_List.begin());
10000 194 : if (SgTemplateParameterList::pools.empty() == false)
10001 : {
10002 : // Generate an array of memory pools
10003 0 : SgTemplateParameterList** objectArray = (SgTemplateParameterList**) &(SgTemplateParameterList::pools[0]);
10004 :
10005 : // Build a local variable for better performance
10006 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
10007 :
10008 : // Iterate over the memory pools
10009 0 : for (unsigned int i=0; i < SgTemplateParameterList::pools.size(); i++)
10010 : {
10011 : // objectArray[i] is a single memory pool
10012 0 : for (unsigned j=0; j < SgTemplateParameterList::pool_size; j++)
10013 : {
10014 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
10015 : {
10016 : // printf ("Found a valid SgTemplateParameterList object in the memory pool %d at position %d \n",i,j);
10017 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
10018 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
10019 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
10020 : }
10021 : else
10022 : {
10023 : // printf ("Found a INVALID SgTemplateParameterList object in the memory pool \n");
10024 : }
10025 : }
10026 : }
10027 : }
10028 :
10029 : // This should not be required since all previously static data members are
10030 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
10031 :
10032 194 : }
10033 :
10034 : void
10035 0 : SgTemplateParameterList::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
10036 : {
10037 : // This function visits only a single IR node of the memory pool.
10038 : // it is typically called once for each type of IR node within
10039 : // the automatically generated function: traverseRepresentativeNodes().
10040 :
10041 : // Initialize array to the address of the first element of the STL vector
10042 : // (which is guarenteed to be contiguous storage).
10043 : // SgTemplateParameterList objectArray [] = *(Memory_Block_List.begin());
10044 0 : if (SgTemplateParameterList::pools.empty() == false)
10045 : {
10046 : // Generate an array of memory pools
10047 0 : SgTemplateParameterList** objectArray = (SgTemplateParameterList**) &(SgTemplateParameterList::pools[0]);
10048 :
10049 : // Build a local variable for better performance
10050 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
10051 :
10052 : // Iterate over the memory pools
10053 0 : bool done = false;
10054 0 : unsigned i=0;
10055 :
10056 : // find the first valid IR node, call visit function, and then leave
10057 0 : while ( done == false && i < SgTemplateParameterList::pools.size() )
10058 : {
10059 : // objectArray[i] is a single memory pool
10060 : unsigned j=0;
10061 0 : while (done == false && j < SgTemplateParameterList::pool_size)
10062 : {
10063 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
10064 : {
10065 0 : traversal.visit(&(objectArray[i][j]));
10066 0 : done = true;
10067 : }
10068 0 : j++;
10069 : }
10070 0 : i++;
10071 : }
10072 :
10073 : #if 0
10074 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
10075 : if (done == false)
10076 : {
10077 : printf ("No representative for SgTemplateParameterList found in memory pools \n");
10078 : }
10079 : #endif
10080 : }
10081 0 : }
10082 :
10083 :
10084 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
10085 : // using values that overflow signed values of int.
10086 : size_t
10087 4 : SgTemplateParameterList::numberOfNodes()
10088 : {
10089 : // This function traverses the memory pool for an IR node and
10090 : // counts the number of IR nodes of a particular Sage III IR
10091 : // nodes type.
10092 :
10093 4 : size_t count = 0;
10094 4 : if (SgTemplateParameterList::pools.empty() == false)
10095 : {
10096 : // Generate an array of memory pools (this is actually a STL vector,
10097 : // but it is contiguious, so OK to treat this way).
10098 0 : SgTemplateParameterList** objectArray = (SgTemplateParameterList**) &(SgTemplateParameterList::pools[0]);
10099 :
10100 : // Build a local variable for better performance (make it a loop invariant variable).
10101 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
10102 :
10103 : // Iterate over all of the memory pools for this IR node.
10104 0 : for (unsigned int i=0; i < SgTemplateParameterList::pools.size(); i++)
10105 : {
10106 : // objectArray[i] is a single memory pool, iterate over all the
10107 : // IR nodes and only count those that are valid IR nodes used in
10108 : // the AST (i.e. allocated IR nodes).
10109 0 : for (unsigned j=0; j < SgTemplateParameterList::pool_size; j++)
10110 : {
10111 : // This is indexing the STL vector of C/C++ style arrays as a doubly
10112 : // indexed array access. It is OK since we have leveraged the semantics
10113 : // of STL vector memory as contigous and cast the memory as an array
10114 : // of arrays to use the 2D array indexing. Hope this is not confusing,
10115 : // but it s very fast as an implementation.
10116 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
10117 : {
10118 0 : count++;
10119 : }
10120 : }
10121 : }
10122 : }
10123 :
10124 :
10125 :
10126 4 : return count;
10127 : }
10128 :
10129 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
10130 : // using values that overflow signed values of int.
10131 : size_t
10132 0 : SgTemplateParameterList::memoryUsage()
10133 : {
10134 : // This function is required because we need the class name as a type when we call sizeof
10135 : // There might be another way to implement this if we have a traversal that only called a
10136 : // representative object (one call for each type of Sage IIIIR node).
10137 0 : size_t memory = numberOfNodes() * sizeof(SgTemplateParameterList);
10138 :
10139 0 : return memory;
10140 : }
10141 :
10142 : /* #line 10143 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
10143 :
10144 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
10145 : void
10146 5342 : SgGraph::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
10147 : {
10148 : // This function traverses the memory pool for only a specific IR node
10149 : // and calls the visit function of the input class execute a traversal
10150 : // similar to the style of the attribute based traversals within ROSE.
10151 : // This traversal will visit ALL nodes of the AST where as the other
10152 : // attribute based traversals visit only the embedded tree within the AST.
10153 :
10154 : // Initialize array to the address of the first element of the STL vector
10155 : // (which is guaranteed to be contiguous storage).
10156 : // SgGraph objectArray [] = *(Memory_Block_List.begin());
10157 5342 : if (SgGraph::pools.empty() == false)
10158 : {
10159 : // Generate an array of memory pools
10160 0 : SgGraph** objectArray = (SgGraph**) &(SgGraph::pools[0]);
10161 :
10162 : // Build a local variable for better performance
10163 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
10164 : #if 0
10165 : // Iterate over the memory pools
10166 : for (unsigned int i=0; i < SgGraph::pools.size(); i++)
10167 : {
10168 : // objectArray[i] is a single memory pool
10169 : for (int j=0; j < SgGraph::pool_size; j++)
10170 : {
10171 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
10172 : {
10173 : traversal.visit(&(objectArray[i][j]));
10174 : }
10175 : }
10176 : }
10177 : #else
10178 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
10179 : // compute the list first and then call the visit function on each list element.
10180 :
10181 : // printf ("Inside of SgGraph::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
10182 :
10183 0 : std::vector<SgGraph*> nodeList;
10184 :
10185 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
10186 0 : for (unsigned int i=0; i < SgGraph::pools.size(); i++)
10187 : {
10188 : // objectArray[i] is a single memory pool
10189 0 : for (unsigned j=0; j < SgGraph::pool_size; j++)
10190 : {
10191 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
10192 : {
10193 0 : nodeList.push_back(&(objectArray[i][j]));
10194 : }
10195 : }
10196 : }
10197 :
10198 : // Iterate over the saved list
10199 0 : size_t nodeListSize = nodeList.size();
10200 0 : for (size_t i=0; i < nodeListSize; i++)
10201 : {
10202 0 : ROSE_ASSERT(nodeList[i] != NULL);
10203 : #if 0
10204 : traversal.visit(nodeList[i]);
10205 : #else
10206 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
10207 : {
10208 0 : traversal.visit(nodeList[i]);
10209 : }
10210 : #endif
10211 : }
10212 : #endif
10213 : }
10214 :
10215 : // This should not be required since all previously static data members are
10216 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
10217 :
10218 5342 : }
10219 :
10220 :
10221 : void
10222 194 : SgGraph::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
10223 : {
10224 : // This function traverses the memory pool for an IR node and
10225 : // calls the function to execute the visitor object.
10226 :
10227 : // Initialize array to the address of the first element of the STL vector
10228 : // (which is guarenteed to be contiguous storage).
10229 : // SgGraph objectArray [] = *(Memory_Block_List.begin());
10230 194 : if (SgGraph::pools.empty() == false)
10231 : {
10232 : // Generate an array of memory pools
10233 0 : SgGraph** objectArray = (SgGraph**) &(SgGraph::pools[0]);
10234 :
10235 : // Build a local variable for better performance
10236 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
10237 :
10238 : // Iterate over the memory pools
10239 0 : for (unsigned int i=0; i < SgGraph::pools.size(); i++)
10240 : {
10241 : // objectArray[i] is a single memory pool
10242 0 : for (unsigned j=0; j < SgGraph::pool_size; j++)
10243 : {
10244 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
10245 : {
10246 : // printf ("Found a valid SgGraph object in the memory pool %d at position %d \n",i,j);
10247 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
10248 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
10249 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
10250 : }
10251 : else
10252 : {
10253 : // printf ("Found a INVALID SgGraph object in the memory pool \n");
10254 : }
10255 : }
10256 : }
10257 : }
10258 :
10259 : // This should not be required since all previously static data members are
10260 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
10261 :
10262 194 : }
10263 :
10264 : void
10265 0 : SgGraph::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
10266 : {
10267 : // This function visits only a single IR node of the memory pool.
10268 : // it is typically called once for each type of IR node within
10269 : // the automatically generated function: traverseRepresentativeNodes().
10270 :
10271 : // Initialize array to the address of the first element of the STL vector
10272 : // (which is guarenteed to be contiguous storage).
10273 : // SgGraph objectArray [] = *(Memory_Block_List.begin());
10274 0 : if (SgGraph::pools.empty() == false)
10275 : {
10276 : // Generate an array of memory pools
10277 0 : SgGraph** objectArray = (SgGraph**) &(SgGraph::pools[0]);
10278 :
10279 : // Build a local variable for better performance
10280 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
10281 :
10282 : // Iterate over the memory pools
10283 0 : bool done = false;
10284 0 : unsigned i=0;
10285 :
10286 : // find the first valid IR node, call visit function, and then leave
10287 0 : while ( done == false && i < SgGraph::pools.size() )
10288 : {
10289 : // objectArray[i] is a single memory pool
10290 : unsigned j=0;
10291 0 : while (done == false && j < SgGraph::pool_size)
10292 : {
10293 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
10294 : {
10295 0 : traversal.visit(&(objectArray[i][j]));
10296 0 : done = true;
10297 : }
10298 0 : j++;
10299 : }
10300 0 : i++;
10301 : }
10302 :
10303 : #if 0
10304 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
10305 : if (done == false)
10306 : {
10307 : printf ("No representative for SgGraph found in memory pools \n");
10308 : }
10309 : #endif
10310 : }
10311 0 : }
10312 :
10313 :
10314 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
10315 : // using values that overflow signed values of int.
10316 : size_t
10317 4 : SgGraph::numberOfNodes()
10318 : {
10319 : // This function traverses the memory pool for an IR node and
10320 : // counts the number of IR nodes of a particular Sage III IR
10321 : // nodes type.
10322 :
10323 4 : size_t count = 0;
10324 4 : if (SgGraph::pools.empty() == false)
10325 : {
10326 : // Generate an array of memory pools (this is actually a STL vector,
10327 : // but it is contiguious, so OK to treat this way).
10328 0 : SgGraph** objectArray = (SgGraph**) &(SgGraph::pools[0]);
10329 :
10330 : // Build a local variable for better performance (make it a loop invariant variable).
10331 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
10332 :
10333 : // Iterate over all of the memory pools for this IR node.
10334 0 : for (unsigned int i=0; i < SgGraph::pools.size(); i++)
10335 : {
10336 : // objectArray[i] is a single memory pool, iterate over all the
10337 : // IR nodes and only count those that are valid IR nodes used in
10338 : // the AST (i.e. allocated IR nodes).
10339 0 : for (unsigned j=0; j < SgGraph::pool_size; j++)
10340 : {
10341 : // This is indexing the STL vector of C/C++ style arrays as a doubly
10342 : // indexed array access. It is OK since we have leveraged the semantics
10343 : // of STL vector memory as contigous and cast the memory as an array
10344 : // of arrays to use the 2D array indexing. Hope this is not confusing,
10345 : // but it s very fast as an implementation.
10346 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
10347 : {
10348 0 : count++;
10349 : }
10350 : }
10351 : }
10352 : }
10353 :
10354 :
10355 :
10356 4 : return count;
10357 : }
10358 :
10359 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
10360 : // using values that overflow signed values of int.
10361 : size_t
10362 0 : SgGraph::memoryUsage()
10363 : {
10364 : // This function is required because we need the class name as a type when we call sizeof
10365 : // There might be another way to implement this if we have a traversal that only called a
10366 : // representative object (one call for each type of Sage IIIIR node).
10367 0 : size_t memory = numberOfNodes() * sizeof(SgGraph);
10368 :
10369 0 : return memory;
10370 : }
10371 :
10372 : /* #line 10373 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
10373 :
10374 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
10375 : void
10376 5342 : SgIncidenceDirectedGraph::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
10377 : {
10378 : // This function traverses the memory pool for only a specific IR node
10379 : // and calls the visit function of the input class execute a traversal
10380 : // similar to the style of the attribute based traversals within ROSE.
10381 : // This traversal will visit ALL nodes of the AST where as the other
10382 : // attribute based traversals visit only the embedded tree within the AST.
10383 :
10384 : // Initialize array to the address of the first element of the STL vector
10385 : // (which is guaranteed to be contiguous storage).
10386 : // SgIncidenceDirectedGraph objectArray [] = *(Memory_Block_List.begin());
10387 5342 : if (SgIncidenceDirectedGraph::pools.empty() == false)
10388 : {
10389 : // Generate an array of memory pools
10390 0 : SgIncidenceDirectedGraph** objectArray = (SgIncidenceDirectedGraph**) &(SgIncidenceDirectedGraph::pools[0]);
10391 :
10392 : // Build a local variable for better performance
10393 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
10394 : #if 0
10395 : // Iterate over the memory pools
10396 : for (unsigned int i=0; i < SgIncidenceDirectedGraph::pools.size(); i++)
10397 : {
10398 : // objectArray[i] is a single memory pool
10399 : for (int j=0; j < SgIncidenceDirectedGraph::pool_size; j++)
10400 : {
10401 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
10402 : {
10403 : traversal.visit(&(objectArray[i][j]));
10404 : }
10405 : }
10406 : }
10407 : #else
10408 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
10409 : // compute the list first and then call the visit function on each list element.
10410 :
10411 : // printf ("Inside of SgIncidenceDirectedGraph::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
10412 :
10413 0 : std::vector<SgIncidenceDirectedGraph*> nodeList;
10414 :
10415 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
10416 0 : for (unsigned int i=0; i < SgIncidenceDirectedGraph::pools.size(); i++)
10417 : {
10418 : // objectArray[i] is a single memory pool
10419 0 : for (unsigned j=0; j < SgIncidenceDirectedGraph::pool_size; j++)
10420 : {
10421 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
10422 : {
10423 0 : nodeList.push_back(&(objectArray[i][j]));
10424 : }
10425 : }
10426 : }
10427 :
10428 : // Iterate over the saved list
10429 0 : size_t nodeListSize = nodeList.size();
10430 0 : for (size_t i=0; i < nodeListSize; i++)
10431 : {
10432 0 : ROSE_ASSERT(nodeList[i] != NULL);
10433 : #if 0
10434 : traversal.visit(nodeList[i]);
10435 : #else
10436 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
10437 : {
10438 0 : traversal.visit(nodeList[i]);
10439 : }
10440 : #endif
10441 : }
10442 : #endif
10443 : }
10444 :
10445 : // This should not be required since all previously static data members are
10446 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
10447 :
10448 5342 : }
10449 :
10450 :
10451 : void
10452 194 : SgIncidenceDirectedGraph::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
10453 : {
10454 : // This function traverses the memory pool for an IR node and
10455 : // calls the function to execute the visitor object.
10456 :
10457 : // Initialize array to the address of the first element of the STL vector
10458 : // (which is guarenteed to be contiguous storage).
10459 : // SgIncidenceDirectedGraph objectArray [] = *(Memory_Block_List.begin());
10460 194 : if (SgIncidenceDirectedGraph::pools.empty() == false)
10461 : {
10462 : // Generate an array of memory pools
10463 0 : SgIncidenceDirectedGraph** objectArray = (SgIncidenceDirectedGraph**) &(SgIncidenceDirectedGraph::pools[0]);
10464 :
10465 : // Build a local variable for better performance
10466 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
10467 :
10468 : // Iterate over the memory pools
10469 0 : for (unsigned int i=0; i < SgIncidenceDirectedGraph::pools.size(); i++)
10470 : {
10471 : // objectArray[i] is a single memory pool
10472 0 : for (unsigned j=0; j < SgIncidenceDirectedGraph::pool_size; j++)
10473 : {
10474 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
10475 : {
10476 : // printf ("Found a valid SgIncidenceDirectedGraph object in the memory pool %d at position %d \n",i,j);
10477 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
10478 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
10479 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
10480 : }
10481 : else
10482 : {
10483 : // printf ("Found a INVALID SgIncidenceDirectedGraph object in the memory pool \n");
10484 : }
10485 : }
10486 : }
10487 : }
10488 :
10489 : // This should not be required since all previously static data members are
10490 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
10491 :
10492 194 : }
10493 :
10494 : void
10495 0 : SgIncidenceDirectedGraph::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
10496 : {
10497 : // This function visits only a single IR node of the memory pool.
10498 : // it is typically called once for each type of IR node within
10499 : // the automatically generated function: traverseRepresentativeNodes().
10500 :
10501 : // Initialize array to the address of the first element of the STL vector
10502 : // (which is guarenteed to be contiguous storage).
10503 : // SgIncidenceDirectedGraph objectArray [] = *(Memory_Block_List.begin());
10504 0 : if (SgIncidenceDirectedGraph::pools.empty() == false)
10505 : {
10506 : // Generate an array of memory pools
10507 0 : SgIncidenceDirectedGraph** objectArray = (SgIncidenceDirectedGraph**) &(SgIncidenceDirectedGraph::pools[0]);
10508 :
10509 : // Build a local variable for better performance
10510 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
10511 :
10512 : // Iterate over the memory pools
10513 0 : bool done = false;
10514 0 : unsigned i=0;
10515 :
10516 : // find the first valid IR node, call visit function, and then leave
10517 0 : while ( done == false && i < SgIncidenceDirectedGraph::pools.size() )
10518 : {
10519 : // objectArray[i] is a single memory pool
10520 : unsigned j=0;
10521 0 : while (done == false && j < SgIncidenceDirectedGraph::pool_size)
10522 : {
10523 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
10524 : {
10525 0 : traversal.visit(&(objectArray[i][j]));
10526 0 : done = true;
10527 : }
10528 0 : j++;
10529 : }
10530 0 : i++;
10531 : }
10532 :
10533 : #if 0
10534 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
10535 : if (done == false)
10536 : {
10537 : printf ("No representative for SgIncidenceDirectedGraph found in memory pools \n");
10538 : }
10539 : #endif
10540 : }
10541 0 : }
10542 :
10543 :
10544 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
10545 : // using values that overflow signed values of int.
10546 : size_t
10547 4 : SgIncidenceDirectedGraph::numberOfNodes()
10548 : {
10549 : // This function traverses the memory pool for an IR node and
10550 : // counts the number of IR nodes of a particular Sage III IR
10551 : // nodes type.
10552 :
10553 4 : size_t count = 0;
10554 4 : if (SgIncidenceDirectedGraph::pools.empty() == false)
10555 : {
10556 : // Generate an array of memory pools (this is actually a STL vector,
10557 : // but it is contiguious, so OK to treat this way).
10558 0 : SgIncidenceDirectedGraph** objectArray = (SgIncidenceDirectedGraph**) &(SgIncidenceDirectedGraph::pools[0]);
10559 :
10560 : // Build a local variable for better performance (make it a loop invariant variable).
10561 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
10562 :
10563 : // Iterate over all of the memory pools for this IR node.
10564 0 : for (unsigned int i=0; i < SgIncidenceDirectedGraph::pools.size(); i++)
10565 : {
10566 : // objectArray[i] is a single memory pool, iterate over all the
10567 : // IR nodes and only count those that are valid IR nodes used in
10568 : // the AST (i.e. allocated IR nodes).
10569 0 : for (unsigned j=0; j < SgIncidenceDirectedGraph::pool_size; j++)
10570 : {
10571 : // This is indexing the STL vector of C/C++ style arrays as a doubly
10572 : // indexed array access. It is OK since we have leveraged the semantics
10573 : // of STL vector memory as contigous and cast the memory as an array
10574 : // of arrays to use the 2D array indexing. Hope this is not confusing,
10575 : // but it s very fast as an implementation.
10576 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
10577 : {
10578 0 : count++;
10579 : }
10580 : }
10581 : }
10582 : }
10583 :
10584 :
10585 :
10586 4 : return count;
10587 : }
10588 :
10589 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
10590 : // using values that overflow signed values of int.
10591 : size_t
10592 0 : SgIncidenceDirectedGraph::memoryUsage()
10593 : {
10594 : // This function is required because we need the class name as a type when we call sizeof
10595 : // There might be another way to implement this if we have a traversal that only called a
10596 : // representative object (one call for each type of Sage IIIIR node).
10597 0 : size_t memory = numberOfNodes() * sizeof(SgIncidenceDirectedGraph);
10598 :
10599 0 : return memory;
10600 : }
10601 :
10602 : /* #line 10603 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
10603 :
10604 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
10605 : void
10606 5342 : SgBidirectionalGraph::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
10607 : {
10608 : // This function traverses the memory pool for only a specific IR node
10609 : // and calls the visit function of the input class execute a traversal
10610 : // similar to the style of the attribute based traversals within ROSE.
10611 : // This traversal will visit ALL nodes of the AST where as the other
10612 : // attribute based traversals visit only the embedded tree within the AST.
10613 :
10614 : // Initialize array to the address of the first element of the STL vector
10615 : // (which is guaranteed to be contiguous storage).
10616 : // SgBidirectionalGraph objectArray [] = *(Memory_Block_List.begin());
10617 5342 : if (SgBidirectionalGraph::pools.empty() == false)
10618 : {
10619 : // Generate an array of memory pools
10620 0 : SgBidirectionalGraph** objectArray = (SgBidirectionalGraph**) &(SgBidirectionalGraph::pools[0]);
10621 :
10622 : // Build a local variable for better performance
10623 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
10624 : #if 0
10625 : // Iterate over the memory pools
10626 : for (unsigned int i=0; i < SgBidirectionalGraph::pools.size(); i++)
10627 : {
10628 : // objectArray[i] is a single memory pool
10629 : for (int j=0; j < SgBidirectionalGraph::pool_size; j++)
10630 : {
10631 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
10632 : {
10633 : traversal.visit(&(objectArray[i][j]));
10634 : }
10635 : }
10636 : }
10637 : #else
10638 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
10639 : // compute the list first and then call the visit function on each list element.
10640 :
10641 : // printf ("Inside of SgBidirectionalGraph::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
10642 :
10643 0 : std::vector<SgBidirectionalGraph*> nodeList;
10644 :
10645 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
10646 0 : for (unsigned int i=0; i < SgBidirectionalGraph::pools.size(); i++)
10647 : {
10648 : // objectArray[i] is a single memory pool
10649 0 : for (unsigned j=0; j < SgBidirectionalGraph::pool_size; j++)
10650 : {
10651 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
10652 : {
10653 0 : nodeList.push_back(&(objectArray[i][j]));
10654 : }
10655 : }
10656 : }
10657 :
10658 : // Iterate over the saved list
10659 0 : size_t nodeListSize = nodeList.size();
10660 0 : for (size_t i=0; i < nodeListSize; i++)
10661 : {
10662 0 : ROSE_ASSERT(nodeList[i] != NULL);
10663 : #if 0
10664 : traversal.visit(nodeList[i]);
10665 : #else
10666 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
10667 : {
10668 0 : traversal.visit(nodeList[i]);
10669 : }
10670 : #endif
10671 : }
10672 : #endif
10673 : }
10674 :
10675 : // This should not be required since all previously static data members are
10676 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
10677 :
10678 5342 : }
10679 :
10680 :
10681 : void
10682 194 : SgBidirectionalGraph::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
10683 : {
10684 : // This function traverses the memory pool for an IR node and
10685 : // calls the function to execute the visitor object.
10686 :
10687 : // Initialize array to the address of the first element of the STL vector
10688 : // (which is guarenteed to be contiguous storage).
10689 : // SgBidirectionalGraph objectArray [] = *(Memory_Block_List.begin());
10690 194 : if (SgBidirectionalGraph::pools.empty() == false)
10691 : {
10692 : // Generate an array of memory pools
10693 0 : SgBidirectionalGraph** objectArray = (SgBidirectionalGraph**) &(SgBidirectionalGraph::pools[0]);
10694 :
10695 : // Build a local variable for better performance
10696 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
10697 :
10698 : // Iterate over the memory pools
10699 0 : for (unsigned int i=0; i < SgBidirectionalGraph::pools.size(); i++)
10700 : {
10701 : // objectArray[i] is a single memory pool
10702 0 : for (unsigned j=0; j < SgBidirectionalGraph::pool_size; j++)
10703 : {
10704 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
10705 : {
10706 : // printf ("Found a valid SgBidirectionalGraph object in the memory pool %d at position %d \n",i,j);
10707 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
10708 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
10709 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
10710 : }
10711 : else
10712 : {
10713 : // printf ("Found a INVALID SgBidirectionalGraph object in the memory pool \n");
10714 : }
10715 : }
10716 : }
10717 : }
10718 :
10719 : // This should not be required since all previously static data members are
10720 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
10721 :
10722 194 : }
10723 :
10724 : void
10725 0 : SgBidirectionalGraph::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
10726 : {
10727 : // This function visits only a single IR node of the memory pool.
10728 : // it is typically called once for each type of IR node within
10729 : // the automatically generated function: traverseRepresentativeNodes().
10730 :
10731 : // Initialize array to the address of the first element of the STL vector
10732 : // (which is guarenteed to be contiguous storage).
10733 : // SgBidirectionalGraph objectArray [] = *(Memory_Block_List.begin());
10734 0 : if (SgBidirectionalGraph::pools.empty() == false)
10735 : {
10736 : // Generate an array of memory pools
10737 0 : SgBidirectionalGraph** objectArray = (SgBidirectionalGraph**) &(SgBidirectionalGraph::pools[0]);
10738 :
10739 : // Build a local variable for better performance
10740 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
10741 :
10742 : // Iterate over the memory pools
10743 0 : bool done = false;
10744 0 : unsigned i=0;
10745 :
10746 : // find the first valid IR node, call visit function, and then leave
10747 0 : while ( done == false && i < SgBidirectionalGraph::pools.size() )
10748 : {
10749 : // objectArray[i] is a single memory pool
10750 : unsigned j=0;
10751 0 : while (done == false && j < SgBidirectionalGraph::pool_size)
10752 : {
10753 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
10754 : {
10755 0 : traversal.visit(&(objectArray[i][j]));
10756 0 : done = true;
10757 : }
10758 0 : j++;
10759 : }
10760 0 : i++;
10761 : }
10762 :
10763 : #if 0
10764 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
10765 : if (done == false)
10766 : {
10767 : printf ("No representative for SgBidirectionalGraph found in memory pools \n");
10768 : }
10769 : #endif
10770 : }
10771 0 : }
10772 :
10773 :
10774 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
10775 : // using values that overflow signed values of int.
10776 : size_t
10777 4 : SgBidirectionalGraph::numberOfNodes()
10778 : {
10779 : // This function traverses the memory pool for an IR node and
10780 : // counts the number of IR nodes of a particular Sage III IR
10781 : // nodes type.
10782 :
10783 4 : size_t count = 0;
10784 4 : if (SgBidirectionalGraph::pools.empty() == false)
10785 : {
10786 : // Generate an array of memory pools (this is actually a STL vector,
10787 : // but it is contiguious, so OK to treat this way).
10788 0 : SgBidirectionalGraph** objectArray = (SgBidirectionalGraph**) &(SgBidirectionalGraph::pools[0]);
10789 :
10790 : // Build a local variable for better performance (make it a loop invariant variable).
10791 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
10792 :
10793 : // Iterate over all of the memory pools for this IR node.
10794 0 : for (unsigned int i=0; i < SgBidirectionalGraph::pools.size(); i++)
10795 : {
10796 : // objectArray[i] is a single memory pool, iterate over all the
10797 : // IR nodes and only count those that are valid IR nodes used in
10798 : // the AST (i.e. allocated IR nodes).
10799 0 : for (unsigned j=0; j < SgBidirectionalGraph::pool_size; j++)
10800 : {
10801 : // This is indexing the STL vector of C/C++ style arrays as a doubly
10802 : // indexed array access. It is OK since we have leveraged the semantics
10803 : // of STL vector memory as contigous and cast the memory as an array
10804 : // of arrays to use the 2D array indexing. Hope this is not confusing,
10805 : // but it s very fast as an implementation.
10806 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
10807 : {
10808 0 : count++;
10809 : }
10810 : }
10811 : }
10812 : }
10813 :
10814 :
10815 :
10816 4 : return count;
10817 : }
10818 :
10819 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
10820 : // using values that overflow signed values of int.
10821 : size_t
10822 0 : SgBidirectionalGraph::memoryUsage()
10823 : {
10824 : // This function is required because we need the class name as a type when we call sizeof
10825 : // There might be another way to implement this if we have a traversal that only called a
10826 : // representative object (one call for each type of Sage IIIIR node).
10827 0 : size_t memory = numberOfNodes() * sizeof(SgBidirectionalGraph);
10828 :
10829 0 : return memory;
10830 : }
10831 :
10832 : /* #line 10833 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
10833 :
10834 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
10835 : void
10836 5342 : SgStringKeyedBidirectionalGraph::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
10837 : {
10838 : // This function traverses the memory pool for only a specific IR node
10839 : // and calls the visit function of the input class execute a traversal
10840 : // similar to the style of the attribute based traversals within ROSE.
10841 : // This traversal will visit ALL nodes of the AST where as the other
10842 : // attribute based traversals visit only the embedded tree within the AST.
10843 :
10844 : // Initialize array to the address of the first element of the STL vector
10845 : // (which is guaranteed to be contiguous storage).
10846 : // SgStringKeyedBidirectionalGraph objectArray [] = *(Memory_Block_List.begin());
10847 5342 : if (SgStringKeyedBidirectionalGraph::pools.empty() == false)
10848 : {
10849 : // Generate an array of memory pools
10850 0 : SgStringKeyedBidirectionalGraph** objectArray = (SgStringKeyedBidirectionalGraph**) &(SgStringKeyedBidirectionalGraph::pools[0]);
10851 :
10852 : // Build a local variable for better performance
10853 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
10854 : #if 0
10855 : // Iterate over the memory pools
10856 : for (unsigned int i=0; i < SgStringKeyedBidirectionalGraph::pools.size(); i++)
10857 : {
10858 : // objectArray[i] is a single memory pool
10859 : for (int j=0; j < SgStringKeyedBidirectionalGraph::pool_size; j++)
10860 : {
10861 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
10862 : {
10863 : traversal.visit(&(objectArray[i][j]));
10864 : }
10865 : }
10866 : }
10867 : #else
10868 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
10869 : // compute the list first and then call the visit function on each list element.
10870 :
10871 : // printf ("Inside of SgStringKeyedBidirectionalGraph::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
10872 :
10873 0 : std::vector<SgStringKeyedBidirectionalGraph*> nodeList;
10874 :
10875 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
10876 0 : for (unsigned int i=0; i < SgStringKeyedBidirectionalGraph::pools.size(); i++)
10877 : {
10878 : // objectArray[i] is a single memory pool
10879 0 : for (unsigned j=0; j < SgStringKeyedBidirectionalGraph::pool_size; j++)
10880 : {
10881 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
10882 : {
10883 0 : nodeList.push_back(&(objectArray[i][j]));
10884 : }
10885 : }
10886 : }
10887 :
10888 : // Iterate over the saved list
10889 0 : size_t nodeListSize = nodeList.size();
10890 0 : for (size_t i=0; i < nodeListSize; i++)
10891 : {
10892 0 : ROSE_ASSERT(nodeList[i] != NULL);
10893 : #if 0
10894 : traversal.visit(nodeList[i]);
10895 : #else
10896 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
10897 : {
10898 0 : traversal.visit(nodeList[i]);
10899 : }
10900 : #endif
10901 : }
10902 : #endif
10903 : }
10904 :
10905 : // This should not be required since all previously static data members are
10906 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
10907 :
10908 5342 : }
10909 :
10910 :
10911 : void
10912 194 : SgStringKeyedBidirectionalGraph::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
10913 : {
10914 : // This function traverses the memory pool for an IR node and
10915 : // calls the function to execute the visitor object.
10916 :
10917 : // Initialize array to the address of the first element of the STL vector
10918 : // (which is guarenteed to be contiguous storage).
10919 : // SgStringKeyedBidirectionalGraph objectArray [] = *(Memory_Block_List.begin());
10920 194 : if (SgStringKeyedBidirectionalGraph::pools.empty() == false)
10921 : {
10922 : // Generate an array of memory pools
10923 0 : SgStringKeyedBidirectionalGraph** objectArray = (SgStringKeyedBidirectionalGraph**) &(SgStringKeyedBidirectionalGraph::pools[0]);
10924 :
10925 : // Build a local variable for better performance
10926 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
10927 :
10928 : // Iterate over the memory pools
10929 0 : for (unsigned int i=0; i < SgStringKeyedBidirectionalGraph::pools.size(); i++)
10930 : {
10931 : // objectArray[i] is a single memory pool
10932 0 : for (unsigned j=0; j < SgStringKeyedBidirectionalGraph::pool_size; j++)
10933 : {
10934 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
10935 : {
10936 : // printf ("Found a valid SgStringKeyedBidirectionalGraph object in the memory pool %d at position %d \n",i,j);
10937 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
10938 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
10939 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
10940 : }
10941 : else
10942 : {
10943 : // printf ("Found a INVALID SgStringKeyedBidirectionalGraph object in the memory pool \n");
10944 : }
10945 : }
10946 : }
10947 : }
10948 :
10949 : // This should not be required since all previously static data members are
10950 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
10951 :
10952 194 : }
10953 :
10954 : void
10955 0 : SgStringKeyedBidirectionalGraph::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
10956 : {
10957 : // This function visits only a single IR node of the memory pool.
10958 : // it is typically called once for each type of IR node within
10959 : // the automatically generated function: traverseRepresentativeNodes().
10960 :
10961 : // Initialize array to the address of the first element of the STL vector
10962 : // (which is guarenteed to be contiguous storage).
10963 : // SgStringKeyedBidirectionalGraph objectArray [] = *(Memory_Block_List.begin());
10964 0 : if (SgStringKeyedBidirectionalGraph::pools.empty() == false)
10965 : {
10966 : // Generate an array of memory pools
10967 0 : SgStringKeyedBidirectionalGraph** objectArray = (SgStringKeyedBidirectionalGraph**) &(SgStringKeyedBidirectionalGraph::pools[0]);
10968 :
10969 : // Build a local variable for better performance
10970 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
10971 :
10972 : // Iterate over the memory pools
10973 0 : bool done = false;
10974 0 : unsigned i=0;
10975 :
10976 : // find the first valid IR node, call visit function, and then leave
10977 0 : while ( done == false && i < SgStringKeyedBidirectionalGraph::pools.size() )
10978 : {
10979 : // objectArray[i] is a single memory pool
10980 : unsigned j=0;
10981 0 : while (done == false && j < SgStringKeyedBidirectionalGraph::pool_size)
10982 : {
10983 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
10984 : {
10985 0 : traversal.visit(&(objectArray[i][j]));
10986 0 : done = true;
10987 : }
10988 0 : j++;
10989 : }
10990 0 : i++;
10991 : }
10992 :
10993 : #if 0
10994 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
10995 : if (done == false)
10996 : {
10997 : printf ("No representative for SgStringKeyedBidirectionalGraph found in memory pools \n");
10998 : }
10999 : #endif
11000 : }
11001 0 : }
11002 :
11003 :
11004 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
11005 : // using values that overflow signed values of int.
11006 : size_t
11007 4 : SgStringKeyedBidirectionalGraph::numberOfNodes()
11008 : {
11009 : // This function traverses the memory pool for an IR node and
11010 : // counts the number of IR nodes of a particular Sage III IR
11011 : // nodes type.
11012 :
11013 4 : size_t count = 0;
11014 4 : if (SgStringKeyedBidirectionalGraph::pools.empty() == false)
11015 : {
11016 : // Generate an array of memory pools (this is actually a STL vector,
11017 : // but it is contiguious, so OK to treat this way).
11018 0 : SgStringKeyedBidirectionalGraph** objectArray = (SgStringKeyedBidirectionalGraph**) &(SgStringKeyedBidirectionalGraph::pools[0]);
11019 :
11020 : // Build a local variable for better performance (make it a loop invariant variable).
11021 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
11022 :
11023 : // Iterate over all of the memory pools for this IR node.
11024 0 : for (unsigned int i=0; i < SgStringKeyedBidirectionalGraph::pools.size(); i++)
11025 : {
11026 : // objectArray[i] is a single memory pool, iterate over all the
11027 : // IR nodes and only count those that are valid IR nodes used in
11028 : // the AST (i.e. allocated IR nodes).
11029 0 : for (unsigned j=0; j < SgStringKeyedBidirectionalGraph::pool_size; j++)
11030 : {
11031 : // This is indexing the STL vector of C/C++ style arrays as a doubly
11032 : // indexed array access. It is OK since we have leveraged the semantics
11033 : // of STL vector memory as contigous and cast the memory as an array
11034 : // of arrays to use the 2D array indexing. Hope this is not confusing,
11035 : // but it s very fast as an implementation.
11036 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
11037 : {
11038 0 : count++;
11039 : }
11040 : }
11041 : }
11042 : }
11043 :
11044 :
11045 :
11046 4 : return count;
11047 : }
11048 :
11049 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
11050 : // using values that overflow signed values of int.
11051 : size_t
11052 0 : SgStringKeyedBidirectionalGraph::memoryUsage()
11053 : {
11054 : // This function is required because we need the class name as a type when we call sizeof
11055 : // There might be another way to implement this if we have a traversal that only called a
11056 : // representative object (one call for each type of Sage IIIIR node).
11057 0 : size_t memory = numberOfNodes() * sizeof(SgStringKeyedBidirectionalGraph);
11058 :
11059 0 : return memory;
11060 : }
11061 :
11062 : /* #line 11063 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
11063 :
11064 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
11065 : void
11066 5342 : SgIntKeyedBidirectionalGraph::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
11067 : {
11068 : // This function traverses the memory pool for only a specific IR node
11069 : // and calls the visit function of the input class execute a traversal
11070 : // similar to the style of the attribute based traversals within ROSE.
11071 : // This traversal will visit ALL nodes of the AST where as the other
11072 : // attribute based traversals visit only the embedded tree within the AST.
11073 :
11074 : // Initialize array to the address of the first element of the STL vector
11075 : // (which is guaranteed to be contiguous storage).
11076 : // SgIntKeyedBidirectionalGraph objectArray [] = *(Memory_Block_List.begin());
11077 5342 : if (SgIntKeyedBidirectionalGraph::pools.empty() == false)
11078 : {
11079 : // Generate an array of memory pools
11080 0 : SgIntKeyedBidirectionalGraph** objectArray = (SgIntKeyedBidirectionalGraph**) &(SgIntKeyedBidirectionalGraph::pools[0]);
11081 :
11082 : // Build a local variable for better performance
11083 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
11084 : #if 0
11085 : // Iterate over the memory pools
11086 : for (unsigned int i=0; i < SgIntKeyedBidirectionalGraph::pools.size(); i++)
11087 : {
11088 : // objectArray[i] is a single memory pool
11089 : for (int j=0; j < SgIntKeyedBidirectionalGraph::pool_size; j++)
11090 : {
11091 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
11092 : {
11093 : traversal.visit(&(objectArray[i][j]));
11094 : }
11095 : }
11096 : }
11097 : #else
11098 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
11099 : // compute the list first and then call the visit function on each list element.
11100 :
11101 : // printf ("Inside of SgIntKeyedBidirectionalGraph::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
11102 :
11103 0 : std::vector<SgIntKeyedBidirectionalGraph*> nodeList;
11104 :
11105 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
11106 0 : for (unsigned int i=0; i < SgIntKeyedBidirectionalGraph::pools.size(); i++)
11107 : {
11108 : // objectArray[i] is a single memory pool
11109 0 : for (unsigned j=0; j < SgIntKeyedBidirectionalGraph::pool_size; j++)
11110 : {
11111 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
11112 : {
11113 0 : nodeList.push_back(&(objectArray[i][j]));
11114 : }
11115 : }
11116 : }
11117 :
11118 : // Iterate over the saved list
11119 0 : size_t nodeListSize = nodeList.size();
11120 0 : for (size_t i=0; i < nodeListSize; i++)
11121 : {
11122 0 : ROSE_ASSERT(nodeList[i] != NULL);
11123 : #if 0
11124 : traversal.visit(nodeList[i]);
11125 : #else
11126 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
11127 : {
11128 0 : traversal.visit(nodeList[i]);
11129 : }
11130 : #endif
11131 : }
11132 : #endif
11133 : }
11134 :
11135 : // This should not be required since all previously static data members are
11136 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
11137 :
11138 5342 : }
11139 :
11140 :
11141 : void
11142 194 : SgIntKeyedBidirectionalGraph::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
11143 : {
11144 : // This function traverses the memory pool for an IR node and
11145 : // calls the function to execute the visitor object.
11146 :
11147 : // Initialize array to the address of the first element of the STL vector
11148 : // (which is guarenteed to be contiguous storage).
11149 : // SgIntKeyedBidirectionalGraph objectArray [] = *(Memory_Block_List.begin());
11150 194 : if (SgIntKeyedBidirectionalGraph::pools.empty() == false)
11151 : {
11152 : // Generate an array of memory pools
11153 0 : SgIntKeyedBidirectionalGraph** objectArray = (SgIntKeyedBidirectionalGraph**) &(SgIntKeyedBidirectionalGraph::pools[0]);
11154 :
11155 : // Build a local variable for better performance
11156 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
11157 :
11158 : // Iterate over the memory pools
11159 0 : for (unsigned int i=0; i < SgIntKeyedBidirectionalGraph::pools.size(); i++)
11160 : {
11161 : // objectArray[i] is a single memory pool
11162 0 : for (unsigned j=0; j < SgIntKeyedBidirectionalGraph::pool_size; j++)
11163 : {
11164 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
11165 : {
11166 : // printf ("Found a valid SgIntKeyedBidirectionalGraph object in the memory pool %d at position %d \n",i,j);
11167 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
11168 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
11169 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
11170 : }
11171 : else
11172 : {
11173 : // printf ("Found a INVALID SgIntKeyedBidirectionalGraph object in the memory pool \n");
11174 : }
11175 : }
11176 : }
11177 : }
11178 :
11179 : // This should not be required since all previously static data members are
11180 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
11181 :
11182 194 : }
11183 :
11184 : void
11185 0 : SgIntKeyedBidirectionalGraph::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
11186 : {
11187 : // This function visits only a single IR node of the memory pool.
11188 : // it is typically called once for each type of IR node within
11189 : // the automatically generated function: traverseRepresentativeNodes().
11190 :
11191 : // Initialize array to the address of the first element of the STL vector
11192 : // (which is guarenteed to be contiguous storage).
11193 : // SgIntKeyedBidirectionalGraph objectArray [] = *(Memory_Block_List.begin());
11194 0 : if (SgIntKeyedBidirectionalGraph::pools.empty() == false)
11195 : {
11196 : // Generate an array of memory pools
11197 0 : SgIntKeyedBidirectionalGraph** objectArray = (SgIntKeyedBidirectionalGraph**) &(SgIntKeyedBidirectionalGraph::pools[0]);
11198 :
11199 : // Build a local variable for better performance
11200 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
11201 :
11202 : // Iterate over the memory pools
11203 0 : bool done = false;
11204 0 : unsigned i=0;
11205 :
11206 : // find the first valid IR node, call visit function, and then leave
11207 0 : while ( done == false && i < SgIntKeyedBidirectionalGraph::pools.size() )
11208 : {
11209 : // objectArray[i] is a single memory pool
11210 : unsigned j=0;
11211 0 : while (done == false && j < SgIntKeyedBidirectionalGraph::pool_size)
11212 : {
11213 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
11214 : {
11215 0 : traversal.visit(&(objectArray[i][j]));
11216 0 : done = true;
11217 : }
11218 0 : j++;
11219 : }
11220 0 : i++;
11221 : }
11222 :
11223 : #if 0
11224 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
11225 : if (done == false)
11226 : {
11227 : printf ("No representative for SgIntKeyedBidirectionalGraph found in memory pools \n");
11228 : }
11229 : #endif
11230 : }
11231 0 : }
11232 :
11233 :
11234 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
11235 : // using values that overflow signed values of int.
11236 : size_t
11237 4 : SgIntKeyedBidirectionalGraph::numberOfNodes()
11238 : {
11239 : // This function traverses the memory pool for an IR node and
11240 : // counts the number of IR nodes of a particular Sage III IR
11241 : // nodes type.
11242 :
11243 4 : size_t count = 0;
11244 4 : if (SgIntKeyedBidirectionalGraph::pools.empty() == false)
11245 : {
11246 : // Generate an array of memory pools (this is actually a STL vector,
11247 : // but it is contiguious, so OK to treat this way).
11248 0 : SgIntKeyedBidirectionalGraph** objectArray = (SgIntKeyedBidirectionalGraph**) &(SgIntKeyedBidirectionalGraph::pools[0]);
11249 :
11250 : // Build a local variable for better performance (make it a loop invariant variable).
11251 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
11252 :
11253 : // Iterate over all of the memory pools for this IR node.
11254 0 : for (unsigned int i=0; i < SgIntKeyedBidirectionalGraph::pools.size(); i++)
11255 : {
11256 : // objectArray[i] is a single memory pool, iterate over all the
11257 : // IR nodes and only count those that are valid IR nodes used in
11258 : // the AST (i.e. allocated IR nodes).
11259 0 : for (unsigned j=0; j < SgIntKeyedBidirectionalGraph::pool_size; j++)
11260 : {
11261 : // This is indexing the STL vector of C/C++ style arrays as a doubly
11262 : // indexed array access. It is OK since we have leveraged the semantics
11263 : // of STL vector memory as contigous and cast the memory as an array
11264 : // of arrays to use the 2D array indexing. Hope this is not confusing,
11265 : // but it s very fast as an implementation.
11266 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
11267 : {
11268 0 : count++;
11269 : }
11270 : }
11271 : }
11272 : }
11273 :
11274 :
11275 :
11276 4 : return count;
11277 : }
11278 :
11279 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
11280 : // using values that overflow signed values of int.
11281 : size_t
11282 0 : SgIntKeyedBidirectionalGraph::memoryUsage()
11283 : {
11284 : // This function is required because we need the class name as a type when we call sizeof
11285 : // There might be another way to implement this if we have a traversal that only called a
11286 : // representative object (one call for each type of Sage IIIIR node).
11287 0 : size_t memory = numberOfNodes() * sizeof(SgIntKeyedBidirectionalGraph);
11288 :
11289 0 : return memory;
11290 : }
11291 :
11292 : /* #line 11293 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
11293 :
11294 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
11295 : void
11296 5342 : SgIncidenceUndirectedGraph::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
11297 : {
11298 : // This function traverses the memory pool for only a specific IR node
11299 : // and calls the visit function of the input class execute a traversal
11300 : // similar to the style of the attribute based traversals within ROSE.
11301 : // This traversal will visit ALL nodes of the AST where as the other
11302 : // attribute based traversals visit only the embedded tree within the AST.
11303 :
11304 : // Initialize array to the address of the first element of the STL vector
11305 : // (which is guaranteed to be contiguous storage).
11306 : // SgIncidenceUndirectedGraph objectArray [] = *(Memory_Block_List.begin());
11307 5342 : if (SgIncidenceUndirectedGraph::pools.empty() == false)
11308 : {
11309 : // Generate an array of memory pools
11310 0 : SgIncidenceUndirectedGraph** objectArray = (SgIncidenceUndirectedGraph**) &(SgIncidenceUndirectedGraph::pools[0]);
11311 :
11312 : // Build a local variable for better performance
11313 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
11314 : #if 0
11315 : // Iterate over the memory pools
11316 : for (unsigned int i=0; i < SgIncidenceUndirectedGraph::pools.size(); i++)
11317 : {
11318 : // objectArray[i] is a single memory pool
11319 : for (int j=0; j < SgIncidenceUndirectedGraph::pool_size; j++)
11320 : {
11321 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
11322 : {
11323 : traversal.visit(&(objectArray[i][j]));
11324 : }
11325 : }
11326 : }
11327 : #else
11328 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
11329 : // compute the list first and then call the visit function on each list element.
11330 :
11331 : // printf ("Inside of SgIncidenceUndirectedGraph::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
11332 :
11333 0 : std::vector<SgIncidenceUndirectedGraph*> nodeList;
11334 :
11335 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
11336 0 : for (unsigned int i=0; i < SgIncidenceUndirectedGraph::pools.size(); i++)
11337 : {
11338 : // objectArray[i] is a single memory pool
11339 0 : for (unsigned j=0; j < SgIncidenceUndirectedGraph::pool_size; j++)
11340 : {
11341 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
11342 : {
11343 0 : nodeList.push_back(&(objectArray[i][j]));
11344 : }
11345 : }
11346 : }
11347 :
11348 : // Iterate over the saved list
11349 0 : size_t nodeListSize = nodeList.size();
11350 0 : for (size_t i=0; i < nodeListSize; i++)
11351 : {
11352 0 : ROSE_ASSERT(nodeList[i] != NULL);
11353 : #if 0
11354 : traversal.visit(nodeList[i]);
11355 : #else
11356 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
11357 : {
11358 0 : traversal.visit(nodeList[i]);
11359 : }
11360 : #endif
11361 : }
11362 : #endif
11363 : }
11364 :
11365 : // This should not be required since all previously static data members are
11366 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
11367 :
11368 5342 : }
11369 :
11370 :
11371 : void
11372 194 : SgIncidenceUndirectedGraph::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
11373 : {
11374 : // This function traverses the memory pool for an IR node and
11375 : // calls the function to execute the visitor object.
11376 :
11377 : // Initialize array to the address of the first element of the STL vector
11378 : // (which is guarenteed to be contiguous storage).
11379 : // SgIncidenceUndirectedGraph objectArray [] = *(Memory_Block_List.begin());
11380 194 : if (SgIncidenceUndirectedGraph::pools.empty() == false)
11381 : {
11382 : // Generate an array of memory pools
11383 0 : SgIncidenceUndirectedGraph** objectArray = (SgIncidenceUndirectedGraph**) &(SgIncidenceUndirectedGraph::pools[0]);
11384 :
11385 : // Build a local variable for better performance
11386 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
11387 :
11388 : // Iterate over the memory pools
11389 0 : for (unsigned int i=0; i < SgIncidenceUndirectedGraph::pools.size(); i++)
11390 : {
11391 : // objectArray[i] is a single memory pool
11392 0 : for (unsigned j=0; j < SgIncidenceUndirectedGraph::pool_size; j++)
11393 : {
11394 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
11395 : {
11396 : // printf ("Found a valid SgIncidenceUndirectedGraph object in the memory pool %d at position %d \n",i,j);
11397 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
11398 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
11399 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
11400 : }
11401 : else
11402 : {
11403 : // printf ("Found a INVALID SgIncidenceUndirectedGraph object in the memory pool \n");
11404 : }
11405 : }
11406 : }
11407 : }
11408 :
11409 : // This should not be required since all previously static data members are
11410 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
11411 :
11412 194 : }
11413 :
11414 : void
11415 0 : SgIncidenceUndirectedGraph::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
11416 : {
11417 : // This function visits only a single IR node of the memory pool.
11418 : // it is typically called once for each type of IR node within
11419 : // the automatically generated function: traverseRepresentativeNodes().
11420 :
11421 : // Initialize array to the address of the first element of the STL vector
11422 : // (which is guarenteed to be contiguous storage).
11423 : // SgIncidenceUndirectedGraph objectArray [] = *(Memory_Block_List.begin());
11424 0 : if (SgIncidenceUndirectedGraph::pools.empty() == false)
11425 : {
11426 : // Generate an array of memory pools
11427 0 : SgIncidenceUndirectedGraph** objectArray = (SgIncidenceUndirectedGraph**) &(SgIncidenceUndirectedGraph::pools[0]);
11428 :
11429 : // Build a local variable for better performance
11430 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
11431 :
11432 : // Iterate over the memory pools
11433 0 : bool done = false;
11434 0 : unsigned i=0;
11435 :
11436 : // find the first valid IR node, call visit function, and then leave
11437 0 : while ( done == false && i < SgIncidenceUndirectedGraph::pools.size() )
11438 : {
11439 : // objectArray[i] is a single memory pool
11440 : unsigned j=0;
11441 0 : while (done == false && j < SgIncidenceUndirectedGraph::pool_size)
11442 : {
11443 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
11444 : {
11445 0 : traversal.visit(&(objectArray[i][j]));
11446 0 : done = true;
11447 : }
11448 0 : j++;
11449 : }
11450 0 : i++;
11451 : }
11452 :
11453 : #if 0
11454 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
11455 : if (done == false)
11456 : {
11457 : printf ("No representative for SgIncidenceUndirectedGraph found in memory pools \n");
11458 : }
11459 : #endif
11460 : }
11461 0 : }
11462 :
11463 :
11464 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
11465 : // using values that overflow signed values of int.
11466 : size_t
11467 4 : SgIncidenceUndirectedGraph::numberOfNodes()
11468 : {
11469 : // This function traverses the memory pool for an IR node and
11470 : // counts the number of IR nodes of a particular Sage III IR
11471 : // nodes type.
11472 :
11473 4 : size_t count = 0;
11474 4 : if (SgIncidenceUndirectedGraph::pools.empty() == false)
11475 : {
11476 : // Generate an array of memory pools (this is actually a STL vector,
11477 : // but it is contiguious, so OK to treat this way).
11478 0 : SgIncidenceUndirectedGraph** objectArray = (SgIncidenceUndirectedGraph**) &(SgIncidenceUndirectedGraph::pools[0]);
11479 :
11480 : // Build a local variable for better performance (make it a loop invariant variable).
11481 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
11482 :
11483 : // Iterate over all of the memory pools for this IR node.
11484 0 : for (unsigned int i=0; i < SgIncidenceUndirectedGraph::pools.size(); i++)
11485 : {
11486 : // objectArray[i] is a single memory pool, iterate over all the
11487 : // IR nodes and only count those that are valid IR nodes used in
11488 : // the AST (i.e. allocated IR nodes).
11489 0 : for (unsigned j=0; j < SgIncidenceUndirectedGraph::pool_size; j++)
11490 : {
11491 : // This is indexing the STL vector of C/C++ style arrays as a doubly
11492 : // indexed array access. It is OK since we have leveraged the semantics
11493 : // of STL vector memory as contigous and cast the memory as an array
11494 : // of arrays to use the 2D array indexing. Hope this is not confusing,
11495 : // but it s very fast as an implementation.
11496 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
11497 : {
11498 0 : count++;
11499 : }
11500 : }
11501 : }
11502 : }
11503 :
11504 :
11505 :
11506 4 : return count;
11507 : }
11508 :
11509 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
11510 : // using values that overflow signed values of int.
11511 : size_t
11512 0 : SgIncidenceUndirectedGraph::memoryUsage()
11513 : {
11514 : // This function is required because we need the class name as a type when we call sizeof
11515 : // There might be another way to implement this if we have a traversal that only called a
11516 : // representative object (one call for each type of Sage IIIIR node).
11517 0 : size_t memory = numberOfNodes() * sizeof(SgIncidenceUndirectedGraph);
11518 :
11519 0 : return memory;
11520 : }
11521 :
11522 : /* #line 11523 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
11523 :
11524 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
11525 : void
11526 5342 : SgGraphNode::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
11527 : {
11528 : // This function traverses the memory pool for only a specific IR node
11529 : // and calls the visit function of the input class execute a traversal
11530 : // similar to the style of the attribute based traversals within ROSE.
11531 : // This traversal will visit ALL nodes of the AST where as the other
11532 : // attribute based traversals visit only the embedded tree within the AST.
11533 :
11534 : // Initialize array to the address of the first element of the STL vector
11535 : // (which is guaranteed to be contiguous storage).
11536 : // SgGraphNode objectArray [] = *(Memory_Block_List.begin());
11537 5342 : if (SgGraphNode::pools.empty() == false)
11538 : {
11539 : // Generate an array of memory pools
11540 0 : SgGraphNode** objectArray = (SgGraphNode**) &(SgGraphNode::pools[0]);
11541 :
11542 : // Build a local variable for better performance
11543 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
11544 : #if 0
11545 : // Iterate over the memory pools
11546 : for (unsigned int i=0; i < SgGraphNode::pools.size(); i++)
11547 : {
11548 : // objectArray[i] is a single memory pool
11549 : for (int j=0; j < SgGraphNode::pool_size; j++)
11550 : {
11551 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
11552 : {
11553 : traversal.visit(&(objectArray[i][j]));
11554 : }
11555 : }
11556 : }
11557 : #else
11558 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
11559 : // compute the list first and then call the visit function on each list element.
11560 :
11561 : // printf ("Inside of SgGraphNode::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
11562 :
11563 0 : std::vector<SgGraphNode*> nodeList;
11564 :
11565 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
11566 0 : for (unsigned int i=0; i < SgGraphNode::pools.size(); i++)
11567 : {
11568 : // objectArray[i] is a single memory pool
11569 0 : for (unsigned j=0; j < SgGraphNode::pool_size; j++)
11570 : {
11571 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
11572 : {
11573 0 : nodeList.push_back(&(objectArray[i][j]));
11574 : }
11575 : }
11576 : }
11577 :
11578 : // Iterate over the saved list
11579 0 : size_t nodeListSize = nodeList.size();
11580 0 : for (size_t i=0; i < nodeListSize; i++)
11581 : {
11582 0 : ROSE_ASSERT(nodeList[i] != NULL);
11583 : #if 0
11584 : traversal.visit(nodeList[i]);
11585 : #else
11586 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
11587 : {
11588 0 : traversal.visit(nodeList[i]);
11589 : }
11590 : #endif
11591 : }
11592 : #endif
11593 : }
11594 :
11595 : // This should not be required since all previously static data members are
11596 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
11597 :
11598 5342 : }
11599 :
11600 :
11601 : void
11602 194 : SgGraphNode::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
11603 : {
11604 : // This function traverses the memory pool for an IR node and
11605 : // calls the function to execute the visitor object.
11606 :
11607 : // Initialize array to the address of the first element of the STL vector
11608 : // (which is guarenteed to be contiguous storage).
11609 : // SgGraphNode objectArray [] = *(Memory_Block_List.begin());
11610 194 : if (SgGraphNode::pools.empty() == false)
11611 : {
11612 : // Generate an array of memory pools
11613 0 : SgGraphNode** objectArray = (SgGraphNode**) &(SgGraphNode::pools[0]);
11614 :
11615 : // Build a local variable for better performance
11616 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
11617 :
11618 : // Iterate over the memory pools
11619 0 : for (unsigned int i=0; i < SgGraphNode::pools.size(); i++)
11620 : {
11621 : // objectArray[i] is a single memory pool
11622 0 : for (unsigned j=0; j < SgGraphNode::pool_size; j++)
11623 : {
11624 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
11625 : {
11626 : // printf ("Found a valid SgGraphNode object in the memory pool %d at position %d \n",i,j);
11627 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
11628 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
11629 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
11630 : }
11631 : else
11632 : {
11633 : // printf ("Found a INVALID SgGraphNode object in the memory pool \n");
11634 : }
11635 : }
11636 : }
11637 : }
11638 :
11639 : // This should not be required since all previously static data members are
11640 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
11641 :
11642 194 : }
11643 :
11644 : void
11645 0 : SgGraphNode::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
11646 : {
11647 : // This function visits only a single IR node of the memory pool.
11648 : // it is typically called once for each type of IR node within
11649 : // the automatically generated function: traverseRepresentativeNodes().
11650 :
11651 : // Initialize array to the address of the first element of the STL vector
11652 : // (which is guarenteed to be contiguous storage).
11653 : // SgGraphNode objectArray [] = *(Memory_Block_List.begin());
11654 0 : if (SgGraphNode::pools.empty() == false)
11655 : {
11656 : // Generate an array of memory pools
11657 0 : SgGraphNode** objectArray = (SgGraphNode**) &(SgGraphNode::pools[0]);
11658 :
11659 : // Build a local variable for better performance
11660 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
11661 :
11662 : // Iterate over the memory pools
11663 0 : bool done = false;
11664 0 : unsigned i=0;
11665 :
11666 : // find the first valid IR node, call visit function, and then leave
11667 0 : while ( done == false && i < SgGraphNode::pools.size() )
11668 : {
11669 : // objectArray[i] is a single memory pool
11670 : unsigned j=0;
11671 0 : while (done == false && j < SgGraphNode::pool_size)
11672 : {
11673 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
11674 : {
11675 0 : traversal.visit(&(objectArray[i][j]));
11676 0 : done = true;
11677 : }
11678 0 : j++;
11679 : }
11680 0 : i++;
11681 : }
11682 :
11683 : #if 0
11684 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
11685 : if (done == false)
11686 : {
11687 : printf ("No representative for SgGraphNode found in memory pools \n");
11688 : }
11689 : #endif
11690 : }
11691 0 : }
11692 :
11693 :
11694 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
11695 : // using values that overflow signed values of int.
11696 : size_t
11697 4 : SgGraphNode::numberOfNodes()
11698 : {
11699 : // This function traverses the memory pool for an IR node and
11700 : // counts the number of IR nodes of a particular Sage III IR
11701 : // nodes type.
11702 :
11703 4 : size_t count = 0;
11704 4 : if (SgGraphNode::pools.empty() == false)
11705 : {
11706 : // Generate an array of memory pools (this is actually a STL vector,
11707 : // but it is contiguious, so OK to treat this way).
11708 0 : SgGraphNode** objectArray = (SgGraphNode**) &(SgGraphNode::pools[0]);
11709 :
11710 : // Build a local variable for better performance (make it a loop invariant variable).
11711 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
11712 :
11713 : // Iterate over all of the memory pools for this IR node.
11714 0 : for (unsigned int i=0; i < SgGraphNode::pools.size(); i++)
11715 : {
11716 : // objectArray[i] is a single memory pool, iterate over all the
11717 : // IR nodes and only count those that are valid IR nodes used in
11718 : // the AST (i.e. allocated IR nodes).
11719 0 : for (unsigned j=0; j < SgGraphNode::pool_size; j++)
11720 : {
11721 : // This is indexing the STL vector of C/C++ style arrays as a doubly
11722 : // indexed array access. It is OK since we have leveraged the semantics
11723 : // of STL vector memory as contigous and cast the memory as an array
11724 : // of arrays to use the 2D array indexing. Hope this is not confusing,
11725 : // but it s very fast as an implementation.
11726 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
11727 : {
11728 0 : count++;
11729 : }
11730 : }
11731 : }
11732 : }
11733 :
11734 :
11735 :
11736 4 : return count;
11737 : }
11738 :
11739 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
11740 : // using values that overflow signed values of int.
11741 : size_t
11742 0 : SgGraphNode::memoryUsage()
11743 : {
11744 : // This function is required because we need the class name as a type when we call sizeof
11745 : // There might be another way to implement this if we have a traversal that only called a
11746 : // representative object (one call for each type of Sage IIIIR node).
11747 0 : size_t memory = numberOfNodes() * sizeof(SgGraphNode);
11748 :
11749 0 : return memory;
11750 : }
11751 :
11752 : /* #line 11753 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
11753 :
11754 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
11755 : void
11756 5342 : SgGraphEdge::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
11757 : {
11758 : // This function traverses the memory pool for only a specific IR node
11759 : // and calls the visit function of the input class execute a traversal
11760 : // similar to the style of the attribute based traversals within ROSE.
11761 : // This traversal will visit ALL nodes of the AST where as the other
11762 : // attribute based traversals visit only the embedded tree within the AST.
11763 :
11764 : // Initialize array to the address of the first element of the STL vector
11765 : // (which is guaranteed to be contiguous storage).
11766 : // SgGraphEdge objectArray [] = *(Memory_Block_List.begin());
11767 5342 : if (SgGraphEdge::pools.empty() == false)
11768 : {
11769 : // Generate an array of memory pools
11770 0 : SgGraphEdge** objectArray = (SgGraphEdge**) &(SgGraphEdge::pools[0]);
11771 :
11772 : // Build a local variable for better performance
11773 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
11774 : #if 0
11775 : // Iterate over the memory pools
11776 : for (unsigned int i=0; i < SgGraphEdge::pools.size(); i++)
11777 : {
11778 : // objectArray[i] is a single memory pool
11779 : for (int j=0; j < SgGraphEdge::pool_size; j++)
11780 : {
11781 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
11782 : {
11783 : traversal.visit(&(objectArray[i][j]));
11784 : }
11785 : }
11786 : }
11787 : #else
11788 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
11789 : // compute the list first and then call the visit function on each list element.
11790 :
11791 : // printf ("Inside of SgGraphEdge::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
11792 :
11793 0 : std::vector<SgGraphEdge*> nodeList;
11794 :
11795 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
11796 0 : for (unsigned int i=0; i < SgGraphEdge::pools.size(); i++)
11797 : {
11798 : // objectArray[i] is a single memory pool
11799 0 : for (unsigned j=0; j < SgGraphEdge::pool_size; j++)
11800 : {
11801 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
11802 : {
11803 0 : nodeList.push_back(&(objectArray[i][j]));
11804 : }
11805 : }
11806 : }
11807 :
11808 : // Iterate over the saved list
11809 0 : size_t nodeListSize = nodeList.size();
11810 0 : for (size_t i=0; i < nodeListSize; i++)
11811 : {
11812 0 : ROSE_ASSERT(nodeList[i] != NULL);
11813 : #if 0
11814 : traversal.visit(nodeList[i]);
11815 : #else
11816 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
11817 : {
11818 0 : traversal.visit(nodeList[i]);
11819 : }
11820 : #endif
11821 : }
11822 : #endif
11823 : }
11824 :
11825 : // This should not be required since all previously static data members are
11826 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
11827 :
11828 5342 : }
11829 :
11830 :
11831 : void
11832 194 : SgGraphEdge::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
11833 : {
11834 : // This function traverses the memory pool for an IR node and
11835 : // calls the function to execute the visitor object.
11836 :
11837 : // Initialize array to the address of the first element of the STL vector
11838 : // (which is guarenteed to be contiguous storage).
11839 : // SgGraphEdge objectArray [] = *(Memory_Block_List.begin());
11840 194 : if (SgGraphEdge::pools.empty() == false)
11841 : {
11842 : // Generate an array of memory pools
11843 0 : SgGraphEdge** objectArray = (SgGraphEdge**) &(SgGraphEdge::pools[0]);
11844 :
11845 : // Build a local variable for better performance
11846 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
11847 :
11848 : // Iterate over the memory pools
11849 0 : for (unsigned int i=0; i < SgGraphEdge::pools.size(); i++)
11850 : {
11851 : // objectArray[i] is a single memory pool
11852 0 : for (unsigned j=0; j < SgGraphEdge::pool_size; j++)
11853 : {
11854 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
11855 : {
11856 : // printf ("Found a valid SgGraphEdge object in the memory pool %d at position %d \n",i,j);
11857 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
11858 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
11859 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
11860 : }
11861 : else
11862 : {
11863 : // printf ("Found a INVALID SgGraphEdge object in the memory pool \n");
11864 : }
11865 : }
11866 : }
11867 : }
11868 :
11869 : // This should not be required since all previously static data members are
11870 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
11871 :
11872 194 : }
11873 :
11874 : void
11875 0 : SgGraphEdge::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
11876 : {
11877 : // This function visits only a single IR node of the memory pool.
11878 : // it is typically called once for each type of IR node within
11879 : // the automatically generated function: traverseRepresentativeNodes().
11880 :
11881 : // Initialize array to the address of the first element of the STL vector
11882 : // (which is guarenteed to be contiguous storage).
11883 : // SgGraphEdge objectArray [] = *(Memory_Block_List.begin());
11884 0 : if (SgGraphEdge::pools.empty() == false)
11885 : {
11886 : // Generate an array of memory pools
11887 0 : SgGraphEdge** objectArray = (SgGraphEdge**) &(SgGraphEdge::pools[0]);
11888 :
11889 : // Build a local variable for better performance
11890 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
11891 :
11892 : // Iterate over the memory pools
11893 0 : bool done = false;
11894 0 : unsigned i=0;
11895 :
11896 : // find the first valid IR node, call visit function, and then leave
11897 0 : while ( done == false && i < SgGraphEdge::pools.size() )
11898 : {
11899 : // objectArray[i] is a single memory pool
11900 : unsigned j=0;
11901 0 : while (done == false && j < SgGraphEdge::pool_size)
11902 : {
11903 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
11904 : {
11905 0 : traversal.visit(&(objectArray[i][j]));
11906 0 : done = true;
11907 : }
11908 0 : j++;
11909 : }
11910 0 : i++;
11911 : }
11912 :
11913 : #if 0
11914 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
11915 : if (done == false)
11916 : {
11917 : printf ("No representative for SgGraphEdge found in memory pools \n");
11918 : }
11919 : #endif
11920 : }
11921 0 : }
11922 :
11923 :
11924 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
11925 : // using values that overflow signed values of int.
11926 : size_t
11927 4 : SgGraphEdge::numberOfNodes()
11928 : {
11929 : // This function traverses the memory pool for an IR node and
11930 : // counts the number of IR nodes of a particular Sage III IR
11931 : // nodes type.
11932 :
11933 4 : size_t count = 0;
11934 4 : if (SgGraphEdge::pools.empty() == false)
11935 : {
11936 : // Generate an array of memory pools (this is actually a STL vector,
11937 : // but it is contiguious, so OK to treat this way).
11938 0 : SgGraphEdge** objectArray = (SgGraphEdge**) &(SgGraphEdge::pools[0]);
11939 :
11940 : // Build a local variable for better performance (make it a loop invariant variable).
11941 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
11942 :
11943 : // Iterate over all of the memory pools for this IR node.
11944 0 : for (unsigned int i=0; i < SgGraphEdge::pools.size(); i++)
11945 : {
11946 : // objectArray[i] is a single memory pool, iterate over all the
11947 : // IR nodes and only count those that are valid IR nodes used in
11948 : // the AST (i.e. allocated IR nodes).
11949 0 : for (unsigned j=0; j < SgGraphEdge::pool_size; j++)
11950 : {
11951 : // This is indexing the STL vector of C/C++ style arrays as a doubly
11952 : // indexed array access. It is OK since we have leveraged the semantics
11953 : // of STL vector memory as contigous and cast the memory as an array
11954 : // of arrays to use the 2D array indexing. Hope this is not confusing,
11955 : // but it s very fast as an implementation.
11956 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
11957 : {
11958 0 : count++;
11959 : }
11960 : }
11961 : }
11962 : }
11963 :
11964 :
11965 :
11966 4 : return count;
11967 : }
11968 :
11969 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
11970 : // using values that overflow signed values of int.
11971 : size_t
11972 0 : SgGraphEdge::memoryUsage()
11973 : {
11974 : // This function is required because we need the class name as a type when we call sizeof
11975 : // There might be another way to implement this if we have a traversal that only called a
11976 : // representative object (one call for each type of Sage IIIIR node).
11977 0 : size_t memory = numberOfNodes() * sizeof(SgGraphEdge);
11978 :
11979 0 : return memory;
11980 : }
11981 :
11982 : /* #line 11983 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
11983 :
11984 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
11985 : void
11986 5342 : SgDirectedGraphEdge::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
11987 : {
11988 : // This function traverses the memory pool for only a specific IR node
11989 : // and calls the visit function of the input class execute a traversal
11990 : // similar to the style of the attribute based traversals within ROSE.
11991 : // This traversal will visit ALL nodes of the AST where as the other
11992 : // attribute based traversals visit only the embedded tree within the AST.
11993 :
11994 : // Initialize array to the address of the first element of the STL vector
11995 : // (which is guaranteed to be contiguous storage).
11996 : // SgDirectedGraphEdge objectArray [] = *(Memory_Block_List.begin());
11997 5342 : if (SgDirectedGraphEdge::pools.empty() == false)
11998 : {
11999 : // Generate an array of memory pools
12000 0 : SgDirectedGraphEdge** objectArray = (SgDirectedGraphEdge**) &(SgDirectedGraphEdge::pools[0]);
12001 :
12002 : // Build a local variable for better performance
12003 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
12004 : #if 0
12005 : // Iterate over the memory pools
12006 : for (unsigned int i=0; i < SgDirectedGraphEdge::pools.size(); i++)
12007 : {
12008 : // objectArray[i] is a single memory pool
12009 : for (int j=0; j < SgDirectedGraphEdge::pool_size; j++)
12010 : {
12011 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
12012 : {
12013 : traversal.visit(&(objectArray[i][j]));
12014 : }
12015 : }
12016 : }
12017 : #else
12018 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
12019 : // compute the list first and then call the visit function on each list element.
12020 :
12021 : // printf ("Inside of SgDirectedGraphEdge::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
12022 :
12023 0 : std::vector<SgDirectedGraphEdge*> nodeList;
12024 :
12025 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
12026 0 : for (unsigned int i=0; i < SgDirectedGraphEdge::pools.size(); i++)
12027 : {
12028 : // objectArray[i] is a single memory pool
12029 0 : for (unsigned j=0; j < SgDirectedGraphEdge::pool_size; j++)
12030 : {
12031 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
12032 : {
12033 0 : nodeList.push_back(&(objectArray[i][j]));
12034 : }
12035 : }
12036 : }
12037 :
12038 : // Iterate over the saved list
12039 0 : size_t nodeListSize = nodeList.size();
12040 0 : for (size_t i=0; i < nodeListSize; i++)
12041 : {
12042 0 : ROSE_ASSERT(nodeList[i] != NULL);
12043 : #if 0
12044 : traversal.visit(nodeList[i]);
12045 : #else
12046 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
12047 : {
12048 0 : traversal.visit(nodeList[i]);
12049 : }
12050 : #endif
12051 : }
12052 : #endif
12053 : }
12054 :
12055 : // This should not be required since all previously static data members are
12056 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
12057 :
12058 5342 : }
12059 :
12060 :
12061 : void
12062 194 : SgDirectedGraphEdge::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
12063 : {
12064 : // This function traverses the memory pool for an IR node and
12065 : // calls the function to execute the visitor object.
12066 :
12067 : // Initialize array to the address of the first element of the STL vector
12068 : // (which is guarenteed to be contiguous storage).
12069 : // SgDirectedGraphEdge objectArray [] = *(Memory_Block_List.begin());
12070 194 : if (SgDirectedGraphEdge::pools.empty() == false)
12071 : {
12072 : // Generate an array of memory pools
12073 0 : SgDirectedGraphEdge** objectArray = (SgDirectedGraphEdge**) &(SgDirectedGraphEdge::pools[0]);
12074 :
12075 : // Build a local variable for better performance
12076 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
12077 :
12078 : // Iterate over the memory pools
12079 0 : for (unsigned int i=0; i < SgDirectedGraphEdge::pools.size(); i++)
12080 : {
12081 : // objectArray[i] is a single memory pool
12082 0 : for (unsigned j=0; j < SgDirectedGraphEdge::pool_size; j++)
12083 : {
12084 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
12085 : {
12086 : // printf ("Found a valid SgDirectedGraphEdge object in the memory pool %d at position %d \n",i,j);
12087 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
12088 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
12089 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
12090 : }
12091 : else
12092 : {
12093 : // printf ("Found a INVALID SgDirectedGraphEdge object in the memory pool \n");
12094 : }
12095 : }
12096 : }
12097 : }
12098 :
12099 : // This should not be required since all previously static data members are
12100 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
12101 :
12102 194 : }
12103 :
12104 : void
12105 0 : SgDirectedGraphEdge::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
12106 : {
12107 : // This function visits only a single IR node of the memory pool.
12108 : // it is typically called once for each type of IR node within
12109 : // the automatically generated function: traverseRepresentativeNodes().
12110 :
12111 : // Initialize array to the address of the first element of the STL vector
12112 : // (which is guarenteed to be contiguous storage).
12113 : // SgDirectedGraphEdge objectArray [] = *(Memory_Block_List.begin());
12114 0 : if (SgDirectedGraphEdge::pools.empty() == false)
12115 : {
12116 : // Generate an array of memory pools
12117 0 : SgDirectedGraphEdge** objectArray = (SgDirectedGraphEdge**) &(SgDirectedGraphEdge::pools[0]);
12118 :
12119 : // Build a local variable for better performance
12120 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
12121 :
12122 : // Iterate over the memory pools
12123 0 : bool done = false;
12124 0 : unsigned i=0;
12125 :
12126 : // find the first valid IR node, call visit function, and then leave
12127 0 : while ( done == false && i < SgDirectedGraphEdge::pools.size() )
12128 : {
12129 : // objectArray[i] is a single memory pool
12130 : unsigned j=0;
12131 0 : while (done == false && j < SgDirectedGraphEdge::pool_size)
12132 : {
12133 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
12134 : {
12135 0 : traversal.visit(&(objectArray[i][j]));
12136 0 : done = true;
12137 : }
12138 0 : j++;
12139 : }
12140 0 : i++;
12141 : }
12142 :
12143 : #if 0
12144 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
12145 : if (done == false)
12146 : {
12147 : printf ("No representative for SgDirectedGraphEdge found in memory pools \n");
12148 : }
12149 : #endif
12150 : }
12151 0 : }
12152 :
12153 :
12154 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
12155 : // using values that overflow signed values of int.
12156 : size_t
12157 4 : SgDirectedGraphEdge::numberOfNodes()
12158 : {
12159 : // This function traverses the memory pool for an IR node and
12160 : // counts the number of IR nodes of a particular Sage III IR
12161 : // nodes type.
12162 :
12163 4 : size_t count = 0;
12164 4 : if (SgDirectedGraphEdge::pools.empty() == false)
12165 : {
12166 : // Generate an array of memory pools (this is actually a STL vector,
12167 : // but it is contiguious, so OK to treat this way).
12168 0 : SgDirectedGraphEdge** objectArray = (SgDirectedGraphEdge**) &(SgDirectedGraphEdge::pools[0]);
12169 :
12170 : // Build a local variable for better performance (make it a loop invariant variable).
12171 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
12172 :
12173 : // Iterate over all of the memory pools for this IR node.
12174 0 : for (unsigned int i=0; i < SgDirectedGraphEdge::pools.size(); i++)
12175 : {
12176 : // objectArray[i] is a single memory pool, iterate over all the
12177 : // IR nodes and only count those that are valid IR nodes used in
12178 : // the AST (i.e. allocated IR nodes).
12179 0 : for (unsigned j=0; j < SgDirectedGraphEdge::pool_size; j++)
12180 : {
12181 : // This is indexing the STL vector of C/C++ style arrays as a doubly
12182 : // indexed array access. It is OK since we have leveraged the semantics
12183 : // of STL vector memory as contigous and cast the memory as an array
12184 : // of arrays to use the 2D array indexing. Hope this is not confusing,
12185 : // but it s very fast as an implementation.
12186 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
12187 : {
12188 0 : count++;
12189 : }
12190 : }
12191 : }
12192 : }
12193 :
12194 :
12195 :
12196 4 : return count;
12197 : }
12198 :
12199 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
12200 : // using values that overflow signed values of int.
12201 : size_t
12202 0 : SgDirectedGraphEdge::memoryUsage()
12203 : {
12204 : // This function is required because we need the class name as a type when we call sizeof
12205 : // There might be another way to implement this if we have a traversal that only called a
12206 : // representative object (one call for each type of Sage IIIIR node).
12207 0 : size_t memory = numberOfNodes() * sizeof(SgDirectedGraphEdge);
12208 :
12209 0 : return memory;
12210 : }
12211 :
12212 : /* #line 12213 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
12213 :
12214 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
12215 : void
12216 5342 : SgUndirectedGraphEdge::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
12217 : {
12218 : // This function traverses the memory pool for only a specific IR node
12219 : // and calls the visit function of the input class execute a traversal
12220 : // similar to the style of the attribute based traversals within ROSE.
12221 : // This traversal will visit ALL nodes of the AST where as the other
12222 : // attribute based traversals visit only the embedded tree within the AST.
12223 :
12224 : // Initialize array to the address of the first element of the STL vector
12225 : // (which is guaranteed to be contiguous storage).
12226 : // SgUndirectedGraphEdge objectArray [] = *(Memory_Block_List.begin());
12227 5342 : if (SgUndirectedGraphEdge::pools.empty() == false)
12228 : {
12229 : // Generate an array of memory pools
12230 0 : SgUndirectedGraphEdge** objectArray = (SgUndirectedGraphEdge**) &(SgUndirectedGraphEdge::pools[0]);
12231 :
12232 : // Build a local variable for better performance
12233 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
12234 : #if 0
12235 : // Iterate over the memory pools
12236 : for (unsigned int i=0; i < SgUndirectedGraphEdge::pools.size(); i++)
12237 : {
12238 : // objectArray[i] is a single memory pool
12239 : for (int j=0; j < SgUndirectedGraphEdge::pool_size; j++)
12240 : {
12241 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
12242 : {
12243 : traversal.visit(&(objectArray[i][j]));
12244 : }
12245 : }
12246 : }
12247 : #else
12248 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
12249 : // compute the list first and then call the visit function on each list element.
12250 :
12251 : // printf ("Inside of SgUndirectedGraphEdge::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
12252 :
12253 0 : std::vector<SgUndirectedGraphEdge*> nodeList;
12254 :
12255 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
12256 0 : for (unsigned int i=0; i < SgUndirectedGraphEdge::pools.size(); i++)
12257 : {
12258 : // objectArray[i] is a single memory pool
12259 0 : for (unsigned j=0; j < SgUndirectedGraphEdge::pool_size; j++)
12260 : {
12261 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
12262 : {
12263 0 : nodeList.push_back(&(objectArray[i][j]));
12264 : }
12265 : }
12266 : }
12267 :
12268 : // Iterate over the saved list
12269 0 : size_t nodeListSize = nodeList.size();
12270 0 : for (size_t i=0; i < nodeListSize; i++)
12271 : {
12272 0 : ROSE_ASSERT(nodeList[i] != NULL);
12273 : #if 0
12274 : traversal.visit(nodeList[i]);
12275 : #else
12276 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
12277 : {
12278 0 : traversal.visit(nodeList[i]);
12279 : }
12280 : #endif
12281 : }
12282 : #endif
12283 : }
12284 :
12285 : // This should not be required since all previously static data members are
12286 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
12287 :
12288 5342 : }
12289 :
12290 :
12291 : void
12292 194 : SgUndirectedGraphEdge::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
12293 : {
12294 : // This function traverses the memory pool for an IR node and
12295 : // calls the function to execute the visitor object.
12296 :
12297 : // Initialize array to the address of the first element of the STL vector
12298 : // (which is guarenteed to be contiguous storage).
12299 : // SgUndirectedGraphEdge objectArray [] = *(Memory_Block_List.begin());
12300 194 : if (SgUndirectedGraphEdge::pools.empty() == false)
12301 : {
12302 : // Generate an array of memory pools
12303 0 : SgUndirectedGraphEdge** objectArray = (SgUndirectedGraphEdge**) &(SgUndirectedGraphEdge::pools[0]);
12304 :
12305 : // Build a local variable for better performance
12306 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
12307 :
12308 : // Iterate over the memory pools
12309 0 : for (unsigned int i=0; i < SgUndirectedGraphEdge::pools.size(); i++)
12310 : {
12311 : // objectArray[i] is a single memory pool
12312 0 : for (unsigned j=0; j < SgUndirectedGraphEdge::pool_size; j++)
12313 : {
12314 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
12315 : {
12316 : // printf ("Found a valid SgUndirectedGraphEdge object in the memory pool %d at position %d \n",i,j);
12317 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
12318 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
12319 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
12320 : }
12321 : else
12322 : {
12323 : // printf ("Found a INVALID SgUndirectedGraphEdge object in the memory pool \n");
12324 : }
12325 : }
12326 : }
12327 : }
12328 :
12329 : // This should not be required since all previously static data members are
12330 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
12331 :
12332 194 : }
12333 :
12334 : void
12335 0 : SgUndirectedGraphEdge::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
12336 : {
12337 : // This function visits only a single IR node of the memory pool.
12338 : // it is typically called once for each type of IR node within
12339 : // the automatically generated function: traverseRepresentativeNodes().
12340 :
12341 : // Initialize array to the address of the first element of the STL vector
12342 : // (which is guarenteed to be contiguous storage).
12343 : // SgUndirectedGraphEdge objectArray [] = *(Memory_Block_List.begin());
12344 0 : if (SgUndirectedGraphEdge::pools.empty() == false)
12345 : {
12346 : // Generate an array of memory pools
12347 0 : SgUndirectedGraphEdge** objectArray = (SgUndirectedGraphEdge**) &(SgUndirectedGraphEdge::pools[0]);
12348 :
12349 : // Build a local variable for better performance
12350 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
12351 :
12352 : // Iterate over the memory pools
12353 0 : bool done = false;
12354 0 : unsigned i=0;
12355 :
12356 : // find the first valid IR node, call visit function, and then leave
12357 0 : while ( done == false && i < SgUndirectedGraphEdge::pools.size() )
12358 : {
12359 : // objectArray[i] is a single memory pool
12360 : unsigned j=0;
12361 0 : while (done == false && j < SgUndirectedGraphEdge::pool_size)
12362 : {
12363 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
12364 : {
12365 0 : traversal.visit(&(objectArray[i][j]));
12366 0 : done = true;
12367 : }
12368 0 : j++;
12369 : }
12370 0 : i++;
12371 : }
12372 :
12373 : #if 0
12374 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
12375 : if (done == false)
12376 : {
12377 : printf ("No representative for SgUndirectedGraphEdge found in memory pools \n");
12378 : }
12379 : #endif
12380 : }
12381 0 : }
12382 :
12383 :
12384 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
12385 : // using values that overflow signed values of int.
12386 : size_t
12387 4 : SgUndirectedGraphEdge::numberOfNodes()
12388 : {
12389 : // This function traverses the memory pool for an IR node and
12390 : // counts the number of IR nodes of a particular Sage III IR
12391 : // nodes type.
12392 :
12393 4 : size_t count = 0;
12394 4 : if (SgUndirectedGraphEdge::pools.empty() == false)
12395 : {
12396 : // Generate an array of memory pools (this is actually a STL vector,
12397 : // but it is contiguious, so OK to treat this way).
12398 0 : SgUndirectedGraphEdge** objectArray = (SgUndirectedGraphEdge**) &(SgUndirectedGraphEdge::pools[0]);
12399 :
12400 : // Build a local variable for better performance (make it a loop invariant variable).
12401 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
12402 :
12403 : // Iterate over all of the memory pools for this IR node.
12404 0 : for (unsigned int i=0; i < SgUndirectedGraphEdge::pools.size(); i++)
12405 : {
12406 : // objectArray[i] is a single memory pool, iterate over all the
12407 : // IR nodes and only count those that are valid IR nodes used in
12408 : // the AST (i.e. allocated IR nodes).
12409 0 : for (unsigned j=0; j < SgUndirectedGraphEdge::pool_size; j++)
12410 : {
12411 : // This is indexing the STL vector of C/C++ style arrays as a doubly
12412 : // indexed array access. It is OK since we have leveraged the semantics
12413 : // of STL vector memory as contigous and cast the memory as an array
12414 : // of arrays to use the 2D array indexing. Hope this is not confusing,
12415 : // but it s very fast as an implementation.
12416 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
12417 : {
12418 0 : count++;
12419 : }
12420 : }
12421 : }
12422 : }
12423 :
12424 :
12425 :
12426 4 : return count;
12427 : }
12428 :
12429 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
12430 : // using values that overflow signed values of int.
12431 : size_t
12432 0 : SgUndirectedGraphEdge::memoryUsage()
12433 : {
12434 : // This function is required because we need the class name as a type when we call sizeof
12435 : // There might be another way to implement this if we have a traversal that only called a
12436 : // representative object (one call for each type of Sage IIIIR node).
12437 0 : size_t memory = numberOfNodes() * sizeof(SgUndirectedGraphEdge);
12438 :
12439 0 : return memory;
12440 : }
12441 :
12442 : /* #line 12443 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
12443 :
12444 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
12445 : void
12446 5342 : SgGraphNodeList::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
12447 : {
12448 : // This function traverses the memory pool for only a specific IR node
12449 : // and calls the visit function of the input class execute a traversal
12450 : // similar to the style of the attribute based traversals within ROSE.
12451 : // This traversal will visit ALL nodes of the AST where as the other
12452 : // attribute based traversals visit only the embedded tree within the AST.
12453 :
12454 : // Initialize array to the address of the first element of the STL vector
12455 : // (which is guaranteed to be contiguous storage).
12456 : // SgGraphNodeList objectArray [] = *(Memory_Block_List.begin());
12457 5342 : if (SgGraphNodeList::pools.empty() == false)
12458 : {
12459 : // Generate an array of memory pools
12460 0 : SgGraphNodeList** objectArray = (SgGraphNodeList**) &(SgGraphNodeList::pools[0]);
12461 :
12462 : // Build a local variable for better performance
12463 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
12464 : #if 0
12465 : // Iterate over the memory pools
12466 : for (unsigned int i=0; i < SgGraphNodeList::pools.size(); i++)
12467 : {
12468 : // objectArray[i] is a single memory pool
12469 : for (int j=0; j < SgGraphNodeList::pool_size; j++)
12470 : {
12471 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
12472 : {
12473 : traversal.visit(&(objectArray[i][j]));
12474 : }
12475 : }
12476 : }
12477 : #else
12478 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
12479 : // compute the list first and then call the visit function on each list element.
12480 :
12481 : // printf ("Inside of SgGraphNodeList::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
12482 :
12483 0 : std::vector<SgGraphNodeList*> nodeList;
12484 :
12485 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
12486 0 : for (unsigned int i=0; i < SgGraphNodeList::pools.size(); i++)
12487 : {
12488 : // objectArray[i] is a single memory pool
12489 0 : for (unsigned j=0; j < SgGraphNodeList::pool_size; j++)
12490 : {
12491 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
12492 : {
12493 0 : nodeList.push_back(&(objectArray[i][j]));
12494 : }
12495 : }
12496 : }
12497 :
12498 : // Iterate over the saved list
12499 0 : size_t nodeListSize = nodeList.size();
12500 0 : for (size_t i=0; i < nodeListSize; i++)
12501 : {
12502 0 : ROSE_ASSERT(nodeList[i] != NULL);
12503 : #if 0
12504 : traversal.visit(nodeList[i]);
12505 : #else
12506 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
12507 : {
12508 0 : traversal.visit(nodeList[i]);
12509 : }
12510 : #endif
12511 : }
12512 : #endif
12513 : }
12514 :
12515 : // This should not be required since all previously static data members are
12516 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
12517 :
12518 5342 : }
12519 :
12520 :
12521 : void
12522 194 : SgGraphNodeList::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
12523 : {
12524 : // This function traverses the memory pool for an IR node and
12525 : // calls the function to execute the visitor object.
12526 :
12527 : // Initialize array to the address of the first element of the STL vector
12528 : // (which is guarenteed to be contiguous storage).
12529 : // SgGraphNodeList objectArray [] = *(Memory_Block_List.begin());
12530 194 : if (SgGraphNodeList::pools.empty() == false)
12531 : {
12532 : // Generate an array of memory pools
12533 0 : SgGraphNodeList** objectArray = (SgGraphNodeList**) &(SgGraphNodeList::pools[0]);
12534 :
12535 : // Build a local variable for better performance
12536 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
12537 :
12538 : // Iterate over the memory pools
12539 0 : for (unsigned int i=0; i < SgGraphNodeList::pools.size(); i++)
12540 : {
12541 : // objectArray[i] is a single memory pool
12542 0 : for (unsigned j=0; j < SgGraphNodeList::pool_size; j++)
12543 : {
12544 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
12545 : {
12546 : // printf ("Found a valid SgGraphNodeList object in the memory pool %d at position %d \n",i,j);
12547 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
12548 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
12549 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
12550 : }
12551 : else
12552 : {
12553 : // printf ("Found a INVALID SgGraphNodeList object in the memory pool \n");
12554 : }
12555 : }
12556 : }
12557 : }
12558 :
12559 : // This should not be required since all previously static data members are
12560 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
12561 :
12562 194 : }
12563 :
12564 : void
12565 0 : SgGraphNodeList::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
12566 : {
12567 : // This function visits only a single IR node of the memory pool.
12568 : // it is typically called once for each type of IR node within
12569 : // the automatically generated function: traverseRepresentativeNodes().
12570 :
12571 : // Initialize array to the address of the first element of the STL vector
12572 : // (which is guarenteed to be contiguous storage).
12573 : // SgGraphNodeList objectArray [] = *(Memory_Block_List.begin());
12574 0 : if (SgGraphNodeList::pools.empty() == false)
12575 : {
12576 : // Generate an array of memory pools
12577 0 : SgGraphNodeList** objectArray = (SgGraphNodeList**) &(SgGraphNodeList::pools[0]);
12578 :
12579 : // Build a local variable for better performance
12580 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
12581 :
12582 : // Iterate over the memory pools
12583 0 : bool done = false;
12584 0 : unsigned i=0;
12585 :
12586 : // find the first valid IR node, call visit function, and then leave
12587 0 : while ( done == false && i < SgGraphNodeList::pools.size() )
12588 : {
12589 : // objectArray[i] is a single memory pool
12590 : unsigned j=0;
12591 0 : while (done == false && j < SgGraphNodeList::pool_size)
12592 : {
12593 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
12594 : {
12595 0 : traversal.visit(&(objectArray[i][j]));
12596 0 : done = true;
12597 : }
12598 0 : j++;
12599 : }
12600 0 : i++;
12601 : }
12602 :
12603 : #if 0
12604 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
12605 : if (done == false)
12606 : {
12607 : printf ("No representative for SgGraphNodeList found in memory pools \n");
12608 : }
12609 : #endif
12610 : }
12611 0 : }
12612 :
12613 :
12614 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
12615 : // using values that overflow signed values of int.
12616 : size_t
12617 4 : SgGraphNodeList::numberOfNodes()
12618 : {
12619 : // This function traverses the memory pool for an IR node and
12620 : // counts the number of IR nodes of a particular Sage III IR
12621 : // nodes type.
12622 :
12623 4 : size_t count = 0;
12624 4 : if (SgGraphNodeList::pools.empty() == false)
12625 : {
12626 : // Generate an array of memory pools (this is actually a STL vector,
12627 : // but it is contiguious, so OK to treat this way).
12628 0 : SgGraphNodeList** objectArray = (SgGraphNodeList**) &(SgGraphNodeList::pools[0]);
12629 :
12630 : // Build a local variable for better performance (make it a loop invariant variable).
12631 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
12632 :
12633 : // Iterate over all of the memory pools for this IR node.
12634 0 : for (unsigned int i=0; i < SgGraphNodeList::pools.size(); i++)
12635 : {
12636 : // objectArray[i] is a single memory pool, iterate over all the
12637 : // IR nodes and only count those that are valid IR nodes used in
12638 : // the AST (i.e. allocated IR nodes).
12639 0 : for (unsigned j=0; j < SgGraphNodeList::pool_size; j++)
12640 : {
12641 : // This is indexing the STL vector of C/C++ style arrays as a doubly
12642 : // indexed array access. It is OK since we have leveraged the semantics
12643 : // of STL vector memory as contigous and cast the memory as an array
12644 : // of arrays to use the 2D array indexing. Hope this is not confusing,
12645 : // but it s very fast as an implementation.
12646 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
12647 : {
12648 0 : count++;
12649 : }
12650 : }
12651 : }
12652 : }
12653 :
12654 :
12655 :
12656 4 : return count;
12657 : }
12658 :
12659 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
12660 : // using values that overflow signed values of int.
12661 : size_t
12662 0 : SgGraphNodeList::memoryUsage()
12663 : {
12664 : // This function is required because we need the class name as a type when we call sizeof
12665 : // There might be another way to implement this if we have a traversal that only called a
12666 : // representative object (one call for each type of Sage IIIIR node).
12667 0 : size_t memory = numberOfNodes() * sizeof(SgGraphNodeList);
12668 :
12669 0 : return memory;
12670 : }
12671 :
12672 : /* #line 12673 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
12673 :
12674 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
12675 : void
12676 5342 : SgGraphEdgeList::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
12677 : {
12678 : // This function traverses the memory pool for only a specific IR node
12679 : // and calls the visit function of the input class execute a traversal
12680 : // similar to the style of the attribute based traversals within ROSE.
12681 : // This traversal will visit ALL nodes of the AST where as the other
12682 : // attribute based traversals visit only the embedded tree within the AST.
12683 :
12684 : // Initialize array to the address of the first element of the STL vector
12685 : // (which is guaranteed to be contiguous storage).
12686 : // SgGraphEdgeList objectArray [] = *(Memory_Block_List.begin());
12687 5342 : if (SgGraphEdgeList::pools.empty() == false)
12688 : {
12689 : // Generate an array of memory pools
12690 0 : SgGraphEdgeList** objectArray = (SgGraphEdgeList**) &(SgGraphEdgeList::pools[0]);
12691 :
12692 : // Build a local variable for better performance
12693 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
12694 : #if 0
12695 : // Iterate over the memory pools
12696 : for (unsigned int i=0; i < SgGraphEdgeList::pools.size(); i++)
12697 : {
12698 : // objectArray[i] is a single memory pool
12699 : for (int j=0; j < SgGraphEdgeList::pool_size; j++)
12700 : {
12701 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
12702 : {
12703 : traversal.visit(&(objectArray[i][j]));
12704 : }
12705 : }
12706 : }
12707 : #else
12708 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
12709 : // compute the list first and then call the visit function on each list element.
12710 :
12711 : // printf ("Inside of SgGraphEdgeList::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
12712 :
12713 0 : std::vector<SgGraphEdgeList*> nodeList;
12714 :
12715 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
12716 0 : for (unsigned int i=0; i < SgGraphEdgeList::pools.size(); i++)
12717 : {
12718 : // objectArray[i] is a single memory pool
12719 0 : for (unsigned j=0; j < SgGraphEdgeList::pool_size; j++)
12720 : {
12721 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
12722 : {
12723 0 : nodeList.push_back(&(objectArray[i][j]));
12724 : }
12725 : }
12726 : }
12727 :
12728 : // Iterate over the saved list
12729 0 : size_t nodeListSize = nodeList.size();
12730 0 : for (size_t i=0; i < nodeListSize; i++)
12731 : {
12732 0 : ROSE_ASSERT(nodeList[i] != NULL);
12733 : #if 0
12734 : traversal.visit(nodeList[i]);
12735 : #else
12736 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
12737 : {
12738 0 : traversal.visit(nodeList[i]);
12739 : }
12740 : #endif
12741 : }
12742 : #endif
12743 : }
12744 :
12745 : // This should not be required since all previously static data members are
12746 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
12747 :
12748 5342 : }
12749 :
12750 :
12751 : void
12752 194 : SgGraphEdgeList::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
12753 : {
12754 : // This function traverses the memory pool for an IR node and
12755 : // calls the function to execute the visitor object.
12756 :
12757 : // Initialize array to the address of the first element of the STL vector
12758 : // (which is guarenteed to be contiguous storage).
12759 : // SgGraphEdgeList objectArray [] = *(Memory_Block_List.begin());
12760 194 : if (SgGraphEdgeList::pools.empty() == false)
12761 : {
12762 : // Generate an array of memory pools
12763 0 : SgGraphEdgeList** objectArray = (SgGraphEdgeList**) &(SgGraphEdgeList::pools[0]);
12764 :
12765 : // Build a local variable for better performance
12766 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
12767 :
12768 : // Iterate over the memory pools
12769 0 : for (unsigned int i=0; i < SgGraphEdgeList::pools.size(); i++)
12770 : {
12771 : // objectArray[i] is a single memory pool
12772 0 : for (unsigned j=0; j < SgGraphEdgeList::pool_size; j++)
12773 : {
12774 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
12775 : {
12776 : // printf ("Found a valid SgGraphEdgeList object in the memory pool %d at position %d \n",i,j);
12777 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
12778 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
12779 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
12780 : }
12781 : else
12782 : {
12783 : // printf ("Found a INVALID SgGraphEdgeList object in the memory pool \n");
12784 : }
12785 : }
12786 : }
12787 : }
12788 :
12789 : // This should not be required since all previously static data members are
12790 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
12791 :
12792 194 : }
12793 :
12794 : void
12795 0 : SgGraphEdgeList::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
12796 : {
12797 : // This function visits only a single IR node of the memory pool.
12798 : // it is typically called once for each type of IR node within
12799 : // the automatically generated function: traverseRepresentativeNodes().
12800 :
12801 : // Initialize array to the address of the first element of the STL vector
12802 : // (which is guarenteed to be contiguous storage).
12803 : // SgGraphEdgeList objectArray [] = *(Memory_Block_List.begin());
12804 0 : if (SgGraphEdgeList::pools.empty() == false)
12805 : {
12806 : // Generate an array of memory pools
12807 0 : SgGraphEdgeList** objectArray = (SgGraphEdgeList**) &(SgGraphEdgeList::pools[0]);
12808 :
12809 : // Build a local variable for better performance
12810 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
12811 :
12812 : // Iterate over the memory pools
12813 0 : bool done = false;
12814 0 : unsigned i=0;
12815 :
12816 : // find the first valid IR node, call visit function, and then leave
12817 0 : while ( done == false && i < SgGraphEdgeList::pools.size() )
12818 : {
12819 : // objectArray[i] is a single memory pool
12820 : unsigned j=0;
12821 0 : while (done == false && j < SgGraphEdgeList::pool_size)
12822 : {
12823 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
12824 : {
12825 0 : traversal.visit(&(objectArray[i][j]));
12826 0 : done = true;
12827 : }
12828 0 : j++;
12829 : }
12830 0 : i++;
12831 : }
12832 :
12833 : #if 0
12834 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
12835 : if (done == false)
12836 : {
12837 : printf ("No representative for SgGraphEdgeList found in memory pools \n");
12838 : }
12839 : #endif
12840 : }
12841 0 : }
12842 :
12843 :
12844 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
12845 : // using values that overflow signed values of int.
12846 : size_t
12847 4 : SgGraphEdgeList::numberOfNodes()
12848 : {
12849 : // This function traverses the memory pool for an IR node and
12850 : // counts the number of IR nodes of a particular Sage III IR
12851 : // nodes type.
12852 :
12853 4 : size_t count = 0;
12854 4 : if (SgGraphEdgeList::pools.empty() == false)
12855 : {
12856 : // Generate an array of memory pools (this is actually a STL vector,
12857 : // but it is contiguious, so OK to treat this way).
12858 0 : SgGraphEdgeList** objectArray = (SgGraphEdgeList**) &(SgGraphEdgeList::pools[0]);
12859 :
12860 : // Build a local variable for better performance (make it a loop invariant variable).
12861 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
12862 :
12863 : // Iterate over all of the memory pools for this IR node.
12864 0 : for (unsigned int i=0; i < SgGraphEdgeList::pools.size(); i++)
12865 : {
12866 : // objectArray[i] is a single memory pool, iterate over all the
12867 : // IR nodes and only count those that are valid IR nodes used in
12868 : // the AST (i.e. allocated IR nodes).
12869 0 : for (unsigned j=0; j < SgGraphEdgeList::pool_size; j++)
12870 : {
12871 : // This is indexing the STL vector of C/C++ style arrays as a doubly
12872 : // indexed array access. It is OK since we have leveraged the semantics
12873 : // of STL vector memory as contigous and cast the memory as an array
12874 : // of arrays to use the 2D array indexing. Hope this is not confusing,
12875 : // but it s very fast as an implementation.
12876 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
12877 : {
12878 0 : count++;
12879 : }
12880 : }
12881 : }
12882 : }
12883 :
12884 :
12885 :
12886 4 : return count;
12887 : }
12888 :
12889 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
12890 : // using values that overflow signed values of int.
12891 : size_t
12892 0 : SgGraphEdgeList::memoryUsage()
12893 : {
12894 : // This function is required because we need the class name as a type when we call sizeof
12895 : // There might be another way to implement this if we have a traversal that only called a
12896 : // representative object (one call for each type of Sage IIIIR node).
12897 0 : size_t memory = numberOfNodes() * sizeof(SgGraphEdgeList);
12898 :
12899 0 : return memory;
12900 : }
12901 :
12902 : /* #line 12903 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
12903 :
12904 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
12905 : void
12906 5342 : SgTypeTable::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
12907 : {
12908 : // This function traverses the memory pool for only a specific IR node
12909 : // and calls the visit function of the input class execute a traversal
12910 : // similar to the style of the attribute based traversals within ROSE.
12911 : // This traversal will visit ALL nodes of the AST where as the other
12912 : // attribute based traversals visit only the embedded tree within the AST.
12913 :
12914 : // Initialize array to the address of the first element of the STL vector
12915 : // (which is guaranteed to be contiguous storage).
12916 : // SgTypeTable objectArray [] = *(Memory_Block_List.begin());
12917 5342 : if (SgTypeTable::pools.empty() == false)
12918 : {
12919 : // Generate an array of memory pools
12920 5342 : SgTypeTable** objectArray = (SgTypeTable**) &(SgTypeTable::pools[0]);
12921 :
12922 : // Build a local variable for better performance
12923 5342 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
12924 : #if 0
12925 : // Iterate over the memory pools
12926 : for (unsigned int i=0; i < SgTypeTable::pools.size(); i++)
12927 : {
12928 : // objectArray[i] is a single memory pool
12929 : for (int j=0; j < SgTypeTable::pool_size; j++)
12930 : {
12931 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
12932 : {
12933 : traversal.visit(&(objectArray[i][j]));
12934 : }
12935 : }
12936 : }
12937 : #else
12938 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
12939 : // compute the list first and then call the visit function on each list element.
12940 :
12941 : // printf ("Inside of SgTypeTable::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
12942 :
12943 10684 : std::vector<SgTypeTable*> nodeList;
12944 :
12945 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
12946 11475 : for (unsigned int i=0; i < SgTypeTable::pools.size(); i++)
12947 : {
12948 : // objectArray[i] is a single memory pool
12949 12272100 : for (unsigned j=0; j < SgTypeTable::pool_size; j++)
12950 : {
12951 12266000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
12952 : {
12953 1930080 : nodeList.push_back(&(objectArray[i][j]));
12954 : }
12955 : }
12956 : }
12957 :
12958 : // Iterate over the saved list
12959 5342 : size_t nodeListSize = nodeList.size();
12960 1935420 : for (size_t i=0; i < nodeListSize; i++)
12961 : {
12962 1930080 : ROSE_ASSERT(nodeList[i] != NULL);
12963 : #if 0
12964 : traversal.visit(nodeList[i]);
12965 : #else
12966 1930080 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
12967 : {
12968 1930080 : traversal.visit(nodeList[i]);
12969 : }
12970 : #endif
12971 : }
12972 : #endif
12973 : }
12974 :
12975 : // This should not be required since all previously static data members are
12976 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
12977 :
12978 5342 : }
12979 :
12980 :
12981 : void
12982 194 : SgTypeTable::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
12983 : {
12984 : // This function traverses the memory pool for an IR node and
12985 : // calls the function to execute the visitor object.
12986 :
12987 : // Initialize array to the address of the first element of the STL vector
12988 : // (which is guarenteed to be contiguous storage).
12989 : // SgTypeTable objectArray [] = *(Memory_Block_List.begin());
12990 194 : if (SgTypeTable::pools.empty() == false)
12991 : {
12992 : // Generate an array of memory pools
12993 194 : SgTypeTable** objectArray = (SgTypeTable**) &(SgTypeTable::pools[0]);
12994 :
12995 : // Build a local variable for better performance
12996 194 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
12997 :
12998 : // Iterate over the memory pools
12999 1228 : for (unsigned int i=0; i < SgTypeTable::pools.size(); i++)
13000 : {
13001 : // objectArray[i] is a single memory pool
13002 2069030 : for (unsigned j=0; j < SgTypeTable::pool_size; j++)
13003 : {
13004 2068000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
13005 : {
13006 : // printf ("Found a valid SgTypeTable object in the memory pool %d at position %d \n",i,j);
13007 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
13008 1875170 : objectArray[i][j].executeVisitorMemberFunction(visitor);
13009 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
13010 : }
13011 : else
13012 : {
13013 : // printf ("Found a INVALID SgTypeTable object in the memory pool \n");
13014 : }
13015 : }
13016 : }
13017 : }
13018 :
13019 : // This should not be required since all previously static data members are
13020 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
13021 :
13022 194 : }
13023 :
13024 : void
13025 0 : SgTypeTable::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
13026 : {
13027 : // This function visits only a single IR node of the memory pool.
13028 : // it is typically called once for each type of IR node within
13029 : // the automatically generated function: traverseRepresentativeNodes().
13030 :
13031 : // Initialize array to the address of the first element of the STL vector
13032 : // (which is guarenteed to be contiguous storage).
13033 : // SgTypeTable objectArray [] = *(Memory_Block_List.begin());
13034 0 : if (SgTypeTable::pools.empty() == false)
13035 : {
13036 : // Generate an array of memory pools
13037 0 : SgTypeTable** objectArray = (SgTypeTable**) &(SgTypeTable::pools[0]);
13038 :
13039 : // Build a local variable for better performance
13040 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
13041 :
13042 : // Iterate over the memory pools
13043 0 : bool done = false;
13044 0 : unsigned i=0;
13045 :
13046 : // find the first valid IR node, call visit function, and then leave
13047 0 : while ( done == false && i < SgTypeTable::pools.size() )
13048 : {
13049 : // objectArray[i] is a single memory pool
13050 : unsigned j=0;
13051 0 : while (done == false && j < SgTypeTable::pool_size)
13052 : {
13053 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
13054 : {
13055 0 : traversal.visit(&(objectArray[i][j]));
13056 0 : done = true;
13057 : }
13058 0 : j++;
13059 : }
13060 0 : i++;
13061 : }
13062 :
13063 : #if 0
13064 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
13065 : if (done == false)
13066 : {
13067 : printf ("No representative for SgTypeTable found in memory pools \n");
13068 : }
13069 : #endif
13070 : }
13071 0 : }
13072 :
13073 :
13074 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
13075 : // using values that overflow signed values of int.
13076 : size_t
13077 4 : SgTypeTable::numberOfNodes()
13078 : {
13079 : // This function traverses the memory pool for an IR node and
13080 : // counts the number of IR nodes of a particular Sage III IR
13081 : // nodes type.
13082 :
13083 4 : size_t count = 0;
13084 4 : if (SgTypeTable::pools.empty() == false)
13085 : {
13086 : // Generate an array of memory pools (this is actually a STL vector,
13087 : // but it is contiguious, so OK to treat this way).
13088 4 : SgTypeTable** objectArray = (SgTypeTable**) &(SgTypeTable::pools[0]);
13089 :
13090 : // Build a local variable for better performance (make it a loop invariant variable).
13091 4 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
13092 :
13093 : // Iterate over all of the memory pools for this IR node.
13094 14 : for (unsigned int i=0; i < SgTypeTable::pools.size(); i++)
13095 : {
13096 : // objectArray[i] is a single memory pool, iterate over all the
13097 : // IR nodes and only count those that are valid IR nodes used in
13098 : // the AST (i.e. allocated IR nodes).
13099 20010 : for (unsigned j=0; j < SgTypeTable::pool_size; j++)
13100 : {
13101 : // This is indexing the STL vector of C/C++ style arrays as a doubly
13102 : // indexed array access. It is OK since we have leveraged the semantics
13103 : // of STL vector memory as contigous and cast the memory as an array
13104 : // of arrays to use the 2D array indexing. Hope this is not confusing,
13105 : // but it s very fast as an implementation.
13106 20000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
13107 : {
13108 13468 : count++;
13109 : }
13110 : }
13111 : }
13112 : }
13113 :
13114 :
13115 :
13116 4 : return count;
13117 : }
13118 :
13119 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
13120 : // using values that overflow signed values of int.
13121 : size_t
13122 0 : SgTypeTable::memoryUsage()
13123 : {
13124 : // This function is required because we need the class name as a type when we call sizeof
13125 : // There might be another way to implement this if we have a traversal that only called a
13126 : // representative object (one call for each type of Sage IIIIR node).
13127 0 : size_t memory = numberOfNodes() * sizeof(SgTypeTable);
13128 :
13129 0 : return memory;
13130 : }
13131 :
13132 : /* #line 13133 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
13133 :
13134 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
13135 : void
13136 5342 : SgNameGroup::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
13137 : {
13138 : // This function traverses the memory pool for only a specific IR node
13139 : // and calls the visit function of the input class execute a traversal
13140 : // similar to the style of the attribute based traversals within ROSE.
13141 : // This traversal will visit ALL nodes of the AST where as the other
13142 : // attribute based traversals visit only the embedded tree within the AST.
13143 :
13144 : // Initialize array to the address of the first element of the STL vector
13145 : // (which is guaranteed to be contiguous storage).
13146 : // SgNameGroup objectArray [] = *(Memory_Block_List.begin());
13147 5342 : if (SgNameGroup::pools.empty() == false)
13148 : {
13149 : // Generate an array of memory pools
13150 0 : SgNameGroup** objectArray = (SgNameGroup**) &(SgNameGroup::pools[0]);
13151 :
13152 : // Build a local variable for better performance
13153 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
13154 : #if 0
13155 : // Iterate over the memory pools
13156 : for (unsigned int i=0; i < SgNameGroup::pools.size(); i++)
13157 : {
13158 : // objectArray[i] is a single memory pool
13159 : for (int j=0; j < SgNameGroup::pool_size; j++)
13160 : {
13161 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
13162 : {
13163 : traversal.visit(&(objectArray[i][j]));
13164 : }
13165 : }
13166 : }
13167 : #else
13168 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
13169 : // compute the list first and then call the visit function on each list element.
13170 :
13171 : // printf ("Inside of SgNameGroup::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
13172 :
13173 0 : std::vector<SgNameGroup*> nodeList;
13174 :
13175 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
13176 0 : for (unsigned int i=0; i < SgNameGroup::pools.size(); i++)
13177 : {
13178 : // objectArray[i] is a single memory pool
13179 0 : for (unsigned j=0; j < SgNameGroup::pool_size; j++)
13180 : {
13181 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
13182 : {
13183 0 : nodeList.push_back(&(objectArray[i][j]));
13184 : }
13185 : }
13186 : }
13187 :
13188 : // Iterate over the saved list
13189 0 : size_t nodeListSize = nodeList.size();
13190 0 : for (size_t i=0; i < nodeListSize; i++)
13191 : {
13192 0 : ROSE_ASSERT(nodeList[i] != NULL);
13193 : #if 0
13194 : traversal.visit(nodeList[i]);
13195 : #else
13196 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
13197 : {
13198 0 : traversal.visit(nodeList[i]);
13199 : }
13200 : #endif
13201 : }
13202 : #endif
13203 : }
13204 :
13205 : // This should not be required since all previously static data members are
13206 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
13207 :
13208 5342 : }
13209 :
13210 :
13211 : void
13212 194 : SgNameGroup::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
13213 : {
13214 : // This function traverses the memory pool for an IR node and
13215 : // calls the function to execute the visitor object.
13216 :
13217 : // Initialize array to the address of the first element of the STL vector
13218 : // (which is guarenteed to be contiguous storage).
13219 : // SgNameGroup objectArray [] = *(Memory_Block_List.begin());
13220 194 : if (SgNameGroup::pools.empty() == false)
13221 : {
13222 : // Generate an array of memory pools
13223 0 : SgNameGroup** objectArray = (SgNameGroup**) &(SgNameGroup::pools[0]);
13224 :
13225 : // Build a local variable for better performance
13226 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
13227 :
13228 : // Iterate over the memory pools
13229 0 : for (unsigned int i=0; i < SgNameGroup::pools.size(); i++)
13230 : {
13231 : // objectArray[i] is a single memory pool
13232 0 : for (unsigned j=0; j < SgNameGroup::pool_size; j++)
13233 : {
13234 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
13235 : {
13236 : // printf ("Found a valid SgNameGroup object in the memory pool %d at position %d \n",i,j);
13237 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
13238 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
13239 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
13240 : }
13241 : else
13242 : {
13243 : // printf ("Found a INVALID SgNameGroup object in the memory pool \n");
13244 : }
13245 : }
13246 : }
13247 : }
13248 :
13249 : // This should not be required since all previously static data members are
13250 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
13251 :
13252 194 : }
13253 :
13254 : void
13255 0 : SgNameGroup::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
13256 : {
13257 : // This function visits only a single IR node of the memory pool.
13258 : // it is typically called once for each type of IR node within
13259 : // the automatically generated function: traverseRepresentativeNodes().
13260 :
13261 : // Initialize array to the address of the first element of the STL vector
13262 : // (which is guarenteed to be contiguous storage).
13263 : // SgNameGroup objectArray [] = *(Memory_Block_List.begin());
13264 0 : if (SgNameGroup::pools.empty() == false)
13265 : {
13266 : // Generate an array of memory pools
13267 0 : SgNameGroup** objectArray = (SgNameGroup**) &(SgNameGroup::pools[0]);
13268 :
13269 : // Build a local variable for better performance
13270 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
13271 :
13272 : // Iterate over the memory pools
13273 0 : bool done = false;
13274 0 : unsigned i=0;
13275 :
13276 : // find the first valid IR node, call visit function, and then leave
13277 0 : while ( done == false && i < SgNameGroup::pools.size() )
13278 : {
13279 : // objectArray[i] is a single memory pool
13280 : unsigned j=0;
13281 0 : while (done == false && j < SgNameGroup::pool_size)
13282 : {
13283 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
13284 : {
13285 0 : traversal.visit(&(objectArray[i][j]));
13286 0 : done = true;
13287 : }
13288 0 : j++;
13289 : }
13290 0 : i++;
13291 : }
13292 :
13293 : #if 0
13294 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
13295 : if (done == false)
13296 : {
13297 : printf ("No representative for SgNameGroup found in memory pools \n");
13298 : }
13299 : #endif
13300 : }
13301 0 : }
13302 :
13303 :
13304 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
13305 : // using values that overflow signed values of int.
13306 : size_t
13307 4 : SgNameGroup::numberOfNodes()
13308 : {
13309 : // This function traverses the memory pool for an IR node and
13310 : // counts the number of IR nodes of a particular Sage III IR
13311 : // nodes type.
13312 :
13313 4 : size_t count = 0;
13314 4 : if (SgNameGroup::pools.empty() == false)
13315 : {
13316 : // Generate an array of memory pools (this is actually a STL vector,
13317 : // but it is contiguious, so OK to treat this way).
13318 0 : SgNameGroup** objectArray = (SgNameGroup**) &(SgNameGroup::pools[0]);
13319 :
13320 : // Build a local variable for better performance (make it a loop invariant variable).
13321 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
13322 :
13323 : // Iterate over all of the memory pools for this IR node.
13324 0 : for (unsigned int i=0; i < SgNameGroup::pools.size(); i++)
13325 : {
13326 : // objectArray[i] is a single memory pool, iterate over all the
13327 : // IR nodes and only count those that are valid IR nodes used in
13328 : // the AST (i.e. allocated IR nodes).
13329 0 : for (unsigned j=0; j < SgNameGroup::pool_size; j++)
13330 : {
13331 : // This is indexing the STL vector of C/C++ style arrays as a doubly
13332 : // indexed array access. It is OK since we have leveraged the semantics
13333 : // of STL vector memory as contigous and cast the memory as an array
13334 : // of arrays to use the 2D array indexing. Hope this is not confusing,
13335 : // but it s very fast as an implementation.
13336 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
13337 : {
13338 0 : count++;
13339 : }
13340 : }
13341 : }
13342 : }
13343 :
13344 :
13345 :
13346 4 : return count;
13347 : }
13348 :
13349 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
13350 : // using values that overflow signed values of int.
13351 : size_t
13352 0 : SgNameGroup::memoryUsage()
13353 : {
13354 : // This function is required because we need the class name as a type when we call sizeof
13355 : // There might be another way to implement this if we have a traversal that only called a
13356 : // representative object (one call for each type of Sage IIIIR node).
13357 0 : size_t memory = numberOfNodes() * sizeof(SgNameGroup);
13358 :
13359 0 : return memory;
13360 : }
13361 :
13362 : /* #line 13363 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
13363 :
13364 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
13365 : void
13366 5342 : SgDimensionObject::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
13367 : {
13368 : // This function traverses the memory pool for only a specific IR node
13369 : // and calls the visit function of the input class execute a traversal
13370 : // similar to the style of the attribute based traversals within ROSE.
13371 : // This traversal will visit ALL nodes of the AST where as the other
13372 : // attribute based traversals visit only the embedded tree within the AST.
13373 :
13374 : // Initialize array to the address of the first element of the STL vector
13375 : // (which is guaranteed to be contiguous storage).
13376 : // SgDimensionObject objectArray [] = *(Memory_Block_List.begin());
13377 5342 : if (SgDimensionObject::pools.empty() == false)
13378 : {
13379 : // Generate an array of memory pools
13380 0 : SgDimensionObject** objectArray = (SgDimensionObject**) &(SgDimensionObject::pools[0]);
13381 :
13382 : // Build a local variable for better performance
13383 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
13384 : #if 0
13385 : // Iterate over the memory pools
13386 : for (unsigned int i=0; i < SgDimensionObject::pools.size(); i++)
13387 : {
13388 : // objectArray[i] is a single memory pool
13389 : for (int j=0; j < SgDimensionObject::pool_size; j++)
13390 : {
13391 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
13392 : {
13393 : traversal.visit(&(objectArray[i][j]));
13394 : }
13395 : }
13396 : }
13397 : #else
13398 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
13399 : // compute the list first and then call the visit function on each list element.
13400 :
13401 : // printf ("Inside of SgDimensionObject::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
13402 :
13403 0 : std::vector<SgDimensionObject*> nodeList;
13404 :
13405 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
13406 0 : for (unsigned int i=0; i < SgDimensionObject::pools.size(); i++)
13407 : {
13408 : // objectArray[i] is a single memory pool
13409 0 : for (unsigned j=0; j < SgDimensionObject::pool_size; j++)
13410 : {
13411 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
13412 : {
13413 0 : nodeList.push_back(&(objectArray[i][j]));
13414 : }
13415 : }
13416 : }
13417 :
13418 : // Iterate over the saved list
13419 0 : size_t nodeListSize = nodeList.size();
13420 0 : for (size_t i=0; i < nodeListSize; i++)
13421 : {
13422 0 : ROSE_ASSERT(nodeList[i] != NULL);
13423 : #if 0
13424 : traversal.visit(nodeList[i]);
13425 : #else
13426 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
13427 : {
13428 0 : traversal.visit(nodeList[i]);
13429 : }
13430 : #endif
13431 : }
13432 : #endif
13433 : }
13434 :
13435 : // This should not be required since all previously static data members are
13436 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
13437 :
13438 5342 : }
13439 :
13440 :
13441 : void
13442 194 : SgDimensionObject::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
13443 : {
13444 : // This function traverses the memory pool for an IR node and
13445 : // calls the function to execute the visitor object.
13446 :
13447 : // Initialize array to the address of the first element of the STL vector
13448 : // (which is guarenteed to be contiguous storage).
13449 : // SgDimensionObject objectArray [] = *(Memory_Block_List.begin());
13450 194 : if (SgDimensionObject::pools.empty() == false)
13451 : {
13452 : // Generate an array of memory pools
13453 0 : SgDimensionObject** objectArray = (SgDimensionObject**) &(SgDimensionObject::pools[0]);
13454 :
13455 : // Build a local variable for better performance
13456 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
13457 :
13458 : // Iterate over the memory pools
13459 0 : for (unsigned int i=0; i < SgDimensionObject::pools.size(); i++)
13460 : {
13461 : // objectArray[i] is a single memory pool
13462 0 : for (unsigned j=0; j < SgDimensionObject::pool_size; j++)
13463 : {
13464 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
13465 : {
13466 : // printf ("Found a valid SgDimensionObject object in the memory pool %d at position %d \n",i,j);
13467 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
13468 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
13469 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
13470 : }
13471 : else
13472 : {
13473 : // printf ("Found a INVALID SgDimensionObject object in the memory pool \n");
13474 : }
13475 : }
13476 : }
13477 : }
13478 :
13479 : // This should not be required since all previously static data members are
13480 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
13481 :
13482 194 : }
13483 :
13484 : void
13485 0 : SgDimensionObject::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
13486 : {
13487 : // This function visits only a single IR node of the memory pool.
13488 : // it is typically called once for each type of IR node within
13489 : // the automatically generated function: traverseRepresentativeNodes().
13490 :
13491 : // Initialize array to the address of the first element of the STL vector
13492 : // (which is guarenteed to be contiguous storage).
13493 : // SgDimensionObject objectArray [] = *(Memory_Block_List.begin());
13494 0 : if (SgDimensionObject::pools.empty() == false)
13495 : {
13496 : // Generate an array of memory pools
13497 0 : SgDimensionObject** objectArray = (SgDimensionObject**) &(SgDimensionObject::pools[0]);
13498 :
13499 : // Build a local variable for better performance
13500 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
13501 :
13502 : // Iterate over the memory pools
13503 0 : bool done = false;
13504 0 : unsigned i=0;
13505 :
13506 : // find the first valid IR node, call visit function, and then leave
13507 0 : while ( done == false && i < SgDimensionObject::pools.size() )
13508 : {
13509 : // objectArray[i] is a single memory pool
13510 : unsigned j=0;
13511 0 : while (done == false && j < SgDimensionObject::pool_size)
13512 : {
13513 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
13514 : {
13515 0 : traversal.visit(&(objectArray[i][j]));
13516 0 : done = true;
13517 : }
13518 0 : j++;
13519 : }
13520 0 : i++;
13521 : }
13522 :
13523 : #if 0
13524 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
13525 : if (done == false)
13526 : {
13527 : printf ("No representative for SgDimensionObject found in memory pools \n");
13528 : }
13529 : #endif
13530 : }
13531 0 : }
13532 :
13533 :
13534 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
13535 : // using values that overflow signed values of int.
13536 : size_t
13537 4 : SgDimensionObject::numberOfNodes()
13538 : {
13539 : // This function traverses the memory pool for an IR node and
13540 : // counts the number of IR nodes of a particular Sage III IR
13541 : // nodes type.
13542 :
13543 4 : size_t count = 0;
13544 4 : if (SgDimensionObject::pools.empty() == false)
13545 : {
13546 : // Generate an array of memory pools (this is actually a STL vector,
13547 : // but it is contiguious, so OK to treat this way).
13548 0 : SgDimensionObject** objectArray = (SgDimensionObject**) &(SgDimensionObject::pools[0]);
13549 :
13550 : // Build a local variable for better performance (make it a loop invariant variable).
13551 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
13552 :
13553 : // Iterate over all of the memory pools for this IR node.
13554 0 : for (unsigned int i=0; i < SgDimensionObject::pools.size(); i++)
13555 : {
13556 : // objectArray[i] is a single memory pool, iterate over all the
13557 : // IR nodes and only count those that are valid IR nodes used in
13558 : // the AST (i.e. allocated IR nodes).
13559 0 : for (unsigned j=0; j < SgDimensionObject::pool_size; j++)
13560 : {
13561 : // This is indexing the STL vector of C/C++ style arrays as a doubly
13562 : // indexed array access. It is OK since we have leveraged the semantics
13563 : // of STL vector memory as contigous and cast the memory as an array
13564 : // of arrays to use the 2D array indexing. Hope this is not confusing,
13565 : // but it s very fast as an implementation.
13566 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
13567 : {
13568 0 : count++;
13569 : }
13570 : }
13571 : }
13572 : }
13573 :
13574 :
13575 :
13576 4 : return count;
13577 : }
13578 :
13579 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
13580 : // using values that overflow signed values of int.
13581 : size_t
13582 0 : SgDimensionObject::memoryUsage()
13583 : {
13584 : // This function is required because we need the class name as a type when we call sizeof
13585 : // There might be another way to implement this if we have a traversal that only called a
13586 : // representative object (one call for each type of Sage IIIIR node).
13587 0 : size_t memory = numberOfNodes() * sizeof(SgDimensionObject);
13588 :
13589 0 : return memory;
13590 : }
13591 :
13592 : /* #line 13593 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
13593 :
13594 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
13595 : void
13596 5342 : SgFormatItem::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
13597 : {
13598 : // This function traverses the memory pool for only a specific IR node
13599 : // and calls the visit function of the input class execute a traversal
13600 : // similar to the style of the attribute based traversals within ROSE.
13601 : // This traversal will visit ALL nodes of the AST where as the other
13602 : // attribute based traversals visit only the embedded tree within the AST.
13603 :
13604 : // Initialize array to the address of the first element of the STL vector
13605 : // (which is guaranteed to be contiguous storage).
13606 : // SgFormatItem objectArray [] = *(Memory_Block_List.begin());
13607 5342 : if (SgFormatItem::pools.empty() == false)
13608 : {
13609 : // Generate an array of memory pools
13610 0 : SgFormatItem** objectArray = (SgFormatItem**) &(SgFormatItem::pools[0]);
13611 :
13612 : // Build a local variable for better performance
13613 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
13614 : #if 0
13615 : // Iterate over the memory pools
13616 : for (unsigned int i=0; i < SgFormatItem::pools.size(); i++)
13617 : {
13618 : // objectArray[i] is a single memory pool
13619 : for (int j=0; j < SgFormatItem::pool_size; j++)
13620 : {
13621 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
13622 : {
13623 : traversal.visit(&(objectArray[i][j]));
13624 : }
13625 : }
13626 : }
13627 : #else
13628 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
13629 : // compute the list first and then call the visit function on each list element.
13630 :
13631 : // printf ("Inside of SgFormatItem::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
13632 :
13633 0 : std::vector<SgFormatItem*> nodeList;
13634 :
13635 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
13636 0 : for (unsigned int i=0; i < SgFormatItem::pools.size(); i++)
13637 : {
13638 : // objectArray[i] is a single memory pool
13639 0 : for (unsigned j=0; j < SgFormatItem::pool_size; j++)
13640 : {
13641 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
13642 : {
13643 0 : nodeList.push_back(&(objectArray[i][j]));
13644 : }
13645 : }
13646 : }
13647 :
13648 : // Iterate over the saved list
13649 0 : size_t nodeListSize = nodeList.size();
13650 0 : for (size_t i=0; i < nodeListSize; i++)
13651 : {
13652 0 : ROSE_ASSERT(nodeList[i] != NULL);
13653 : #if 0
13654 : traversal.visit(nodeList[i]);
13655 : #else
13656 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
13657 : {
13658 0 : traversal.visit(nodeList[i]);
13659 : }
13660 : #endif
13661 : }
13662 : #endif
13663 : }
13664 :
13665 : // This should not be required since all previously static data members are
13666 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
13667 :
13668 5342 : }
13669 :
13670 :
13671 : void
13672 194 : SgFormatItem::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
13673 : {
13674 : // This function traverses the memory pool for an IR node and
13675 : // calls the function to execute the visitor object.
13676 :
13677 : // Initialize array to the address of the first element of the STL vector
13678 : // (which is guarenteed to be contiguous storage).
13679 : // SgFormatItem objectArray [] = *(Memory_Block_List.begin());
13680 194 : if (SgFormatItem::pools.empty() == false)
13681 : {
13682 : // Generate an array of memory pools
13683 0 : SgFormatItem** objectArray = (SgFormatItem**) &(SgFormatItem::pools[0]);
13684 :
13685 : // Build a local variable for better performance
13686 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
13687 :
13688 : // Iterate over the memory pools
13689 0 : for (unsigned int i=0; i < SgFormatItem::pools.size(); i++)
13690 : {
13691 : // objectArray[i] is a single memory pool
13692 0 : for (unsigned j=0; j < SgFormatItem::pool_size; j++)
13693 : {
13694 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
13695 : {
13696 : // printf ("Found a valid SgFormatItem object in the memory pool %d at position %d \n",i,j);
13697 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
13698 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
13699 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
13700 : }
13701 : else
13702 : {
13703 : // printf ("Found a INVALID SgFormatItem object in the memory pool \n");
13704 : }
13705 : }
13706 : }
13707 : }
13708 :
13709 : // This should not be required since all previously static data members are
13710 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
13711 :
13712 194 : }
13713 :
13714 : void
13715 0 : SgFormatItem::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
13716 : {
13717 : // This function visits only a single IR node of the memory pool.
13718 : // it is typically called once for each type of IR node within
13719 : // the automatically generated function: traverseRepresentativeNodes().
13720 :
13721 : // Initialize array to the address of the first element of the STL vector
13722 : // (which is guarenteed to be contiguous storage).
13723 : // SgFormatItem objectArray [] = *(Memory_Block_List.begin());
13724 0 : if (SgFormatItem::pools.empty() == false)
13725 : {
13726 : // Generate an array of memory pools
13727 0 : SgFormatItem** objectArray = (SgFormatItem**) &(SgFormatItem::pools[0]);
13728 :
13729 : // Build a local variable for better performance
13730 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
13731 :
13732 : // Iterate over the memory pools
13733 0 : bool done = false;
13734 0 : unsigned i=0;
13735 :
13736 : // find the first valid IR node, call visit function, and then leave
13737 0 : while ( done == false && i < SgFormatItem::pools.size() )
13738 : {
13739 : // objectArray[i] is a single memory pool
13740 : unsigned j=0;
13741 0 : while (done == false && j < SgFormatItem::pool_size)
13742 : {
13743 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
13744 : {
13745 0 : traversal.visit(&(objectArray[i][j]));
13746 0 : done = true;
13747 : }
13748 0 : j++;
13749 : }
13750 0 : i++;
13751 : }
13752 :
13753 : #if 0
13754 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
13755 : if (done == false)
13756 : {
13757 : printf ("No representative for SgFormatItem found in memory pools \n");
13758 : }
13759 : #endif
13760 : }
13761 0 : }
13762 :
13763 :
13764 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
13765 : // using values that overflow signed values of int.
13766 : size_t
13767 4 : SgFormatItem::numberOfNodes()
13768 : {
13769 : // This function traverses the memory pool for an IR node and
13770 : // counts the number of IR nodes of a particular Sage III IR
13771 : // nodes type.
13772 :
13773 4 : size_t count = 0;
13774 4 : if (SgFormatItem::pools.empty() == false)
13775 : {
13776 : // Generate an array of memory pools (this is actually a STL vector,
13777 : // but it is contiguious, so OK to treat this way).
13778 0 : SgFormatItem** objectArray = (SgFormatItem**) &(SgFormatItem::pools[0]);
13779 :
13780 : // Build a local variable for better performance (make it a loop invariant variable).
13781 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
13782 :
13783 : // Iterate over all of the memory pools for this IR node.
13784 0 : for (unsigned int i=0; i < SgFormatItem::pools.size(); i++)
13785 : {
13786 : // objectArray[i] is a single memory pool, iterate over all the
13787 : // IR nodes and only count those that are valid IR nodes used in
13788 : // the AST (i.e. allocated IR nodes).
13789 0 : for (unsigned j=0; j < SgFormatItem::pool_size; j++)
13790 : {
13791 : // This is indexing the STL vector of C/C++ style arrays as a doubly
13792 : // indexed array access. It is OK since we have leveraged the semantics
13793 : // of STL vector memory as contigous and cast the memory as an array
13794 : // of arrays to use the 2D array indexing. Hope this is not confusing,
13795 : // but it s very fast as an implementation.
13796 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
13797 : {
13798 0 : count++;
13799 : }
13800 : }
13801 : }
13802 : }
13803 :
13804 :
13805 :
13806 4 : return count;
13807 : }
13808 :
13809 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
13810 : // using values that overflow signed values of int.
13811 : size_t
13812 0 : SgFormatItem::memoryUsage()
13813 : {
13814 : // This function is required because we need the class name as a type when we call sizeof
13815 : // There might be another way to implement this if we have a traversal that only called a
13816 : // representative object (one call for each type of Sage IIIIR node).
13817 0 : size_t memory = numberOfNodes() * sizeof(SgFormatItem);
13818 :
13819 0 : return memory;
13820 : }
13821 :
13822 : /* #line 13823 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
13823 :
13824 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
13825 : void
13826 5342 : SgFormatItemList::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
13827 : {
13828 : // This function traverses the memory pool for only a specific IR node
13829 : // and calls the visit function of the input class execute a traversal
13830 : // similar to the style of the attribute based traversals within ROSE.
13831 : // This traversal will visit ALL nodes of the AST where as the other
13832 : // attribute based traversals visit only the embedded tree within the AST.
13833 :
13834 : // Initialize array to the address of the first element of the STL vector
13835 : // (which is guaranteed to be contiguous storage).
13836 : // SgFormatItemList objectArray [] = *(Memory_Block_List.begin());
13837 5342 : if (SgFormatItemList::pools.empty() == false)
13838 : {
13839 : // Generate an array of memory pools
13840 0 : SgFormatItemList** objectArray = (SgFormatItemList**) &(SgFormatItemList::pools[0]);
13841 :
13842 : // Build a local variable for better performance
13843 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
13844 : #if 0
13845 : // Iterate over the memory pools
13846 : for (unsigned int i=0; i < SgFormatItemList::pools.size(); i++)
13847 : {
13848 : // objectArray[i] is a single memory pool
13849 : for (int j=0; j < SgFormatItemList::pool_size; j++)
13850 : {
13851 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
13852 : {
13853 : traversal.visit(&(objectArray[i][j]));
13854 : }
13855 : }
13856 : }
13857 : #else
13858 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
13859 : // compute the list first and then call the visit function on each list element.
13860 :
13861 : // printf ("Inside of SgFormatItemList::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
13862 :
13863 0 : std::vector<SgFormatItemList*> nodeList;
13864 :
13865 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
13866 0 : for (unsigned int i=0; i < SgFormatItemList::pools.size(); i++)
13867 : {
13868 : // objectArray[i] is a single memory pool
13869 0 : for (unsigned j=0; j < SgFormatItemList::pool_size; j++)
13870 : {
13871 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
13872 : {
13873 0 : nodeList.push_back(&(objectArray[i][j]));
13874 : }
13875 : }
13876 : }
13877 :
13878 : // Iterate over the saved list
13879 0 : size_t nodeListSize = nodeList.size();
13880 0 : for (size_t i=0; i < nodeListSize; i++)
13881 : {
13882 0 : ROSE_ASSERT(nodeList[i] != NULL);
13883 : #if 0
13884 : traversal.visit(nodeList[i]);
13885 : #else
13886 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
13887 : {
13888 0 : traversal.visit(nodeList[i]);
13889 : }
13890 : #endif
13891 : }
13892 : #endif
13893 : }
13894 :
13895 : // This should not be required since all previously static data members are
13896 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
13897 :
13898 5342 : }
13899 :
13900 :
13901 : void
13902 194 : SgFormatItemList::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
13903 : {
13904 : // This function traverses the memory pool for an IR node and
13905 : // calls the function to execute the visitor object.
13906 :
13907 : // Initialize array to the address of the first element of the STL vector
13908 : // (which is guarenteed to be contiguous storage).
13909 : // SgFormatItemList objectArray [] = *(Memory_Block_List.begin());
13910 194 : if (SgFormatItemList::pools.empty() == false)
13911 : {
13912 : // Generate an array of memory pools
13913 0 : SgFormatItemList** objectArray = (SgFormatItemList**) &(SgFormatItemList::pools[0]);
13914 :
13915 : // Build a local variable for better performance
13916 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
13917 :
13918 : // Iterate over the memory pools
13919 0 : for (unsigned int i=0; i < SgFormatItemList::pools.size(); i++)
13920 : {
13921 : // objectArray[i] is a single memory pool
13922 0 : for (unsigned j=0; j < SgFormatItemList::pool_size; j++)
13923 : {
13924 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
13925 : {
13926 : // printf ("Found a valid SgFormatItemList object in the memory pool %d at position %d \n",i,j);
13927 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
13928 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
13929 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
13930 : }
13931 : else
13932 : {
13933 : // printf ("Found a INVALID SgFormatItemList object in the memory pool \n");
13934 : }
13935 : }
13936 : }
13937 : }
13938 :
13939 : // This should not be required since all previously static data members are
13940 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
13941 :
13942 194 : }
13943 :
13944 : void
13945 0 : SgFormatItemList::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
13946 : {
13947 : // This function visits only a single IR node of the memory pool.
13948 : // it is typically called once for each type of IR node within
13949 : // the automatically generated function: traverseRepresentativeNodes().
13950 :
13951 : // Initialize array to the address of the first element of the STL vector
13952 : // (which is guarenteed to be contiguous storage).
13953 : // SgFormatItemList objectArray [] = *(Memory_Block_List.begin());
13954 0 : if (SgFormatItemList::pools.empty() == false)
13955 : {
13956 : // Generate an array of memory pools
13957 0 : SgFormatItemList** objectArray = (SgFormatItemList**) &(SgFormatItemList::pools[0]);
13958 :
13959 : // Build a local variable for better performance
13960 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
13961 :
13962 : // Iterate over the memory pools
13963 0 : bool done = false;
13964 0 : unsigned i=0;
13965 :
13966 : // find the first valid IR node, call visit function, and then leave
13967 0 : while ( done == false && i < SgFormatItemList::pools.size() )
13968 : {
13969 : // objectArray[i] is a single memory pool
13970 : unsigned j=0;
13971 0 : while (done == false && j < SgFormatItemList::pool_size)
13972 : {
13973 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
13974 : {
13975 0 : traversal.visit(&(objectArray[i][j]));
13976 0 : done = true;
13977 : }
13978 0 : j++;
13979 : }
13980 0 : i++;
13981 : }
13982 :
13983 : #if 0
13984 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
13985 : if (done == false)
13986 : {
13987 : printf ("No representative for SgFormatItemList found in memory pools \n");
13988 : }
13989 : #endif
13990 : }
13991 0 : }
13992 :
13993 :
13994 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
13995 : // using values that overflow signed values of int.
13996 : size_t
13997 4 : SgFormatItemList::numberOfNodes()
13998 : {
13999 : // This function traverses the memory pool for an IR node and
14000 : // counts the number of IR nodes of a particular Sage III IR
14001 : // nodes type.
14002 :
14003 4 : size_t count = 0;
14004 4 : if (SgFormatItemList::pools.empty() == false)
14005 : {
14006 : // Generate an array of memory pools (this is actually a STL vector,
14007 : // but it is contiguious, so OK to treat this way).
14008 0 : SgFormatItemList** objectArray = (SgFormatItemList**) &(SgFormatItemList::pools[0]);
14009 :
14010 : // Build a local variable for better performance (make it a loop invariant variable).
14011 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
14012 :
14013 : // Iterate over all of the memory pools for this IR node.
14014 0 : for (unsigned int i=0; i < SgFormatItemList::pools.size(); i++)
14015 : {
14016 : // objectArray[i] is a single memory pool, iterate over all the
14017 : // IR nodes and only count those that are valid IR nodes used in
14018 : // the AST (i.e. allocated IR nodes).
14019 0 : for (unsigned j=0; j < SgFormatItemList::pool_size; j++)
14020 : {
14021 : // This is indexing the STL vector of C/C++ style arrays as a doubly
14022 : // indexed array access. It is OK since we have leveraged the semantics
14023 : // of STL vector memory as contigous and cast the memory as an array
14024 : // of arrays to use the 2D array indexing. Hope this is not confusing,
14025 : // but it s very fast as an implementation.
14026 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
14027 : {
14028 0 : count++;
14029 : }
14030 : }
14031 : }
14032 : }
14033 :
14034 :
14035 :
14036 4 : return count;
14037 : }
14038 :
14039 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
14040 : // using values that overflow signed values of int.
14041 : size_t
14042 0 : SgFormatItemList::memoryUsage()
14043 : {
14044 : // This function is required because we need the class name as a type when we call sizeof
14045 : // There might be another way to implement this if we have a traversal that only called a
14046 : // representative object (one call for each type of Sage IIIIR node).
14047 0 : size_t memory = numberOfNodes() * sizeof(SgFormatItemList);
14048 :
14049 0 : return memory;
14050 : }
14051 :
14052 : /* #line 14053 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
14053 :
14054 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
14055 : void
14056 5342 : SgDataStatementGroup::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
14057 : {
14058 : // This function traverses the memory pool for only a specific IR node
14059 : // and calls the visit function of the input class execute a traversal
14060 : // similar to the style of the attribute based traversals within ROSE.
14061 : // This traversal will visit ALL nodes of the AST where as the other
14062 : // attribute based traversals visit only the embedded tree within the AST.
14063 :
14064 : // Initialize array to the address of the first element of the STL vector
14065 : // (which is guaranteed to be contiguous storage).
14066 : // SgDataStatementGroup objectArray [] = *(Memory_Block_List.begin());
14067 5342 : if (SgDataStatementGroup::pools.empty() == false)
14068 : {
14069 : // Generate an array of memory pools
14070 0 : SgDataStatementGroup** objectArray = (SgDataStatementGroup**) &(SgDataStatementGroup::pools[0]);
14071 :
14072 : // Build a local variable for better performance
14073 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
14074 : #if 0
14075 : // Iterate over the memory pools
14076 : for (unsigned int i=0; i < SgDataStatementGroup::pools.size(); i++)
14077 : {
14078 : // objectArray[i] is a single memory pool
14079 : for (int j=0; j < SgDataStatementGroup::pool_size; j++)
14080 : {
14081 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
14082 : {
14083 : traversal.visit(&(objectArray[i][j]));
14084 : }
14085 : }
14086 : }
14087 : #else
14088 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
14089 : // compute the list first and then call the visit function on each list element.
14090 :
14091 : // printf ("Inside of SgDataStatementGroup::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
14092 :
14093 0 : std::vector<SgDataStatementGroup*> nodeList;
14094 :
14095 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
14096 0 : for (unsigned int i=0; i < SgDataStatementGroup::pools.size(); i++)
14097 : {
14098 : // objectArray[i] is a single memory pool
14099 0 : for (unsigned j=0; j < SgDataStatementGroup::pool_size; j++)
14100 : {
14101 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
14102 : {
14103 0 : nodeList.push_back(&(objectArray[i][j]));
14104 : }
14105 : }
14106 : }
14107 :
14108 : // Iterate over the saved list
14109 0 : size_t nodeListSize = nodeList.size();
14110 0 : for (size_t i=0; i < nodeListSize; i++)
14111 : {
14112 0 : ROSE_ASSERT(nodeList[i] != NULL);
14113 : #if 0
14114 : traversal.visit(nodeList[i]);
14115 : #else
14116 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
14117 : {
14118 0 : traversal.visit(nodeList[i]);
14119 : }
14120 : #endif
14121 : }
14122 : #endif
14123 : }
14124 :
14125 : // This should not be required since all previously static data members are
14126 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
14127 :
14128 5342 : }
14129 :
14130 :
14131 : void
14132 194 : SgDataStatementGroup::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
14133 : {
14134 : // This function traverses the memory pool for an IR node and
14135 : // calls the function to execute the visitor object.
14136 :
14137 : // Initialize array to the address of the first element of the STL vector
14138 : // (which is guarenteed to be contiguous storage).
14139 : // SgDataStatementGroup objectArray [] = *(Memory_Block_List.begin());
14140 194 : if (SgDataStatementGroup::pools.empty() == false)
14141 : {
14142 : // Generate an array of memory pools
14143 0 : SgDataStatementGroup** objectArray = (SgDataStatementGroup**) &(SgDataStatementGroup::pools[0]);
14144 :
14145 : // Build a local variable for better performance
14146 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
14147 :
14148 : // Iterate over the memory pools
14149 0 : for (unsigned int i=0; i < SgDataStatementGroup::pools.size(); i++)
14150 : {
14151 : // objectArray[i] is a single memory pool
14152 0 : for (unsigned j=0; j < SgDataStatementGroup::pool_size; j++)
14153 : {
14154 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
14155 : {
14156 : // printf ("Found a valid SgDataStatementGroup object in the memory pool %d at position %d \n",i,j);
14157 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
14158 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
14159 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
14160 : }
14161 : else
14162 : {
14163 : // printf ("Found a INVALID SgDataStatementGroup object in the memory pool \n");
14164 : }
14165 : }
14166 : }
14167 : }
14168 :
14169 : // This should not be required since all previously static data members are
14170 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
14171 :
14172 194 : }
14173 :
14174 : void
14175 0 : SgDataStatementGroup::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
14176 : {
14177 : // This function visits only a single IR node of the memory pool.
14178 : // it is typically called once for each type of IR node within
14179 : // the automatically generated function: traverseRepresentativeNodes().
14180 :
14181 : // Initialize array to the address of the first element of the STL vector
14182 : // (which is guarenteed to be contiguous storage).
14183 : // SgDataStatementGroup objectArray [] = *(Memory_Block_List.begin());
14184 0 : if (SgDataStatementGroup::pools.empty() == false)
14185 : {
14186 : // Generate an array of memory pools
14187 0 : SgDataStatementGroup** objectArray = (SgDataStatementGroup**) &(SgDataStatementGroup::pools[0]);
14188 :
14189 : // Build a local variable for better performance
14190 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
14191 :
14192 : // Iterate over the memory pools
14193 0 : bool done = false;
14194 0 : unsigned i=0;
14195 :
14196 : // find the first valid IR node, call visit function, and then leave
14197 0 : while ( done == false && i < SgDataStatementGroup::pools.size() )
14198 : {
14199 : // objectArray[i] is a single memory pool
14200 : unsigned j=0;
14201 0 : while (done == false && j < SgDataStatementGroup::pool_size)
14202 : {
14203 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
14204 : {
14205 0 : traversal.visit(&(objectArray[i][j]));
14206 0 : done = true;
14207 : }
14208 0 : j++;
14209 : }
14210 0 : i++;
14211 : }
14212 :
14213 : #if 0
14214 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
14215 : if (done == false)
14216 : {
14217 : printf ("No representative for SgDataStatementGroup found in memory pools \n");
14218 : }
14219 : #endif
14220 : }
14221 0 : }
14222 :
14223 :
14224 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
14225 : // using values that overflow signed values of int.
14226 : size_t
14227 4 : SgDataStatementGroup::numberOfNodes()
14228 : {
14229 : // This function traverses the memory pool for an IR node and
14230 : // counts the number of IR nodes of a particular Sage III IR
14231 : // nodes type.
14232 :
14233 4 : size_t count = 0;
14234 4 : if (SgDataStatementGroup::pools.empty() == false)
14235 : {
14236 : // Generate an array of memory pools (this is actually a STL vector,
14237 : // but it is contiguious, so OK to treat this way).
14238 0 : SgDataStatementGroup** objectArray = (SgDataStatementGroup**) &(SgDataStatementGroup::pools[0]);
14239 :
14240 : // Build a local variable for better performance (make it a loop invariant variable).
14241 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
14242 :
14243 : // Iterate over all of the memory pools for this IR node.
14244 0 : for (unsigned int i=0; i < SgDataStatementGroup::pools.size(); i++)
14245 : {
14246 : // objectArray[i] is a single memory pool, iterate over all the
14247 : // IR nodes and only count those that are valid IR nodes used in
14248 : // the AST (i.e. allocated IR nodes).
14249 0 : for (unsigned j=0; j < SgDataStatementGroup::pool_size; j++)
14250 : {
14251 : // This is indexing the STL vector of C/C++ style arrays as a doubly
14252 : // indexed array access. It is OK since we have leveraged the semantics
14253 : // of STL vector memory as contigous and cast the memory as an array
14254 : // of arrays to use the 2D array indexing. Hope this is not confusing,
14255 : // but it s very fast as an implementation.
14256 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
14257 : {
14258 0 : count++;
14259 : }
14260 : }
14261 : }
14262 : }
14263 :
14264 :
14265 :
14266 4 : return count;
14267 : }
14268 :
14269 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
14270 : // using values that overflow signed values of int.
14271 : size_t
14272 0 : SgDataStatementGroup::memoryUsage()
14273 : {
14274 : // This function is required because we need the class name as a type when we call sizeof
14275 : // There might be another way to implement this if we have a traversal that only called a
14276 : // representative object (one call for each type of Sage IIIIR node).
14277 0 : size_t memory = numberOfNodes() * sizeof(SgDataStatementGroup);
14278 :
14279 0 : return memory;
14280 : }
14281 :
14282 : /* #line 14283 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
14283 :
14284 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
14285 : void
14286 5342 : SgDataStatementObject::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
14287 : {
14288 : // This function traverses the memory pool for only a specific IR node
14289 : // and calls the visit function of the input class execute a traversal
14290 : // similar to the style of the attribute based traversals within ROSE.
14291 : // This traversal will visit ALL nodes of the AST where as the other
14292 : // attribute based traversals visit only the embedded tree within the AST.
14293 :
14294 : // Initialize array to the address of the first element of the STL vector
14295 : // (which is guaranteed to be contiguous storage).
14296 : // SgDataStatementObject objectArray [] = *(Memory_Block_List.begin());
14297 5342 : if (SgDataStatementObject::pools.empty() == false)
14298 : {
14299 : // Generate an array of memory pools
14300 0 : SgDataStatementObject** objectArray = (SgDataStatementObject**) &(SgDataStatementObject::pools[0]);
14301 :
14302 : // Build a local variable for better performance
14303 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
14304 : #if 0
14305 : // Iterate over the memory pools
14306 : for (unsigned int i=0; i < SgDataStatementObject::pools.size(); i++)
14307 : {
14308 : // objectArray[i] is a single memory pool
14309 : for (int j=0; j < SgDataStatementObject::pool_size; j++)
14310 : {
14311 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
14312 : {
14313 : traversal.visit(&(objectArray[i][j]));
14314 : }
14315 : }
14316 : }
14317 : #else
14318 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
14319 : // compute the list first and then call the visit function on each list element.
14320 :
14321 : // printf ("Inside of SgDataStatementObject::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
14322 :
14323 0 : std::vector<SgDataStatementObject*> nodeList;
14324 :
14325 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
14326 0 : for (unsigned int i=0; i < SgDataStatementObject::pools.size(); i++)
14327 : {
14328 : // objectArray[i] is a single memory pool
14329 0 : for (unsigned j=0; j < SgDataStatementObject::pool_size; j++)
14330 : {
14331 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
14332 : {
14333 0 : nodeList.push_back(&(objectArray[i][j]));
14334 : }
14335 : }
14336 : }
14337 :
14338 : // Iterate over the saved list
14339 0 : size_t nodeListSize = nodeList.size();
14340 0 : for (size_t i=0; i < nodeListSize; i++)
14341 : {
14342 0 : ROSE_ASSERT(nodeList[i] != NULL);
14343 : #if 0
14344 : traversal.visit(nodeList[i]);
14345 : #else
14346 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
14347 : {
14348 0 : traversal.visit(nodeList[i]);
14349 : }
14350 : #endif
14351 : }
14352 : #endif
14353 : }
14354 :
14355 : // This should not be required since all previously static data members are
14356 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
14357 :
14358 5342 : }
14359 :
14360 :
14361 : void
14362 194 : SgDataStatementObject::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
14363 : {
14364 : // This function traverses the memory pool for an IR node and
14365 : // calls the function to execute the visitor object.
14366 :
14367 : // Initialize array to the address of the first element of the STL vector
14368 : // (which is guarenteed to be contiguous storage).
14369 : // SgDataStatementObject objectArray [] = *(Memory_Block_List.begin());
14370 194 : if (SgDataStatementObject::pools.empty() == false)
14371 : {
14372 : // Generate an array of memory pools
14373 0 : SgDataStatementObject** objectArray = (SgDataStatementObject**) &(SgDataStatementObject::pools[0]);
14374 :
14375 : // Build a local variable for better performance
14376 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
14377 :
14378 : // Iterate over the memory pools
14379 0 : for (unsigned int i=0; i < SgDataStatementObject::pools.size(); i++)
14380 : {
14381 : // objectArray[i] is a single memory pool
14382 0 : for (unsigned j=0; j < SgDataStatementObject::pool_size; j++)
14383 : {
14384 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
14385 : {
14386 : // printf ("Found a valid SgDataStatementObject object in the memory pool %d at position %d \n",i,j);
14387 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
14388 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
14389 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
14390 : }
14391 : else
14392 : {
14393 : // printf ("Found a INVALID SgDataStatementObject object in the memory pool \n");
14394 : }
14395 : }
14396 : }
14397 : }
14398 :
14399 : // This should not be required since all previously static data members are
14400 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
14401 :
14402 194 : }
14403 :
14404 : void
14405 0 : SgDataStatementObject::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
14406 : {
14407 : // This function visits only a single IR node of the memory pool.
14408 : // it is typically called once for each type of IR node within
14409 : // the automatically generated function: traverseRepresentativeNodes().
14410 :
14411 : // Initialize array to the address of the first element of the STL vector
14412 : // (which is guarenteed to be contiguous storage).
14413 : // SgDataStatementObject objectArray [] = *(Memory_Block_List.begin());
14414 0 : if (SgDataStatementObject::pools.empty() == false)
14415 : {
14416 : // Generate an array of memory pools
14417 0 : SgDataStatementObject** objectArray = (SgDataStatementObject**) &(SgDataStatementObject::pools[0]);
14418 :
14419 : // Build a local variable for better performance
14420 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
14421 :
14422 : // Iterate over the memory pools
14423 0 : bool done = false;
14424 0 : unsigned i=0;
14425 :
14426 : // find the first valid IR node, call visit function, and then leave
14427 0 : while ( done == false && i < SgDataStatementObject::pools.size() )
14428 : {
14429 : // objectArray[i] is a single memory pool
14430 : unsigned j=0;
14431 0 : while (done == false && j < SgDataStatementObject::pool_size)
14432 : {
14433 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
14434 : {
14435 0 : traversal.visit(&(objectArray[i][j]));
14436 0 : done = true;
14437 : }
14438 0 : j++;
14439 : }
14440 0 : i++;
14441 : }
14442 :
14443 : #if 0
14444 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
14445 : if (done == false)
14446 : {
14447 : printf ("No representative for SgDataStatementObject found in memory pools \n");
14448 : }
14449 : #endif
14450 : }
14451 0 : }
14452 :
14453 :
14454 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
14455 : // using values that overflow signed values of int.
14456 : size_t
14457 4 : SgDataStatementObject::numberOfNodes()
14458 : {
14459 : // This function traverses the memory pool for an IR node and
14460 : // counts the number of IR nodes of a particular Sage III IR
14461 : // nodes type.
14462 :
14463 4 : size_t count = 0;
14464 4 : if (SgDataStatementObject::pools.empty() == false)
14465 : {
14466 : // Generate an array of memory pools (this is actually a STL vector,
14467 : // but it is contiguious, so OK to treat this way).
14468 0 : SgDataStatementObject** objectArray = (SgDataStatementObject**) &(SgDataStatementObject::pools[0]);
14469 :
14470 : // Build a local variable for better performance (make it a loop invariant variable).
14471 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
14472 :
14473 : // Iterate over all of the memory pools for this IR node.
14474 0 : for (unsigned int i=0; i < SgDataStatementObject::pools.size(); i++)
14475 : {
14476 : // objectArray[i] is a single memory pool, iterate over all the
14477 : // IR nodes and only count those that are valid IR nodes used in
14478 : // the AST (i.e. allocated IR nodes).
14479 0 : for (unsigned j=0; j < SgDataStatementObject::pool_size; j++)
14480 : {
14481 : // This is indexing the STL vector of C/C++ style arrays as a doubly
14482 : // indexed array access. It is OK since we have leveraged the semantics
14483 : // of STL vector memory as contigous and cast the memory as an array
14484 : // of arrays to use the 2D array indexing. Hope this is not confusing,
14485 : // but it s very fast as an implementation.
14486 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
14487 : {
14488 0 : count++;
14489 : }
14490 : }
14491 : }
14492 : }
14493 :
14494 :
14495 :
14496 4 : return count;
14497 : }
14498 :
14499 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
14500 : // using values that overflow signed values of int.
14501 : size_t
14502 0 : SgDataStatementObject::memoryUsage()
14503 : {
14504 : // This function is required because we need the class name as a type when we call sizeof
14505 : // There might be another way to implement this if we have a traversal that only called a
14506 : // representative object (one call for each type of Sage IIIIR node).
14507 0 : size_t memory = numberOfNodes() * sizeof(SgDataStatementObject);
14508 :
14509 0 : return memory;
14510 : }
14511 :
14512 : /* #line 14513 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
14513 :
14514 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
14515 : void
14516 5342 : SgIncludeFile::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
14517 : {
14518 : // This function traverses the memory pool for only a specific IR node
14519 : // and calls the visit function of the input class execute a traversal
14520 : // similar to the style of the attribute based traversals within ROSE.
14521 : // This traversal will visit ALL nodes of the AST where as the other
14522 : // attribute based traversals visit only the embedded tree within the AST.
14523 :
14524 : // Initialize array to the address of the first element of the STL vector
14525 : // (which is guaranteed to be contiguous storage).
14526 : // SgIncludeFile objectArray [] = *(Memory_Block_List.begin());
14527 5342 : if (SgIncludeFile::pools.empty() == false)
14528 : {
14529 : // Generate an array of memory pools
14530 4602 : SgIncludeFile** objectArray = (SgIncludeFile**) &(SgIncludeFile::pools[0]);
14531 :
14532 : // Build a local variable for better performance
14533 4602 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
14534 : #if 0
14535 : // Iterate over the memory pools
14536 : for (unsigned int i=0; i < SgIncludeFile::pools.size(); i++)
14537 : {
14538 : // objectArray[i] is a single memory pool
14539 : for (int j=0; j < SgIncludeFile::pool_size; j++)
14540 : {
14541 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
14542 : {
14543 : traversal.visit(&(objectArray[i][j]));
14544 : }
14545 : }
14546 : }
14547 : #else
14548 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
14549 : // compute the list first and then call the visit function on each list element.
14550 :
14551 : // printf ("Inside of SgIncludeFile::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
14552 :
14553 9204 : std::vector<SgIncludeFile*> nodeList;
14554 :
14555 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
14556 9204 : for (unsigned int i=0; i < SgIncludeFile::pools.size(); i++)
14557 : {
14558 : // objectArray[i] is a single memory pool
14559 9208600 : for (unsigned j=0; j < SgIncludeFile::pool_size; j++)
14560 : {
14561 9204000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
14562 : {
14563 195732 : nodeList.push_back(&(objectArray[i][j]));
14564 : }
14565 : }
14566 : }
14567 :
14568 : // Iterate over the saved list
14569 4602 : size_t nodeListSize = nodeList.size();
14570 200334 : for (size_t i=0; i < nodeListSize; i++)
14571 : {
14572 195732 : ROSE_ASSERT(nodeList[i] != NULL);
14573 : #if 0
14574 : traversal.visit(nodeList[i]);
14575 : #else
14576 195732 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
14577 : {
14578 195732 : traversal.visit(nodeList[i]);
14579 : }
14580 : #endif
14581 : }
14582 : #endif
14583 : }
14584 :
14585 : // This should not be required since all previously static data members are
14586 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
14587 :
14588 5342 : }
14589 :
14590 :
14591 : void
14592 194 : SgIncludeFile::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
14593 : {
14594 : // This function traverses the memory pool for an IR node and
14595 : // calls the function to execute the visitor object.
14596 :
14597 : // Initialize array to the address of the first element of the STL vector
14598 : // (which is guarenteed to be contiguous storage).
14599 : // SgIncludeFile objectArray [] = *(Memory_Block_List.begin());
14600 194 : if (SgIncludeFile::pools.empty() == false)
14601 : {
14602 : // Generate an array of memory pools
14603 194 : SgIncludeFile** objectArray = (SgIncludeFile**) &(SgIncludeFile::pools[0]);
14604 :
14605 : // Build a local variable for better performance
14606 194 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
14607 :
14608 : // Iterate over the memory pools
14609 388 : for (unsigned int i=0; i < SgIncludeFile::pools.size(); i++)
14610 : {
14611 : // objectArray[i] is a single memory pool
14612 388194 : for (unsigned j=0; j < SgIncludeFile::pool_size; j++)
14613 : {
14614 388000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
14615 : {
14616 : // printf ("Found a valid SgIncludeFile object in the memory pool %d at position %d \n",i,j);
14617 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
14618 27298 : objectArray[i][j].executeVisitorMemberFunction(visitor);
14619 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
14620 : }
14621 : else
14622 : {
14623 : // printf ("Found a INVALID SgIncludeFile object in the memory pool \n");
14624 : }
14625 : }
14626 : }
14627 : }
14628 :
14629 : // This should not be required since all previously static data members are
14630 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
14631 :
14632 194 : }
14633 :
14634 : void
14635 0 : SgIncludeFile::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
14636 : {
14637 : // This function visits only a single IR node of the memory pool.
14638 : // it is typically called once for each type of IR node within
14639 : // the automatically generated function: traverseRepresentativeNodes().
14640 :
14641 : // Initialize array to the address of the first element of the STL vector
14642 : // (which is guarenteed to be contiguous storage).
14643 : // SgIncludeFile objectArray [] = *(Memory_Block_List.begin());
14644 0 : if (SgIncludeFile::pools.empty() == false)
14645 : {
14646 : // Generate an array of memory pools
14647 0 : SgIncludeFile** objectArray = (SgIncludeFile**) &(SgIncludeFile::pools[0]);
14648 :
14649 : // Build a local variable for better performance
14650 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
14651 :
14652 : // Iterate over the memory pools
14653 0 : bool done = false;
14654 0 : unsigned i=0;
14655 :
14656 : // find the first valid IR node, call visit function, and then leave
14657 0 : while ( done == false && i < SgIncludeFile::pools.size() )
14658 : {
14659 : // objectArray[i] is a single memory pool
14660 : unsigned j=0;
14661 0 : while (done == false && j < SgIncludeFile::pool_size)
14662 : {
14663 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
14664 : {
14665 0 : traversal.visit(&(objectArray[i][j]));
14666 0 : done = true;
14667 : }
14668 0 : j++;
14669 : }
14670 0 : i++;
14671 : }
14672 :
14673 : #if 0
14674 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
14675 : if (done == false)
14676 : {
14677 : printf ("No representative for SgIncludeFile found in memory pools \n");
14678 : }
14679 : #endif
14680 : }
14681 0 : }
14682 :
14683 :
14684 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
14685 : // using values that overflow signed values of int.
14686 : size_t
14687 4 : SgIncludeFile::numberOfNodes()
14688 : {
14689 : // This function traverses the memory pool for an IR node and
14690 : // counts the number of IR nodes of a particular Sage III IR
14691 : // nodes type.
14692 :
14693 4 : size_t count = 0;
14694 4 : if (SgIncludeFile::pools.empty() == false)
14695 : {
14696 : // Generate an array of memory pools (this is actually a STL vector,
14697 : // but it is contiguious, so OK to treat this way).
14698 2 : SgIncludeFile** objectArray = (SgIncludeFile**) &(SgIncludeFile::pools[0]);
14699 :
14700 : // Build a local variable for better performance (make it a loop invariant variable).
14701 2 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
14702 :
14703 : // Iterate over all of the memory pools for this IR node.
14704 4 : for (unsigned int i=0; i < SgIncludeFile::pools.size(); i++)
14705 : {
14706 : // objectArray[i] is a single memory pool, iterate over all the
14707 : // IR nodes and only count those that are valid IR nodes used in
14708 : // the AST (i.e. allocated IR nodes).
14709 4002 : for (unsigned j=0; j < SgIncludeFile::pool_size; j++)
14710 : {
14711 : // This is indexing the STL vector of C/C++ style arrays as a doubly
14712 : // indexed array access. It is OK since we have leveraged the semantics
14713 : // of STL vector memory as contigous and cast the memory as an array
14714 : // of arrays to use the 2D array indexing. Hope this is not confusing,
14715 : // but it s very fast as an implementation.
14716 4000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
14717 : {
14718 224 : count++;
14719 : }
14720 : }
14721 : }
14722 : }
14723 :
14724 :
14725 :
14726 4 : return count;
14727 : }
14728 :
14729 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
14730 : // using values that overflow signed values of int.
14731 : size_t
14732 0 : SgIncludeFile::memoryUsage()
14733 : {
14734 : // This function is required because we need the class name as a type when we call sizeof
14735 : // There might be another way to implement this if we have a traversal that only called a
14736 : // representative object (one call for each type of Sage IIIIR node).
14737 0 : size_t memory = numberOfNodes() * sizeof(SgIncludeFile);
14738 :
14739 0 : return memory;
14740 : }
14741 :
14742 : /* #line 14743 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
14743 :
14744 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
14745 : void
14746 5342 : SgDataStatementValue::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
14747 : {
14748 : // This function traverses the memory pool for only a specific IR node
14749 : // and calls the visit function of the input class execute a traversal
14750 : // similar to the style of the attribute based traversals within ROSE.
14751 : // This traversal will visit ALL nodes of the AST where as the other
14752 : // attribute based traversals visit only the embedded tree within the AST.
14753 :
14754 : // Initialize array to the address of the first element of the STL vector
14755 : // (which is guaranteed to be contiguous storage).
14756 : // SgDataStatementValue objectArray [] = *(Memory_Block_List.begin());
14757 5342 : if (SgDataStatementValue::pools.empty() == false)
14758 : {
14759 : // Generate an array of memory pools
14760 0 : SgDataStatementValue** objectArray = (SgDataStatementValue**) &(SgDataStatementValue::pools[0]);
14761 :
14762 : // Build a local variable for better performance
14763 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
14764 : #if 0
14765 : // Iterate over the memory pools
14766 : for (unsigned int i=0; i < SgDataStatementValue::pools.size(); i++)
14767 : {
14768 : // objectArray[i] is a single memory pool
14769 : for (int j=0; j < SgDataStatementValue::pool_size; j++)
14770 : {
14771 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
14772 : {
14773 : traversal.visit(&(objectArray[i][j]));
14774 : }
14775 : }
14776 : }
14777 : #else
14778 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
14779 : // compute the list first and then call the visit function on each list element.
14780 :
14781 : // printf ("Inside of SgDataStatementValue::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
14782 :
14783 0 : std::vector<SgDataStatementValue*> nodeList;
14784 :
14785 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
14786 0 : for (unsigned int i=0; i < SgDataStatementValue::pools.size(); i++)
14787 : {
14788 : // objectArray[i] is a single memory pool
14789 0 : for (unsigned j=0; j < SgDataStatementValue::pool_size; j++)
14790 : {
14791 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
14792 : {
14793 0 : nodeList.push_back(&(objectArray[i][j]));
14794 : }
14795 : }
14796 : }
14797 :
14798 : // Iterate over the saved list
14799 0 : size_t nodeListSize = nodeList.size();
14800 0 : for (size_t i=0; i < nodeListSize; i++)
14801 : {
14802 0 : ROSE_ASSERT(nodeList[i] != NULL);
14803 : #if 0
14804 : traversal.visit(nodeList[i]);
14805 : #else
14806 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
14807 : {
14808 0 : traversal.visit(nodeList[i]);
14809 : }
14810 : #endif
14811 : }
14812 : #endif
14813 : }
14814 :
14815 : // This should not be required since all previously static data members are
14816 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
14817 :
14818 5342 : }
14819 :
14820 :
14821 : void
14822 194 : SgDataStatementValue::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
14823 : {
14824 : // This function traverses the memory pool for an IR node and
14825 : // calls the function to execute the visitor object.
14826 :
14827 : // Initialize array to the address of the first element of the STL vector
14828 : // (which is guarenteed to be contiguous storage).
14829 : // SgDataStatementValue objectArray [] = *(Memory_Block_List.begin());
14830 194 : if (SgDataStatementValue::pools.empty() == false)
14831 : {
14832 : // Generate an array of memory pools
14833 0 : SgDataStatementValue** objectArray = (SgDataStatementValue**) &(SgDataStatementValue::pools[0]);
14834 :
14835 : // Build a local variable for better performance
14836 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
14837 :
14838 : // Iterate over the memory pools
14839 0 : for (unsigned int i=0; i < SgDataStatementValue::pools.size(); i++)
14840 : {
14841 : // objectArray[i] is a single memory pool
14842 0 : for (unsigned j=0; j < SgDataStatementValue::pool_size; j++)
14843 : {
14844 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
14845 : {
14846 : // printf ("Found a valid SgDataStatementValue object in the memory pool %d at position %d \n",i,j);
14847 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
14848 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
14849 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
14850 : }
14851 : else
14852 : {
14853 : // printf ("Found a INVALID SgDataStatementValue object in the memory pool \n");
14854 : }
14855 : }
14856 : }
14857 : }
14858 :
14859 : // This should not be required since all previously static data members are
14860 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
14861 :
14862 194 : }
14863 :
14864 : void
14865 0 : SgDataStatementValue::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
14866 : {
14867 : // This function visits only a single IR node of the memory pool.
14868 : // it is typically called once for each type of IR node within
14869 : // the automatically generated function: traverseRepresentativeNodes().
14870 :
14871 : // Initialize array to the address of the first element of the STL vector
14872 : // (which is guarenteed to be contiguous storage).
14873 : // SgDataStatementValue objectArray [] = *(Memory_Block_List.begin());
14874 0 : if (SgDataStatementValue::pools.empty() == false)
14875 : {
14876 : // Generate an array of memory pools
14877 0 : SgDataStatementValue** objectArray = (SgDataStatementValue**) &(SgDataStatementValue::pools[0]);
14878 :
14879 : // Build a local variable for better performance
14880 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
14881 :
14882 : // Iterate over the memory pools
14883 0 : bool done = false;
14884 0 : unsigned i=0;
14885 :
14886 : // find the first valid IR node, call visit function, and then leave
14887 0 : while ( done == false && i < SgDataStatementValue::pools.size() )
14888 : {
14889 : // objectArray[i] is a single memory pool
14890 : unsigned j=0;
14891 0 : while (done == false && j < SgDataStatementValue::pool_size)
14892 : {
14893 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
14894 : {
14895 0 : traversal.visit(&(objectArray[i][j]));
14896 0 : done = true;
14897 : }
14898 0 : j++;
14899 : }
14900 0 : i++;
14901 : }
14902 :
14903 : #if 0
14904 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
14905 : if (done == false)
14906 : {
14907 : printf ("No representative for SgDataStatementValue found in memory pools \n");
14908 : }
14909 : #endif
14910 : }
14911 0 : }
14912 :
14913 :
14914 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
14915 : // using values that overflow signed values of int.
14916 : size_t
14917 4 : SgDataStatementValue::numberOfNodes()
14918 : {
14919 : // This function traverses the memory pool for an IR node and
14920 : // counts the number of IR nodes of a particular Sage III IR
14921 : // nodes type.
14922 :
14923 4 : size_t count = 0;
14924 4 : if (SgDataStatementValue::pools.empty() == false)
14925 : {
14926 : // Generate an array of memory pools (this is actually a STL vector,
14927 : // but it is contiguious, so OK to treat this way).
14928 0 : SgDataStatementValue** objectArray = (SgDataStatementValue**) &(SgDataStatementValue::pools[0]);
14929 :
14930 : // Build a local variable for better performance (make it a loop invariant variable).
14931 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
14932 :
14933 : // Iterate over all of the memory pools for this IR node.
14934 0 : for (unsigned int i=0; i < SgDataStatementValue::pools.size(); i++)
14935 : {
14936 : // objectArray[i] is a single memory pool, iterate over all the
14937 : // IR nodes and only count those that are valid IR nodes used in
14938 : // the AST (i.e. allocated IR nodes).
14939 0 : for (unsigned j=0; j < SgDataStatementValue::pool_size; j++)
14940 : {
14941 : // This is indexing the STL vector of C/C++ style arrays as a doubly
14942 : // indexed array access. It is OK since we have leveraged the semantics
14943 : // of STL vector memory as contigous and cast the memory as an array
14944 : // of arrays to use the 2D array indexing. Hope this is not confusing,
14945 : // but it s very fast as an implementation.
14946 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
14947 : {
14948 0 : count++;
14949 : }
14950 : }
14951 : }
14952 : }
14953 :
14954 :
14955 :
14956 4 : return count;
14957 : }
14958 :
14959 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
14960 : // using values that overflow signed values of int.
14961 : size_t
14962 0 : SgDataStatementValue::memoryUsage()
14963 : {
14964 : // This function is required because we need the class name as a type when we call sizeof
14965 : // There might be another way to implement this if we have a traversal that only called a
14966 : // representative object (one call for each type of Sage IIIIR node).
14967 0 : size_t memory = numberOfNodes() * sizeof(SgDataStatementValue);
14968 :
14969 0 : return memory;
14970 : }
14971 :
14972 : /* #line 14973 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
14973 :
14974 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
14975 : void
14976 5342 : SgHeaderFileReport::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
14977 : {
14978 : // This function traverses the memory pool for only a specific IR node
14979 : // and calls the visit function of the input class execute a traversal
14980 : // similar to the style of the attribute based traversals within ROSE.
14981 : // This traversal will visit ALL nodes of the AST where as the other
14982 : // attribute based traversals visit only the embedded tree within the AST.
14983 :
14984 : // Initialize array to the address of the first element of the STL vector
14985 : // (which is guaranteed to be contiguous storage).
14986 : // SgHeaderFileReport objectArray [] = *(Memory_Block_List.begin());
14987 5342 : if (SgHeaderFileReport::pools.empty() == false)
14988 : {
14989 : // Generate an array of memory pools
14990 0 : SgHeaderFileReport** objectArray = (SgHeaderFileReport**) &(SgHeaderFileReport::pools[0]);
14991 :
14992 : // Build a local variable for better performance
14993 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
14994 : #if 0
14995 : // Iterate over the memory pools
14996 : for (unsigned int i=0; i < SgHeaderFileReport::pools.size(); i++)
14997 : {
14998 : // objectArray[i] is a single memory pool
14999 : for (int j=0; j < SgHeaderFileReport::pool_size; j++)
15000 : {
15001 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
15002 : {
15003 : traversal.visit(&(objectArray[i][j]));
15004 : }
15005 : }
15006 : }
15007 : #else
15008 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
15009 : // compute the list first and then call the visit function on each list element.
15010 :
15011 : // printf ("Inside of SgHeaderFileReport::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
15012 :
15013 0 : std::vector<SgHeaderFileReport*> nodeList;
15014 :
15015 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
15016 0 : for (unsigned int i=0; i < SgHeaderFileReport::pools.size(); i++)
15017 : {
15018 : // objectArray[i] is a single memory pool
15019 0 : for (unsigned j=0; j < SgHeaderFileReport::pool_size; j++)
15020 : {
15021 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
15022 : {
15023 0 : nodeList.push_back(&(objectArray[i][j]));
15024 : }
15025 : }
15026 : }
15027 :
15028 : // Iterate over the saved list
15029 0 : size_t nodeListSize = nodeList.size();
15030 0 : for (size_t i=0; i < nodeListSize; i++)
15031 : {
15032 0 : ROSE_ASSERT(nodeList[i] != NULL);
15033 : #if 0
15034 : traversal.visit(nodeList[i]);
15035 : #else
15036 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
15037 : {
15038 0 : traversal.visit(nodeList[i]);
15039 : }
15040 : #endif
15041 : }
15042 : #endif
15043 : }
15044 :
15045 : // This should not be required since all previously static data members are
15046 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
15047 :
15048 5342 : }
15049 :
15050 :
15051 : void
15052 194 : SgHeaderFileReport::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
15053 : {
15054 : // This function traverses the memory pool for an IR node and
15055 : // calls the function to execute the visitor object.
15056 :
15057 : // Initialize array to the address of the first element of the STL vector
15058 : // (which is guarenteed to be contiguous storage).
15059 : // SgHeaderFileReport objectArray [] = *(Memory_Block_List.begin());
15060 194 : if (SgHeaderFileReport::pools.empty() == false)
15061 : {
15062 : // Generate an array of memory pools
15063 0 : SgHeaderFileReport** objectArray = (SgHeaderFileReport**) &(SgHeaderFileReport::pools[0]);
15064 :
15065 : // Build a local variable for better performance
15066 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
15067 :
15068 : // Iterate over the memory pools
15069 0 : for (unsigned int i=0; i < SgHeaderFileReport::pools.size(); i++)
15070 : {
15071 : // objectArray[i] is a single memory pool
15072 0 : for (unsigned j=0; j < SgHeaderFileReport::pool_size; j++)
15073 : {
15074 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
15075 : {
15076 : // printf ("Found a valid SgHeaderFileReport object in the memory pool %d at position %d \n",i,j);
15077 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
15078 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
15079 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
15080 : }
15081 : else
15082 : {
15083 : // printf ("Found a INVALID SgHeaderFileReport object in the memory pool \n");
15084 : }
15085 : }
15086 : }
15087 : }
15088 :
15089 : // This should not be required since all previously static data members are
15090 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
15091 :
15092 194 : }
15093 :
15094 : void
15095 0 : SgHeaderFileReport::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
15096 : {
15097 : // This function visits only a single IR node of the memory pool.
15098 : // it is typically called once for each type of IR node within
15099 : // the automatically generated function: traverseRepresentativeNodes().
15100 :
15101 : // Initialize array to the address of the first element of the STL vector
15102 : // (which is guarenteed to be contiguous storage).
15103 : // SgHeaderFileReport objectArray [] = *(Memory_Block_List.begin());
15104 0 : if (SgHeaderFileReport::pools.empty() == false)
15105 : {
15106 : // Generate an array of memory pools
15107 0 : SgHeaderFileReport** objectArray = (SgHeaderFileReport**) &(SgHeaderFileReport::pools[0]);
15108 :
15109 : // Build a local variable for better performance
15110 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
15111 :
15112 : // Iterate over the memory pools
15113 0 : bool done = false;
15114 0 : unsigned i=0;
15115 :
15116 : // find the first valid IR node, call visit function, and then leave
15117 0 : while ( done == false && i < SgHeaderFileReport::pools.size() )
15118 : {
15119 : // objectArray[i] is a single memory pool
15120 : unsigned j=0;
15121 0 : while (done == false && j < SgHeaderFileReport::pool_size)
15122 : {
15123 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
15124 : {
15125 0 : traversal.visit(&(objectArray[i][j]));
15126 0 : done = true;
15127 : }
15128 0 : j++;
15129 : }
15130 0 : i++;
15131 : }
15132 :
15133 : #if 0
15134 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
15135 : if (done == false)
15136 : {
15137 : printf ("No representative for SgHeaderFileReport found in memory pools \n");
15138 : }
15139 : #endif
15140 : }
15141 0 : }
15142 :
15143 :
15144 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
15145 : // using values that overflow signed values of int.
15146 : size_t
15147 4 : SgHeaderFileReport::numberOfNodes()
15148 : {
15149 : // This function traverses the memory pool for an IR node and
15150 : // counts the number of IR nodes of a particular Sage III IR
15151 : // nodes type.
15152 :
15153 4 : size_t count = 0;
15154 4 : if (SgHeaderFileReport::pools.empty() == false)
15155 : {
15156 : // Generate an array of memory pools (this is actually a STL vector,
15157 : // but it is contiguious, so OK to treat this way).
15158 0 : SgHeaderFileReport** objectArray = (SgHeaderFileReport**) &(SgHeaderFileReport::pools[0]);
15159 :
15160 : // Build a local variable for better performance (make it a loop invariant variable).
15161 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
15162 :
15163 : // Iterate over all of the memory pools for this IR node.
15164 0 : for (unsigned int i=0; i < SgHeaderFileReport::pools.size(); i++)
15165 : {
15166 : // objectArray[i] is a single memory pool, iterate over all the
15167 : // IR nodes and only count those that are valid IR nodes used in
15168 : // the AST (i.e. allocated IR nodes).
15169 0 : for (unsigned j=0; j < SgHeaderFileReport::pool_size; j++)
15170 : {
15171 : // This is indexing the STL vector of C/C++ style arrays as a doubly
15172 : // indexed array access. It is OK since we have leveraged the semantics
15173 : // of STL vector memory as contigous and cast the memory as an array
15174 : // of arrays to use the 2D array indexing. Hope this is not confusing,
15175 : // but it s very fast as an implementation.
15176 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
15177 : {
15178 0 : count++;
15179 : }
15180 : }
15181 : }
15182 : }
15183 :
15184 :
15185 :
15186 4 : return count;
15187 : }
15188 :
15189 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
15190 : // using values that overflow signed values of int.
15191 : size_t
15192 0 : SgHeaderFileReport::memoryUsage()
15193 : {
15194 : // This function is required because we need the class name as a type when we call sizeof
15195 : // There might be another way to implement this if we have a traversal that only called a
15196 : // representative object (one call for each type of Sage IIIIR node).
15197 0 : size_t memory = numberOfNodes() * sizeof(SgHeaderFileReport);
15198 :
15199 0 : return memory;
15200 : }
15201 :
15202 : /* #line 15203 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
15203 :
15204 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
15205 : void
15206 5668 : SgType::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
15207 : {
15208 : // This function traverses the memory pool for only a specific IR node
15209 : // and calls the visit function of the input class execute a traversal
15210 : // similar to the style of the attribute based traversals within ROSE.
15211 : // This traversal will visit ALL nodes of the AST where as the other
15212 : // attribute based traversals visit only the embedded tree within the AST.
15213 :
15214 : // Initialize array to the address of the first element of the STL vector
15215 : // (which is guaranteed to be contiguous storage).
15216 : // SgType objectArray [] = *(Memory_Block_List.begin());
15217 5668 : if (SgType::pools.empty() == false)
15218 : {
15219 : // Generate an array of memory pools
15220 0 : SgType** objectArray = (SgType**) &(SgType::pools[0]);
15221 :
15222 : // Build a local variable for better performance
15223 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
15224 : #if 0
15225 : // Iterate over the memory pools
15226 : for (unsigned int i=0; i < SgType::pools.size(); i++)
15227 : {
15228 : // objectArray[i] is a single memory pool
15229 : for (int j=0; j < SgType::pool_size; j++)
15230 : {
15231 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
15232 : {
15233 : traversal.visit(&(objectArray[i][j]));
15234 : }
15235 : }
15236 : }
15237 : #else
15238 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
15239 : // compute the list first and then call the visit function on each list element.
15240 :
15241 : // printf ("Inside of SgType::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
15242 :
15243 0 : std::vector<SgType*> nodeList;
15244 :
15245 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
15246 0 : for (unsigned int i=0; i < SgType::pools.size(); i++)
15247 : {
15248 : // objectArray[i] is a single memory pool
15249 0 : for (unsigned j=0; j < SgType::pool_size; j++)
15250 : {
15251 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
15252 : {
15253 0 : nodeList.push_back(&(objectArray[i][j]));
15254 : }
15255 : }
15256 : }
15257 :
15258 : // Iterate over the saved list
15259 0 : size_t nodeListSize = nodeList.size();
15260 0 : for (size_t i=0; i < nodeListSize; i++)
15261 : {
15262 0 : ROSE_ASSERT(nodeList[i] != NULL);
15263 : #if 0
15264 : traversal.visit(nodeList[i]);
15265 : #else
15266 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
15267 : {
15268 0 : traversal.visit(nodeList[i]);
15269 : }
15270 : #endif
15271 : }
15272 : #endif
15273 : }
15274 :
15275 : // This should not be required since all previously static data members are
15276 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
15277 :
15278 5668 : }
15279 :
15280 :
15281 : void
15282 194 : SgType::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
15283 : {
15284 : // This function traverses the memory pool for an IR node and
15285 : // calls the function to execute the visitor object.
15286 :
15287 : // Initialize array to the address of the first element of the STL vector
15288 : // (which is guarenteed to be contiguous storage).
15289 : // SgType objectArray [] = *(Memory_Block_List.begin());
15290 194 : if (SgType::pools.empty() == false)
15291 : {
15292 : // Generate an array of memory pools
15293 0 : SgType** objectArray = (SgType**) &(SgType::pools[0]);
15294 :
15295 : // Build a local variable for better performance
15296 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
15297 :
15298 : // Iterate over the memory pools
15299 0 : for (unsigned int i=0; i < SgType::pools.size(); i++)
15300 : {
15301 : // objectArray[i] is a single memory pool
15302 0 : for (unsigned j=0; j < SgType::pool_size; j++)
15303 : {
15304 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
15305 : {
15306 : // printf ("Found a valid SgType object in the memory pool %d at position %d \n",i,j);
15307 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
15308 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
15309 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
15310 : }
15311 : else
15312 : {
15313 : // printf ("Found a INVALID SgType object in the memory pool \n");
15314 : }
15315 : }
15316 : }
15317 : }
15318 :
15319 : // This should not be required since all previously static data members are
15320 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
15321 :
15322 194 : }
15323 :
15324 : void
15325 0 : SgType::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
15326 : {
15327 : // This function visits only a single IR node of the memory pool.
15328 : // it is typically called once for each type of IR node within
15329 : // the automatically generated function: traverseRepresentativeNodes().
15330 :
15331 : // Initialize array to the address of the first element of the STL vector
15332 : // (which is guarenteed to be contiguous storage).
15333 : // SgType objectArray [] = *(Memory_Block_List.begin());
15334 0 : if (SgType::pools.empty() == false)
15335 : {
15336 : // Generate an array of memory pools
15337 0 : SgType** objectArray = (SgType**) &(SgType::pools[0]);
15338 :
15339 : // Build a local variable for better performance
15340 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
15341 :
15342 : // Iterate over the memory pools
15343 0 : bool done = false;
15344 0 : unsigned i=0;
15345 :
15346 : // find the first valid IR node, call visit function, and then leave
15347 0 : while ( done == false && i < SgType::pools.size() )
15348 : {
15349 : // objectArray[i] is a single memory pool
15350 : unsigned j=0;
15351 0 : while (done == false && j < SgType::pool_size)
15352 : {
15353 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
15354 : {
15355 0 : traversal.visit(&(objectArray[i][j]));
15356 0 : done = true;
15357 : }
15358 0 : j++;
15359 : }
15360 0 : i++;
15361 : }
15362 :
15363 : #if 0
15364 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
15365 : if (done == false)
15366 : {
15367 : printf ("No representative for SgType found in memory pools \n");
15368 : }
15369 : #endif
15370 : }
15371 0 : }
15372 :
15373 :
15374 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
15375 : // using values that overflow signed values of int.
15376 : size_t
15377 4 : SgType::numberOfNodes()
15378 : {
15379 : // This function traverses the memory pool for an IR node and
15380 : // counts the number of IR nodes of a particular Sage III IR
15381 : // nodes type.
15382 :
15383 4 : size_t count = 0;
15384 4 : if (SgType::pools.empty() == false)
15385 : {
15386 : // Generate an array of memory pools (this is actually a STL vector,
15387 : // but it is contiguious, so OK to treat this way).
15388 0 : SgType** objectArray = (SgType**) &(SgType::pools[0]);
15389 :
15390 : // Build a local variable for better performance (make it a loop invariant variable).
15391 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
15392 :
15393 : // Iterate over all of the memory pools for this IR node.
15394 0 : for (unsigned int i=0; i < SgType::pools.size(); i++)
15395 : {
15396 : // objectArray[i] is a single memory pool, iterate over all the
15397 : // IR nodes and only count those that are valid IR nodes used in
15398 : // the AST (i.e. allocated IR nodes).
15399 0 : for (unsigned j=0; j < SgType::pool_size; j++)
15400 : {
15401 : // This is indexing the STL vector of C/C++ style arrays as a doubly
15402 : // indexed array access. It is OK since we have leveraged the semantics
15403 : // of STL vector memory as contigous and cast the memory as an array
15404 : // of arrays to use the 2D array indexing. Hope this is not confusing,
15405 : // but it s very fast as an implementation.
15406 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
15407 : {
15408 0 : count++;
15409 : }
15410 : }
15411 : }
15412 : }
15413 :
15414 :
15415 :
15416 4 : return count;
15417 : }
15418 :
15419 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
15420 : // using values that overflow signed values of int.
15421 : size_t
15422 0 : SgType::memoryUsage()
15423 : {
15424 : // This function is required because we need the class name as a type when we call sizeof
15425 : // There might be another way to implement this if we have a traversal that only called a
15426 : // representative object (one call for each type of Sage IIIIR node).
15427 0 : size_t memory = numberOfNodes() * sizeof(SgType);
15428 :
15429 0 : return memory;
15430 : }
15431 :
15432 : /* #line 15433 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
15433 :
15434 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
15435 : void
15436 5668 : SgTypeUnknown::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
15437 : {
15438 : // This function traverses the memory pool for only a specific IR node
15439 : // and calls the visit function of the input class execute a traversal
15440 : // similar to the style of the attribute based traversals within ROSE.
15441 : // This traversal will visit ALL nodes of the AST where as the other
15442 : // attribute based traversals visit only the embedded tree within the AST.
15443 :
15444 : // Initialize array to the address of the first element of the STL vector
15445 : // (which is guaranteed to be contiguous storage).
15446 : // SgTypeUnknown objectArray [] = *(Memory_Block_List.begin());
15447 5668 : if (SgTypeUnknown::pools.empty() == false)
15448 : {
15449 : // Generate an array of memory pools
15450 289 : SgTypeUnknown** objectArray = (SgTypeUnknown**) &(SgTypeUnknown::pools[0]);
15451 :
15452 : // Build a local variable for better performance
15453 289 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
15454 : #if 0
15455 : // Iterate over the memory pools
15456 : for (unsigned int i=0; i < SgTypeUnknown::pools.size(); i++)
15457 : {
15458 : // objectArray[i] is a single memory pool
15459 : for (int j=0; j < SgTypeUnknown::pool_size; j++)
15460 : {
15461 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
15462 : {
15463 : traversal.visit(&(objectArray[i][j]));
15464 : }
15465 : }
15466 : }
15467 : #else
15468 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
15469 : // compute the list first and then call the visit function on each list element.
15470 :
15471 : // printf ("Inside of SgTypeUnknown::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
15472 :
15473 578 : std::vector<SgTypeUnknown*> nodeList;
15474 :
15475 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
15476 578 : for (unsigned int i=0; i < SgTypeUnknown::pools.size(); i++)
15477 : {
15478 : // objectArray[i] is a single memory pool
15479 578289 : for (unsigned j=0; j < SgTypeUnknown::pool_size; j++)
15480 : {
15481 578000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
15482 : {
15483 289 : nodeList.push_back(&(objectArray[i][j]));
15484 : }
15485 : }
15486 : }
15487 :
15488 : // Iterate over the saved list
15489 289 : size_t nodeListSize = nodeList.size();
15490 578 : for (size_t i=0; i < nodeListSize; i++)
15491 : {
15492 289 : ROSE_ASSERT(nodeList[i] != NULL);
15493 : #if 0
15494 : traversal.visit(nodeList[i]);
15495 : #else
15496 289 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
15497 : {
15498 289 : traversal.visit(nodeList[i]);
15499 : }
15500 : #endif
15501 : }
15502 : #endif
15503 : }
15504 :
15505 : // This should not be required since all previously static data members are
15506 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
15507 :
15508 5668 : }
15509 :
15510 :
15511 : void
15512 194 : SgTypeUnknown::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
15513 : {
15514 : // This function traverses the memory pool for an IR node and
15515 : // calls the function to execute the visitor object.
15516 :
15517 : // Initialize array to the address of the first element of the STL vector
15518 : // (which is guarenteed to be contiguous storage).
15519 : // SgTypeUnknown objectArray [] = *(Memory_Block_List.begin());
15520 194 : if (SgTypeUnknown::pools.empty() == false)
15521 : {
15522 : // Generate an array of memory pools
15523 137 : SgTypeUnknown** objectArray = (SgTypeUnknown**) &(SgTypeUnknown::pools[0]);
15524 :
15525 : // Build a local variable for better performance
15526 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
15527 :
15528 : // Iterate over the memory pools
15529 274 : for (unsigned int i=0; i < SgTypeUnknown::pools.size(); i++)
15530 : {
15531 : // objectArray[i] is a single memory pool
15532 274137 : for (unsigned j=0; j < SgTypeUnknown::pool_size; j++)
15533 : {
15534 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
15535 : {
15536 : // printf ("Found a valid SgTypeUnknown object in the memory pool %d at position %d \n",i,j);
15537 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
15538 137 : objectArray[i][j].executeVisitorMemberFunction(visitor);
15539 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
15540 : }
15541 : else
15542 : {
15543 : // printf ("Found a INVALID SgTypeUnknown object in the memory pool \n");
15544 : }
15545 : }
15546 : }
15547 : }
15548 :
15549 : // This should not be required since all previously static data members are
15550 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
15551 :
15552 194 : }
15553 :
15554 : void
15555 0 : SgTypeUnknown::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
15556 : {
15557 : // This function visits only a single IR node of the memory pool.
15558 : // it is typically called once for each type of IR node within
15559 : // the automatically generated function: traverseRepresentativeNodes().
15560 :
15561 : // Initialize array to the address of the first element of the STL vector
15562 : // (which is guarenteed to be contiguous storage).
15563 : // SgTypeUnknown objectArray [] = *(Memory_Block_List.begin());
15564 0 : if (SgTypeUnknown::pools.empty() == false)
15565 : {
15566 : // Generate an array of memory pools
15567 0 : SgTypeUnknown** objectArray = (SgTypeUnknown**) &(SgTypeUnknown::pools[0]);
15568 :
15569 : // Build a local variable for better performance
15570 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
15571 :
15572 : // Iterate over the memory pools
15573 0 : bool done = false;
15574 0 : unsigned i=0;
15575 :
15576 : // find the first valid IR node, call visit function, and then leave
15577 0 : while ( done == false && i < SgTypeUnknown::pools.size() )
15578 : {
15579 : // objectArray[i] is a single memory pool
15580 : unsigned j=0;
15581 0 : while (done == false && j < SgTypeUnknown::pool_size)
15582 : {
15583 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
15584 : {
15585 0 : traversal.visit(&(objectArray[i][j]));
15586 0 : done = true;
15587 : }
15588 0 : j++;
15589 : }
15590 0 : i++;
15591 : }
15592 :
15593 : #if 0
15594 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
15595 : if (done == false)
15596 : {
15597 : printf ("No representative for SgTypeUnknown found in memory pools \n");
15598 : }
15599 : #endif
15600 : }
15601 0 : }
15602 :
15603 :
15604 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
15605 : // using values that overflow signed values of int.
15606 : size_t
15607 4 : SgTypeUnknown::numberOfNodes()
15608 : {
15609 : // This function traverses the memory pool for an IR node and
15610 : // counts the number of IR nodes of a particular Sage III IR
15611 : // nodes type.
15612 :
15613 4 : size_t count = 0;
15614 4 : if (SgTypeUnknown::pools.empty() == false)
15615 : {
15616 : // Generate an array of memory pools (this is actually a STL vector,
15617 : // but it is contiguious, so OK to treat this way).
15618 1 : SgTypeUnknown** objectArray = (SgTypeUnknown**) &(SgTypeUnknown::pools[0]);
15619 :
15620 : // Build a local variable for better performance (make it a loop invariant variable).
15621 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
15622 :
15623 : // Iterate over all of the memory pools for this IR node.
15624 2 : for (unsigned int i=0; i < SgTypeUnknown::pools.size(); i++)
15625 : {
15626 : // objectArray[i] is a single memory pool, iterate over all the
15627 : // IR nodes and only count those that are valid IR nodes used in
15628 : // the AST (i.e. allocated IR nodes).
15629 2001 : for (unsigned j=0; j < SgTypeUnknown::pool_size; j++)
15630 : {
15631 : // This is indexing the STL vector of C/C++ style arrays as a doubly
15632 : // indexed array access. It is OK since we have leveraged the semantics
15633 : // of STL vector memory as contigous and cast the memory as an array
15634 : // of arrays to use the 2D array indexing. Hope this is not confusing,
15635 : // but it s very fast as an implementation.
15636 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
15637 : {
15638 1 : count++;
15639 : }
15640 : }
15641 : }
15642 : }
15643 :
15644 :
15645 :
15646 4 : return count;
15647 : }
15648 :
15649 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
15650 : // using values that overflow signed values of int.
15651 : size_t
15652 0 : SgTypeUnknown::memoryUsage()
15653 : {
15654 : // This function is required because we need the class name as a type when we call sizeof
15655 : // There might be another way to implement this if we have a traversal that only called a
15656 : // representative object (one call for each type of Sage IIIIR node).
15657 0 : size_t memory = numberOfNodes() * sizeof(SgTypeUnknown);
15658 :
15659 0 : return memory;
15660 : }
15661 :
15662 : /* #line 15663 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
15663 :
15664 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
15665 : void
15666 5668 : SgTypeChar::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
15667 : {
15668 : // This function traverses the memory pool for only a specific IR node
15669 : // and calls the visit function of the input class execute a traversal
15670 : // similar to the style of the attribute based traversals within ROSE.
15671 : // This traversal will visit ALL nodes of the AST where as the other
15672 : // attribute based traversals visit only the embedded tree within the AST.
15673 :
15674 : // Initialize array to the address of the first element of the STL vector
15675 : // (which is guaranteed to be contiguous storage).
15676 : // SgTypeChar objectArray [] = *(Memory_Block_List.begin());
15677 5668 : if (SgTypeChar::pools.empty() == false)
15678 : {
15679 : // Generate an array of memory pools
15680 4892 : SgTypeChar** objectArray = (SgTypeChar**) &(SgTypeChar::pools[0]);
15681 :
15682 : // Build a local variable for better performance
15683 4892 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
15684 : #if 0
15685 : // Iterate over the memory pools
15686 : for (unsigned int i=0; i < SgTypeChar::pools.size(); i++)
15687 : {
15688 : // objectArray[i] is a single memory pool
15689 : for (int j=0; j < SgTypeChar::pool_size; j++)
15690 : {
15691 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
15692 : {
15693 : traversal.visit(&(objectArray[i][j]));
15694 : }
15695 : }
15696 : }
15697 : #else
15698 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
15699 : // compute the list first and then call the visit function on each list element.
15700 :
15701 : // printf ("Inside of SgTypeChar::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
15702 :
15703 9784 : std::vector<SgTypeChar*> nodeList;
15704 :
15705 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
15706 9784 : for (unsigned int i=0; i < SgTypeChar::pools.size(); i++)
15707 : {
15708 : // objectArray[i] is a single memory pool
15709 9788890 : for (unsigned j=0; j < SgTypeChar::pool_size; j++)
15710 : {
15711 9784000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
15712 : {
15713 4892 : nodeList.push_back(&(objectArray[i][j]));
15714 : }
15715 : }
15716 : }
15717 :
15718 : // Iterate over the saved list
15719 4892 : size_t nodeListSize = nodeList.size();
15720 9784 : for (size_t i=0; i < nodeListSize; i++)
15721 : {
15722 4892 : ROSE_ASSERT(nodeList[i] != NULL);
15723 : #if 0
15724 : traversal.visit(nodeList[i]);
15725 : #else
15726 4892 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
15727 : {
15728 4892 : traversal.visit(nodeList[i]);
15729 : }
15730 : #endif
15731 : }
15732 : #endif
15733 : }
15734 :
15735 : // This should not be required since all previously static data members are
15736 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
15737 :
15738 5668 : }
15739 :
15740 :
15741 : void
15742 194 : SgTypeChar::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
15743 : {
15744 : // This function traverses the memory pool for an IR node and
15745 : // calls the function to execute the visitor object.
15746 :
15747 : // Initialize array to the address of the first element of the STL vector
15748 : // (which is guarenteed to be contiguous storage).
15749 : // SgTypeChar objectArray [] = *(Memory_Block_List.begin());
15750 194 : if (SgTypeChar::pools.empty() == false)
15751 : {
15752 : // Generate an array of memory pools
15753 194 : SgTypeChar** objectArray = (SgTypeChar**) &(SgTypeChar::pools[0]);
15754 :
15755 : // Build a local variable for better performance
15756 194 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
15757 :
15758 : // Iterate over the memory pools
15759 388 : for (unsigned int i=0; i < SgTypeChar::pools.size(); i++)
15760 : {
15761 : // objectArray[i] is a single memory pool
15762 388194 : for (unsigned j=0; j < SgTypeChar::pool_size; j++)
15763 : {
15764 388000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
15765 : {
15766 : // printf ("Found a valid SgTypeChar object in the memory pool %d at position %d \n",i,j);
15767 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
15768 194 : objectArray[i][j].executeVisitorMemberFunction(visitor);
15769 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
15770 : }
15771 : else
15772 : {
15773 : // printf ("Found a INVALID SgTypeChar object in the memory pool \n");
15774 : }
15775 : }
15776 : }
15777 : }
15778 :
15779 : // This should not be required since all previously static data members are
15780 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
15781 :
15782 194 : }
15783 :
15784 : void
15785 0 : SgTypeChar::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
15786 : {
15787 : // This function visits only a single IR node of the memory pool.
15788 : // it is typically called once for each type of IR node within
15789 : // the automatically generated function: traverseRepresentativeNodes().
15790 :
15791 : // Initialize array to the address of the first element of the STL vector
15792 : // (which is guarenteed to be contiguous storage).
15793 : // SgTypeChar objectArray [] = *(Memory_Block_List.begin());
15794 0 : if (SgTypeChar::pools.empty() == false)
15795 : {
15796 : // Generate an array of memory pools
15797 0 : SgTypeChar** objectArray = (SgTypeChar**) &(SgTypeChar::pools[0]);
15798 :
15799 : // Build a local variable for better performance
15800 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
15801 :
15802 : // Iterate over the memory pools
15803 0 : bool done = false;
15804 0 : unsigned i=0;
15805 :
15806 : // find the first valid IR node, call visit function, and then leave
15807 0 : while ( done == false && i < SgTypeChar::pools.size() )
15808 : {
15809 : // objectArray[i] is a single memory pool
15810 : unsigned j=0;
15811 0 : while (done == false && j < SgTypeChar::pool_size)
15812 : {
15813 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
15814 : {
15815 0 : traversal.visit(&(objectArray[i][j]));
15816 0 : done = true;
15817 : }
15818 0 : j++;
15819 : }
15820 0 : i++;
15821 : }
15822 :
15823 : #if 0
15824 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
15825 : if (done == false)
15826 : {
15827 : printf ("No representative for SgTypeChar found in memory pools \n");
15828 : }
15829 : #endif
15830 : }
15831 0 : }
15832 :
15833 :
15834 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
15835 : // using values that overflow signed values of int.
15836 : size_t
15837 4 : SgTypeChar::numberOfNodes()
15838 : {
15839 : // This function traverses the memory pool for an IR node and
15840 : // counts the number of IR nodes of a particular Sage III IR
15841 : // nodes type.
15842 :
15843 4 : size_t count = 0;
15844 4 : if (SgTypeChar::pools.empty() == false)
15845 : {
15846 : // Generate an array of memory pools (this is actually a STL vector,
15847 : // but it is contiguious, so OK to treat this way).
15848 2 : SgTypeChar** objectArray = (SgTypeChar**) &(SgTypeChar::pools[0]);
15849 :
15850 : // Build a local variable for better performance (make it a loop invariant variable).
15851 2 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
15852 :
15853 : // Iterate over all of the memory pools for this IR node.
15854 4 : for (unsigned int i=0; i < SgTypeChar::pools.size(); i++)
15855 : {
15856 : // objectArray[i] is a single memory pool, iterate over all the
15857 : // IR nodes and only count those that are valid IR nodes used in
15858 : // the AST (i.e. allocated IR nodes).
15859 4002 : for (unsigned j=0; j < SgTypeChar::pool_size; j++)
15860 : {
15861 : // This is indexing the STL vector of C/C++ style arrays as a doubly
15862 : // indexed array access. It is OK since we have leveraged the semantics
15863 : // of STL vector memory as contigous and cast the memory as an array
15864 : // of arrays to use the 2D array indexing. Hope this is not confusing,
15865 : // but it s very fast as an implementation.
15866 4000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
15867 : {
15868 2 : count++;
15869 : }
15870 : }
15871 : }
15872 : }
15873 :
15874 :
15875 :
15876 4 : return count;
15877 : }
15878 :
15879 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
15880 : // using values that overflow signed values of int.
15881 : size_t
15882 0 : SgTypeChar::memoryUsage()
15883 : {
15884 : // This function is required because we need the class name as a type when we call sizeof
15885 : // There might be another way to implement this if we have a traversal that only called a
15886 : // representative object (one call for each type of Sage IIIIR node).
15887 0 : size_t memory = numberOfNodes() * sizeof(SgTypeChar);
15888 :
15889 0 : return memory;
15890 : }
15891 :
15892 : /* #line 15893 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
15893 :
15894 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
15895 : void
15896 5668 : SgTypeSignedChar::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
15897 : {
15898 : // This function traverses the memory pool for only a specific IR node
15899 : // and calls the visit function of the input class execute a traversal
15900 : // similar to the style of the attribute based traversals within ROSE.
15901 : // This traversal will visit ALL nodes of the AST where as the other
15902 : // attribute based traversals visit only the embedded tree within the AST.
15903 :
15904 : // Initialize array to the address of the first element of the STL vector
15905 : // (which is guaranteed to be contiguous storage).
15906 : // SgTypeSignedChar objectArray [] = *(Memory_Block_List.begin());
15907 5668 : if (SgTypeSignedChar::pools.empty() == false)
15908 : {
15909 : // Generate an array of memory pools
15910 3153 : SgTypeSignedChar** objectArray = (SgTypeSignedChar**) &(SgTypeSignedChar::pools[0]);
15911 :
15912 : // Build a local variable for better performance
15913 3153 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
15914 : #if 0
15915 : // Iterate over the memory pools
15916 : for (unsigned int i=0; i < SgTypeSignedChar::pools.size(); i++)
15917 : {
15918 : // objectArray[i] is a single memory pool
15919 : for (int j=0; j < SgTypeSignedChar::pool_size; j++)
15920 : {
15921 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
15922 : {
15923 : traversal.visit(&(objectArray[i][j]));
15924 : }
15925 : }
15926 : }
15927 : #else
15928 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
15929 : // compute the list first and then call the visit function on each list element.
15930 :
15931 : // printf ("Inside of SgTypeSignedChar::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
15932 :
15933 6306 : std::vector<SgTypeSignedChar*> nodeList;
15934 :
15935 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
15936 6306 : for (unsigned int i=0; i < SgTypeSignedChar::pools.size(); i++)
15937 : {
15938 : // objectArray[i] is a single memory pool
15939 6309150 : for (unsigned j=0; j < SgTypeSignedChar::pool_size; j++)
15940 : {
15941 6306000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
15942 : {
15943 3153 : nodeList.push_back(&(objectArray[i][j]));
15944 : }
15945 : }
15946 : }
15947 :
15948 : // Iterate over the saved list
15949 3153 : size_t nodeListSize = nodeList.size();
15950 6306 : for (size_t i=0; i < nodeListSize; i++)
15951 : {
15952 3153 : ROSE_ASSERT(nodeList[i] != NULL);
15953 : #if 0
15954 : traversal.visit(nodeList[i]);
15955 : #else
15956 3153 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
15957 : {
15958 3153 : traversal.visit(nodeList[i]);
15959 : }
15960 : #endif
15961 : }
15962 : #endif
15963 : }
15964 :
15965 : // This should not be required since all previously static data members are
15966 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
15967 :
15968 5668 : }
15969 :
15970 :
15971 : void
15972 194 : SgTypeSignedChar::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
15973 : {
15974 : // This function traverses the memory pool for an IR node and
15975 : // calls the function to execute the visitor object.
15976 :
15977 : // Initialize array to the address of the first element of the STL vector
15978 : // (which is guarenteed to be contiguous storage).
15979 : // SgTypeSignedChar objectArray [] = *(Memory_Block_List.begin());
15980 194 : if (SgTypeSignedChar::pools.empty() == false)
15981 : {
15982 : // Generate an array of memory pools
15983 137 : SgTypeSignedChar** objectArray = (SgTypeSignedChar**) &(SgTypeSignedChar::pools[0]);
15984 :
15985 : // Build a local variable for better performance
15986 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
15987 :
15988 : // Iterate over the memory pools
15989 274 : for (unsigned int i=0; i < SgTypeSignedChar::pools.size(); i++)
15990 : {
15991 : // objectArray[i] is a single memory pool
15992 274137 : for (unsigned j=0; j < SgTypeSignedChar::pool_size; j++)
15993 : {
15994 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
15995 : {
15996 : // printf ("Found a valid SgTypeSignedChar object in the memory pool %d at position %d \n",i,j);
15997 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
15998 137 : objectArray[i][j].executeVisitorMemberFunction(visitor);
15999 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
16000 : }
16001 : else
16002 : {
16003 : // printf ("Found a INVALID SgTypeSignedChar object in the memory pool \n");
16004 : }
16005 : }
16006 : }
16007 : }
16008 :
16009 : // This should not be required since all previously static data members are
16010 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
16011 :
16012 194 : }
16013 :
16014 : void
16015 0 : SgTypeSignedChar::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
16016 : {
16017 : // This function visits only a single IR node of the memory pool.
16018 : // it is typically called once for each type of IR node within
16019 : // the automatically generated function: traverseRepresentativeNodes().
16020 :
16021 : // Initialize array to the address of the first element of the STL vector
16022 : // (which is guarenteed to be contiguous storage).
16023 : // SgTypeSignedChar objectArray [] = *(Memory_Block_List.begin());
16024 0 : if (SgTypeSignedChar::pools.empty() == false)
16025 : {
16026 : // Generate an array of memory pools
16027 0 : SgTypeSignedChar** objectArray = (SgTypeSignedChar**) &(SgTypeSignedChar::pools[0]);
16028 :
16029 : // Build a local variable for better performance
16030 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
16031 :
16032 : // Iterate over the memory pools
16033 0 : bool done = false;
16034 0 : unsigned i=0;
16035 :
16036 : // find the first valid IR node, call visit function, and then leave
16037 0 : while ( done == false && i < SgTypeSignedChar::pools.size() )
16038 : {
16039 : // objectArray[i] is a single memory pool
16040 : unsigned j=0;
16041 0 : while (done == false && j < SgTypeSignedChar::pool_size)
16042 : {
16043 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
16044 : {
16045 0 : traversal.visit(&(objectArray[i][j]));
16046 0 : done = true;
16047 : }
16048 0 : j++;
16049 : }
16050 0 : i++;
16051 : }
16052 :
16053 : #if 0
16054 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
16055 : if (done == false)
16056 : {
16057 : printf ("No representative for SgTypeSignedChar found in memory pools \n");
16058 : }
16059 : #endif
16060 : }
16061 0 : }
16062 :
16063 :
16064 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
16065 : // using values that overflow signed values of int.
16066 : size_t
16067 4 : SgTypeSignedChar::numberOfNodes()
16068 : {
16069 : // This function traverses the memory pool for an IR node and
16070 : // counts the number of IR nodes of a particular Sage III IR
16071 : // nodes type.
16072 :
16073 4 : size_t count = 0;
16074 4 : if (SgTypeSignedChar::pools.empty() == false)
16075 : {
16076 : // Generate an array of memory pools (this is actually a STL vector,
16077 : // but it is contiguious, so OK to treat this way).
16078 2 : SgTypeSignedChar** objectArray = (SgTypeSignedChar**) &(SgTypeSignedChar::pools[0]);
16079 :
16080 : // Build a local variable for better performance (make it a loop invariant variable).
16081 2 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
16082 :
16083 : // Iterate over all of the memory pools for this IR node.
16084 4 : for (unsigned int i=0; i < SgTypeSignedChar::pools.size(); i++)
16085 : {
16086 : // objectArray[i] is a single memory pool, iterate over all the
16087 : // IR nodes and only count those that are valid IR nodes used in
16088 : // the AST (i.e. allocated IR nodes).
16089 4002 : for (unsigned j=0; j < SgTypeSignedChar::pool_size; j++)
16090 : {
16091 : // This is indexing the STL vector of C/C++ style arrays as a doubly
16092 : // indexed array access. It is OK since we have leveraged the semantics
16093 : // of STL vector memory as contigous and cast the memory as an array
16094 : // of arrays to use the 2D array indexing. Hope this is not confusing,
16095 : // but it s very fast as an implementation.
16096 4000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
16097 : {
16098 2 : count++;
16099 : }
16100 : }
16101 : }
16102 : }
16103 :
16104 :
16105 :
16106 4 : return count;
16107 : }
16108 :
16109 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
16110 : // using values that overflow signed values of int.
16111 : size_t
16112 0 : SgTypeSignedChar::memoryUsage()
16113 : {
16114 : // This function is required because we need the class name as a type when we call sizeof
16115 : // There might be another way to implement this if we have a traversal that only called a
16116 : // representative object (one call for each type of Sage IIIIR node).
16117 0 : size_t memory = numberOfNodes() * sizeof(SgTypeSignedChar);
16118 :
16119 0 : return memory;
16120 : }
16121 :
16122 : /* #line 16123 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
16123 :
16124 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
16125 : void
16126 5668 : SgTypeUnsignedChar::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
16127 : {
16128 : // This function traverses the memory pool for only a specific IR node
16129 : // and calls the visit function of the input class execute a traversal
16130 : // similar to the style of the attribute based traversals within ROSE.
16131 : // This traversal will visit ALL nodes of the AST where as the other
16132 : // attribute based traversals visit only the embedded tree within the AST.
16133 :
16134 : // Initialize array to the address of the first element of the STL vector
16135 : // (which is guaranteed to be contiguous storage).
16136 : // SgTypeUnsignedChar objectArray [] = *(Memory_Block_List.begin());
16137 5668 : if (SgTypeUnsignedChar::pools.empty() == false)
16138 : {
16139 : // Generate an array of memory pools
16140 4892 : SgTypeUnsignedChar** objectArray = (SgTypeUnsignedChar**) &(SgTypeUnsignedChar::pools[0]);
16141 :
16142 : // Build a local variable for better performance
16143 4892 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
16144 : #if 0
16145 : // Iterate over the memory pools
16146 : for (unsigned int i=0; i < SgTypeUnsignedChar::pools.size(); i++)
16147 : {
16148 : // objectArray[i] is a single memory pool
16149 : for (int j=0; j < SgTypeUnsignedChar::pool_size; j++)
16150 : {
16151 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
16152 : {
16153 : traversal.visit(&(objectArray[i][j]));
16154 : }
16155 : }
16156 : }
16157 : #else
16158 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
16159 : // compute the list first and then call the visit function on each list element.
16160 :
16161 : // printf ("Inside of SgTypeUnsignedChar::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
16162 :
16163 9784 : std::vector<SgTypeUnsignedChar*> nodeList;
16164 :
16165 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
16166 9784 : for (unsigned int i=0; i < SgTypeUnsignedChar::pools.size(); i++)
16167 : {
16168 : // objectArray[i] is a single memory pool
16169 9788890 : for (unsigned j=0; j < SgTypeUnsignedChar::pool_size; j++)
16170 : {
16171 9784000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
16172 : {
16173 4892 : nodeList.push_back(&(objectArray[i][j]));
16174 : }
16175 : }
16176 : }
16177 :
16178 : // Iterate over the saved list
16179 4892 : size_t nodeListSize = nodeList.size();
16180 9784 : for (size_t i=0; i < nodeListSize; i++)
16181 : {
16182 4892 : ROSE_ASSERT(nodeList[i] != NULL);
16183 : #if 0
16184 : traversal.visit(nodeList[i]);
16185 : #else
16186 4892 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
16187 : {
16188 4892 : traversal.visit(nodeList[i]);
16189 : }
16190 : #endif
16191 : }
16192 : #endif
16193 : }
16194 :
16195 : // This should not be required since all previously static data members are
16196 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
16197 :
16198 5668 : }
16199 :
16200 :
16201 : void
16202 194 : SgTypeUnsignedChar::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
16203 : {
16204 : // This function traverses the memory pool for an IR node and
16205 : // calls the function to execute the visitor object.
16206 :
16207 : // Initialize array to the address of the first element of the STL vector
16208 : // (which is guarenteed to be contiguous storage).
16209 : // SgTypeUnsignedChar objectArray [] = *(Memory_Block_List.begin());
16210 194 : if (SgTypeUnsignedChar::pools.empty() == false)
16211 : {
16212 : // Generate an array of memory pools
16213 194 : SgTypeUnsignedChar** objectArray = (SgTypeUnsignedChar**) &(SgTypeUnsignedChar::pools[0]);
16214 :
16215 : // Build a local variable for better performance
16216 194 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
16217 :
16218 : // Iterate over the memory pools
16219 388 : for (unsigned int i=0; i < SgTypeUnsignedChar::pools.size(); i++)
16220 : {
16221 : // objectArray[i] is a single memory pool
16222 388194 : for (unsigned j=0; j < SgTypeUnsignedChar::pool_size; j++)
16223 : {
16224 388000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
16225 : {
16226 : // printf ("Found a valid SgTypeUnsignedChar object in the memory pool %d at position %d \n",i,j);
16227 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
16228 194 : objectArray[i][j].executeVisitorMemberFunction(visitor);
16229 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
16230 : }
16231 : else
16232 : {
16233 : // printf ("Found a INVALID SgTypeUnsignedChar object in the memory pool \n");
16234 : }
16235 : }
16236 : }
16237 : }
16238 :
16239 : // This should not be required since all previously static data members are
16240 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
16241 :
16242 194 : }
16243 :
16244 : void
16245 0 : SgTypeUnsignedChar::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
16246 : {
16247 : // This function visits only a single IR node of the memory pool.
16248 : // it is typically called once for each type of IR node within
16249 : // the automatically generated function: traverseRepresentativeNodes().
16250 :
16251 : // Initialize array to the address of the first element of the STL vector
16252 : // (which is guarenteed to be contiguous storage).
16253 : // SgTypeUnsignedChar objectArray [] = *(Memory_Block_List.begin());
16254 0 : if (SgTypeUnsignedChar::pools.empty() == false)
16255 : {
16256 : // Generate an array of memory pools
16257 0 : SgTypeUnsignedChar** objectArray = (SgTypeUnsignedChar**) &(SgTypeUnsignedChar::pools[0]);
16258 :
16259 : // Build a local variable for better performance
16260 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
16261 :
16262 : // Iterate over the memory pools
16263 0 : bool done = false;
16264 0 : unsigned i=0;
16265 :
16266 : // find the first valid IR node, call visit function, and then leave
16267 0 : while ( done == false && i < SgTypeUnsignedChar::pools.size() )
16268 : {
16269 : // objectArray[i] is a single memory pool
16270 : unsigned j=0;
16271 0 : while (done == false && j < SgTypeUnsignedChar::pool_size)
16272 : {
16273 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
16274 : {
16275 0 : traversal.visit(&(objectArray[i][j]));
16276 0 : done = true;
16277 : }
16278 0 : j++;
16279 : }
16280 0 : i++;
16281 : }
16282 :
16283 : #if 0
16284 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
16285 : if (done == false)
16286 : {
16287 : printf ("No representative for SgTypeUnsignedChar found in memory pools \n");
16288 : }
16289 : #endif
16290 : }
16291 0 : }
16292 :
16293 :
16294 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
16295 : // using values that overflow signed values of int.
16296 : size_t
16297 4 : SgTypeUnsignedChar::numberOfNodes()
16298 : {
16299 : // This function traverses the memory pool for an IR node and
16300 : // counts the number of IR nodes of a particular Sage III IR
16301 : // nodes type.
16302 :
16303 4 : size_t count = 0;
16304 4 : if (SgTypeUnsignedChar::pools.empty() == false)
16305 : {
16306 : // Generate an array of memory pools (this is actually a STL vector,
16307 : // but it is contiguious, so OK to treat this way).
16308 2 : SgTypeUnsignedChar** objectArray = (SgTypeUnsignedChar**) &(SgTypeUnsignedChar::pools[0]);
16309 :
16310 : // Build a local variable for better performance (make it a loop invariant variable).
16311 2 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
16312 :
16313 : // Iterate over all of the memory pools for this IR node.
16314 4 : for (unsigned int i=0; i < SgTypeUnsignedChar::pools.size(); i++)
16315 : {
16316 : // objectArray[i] is a single memory pool, iterate over all the
16317 : // IR nodes and only count those that are valid IR nodes used in
16318 : // the AST (i.e. allocated IR nodes).
16319 4002 : for (unsigned j=0; j < SgTypeUnsignedChar::pool_size; j++)
16320 : {
16321 : // This is indexing the STL vector of C/C++ style arrays as a doubly
16322 : // indexed array access. It is OK since we have leveraged the semantics
16323 : // of STL vector memory as contigous and cast the memory as an array
16324 : // of arrays to use the 2D array indexing. Hope this is not confusing,
16325 : // but it s very fast as an implementation.
16326 4000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
16327 : {
16328 2 : count++;
16329 : }
16330 : }
16331 : }
16332 : }
16333 :
16334 :
16335 :
16336 4 : return count;
16337 : }
16338 :
16339 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
16340 : // using values that overflow signed values of int.
16341 : size_t
16342 0 : SgTypeUnsignedChar::memoryUsage()
16343 : {
16344 : // This function is required because we need the class name as a type when we call sizeof
16345 : // There might be another way to implement this if we have a traversal that only called a
16346 : // representative object (one call for each type of Sage IIIIR node).
16347 0 : size_t memory = numberOfNodes() * sizeof(SgTypeUnsignedChar);
16348 :
16349 0 : return memory;
16350 : }
16351 :
16352 : /* #line 16353 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
16353 :
16354 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
16355 : void
16356 5668 : SgTypeShort::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
16357 : {
16358 : // This function traverses the memory pool for only a specific IR node
16359 : // and calls the visit function of the input class execute a traversal
16360 : // similar to the style of the attribute based traversals within ROSE.
16361 : // This traversal will visit ALL nodes of the AST where as the other
16362 : // attribute based traversals visit only the embedded tree within the AST.
16363 :
16364 : // Initialize array to the address of the first element of the STL vector
16365 : // (which is guaranteed to be contiguous storage).
16366 : // SgTypeShort objectArray [] = *(Memory_Block_List.begin());
16367 5668 : if (SgTypeShort::pools.empty() == false)
16368 : {
16369 : // Generate an array of memory pools
16370 4892 : SgTypeShort** objectArray = (SgTypeShort**) &(SgTypeShort::pools[0]);
16371 :
16372 : // Build a local variable for better performance
16373 4892 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
16374 : #if 0
16375 : // Iterate over the memory pools
16376 : for (unsigned int i=0; i < SgTypeShort::pools.size(); i++)
16377 : {
16378 : // objectArray[i] is a single memory pool
16379 : for (int j=0; j < SgTypeShort::pool_size; j++)
16380 : {
16381 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
16382 : {
16383 : traversal.visit(&(objectArray[i][j]));
16384 : }
16385 : }
16386 : }
16387 : #else
16388 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
16389 : // compute the list first and then call the visit function on each list element.
16390 :
16391 : // printf ("Inside of SgTypeShort::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
16392 :
16393 9784 : std::vector<SgTypeShort*> nodeList;
16394 :
16395 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
16396 9784 : for (unsigned int i=0; i < SgTypeShort::pools.size(); i++)
16397 : {
16398 : // objectArray[i] is a single memory pool
16399 9788890 : for (unsigned j=0; j < SgTypeShort::pool_size; j++)
16400 : {
16401 9784000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
16402 : {
16403 4892 : nodeList.push_back(&(objectArray[i][j]));
16404 : }
16405 : }
16406 : }
16407 :
16408 : // Iterate over the saved list
16409 4892 : size_t nodeListSize = nodeList.size();
16410 9784 : for (size_t i=0; i < nodeListSize; i++)
16411 : {
16412 4892 : ROSE_ASSERT(nodeList[i] != NULL);
16413 : #if 0
16414 : traversal.visit(nodeList[i]);
16415 : #else
16416 4892 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
16417 : {
16418 4892 : traversal.visit(nodeList[i]);
16419 : }
16420 : #endif
16421 : }
16422 : #endif
16423 : }
16424 :
16425 : // This should not be required since all previously static data members are
16426 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
16427 :
16428 5668 : }
16429 :
16430 :
16431 : void
16432 194 : SgTypeShort::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
16433 : {
16434 : // This function traverses the memory pool for an IR node and
16435 : // calls the function to execute the visitor object.
16436 :
16437 : // Initialize array to the address of the first element of the STL vector
16438 : // (which is guarenteed to be contiguous storage).
16439 : // SgTypeShort objectArray [] = *(Memory_Block_List.begin());
16440 194 : if (SgTypeShort::pools.empty() == false)
16441 : {
16442 : // Generate an array of memory pools
16443 194 : SgTypeShort** objectArray = (SgTypeShort**) &(SgTypeShort::pools[0]);
16444 :
16445 : // Build a local variable for better performance
16446 194 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
16447 :
16448 : // Iterate over the memory pools
16449 388 : for (unsigned int i=0; i < SgTypeShort::pools.size(); i++)
16450 : {
16451 : // objectArray[i] is a single memory pool
16452 388194 : for (unsigned j=0; j < SgTypeShort::pool_size; j++)
16453 : {
16454 388000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
16455 : {
16456 : // printf ("Found a valid SgTypeShort object in the memory pool %d at position %d \n",i,j);
16457 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
16458 194 : objectArray[i][j].executeVisitorMemberFunction(visitor);
16459 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
16460 : }
16461 : else
16462 : {
16463 : // printf ("Found a INVALID SgTypeShort object in the memory pool \n");
16464 : }
16465 : }
16466 : }
16467 : }
16468 :
16469 : // This should not be required since all previously static data members are
16470 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
16471 :
16472 194 : }
16473 :
16474 : void
16475 0 : SgTypeShort::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
16476 : {
16477 : // This function visits only a single IR node of the memory pool.
16478 : // it is typically called once for each type of IR node within
16479 : // the automatically generated function: traverseRepresentativeNodes().
16480 :
16481 : // Initialize array to the address of the first element of the STL vector
16482 : // (which is guarenteed to be contiguous storage).
16483 : // SgTypeShort objectArray [] = *(Memory_Block_List.begin());
16484 0 : if (SgTypeShort::pools.empty() == false)
16485 : {
16486 : // Generate an array of memory pools
16487 0 : SgTypeShort** objectArray = (SgTypeShort**) &(SgTypeShort::pools[0]);
16488 :
16489 : // Build a local variable for better performance
16490 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
16491 :
16492 : // Iterate over the memory pools
16493 0 : bool done = false;
16494 0 : unsigned i=0;
16495 :
16496 : // find the first valid IR node, call visit function, and then leave
16497 0 : while ( done == false && i < SgTypeShort::pools.size() )
16498 : {
16499 : // objectArray[i] is a single memory pool
16500 : unsigned j=0;
16501 0 : while (done == false && j < SgTypeShort::pool_size)
16502 : {
16503 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
16504 : {
16505 0 : traversal.visit(&(objectArray[i][j]));
16506 0 : done = true;
16507 : }
16508 0 : j++;
16509 : }
16510 0 : i++;
16511 : }
16512 :
16513 : #if 0
16514 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
16515 : if (done == false)
16516 : {
16517 : printf ("No representative for SgTypeShort found in memory pools \n");
16518 : }
16519 : #endif
16520 : }
16521 0 : }
16522 :
16523 :
16524 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
16525 : // using values that overflow signed values of int.
16526 : size_t
16527 4 : SgTypeShort::numberOfNodes()
16528 : {
16529 : // This function traverses the memory pool for an IR node and
16530 : // counts the number of IR nodes of a particular Sage III IR
16531 : // nodes type.
16532 :
16533 4 : size_t count = 0;
16534 4 : if (SgTypeShort::pools.empty() == false)
16535 : {
16536 : // Generate an array of memory pools (this is actually a STL vector,
16537 : // but it is contiguious, so OK to treat this way).
16538 2 : SgTypeShort** objectArray = (SgTypeShort**) &(SgTypeShort::pools[0]);
16539 :
16540 : // Build a local variable for better performance (make it a loop invariant variable).
16541 2 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
16542 :
16543 : // Iterate over all of the memory pools for this IR node.
16544 4 : for (unsigned int i=0; i < SgTypeShort::pools.size(); i++)
16545 : {
16546 : // objectArray[i] is a single memory pool, iterate over all the
16547 : // IR nodes and only count those that are valid IR nodes used in
16548 : // the AST (i.e. allocated IR nodes).
16549 4002 : for (unsigned j=0; j < SgTypeShort::pool_size; j++)
16550 : {
16551 : // This is indexing the STL vector of C/C++ style arrays as a doubly
16552 : // indexed array access. It is OK since we have leveraged the semantics
16553 : // of STL vector memory as contigous and cast the memory as an array
16554 : // of arrays to use the 2D array indexing. Hope this is not confusing,
16555 : // but it s very fast as an implementation.
16556 4000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
16557 : {
16558 2 : count++;
16559 : }
16560 : }
16561 : }
16562 : }
16563 :
16564 :
16565 :
16566 4 : return count;
16567 : }
16568 :
16569 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
16570 : // using values that overflow signed values of int.
16571 : size_t
16572 0 : SgTypeShort::memoryUsage()
16573 : {
16574 : // This function is required because we need the class name as a type when we call sizeof
16575 : // There might be another way to implement this if we have a traversal that only called a
16576 : // representative object (one call for each type of Sage IIIIR node).
16577 0 : size_t memory = numberOfNodes() * sizeof(SgTypeShort);
16578 :
16579 0 : return memory;
16580 : }
16581 :
16582 : /* #line 16583 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
16583 :
16584 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
16585 : void
16586 5668 : SgTypeSignedShort::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
16587 : {
16588 : // This function traverses the memory pool for only a specific IR node
16589 : // and calls the visit function of the input class execute a traversal
16590 : // similar to the style of the attribute based traversals within ROSE.
16591 : // This traversal will visit ALL nodes of the AST where as the other
16592 : // attribute based traversals visit only the embedded tree within the AST.
16593 :
16594 : // Initialize array to the address of the first element of the STL vector
16595 : // (which is guaranteed to be contiguous storage).
16596 : // SgTypeSignedShort objectArray [] = *(Memory_Block_List.begin());
16597 5668 : if (SgTypeSignedShort::pools.empty() == false)
16598 : {
16599 : // Generate an array of memory pools
16600 3153 : SgTypeSignedShort** objectArray = (SgTypeSignedShort**) &(SgTypeSignedShort::pools[0]);
16601 :
16602 : // Build a local variable for better performance
16603 3153 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
16604 : #if 0
16605 : // Iterate over the memory pools
16606 : for (unsigned int i=0; i < SgTypeSignedShort::pools.size(); i++)
16607 : {
16608 : // objectArray[i] is a single memory pool
16609 : for (int j=0; j < SgTypeSignedShort::pool_size; j++)
16610 : {
16611 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
16612 : {
16613 : traversal.visit(&(objectArray[i][j]));
16614 : }
16615 : }
16616 : }
16617 : #else
16618 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
16619 : // compute the list first and then call the visit function on each list element.
16620 :
16621 : // printf ("Inside of SgTypeSignedShort::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
16622 :
16623 6306 : std::vector<SgTypeSignedShort*> nodeList;
16624 :
16625 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
16626 6306 : for (unsigned int i=0; i < SgTypeSignedShort::pools.size(); i++)
16627 : {
16628 : // objectArray[i] is a single memory pool
16629 6309150 : for (unsigned j=0; j < SgTypeSignedShort::pool_size; j++)
16630 : {
16631 6306000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
16632 : {
16633 3153 : nodeList.push_back(&(objectArray[i][j]));
16634 : }
16635 : }
16636 : }
16637 :
16638 : // Iterate over the saved list
16639 3153 : size_t nodeListSize = nodeList.size();
16640 6306 : for (size_t i=0; i < nodeListSize; i++)
16641 : {
16642 3153 : ROSE_ASSERT(nodeList[i] != NULL);
16643 : #if 0
16644 : traversal.visit(nodeList[i]);
16645 : #else
16646 3153 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
16647 : {
16648 3153 : traversal.visit(nodeList[i]);
16649 : }
16650 : #endif
16651 : }
16652 : #endif
16653 : }
16654 :
16655 : // This should not be required since all previously static data members are
16656 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
16657 :
16658 5668 : }
16659 :
16660 :
16661 : void
16662 194 : SgTypeSignedShort::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
16663 : {
16664 : // This function traverses the memory pool for an IR node and
16665 : // calls the function to execute the visitor object.
16666 :
16667 : // Initialize array to the address of the first element of the STL vector
16668 : // (which is guarenteed to be contiguous storage).
16669 : // SgTypeSignedShort objectArray [] = *(Memory_Block_List.begin());
16670 194 : if (SgTypeSignedShort::pools.empty() == false)
16671 : {
16672 : // Generate an array of memory pools
16673 137 : SgTypeSignedShort** objectArray = (SgTypeSignedShort**) &(SgTypeSignedShort::pools[0]);
16674 :
16675 : // Build a local variable for better performance
16676 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
16677 :
16678 : // Iterate over the memory pools
16679 274 : for (unsigned int i=0; i < SgTypeSignedShort::pools.size(); i++)
16680 : {
16681 : // objectArray[i] is a single memory pool
16682 274137 : for (unsigned j=0; j < SgTypeSignedShort::pool_size; j++)
16683 : {
16684 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
16685 : {
16686 : // printf ("Found a valid SgTypeSignedShort object in the memory pool %d at position %d \n",i,j);
16687 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
16688 137 : objectArray[i][j].executeVisitorMemberFunction(visitor);
16689 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
16690 : }
16691 : else
16692 : {
16693 : // printf ("Found a INVALID SgTypeSignedShort object in the memory pool \n");
16694 : }
16695 : }
16696 : }
16697 : }
16698 :
16699 : // This should not be required since all previously static data members are
16700 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
16701 :
16702 194 : }
16703 :
16704 : void
16705 0 : SgTypeSignedShort::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
16706 : {
16707 : // This function visits only a single IR node of the memory pool.
16708 : // it is typically called once for each type of IR node within
16709 : // the automatically generated function: traverseRepresentativeNodes().
16710 :
16711 : // Initialize array to the address of the first element of the STL vector
16712 : // (which is guarenteed to be contiguous storage).
16713 : // SgTypeSignedShort objectArray [] = *(Memory_Block_List.begin());
16714 0 : if (SgTypeSignedShort::pools.empty() == false)
16715 : {
16716 : // Generate an array of memory pools
16717 0 : SgTypeSignedShort** objectArray = (SgTypeSignedShort**) &(SgTypeSignedShort::pools[0]);
16718 :
16719 : // Build a local variable for better performance
16720 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
16721 :
16722 : // Iterate over the memory pools
16723 0 : bool done = false;
16724 0 : unsigned i=0;
16725 :
16726 : // find the first valid IR node, call visit function, and then leave
16727 0 : while ( done == false && i < SgTypeSignedShort::pools.size() )
16728 : {
16729 : // objectArray[i] is a single memory pool
16730 : unsigned j=0;
16731 0 : while (done == false && j < SgTypeSignedShort::pool_size)
16732 : {
16733 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
16734 : {
16735 0 : traversal.visit(&(objectArray[i][j]));
16736 0 : done = true;
16737 : }
16738 0 : j++;
16739 : }
16740 0 : i++;
16741 : }
16742 :
16743 : #if 0
16744 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
16745 : if (done == false)
16746 : {
16747 : printf ("No representative for SgTypeSignedShort found in memory pools \n");
16748 : }
16749 : #endif
16750 : }
16751 0 : }
16752 :
16753 :
16754 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
16755 : // using values that overflow signed values of int.
16756 : size_t
16757 4 : SgTypeSignedShort::numberOfNodes()
16758 : {
16759 : // This function traverses the memory pool for an IR node and
16760 : // counts the number of IR nodes of a particular Sage III IR
16761 : // nodes type.
16762 :
16763 4 : size_t count = 0;
16764 4 : if (SgTypeSignedShort::pools.empty() == false)
16765 : {
16766 : // Generate an array of memory pools (this is actually a STL vector,
16767 : // but it is contiguious, so OK to treat this way).
16768 2 : SgTypeSignedShort** objectArray = (SgTypeSignedShort**) &(SgTypeSignedShort::pools[0]);
16769 :
16770 : // Build a local variable for better performance (make it a loop invariant variable).
16771 2 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
16772 :
16773 : // Iterate over all of the memory pools for this IR node.
16774 4 : for (unsigned int i=0; i < SgTypeSignedShort::pools.size(); i++)
16775 : {
16776 : // objectArray[i] is a single memory pool, iterate over all the
16777 : // IR nodes and only count those that are valid IR nodes used in
16778 : // the AST (i.e. allocated IR nodes).
16779 4002 : for (unsigned j=0; j < SgTypeSignedShort::pool_size; j++)
16780 : {
16781 : // This is indexing the STL vector of C/C++ style arrays as a doubly
16782 : // indexed array access. It is OK since we have leveraged the semantics
16783 : // of STL vector memory as contigous and cast the memory as an array
16784 : // of arrays to use the 2D array indexing. Hope this is not confusing,
16785 : // but it s very fast as an implementation.
16786 4000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
16787 : {
16788 2 : count++;
16789 : }
16790 : }
16791 : }
16792 : }
16793 :
16794 :
16795 :
16796 4 : return count;
16797 : }
16798 :
16799 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
16800 : // using values that overflow signed values of int.
16801 : size_t
16802 0 : SgTypeSignedShort::memoryUsage()
16803 : {
16804 : // This function is required because we need the class name as a type when we call sizeof
16805 : // There might be another way to implement this if we have a traversal that only called a
16806 : // representative object (one call for each type of Sage IIIIR node).
16807 0 : size_t memory = numberOfNodes() * sizeof(SgTypeSignedShort);
16808 :
16809 0 : return memory;
16810 : }
16811 :
16812 : /* #line 16813 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
16813 :
16814 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
16815 : void
16816 5668 : SgTypeUnsignedShort::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
16817 : {
16818 : // This function traverses the memory pool for only a specific IR node
16819 : // and calls the visit function of the input class execute a traversal
16820 : // similar to the style of the attribute based traversals within ROSE.
16821 : // This traversal will visit ALL nodes of the AST where as the other
16822 : // attribute based traversals visit only the embedded tree within the AST.
16823 :
16824 : // Initialize array to the address of the first element of the STL vector
16825 : // (which is guaranteed to be contiguous storage).
16826 : // SgTypeUnsignedShort objectArray [] = *(Memory_Block_List.begin());
16827 5668 : if (SgTypeUnsignedShort::pools.empty() == false)
16828 : {
16829 : // Generate an array of memory pools
16830 4892 : SgTypeUnsignedShort** objectArray = (SgTypeUnsignedShort**) &(SgTypeUnsignedShort::pools[0]);
16831 :
16832 : // Build a local variable for better performance
16833 4892 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
16834 : #if 0
16835 : // Iterate over the memory pools
16836 : for (unsigned int i=0; i < SgTypeUnsignedShort::pools.size(); i++)
16837 : {
16838 : // objectArray[i] is a single memory pool
16839 : for (int j=0; j < SgTypeUnsignedShort::pool_size; j++)
16840 : {
16841 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
16842 : {
16843 : traversal.visit(&(objectArray[i][j]));
16844 : }
16845 : }
16846 : }
16847 : #else
16848 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
16849 : // compute the list first and then call the visit function on each list element.
16850 :
16851 : // printf ("Inside of SgTypeUnsignedShort::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
16852 :
16853 9784 : std::vector<SgTypeUnsignedShort*> nodeList;
16854 :
16855 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
16856 9784 : for (unsigned int i=0; i < SgTypeUnsignedShort::pools.size(); i++)
16857 : {
16858 : // objectArray[i] is a single memory pool
16859 9788890 : for (unsigned j=0; j < SgTypeUnsignedShort::pool_size; j++)
16860 : {
16861 9784000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
16862 : {
16863 4892 : nodeList.push_back(&(objectArray[i][j]));
16864 : }
16865 : }
16866 : }
16867 :
16868 : // Iterate over the saved list
16869 4892 : size_t nodeListSize = nodeList.size();
16870 9784 : for (size_t i=0; i < nodeListSize; i++)
16871 : {
16872 4892 : ROSE_ASSERT(nodeList[i] != NULL);
16873 : #if 0
16874 : traversal.visit(nodeList[i]);
16875 : #else
16876 4892 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
16877 : {
16878 4892 : traversal.visit(nodeList[i]);
16879 : }
16880 : #endif
16881 : }
16882 : #endif
16883 : }
16884 :
16885 : // This should not be required since all previously static data members are
16886 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
16887 :
16888 5668 : }
16889 :
16890 :
16891 : void
16892 194 : SgTypeUnsignedShort::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
16893 : {
16894 : // This function traverses the memory pool for an IR node and
16895 : // calls the function to execute the visitor object.
16896 :
16897 : // Initialize array to the address of the first element of the STL vector
16898 : // (which is guarenteed to be contiguous storage).
16899 : // SgTypeUnsignedShort objectArray [] = *(Memory_Block_List.begin());
16900 194 : if (SgTypeUnsignedShort::pools.empty() == false)
16901 : {
16902 : // Generate an array of memory pools
16903 194 : SgTypeUnsignedShort** objectArray = (SgTypeUnsignedShort**) &(SgTypeUnsignedShort::pools[0]);
16904 :
16905 : // Build a local variable for better performance
16906 194 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
16907 :
16908 : // Iterate over the memory pools
16909 388 : for (unsigned int i=0; i < SgTypeUnsignedShort::pools.size(); i++)
16910 : {
16911 : // objectArray[i] is a single memory pool
16912 388194 : for (unsigned j=0; j < SgTypeUnsignedShort::pool_size; j++)
16913 : {
16914 388000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
16915 : {
16916 : // printf ("Found a valid SgTypeUnsignedShort object in the memory pool %d at position %d \n",i,j);
16917 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
16918 194 : objectArray[i][j].executeVisitorMemberFunction(visitor);
16919 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
16920 : }
16921 : else
16922 : {
16923 : // printf ("Found a INVALID SgTypeUnsignedShort object in the memory pool \n");
16924 : }
16925 : }
16926 : }
16927 : }
16928 :
16929 : // This should not be required since all previously static data members are
16930 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
16931 :
16932 194 : }
16933 :
16934 : void
16935 0 : SgTypeUnsignedShort::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
16936 : {
16937 : // This function visits only a single IR node of the memory pool.
16938 : // it is typically called once for each type of IR node within
16939 : // the automatically generated function: traverseRepresentativeNodes().
16940 :
16941 : // Initialize array to the address of the first element of the STL vector
16942 : // (which is guarenteed to be contiguous storage).
16943 : // SgTypeUnsignedShort objectArray [] = *(Memory_Block_List.begin());
16944 0 : if (SgTypeUnsignedShort::pools.empty() == false)
16945 : {
16946 : // Generate an array of memory pools
16947 0 : SgTypeUnsignedShort** objectArray = (SgTypeUnsignedShort**) &(SgTypeUnsignedShort::pools[0]);
16948 :
16949 : // Build a local variable for better performance
16950 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
16951 :
16952 : // Iterate over the memory pools
16953 0 : bool done = false;
16954 0 : unsigned i=0;
16955 :
16956 : // find the first valid IR node, call visit function, and then leave
16957 0 : while ( done == false && i < SgTypeUnsignedShort::pools.size() )
16958 : {
16959 : // objectArray[i] is a single memory pool
16960 : unsigned j=0;
16961 0 : while (done == false && j < SgTypeUnsignedShort::pool_size)
16962 : {
16963 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
16964 : {
16965 0 : traversal.visit(&(objectArray[i][j]));
16966 0 : done = true;
16967 : }
16968 0 : j++;
16969 : }
16970 0 : i++;
16971 : }
16972 :
16973 : #if 0
16974 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
16975 : if (done == false)
16976 : {
16977 : printf ("No representative for SgTypeUnsignedShort found in memory pools \n");
16978 : }
16979 : #endif
16980 : }
16981 0 : }
16982 :
16983 :
16984 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
16985 : // using values that overflow signed values of int.
16986 : size_t
16987 4 : SgTypeUnsignedShort::numberOfNodes()
16988 : {
16989 : // This function traverses the memory pool for an IR node and
16990 : // counts the number of IR nodes of a particular Sage III IR
16991 : // nodes type.
16992 :
16993 4 : size_t count = 0;
16994 4 : if (SgTypeUnsignedShort::pools.empty() == false)
16995 : {
16996 : // Generate an array of memory pools (this is actually a STL vector,
16997 : // but it is contiguious, so OK to treat this way).
16998 2 : SgTypeUnsignedShort** objectArray = (SgTypeUnsignedShort**) &(SgTypeUnsignedShort::pools[0]);
16999 :
17000 : // Build a local variable for better performance (make it a loop invariant variable).
17001 2 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
17002 :
17003 : // Iterate over all of the memory pools for this IR node.
17004 4 : for (unsigned int i=0; i < SgTypeUnsignedShort::pools.size(); i++)
17005 : {
17006 : // objectArray[i] is a single memory pool, iterate over all the
17007 : // IR nodes and only count those that are valid IR nodes used in
17008 : // the AST (i.e. allocated IR nodes).
17009 4002 : for (unsigned j=0; j < SgTypeUnsignedShort::pool_size; j++)
17010 : {
17011 : // This is indexing the STL vector of C/C++ style arrays as a doubly
17012 : // indexed array access. It is OK since we have leveraged the semantics
17013 : // of STL vector memory as contigous and cast the memory as an array
17014 : // of arrays to use the 2D array indexing. Hope this is not confusing,
17015 : // but it s very fast as an implementation.
17016 4000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
17017 : {
17018 2 : count++;
17019 : }
17020 : }
17021 : }
17022 : }
17023 :
17024 :
17025 :
17026 4 : return count;
17027 : }
17028 :
17029 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
17030 : // using values that overflow signed values of int.
17031 : size_t
17032 0 : SgTypeUnsignedShort::memoryUsage()
17033 : {
17034 : // This function is required because we need the class name as a type when we call sizeof
17035 : // There might be another way to implement this if we have a traversal that only called a
17036 : // representative object (one call for each type of Sage IIIIR node).
17037 0 : size_t memory = numberOfNodes() * sizeof(SgTypeUnsignedShort);
17038 :
17039 0 : return memory;
17040 : }
17041 :
17042 : /* #line 17043 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
17043 :
17044 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
17045 : void
17046 5668 : SgTypeInt::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
17047 : {
17048 : // This function traverses the memory pool for only a specific IR node
17049 : // and calls the visit function of the input class execute a traversal
17050 : // similar to the style of the attribute based traversals within ROSE.
17051 : // This traversal will visit ALL nodes of the AST where as the other
17052 : // attribute based traversals visit only the embedded tree within the AST.
17053 :
17054 : // Initialize array to the address of the first element of the STL vector
17055 : // (which is guaranteed to be contiguous storage).
17056 : // SgTypeInt objectArray [] = *(Memory_Block_List.begin());
17057 5668 : if (SgTypeInt::pools.empty() == false)
17058 : {
17059 : // Generate an array of memory pools
17060 5412 : SgTypeInt** objectArray = (SgTypeInt**) &(SgTypeInt::pools[0]);
17061 :
17062 : // Build a local variable for better performance
17063 5412 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
17064 : #if 0
17065 : // Iterate over the memory pools
17066 : for (unsigned int i=0; i < SgTypeInt::pools.size(); i++)
17067 : {
17068 : // objectArray[i] is a single memory pool
17069 : for (int j=0; j < SgTypeInt::pool_size; j++)
17070 : {
17071 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
17072 : {
17073 : traversal.visit(&(objectArray[i][j]));
17074 : }
17075 : }
17076 : }
17077 : #else
17078 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
17079 : // compute the list first and then call the visit function on each list element.
17080 :
17081 : // printf ("Inside of SgTypeInt::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
17082 :
17083 10824 : std::vector<SgTypeInt*> nodeList;
17084 :
17085 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
17086 10824 : for (unsigned int i=0; i < SgTypeInt::pools.size(); i++)
17087 : {
17088 : // objectArray[i] is a single memory pool
17089 10829400 : for (unsigned j=0; j < SgTypeInt::pool_size; j++)
17090 : {
17091 10824000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
17092 : {
17093 6588 : nodeList.push_back(&(objectArray[i][j]));
17094 : }
17095 : }
17096 : }
17097 :
17098 : // Iterate over the saved list
17099 5412 : size_t nodeListSize = nodeList.size();
17100 12000 : for (size_t i=0; i < nodeListSize; i++)
17101 : {
17102 6588 : ROSE_ASSERT(nodeList[i] != NULL);
17103 : #if 0
17104 : traversal.visit(nodeList[i]);
17105 : #else
17106 6588 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
17107 : {
17108 6588 : traversal.visit(nodeList[i]);
17109 : }
17110 : #endif
17111 : }
17112 : #endif
17113 : }
17114 :
17115 : // This should not be required since all previously static data members are
17116 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
17117 :
17118 5668 : }
17119 :
17120 :
17121 : void
17122 194 : SgTypeInt::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
17123 : {
17124 : // This function traverses the memory pool for an IR node and
17125 : // calls the function to execute the visitor object.
17126 :
17127 : // Initialize array to the address of the first element of the STL vector
17128 : // (which is guarenteed to be contiguous storage).
17129 : // SgTypeInt objectArray [] = *(Memory_Block_List.begin());
17130 194 : if (SgTypeInt::pools.empty() == false)
17131 : {
17132 : // Generate an array of memory pools
17133 194 : SgTypeInt** objectArray = (SgTypeInt**) &(SgTypeInt::pools[0]);
17134 :
17135 : // Build a local variable for better performance
17136 194 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
17137 :
17138 : // Iterate over the memory pools
17139 388 : for (unsigned int i=0; i < SgTypeInt::pools.size(); i++)
17140 : {
17141 : // objectArray[i] is a single memory pool
17142 388194 : for (unsigned j=0; j < SgTypeInt::pool_size; j++)
17143 : {
17144 388000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
17145 : {
17146 : // printf ("Found a valid SgTypeInt object in the memory pool %d at position %d \n",i,j);
17147 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
17148 194 : objectArray[i][j].executeVisitorMemberFunction(visitor);
17149 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
17150 : }
17151 : else
17152 : {
17153 : // printf ("Found a INVALID SgTypeInt object in the memory pool \n");
17154 : }
17155 : }
17156 : }
17157 : }
17158 :
17159 : // This should not be required since all previously static data members are
17160 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
17161 :
17162 194 : }
17163 :
17164 : void
17165 0 : SgTypeInt::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
17166 : {
17167 : // This function visits only a single IR node of the memory pool.
17168 : // it is typically called once for each type of IR node within
17169 : // the automatically generated function: traverseRepresentativeNodes().
17170 :
17171 : // Initialize array to the address of the first element of the STL vector
17172 : // (which is guarenteed to be contiguous storage).
17173 : // SgTypeInt objectArray [] = *(Memory_Block_List.begin());
17174 0 : if (SgTypeInt::pools.empty() == false)
17175 : {
17176 : // Generate an array of memory pools
17177 0 : SgTypeInt** objectArray = (SgTypeInt**) &(SgTypeInt::pools[0]);
17178 :
17179 : // Build a local variable for better performance
17180 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
17181 :
17182 : // Iterate over the memory pools
17183 0 : bool done = false;
17184 0 : unsigned i=0;
17185 :
17186 : // find the first valid IR node, call visit function, and then leave
17187 0 : while ( done == false && i < SgTypeInt::pools.size() )
17188 : {
17189 : // objectArray[i] is a single memory pool
17190 : unsigned j=0;
17191 0 : while (done == false && j < SgTypeInt::pool_size)
17192 : {
17193 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
17194 : {
17195 0 : traversal.visit(&(objectArray[i][j]));
17196 0 : done = true;
17197 : }
17198 0 : j++;
17199 : }
17200 0 : i++;
17201 : }
17202 :
17203 : #if 0
17204 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
17205 : if (done == false)
17206 : {
17207 : printf ("No representative for SgTypeInt found in memory pools \n");
17208 : }
17209 : #endif
17210 : }
17211 0 : }
17212 :
17213 :
17214 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
17215 : // using values that overflow signed values of int.
17216 : size_t
17217 4 : SgTypeInt::numberOfNodes()
17218 : {
17219 : // This function traverses the memory pool for an IR node and
17220 : // counts the number of IR nodes of a particular Sage III IR
17221 : // nodes type.
17222 :
17223 4 : size_t count = 0;
17224 4 : if (SgTypeInt::pools.empty() == false)
17225 : {
17226 : // Generate an array of memory pools (this is actually a STL vector,
17227 : // but it is contiguious, so OK to treat this way).
17228 2 : SgTypeInt** objectArray = (SgTypeInt**) &(SgTypeInt::pools[0]);
17229 :
17230 : // Build a local variable for better performance (make it a loop invariant variable).
17231 2 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
17232 :
17233 : // Iterate over all of the memory pools for this IR node.
17234 4 : for (unsigned int i=0; i < SgTypeInt::pools.size(); i++)
17235 : {
17236 : // objectArray[i] is a single memory pool, iterate over all the
17237 : // IR nodes and only count those that are valid IR nodes used in
17238 : // the AST (i.e. allocated IR nodes).
17239 4002 : for (unsigned j=0; j < SgTypeInt::pool_size; j++)
17240 : {
17241 : // This is indexing the STL vector of C/C++ style arrays as a doubly
17242 : // indexed array access. It is OK since we have leveraged the semantics
17243 : // of STL vector memory as contigous and cast the memory as an array
17244 : // of arrays to use the 2D array indexing. Hope this is not confusing,
17245 : // but it s very fast as an implementation.
17246 4000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
17247 : {
17248 2 : count++;
17249 : }
17250 : }
17251 : }
17252 : }
17253 :
17254 :
17255 :
17256 4 : return count;
17257 : }
17258 :
17259 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
17260 : // using values that overflow signed values of int.
17261 : size_t
17262 0 : SgTypeInt::memoryUsage()
17263 : {
17264 : // This function is required because we need the class name as a type when we call sizeof
17265 : // There might be another way to implement this if we have a traversal that only called a
17266 : // representative object (one call for each type of Sage IIIIR node).
17267 0 : size_t memory = numberOfNodes() * sizeof(SgTypeInt);
17268 :
17269 0 : return memory;
17270 : }
17271 :
17272 : /* #line 17273 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
17273 :
17274 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
17275 : void
17276 5668 : SgTypeSignedInt::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
17277 : {
17278 : // This function traverses the memory pool for only a specific IR node
17279 : // and calls the visit function of the input class execute a traversal
17280 : // similar to the style of the attribute based traversals within ROSE.
17281 : // This traversal will visit ALL nodes of the AST where as the other
17282 : // attribute based traversals visit only the embedded tree within the AST.
17283 :
17284 : // Initialize array to the address of the first element of the STL vector
17285 : // (which is guaranteed to be contiguous storage).
17286 : // SgTypeSignedInt objectArray [] = *(Memory_Block_List.begin());
17287 5668 : if (SgTypeSignedInt::pools.empty() == false)
17288 : {
17289 : // Generate an array of memory pools
17290 3153 : SgTypeSignedInt** objectArray = (SgTypeSignedInt**) &(SgTypeSignedInt::pools[0]);
17291 :
17292 : // Build a local variable for better performance
17293 3153 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
17294 : #if 0
17295 : // Iterate over the memory pools
17296 : for (unsigned int i=0; i < SgTypeSignedInt::pools.size(); i++)
17297 : {
17298 : // objectArray[i] is a single memory pool
17299 : for (int j=0; j < SgTypeSignedInt::pool_size; j++)
17300 : {
17301 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
17302 : {
17303 : traversal.visit(&(objectArray[i][j]));
17304 : }
17305 : }
17306 : }
17307 : #else
17308 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
17309 : // compute the list first and then call the visit function on each list element.
17310 :
17311 : // printf ("Inside of SgTypeSignedInt::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
17312 :
17313 6306 : std::vector<SgTypeSignedInt*> nodeList;
17314 :
17315 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
17316 6306 : for (unsigned int i=0; i < SgTypeSignedInt::pools.size(); i++)
17317 : {
17318 : // objectArray[i] is a single memory pool
17319 6309150 : for (unsigned j=0; j < SgTypeSignedInt::pool_size; j++)
17320 : {
17321 6306000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
17322 : {
17323 3153 : nodeList.push_back(&(objectArray[i][j]));
17324 : }
17325 : }
17326 : }
17327 :
17328 : // Iterate over the saved list
17329 3153 : size_t nodeListSize = nodeList.size();
17330 6306 : for (size_t i=0; i < nodeListSize; i++)
17331 : {
17332 3153 : ROSE_ASSERT(nodeList[i] != NULL);
17333 : #if 0
17334 : traversal.visit(nodeList[i]);
17335 : #else
17336 3153 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
17337 : {
17338 3153 : traversal.visit(nodeList[i]);
17339 : }
17340 : #endif
17341 : }
17342 : #endif
17343 : }
17344 :
17345 : // This should not be required since all previously static data members are
17346 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
17347 :
17348 5668 : }
17349 :
17350 :
17351 : void
17352 194 : SgTypeSignedInt::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
17353 : {
17354 : // This function traverses the memory pool for an IR node and
17355 : // calls the function to execute the visitor object.
17356 :
17357 : // Initialize array to the address of the first element of the STL vector
17358 : // (which is guarenteed to be contiguous storage).
17359 : // SgTypeSignedInt objectArray [] = *(Memory_Block_List.begin());
17360 194 : if (SgTypeSignedInt::pools.empty() == false)
17361 : {
17362 : // Generate an array of memory pools
17363 137 : SgTypeSignedInt** objectArray = (SgTypeSignedInt**) &(SgTypeSignedInt::pools[0]);
17364 :
17365 : // Build a local variable for better performance
17366 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
17367 :
17368 : // Iterate over the memory pools
17369 274 : for (unsigned int i=0; i < SgTypeSignedInt::pools.size(); i++)
17370 : {
17371 : // objectArray[i] is a single memory pool
17372 274137 : for (unsigned j=0; j < SgTypeSignedInt::pool_size; j++)
17373 : {
17374 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
17375 : {
17376 : // printf ("Found a valid SgTypeSignedInt object in the memory pool %d at position %d \n",i,j);
17377 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
17378 137 : objectArray[i][j].executeVisitorMemberFunction(visitor);
17379 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
17380 : }
17381 : else
17382 : {
17383 : // printf ("Found a INVALID SgTypeSignedInt object in the memory pool \n");
17384 : }
17385 : }
17386 : }
17387 : }
17388 :
17389 : // This should not be required since all previously static data members are
17390 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
17391 :
17392 194 : }
17393 :
17394 : void
17395 0 : SgTypeSignedInt::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
17396 : {
17397 : // This function visits only a single IR node of the memory pool.
17398 : // it is typically called once for each type of IR node within
17399 : // the automatically generated function: traverseRepresentativeNodes().
17400 :
17401 : // Initialize array to the address of the first element of the STL vector
17402 : // (which is guarenteed to be contiguous storage).
17403 : // SgTypeSignedInt objectArray [] = *(Memory_Block_List.begin());
17404 0 : if (SgTypeSignedInt::pools.empty() == false)
17405 : {
17406 : // Generate an array of memory pools
17407 0 : SgTypeSignedInt** objectArray = (SgTypeSignedInt**) &(SgTypeSignedInt::pools[0]);
17408 :
17409 : // Build a local variable for better performance
17410 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
17411 :
17412 : // Iterate over the memory pools
17413 0 : bool done = false;
17414 0 : unsigned i=0;
17415 :
17416 : // find the first valid IR node, call visit function, and then leave
17417 0 : while ( done == false && i < SgTypeSignedInt::pools.size() )
17418 : {
17419 : // objectArray[i] is a single memory pool
17420 : unsigned j=0;
17421 0 : while (done == false && j < SgTypeSignedInt::pool_size)
17422 : {
17423 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
17424 : {
17425 0 : traversal.visit(&(objectArray[i][j]));
17426 0 : done = true;
17427 : }
17428 0 : j++;
17429 : }
17430 0 : i++;
17431 : }
17432 :
17433 : #if 0
17434 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
17435 : if (done == false)
17436 : {
17437 : printf ("No representative for SgTypeSignedInt found in memory pools \n");
17438 : }
17439 : #endif
17440 : }
17441 0 : }
17442 :
17443 :
17444 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
17445 : // using values that overflow signed values of int.
17446 : size_t
17447 4 : SgTypeSignedInt::numberOfNodes()
17448 : {
17449 : // This function traverses the memory pool for an IR node and
17450 : // counts the number of IR nodes of a particular Sage III IR
17451 : // nodes type.
17452 :
17453 4 : size_t count = 0;
17454 4 : if (SgTypeSignedInt::pools.empty() == false)
17455 : {
17456 : // Generate an array of memory pools (this is actually a STL vector,
17457 : // but it is contiguious, so OK to treat this way).
17458 2 : SgTypeSignedInt** objectArray = (SgTypeSignedInt**) &(SgTypeSignedInt::pools[0]);
17459 :
17460 : // Build a local variable for better performance (make it a loop invariant variable).
17461 2 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
17462 :
17463 : // Iterate over all of the memory pools for this IR node.
17464 4 : for (unsigned int i=0; i < SgTypeSignedInt::pools.size(); i++)
17465 : {
17466 : // objectArray[i] is a single memory pool, iterate over all the
17467 : // IR nodes and only count those that are valid IR nodes used in
17468 : // the AST (i.e. allocated IR nodes).
17469 4002 : for (unsigned j=0; j < SgTypeSignedInt::pool_size; j++)
17470 : {
17471 : // This is indexing the STL vector of C/C++ style arrays as a doubly
17472 : // indexed array access. It is OK since we have leveraged the semantics
17473 : // of STL vector memory as contigous and cast the memory as an array
17474 : // of arrays to use the 2D array indexing. Hope this is not confusing,
17475 : // but it s very fast as an implementation.
17476 4000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
17477 : {
17478 2 : count++;
17479 : }
17480 : }
17481 : }
17482 : }
17483 :
17484 :
17485 :
17486 4 : return count;
17487 : }
17488 :
17489 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
17490 : // using values that overflow signed values of int.
17491 : size_t
17492 0 : SgTypeSignedInt::memoryUsage()
17493 : {
17494 : // This function is required because we need the class name as a type when we call sizeof
17495 : // There might be another way to implement this if we have a traversal that only called a
17496 : // representative object (one call for each type of Sage IIIIR node).
17497 0 : size_t memory = numberOfNodes() * sizeof(SgTypeSignedInt);
17498 :
17499 0 : return memory;
17500 : }
17501 :
17502 : /* #line 17503 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
17503 :
17504 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
17505 : void
17506 5668 : SgTypeUnsignedInt::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
17507 : {
17508 : // This function traverses the memory pool for only a specific IR node
17509 : // and calls the visit function of the input class execute a traversal
17510 : // similar to the style of the attribute based traversals within ROSE.
17511 : // This traversal will visit ALL nodes of the AST where as the other
17512 : // attribute based traversals visit only the embedded tree within the AST.
17513 :
17514 : // Initialize array to the address of the first element of the STL vector
17515 : // (which is guaranteed to be contiguous storage).
17516 : // SgTypeUnsignedInt objectArray [] = *(Memory_Block_List.begin());
17517 5668 : if (SgTypeUnsignedInt::pools.empty() == false)
17518 : {
17519 : // Generate an array of memory pools
17520 4892 : SgTypeUnsignedInt** objectArray = (SgTypeUnsignedInt**) &(SgTypeUnsignedInt::pools[0]);
17521 :
17522 : // Build a local variable for better performance
17523 4892 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
17524 : #if 0
17525 : // Iterate over the memory pools
17526 : for (unsigned int i=0; i < SgTypeUnsignedInt::pools.size(); i++)
17527 : {
17528 : // objectArray[i] is a single memory pool
17529 : for (int j=0; j < SgTypeUnsignedInt::pool_size; j++)
17530 : {
17531 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
17532 : {
17533 : traversal.visit(&(objectArray[i][j]));
17534 : }
17535 : }
17536 : }
17537 : #else
17538 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
17539 : // compute the list first and then call the visit function on each list element.
17540 :
17541 : // printf ("Inside of SgTypeUnsignedInt::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
17542 :
17543 9784 : std::vector<SgTypeUnsignedInt*> nodeList;
17544 :
17545 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
17546 9784 : for (unsigned int i=0; i < SgTypeUnsignedInt::pools.size(); i++)
17547 : {
17548 : // objectArray[i] is a single memory pool
17549 9788890 : for (unsigned j=0; j < SgTypeUnsignedInt::pool_size; j++)
17550 : {
17551 9784000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
17552 : {
17553 4892 : nodeList.push_back(&(objectArray[i][j]));
17554 : }
17555 : }
17556 : }
17557 :
17558 : // Iterate over the saved list
17559 4892 : size_t nodeListSize = nodeList.size();
17560 9784 : for (size_t i=0; i < nodeListSize; i++)
17561 : {
17562 4892 : ROSE_ASSERT(nodeList[i] != NULL);
17563 : #if 0
17564 : traversal.visit(nodeList[i]);
17565 : #else
17566 4892 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
17567 : {
17568 4892 : traversal.visit(nodeList[i]);
17569 : }
17570 : #endif
17571 : }
17572 : #endif
17573 : }
17574 :
17575 : // This should not be required since all previously static data members are
17576 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
17577 :
17578 5668 : }
17579 :
17580 :
17581 : void
17582 194 : SgTypeUnsignedInt::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
17583 : {
17584 : // This function traverses the memory pool for an IR node and
17585 : // calls the function to execute the visitor object.
17586 :
17587 : // Initialize array to the address of the first element of the STL vector
17588 : // (which is guarenteed to be contiguous storage).
17589 : // SgTypeUnsignedInt objectArray [] = *(Memory_Block_List.begin());
17590 194 : if (SgTypeUnsignedInt::pools.empty() == false)
17591 : {
17592 : // Generate an array of memory pools
17593 194 : SgTypeUnsignedInt** objectArray = (SgTypeUnsignedInt**) &(SgTypeUnsignedInt::pools[0]);
17594 :
17595 : // Build a local variable for better performance
17596 194 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
17597 :
17598 : // Iterate over the memory pools
17599 388 : for (unsigned int i=0; i < SgTypeUnsignedInt::pools.size(); i++)
17600 : {
17601 : // objectArray[i] is a single memory pool
17602 388194 : for (unsigned j=0; j < SgTypeUnsignedInt::pool_size; j++)
17603 : {
17604 388000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
17605 : {
17606 : // printf ("Found a valid SgTypeUnsignedInt object in the memory pool %d at position %d \n",i,j);
17607 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
17608 194 : objectArray[i][j].executeVisitorMemberFunction(visitor);
17609 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
17610 : }
17611 : else
17612 : {
17613 : // printf ("Found a INVALID SgTypeUnsignedInt object in the memory pool \n");
17614 : }
17615 : }
17616 : }
17617 : }
17618 :
17619 : // This should not be required since all previously static data members are
17620 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
17621 :
17622 194 : }
17623 :
17624 : void
17625 0 : SgTypeUnsignedInt::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
17626 : {
17627 : // This function visits only a single IR node of the memory pool.
17628 : // it is typically called once for each type of IR node within
17629 : // the automatically generated function: traverseRepresentativeNodes().
17630 :
17631 : // Initialize array to the address of the first element of the STL vector
17632 : // (which is guarenteed to be contiguous storage).
17633 : // SgTypeUnsignedInt objectArray [] = *(Memory_Block_List.begin());
17634 0 : if (SgTypeUnsignedInt::pools.empty() == false)
17635 : {
17636 : // Generate an array of memory pools
17637 0 : SgTypeUnsignedInt** objectArray = (SgTypeUnsignedInt**) &(SgTypeUnsignedInt::pools[0]);
17638 :
17639 : // Build a local variable for better performance
17640 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
17641 :
17642 : // Iterate over the memory pools
17643 0 : bool done = false;
17644 0 : unsigned i=0;
17645 :
17646 : // find the first valid IR node, call visit function, and then leave
17647 0 : while ( done == false && i < SgTypeUnsignedInt::pools.size() )
17648 : {
17649 : // objectArray[i] is a single memory pool
17650 : unsigned j=0;
17651 0 : while (done == false && j < SgTypeUnsignedInt::pool_size)
17652 : {
17653 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
17654 : {
17655 0 : traversal.visit(&(objectArray[i][j]));
17656 0 : done = true;
17657 : }
17658 0 : j++;
17659 : }
17660 0 : i++;
17661 : }
17662 :
17663 : #if 0
17664 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
17665 : if (done == false)
17666 : {
17667 : printf ("No representative for SgTypeUnsignedInt found in memory pools \n");
17668 : }
17669 : #endif
17670 : }
17671 0 : }
17672 :
17673 :
17674 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
17675 : // using values that overflow signed values of int.
17676 : size_t
17677 4 : SgTypeUnsignedInt::numberOfNodes()
17678 : {
17679 : // This function traverses the memory pool for an IR node and
17680 : // counts the number of IR nodes of a particular Sage III IR
17681 : // nodes type.
17682 :
17683 4 : size_t count = 0;
17684 4 : if (SgTypeUnsignedInt::pools.empty() == false)
17685 : {
17686 : // Generate an array of memory pools (this is actually a STL vector,
17687 : // but it is contiguious, so OK to treat this way).
17688 2 : SgTypeUnsignedInt** objectArray = (SgTypeUnsignedInt**) &(SgTypeUnsignedInt::pools[0]);
17689 :
17690 : // Build a local variable for better performance (make it a loop invariant variable).
17691 2 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
17692 :
17693 : // Iterate over all of the memory pools for this IR node.
17694 4 : for (unsigned int i=0; i < SgTypeUnsignedInt::pools.size(); i++)
17695 : {
17696 : // objectArray[i] is a single memory pool, iterate over all the
17697 : // IR nodes and only count those that are valid IR nodes used in
17698 : // the AST (i.e. allocated IR nodes).
17699 4002 : for (unsigned j=0; j < SgTypeUnsignedInt::pool_size; j++)
17700 : {
17701 : // This is indexing the STL vector of C/C++ style arrays as a doubly
17702 : // indexed array access. It is OK since we have leveraged the semantics
17703 : // of STL vector memory as contigous and cast the memory as an array
17704 : // of arrays to use the 2D array indexing. Hope this is not confusing,
17705 : // but it s very fast as an implementation.
17706 4000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
17707 : {
17708 2 : count++;
17709 : }
17710 : }
17711 : }
17712 : }
17713 :
17714 :
17715 :
17716 4 : return count;
17717 : }
17718 :
17719 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
17720 : // using values that overflow signed values of int.
17721 : size_t
17722 0 : SgTypeUnsignedInt::memoryUsage()
17723 : {
17724 : // This function is required because we need the class name as a type when we call sizeof
17725 : // There might be another way to implement this if we have a traversal that only called a
17726 : // representative object (one call for each type of Sage IIIIR node).
17727 0 : size_t memory = numberOfNodes() * sizeof(SgTypeUnsignedInt);
17728 :
17729 0 : return memory;
17730 : }
17731 :
17732 : /* #line 17733 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
17733 :
17734 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
17735 : void
17736 5668 : SgTypeLong::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
17737 : {
17738 : // This function traverses the memory pool for only a specific IR node
17739 : // and calls the visit function of the input class execute a traversal
17740 : // similar to the style of the attribute based traversals within ROSE.
17741 : // This traversal will visit ALL nodes of the AST where as the other
17742 : // attribute based traversals visit only the embedded tree within the AST.
17743 :
17744 : // Initialize array to the address of the first element of the STL vector
17745 : // (which is guaranteed to be contiguous storage).
17746 : // SgTypeLong objectArray [] = *(Memory_Block_List.begin());
17747 5668 : if (SgTypeLong::pools.empty() == false)
17748 : {
17749 : // Generate an array of memory pools
17750 4892 : SgTypeLong** objectArray = (SgTypeLong**) &(SgTypeLong::pools[0]);
17751 :
17752 : // Build a local variable for better performance
17753 4892 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
17754 : #if 0
17755 : // Iterate over the memory pools
17756 : for (unsigned int i=0; i < SgTypeLong::pools.size(); i++)
17757 : {
17758 : // objectArray[i] is a single memory pool
17759 : for (int j=0; j < SgTypeLong::pool_size; j++)
17760 : {
17761 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
17762 : {
17763 : traversal.visit(&(objectArray[i][j]));
17764 : }
17765 : }
17766 : }
17767 : #else
17768 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
17769 : // compute the list first and then call the visit function on each list element.
17770 :
17771 : // printf ("Inside of SgTypeLong::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
17772 :
17773 9784 : std::vector<SgTypeLong*> nodeList;
17774 :
17775 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
17776 9784 : for (unsigned int i=0; i < SgTypeLong::pools.size(); i++)
17777 : {
17778 : // objectArray[i] is a single memory pool
17779 9788890 : for (unsigned j=0; j < SgTypeLong::pool_size; j++)
17780 : {
17781 9784000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
17782 : {
17783 4892 : nodeList.push_back(&(objectArray[i][j]));
17784 : }
17785 : }
17786 : }
17787 :
17788 : // Iterate over the saved list
17789 4892 : size_t nodeListSize = nodeList.size();
17790 9784 : for (size_t i=0; i < nodeListSize; i++)
17791 : {
17792 4892 : ROSE_ASSERT(nodeList[i] != NULL);
17793 : #if 0
17794 : traversal.visit(nodeList[i]);
17795 : #else
17796 4892 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
17797 : {
17798 4892 : traversal.visit(nodeList[i]);
17799 : }
17800 : #endif
17801 : }
17802 : #endif
17803 : }
17804 :
17805 : // This should not be required since all previously static data members are
17806 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
17807 :
17808 5668 : }
17809 :
17810 :
17811 : void
17812 194 : SgTypeLong::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
17813 : {
17814 : // This function traverses the memory pool for an IR node and
17815 : // calls the function to execute the visitor object.
17816 :
17817 : // Initialize array to the address of the first element of the STL vector
17818 : // (which is guarenteed to be contiguous storage).
17819 : // SgTypeLong objectArray [] = *(Memory_Block_List.begin());
17820 194 : if (SgTypeLong::pools.empty() == false)
17821 : {
17822 : // Generate an array of memory pools
17823 194 : SgTypeLong** objectArray = (SgTypeLong**) &(SgTypeLong::pools[0]);
17824 :
17825 : // Build a local variable for better performance
17826 194 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
17827 :
17828 : // Iterate over the memory pools
17829 388 : for (unsigned int i=0; i < SgTypeLong::pools.size(); i++)
17830 : {
17831 : // objectArray[i] is a single memory pool
17832 388194 : for (unsigned j=0; j < SgTypeLong::pool_size; j++)
17833 : {
17834 388000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
17835 : {
17836 : // printf ("Found a valid SgTypeLong object in the memory pool %d at position %d \n",i,j);
17837 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
17838 194 : objectArray[i][j].executeVisitorMemberFunction(visitor);
17839 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
17840 : }
17841 : else
17842 : {
17843 : // printf ("Found a INVALID SgTypeLong object in the memory pool \n");
17844 : }
17845 : }
17846 : }
17847 : }
17848 :
17849 : // This should not be required since all previously static data members are
17850 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
17851 :
17852 194 : }
17853 :
17854 : void
17855 0 : SgTypeLong::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
17856 : {
17857 : // This function visits only a single IR node of the memory pool.
17858 : // it is typically called once for each type of IR node within
17859 : // the automatically generated function: traverseRepresentativeNodes().
17860 :
17861 : // Initialize array to the address of the first element of the STL vector
17862 : // (which is guarenteed to be contiguous storage).
17863 : // SgTypeLong objectArray [] = *(Memory_Block_List.begin());
17864 0 : if (SgTypeLong::pools.empty() == false)
17865 : {
17866 : // Generate an array of memory pools
17867 0 : SgTypeLong** objectArray = (SgTypeLong**) &(SgTypeLong::pools[0]);
17868 :
17869 : // Build a local variable for better performance
17870 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
17871 :
17872 : // Iterate over the memory pools
17873 0 : bool done = false;
17874 0 : unsigned i=0;
17875 :
17876 : // find the first valid IR node, call visit function, and then leave
17877 0 : while ( done == false && i < SgTypeLong::pools.size() )
17878 : {
17879 : // objectArray[i] is a single memory pool
17880 : unsigned j=0;
17881 0 : while (done == false && j < SgTypeLong::pool_size)
17882 : {
17883 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
17884 : {
17885 0 : traversal.visit(&(objectArray[i][j]));
17886 0 : done = true;
17887 : }
17888 0 : j++;
17889 : }
17890 0 : i++;
17891 : }
17892 :
17893 : #if 0
17894 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
17895 : if (done == false)
17896 : {
17897 : printf ("No representative for SgTypeLong found in memory pools \n");
17898 : }
17899 : #endif
17900 : }
17901 0 : }
17902 :
17903 :
17904 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
17905 : // using values that overflow signed values of int.
17906 : size_t
17907 4 : SgTypeLong::numberOfNodes()
17908 : {
17909 : // This function traverses the memory pool for an IR node and
17910 : // counts the number of IR nodes of a particular Sage III IR
17911 : // nodes type.
17912 :
17913 4 : size_t count = 0;
17914 4 : if (SgTypeLong::pools.empty() == false)
17915 : {
17916 : // Generate an array of memory pools (this is actually a STL vector,
17917 : // but it is contiguious, so OK to treat this way).
17918 2 : SgTypeLong** objectArray = (SgTypeLong**) &(SgTypeLong::pools[0]);
17919 :
17920 : // Build a local variable for better performance (make it a loop invariant variable).
17921 2 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
17922 :
17923 : // Iterate over all of the memory pools for this IR node.
17924 4 : for (unsigned int i=0; i < SgTypeLong::pools.size(); i++)
17925 : {
17926 : // objectArray[i] is a single memory pool, iterate over all the
17927 : // IR nodes and only count those that are valid IR nodes used in
17928 : // the AST (i.e. allocated IR nodes).
17929 4002 : for (unsigned j=0; j < SgTypeLong::pool_size; j++)
17930 : {
17931 : // This is indexing the STL vector of C/C++ style arrays as a doubly
17932 : // indexed array access. It is OK since we have leveraged the semantics
17933 : // of STL vector memory as contigous and cast the memory as an array
17934 : // of arrays to use the 2D array indexing. Hope this is not confusing,
17935 : // but it s very fast as an implementation.
17936 4000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
17937 : {
17938 2 : count++;
17939 : }
17940 : }
17941 : }
17942 : }
17943 :
17944 :
17945 :
17946 4 : return count;
17947 : }
17948 :
17949 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
17950 : // using values that overflow signed values of int.
17951 : size_t
17952 0 : SgTypeLong::memoryUsage()
17953 : {
17954 : // This function is required because we need the class name as a type when we call sizeof
17955 : // There might be another way to implement this if we have a traversal that only called a
17956 : // representative object (one call for each type of Sage IIIIR node).
17957 0 : size_t memory = numberOfNodes() * sizeof(SgTypeLong);
17958 :
17959 0 : return memory;
17960 : }
17961 :
17962 : /* #line 17963 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
17963 :
17964 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
17965 : void
17966 5668 : SgTypeSignedLong::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
17967 : {
17968 : // This function traverses the memory pool for only a specific IR node
17969 : // and calls the visit function of the input class execute a traversal
17970 : // similar to the style of the attribute based traversals within ROSE.
17971 : // This traversal will visit ALL nodes of the AST where as the other
17972 : // attribute based traversals visit only the embedded tree within the AST.
17973 :
17974 : // Initialize array to the address of the first element of the STL vector
17975 : // (which is guaranteed to be contiguous storage).
17976 : // SgTypeSignedLong objectArray [] = *(Memory_Block_List.begin());
17977 5668 : if (SgTypeSignedLong::pools.empty() == false)
17978 : {
17979 : // Generate an array of memory pools
17980 3153 : SgTypeSignedLong** objectArray = (SgTypeSignedLong**) &(SgTypeSignedLong::pools[0]);
17981 :
17982 : // Build a local variable for better performance
17983 3153 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
17984 : #if 0
17985 : // Iterate over the memory pools
17986 : for (unsigned int i=0; i < SgTypeSignedLong::pools.size(); i++)
17987 : {
17988 : // objectArray[i] is a single memory pool
17989 : for (int j=0; j < SgTypeSignedLong::pool_size; j++)
17990 : {
17991 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
17992 : {
17993 : traversal.visit(&(objectArray[i][j]));
17994 : }
17995 : }
17996 : }
17997 : #else
17998 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
17999 : // compute the list first and then call the visit function on each list element.
18000 :
18001 : // printf ("Inside of SgTypeSignedLong::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
18002 :
18003 6306 : std::vector<SgTypeSignedLong*> nodeList;
18004 :
18005 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
18006 6306 : for (unsigned int i=0; i < SgTypeSignedLong::pools.size(); i++)
18007 : {
18008 : // objectArray[i] is a single memory pool
18009 6309150 : for (unsigned j=0; j < SgTypeSignedLong::pool_size; j++)
18010 : {
18011 6306000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
18012 : {
18013 3153 : nodeList.push_back(&(objectArray[i][j]));
18014 : }
18015 : }
18016 : }
18017 :
18018 : // Iterate over the saved list
18019 3153 : size_t nodeListSize = nodeList.size();
18020 6306 : for (size_t i=0; i < nodeListSize; i++)
18021 : {
18022 3153 : ROSE_ASSERT(nodeList[i] != NULL);
18023 : #if 0
18024 : traversal.visit(nodeList[i]);
18025 : #else
18026 3153 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
18027 : {
18028 3153 : traversal.visit(nodeList[i]);
18029 : }
18030 : #endif
18031 : }
18032 : #endif
18033 : }
18034 :
18035 : // This should not be required since all previously static data members are
18036 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
18037 :
18038 5668 : }
18039 :
18040 :
18041 : void
18042 194 : SgTypeSignedLong::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
18043 : {
18044 : // This function traverses the memory pool for an IR node and
18045 : // calls the function to execute the visitor object.
18046 :
18047 : // Initialize array to the address of the first element of the STL vector
18048 : // (which is guarenteed to be contiguous storage).
18049 : // SgTypeSignedLong objectArray [] = *(Memory_Block_List.begin());
18050 194 : if (SgTypeSignedLong::pools.empty() == false)
18051 : {
18052 : // Generate an array of memory pools
18053 137 : SgTypeSignedLong** objectArray = (SgTypeSignedLong**) &(SgTypeSignedLong::pools[0]);
18054 :
18055 : // Build a local variable for better performance
18056 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
18057 :
18058 : // Iterate over the memory pools
18059 274 : for (unsigned int i=0; i < SgTypeSignedLong::pools.size(); i++)
18060 : {
18061 : // objectArray[i] is a single memory pool
18062 274137 : for (unsigned j=0; j < SgTypeSignedLong::pool_size; j++)
18063 : {
18064 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
18065 : {
18066 : // printf ("Found a valid SgTypeSignedLong object in the memory pool %d at position %d \n",i,j);
18067 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
18068 137 : objectArray[i][j].executeVisitorMemberFunction(visitor);
18069 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
18070 : }
18071 : else
18072 : {
18073 : // printf ("Found a INVALID SgTypeSignedLong object in the memory pool \n");
18074 : }
18075 : }
18076 : }
18077 : }
18078 :
18079 : // This should not be required since all previously static data members are
18080 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
18081 :
18082 194 : }
18083 :
18084 : void
18085 0 : SgTypeSignedLong::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
18086 : {
18087 : // This function visits only a single IR node of the memory pool.
18088 : // it is typically called once for each type of IR node within
18089 : // the automatically generated function: traverseRepresentativeNodes().
18090 :
18091 : // Initialize array to the address of the first element of the STL vector
18092 : // (which is guarenteed to be contiguous storage).
18093 : // SgTypeSignedLong objectArray [] = *(Memory_Block_List.begin());
18094 0 : if (SgTypeSignedLong::pools.empty() == false)
18095 : {
18096 : // Generate an array of memory pools
18097 0 : SgTypeSignedLong** objectArray = (SgTypeSignedLong**) &(SgTypeSignedLong::pools[0]);
18098 :
18099 : // Build a local variable for better performance
18100 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
18101 :
18102 : // Iterate over the memory pools
18103 0 : bool done = false;
18104 0 : unsigned i=0;
18105 :
18106 : // find the first valid IR node, call visit function, and then leave
18107 0 : while ( done == false && i < SgTypeSignedLong::pools.size() )
18108 : {
18109 : // objectArray[i] is a single memory pool
18110 : unsigned j=0;
18111 0 : while (done == false && j < SgTypeSignedLong::pool_size)
18112 : {
18113 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
18114 : {
18115 0 : traversal.visit(&(objectArray[i][j]));
18116 0 : done = true;
18117 : }
18118 0 : j++;
18119 : }
18120 0 : i++;
18121 : }
18122 :
18123 : #if 0
18124 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
18125 : if (done == false)
18126 : {
18127 : printf ("No representative for SgTypeSignedLong found in memory pools \n");
18128 : }
18129 : #endif
18130 : }
18131 0 : }
18132 :
18133 :
18134 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
18135 : // using values that overflow signed values of int.
18136 : size_t
18137 4 : SgTypeSignedLong::numberOfNodes()
18138 : {
18139 : // This function traverses the memory pool for an IR node and
18140 : // counts the number of IR nodes of a particular Sage III IR
18141 : // nodes type.
18142 :
18143 4 : size_t count = 0;
18144 4 : if (SgTypeSignedLong::pools.empty() == false)
18145 : {
18146 : // Generate an array of memory pools (this is actually a STL vector,
18147 : // but it is contiguious, so OK to treat this way).
18148 2 : SgTypeSignedLong** objectArray = (SgTypeSignedLong**) &(SgTypeSignedLong::pools[0]);
18149 :
18150 : // Build a local variable for better performance (make it a loop invariant variable).
18151 2 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
18152 :
18153 : // Iterate over all of the memory pools for this IR node.
18154 4 : for (unsigned int i=0; i < SgTypeSignedLong::pools.size(); i++)
18155 : {
18156 : // objectArray[i] is a single memory pool, iterate over all the
18157 : // IR nodes and only count those that are valid IR nodes used in
18158 : // the AST (i.e. allocated IR nodes).
18159 4002 : for (unsigned j=0; j < SgTypeSignedLong::pool_size; j++)
18160 : {
18161 : // This is indexing the STL vector of C/C++ style arrays as a doubly
18162 : // indexed array access. It is OK since we have leveraged the semantics
18163 : // of STL vector memory as contigous and cast the memory as an array
18164 : // of arrays to use the 2D array indexing. Hope this is not confusing,
18165 : // but it s very fast as an implementation.
18166 4000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
18167 : {
18168 2 : count++;
18169 : }
18170 : }
18171 : }
18172 : }
18173 :
18174 :
18175 :
18176 4 : return count;
18177 : }
18178 :
18179 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
18180 : // using values that overflow signed values of int.
18181 : size_t
18182 0 : SgTypeSignedLong::memoryUsage()
18183 : {
18184 : // This function is required because we need the class name as a type when we call sizeof
18185 : // There might be another way to implement this if we have a traversal that only called a
18186 : // representative object (one call for each type of Sage IIIIR node).
18187 0 : size_t memory = numberOfNodes() * sizeof(SgTypeSignedLong);
18188 :
18189 0 : return memory;
18190 : }
18191 :
18192 : /* #line 18193 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
18193 :
18194 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
18195 : void
18196 5668 : SgTypeUnsignedLong::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
18197 : {
18198 : // This function traverses the memory pool for only a specific IR node
18199 : // and calls the visit function of the input class execute a traversal
18200 : // similar to the style of the attribute based traversals within ROSE.
18201 : // This traversal will visit ALL nodes of the AST where as the other
18202 : // attribute based traversals visit only the embedded tree within the AST.
18203 :
18204 : // Initialize array to the address of the first element of the STL vector
18205 : // (which is guaranteed to be contiguous storage).
18206 : // SgTypeUnsignedLong objectArray [] = *(Memory_Block_List.begin());
18207 5668 : if (SgTypeUnsignedLong::pools.empty() == false)
18208 : {
18209 : // Generate an array of memory pools
18210 4892 : SgTypeUnsignedLong** objectArray = (SgTypeUnsignedLong**) &(SgTypeUnsignedLong::pools[0]);
18211 :
18212 : // Build a local variable for better performance
18213 4892 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
18214 : #if 0
18215 : // Iterate over the memory pools
18216 : for (unsigned int i=0; i < SgTypeUnsignedLong::pools.size(); i++)
18217 : {
18218 : // objectArray[i] is a single memory pool
18219 : for (int j=0; j < SgTypeUnsignedLong::pool_size; j++)
18220 : {
18221 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
18222 : {
18223 : traversal.visit(&(objectArray[i][j]));
18224 : }
18225 : }
18226 : }
18227 : #else
18228 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
18229 : // compute the list first and then call the visit function on each list element.
18230 :
18231 : // printf ("Inside of SgTypeUnsignedLong::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
18232 :
18233 9784 : std::vector<SgTypeUnsignedLong*> nodeList;
18234 :
18235 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
18236 9784 : for (unsigned int i=0; i < SgTypeUnsignedLong::pools.size(); i++)
18237 : {
18238 : // objectArray[i] is a single memory pool
18239 9788890 : for (unsigned j=0; j < SgTypeUnsignedLong::pool_size; j++)
18240 : {
18241 9784000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
18242 : {
18243 4892 : nodeList.push_back(&(objectArray[i][j]));
18244 : }
18245 : }
18246 : }
18247 :
18248 : // Iterate over the saved list
18249 4892 : size_t nodeListSize = nodeList.size();
18250 9784 : for (size_t i=0; i < nodeListSize; i++)
18251 : {
18252 4892 : ROSE_ASSERT(nodeList[i] != NULL);
18253 : #if 0
18254 : traversal.visit(nodeList[i]);
18255 : #else
18256 4892 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
18257 : {
18258 4892 : traversal.visit(nodeList[i]);
18259 : }
18260 : #endif
18261 : }
18262 : #endif
18263 : }
18264 :
18265 : // This should not be required since all previously static data members are
18266 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
18267 :
18268 5668 : }
18269 :
18270 :
18271 : void
18272 194 : SgTypeUnsignedLong::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
18273 : {
18274 : // This function traverses the memory pool for an IR node and
18275 : // calls the function to execute the visitor object.
18276 :
18277 : // Initialize array to the address of the first element of the STL vector
18278 : // (which is guarenteed to be contiguous storage).
18279 : // SgTypeUnsignedLong objectArray [] = *(Memory_Block_List.begin());
18280 194 : if (SgTypeUnsignedLong::pools.empty() == false)
18281 : {
18282 : // Generate an array of memory pools
18283 194 : SgTypeUnsignedLong** objectArray = (SgTypeUnsignedLong**) &(SgTypeUnsignedLong::pools[0]);
18284 :
18285 : // Build a local variable for better performance
18286 194 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
18287 :
18288 : // Iterate over the memory pools
18289 388 : for (unsigned int i=0; i < SgTypeUnsignedLong::pools.size(); i++)
18290 : {
18291 : // objectArray[i] is a single memory pool
18292 388194 : for (unsigned j=0; j < SgTypeUnsignedLong::pool_size; j++)
18293 : {
18294 388000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
18295 : {
18296 : // printf ("Found a valid SgTypeUnsignedLong object in the memory pool %d at position %d \n",i,j);
18297 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
18298 194 : objectArray[i][j].executeVisitorMemberFunction(visitor);
18299 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
18300 : }
18301 : else
18302 : {
18303 : // printf ("Found a INVALID SgTypeUnsignedLong object in the memory pool \n");
18304 : }
18305 : }
18306 : }
18307 : }
18308 :
18309 : // This should not be required since all previously static data members are
18310 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
18311 :
18312 194 : }
18313 :
18314 : void
18315 0 : SgTypeUnsignedLong::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
18316 : {
18317 : // This function visits only a single IR node of the memory pool.
18318 : // it is typically called once for each type of IR node within
18319 : // the automatically generated function: traverseRepresentativeNodes().
18320 :
18321 : // Initialize array to the address of the first element of the STL vector
18322 : // (which is guarenteed to be contiguous storage).
18323 : // SgTypeUnsignedLong objectArray [] = *(Memory_Block_List.begin());
18324 0 : if (SgTypeUnsignedLong::pools.empty() == false)
18325 : {
18326 : // Generate an array of memory pools
18327 0 : SgTypeUnsignedLong** objectArray = (SgTypeUnsignedLong**) &(SgTypeUnsignedLong::pools[0]);
18328 :
18329 : // Build a local variable for better performance
18330 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
18331 :
18332 : // Iterate over the memory pools
18333 0 : bool done = false;
18334 0 : unsigned i=0;
18335 :
18336 : // find the first valid IR node, call visit function, and then leave
18337 0 : while ( done == false && i < SgTypeUnsignedLong::pools.size() )
18338 : {
18339 : // objectArray[i] is a single memory pool
18340 : unsigned j=0;
18341 0 : while (done == false && j < SgTypeUnsignedLong::pool_size)
18342 : {
18343 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
18344 : {
18345 0 : traversal.visit(&(objectArray[i][j]));
18346 0 : done = true;
18347 : }
18348 0 : j++;
18349 : }
18350 0 : i++;
18351 : }
18352 :
18353 : #if 0
18354 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
18355 : if (done == false)
18356 : {
18357 : printf ("No representative for SgTypeUnsignedLong found in memory pools \n");
18358 : }
18359 : #endif
18360 : }
18361 0 : }
18362 :
18363 :
18364 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
18365 : // using values that overflow signed values of int.
18366 : size_t
18367 4 : SgTypeUnsignedLong::numberOfNodes()
18368 : {
18369 : // This function traverses the memory pool for an IR node and
18370 : // counts the number of IR nodes of a particular Sage III IR
18371 : // nodes type.
18372 :
18373 4 : size_t count = 0;
18374 4 : if (SgTypeUnsignedLong::pools.empty() == false)
18375 : {
18376 : // Generate an array of memory pools (this is actually a STL vector,
18377 : // but it is contiguious, so OK to treat this way).
18378 2 : SgTypeUnsignedLong** objectArray = (SgTypeUnsignedLong**) &(SgTypeUnsignedLong::pools[0]);
18379 :
18380 : // Build a local variable for better performance (make it a loop invariant variable).
18381 2 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
18382 :
18383 : // Iterate over all of the memory pools for this IR node.
18384 4 : for (unsigned int i=0; i < SgTypeUnsignedLong::pools.size(); i++)
18385 : {
18386 : // objectArray[i] is a single memory pool, iterate over all the
18387 : // IR nodes and only count those that are valid IR nodes used in
18388 : // the AST (i.e. allocated IR nodes).
18389 4002 : for (unsigned j=0; j < SgTypeUnsignedLong::pool_size; j++)
18390 : {
18391 : // This is indexing the STL vector of C/C++ style arrays as a doubly
18392 : // indexed array access. It is OK since we have leveraged the semantics
18393 : // of STL vector memory as contigous and cast the memory as an array
18394 : // of arrays to use the 2D array indexing. Hope this is not confusing,
18395 : // but it s very fast as an implementation.
18396 4000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
18397 : {
18398 2 : count++;
18399 : }
18400 : }
18401 : }
18402 : }
18403 :
18404 :
18405 :
18406 4 : return count;
18407 : }
18408 :
18409 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
18410 : // using values that overflow signed values of int.
18411 : size_t
18412 0 : SgTypeUnsignedLong::memoryUsage()
18413 : {
18414 : // This function is required because we need the class name as a type when we call sizeof
18415 : // There might be another way to implement this if we have a traversal that only called a
18416 : // representative object (one call for each type of Sage IIIIR node).
18417 0 : size_t memory = numberOfNodes() * sizeof(SgTypeUnsignedLong);
18418 :
18419 0 : return memory;
18420 : }
18421 :
18422 : /* #line 18423 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
18423 :
18424 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
18425 : void
18426 5668 : SgTypeVoid::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
18427 : {
18428 : // This function traverses the memory pool for only a specific IR node
18429 : // and calls the visit function of the input class execute a traversal
18430 : // similar to the style of the attribute based traversals within ROSE.
18431 : // This traversal will visit ALL nodes of the AST where as the other
18432 : // attribute based traversals visit only the embedded tree within the AST.
18433 :
18434 : // Initialize array to the address of the first element of the STL vector
18435 : // (which is guaranteed to be contiguous storage).
18436 : // SgTypeVoid objectArray [] = *(Memory_Block_List.begin());
18437 5668 : if (SgTypeVoid::pools.empty() == false)
18438 : {
18439 : // Generate an array of memory pools
18440 5608 : SgTypeVoid** objectArray = (SgTypeVoid**) &(SgTypeVoid::pools[0]);
18441 :
18442 : // Build a local variable for better performance
18443 5608 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
18444 : #if 0
18445 : // Iterate over the memory pools
18446 : for (unsigned int i=0; i < SgTypeVoid::pools.size(); i++)
18447 : {
18448 : // objectArray[i] is a single memory pool
18449 : for (int j=0; j < SgTypeVoid::pool_size; j++)
18450 : {
18451 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
18452 : {
18453 : traversal.visit(&(objectArray[i][j]));
18454 : }
18455 : }
18456 : }
18457 : #else
18458 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
18459 : // compute the list first and then call the visit function on each list element.
18460 :
18461 : // printf ("Inside of SgTypeVoid::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
18462 :
18463 11216 : std::vector<SgTypeVoid*> nodeList;
18464 :
18465 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
18466 11216 : for (unsigned int i=0; i < SgTypeVoid::pools.size(); i++)
18467 : {
18468 : // objectArray[i] is a single memory pool
18469 11221600 : for (unsigned j=0; j < SgTypeVoid::pool_size; j++)
18470 : {
18471 11216000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
18472 : {
18473 5608 : nodeList.push_back(&(objectArray[i][j]));
18474 : }
18475 : }
18476 : }
18477 :
18478 : // Iterate over the saved list
18479 5608 : size_t nodeListSize = nodeList.size();
18480 11216 : for (size_t i=0; i < nodeListSize; i++)
18481 : {
18482 5608 : ROSE_ASSERT(nodeList[i] != NULL);
18483 : #if 0
18484 : traversal.visit(nodeList[i]);
18485 : #else
18486 5608 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
18487 : {
18488 5608 : traversal.visit(nodeList[i]);
18489 : }
18490 : #endif
18491 : }
18492 : #endif
18493 : }
18494 :
18495 : // This should not be required since all previously static data members are
18496 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
18497 :
18498 5668 : }
18499 :
18500 :
18501 : void
18502 194 : SgTypeVoid::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
18503 : {
18504 : // This function traverses the memory pool for an IR node and
18505 : // calls the function to execute the visitor object.
18506 :
18507 : // Initialize array to the address of the first element of the STL vector
18508 : // (which is guarenteed to be contiguous storage).
18509 : // SgTypeVoid objectArray [] = *(Memory_Block_List.begin());
18510 194 : if (SgTypeVoid::pools.empty() == false)
18511 : {
18512 : // Generate an array of memory pools
18513 194 : SgTypeVoid** objectArray = (SgTypeVoid**) &(SgTypeVoid::pools[0]);
18514 :
18515 : // Build a local variable for better performance
18516 194 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
18517 :
18518 : // Iterate over the memory pools
18519 388 : for (unsigned int i=0; i < SgTypeVoid::pools.size(); i++)
18520 : {
18521 : // objectArray[i] is a single memory pool
18522 388194 : for (unsigned j=0; j < SgTypeVoid::pool_size; j++)
18523 : {
18524 388000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
18525 : {
18526 : // printf ("Found a valid SgTypeVoid object in the memory pool %d at position %d \n",i,j);
18527 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
18528 194 : objectArray[i][j].executeVisitorMemberFunction(visitor);
18529 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
18530 : }
18531 : else
18532 : {
18533 : // printf ("Found a INVALID SgTypeVoid object in the memory pool \n");
18534 : }
18535 : }
18536 : }
18537 : }
18538 :
18539 : // This should not be required since all previously static data members are
18540 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
18541 :
18542 194 : }
18543 :
18544 : void
18545 0 : SgTypeVoid::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
18546 : {
18547 : // This function visits only a single IR node of the memory pool.
18548 : // it is typically called once for each type of IR node within
18549 : // the automatically generated function: traverseRepresentativeNodes().
18550 :
18551 : // Initialize array to the address of the first element of the STL vector
18552 : // (which is guarenteed to be contiguous storage).
18553 : // SgTypeVoid objectArray [] = *(Memory_Block_List.begin());
18554 0 : if (SgTypeVoid::pools.empty() == false)
18555 : {
18556 : // Generate an array of memory pools
18557 0 : SgTypeVoid** objectArray = (SgTypeVoid**) &(SgTypeVoid::pools[0]);
18558 :
18559 : // Build a local variable for better performance
18560 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
18561 :
18562 : // Iterate over the memory pools
18563 0 : bool done = false;
18564 0 : unsigned i=0;
18565 :
18566 : // find the first valid IR node, call visit function, and then leave
18567 0 : while ( done == false && i < SgTypeVoid::pools.size() )
18568 : {
18569 : // objectArray[i] is a single memory pool
18570 : unsigned j=0;
18571 0 : while (done == false && j < SgTypeVoid::pool_size)
18572 : {
18573 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
18574 : {
18575 0 : traversal.visit(&(objectArray[i][j]));
18576 0 : done = true;
18577 : }
18578 0 : j++;
18579 : }
18580 0 : i++;
18581 : }
18582 :
18583 : #if 0
18584 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
18585 : if (done == false)
18586 : {
18587 : printf ("No representative for SgTypeVoid found in memory pools \n");
18588 : }
18589 : #endif
18590 : }
18591 0 : }
18592 :
18593 :
18594 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
18595 : // using values that overflow signed values of int.
18596 : size_t
18597 4 : SgTypeVoid::numberOfNodes()
18598 : {
18599 : // This function traverses the memory pool for an IR node and
18600 : // counts the number of IR nodes of a particular Sage III IR
18601 : // nodes type.
18602 :
18603 4 : size_t count = 0;
18604 4 : if (SgTypeVoid::pools.empty() == false)
18605 : {
18606 : // Generate an array of memory pools (this is actually a STL vector,
18607 : // but it is contiguious, so OK to treat this way).
18608 4 : SgTypeVoid** objectArray = (SgTypeVoid**) &(SgTypeVoid::pools[0]);
18609 :
18610 : // Build a local variable for better performance (make it a loop invariant variable).
18611 4 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
18612 :
18613 : // Iterate over all of the memory pools for this IR node.
18614 8 : for (unsigned int i=0; i < SgTypeVoid::pools.size(); i++)
18615 : {
18616 : // objectArray[i] is a single memory pool, iterate over all the
18617 : // IR nodes and only count those that are valid IR nodes used in
18618 : // the AST (i.e. allocated IR nodes).
18619 8004 : for (unsigned j=0; j < SgTypeVoid::pool_size; j++)
18620 : {
18621 : // This is indexing the STL vector of C/C++ style arrays as a doubly
18622 : // indexed array access. It is OK since we have leveraged the semantics
18623 : // of STL vector memory as contigous and cast the memory as an array
18624 : // of arrays to use the 2D array indexing. Hope this is not confusing,
18625 : // but it s very fast as an implementation.
18626 8000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
18627 : {
18628 4 : count++;
18629 : }
18630 : }
18631 : }
18632 : }
18633 :
18634 :
18635 :
18636 4 : return count;
18637 : }
18638 :
18639 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
18640 : // using values that overflow signed values of int.
18641 : size_t
18642 0 : SgTypeVoid::memoryUsage()
18643 : {
18644 : // This function is required because we need the class name as a type when we call sizeof
18645 : // There might be another way to implement this if we have a traversal that only called a
18646 : // representative object (one call for each type of Sage IIIIR node).
18647 0 : size_t memory = numberOfNodes() * sizeof(SgTypeVoid);
18648 :
18649 0 : return memory;
18650 : }
18651 :
18652 : /* #line 18653 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
18653 :
18654 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
18655 : void
18656 5668 : SgTypeGlobalVoid::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
18657 : {
18658 : // This function traverses the memory pool for only a specific IR node
18659 : // and calls the visit function of the input class execute a traversal
18660 : // similar to the style of the attribute based traversals within ROSE.
18661 : // This traversal will visit ALL nodes of the AST where as the other
18662 : // attribute based traversals visit only the embedded tree within the AST.
18663 :
18664 : // Initialize array to the address of the first element of the STL vector
18665 : // (which is guaranteed to be contiguous storage).
18666 : // SgTypeGlobalVoid objectArray [] = *(Memory_Block_List.begin());
18667 5668 : if (SgTypeGlobalVoid::pools.empty() == false)
18668 : {
18669 : // Generate an array of memory pools
18670 0 : SgTypeGlobalVoid** objectArray = (SgTypeGlobalVoid**) &(SgTypeGlobalVoid::pools[0]);
18671 :
18672 : // Build a local variable for better performance
18673 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
18674 : #if 0
18675 : // Iterate over the memory pools
18676 : for (unsigned int i=0; i < SgTypeGlobalVoid::pools.size(); i++)
18677 : {
18678 : // objectArray[i] is a single memory pool
18679 : for (int j=0; j < SgTypeGlobalVoid::pool_size; j++)
18680 : {
18681 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
18682 : {
18683 : traversal.visit(&(objectArray[i][j]));
18684 : }
18685 : }
18686 : }
18687 : #else
18688 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
18689 : // compute the list first and then call the visit function on each list element.
18690 :
18691 : // printf ("Inside of SgTypeGlobalVoid::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
18692 :
18693 0 : std::vector<SgTypeGlobalVoid*> nodeList;
18694 :
18695 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
18696 0 : for (unsigned int i=0; i < SgTypeGlobalVoid::pools.size(); i++)
18697 : {
18698 : // objectArray[i] is a single memory pool
18699 0 : for (unsigned j=0; j < SgTypeGlobalVoid::pool_size; j++)
18700 : {
18701 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
18702 : {
18703 0 : nodeList.push_back(&(objectArray[i][j]));
18704 : }
18705 : }
18706 : }
18707 :
18708 : // Iterate over the saved list
18709 0 : size_t nodeListSize = nodeList.size();
18710 0 : for (size_t i=0; i < nodeListSize; i++)
18711 : {
18712 0 : ROSE_ASSERT(nodeList[i] != NULL);
18713 : #if 0
18714 : traversal.visit(nodeList[i]);
18715 : #else
18716 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
18717 : {
18718 0 : traversal.visit(nodeList[i]);
18719 : }
18720 : #endif
18721 : }
18722 : #endif
18723 : }
18724 :
18725 : // This should not be required since all previously static data members are
18726 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
18727 :
18728 5668 : }
18729 :
18730 :
18731 : void
18732 194 : SgTypeGlobalVoid::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
18733 : {
18734 : // This function traverses the memory pool for an IR node and
18735 : // calls the function to execute the visitor object.
18736 :
18737 : // Initialize array to the address of the first element of the STL vector
18738 : // (which is guarenteed to be contiguous storage).
18739 : // SgTypeGlobalVoid objectArray [] = *(Memory_Block_List.begin());
18740 194 : if (SgTypeGlobalVoid::pools.empty() == false)
18741 : {
18742 : // Generate an array of memory pools
18743 0 : SgTypeGlobalVoid** objectArray = (SgTypeGlobalVoid**) &(SgTypeGlobalVoid::pools[0]);
18744 :
18745 : // Build a local variable for better performance
18746 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
18747 :
18748 : // Iterate over the memory pools
18749 0 : for (unsigned int i=0; i < SgTypeGlobalVoid::pools.size(); i++)
18750 : {
18751 : // objectArray[i] is a single memory pool
18752 0 : for (unsigned j=0; j < SgTypeGlobalVoid::pool_size; j++)
18753 : {
18754 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
18755 : {
18756 : // printf ("Found a valid SgTypeGlobalVoid object in the memory pool %d at position %d \n",i,j);
18757 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
18758 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
18759 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
18760 : }
18761 : else
18762 : {
18763 : // printf ("Found a INVALID SgTypeGlobalVoid object in the memory pool \n");
18764 : }
18765 : }
18766 : }
18767 : }
18768 :
18769 : // This should not be required since all previously static data members are
18770 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
18771 :
18772 194 : }
18773 :
18774 : void
18775 0 : SgTypeGlobalVoid::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
18776 : {
18777 : // This function visits only a single IR node of the memory pool.
18778 : // it is typically called once for each type of IR node within
18779 : // the automatically generated function: traverseRepresentativeNodes().
18780 :
18781 : // Initialize array to the address of the first element of the STL vector
18782 : // (which is guarenteed to be contiguous storage).
18783 : // SgTypeGlobalVoid objectArray [] = *(Memory_Block_List.begin());
18784 0 : if (SgTypeGlobalVoid::pools.empty() == false)
18785 : {
18786 : // Generate an array of memory pools
18787 0 : SgTypeGlobalVoid** objectArray = (SgTypeGlobalVoid**) &(SgTypeGlobalVoid::pools[0]);
18788 :
18789 : // Build a local variable for better performance
18790 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
18791 :
18792 : // Iterate over the memory pools
18793 0 : bool done = false;
18794 0 : unsigned i=0;
18795 :
18796 : // find the first valid IR node, call visit function, and then leave
18797 0 : while ( done == false && i < SgTypeGlobalVoid::pools.size() )
18798 : {
18799 : // objectArray[i] is a single memory pool
18800 : unsigned j=0;
18801 0 : while (done == false && j < SgTypeGlobalVoid::pool_size)
18802 : {
18803 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
18804 : {
18805 0 : traversal.visit(&(objectArray[i][j]));
18806 0 : done = true;
18807 : }
18808 0 : j++;
18809 : }
18810 0 : i++;
18811 : }
18812 :
18813 : #if 0
18814 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
18815 : if (done == false)
18816 : {
18817 : printf ("No representative for SgTypeGlobalVoid found in memory pools \n");
18818 : }
18819 : #endif
18820 : }
18821 0 : }
18822 :
18823 :
18824 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
18825 : // using values that overflow signed values of int.
18826 : size_t
18827 4 : SgTypeGlobalVoid::numberOfNodes()
18828 : {
18829 : // This function traverses the memory pool for an IR node and
18830 : // counts the number of IR nodes of a particular Sage III IR
18831 : // nodes type.
18832 :
18833 4 : size_t count = 0;
18834 4 : if (SgTypeGlobalVoid::pools.empty() == false)
18835 : {
18836 : // Generate an array of memory pools (this is actually a STL vector,
18837 : // but it is contiguious, so OK to treat this way).
18838 0 : SgTypeGlobalVoid** objectArray = (SgTypeGlobalVoid**) &(SgTypeGlobalVoid::pools[0]);
18839 :
18840 : // Build a local variable for better performance (make it a loop invariant variable).
18841 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
18842 :
18843 : // Iterate over all of the memory pools for this IR node.
18844 0 : for (unsigned int i=0; i < SgTypeGlobalVoid::pools.size(); i++)
18845 : {
18846 : // objectArray[i] is a single memory pool, iterate over all the
18847 : // IR nodes and only count those that are valid IR nodes used in
18848 : // the AST (i.e. allocated IR nodes).
18849 0 : for (unsigned j=0; j < SgTypeGlobalVoid::pool_size; j++)
18850 : {
18851 : // This is indexing the STL vector of C/C++ style arrays as a doubly
18852 : // indexed array access. It is OK since we have leveraged the semantics
18853 : // of STL vector memory as contigous and cast the memory as an array
18854 : // of arrays to use the 2D array indexing. Hope this is not confusing,
18855 : // but it s very fast as an implementation.
18856 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
18857 : {
18858 0 : count++;
18859 : }
18860 : }
18861 : }
18862 : }
18863 :
18864 :
18865 :
18866 4 : return count;
18867 : }
18868 :
18869 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
18870 : // using values that overflow signed values of int.
18871 : size_t
18872 0 : SgTypeGlobalVoid::memoryUsage()
18873 : {
18874 : // This function is required because we need the class name as a type when we call sizeof
18875 : // There might be another way to implement this if we have a traversal that only called a
18876 : // representative object (one call for each type of Sage IIIIR node).
18877 0 : size_t memory = numberOfNodes() * sizeof(SgTypeGlobalVoid);
18878 :
18879 0 : return memory;
18880 : }
18881 :
18882 : /* #line 18883 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
18883 :
18884 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
18885 : void
18886 5668 : SgTypeWchar::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
18887 : {
18888 : // This function traverses the memory pool for only a specific IR node
18889 : // and calls the visit function of the input class execute a traversal
18890 : // similar to the style of the attribute based traversals within ROSE.
18891 : // This traversal will visit ALL nodes of the AST where as the other
18892 : // attribute based traversals visit only the embedded tree within the AST.
18893 :
18894 : // Initialize array to the address of the first element of the STL vector
18895 : // (which is guaranteed to be contiguous storage).
18896 : // SgTypeWchar objectArray [] = *(Memory_Block_List.begin());
18897 5668 : if (SgTypeWchar::pools.empty() == false)
18898 : {
18899 : // Generate an array of memory pools
18900 201 : SgTypeWchar** objectArray = (SgTypeWchar**) &(SgTypeWchar::pools[0]);
18901 :
18902 : // Build a local variable for better performance
18903 201 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
18904 : #if 0
18905 : // Iterate over the memory pools
18906 : for (unsigned int i=0; i < SgTypeWchar::pools.size(); i++)
18907 : {
18908 : // objectArray[i] is a single memory pool
18909 : for (int j=0; j < SgTypeWchar::pool_size; j++)
18910 : {
18911 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
18912 : {
18913 : traversal.visit(&(objectArray[i][j]));
18914 : }
18915 : }
18916 : }
18917 : #else
18918 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
18919 : // compute the list first and then call the visit function on each list element.
18920 :
18921 : // printf ("Inside of SgTypeWchar::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
18922 :
18923 402 : std::vector<SgTypeWchar*> nodeList;
18924 :
18925 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
18926 402 : for (unsigned int i=0; i < SgTypeWchar::pools.size(); i++)
18927 : {
18928 : // objectArray[i] is a single memory pool
18929 402201 : for (unsigned j=0; j < SgTypeWchar::pool_size; j++)
18930 : {
18931 402000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
18932 : {
18933 201 : nodeList.push_back(&(objectArray[i][j]));
18934 : }
18935 : }
18936 : }
18937 :
18938 : // Iterate over the saved list
18939 201 : size_t nodeListSize = nodeList.size();
18940 402 : for (size_t i=0; i < nodeListSize; i++)
18941 : {
18942 201 : ROSE_ASSERT(nodeList[i] != NULL);
18943 : #if 0
18944 : traversal.visit(nodeList[i]);
18945 : #else
18946 201 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
18947 : {
18948 201 : traversal.visit(nodeList[i]);
18949 : }
18950 : #endif
18951 : }
18952 : #endif
18953 : }
18954 :
18955 : // This should not be required since all previously static data members are
18956 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
18957 :
18958 5668 : }
18959 :
18960 :
18961 : void
18962 194 : SgTypeWchar::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
18963 : {
18964 : // This function traverses the memory pool for an IR node and
18965 : // calls the function to execute the visitor object.
18966 :
18967 : // Initialize array to the address of the first element of the STL vector
18968 : // (which is guarenteed to be contiguous storage).
18969 : // SgTypeWchar objectArray [] = *(Memory_Block_List.begin());
18970 194 : if (SgTypeWchar::pools.empty() == false)
18971 : {
18972 : // Generate an array of memory pools
18973 137 : SgTypeWchar** objectArray = (SgTypeWchar**) &(SgTypeWchar::pools[0]);
18974 :
18975 : // Build a local variable for better performance
18976 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
18977 :
18978 : // Iterate over the memory pools
18979 274 : for (unsigned int i=0; i < SgTypeWchar::pools.size(); i++)
18980 : {
18981 : // objectArray[i] is a single memory pool
18982 274137 : for (unsigned j=0; j < SgTypeWchar::pool_size; j++)
18983 : {
18984 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
18985 : {
18986 : // printf ("Found a valid SgTypeWchar object in the memory pool %d at position %d \n",i,j);
18987 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
18988 137 : objectArray[i][j].executeVisitorMemberFunction(visitor);
18989 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
18990 : }
18991 : else
18992 : {
18993 : // printf ("Found a INVALID SgTypeWchar object in the memory pool \n");
18994 : }
18995 : }
18996 : }
18997 : }
18998 :
18999 : // This should not be required since all previously static data members are
19000 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
19001 :
19002 194 : }
19003 :
19004 : void
19005 0 : SgTypeWchar::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
19006 : {
19007 : // This function visits only a single IR node of the memory pool.
19008 : // it is typically called once for each type of IR node within
19009 : // the automatically generated function: traverseRepresentativeNodes().
19010 :
19011 : // Initialize array to the address of the first element of the STL vector
19012 : // (which is guarenteed to be contiguous storage).
19013 : // SgTypeWchar objectArray [] = *(Memory_Block_List.begin());
19014 0 : if (SgTypeWchar::pools.empty() == false)
19015 : {
19016 : // Generate an array of memory pools
19017 0 : SgTypeWchar** objectArray = (SgTypeWchar**) &(SgTypeWchar::pools[0]);
19018 :
19019 : // Build a local variable for better performance
19020 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
19021 :
19022 : // Iterate over the memory pools
19023 0 : bool done = false;
19024 0 : unsigned i=0;
19025 :
19026 : // find the first valid IR node, call visit function, and then leave
19027 0 : while ( done == false && i < SgTypeWchar::pools.size() )
19028 : {
19029 : // objectArray[i] is a single memory pool
19030 : unsigned j=0;
19031 0 : while (done == false && j < SgTypeWchar::pool_size)
19032 : {
19033 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
19034 : {
19035 0 : traversal.visit(&(objectArray[i][j]));
19036 0 : done = true;
19037 : }
19038 0 : j++;
19039 : }
19040 0 : i++;
19041 : }
19042 :
19043 : #if 0
19044 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
19045 : if (done == false)
19046 : {
19047 : printf ("No representative for SgTypeWchar found in memory pools \n");
19048 : }
19049 : #endif
19050 : }
19051 0 : }
19052 :
19053 :
19054 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
19055 : // using values that overflow signed values of int.
19056 : size_t
19057 4 : SgTypeWchar::numberOfNodes()
19058 : {
19059 : // This function traverses the memory pool for an IR node and
19060 : // counts the number of IR nodes of a particular Sage III IR
19061 : // nodes type.
19062 :
19063 4 : size_t count = 0;
19064 4 : if (SgTypeWchar::pools.empty() == false)
19065 : {
19066 : // Generate an array of memory pools (this is actually a STL vector,
19067 : // but it is contiguious, so OK to treat this way).
19068 1 : SgTypeWchar** objectArray = (SgTypeWchar**) &(SgTypeWchar::pools[0]);
19069 :
19070 : // Build a local variable for better performance (make it a loop invariant variable).
19071 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
19072 :
19073 : // Iterate over all of the memory pools for this IR node.
19074 2 : for (unsigned int i=0; i < SgTypeWchar::pools.size(); i++)
19075 : {
19076 : // objectArray[i] is a single memory pool, iterate over all the
19077 : // IR nodes and only count those that are valid IR nodes used in
19078 : // the AST (i.e. allocated IR nodes).
19079 2001 : for (unsigned j=0; j < SgTypeWchar::pool_size; j++)
19080 : {
19081 : // This is indexing the STL vector of C/C++ style arrays as a doubly
19082 : // indexed array access. It is OK since we have leveraged the semantics
19083 : // of STL vector memory as contigous and cast the memory as an array
19084 : // of arrays to use the 2D array indexing. Hope this is not confusing,
19085 : // but it s very fast as an implementation.
19086 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
19087 : {
19088 1 : count++;
19089 : }
19090 : }
19091 : }
19092 : }
19093 :
19094 :
19095 :
19096 4 : return count;
19097 : }
19098 :
19099 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
19100 : // using values that overflow signed values of int.
19101 : size_t
19102 0 : SgTypeWchar::memoryUsage()
19103 : {
19104 : // This function is required because we need the class name as a type when we call sizeof
19105 : // There might be another way to implement this if we have a traversal that only called a
19106 : // representative object (one call for each type of Sage IIIIR node).
19107 0 : size_t memory = numberOfNodes() * sizeof(SgTypeWchar);
19108 :
19109 0 : return memory;
19110 : }
19111 :
19112 : /* #line 19113 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
19113 :
19114 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
19115 : void
19116 5668 : SgTypeFloat::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
19117 : {
19118 : // This function traverses the memory pool for only a specific IR node
19119 : // and calls the visit function of the input class execute a traversal
19120 : // similar to the style of the attribute based traversals within ROSE.
19121 : // This traversal will visit ALL nodes of the AST where as the other
19122 : // attribute based traversals visit only the embedded tree within the AST.
19123 :
19124 : // Initialize array to the address of the first element of the STL vector
19125 : // (which is guaranteed to be contiguous storage).
19126 : // SgTypeFloat objectArray [] = *(Memory_Block_List.begin());
19127 5668 : if (SgTypeFloat::pools.empty() == false)
19128 : {
19129 : // Generate an array of memory pools
19130 5323 : SgTypeFloat** objectArray = (SgTypeFloat**) &(SgTypeFloat::pools[0]);
19131 :
19132 : // Build a local variable for better performance
19133 5323 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
19134 : #if 0
19135 : // Iterate over the memory pools
19136 : for (unsigned int i=0; i < SgTypeFloat::pools.size(); i++)
19137 : {
19138 : // objectArray[i] is a single memory pool
19139 : for (int j=0; j < SgTypeFloat::pool_size; j++)
19140 : {
19141 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
19142 : {
19143 : traversal.visit(&(objectArray[i][j]));
19144 : }
19145 : }
19146 : }
19147 : #else
19148 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
19149 : // compute the list first and then call the visit function on each list element.
19150 :
19151 : // printf ("Inside of SgTypeFloat::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
19152 :
19153 10646 : std::vector<SgTypeFloat*> nodeList;
19154 :
19155 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
19156 10646 : for (unsigned int i=0; i < SgTypeFloat::pools.size(); i++)
19157 : {
19158 : // objectArray[i] is a single memory pool
19159 10651300 : for (unsigned j=0; j < SgTypeFloat::pool_size; j++)
19160 : {
19161 10646000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
19162 : {
19163 5323 : nodeList.push_back(&(objectArray[i][j]));
19164 : }
19165 : }
19166 : }
19167 :
19168 : // Iterate over the saved list
19169 5323 : size_t nodeListSize = nodeList.size();
19170 10646 : for (size_t i=0; i < nodeListSize; i++)
19171 : {
19172 5323 : ROSE_ASSERT(nodeList[i] != NULL);
19173 : #if 0
19174 : traversal.visit(nodeList[i]);
19175 : #else
19176 5323 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
19177 : {
19178 5323 : traversal.visit(nodeList[i]);
19179 : }
19180 : #endif
19181 : }
19182 : #endif
19183 : }
19184 :
19185 : // This should not be required since all previously static data members are
19186 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
19187 :
19188 5668 : }
19189 :
19190 :
19191 : void
19192 194 : SgTypeFloat::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
19193 : {
19194 : // This function traverses the memory pool for an IR node and
19195 : // calls the function to execute the visitor object.
19196 :
19197 : // Initialize array to the address of the first element of the STL vector
19198 : // (which is guarenteed to be contiguous storage).
19199 : // SgTypeFloat objectArray [] = *(Memory_Block_List.begin());
19200 194 : if (SgTypeFloat::pools.empty() == false)
19201 : {
19202 : // Generate an array of memory pools
19203 194 : SgTypeFloat** objectArray = (SgTypeFloat**) &(SgTypeFloat::pools[0]);
19204 :
19205 : // Build a local variable for better performance
19206 194 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
19207 :
19208 : // Iterate over the memory pools
19209 388 : for (unsigned int i=0; i < SgTypeFloat::pools.size(); i++)
19210 : {
19211 : // objectArray[i] is a single memory pool
19212 388194 : for (unsigned j=0; j < SgTypeFloat::pool_size; j++)
19213 : {
19214 388000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
19215 : {
19216 : // printf ("Found a valid SgTypeFloat object in the memory pool %d at position %d \n",i,j);
19217 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
19218 194 : objectArray[i][j].executeVisitorMemberFunction(visitor);
19219 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
19220 : }
19221 : else
19222 : {
19223 : // printf ("Found a INVALID SgTypeFloat object in the memory pool \n");
19224 : }
19225 : }
19226 : }
19227 : }
19228 :
19229 : // This should not be required since all previously static data members are
19230 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
19231 :
19232 194 : }
19233 :
19234 : void
19235 0 : SgTypeFloat::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
19236 : {
19237 : // This function visits only a single IR node of the memory pool.
19238 : // it is typically called once for each type of IR node within
19239 : // the automatically generated function: traverseRepresentativeNodes().
19240 :
19241 : // Initialize array to the address of the first element of the STL vector
19242 : // (which is guarenteed to be contiguous storage).
19243 : // SgTypeFloat objectArray [] = *(Memory_Block_List.begin());
19244 0 : if (SgTypeFloat::pools.empty() == false)
19245 : {
19246 : // Generate an array of memory pools
19247 0 : SgTypeFloat** objectArray = (SgTypeFloat**) &(SgTypeFloat::pools[0]);
19248 :
19249 : // Build a local variable for better performance
19250 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
19251 :
19252 : // Iterate over the memory pools
19253 0 : bool done = false;
19254 0 : unsigned i=0;
19255 :
19256 : // find the first valid IR node, call visit function, and then leave
19257 0 : while ( done == false && i < SgTypeFloat::pools.size() )
19258 : {
19259 : // objectArray[i] is a single memory pool
19260 : unsigned j=0;
19261 0 : while (done == false && j < SgTypeFloat::pool_size)
19262 : {
19263 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
19264 : {
19265 0 : traversal.visit(&(objectArray[i][j]));
19266 0 : done = true;
19267 : }
19268 0 : j++;
19269 : }
19270 0 : i++;
19271 : }
19272 :
19273 : #if 0
19274 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
19275 : if (done == false)
19276 : {
19277 : printf ("No representative for SgTypeFloat found in memory pools \n");
19278 : }
19279 : #endif
19280 : }
19281 0 : }
19282 :
19283 :
19284 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
19285 : // using values that overflow signed values of int.
19286 : size_t
19287 4 : SgTypeFloat::numberOfNodes()
19288 : {
19289 : // This function traverses the memory pool for an IR node and
19290 : // counts the number of IR nodes of a particular Sage III IR
19291 : // nodes type.
19292 :
19293 4 : size_t count = 0;
19294 4 : if (SgTypeFloat::pools.empty() == false)
19295 : {
19296 : // Generate an array of memory pools (this is actually a STL vector,
19297 : // but it is contiguious, so OK to treat this way).
19298 3 : SgTypeFloat** objectArray = (SgTypeFloat**) &(SgTypeFloat::pools[0]);
19299 :
19300 : // Build a local variable for better performance (make it a loop invariant variable).
19301 3 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
19302 :
19303 : // Iterate over all of the memory pools for this IR node.
19304 6 : for (unsigned int i=0; i < SgTypeFloat::pools.size(); i++)
19305 : {
19306 : // objectArray[i] is a single memory pool, iterate over all the
19307 : // IR nodes and only count those that are valid IR nodes used in
19308 : // the AST (i.e. allocated IR nodes).
19309 6003 : for (unsigned j=0; j < SgTypeFloat::pool_size; j++)
19310 : {
19311 : // This is indexing the STL vector of C/C++ style arrays as a doubly
19312 : // indexed array access. It is OK since we have leveraged the semantics
19313 : // of STL vector memory as contigous and cast the memory as an array
19314 : // of arrays to use the 2D array indexing. Hope this is not confusing,
19315 : // but it s very fast as an implementation.
19316 6000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
19317 : {
19318 3 : count++;
19319 : }
19320 : }
19321 : }
19322 : }
19323 :
19324 :
19325 :
19326 4 : return count;
19327 : }
19328 :
19329 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
19330 : // using values that overflow signed values of int.
19331 : size_t
19332 0 : SgTypeFloat::memoryUsage()
19333 : {
19334 : // This function is required because we need the class name as a type when we call sizeof
19335 : // There might be another way to implement this if we have a traversal that only called a
19336 : // representative object (one call for each type of Sage IIIIR node).
19337 0 : size_t memory = numberOfNodes() * sizeof(SgTypeFloat);
19338 :
19339 0 : return memory;
19340 : }
19341 :
19342 : /* #line 19343 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
19343 :
19344 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
19345 : void
19346 5668 : SgTypeDouble::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
19347 : {
19348 : // This function traverses the memory pool for only a specific IR node
19349 : // and calls the visit function of the input class execute a traversal
19350 : // similar to the style of the attribute based traversals within ROSE.
19351 : // This traversal will visit ALL nodes of the AST where as the other
19352 : // attribute based traversals visit only the embedded tree within the AST.
19353 :
19354 : // Initialize array to the address of the first element of the STL vector
19355 : // (which is guaranteed to be contiguous storage).
19356 : // SgTypeDouble objectArray [] = *(Memory_Block_List.begin());
19357 5668 : if (SgTypeDouble::pools.empty() == false)
19358 : {
19359 : // Generate an array of memory pools
19360 5144 : SgTypeDouble** objectArray = (SgTypeDouble**) &(SgTypeDouble::pools[0]);
19361 :
19362 : // Build a local variable for better performance
19363 5144 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
19364 : #if 0
19365 : // Iterate over the memory pools
19366 : for (unsigned int i=0; i < SgTypeDouble::pools.size(); i++)
19367 : {
19368 : // objectArray[i] is a single memory pool
19369 : for (int j=0; j < SgTypeDouble::pool_size; j++)
19370 : {
19371 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
19372 : {
19373 : traversal.visit(&(objectArray[i][j]));
19374 : }
19375 : }
19376 : }
19377 : #else
19378 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
19379 : // compute the list first and then call the visit function on each list element.
19380 :
19381 : // printf ("Inside of SgTypeDouble::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
19382 :
19383 10288 : std::vector<SgTypeDouble*> nodeList;
19384 :
19385 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
19386 10288 : for (unsigned int i=0; i < SgTypeDouble::pools.size(); i++)
19387 : {
19388 : // objectArray[i] is a single memory pool
19389 10293100 : for (unsigned j=0; j < SgTypeDouble::pool_size; j++)
19390 : {
19391 10288000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
19392 : {
19393 5144 : nodeList.push_back(&(objectArray[i][j]));
19394 : }
19395 : }
19396 : }
19397 :
19398 : // Iterate over the saved list
19399 5144 : size_t nodeListSize = nodeList.size();
19400 10288 : for (size_t i=0; i < nodeListSize; i++)
19401 : {
19402 5144 : ROSE_ASSERT(nodeList[i] != NULL);
19403 : #if 0
19404 : traversal.visit(nodeList[i]);
19405 : #else
19406 5144 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
19407 : {
19408 5144 : traversal.visit(nodeList[i]);
19409 : }
19410 : #endif
19411 : }
19412 : #endif
19413 : }
19414 :
19415 : // This should not be required since all previously static data members are
19416 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
19417 :
19418 5668 : }
19419 :
19420 :
19421 : void
19422 194 : SgTypeDouble::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
19423 : {
19424 : // This function traverses the memory pool for an IR node and
19425 : // calls the function to execute the visitor object.
19426 :
19427 : // Initialize array to the address of the first element of the STL vector
19428 : // (which is guarenteed to be contiguous storage).
19429 : // SgTypeDouble objectArray [] = *(Memory_Block_List.begin());
19430 194 : if (SgTypeDouble::pools.empty() == false)
19431 : {
19432 : // Generate an array of memory pools
19433 194 : SgTypeDouble** objectArray = (SgTypeDouble**) &(SgTypeDouble::pools[0]);
19434 :
19435 : // Build a local variable for better performance
19436 194 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
19437 :
19438 : // Iterate over the memory pools
19439 388 : for (unsigned int i=0; i < SgTypeDouble::pools.size(); i++)
19440 : {
19441 : // objectArray[i] is a single memory pool
19442 388194 : for (unsigned j=0; j < SgTypeDouble::pool_size; j++)
19443 : {
19444 388000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
19445 : {
19446 : // printf ("Found a valid SgTypeDouble object in the memory pool %d at position %d \n",i,j);
19447 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
19448 194 : objectArray[i][j].executeVisitorMemberFunction(visitor);
19449 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
19450 : }
19451 : else
19452 : {
19453 : // printf ("Found a INVALID SgTypeDouble object in the memory pool \n");
19454 : }
19455 : }
19456 : }
19457 : }
19458 :
19459 : // This should not be required since all previously static data members are
19460 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
19461 :
19462 194 : }
19463 :
19464 : void
19465 0 : SgTypeDouble::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
19466 : {
19467 : // This function visits only a single IR node of the memory pool.
19468 : // it is typically called once for each type of IR node within
19469 : // the automatically generated function: traverseRepresentativeNodes().
19470 :
19471 : // Initialize array to the address of the first element of the STL vector
19472 : // (which is guarenteed to be contiguous storage).
19473 : // SgTypeDouble objectArray [] = *(Memory_Block_List.begin());
19474 0 : if (SgTypeDouble::pools.empty() == false)
19475 : {
19476 : // Generate an array of memory pools
19477 0 : SgTypeDouble** objectArray = (SgTypeDouble**) &(SgTypeDouble::pools[0]);
19478 :
19479 : // Build a local variable for better performance
19480 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
19481 :
19482 : // Iterate over the memory pools
19483 0 : bool done = false;
19484 0 : unsigned i=0;
19485 :
19486 : // find the first valid IR node, call visit function, and then leave
19487 0 : while ( done == false && i < SgTypeDouble::pools.size() )
19488 : {
19489 : // objectArray[i] is a single memory pool
19490 : unsigned j=0;
19491 0 : while (done == false && j < SgTypeDouble::pool_size)
19492 : {
19493 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
19494 : {
19495 0 : traversal.visit(&(objectArray[i][j]));
19496 0 : done = true;
19497 : }
19498 0 : j++;
19499 : }
19500 0 : i++;
19501 : }
19502 :
19503 : #if 0
19504 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
19505 : if (done == false)
19506 : {
19507 : printf ("No representative for SgTypeDouble found in memory pools \n");
19508 : }
19509 : #endif
19510 : }
19511 0 : }
19512 :
19513 :
19514 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
19515 : // using values that overflow signed values of int.
19516 : size_t
19517 4 : SgTypeDouble::numberOfNodes()
19518 : {
19519 : // This function traverses the memory pool for an IR node and
19520 : // counts the number of IR nodes of a particular Sage III IR
19521 : // nodes type.
19522 :
19523 4 : size_t count = 0;
19524 4 : if (SgTypeDouble::pools.empty() == false)
19525 : {
19526 : // Generate an array of memory pools (this is actually a STL vector,
19527 : // but it is contiguious, so OK to treat this way).
19528 2 : SgTypeDouble** objectArray = (SgTypeDouble**) &(SgTypeDouble::pools[0]);
19529 :
19530 : // Build a local variable for better performance (make it a loop invariant variable).
19531 2 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
19532 :
19533 : // Iterate over all of the memory pools for this IR node.
19534 4 : for (unsigned int i=0; i < SgTypeDouble::pools.size(); i++)
19535 : {
19536 : // objectArray[i] is a single memory pool, iterate over all the
19537 : // IR nodes and only count those that are valid IR nodes used in
19538 : // the AST (i.e. allocated IR nodes).
19539 4002 : for (unsigned j=0; j < SgTypeDouble::pool_size; j++)
19540 : {
19541 : // This is indexing the STL vector of C/C++ style arrays as a doubly
19542 : // indexed array access. It is OK since we have leveraged the semantics
19543 : // of STL vector memory as contigous and cast the memory as an array
19544 : // of arrays to use the 2D array indexing. Hope this is not confusing,
19545 : // but it s very fast as an implementation.
19546 4000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
19547 : {
19548 2 : count++;
19549 : }
19550 : }
19551 : }
19552 : }
19553 :
19554 :
19555 :
19556 4 : return count;
19557 : }
19558 :
19559 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
19560 : // using values that overflow signed values of int.
19561 : size_t
19562 0 : SgTypeDouble::memoryUsage()
19563 : {
19564 : // This function is required because we need the class name as a type when we call sizeof
19565 : // There might be another way to implement this if we have a traversal that only called a
19566 : // representative object (one call for each type of Sage IIIIR node).
19567 0 : size_t memory = numberOfNodes() * sizeof(SgTypeDouble);
19568 :
19569 0 : return memory;
19570 : }
19571 :
19572 : /* #line 19573 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
19573 :
19574 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
19575 : void
19576 5668 : SgTypeLongLong::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
19577 : {
19578 : // This function traverses the memory pool for only a specific IR node
19579 : // and calls the visit function of the input class execute a traversal
19580 : // similar to the style of the attribute based traversals within ROSE.
19581 : // This traversal will visit ALL nodes of the AST where as the other
19582 : // attribute based traversals visit only the embedded tree within the AST.
19583 :
19584 : // Initialize array to the address of the first element of the STL vector
19585 : // (which is guaranteed to be contiguous storage).
19586 : // SgTypeLongLong objectArray [] = *(Memory_Block_List.begin());
19587 5668 : if (SgTypeLongLong::pools.empty() == false)
19588 : {
19589 : // Generate an array of memory pools
19590 4892 : SgTypeLongLong** objectArray = (SgTypeLongLong**) &(SgTypeLongLong::pools[0]);
19591 :
19592 : // Build a local variable for better performance
19593 4892 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
19594 : #if 0
19595 : // Iterate over the memory pools
19596 : for (unsigned int i=0; i < SgTypeLongLong::pools.size(); i++)
19597 : {
19598 : // objectArray[i] is a single memory pool
19599 : for (int j=0; j < SgTypeLongLong::pool_size; j++)
19600 : {
19601 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
19602 : {
19603 : traversal.visit(&(objectArray[i][j]));
19604 : }
19605 : }
19606 : }
19607 : #else
19608 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
19609 : // compute the list first and then call the visit function on each list element.
19610 :
19611 : // printf ("Inside of SgTypeLongLong::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
19612 :
19613 9784 : std::vector<SgTypeLongLong*> nodeList;
19614 :
19615 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
19616 9784 : for (unsigned int i=0; i < SgTypeLongLong::pools.size(); i++)
19617 : {
19618 : // objectArray[i] is a single memory pool
19619 9788890 : for (unsigned j=0; j < SgTypeLongLong::pool_size; j++)
19620 : {
19621 9784000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
19622 : {
19623 4892 : nodeList.push_back(&(objectArray[i][j]));
19624 : }
19625 : }
19626 : }
19627 :
19628 : // Iterate over the saved list
19629 4892 : size_t nodeListSize = nodeList.size();
19630 9784 : for (size_t i=0; i < nodeListSize; i++)
19631 : {
19632 4892 : ROSE_ASSERT(nodeList[i] != NULL);
19633 : #if 0
19634 : traversal.visit(nodeList[i]);
19635 : #else
19636 4892 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
19637 : {
19638 4892 : traversal.visit(nodeList[i]);
19639 : }
19640 : #endif
19641 : }
19642 : #endif
19643 : }
19644 :
19645 : // This should not be required since all previously static data members are
19646 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
19647 :
19648 5668 : }
19649 :
19650 :
19651 : void
19652 194 : SgTypeLongLong::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
19653 : {
19654 : // This function traverses the memory pool for an IR node and
19655 : // calls the function to execute the visitor object.
19656 :
19657 : // Initialize array to the address of the first element of the STL vector
19658 : // (which is guarenteed to be contiguous storage).
19659 : // SgTypeLongLong objectArray [] = *(Memory_Block_List.begin());
19660 194 : if (SgTypeLongLong::pools.empty() == false)
19661 : {
19662 : // Generate an array of memory pools
19663 194 : SgTypeLongLong** objectArray = (SgTypeLongLong**) &(SgTypeLongLong::pools[0]);
19664 :
19665 : // Build a local variable for better performance
19666 194 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
19667 :
19668 : // Iterate over the memory pools
19669 388 : for (unsigned int i=0; i < SgTypeLongLong::pools.size(); i++)
19670 : {
19671 : // objectArray[i] is a single memory pool
19672 388194 : for (unsigned j=0; j < SgTypeLongLong::pool_size; j++)
19673 : {
19674 388000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
19675 : {
19676 : // printf ("Found a valid SgTypeLongLong object in the memory pool %d at position %d \n",i,j);
19677 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
19678 194 : objectArray[i][j].executeVisitorMemberFunction(visitor);
19679 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
19680 : }
19681 : else
19682 : {
19683 : // printf ("Found a INVALID SgTypeLongLong object in the memory pool \n");
19684 : }
19685 : }
19686 : }
19687 : }
19688 :
19689 : // This should not be required since all previously static data members are
19690 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
19691 :
19692 194 : }
19693 :
19694 : void
19695 0 : SgTypeLongLong::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
19696 : {
19697 : // This function visits only a single IR node of the memory pool.
19698 : // it is typically called once for each type of IR node within
19699 : // the automatically generated function: traverseRepresentativeNodes().
19700 :
19701 : // Initialize array to the address of the first element of the STL vector
19702 : // (which is guarenteed to be contiguous storage).
19703 : // SgTypeLongLong objectArray [] = *(Memory_Block_List.begin());
19704 0 : if (SgTypeLongLong::pools.empty() == false)
19705 : {
19706 : // Generate an array of memory pools
19707 0 : SgTypeLongLong** objectArray = (SgTypeLongLong**) &(SgTypeLongLong::pools[0]);
19708 :
19709 : // Build a local variable for better performance
19710 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
19711 :
19712 : // Iterate over the memory pools
19713 0 : bool done = false;
19714 0 : unsigned i=0;
19715 :
19716 : // find the first valid IR node, call visit function, and then leave
19717 0 : while ( done == false && i < SgTypeLongLong::pools.size() )
19718 : {
19719 : // objectArray[i] is a single memory pool
19720 : unsigned j=0;
19721 0 : while (done == false && j < SgTypeLongLong::pool_size)
19722 : {
19723 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
19724 : {
19725 0 : traversal.visit(&(objectArray[i][j]));
19726 0 : done = true;
19727 : }
19728 0 : j++;
19729 : }
19730 0 : i++;
19731 : }
19732 :
19733 : #if 0
19734 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
19735 : if (done == false)
19736 : {
19737 : printf ("No representative for SgTypeLongLong found in memory pools \n");
19738 : }
19739 : #endif
19740 : }
19741 0 : }
19742 :
19743 :
19744 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
19745 : // using values that overflow signed values of int.
19746 : size_t
19747 4 : SgTypeLongLong::numberOfNodes()
19748 : {
19749 : // This function traverses the memory pool for an IR node and
19750 : // counts the number of IR nodes of a particular Sage III IR
19751 : // nodes type.
19752 :
19753 4 : size_t count = 0;
19754 4 : if (SgTypeLongLong::pools.empty() == false)
19755 : {
19756 : // Generate an array of memory pools (this is actually a STL vector,
19757 : // but it is contiguious, so OK to treat this way).
19758 2 : SgTypeLongLong** objectArray = (SgTypeLongLong**) &(SgTypeLongLong::pools[0]);
19759 :
19760 : // Build a local variable for better performance (make it a loop invariant variable).
19761 2 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
19762 :
19763 : // Iterate over all of the memory pools for this IR node.
19764 4 : for (unsigned int i=0; i < SgTypeLongLong::pools.size(); i++)
19765 : {
19766 : // objectArray[i] is a single memory pool, iterate over all the
19767 : // IR nodes and only count those that are valid IR nodes used in
19768 : // the AST (i.e. allocated IR nodes).
19769 4002 : for (unsigned j=0; j < SgTypeLongLong::pool_size; j++)
19770 : {
19771 : // This is indexing the STL vector of C/C++ style arrays as a doubly
19772 : // indexed array access. It is OK since we have leveraged the semantics
19773 : // of STL vector memory as contigous and cast the memory as an array
19774 : // of arrays to use the 2D array indexing. Hope this is not confusing,
19775 : // but it s very fast as an implementation.
19776 4000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
19777 : {
19778 2 : count++;
19779 : }
19780 : }
19781 : }
19782 : }
19783 :
19784 :
19785 :
19786 4 : return count;
19787 : }
19788 :
19789 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
19790 : // using values that overflow signed values of int.
19791 : size_t
19792 0 : SgTypeLongLong::memoryUsage()
19793 : {
19794 : // This function is required because we need the class name as a type when we call sizeof
19795 : // There might be another way to implement this if we have a traversal that only called a
19796 : // representative object (one call for each type of Sage IIIIR node).
19797 0 : size_t memory = numberOfNodes() * sizeof(SgTypeLongLong);
19798 :
19799 0 : return memory;
19800 : }
19801 :
19802 : /* #line 19803 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
19803 :
19804 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
19805 : void
19806 5668 : SgTypeSignedLongLong::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
19807 : {
19808 : // This function traverses the memory pool for only a specific IR node
19809 : // and calls the visit function of the input class execute a traversal
19810 : // similar to the style of the attribute based traversals within ROSE.
19811 : // This traversal will visit ALL nodes of the AST where as the other
19812 : // attribute based traversals visit only the embedded tree within the AST.
19813 :
19814 : // Initialize array to the address of the first element of the STL vector
19815 : // (which is guaranteed to be contiguous storage).
19816 : // SgTypeSignedLongLong objectArray [] = *(Memory_Block_List.begin());
19817 5668 : if (SgTypeSignedLongLong::pools.empty() == false)
19818 : {
19819 : // Generate an array of memory pools
19820 145 : SgTypeSignedLongLong** objectArray = (SgTypeSignedLongLong**) &(SgTypeSignedLongLong::pools[0]);
19821 :
19822 : // Build a local variable for better performance
19823 145 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
19824 : #if 0
19825 : // Iterate over the memory pools
19826 : for (unsigned int i=0; i < SgTypeSignedLongLong::pools.size(); i++)
19827 : {
19828 : // objectArray[i] is a single memory pool
19829 : for (int j=0; j < SgTypeSignedLongLong::pool_size; j++)
19830 : {
19831 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
19832 : {
19833 : traversal.visit(&(objectArray[i][j]));
19834 : }
19835 : }
19836 : }
19837 : #else
19838 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
19839 : // compute the list first and then call the visit function on each list element.
19840 :
19841 : // printf ("Inside of SgTypeSignedLongLong::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
19842 :
19843 290 : std::vector<SgTypeSignedLongLong*> nodeList;
19844 :
19845 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
19846 290 : for (unsigned int i=0; i < SgTypeSignedLongLong::pools.size(); i++)
19847 : {
19848 : // objectArray[i] is a single memory pool
19849 290145 : for (unsigned j=0; j < SgTypeSignedLongLong::pool_size; j++)
19850 : {
19851 290000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
19852 : {
19853 145 : nodeList.push_back(&(objectArray[i][j]));
19854 : }
19855 : }
19856 : }
19857 :
19858 : // Iterate over the saved list
19859 145 : size_t nodeListSize = nodeList.size();
19860 290 : for (size_t i=0; i < nodeListSize; i++)
19861 : {
19862 145 : ROSE_ASSERT(nodeList[i] != NULL);
19863 : #if 0
19864 : traversal.visit(nodeList[i]);
19865 : #else
19866 145 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
19867 : {
19868 145 : traversal.visit(nodeList[i]);
19869 : }
19870 : #endif
19871 : }
19872 : #endif
19873 : }
19874 :
19875 : // This should not be required since all previously static data members are
19876 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
19877 :
19878 5668 : }
19879 :
19880 :
19881 : void
19882 194 : SgTypeSignedLongLong::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
19883 : {
19884 : // This function traverses the memory pool for an IR node and
19885 : // calls the function to execute the visitor object.
19886 :
19887 : // Initialize array to the address of the first element of the STL vector
19888 : // (which is guarenteed to be contiguous storage).
19889 : // SgTypeSignedLongLong objectArray [] = *(Memory_Block_List.begin());
19890 194 : if (SgTypeSignedLongLong::pools.empty() == false)
19891 : {
19892 : // Generate an array of memory pools
19893 137 : SgTypeSignedLongLong** objectArray = (SgTypeSignedLongLong**) &(SgTypeSignedLongLong::pools[0]);
19894 :
19895 : // Build a local variable for better performance
19896 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
19897 :
19898 : // Iterate over the memory pools
19899 274 : for (unsigned int i=0; i < SgTypeSignedLongLong::pools.size(); i++)
19900 : {
19901 : // objectArray[i] is a single memory pool
19902 274137 : for (unsigned j=0; j < SgTypeSignedLongLong::pool_size; j++)
19903 : {
19904 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
19905 : {
19906 : // printf ("Found a valid SgTypeSignedLongLong object in the memory pool %d at position %d \n",i,j);
19907 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
19908 137 : objectArray[i][j].executeVisitorMemberFunction(visitor);
19909 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
19910 : }
19911 : else
19912 : {
19913 : // printf ("Found a INVALID SgTypeSignedLongLong object in the memory pool \n");
19914 : }
19915 : }
19916 : }
19917 : }
19918 :
19919 : // This should not be required since all previously static data members are
19920 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
19921 :
19922 194 : }
19923 :
19924 : void
19925 0 : SgTypeSignedLongLong::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
19926 : {
19927 : // This function visits only a single IR node of the memory pool.
19928 : // it is typically called once for each type of IR node within
19929 : // the automatically generated function: traverseRepresentativeNodes().
19930 :
19931 : // Initialize array to the address of the first element of the STL vector
19932 : // (which is guarenteed to be contiguous storage).
19933 : // SgTypeSignedLongLong objectArray [] = *(Memory_Block_List.begin());
19934 0 : if (SgTypeSignedLongLong::pools.empty() == false)
19935 : {
19936 : // Generate an array of memory pools
19937 0 : SgTypeSignedLongLong** objectArray = (SgTypeSignedLongLong**) &(SgTypeSignedLongLong::pools[0]);
19938 :
19939 : // Build a local variable for better performance
19940 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
19941 :
19942 : // Iterate over the memory pools
19943 0 : bool done = false;
19944 0 : unsigned i=0;
19945 :
19946 : // find the first valid IR node, call visit function, and then leave
19947 0 : while ( done == false && i < SgTypeSignedLongLong::pools.size() )
19948 : {
19949 : // objectArray[i] is a single memory pool
19950 : unsigned j=0;
19951 0 : while (done == false && j < SgTypeSignedLongLong::pool_size)
19952 : {
19953 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
19954 : {
19955 0 : traversal.visit(&(objectArray[i][j]));
19956 0 : done = true;
19957 : }
19958 0 : j++;
19959 : }
19960 0 : i++;
19961 : }
19962 :
19963 : #if 0
19964 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
19965 : if (done == false)
19966 : {
19967 : printf ("No representative for SgTypeSignedLongLong found in memory pools \n");
19968 : }
19969 : #endif
19970 : }
19971 0 : }
19972 :
19973 :
19974 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
19975 : // using values that overflow signed values of int.
19976 : size_t
19977 4 : SgTypeSignedLongLong::numberOfNodes()
19978 : {
19979 : // This function traverses the memory pool for an IR node and
19980 : // counts the number of IR nodes of a particular Sage III IR
19981 : // nodes type.
19982 :
19983 4 : size_t count = 0;
19984 4 : if (SgTypeSignedLongLong::pools.empty() == false)
19985 : {
19986 : // Generate an array of memory pools (this is actually a STL vector,
19987 : // but it is contiguious, so OK to treat this way).
19988 1 : SgTypeSignedLongLong** objectArray = (SgTypeSignedLongLong**) &(SgTypeSignedLongLong::pools[0]);
19989 :
19990 : // Build a local variable for better performance (make it a loop invariant variable).
19991 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
19992 :
19993 : // Iterate over all of the memory pools for this IR node.
19994 2 : for (unsigned int i=0; i < SgTypeSignedLongLong::pools.size(); i++)
19995 : {
19996 : // objectArray[i] is a single memory pool, iterate over all the
19997 : // IR nodes and only count those that are valid IR nodes used in
19998 : // the AST (i.e. allocated IR nodes).
19999 2001 : for (unsigned j=0; j < SgTypeSignedLongLong::pool_size; j++)
20000 : {
20001 : // This is indexing the STL vector of C/C++ style arrays as a doubly
20002 : // indexed array access. It is OK since we have leveraged the semantics
20003 : // of STL vector memory as contigous and cast the memory as an array
20004 : // of arrays to use the 2D array indexing. Hope this is not confusing,
20005 : // but it s very fast as an implementation.
20006 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
20007 : {
20008 1 : count++;
20009 : }
20010 : }
20011 : }
20012 : }
20013 :
20014 :
20015 :
20016 4 : return count;
20017 : }
20018 :
20019 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
20020 : // using values that overflow signed values of int.
20021 : size_t
20022 0 : SgTypeSignedLongLong::memoryUsage()
20023 : {
20024 : // This function is required because we need the class name as a type when we call sizeof
20025 : // There might be another way to implement this if we have a traversal that only called a
20026 : // representative object (one call for each type of Sage IIIIR node).
20027 0 : size_t memory = numberOfNodes() * sizeof(SgTypeSignedLongLong);
20028 :
20029 0 : return memory;
20030 : }
20031 :
20032 : /* #line 20033 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
20033 :
20034 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
20035 : void
20036 5668 : SgTypeUnsignedLongLong::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
20037 : {
20038 : // This function traverses the memory pool for only a specific IR node
20039 : // and calls the visit function of the input class execute a traversal
20040 : // similar to the style of the attribute based traversals within ROSE.
20041 : // This traversal will visit ALL nodes of the AST where as the other
20042 : // attribute based traversals visit only the embedded tree within the AST.
20043 :
20044 : // Initialize array to the address of the first element of the STL vector
20045 : // (which is guaranteed to be contiguous storage).
20046 : // SgTypeUnsignedLongLong objectArray [] = *(Memory_Block_List.begin());
20047 5668 : if (SgTypeUnsignedLongLong::pools.empty() == false)
20048 : {
20049 : // Generate an array of memory pools
20050 4892 : SgTypeUnsignedLongLong** objectArray = (SgTypeUnsignedLongLong**) &(SgTypeUnsignedLongLong::pools[0]);
20051 :
20052 : // Build a local variable for better performance
20053 4892 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
20054 : #if 0
20055 : // Iterate over the memory pools
20056 : for (unsigned int i=0; i < SgTypeUnsignedLongLong::pools.size(); i++)
20057 : {
20058 : // objectArray[i] is a single memory pool
20059 : for (int j=0; j < SgTypeUnsignedLongLong::pool_size; j++)
20060 : {
20061 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
20062 : {
20063 : traversal.visit(&(objectArray[i][j]));
20064 : }
20065 : }
20066 : }
20067 : #else
20068 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
20069 : // compute the list first and then call the visit function on each list element.
20070 :
20071 : // printf ("Inside of SgTypeUnsignedLongLong::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
20072 :
20073 9784 : std::vector<SgTypeUnsignedLongLong*> nodeList;
20074 :
20075 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
20076 9784 : for (unsigned int i=0; i < SgTypeUnsignedLongLong::pools.size(); i++)
20077 : {
20078 : // objectArray[i] is a single memory pool
20079 9788890 : for (unsigned j=0; j < SgTypeUnsignedLongLong::pool_size; j++)
20080 : {
20081 9784000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
20082 : {
20083 4892 : nodeList.push_back(&(objectArray[i][j]));
20084 : }
20085 : }
20086 : }
20087 :
20088 : // Iterate over the saved list
20089 4892 : size_t nodeListSize = nodeList.size();
20090 9784 : for (size_t i=0; i < nodeListSize; i++)
20091 : {
20092 4892 : ROSE_ASSERT(nodeList[i] != NULL);
20093 : #if 0
20094 : traversal.visit(nodeList[i]);
20095 : #else
20096 4892 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
20097 : {
20098 4892 : traversal.visit(nodeList[i]);
20099 : }
20100 : #endif
20101 : }
20102 : #endif
20103 : }
20104 :
20105 : // This should not be required since all previously static data members are
20106 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
20107 :
20108 5668 : }
20109 :
20110 :
20111 : void
20112 194 : SgTypeUnsignedLongLong::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
20113 : {
20114 : // This function traverses the memory pool for an IR node and
20115 : // calls the function to execute the visitor object.
20116 :
20117 : // Initialize array to the address of the first element of the STL vector
20118 : // (which is guarenteed to be contiguous storage).
20119 : // SgTypeUnsignedLongLong objectArray [] = *(Memory_Block_List.begin());
20120 194 : if (SgTypeUnsignedLongLong::pools.empty() == false)
20121 : {
20122 : // Generate an array of memory pools
20123 194 : SgTypeUnsignedLongLong** objectArray = (SgTypeUnsignedLongLong**) &(SgTypeUnsignedLongLong::pools[0]);
20124 :
20125 : // Build a local variable for better performance
20126 194 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
20127 :
20128 : // Iterate over the memory pools
20129 388 : for (unsigned int i=0; i < SgTypeUnsignedLongLong::pools.size(); i++)
20130 : {
20131 : // objectArray[i] is a single memory pool
20132 388194 : for (unsigned j=0; j < SgTypeUnsignedLongLong::pool_size; j++)
20133 : {
20134 388000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
20135 : {
20136 : // printf ("Found a valid SgTypeUnsignedLongLong object in the memory pool %d at position %d \n",i,j);
20137 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
20138 194 : objectArray[i][j].executeVisitorMemberFunction(visitor);
20139 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
20140 : }
20141 : else
20142 : {
20143 : // printf ("Found a INVALID SgTypeUnsignedLongLong object in the memory pool \n");
20144 : }
20145 : }
20146 : }
20147 : }
20148 :
20149 : // This should not be required since all previously static data members are
20150 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
20151 :
20152 194 : }
20153 :
20154 : void
20155 0 : SgTypeUnsignedLongLong::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
20156 : {
20157 : // This function visits only a single IR node of the memory pool.
20158 : // it is typically called once for each type of IR node within
20159 : // the automatically generated function: traverseRepresentativeNodes().
20160 :
20161 : // Initialize array to the address of the first element of the STL vector
20162 : // (which is guarenteed to be contiguous storage).
20163 : // SgTypeUnsignedLongLong objectArray [] = *(Memory_Block_List.begin());
20164 0 : if (SgTypeUnsignedLongLong::pools.empty() == false)
20165 : {
20166 : // Generate an array of memory pools
20167 0 : SgTypeUnsignedLongLong** objectArray = (SgTypeUnsignedLongLong**) &(SgTypeUnsignedLongLong::pools[0]);
20168 :
20169 : // Build a local variable for better performance
20170 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
20171 :
20172 : // Iterate over the memory pools
20173 0 : bool done = false;
20174 0 : unsigned i=0;
20175 :
20176 : // find the first valid IR node, call visit function, and then leave
20177 0 : while ( done == false && i < SgTypeUnsignedLongLong::pools.size() )
20178 : {
20179 : // objectArray[i] is a single memory pool
20180 : unsigned j=0;
20181 0 : while (done == false && j < SgTypeUnsignedLongLong::pool_size)
20182 : {
20183 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
20184 : {
20185 0 : traversal.visit(&(objectArray[i][j]));
20186 0 : done = true;
20187 : }
20188 0 : j++;
20189 : }
20190 0 : i++;
20191 : }
20192 :
20193 : #if 0
20194 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
20195 : if (done == false)
20196 : {
20197 : printf ("No representative for SgTypeUnsignedLongLong found in memory pools \n");
20198 : }
20199 : #endif
20200 : }
20201 0 : }
20202 :
20203 :
20204 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
20205 : // using values that overflow signed values of int.
20206 : size_t
20207 4 : SgTypeUnsignedLongLong::numberOfNodes()
20208 : {
20209 : // This function traverses the memory pool for an IR node and
20210 : // counts the number of IR nodes of a particular Sage III IR
20211 : // nodes type.
20212 :
20213 4 : size_t count = 0;
20214 4 : if (SgTypeUnsignedLongLong::pools.empty() == false)
20215 : {
20216 : // Generate an array of memory pools (this is actually a STL vector,
20217 : // but it is contiguious, so OK to treat this way).
20218 2 : SgTypeUnsignedLongLong** objectArray = (SgTypeUnsignedLongLong**) &(SgTypeUnsignedLongLong::pools[0]);
20219 :
20220 : // Build a local variable for better performance (make it a loop invariant variable).
20221 2 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
20222 :
20223 : // Iterate over all of the memory pools for this IR node.
20224 4 : for (unsigned int i=0; i < SgTypeUnsignedLongLong::pools.size(); i++)
20225 : {
20226 : // objectArray[i] is a single memory pool, iterate over all the
20227 : // IR nodes and only count those that are valid IR nodes used in
20228 : // the AST (i.e. allocated IR nodes).
20229 4002 : for (unsigned j=0; j < SgTypeUnsignedLongLong::pool_size; j++)
20230 : {
20231 : // This is indexing the STL vector of C/C++ style arrays as a doubly
20232 : // indexed array access. It is OK since we have leveraged the semantics
20233 : // of STL vector memory as contigous and cast the memory as an array
20234 : // of arrays to use the 2D array indexing. Hope this is not confusing,
20235 : // but it s very fast as an implementation.
20236 4000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
20237 : {
20238 2 : count++;
20239 : }
20240 : }
20241 : }
20242 : }
20243 :
20244 :
20245 :
20246 4 : return count;
20247 : }
20248 :
20249 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
20250 : // using values that overflow signed values of int.
20251 : size_t
20252 0 : SgTypeUnsignedLongLong::memoryUsage()
20253 : {
20254 : // This function is required because we need the class name as a type when we call sizeof
20255 : // There might be another way to implement this if we have a traversal that only called a
20256 : // representative object (one call for each type of Sage IIIIR node).
20257 0 : size_t memory = numberOfNodes() * sizeof(SgTypeUnsignedLongLong);
20258 :
20259 0 : return memory;
20260 : }
20261 :
20262 : /* #line 20263 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
20263 :
20264 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
20265 : void
20266 5668 : SgTypeSigned128bitInteger::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
20267 : {
20268 : // This function traverses the memory pool for only a specific IR node
20269 : // and calls the visit function of the input class execute a traversal
20270 : // similar to the style of the attribute based traversals within ROSE.
20271 : // This traversal will visit ALL nodes of the AST where as the other
20272 : // attribute based traversals visit only the embedded tree within the AST.
20273 :
20274 : // Initialize array to the address of the first element of the STL vector
20275 : // (which is guaranteed to be contiguous storage).
20276 : // SgTypeSigned128bitInteger objectArray [] = *(Memory_Block_List.begin());
20277 5668 : if (SgTypeSigned128bitInteger::pools.empty() == false)
20278 : {
20279 : // Generate an array of memory pools
20280 876 : SgTypeSigned128bitInteger** objectArray = (SgTypeSigned128bitInteger**) &(SgTypeSigned128bitInteger::pools[0]);
20281 :
20282 : // Build a local variable for better performance
20283 876 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
20284 : #if 0
20285 : // Iterate over the memory pools
20286 : for (unsigned int i=0; i < SgTypeSigned128bitInteger::pools.size(); i++)
20287 : {
20288 : // objectArray[i] is a single memory pool
20289 : for (int j=0; j < SgTypeSigned128bitInteger::pool_size; j++)
20290 : {
20291 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
20292 : {
20293 : traversal.visit(&(objectArray[i][j]));
20294 : }
20295 : }
20296 : }
20297 : #else
20298 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
20299 : // compute the list first and then call the visit function on each list element.
20300 :
20301 : // printf ("Inside of SgTypeSigned128bitInteger::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
20302 :
20303 1752 : std::vector<SgTypeSigned128bitInteger*> nodeList;
20304 :
20305 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
20306 1752 : for (unsigned int i=0; i < SgTypeSigned128bitInteger::pools.size(); i++)
20307 : {
20308 : // objectArray[i] is a single memory pool
20309 1752880 : for (unsigned j=0; j < SgTypeSigned128bitInteger::pool_size; j++)
20310 : {
20311 1752000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
20312 : {
20313 876 : nodeList.push_back(&(objectArray[i][j]));
20314 : }
20315 : }
20316 : }
20317 :
20318 : // Iterate over the saved list
20319 876 : size_t nodeListSize = nodeList.size();
20320 1752 : for (size_t i=0; i < nodeListSize; i++)
20321 : {
20322 876 : ROSE_ASSERT(nodeList[i] != NULL);
20323 : #if 0
20324 : traversal.visit(nodeList[i]);
20325 : #else
20326 876 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
20327 : {
20328 876 : traversal.visit(nodeList[i]);
20329 : }
20330 : #endif
20331 : }
20332 : #endif
20333 : }
20334 :
20335 : // This should not be required since all previously static data members are
20336 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
20337 :
20338 5668 : }
20339 :
20340 :
20341 : void
20342 194 : SgTypeSigned128bitInteger::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
20343 : {
20344 : // This function traverses the memory pool for an IR node and
20345 : // calls the function to execute the visitor object.
20346 :
20347 : // Initialize array to the address of the first element of the STL vector
20348 : // (which is guarenteed to be contiguous storage).
20349 : // SgTypeSigned128bitInteger objectArray [] = *(Memory_Block_List.begin());
20350 194 : if (SgTypeSigned128bitInteger::pools.empty() == false)
20351 : {
20352 : // Generate an array of memory pools
20353 194 : SgTypeSigned128bitInteger** objectArray = (SgTypeSigned128bitInteger**) &(SgTypeSigned128bitInteger::pools[0]);
20354 :
20355 : // Build a local variable for better performance
20356 194 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
20357 :
20358 : // Iterate over the memory pools
20359 388 : for (unsigned int i=0; i < SgTypeSigned128bitInteger::pools.size(); i++)
20360 : {
20361 : // objectArray[i] is a single memory pool
20362 388194 : for (unsigned j=0; j < SgTypeSigned128bitInteger::pool_size; j++)
20363 : {
20364 388000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
20365 : {
20366 : // printf ("Found a valid SgTypeSigned128bitInteger object in the memory pool %d at position %d \n",i,j);
20367 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
20368 194 : objectArray[i][j].executeVisitorMemberFunction(visitor);
20369 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
20370 : }
20371 : else
20372 : {
20373 : // printf ("Found a INVALID SgTypeSigned128bitInteger object in the memory pool \n");
20374 : }
20375 : }
20376 : }
20377 : }
20378 :
20379 : // This should not be required since all previously static data members are
20380 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
20381 :
20382 194 : }
20383 :
20384 : void
20385 0 : SgTypeSigned128bitInteger::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
20386 : {
20387 : // This function visits only a single IR node of the memory pool.
20388 : // it is typically called once for each type of IR node within
20389 : // the automatically generated function: traverseRepresentativeNodes().
20390 :
20391 : // Initialize array to the address of the first element of the STL vector
20392 : // (which is guarenteed to be contiguous storage).
20393 : // SgTypeSigned128bitInteger objectArray [] = *(Memory_Block_List.begin());
20394 0 : if (SgTypeSigned128bitInteger::pools.empty() == false)
20395 : {
20396 : // Generate an array of memory pools
20397 0 : SgTypeSigned128bitInteger** objectArray = (SgTypeSigned128bitInteger**) &(SgTypeSigned128bitInteger::pools[0]);
20398 :
20399 : // Build a local variable for better performance
20400 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
20401 :
20402 : // Iterate over the memory pools
20403 0 : bool done = false;
20404 0 : unsigned i=0;
20405 :
20406 : // find the first valid IR node, call visit function, and then leave
20407 0 : while ( done == false && i < SgTypeSigned128bitInteger::pools.size() )
20408 : {
20409 : // objectArray[i] is a single memory pool
20410 : unsigned j=0;
20411 0 : while (done == false && j < SgTypeSigned128bitInteger::pool_size)
20412 : {
20413 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
20414 : {
20415 0 : traversal.visit(&(objectArray[i][j]));
20416 0 : done = true;
20417 : }
20418 0 : j++;
20419 : }
20420 0 : i++;
20421 : }
20422 :
20423 : #if 0
20424 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
20425 : if (done == false)
20426 : {
20427 : printf ("No representative for SgTypeSigned128bitInteger found in memory pools \n");
20428 : }
20429 : #endif
20430 : }
20431 0 : }
20432 :
20433 :
20434 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
20435 : // using values that overflow signed values of int.
20436 : size_t
20437 4 : SgTypeSigned128bitInteger::numberOfNodes()
20438 : {
20439 : // This function traverses the memory pool for an IR node and
20440 : // counts the number of IR nodes of a particular Sage III IR
20441 : // nodes type.
20442 :
20443 4 : size_t count = 0;
20444 4 : if (SgTypeSigned128bitInteger::pools.empty() == false)
20445 : {
20446 : // Generate an array of memory pools (this is actually a STL vector,
20447 : // but it is contiguious, so OK to treat this way).
20448 1 : SgTypeSigned128bitInteger** objectArray = (SgTypeSigned128bitInteger**) &(SgTypeSigned128bitInteger::pools[0]);
20449 :
20450 : // Build a local variable for better performance (make it a loop invariant variable).
20451 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
20452 :
20453 : // Iterate over all of the memory pools for this IR node.
20454 2 : for (unsigned int i=0; i < SgTypeSigned128bitInteger::pools.size(); i++)
20455 : {
20456 : // objectArray[i] is a single memory pool, iterate over all the
20457 : // IR nodes and only count those that are valid IR nodes used in
20458 : // the AST (i.e. allocated IR nodes).
20459 2001 : for (unsigned j=0; j < SgTypeSigned128bitInteger::pool_size; j++)
20460 : {
20461 : // This is indexing the STL vector of C/C++ style arrays as a doubly
20462 : // indexed array access. It is OK since we have leveraged the semantics
20463 : // of STL vector memory as contigous and cast the memory as an array
20464 : // of arrays to use the 2D array indexing. Hope this is not confusing,
20465 : // but it s very fast as an implementation.
20466 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
20467 : {
20468 1 : count++;
20469 : }
20470 : }
20471 : }
20472 : }
20473 :
20474 :
20475 :
20476 4 : return count;
20477 : }
20478 :
20479 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
20480 : // using values that overflow signed values of int.
20481 : size_t
20482 0 : SgTypeSigned128bitInteger::memoryUsage()
20483 : {
20484 : // This function is required because we need the class name as a type when we call sizeof
20485 : // There might be another way to implement this if we have a traversal that only called a
20486 : // representative object (one call for each type of Sage IIIIR node).
20487 0 : size_t memory = numberOfNodes() * sizeof(SgTypeSigned128bitInteger);
20488 :
20489 0 : return memory;
20490 : }
20491 :
20492 : /* #line 20493 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
20493 :
20494 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
20495 : void
20496 5668 : SgTypeUnsigned128bitInteger::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
20497 : {
20498 : // This function traverses the memory pool for only a specific IR node
20499 : // and calls the visit function of the input class execute a traversal
20500 : // similar to the style of the attribute based traversals within ROSE.
20501 : // This traversal will visit ALL nodes of the AST where as the other
20502 : // attribute based traversals visit only the embedded tree within the AST.
20503 :
20504 : // Initialize array to the address of the first element of the STL vector
20505 : // (which is guaranteed to be contiguous storage).
20506 : // SgTypeUnsigned128bitInteger objectArray [] = *(Memory_Block_List.begin());
20507 5668 : if (SgTypeUnsigned128bitInteger::pools.empty() == false)
20508 : {
20509 : // Generate an array of memory pools
20510 145 : SgTypeUnsigned128bitInteger** objectArray = (SgTypeUnsigned128bitInteger**) &(SgTypeUnsigned128bitInteger::pools[0]);
20511 :
20512 : // Build a local variable for better performance
20513 145 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
20514 : #if 0
20515 : // Iterate over the memory pools
20516 : for (unsigned int i=0; i < SgTypeUnsigned128bitInteger::pools.size(); i++)
20517 : {
20518 : // objectArray[i] is a single memory pool
20519 : for (int j=0; j < SgTypeUnsigned128bitInteger::pool_size; j++)
20520 : {
20521 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
20522 : {
20523 : traversal.visit(&(objectArray[i][j]));
20524 : }
20525 : }
20526 : }
20527 : #else
20528 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
20529 : // compute the list first and then call the visit function on each list element.
20530 :
20531 : // printf ("Inside of SgTypeUnsigned128bitInteger::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
20532 :
20533 290 : std::vector<SgTypeUnsigned128bitInteger*> nodeList;
20534 :
20535 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
20536 290 : for (unsigned int i=0; i < SgTypeUnsigned128bitInteger::pools.size(); i++)
20537 : {
20538 : // objectArray[i] is a single memory pool
20539 290145 : for (unsigned j=0; j < SgTypeUnsigned128bitInteger::pool_size; j++)
20540 : {
20541 290000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
20542 : {
20543 145 : nodeList.push_back(&(objectArray[i][j]));
20544 : }
20545 : }
20546 : }
20547 :
20548 : // Iterate over the saved list
20549 145 : size_t nodeListSize = nodeList.size();
20550 290 : for (size_t i=0; i < nodeListSize; i++)
20551 : {
20552 145 : ROSE_ASSERT(nodeList[i] != NULL);
20553 : #if 0
20554 : traversal.visit(nodeList[i]);
20555 : #else
20556 145 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
20557 : {
20558 145 : traversal.visit(nodeList[i]);
20559 : }
20560 : #endif
20561 : }
20562 : #endif
20563 : }
20564 :
20565 : // This should not be required since all previously static data members are
20566 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
20567 :
20568 5668 : }
20569 :
20570 :
20571 : void
20572 194 : SgTypeUnsigned128bitInteger::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
20573 : {
20574 : // This function traverses the memory pool for an IR node and
20575 : // calls the function to execute the visitor object.
20576 :
20577 : // Initialize array to the address of the first element of the STL vector
20578 : // (which is guarenteed to be contiguous storage).
20579 : // SgTypeUnsigned128bitInteger objectArray [] = *(Memory_Block_List.begin());
20580 194 : if (SgTypeUnsigned128bitInteger::pools.empty() == false)
20581 : {
20582 : // Generate an array of memory pools
20583 137 : SgTypeUnsigned128bitInteger** objectArray = (SgTypeUnsigned128bitInteger**) &(SgTypeUnsigned128bitInteger::pools[0]);
20584 :
20585 : // Build a local variable for better performance
20586 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
20587 :
20588 : // Iterate over the memory pools
20589 274 : for (unsigned int i=0; i < SgTypeUnsigned128bitInteger::pools.size(); i++)
20590 : {
20591 : // objectArray[i] is a single memory pool
20592 274137 : for (unsigned j=0; j < SgTypeUnsigned128bitInteger::pool_size; j++)
20593 : {
20594 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
20595 : {
20596 : // printf ("Found a valid SgTypeUnsigned128bitInteger object in the memory pool %d at position %d \n",i,j);
20597 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
20598 137 : objectArray[i][j].executeVisitorMemberFunction(visitor);
20599 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
20600 : }
20601 : else
20602 : {
20603 : // printf ("Found a INVALID SgTypeUnsigned128bitInteger object in the memory pool \n");
20604 : }
20605 : }
20606 : }
20607 : }
20608 :
20609 : // This should not be required since all previously static data members are
20610 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
20611 :
20612 194 : }
20613 :
20614 : void
20615 0 : SgTypeUnsigned128bitInteger::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
20616 : {
20617 : // This function visits only a single IR node of the memory pool.
20618 : // it is typically called once for each type of IR node within
20619 : // the automatically generated function: traverseRepresentativeNodes().
20620 :
20621 : // Initialize array to the address of the first element of the STL vector
20622 : // (which is guarenteed to be contiguous storage).
20623 : // SgTypeUnsigned128bitInteger objectArray [] = *(Memory_Block_List.begin());
20624 0 : if (SgTypeUnsigned128bitInteger::pools.empty() == false)
20625 : {
20626 : // Generate an array of memory pools
20627 0 : SgTypeUnsigned128bitInteger** objectArray = (SgTypeUnsigned128bitInteger**) &(SgTypeUnsigned128bitInteger::pools[0]);
20628 :
20629 : // Build a local variable for better performance
20630 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
20631 :
20632 : // Iterate over the memory pools
20633 0 : bool done = false;
20634 0 : unsigned i=0;
20635 :
20636 : // find the first valid IR node, call visit function, and then leave
20637 0 : while ( done == false && i < SgTypeUnsigned128bitInteger::pools.size() )
20638 : {
20639 : // objectArray[i] is a single memory pool
20640 : unsigned j=0;
20641 0 : while (done == false && j < SgTypeUnsigned128bitInteger::pool_size)
20642 : {
20643 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
20644 : {
20645 0 : traversal.visit(&(objectArray[i][j]));
20646 0 : done = true;
20647 : }
20648 0 : j++;
20649 : }
20650 0 : i++;
20651 : }
20652 :
20653 : #if 0
20654 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
20655 : if (done == false)
20656 : {
20657 : printf ("No representative for SgTypeUnsigned128bitInteger found in memory pools \n");
20658 : }
20659 : #endif
20660 : }
20661 0 : }
20662 :
20663 :
20664 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
20665 : // using values that overflow signed values of int.
20666 : size_t
20667 4 : SgTypeUnsigned128bitInteger::numberOfNodes()
20668 : {
20669 : // This function traverses the memory pool for an IR node and
20670 : // counts the number of IR nodes of a particular Sage III IR
20671 : // nodes type.
20672 :
20673 4 : size_t count = 0;
20674 4 : if (SgTypeUnsigned128bitInteger::pools.empty() == false)
20675 : {
20676 : // Generate an array of memory pools (this is actually a STL vector,
20677 : // but it is contiguious, so OK to treat this way).
20678 1 : SgTypeUnsigned128bitInteger** objectArray = (SgTypeUnsigned128bitInteger**) &(SgTypeUnsigned128bitInteger::pools[0]);
20679 :
20680 : // Build a local variable for better performance (make it a loop invariant variable).
20681 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
20682 :
20683 : // Iterate over all of the memory pools for this IR node.
20684 2 : for (unsigned int i=0; i < SgTypeUnsigned128bitInteger::pools.size(); i++)
20685 : {
20686 : // objectArray[i] is a single memory pool, iterate over all the
20687 : // IR nodes and only count those that are valid IR nodes used in
20688 : // the AST (i.e. allocated IR nodes).
20689 2001 : for (unsigned j=0; j < SgTypeUnsigned128bitInteger::pool_size; j++)
20690 : {
20691 : // This is indexing the STL vector of C/C++ style arrays as a doubly
20692 : // indexed array access. It is OK since we have leveraged the semantics
20693 : // of STL vector memory as contigous and cast the memory as an array
20694 : // of arrays to use the 2D array indexing. Hope this is not confusing,
20695 : // but it s very fast as an implementation.
20696 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
20697 : {
20698 1 : count++;
20699 : }
20700 : }
20701 : }
20702 : }
20703 :
20704 :
20705 :
20706 4 : return count;
20707 : }
20708 :
20709 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
20710 : // using values that overflow signed values of int.
20711 : size_t
20712 0 : SgTypeUnsigned128bitInteger::memoryUsage()
20713 : {
20714 : // This function is required because we need the class name as a type when we call sizeof
20715 : // There might be another way to implement this if we have a traversal that only called a
20716 : // representative object (one call for each type of Sage IIIIR node).
20717 0 : size_t memory = numberOfNodes() * sizeof(SgTypeUnsigned128bitInteger);
20718 :
20719 0 : return memory;
20720 : }
20721 :
20722 : /* #line 20723 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
20723 :
20724 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
20725 : void
20726 5668 : SgTypeFloat80::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
20727 : {
20728 : // This function traverses the memory pool for only a specific IR node
20729 : // and calls the visit function of the input class execute a traversal
20730 : // similar to the style of the attribute based traversals within ROSE.
20731 : // This traversal will visit ALL nodes of the AST where as the other
20732 : // attribute based traversals visit only the embedded tree within the AST.
20733 :
20734 : // Initialize array to the address of the first element of the STL vector
20735 : // (which is guaranteed to be contiguous storage).
20736 : // SgTypeFloat80 objectArray [] = *(Memory_Block_List.begin());
20737 5668 : if (SgTypeFloat80::pools.empty() == false)
20738 : {
20739 : // Generate an array of memory pools
20740 0 : SgTypeFloat80** objectArray = (SgTypeFloat80**) &(SgTypeFloat80::pools[0]);
20741 :
20742 : // Build a local variable for better performance
20743 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
20744 : #if 0
20745 : // Iterate over the memory pools
20746 : for (unsigned int i=0; i < SgTypeFloat80::pools.size(); i++)
20747 : {
20748 : // objectArray[i] is a single memory pool
20749 : for (int j=0; j < SgTypeFloat80::pool_size; j++)
20750 : {
20751 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
20752 : {
20753 : traversal.visit(&(objectArray[i][j]));
20754 : }
20755 : }
20756 : }
20757 : #else
20758 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
20759 : // compute the list first and then call the visit function on each list element.
20760 :
20761 : // printf ("Inside of SgTypeFloat80::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
20762 :
20763 0 : std::vector<SgTypeFloat80*> nodeList;
20764 :
20765 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
20766 0 : for (unsigned int i=0; i < SgTypeFloat80::pools.size(); i++)
20767 : {
20768 : // objectArray[i] is a single memory pool
20769 0 : for (unsigned j=0; j < SgTypeFloat80::pool_size; j++)
20770 : {
20771 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
20772 : {
20773 0 : nodeList.push_back(&(objectArray[i][j]));
20774 : }
20775 : }
20776 : }
20777 :
20778 : // Iterate over the saved list
20779 0 : size_t nodeListSize = nodeList.size();
20780 0 : for (size_t i=0; i < nodeListSize; i++)
20781 : {
20782 0 : ROSE_ASSERT(nodeList[i] != NULL);
20783 : #if 0
20784 : traversal.visit(nodeList[i]);
20785 : #else
20786 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
20787 : {
20788 0 : traversal.visit(nodeList[i]);
20789 : }
20790 : #endif
20791 : }
20792 : #endif
20793 : }
20794 :
20795 : // This should not be required since all previously static data members are
20796 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
20797 :
20798 5668 : }
20799 :
20800 :
20801 : void
20802 194 : SgTypeFloat80::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
20803 : {
20804 : // This function traverses the memory pool for an IR node and
20805 : // calls the function to execute the visitor object.
20806 :
20807 : // Initialize array to the address of the first element of the STL vector
20808 : // (which is guarenteed to be contiguous storage).
20809 : // SgTypeFloat80 objectArray [] = *(Memory_Block_List.begin());
20810 194 : if (SgTypeFloat80::pools.empty() == false)
20811 : {
20812 : // Generate an array of memory pools
20813 0 : SgTypeFloat80** objectArray = (SgTypeFloat80**) &(SgTypeFloat80::pools[0]);
20814 :
20815 : // Build a local variable for better performance
20816 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
20817 :
20818 : // Iterate over the memory pools
20819 0 : for (unsigned int i=0; i < SgTypeFloat80::pools.size(); i++)
20820 : {
20821 : // objectArray[i] is a single memory pool
20822 0 : for (unsigned j=0; j < SgTypeFloat80::pool_size; j++)
20823 : {
20824 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
20825 : {
20826 : // printf ("Found a valid SgTypeFloat80 object in the memory pool %d at position %d \n",i,j);
20827 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
20828 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
20829 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
20830 : }
20831 : else
20832 : {
20833 : // printf ("Found a INVALID SgTypeFloat80 object in the memory pool \n");
20834 : }
20835 : }
20836 : }
20837 : }
20838 :
20839 : // This should not be required since all previously static data members are
20840 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
20841 :
20842 194 : }
20843 :
20844 : void
20845 0 : SgTypeFloat80::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
20846 : {
20847 : // This function visits only a single IR node of the memory pool.
20848 : // it is typically called once for each type of IR node within
20849 : // the automatically generated function: traverseRepresentativeNodes().
20850 :
20851 : // Initialize array to the address of the first element of the STL vector
20852 : // (which is guarenteed to be contiguous storage).
20853 : // SgTypeFloat80 objectArray [] = *(Memory_Block_List.begin());
20854 0 : if (SgTypeFloat80::pools.empty() == false)
20855 : {
20856 : // Generate an array of memory pools
20857 0 : SgTypeFloat80** objectArray = (SgTypeFloat80**) &(SgTypeFloat80::pools[0]);
20858 :
20859 : // Build a local variable for better performance
20860 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
20861 :
20862 : // Iterate over the memory pools
20863 0 : bool done = false;
20864 0 : unsigned i=0;
20865 :
20866 : // find the first valid IR node, call visit function, and then leave
20867 0 : while ( done == false && i < SgTypeFloat80::pools.size() )
20868 : {
20869 : // objectArray[i] is a single memory pool
20870 : unsigned j=0;
20871 0 : while (done == false && j < SgTypeFloat80::pool_size)
20872 : {
20873 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
20874 : {
20875 0 : traversal.visit(&(objectArray[i][j]));
20876 0 : done = true;
20877 : }
20878 0 : j++;
20879 : }
20880 0 : i++;
20881 : }
20882 :
20883 : #if 0
20884 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
20885 : if (done == false)
20886 : {
20887 : printf ("No representative for SgTypeFloat80 found in memory pools \n");
20888 : }
20889 : #endif
20890 : }
20891 0 : }
20892 :
20893 :
20894 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
20895 : // using values that overflow signed values of int.
20896 : size_t
20897 4 : SgTypeFloat80::numberOfNodes()
20898 : {
20899 : // This function traverses the memory pool for an IR node and
20900 : // counts the number of IR nodes of a particular Sage III IR
20901 : // nodes type.
20902 :
20903 4 : size_t count = 0;
20904 4 : if (SgTypeFloat80::pools.empty() == false)
20905 : {
20906 : // Generate an array of memory pools (this is actually a STL vector,
20907 : // but it is contiguious, so OK to treat this way).
20908 0 : SgTypeFloat80** objectArray = (SgTypeFloat80**) &(SgTypeFloat80::pools[0]);
20909 :
20910 : // Build a local variable for better performance (make it a loop invariant variable).
20911 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
20912 :
20913 : // Iterate over all of the memory pools for this IR node.
20914 0 : for (unsigned int i=0; i < SgTypeFloat80::pools.size(); i++)
20915 : {
20916 : // objectArray[i] is a single memory pool, iterate over all the
20917 : // IR nodes and only count those that are valid IR nodes used in
20918 : // the AST (i.e. allocated IR nodes).
20919 0 : for (unsigned j=0; j < SgTypeFloat80::pool_size; j++)
20920 : {
20921 : // This is indexing the STL vector of C/C++ style arrays as a doubly
20922 : // indexed array access. It is OK since we have leveraged the semantics
20923 : // of STL vector memory as contigous and cast the memory as an array
20924 : // of arrays to use the 2D array indexing. Hope this is not confusing,
20925 : // but it s very fast as an implementation.
20926 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
20927 : {
20928 0 : count++;
20929 : }
20930 : }
20931 : }
20932 : }
20933 :
20934 :
20935 :
20936 4 : return count;
20937 : }
20938 :
20939 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
20940 : // using values that overflow signed values of int.
20941 : size_t
20942 0 : SgTypeFloat80::memoryUsage()
20943 : {
20944 : // This function is required because we need the class name as a type when we call sizeof
20945 : // There might be another way to implement this if we have a traversal that only called a
20946 : // representative object (one call for each type of Sage IIIIR node).
20947 0 : size_t memory = numberOfNodes() * sizeof(SgTypeFloat80);
20948 :
20949 0 : return memory;
20950 : }
20951 :
20952 : /* #line 20953 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
20953 :
20954 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
20955 : void
20956 5668 : SgTypeLongDouble::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
20957 : {
20958 : // This function traverses the memory pool for only a specific IR node
20959 : // and calls the visit function of the input class execute a traversal
20960 : // similar to the style of the attribute based traversals within ROSE.
20961 : // This traversal will visit ALL nodes of the AST where as the other
20962 : // attribute based traversals visit only the embedded tree within the AST.
20963 :
20964 : // Initialize array to the address of the first element of the STL vector
20965 : // (which is guaranteed to be contiguous storage).
20966 : // SgTypeLongDouble objectArray [] = *(Memory_Block_List.begin());
20967 5668 : if (SgTypeLongDouble::pools.empty() == false)
20968 : {
20969 : // Generate an array of memory pools
20970 4892 : SgTypeLongDouble** objectArray = (SgTypeLongDouble**) &(SgTypeLongDouble::pools[0]);
20971 :
20972 : // Build a local variable for better performance
20973 4892 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
20974 : #if 0
20975 : // Iterate over the memory pools
20976 : for (unsigned int i=0; i < SgTypeLongDouble::pools.size(); i++)
20977 : {
20978 : // objectArray[i] is a single memory pool
20979 : for (int j=0; j < SgTypeLongDouble::pool_size; j++)
20980 : {
20981 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
20982 : {
20983 : traversal.visit(&(objectArray[i][j]));
20984 : }
20985 : }
20986 : }
20987 : #else
20988 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
20989 : // compute the list first and then call the visit function on each list element.
20990 :
20991 : // printf ("Inside of SgTypeLongDouble::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
20992 :
20993 9784 : std::vector<SgTypeLongDouble*> nodeList;
20994 :
20995 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
20996 9784 : for (unsigned int i=0; i < SgTypeLongDouble::pools.size(); i++)
20997 : {
20998 : // objectArray[i] is a single memory pool
20999 9788890 : for (unsigned j=0; j < SgTypeLongDouble::pool_size; j++)
21000 : {
21001 9784000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
21002 : {
21003 4892 : nodeList.push_back(&(objectArray[i][j]));
21004 : }
21005 : }
21006 : }
21007 :
21008 : // Iterate over the saved list
21009 4892 : size_t nodeListSize = nodeList.size();
21010 9784 : for (size_t i=0; i < nodeListSize; i++)
21011 : {
21012 4892 : ROSE_ASSERT(nodeList[i] != NULL);
21013 : #if 0
21014 : traversal.visit(nodeList[i]);
21015 : #else
21016 4892 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
21017 : {
21018 4892 : traversal.visit(nodeList[i]);
21019 : }
21020 : #endif
21021 : }
21022 : #endif
21023 : }
21024 :
21025 : // This should not be required since all previously static data members are
21026 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
21027 :
21028 5668 : }
21029 :
21030 :
21031 : void
21032 194 : SgTypeLongDouble::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
21033 : {
21034 : // This function traverses the memory pool for an IR node and
21035 : // calls the function to execute the visitor object.
21036 :
21037 : // Initialize array to the address of the first element of the STL vector
21038 : // (which is guarenteed to be contiguous storage).
21039 : // SgTypeLongDouble objectArray [] = *(Memory_Block_List.begin());
21040 194 : if (SgTypeLongDouble::pools.empty() == false)
21041 : {
21042 : // Generate an array of memory pools
21043 194 : SgTypeLongDouble** objectArray = (SgTypeLongDouble**) &(SgTypeLongDouble::pools[0]);
21044 :
21045 : // Build a local variable for better performance
21046 194 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
21047 :
21048 : // Iterate over the memory pools
21049 388 : for (unsigned int i=0; i < SgTypeLongDouble::pools.size(); i++)
21050 : {
21051 : // objectArray[i] is a single memory pool
21052 388194 : for (unsigned j=0; j < SgTypeLongDouble::pool_size; j++)
21053 : {
21054 388000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
21055 : {
21056 : // printf ("Found a valid SgTypeLongDouble object in the memory pool %d at position %d \n",i,j);
21057 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
21058 194 : objectArray[i][j].executeVisitorMemberFunction(visitor);
21059 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
21060 : }
21061 : else
21062 : {
21063 : // printf ("Found a INVALID SgTypeLongDouble object in the memory pool \n");
21064 : }
21065 : }
21066 : }
21067 : }
21068 :
21069 : // This should not be required since all previously static data members are
21070 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
21071 :
21072 194 : }
21073 :
21074 : void
21075 0 : SgTypeLongDouble::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
21076 : {
21077 : // This function visits only a single IR node of the memory pool.
21078 : // it is typically called once for each type of IR node within
21079 : // the automatically generated function: traverseRepresentativeNodes().
21080 :
21081 : // Initialize array to the address of the first element of the STL vector
21082 : // (which is guarenteed to be contiguous storage).
21083 : // SgTypeLongDouble objectArray [] = *(Memory_Block_List.begin());
21084 0 : if (SgTypeLongDouble::pools.empty() == false)
21085 : {
21086 : // Generate an array of memory pools
21087 0 : SgTypeLongDouble** objectArray = (SgTypeLongDouble**) &(SgTypeLongDouble::pools[0]);
21088 :
21089 : // Build a local variable for better performance
21090 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
21091 :
21092 : // Iterate over the memory pools
21093 0 : bool done = false;
21094 0 : unsigned i=0;
21095 :
21096 : // find the first valid IR node, call visit function, and then leave
21097 0 : while ( done == false && i < SgTypeLongDouble::pools.size() )
21098 : {
21099 : // objectArray[i] is a single memory pool
21100 : unsigned j=0;
21101 0 : while (done == false && j < SgTypeLongDouble::pool_size)
21102 : {
21103 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
21104 : {
21105 0 : traversal.visit(&(objectArray[i][j]));
21106 0 : done = true;
21107 : }
21108 0 : j++;
21109 : }
21110 0 : i++;
21111 : }
21112 :
21113 : #if 0
21114 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
21115 : if (done == false)
21116 : {
21117 : printf ("No representative for SgTypeLongDouble found in memory pools \n");
21118 : }
21119 : #endif
21120 : }
21121 0 : }
21122 :
21123 :
21124 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
21125 : // using values that overflow signed values of int.
21126 : size_t
21127 4 : SgTypeLongDouble::numberOfNodes()
21128 : {
21129 : // This function traverses the memory pool for an IR node and
21130 : // counts the number of IR nodes of a particular Sage III IR
21131 : // nodes type.
21132 :
21133 4 : size_t count = 0;
21134 4 : if (SgTypeLongDouble::pools.empty() == false)
21135 : {
21136 : // Generate an array of memory pools (this is actually a STL vector,
21137 : // but it is contiguious, so OK to treat this way).
21138 2 : SgTypeLongDouble** objectArray = (SgTypeLongDouble**) &(SgTypeLongDouble::pools[0]);
21139 :
21140 : // Build a local variable for better performance (make it a loop invariant variable).
21141 2 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
21142 :
21143 : // Iterate over all of the memory pools for this IR node.
21144 4 : for (unsigned int i=0; i < SgTypeLongDouble::pools.size(); i++)
21145 : {
21146 : // objectArray[i] is a single memory pool, iterate over all the
21147 : // IR nodes and only count those that are valid IR nodes used in
21148 : // the AST (i.e. allocated IR nodes).
21149 4002 : for (unsigned j=0; j < SgTypeLongDouble::pool_size; j++)
21150 : {
21151 : // This is indexing the STL vector of C/C++ style arrays as a doubly
21152 : // indexed array access. It is OK since we have leveraged the semantics
21153 : // of STL vector memory as contigous and cast the memory as an array
21154 : // of arrays to use the 2D array indexing. Hope this is not confusing,
21155 : // but it s very fast as an implementation.
21156 4000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
21157 : {
21158 2 : count++;
21159 : }
21160 : }
21161 : }
21162 : }
21163 :
21164 :
21165 :
21166 4 : return count;
21167 : }
21168 :
21169 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
21170 : // using values that overflow signed values of int.
21171 : size_t
21172 0 : SgTypeLongDouble::memoryUsage()
21173 : {
21174 : // This function is required because we need the class name as a type when we call sizeof
21175 : // There might be another way to implement this if we have a traversal that only called a
21176 : // representative object (one call for each type of Sage IIIIR node).
21177 0 : size_t memory = numberOfNodes() * sizeof(SgTypeLongDouble);
21178 :
21179 0 : return memory;
21180 : }
21181 :
21182 : /* #line 21183 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
21183 :
21184 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
21185 : void
21186 5668 : SgTypeString::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
21187 : {
21188 : // This function traverses the memory pool for only a specific IR node
21189 : // and calls the visit function of the input class execute a traversal
21190 : // similar to the style of the attribute based traversals within ROSE.
21191 : // This traversal will visit ALL nodes of the AST where as the other
21192 : // attribute based traversals visit only the embedded tree within the AST.
21193 :
21194 : // Initialize array to the address of the first element of the STL vector
21195 : // (which is guaranteed to be contiguous storage).
21196 : // SgTypeString objectArray [] = *(Memory_Block_List.begin());
21197 5668 : if (SgTypeString::pools.empty() == false)
21198 : {
21199 : // Generate an array of memory pools
21200 25 : SgTypeString** objectArray = (SgTypeString**) &(SgTypeString::pools[0]);
21201 :
21202 : // Build a local variable for better performance
21203 25 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
21204 : #if 0
21205 : // Iterate over the memory pools
21206 : for (unsigned int i=0; i < SgTypeString::pools.size(); i++)
21207 : {
21208 : // objectArray[i] is a single memory pool
21209 : for (int j=0; j < SgTypeString::pool_size; j++)
21210 : {
21211 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
21212 : {
21213 : traversal.visit(&(objectArray[i][j]));
21214 : }
21215 : }
21216 : }
21217 : #else
21218 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
21219 : // compute the list first and then call the visit function on each list element.
21220 :
21221 : // printf ("Inside of SgTypeString::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
21222 :
21223 50 : std::vector<SgTypeString*> nodeList;
21224 :
21225 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
21226 50 : for (unsigned int i=0; i < SgTypeString::pools.size(); i++)
21227 : {
21228 : // objectArray[i] is a single memory pool
21229 50025 : for (unsigned j=0; j < SgTypeString::pool_size; j++)
21230 : {
21231 50000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
21232 : {
21233 192 : nodeList.push_back(&(objectArray[i][j]));
21234 : }
21235 : }
21236 : }
21237 :
21238 : // Iterate over the saved list
21239 25 : size_t nodeListSize = nodeList.size();
21240 217 : for (size_t i=0; i < nodeListSize; i++)
21241 : {
21242 192 : ROSE_ASSERT(nodeList[i] != NULL);
21243 : #if 0
21244 : traversal.visit(nodeList[i]);
21245 : #else
21246 192 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
21247 : {
21248 192 : traversal.visit(nodeList[i]);
21249 : }
21250 : #endif
21251 : }
21252 : #endif
21253 : }
21254 :
21255 : // This should not be required since all previously static data members are
21256 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
21257 :
21258 5668 : }
21259 :
21260 :
21261 : void
21262 194 : SgTypeString::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
21263 : {
21264 : // This function traverses the memory pool for an IR node and
21265 : // calls the function to execute the visitor object.
21266 :
21267 : // Initialize array to the address of the first element of the STL vector
21268 : // (which is guarenteed to be contiguous storage).
21269 : // SgTypeString objectArray [] = *(Memory_Block_List.begin());
21270 194 : if (SgTypeString::pools.empty() == false)
21271 : {
21272 : // Generate an array of memory pools
21273 1 : SgTypeString** objectArray = (SgTypeString**) &(SgTypeString::pools[0]);
21274 :
21275 : // Build a local variable for better performance
21276 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
21277 :
21278 : // Iterate over the memory pools
21279 2 : for (unsigned int i=0; i < SgTypeString::pools.size(); i++)
21280 : {
21281 : // objectArray[i] is a single memory pool
21282 2001 : for (unsigned j=0; j < SgTypeString::pool_size; j++)
21283 : {
21284 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
21285 : {
21286 : // printf ("Found a valid SgTypeString object in the memory pool %d at position %d \n",i,j);
21287 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
21288 32 : objectArray[i][j].executeVisitorMemberFunction(visitor);
21289 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
21290 : }
21291 : else
21292 : {
21293 : // printf ("Found a INVALID SgTypeString object in the memory pool \n");
21294 : }
21295 : }
21296 : }
21297 : }
21298 :
21299 : // This should not be required since all previously static data members are
21300 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
21301 :
21302 194 : }
21303 :
21304 : void
21305 0 : SgTypeString::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
21306 : {
21307 : // This function visits only a single IR node of the memory pool.
21308 : // it is typically called once for each type of IR node within
21309 : // the automatically generated function: traverseRepresentativeNodes().
21310 :
21311 : // Initialize array to the address of the first element of the STL vector
21312 : // (which is guarenteed to be contiguous storage).
21313 : // SgTypeString objectArray [] = *(Memory_Block_List.begin());
21314 0 : if (SgTypeString::pools.empty() == false)
21315 : {
21316 : // Generate an array of memory pools
21317 0 : SgTypeString** objectArray = (SgTypeString**) &(SgTypeString::pools[0]);
21318 :
21319 : // Build a local variable for better performance
21320 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
21321 :
21322 : // Iterate over the memory pools
21323 0 : bool done = false;
21324 0 : unsigned i=0;
21325 :
21326 : // find the first valid IR node, call visit function, and then leave
21327 0 : while ( done == false && i < SgTypeString::pools.size() )
21328 : {
21329 : // objectArray[i] is a single memory pool
21330 : unsigned j=0;
21331 0 : while (done == false && j < SgTypeString::pool_size)
21332 : {
21333 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
21334 : {
21335 0 : traversal.visit(&(objectArray[i][j]));
21336 0 : done = true;
21337 : }
21338 0 : j++;
21339 : }
21340 0 : i++;
21341 : }
21342 :
21343 : #if 0
21344 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
21345 : if (done == false)
21346 : {
21347 : printf ("No representative for SgTypeString found in memory pools \n");
21348 : }
21349 : #endif
21350 : }
21351 0 : }
21352 :
21353 :
21354 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
21355 : // using values that overflow signed values of int.
21356 : size_t
21357 4 : SgTypeString::numberOfNodes()
21358 : {
21359 : // This function traverses the memory pool for an IR node and
21360 : // counts the number of IR nodes of a particular Sage III IR
21361 : // nodes type.
21362 :
21363 4 : size_t count = 0;
21364 4 : if (SgTypeString::pools.empty() == false)
21365 : {
21366 : // Generate an array of memory pools (this is actually a STL vector,
21367 : // but it is contiguious, so OK to treat this way).
21368 0 : SgTypeString** objectArray = (SgTypeString**) &(SgTypeString::pools[0]);
21369 :
21370 : // Build a local variable for better performance (make it a loop invariant variable).
21371 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
21372 :
21373 : // Iterate over all of the memory pools for this IR node.
21374 0 : for (unsigned int i=0; i < SgTypeString::pools.size(); i++)
21375 : {
21376 : // objectArray[i] is a single memory pool, iterate over all the
21377 : // IR nodes and only count those that are valid IR nodes used in
21378 : // the AST (i.e. allocated IR nodes).
21379 0 : for (unsigned j=0; j < SgTypeString::pool_size; j++)
21380 : {
21381 : // This is indexing the STL vector of C/C++ style arrays as a doubly
21382 : // indexed array access. It is OK since we have leveraged the semantics
21383 : // of STL vector memory as contigous and cast the memory as an array
21384 : // of arrays to use the 2D array indexing. Hope this is not confusing,
21385 : // but it s very fast as an implementation.
21386 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
21387 : {
21388 0 : count++;
21389 : }
21390 : }
21391 : }
21392 : }
21393 :
21394 :
21395 :
21396 4 : return count;
21397 : }
21398 :
21399 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
21400 : // using values that overflow signed values of int.
21401 : size_t
21402 0 : SgTypeString::memoryUsage()
21403 : {
21404 : // This function is required because we need the class name as a type when we call sizeof
21405 : // There might be another way to implement this if we have a traversal that only called a
21406 : // representative object (one call for each type of Sage IIIIR node).
21407 0 : size_t memory = numberOfNodes() * sizeof(SgTypeString);
21408 :
21409 0 : return memory;
21410 : }
21411 :
21412 : /* #line 21413 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
21413 :
21414 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
21415 : void
21416 5668 : SgTypeBool::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
21417 : {
21418 : // This function traverses the memory pool for only a specific IR node
21419 : // and calls the visit function of the input class execute a traversal
21420 : // similar to the style of the attribute based traversals within ROSE.
21421 : // This traversal will visit ALL nodes of the AST where as the other
21422 : // attribute based traversals visit only the embedded tree within the AST.
21423 :
21424 : // Initialize array to the address of the first element of the STL vector
21425 : // (which is guaranteed to be contiguous storage).
21426 : // SgTypeBool objectArray [] = *(Memory_Block_List.begin());
21427 5668 : if (SgTypeBool::pools.empty() == false)
21428 : {
21429 : // Generate an array of memory pools
21430 1144 : SgTypeBool** objectArray = (SgTypeBool**) &(SgTypeBool::pools[0]);
21431 :
21432 : // Build a local variable for better performance
21433 1144 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
21434 : #if 0
21435 : // Iterate over the memory pools
21436 : for (unsigned int i=0; i < SgTypeBool::pools.size(); i++)
21437 : {
21438 : // objectArray[i] is a single memory pool
21439 : for (int j=0; j < SgTypeBool::pool_size; j++)
21440 : {
21441 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
21442 : {
21443 : traversal.visit(&(objectArray[i][j]));
21444 : }
21445 : }
21446 : }
21447 : #else
21448 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
21449 : // compute the list first and then call the visit function on each list element.
21450 :
21451 : // printf ("Inside of SgTypeBool::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
21452 :
21453 2288 : std::vector<SgTypeBool*> nodeList;
21454 :
21455 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
21456 2288 : for (unsigned int i=0; i < SgTypeBool::pools.size(); i++)
21457 : {
21458 : // objectArray[i] is a single memory pool
21459 2289140 : for (unsigned j=0; j < SgTypeBool::pool_size; j++)
21460 : {
21461 2288000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
21462 : {
21463 1144 : nodeList.push_back(&(objectArray[i][j]));
21464 : }
21465 : }
21466 : }
21467 :
21468 : // Iterate over the saved list
21469 1144 : size_t nodeListSize = nodeList.size();
21470 2288 : for (size_t i=0; i < nodeListSize; i++)
21471 : {
21472 1144 : ROSE_ASSERT(nodeList[i] != NULL);
21473 : #if 0
21474 : traversal.visit(nodeList[i]);
21475 : #else
21476 1144 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
21477 : {
21478 1144 : traversal.visit(nodeList[i]);
21479 : }
21480 : #endif
21481 : }
21482 : #endif
21483 : }
21484 :
21485 : // This should not be required since all previously static data members are
21486 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
21487 :
21488 5668 : }
21489 :
21490 :
21491 : void
21492 194 : SgTypeBool::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
21493 : {
21494 : // This function traverses the memory pool for an IR node and
21495 : // calls the function to execute the visitor object.
21496 :
21497 : // Initialize array to the address of the first element of the STL vector
21498 : // (which is guarenteed to be contiguous storage).
21499 : // SgTypeBool objectArray [] = *(Memory_Block_List.begin());
21500 194 : if (SgTypeBool::pools.empty() == false)
21501 : {
21502 : // Generate an array of memory pools
21503 194 : SgTypeBool** objectArray = (SgTypeBool**) &(SgTypeBool::pools[0]);
21504 :
21505 : // Build a local variable for better performance
21506 194 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
21507 :
21508 : // Iterate over the memory pools
21509 388 : for (unsigned int i=0; i < SgTypeBool::pools.size(); i++)
21510 : {
21511 : // objectArray[i] is a single memory pool
21512 388194 : for (unsigned j=0; j < SgTypeBool::pool_size; j++)
21513 : {
21514 388000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
21515 : {
21516 : // printf ("Found a valid SgTypeBool object in the memory pool %d at position %d \n",i,j);
21517 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
21518 194 : objectArray[i][j].executeVisitorMemberFunction(visitor);
21519 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
21520 : }
21521 : else
21522 : {
21523 : // printf ("Found a INVALID SgTypeBool object in the memory pool \n");
21524 : }
21525 : }
21526 : }
21527 : }
21528 :
21529 : // This should not be required since all previously static data members are
21530 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
21531 :
21532 194 : }
21533 :
21534 : void
21535 0 : SgTypeBool::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
21536 : {
21537 : // This function visits only a single IR node of the memory pool.
21538 : // it is typically called once for each type of IR node within
21539 : // the automatically generated function: traverseRepresentativeNodes().
21540 :
21541 : // Initialize array to the address of the first element of the STL vector
21542 : // (which is guarenteed to be contiguous storage).
21543 : // SgTypeBool objectArray [] = *(Memory_Block_List.begin());
21544 0 : if (SgTypeBool::pools.empty() == false)
21545 : {
21546 : // Generate an array of memory pools
21547 0 : SgTypeBool** objectArray = (SgTypeBool**) &(SgTypeBool::pools[0]);
21548 :
21549 : // Build a local variable for better performance
21550 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
21551 :
21552 : // Iterate over the memory pools
21553 0 : bool done = false;
21554 0 : unsigned i=0;
21555 :
21556 : // find the first valid IR node, call visit function, and then leave
21557 0 : while ( done == false && i < SgTypeBool::pools.size() )
21558 : {
21559 : // objectArray[i] is a single memory pool
21560 : unsigned j=0;
21561 0 : while (done == false && j < SgTypeBool::pool_size)
21562 : {
21563 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
21564 : {
21565 0 : traversal.visit(&(objectArray[i][j]));
21566 0 : done = true;
21567 : }
21568 0 : j++;
21569 : }
21570 0 : i++;
21571 : }
21572 :
21573 : #if 0
21574 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
21575 : if (done == false)
21576 : {
21577 : printf ("No representative for SgTypeBool found in memory pools \n");
21578 : }
21579 : #endif
21580 : }
21581 0 : }
21582 :
21583 :
21584 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
21585 : // using values that overflow signed values of int.
21586 : size_t
21587 4 : SgTypeBool::numberOfNodes()
21588 : {
21589 : // This function traverses the memory pool for an IR node and
21590 : // counts the number of IR nodes of a particular Sage III IR
21591 : // nodes type.
21592 :
21593 4 : size_t count = 0;
21594 4 : if (SgTypeBool::pools.empty() == false)
21595 : {
21596 : // Generate an array of memory pools (this is actually a STL vector,
21597 : // but it is contiguious, so OK to treat this way).
21598 1 : SgTypeBool** objectArray = (SgTypeBool**) &(SgTypeBool::pools[0]);
21599 :
21600 : // Build a local variable for better performance (make it a loop invariant variable).
21601 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
21602 :
21603 : // Iterate over all of the memory pools for this IR node.
21604 2 : for (unsigned int i=0; i < SgTypeBool::pools.size(); i++)
21605 : {
21606 : // objectArray[i] is a single memory pool, iterate over all the
21607 : // IR nodes and only count those that are valid IR nodes used in
21608 : // the AST (i.e. allocated IR nodes).
21609 2001 : for (unsigned j=0; j < SgTypeBool::pool_size; j++)
21610 : {
21611 : // This is indexing the STL vector of C/C++ style arrays as a doubly
21612 : // indexed array access. It is OK since we have leveraged the semantics
21613 : // of STL vector memory as contigous and cast the memory as an array
21614 : // of arrays to use the 2D array indexing. Hope this is not confusing,
21615 : // but it s very fast as an implementation.
21616 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
21617 : {
21618 1 : count++;
21619 : }
21620 : }
21621 : }
21622 : }
21623 :
21624 :
21625 :
21626 4 : return count;
21627 : }
21628 :
21629 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
21630 : // using values that overflow signed values of int.
21631 : size_t
21632 0 : SgTypeBool::memoryUsage()
21633 : {
21634 : // This function is required because we need the class name as a type when we call sizeof
21635 : // There might be another way to implement this if we have a traversal that only called a
21636 : // representative object (one call for each type of Sage IIIIR node).
21637 0 : size_t memory = numberOfNodes() * sizeof(SgTypeBool);
21638 :
21639 0 : return memory;
21640 : }
21641 :
21642 : /* #line 21643 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
21643 :
21644 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
21645 : void
21646 5668 : SgPointerType::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
21647 : {
21648 : // This function traverses the memory pool for only a specific IR node
21649 : // and calls the visit function of the input class execute a traversal
21650 : // similar to the style of the attribute based traversals within ROSE.
21651 : // This traversal will visit ALL nodes of the AST where as the other
21652 : // attribute based traversals visit only the embedded tree within the AST.
21653 :
21654 : // Initialize array to the address of the first element of the STL vector
21655 : // (which is guaranteed to be contiguous storage).
21656 : // SgPointerType objectArray [] = *(Memory_Block_List.begin());
21657 5668 : if (SgPointerType::pools.empty() == false)
21658 : {
21659 : // Generate an array of memory pools
21660 4913 : SgPointerType** objectArray = (SgPointerType**) &(SgPointerType::pools[0]);
21661 :
21662 : // Build a local variable for better performance
21663 4913 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
21664 : #if 0
21665 : // Iterate over the memory pools
21666 : for (unsigned int i=0; i < SgPointerType::pools.size(); i++)
21667 : {
21668 : // objectArray[i] is a single memory pool
21669 : for (int j=0; j < SgPointerType::pool_size; j++)
21670 : {
21671 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
21672 : {
21673 : traversal.visit(&(objectArray[i][j]));
21674 : }
21675 : }
21676 : }
21677 : #else
21678 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
21679 : // compute the list first and then call the visit function on each list element.
21680 :
21681 : // printf ("Inside of SgPointerType::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
21682 :
21683 9826 : std::vector<SgPointerType*> nodeList;
21684 :
21685 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
21686 9826 : for (unsigned int i=0; i < SgPointerType::pools.size(); i++)
21687 : {
21688 : // objectArray[i] is a single memory pool
21689 9830910 : for (unsigned j=0; j < SgPointerType::pool_size; j++)
21690 : {
21691 9826000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
21692 : {
21693 412407 : nodeList.push_back(&(objectArray[i][j]));
21694 : }
21695 : }
21696 : }
21697 :
21698 : // Iterate over the saved list
21699 4913 : size_t nodeListSize = nodeList.size();
21700 417320 : for (size_t i=0; i < nodeListSize; i++)
21701 : {
21702 412407 : ROSE_ASSERT(nodeList[i] != NULL);
21703 : #if 0
21704 : traversal.visit(nodeList[i]);
21705 : #else
21706 412407 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
21707 : {
21708 412407 : traversal.visit(nodeList[i]);
21709 : }
21710 : #endif
21711 : }
21712 : #endif
21713 : }
21714 :
21715 : // This should not be required since all previously static data members are
21716 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
21717 :
21718 5668 : }
21719 :
21720 :
21721 : void
21722 194 : SgPointerType::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
21723 : {
21724 : // This function traverses the memory pool for an IR node and
21725 : // calls the function to execute the visitor object.
21726 :
21727 : // Initialize array to the address of the first element of the STL vector
21728 : // (which is guarenteed to be contiguous storage).
21729 : // SgPointerType objectArray [] = *(Memory_Block_List.begin());
21730 194 : if (SgPointerType::pools.empty() == false)
21731 : {
21732 : // Generate an array of memory pools
21733 194 : SgPointerType** objectArray = (SgPointerType**) &(SgPointerType::pools[0]);
21734 :
21735 : // Build a local variable for better performance
21736 194 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
21737 :
21738 : // Iterate over the memory pools
21739 388 : for (unsigned int i=0; i < SgPointerType::pools.size(); i++)
21740 : {
21741 : // objectArray[i] is a single memory pool
21742 388194 : for (unsigned j=0; j < SgPointerType::pool_size; j++)
21743 : {
21744 388000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
21745 : {
21746 : // printf ("Found a valid SgPointerType object in the memory pool %d at position %d \n",i,j);
21747 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
21748 81737 : objectArray[i][j].executeVisitorMemberFunction(visitor);
21749 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
21750 : }
21751 : else
21752 : {
21753 : // printf ("Found a INVALID SgPointerType object in the memory pool \n");
21754 : }
21755 : }
21756 : }
21757 : }
21758 :
21759 : // This should not be required since all previously static data members are
21760 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
21761 :
21762 194 : }
21763 :
21764 : void
21765 0 : SgPointerType::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
21766 : {
21767 : // This function visits only a single IR node of the memory pool.
21768 : // it is typically called once for each type of IR node within
21769 : // the automatically generated function: traverseRepresentativeNodes().
21770 :
21771 : // Initialize array to the address of the first element of the STL vector
21772 : // (which is guarenteed to be contiguous storage).
21773 : // SgPointerType objectArray [] = *(Memory_Block_List.begin());
21774 0 : if (SgPointerType::pools.empty() == false)
21775 : {
21776 : // Generate an array of memory pools
21777 0 : SgPointerType** objectArray = (SgPointerType**) &(SgPointerType::pools[0]);
21778 :
21779 : // Build a local variable for better performance
21780 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
21781 :
21782 : // Iterate over the memory pools
21783 0 : bool done = false;
21784 0 : unsigned i=0;
21785 :
21786 : // find the first valid IR node, call visit function, and then leave
21787 0 : while ( done == false && i < SgPointerType::pools.size() )
21788 : {
21789 : // objectArray[i] is a single memory pool
21790 : unsigned j=0;
21791 0 : while (done == false && j < SgPointerType::pool_size)
21792 : {
21793 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
21794 : {
21795 0 : traversal.visit(&(objectArray[i][j]));
21796 0 : done = true;
21797 : }
21798 0 : j++;
21799 : }
21800 0 : i++;
21801 : }
21802 :
21803 : #if 0
21804 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
21805 : if (done == false)
21806 : {
21807 : printf ("No representative for SgPointerType found in memory pools \n");
21808 : }
21809 : #endif
21810 : }
21811 0 : }
21812 :
21813 :
21814 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
21815 : // using values that overflow signed values of int.
21816 : size_t
21817 4 : SgPointerType::numberOfNodes()
21818 : {
21819 : // This function traverses the memory pool for an IR node and
21820 : // counts the number of IR nodes of a particular Sage III IR
21821 : // nodes type.
21822 :
21823 4 : size_t count = 0;
21824 4 : if (SgPointerType::pools.empty() == false)
21825 : {
21826 : // Generate an array of memory pools (this is actually a STL vector,
21827 : // but it is contiguious, so OK to treat this way).
21828 2 : SgPointerType** objectArray = (SgPointerType**) &(SgPointerType::pools[0]);
21829 :
21830 : // Build a local variable for better performance (make it a loop invariant variable).
21831 2 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
21832 :
21833 : // Iterate over all of the memory pools for this IR node.
21834 4 : for (unsigned int i=0; i < SgPointerType::pools.size(); i++)
21835 : {
21836 : // objectArray[i] is a single memory pool, iterate over all the
21837 : // IR nodes and only count those that are valid IR nodes used in
21838 : // the AST (i.e. allocated IR nodes).
21839 4002 : for (unsigned j=0; j < SgPointerType::pool_size; j++)
21840 : {
21841 : // This is indexing the STL vector of C/C++ style arrays as a doubly
21842 : // indexed array access. It is OK since we have leveraged the semantics
21843 : // of STL vector memory as contigous and cast the memory as an array
21844 : // of arrays to use the 2D array indexing. Hope this is not confusing,
21845 : // but it s very fast as an implementation.
21846 4000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
21847 : {
21848 626 : count++;
21849 : }
21850 : }
21851 : }
21852 : }
21853 :
21854 :
21855 :
21856 4 : return count;
21857 : }
21858 :
21859 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
21860 : // using values that overflow signed values of int.
21861 : size_t
21862 0 : SgPointerType::memoryUsage()
21863 : {
21864 : // This function is required because we need the class name as a type when we call sizeof
21865 : // There might be another way to implement this if we have a traversal that only called a
21866 : // representative object (one call for each type of Sage IIIIR node).
21867 0 : size_t memory = numberOfNodes() * sizeof(SgPointerType);
21868 :
21869 0 : return memory;
21870 : }
21871 :
21872 : /* #line 21873 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
21873 :
21874 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
21875 : void
21876 5668 : SgPointerMemberType::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
21877 : {
21878 : // This function traverses the memory pool for only a specific IR node
21879 : // and calls the visit function of the input class execute a traversal
21880 : // similar to the style of the attribute based traversals within ROSE.
21881 : // This traversal will visit ALL nodes of the AST where as the other
21882 : // attribute based traversals visit only the embedded tree within the AST.
21883 :
21884 : // Initialize array to the address of the first element of the STL vector
21885 : // (which is guaranteed to be contiguous storage).
21886 : // SgPointerMemberType objectArray [] = *(Memory_Block_List.begin());
21887 5668 : if (SgPointerMemberType::pools.empty() == false)
21888 : {
21889 : // Generate an array of memory pools
21890 145 : SgPointerMemberType** objectArray = (SgPointerMemberType**) &(SgPointerMemberType::pools[0]);
21891 :
21892 : // Build a local variable for better performance
21893 145 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
21894 : #if 0
21895 : // Iterate over the memory pools
21896 : for (unsigned int i=0; i < SgPointerMemberType::pools.size(); i++)
21897 : {
21898 : // objectArray[i] is a single memory pool
21899 : for (int j=0; j < SgPointerMemberType::pool_size; j++)
21900 : {
21901 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
21902 : {
21903 : traversal.visit(&(objectArray[i][j]));
21904 : }
21905 : }
21906 : }
21907 : #else
21908 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
21909 : // compute the list first and then call the visit function on each list element.
21910 :
21911 : // printf ("Inside of SgPointerMemberType::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
21912 :
21913 290 : std::vector<SgPointerMemberType*> nodeList;
21914 :
21915 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
21916 290 : for (unsigned int i=0; i < SgPointerMemberType::pools.size(); i++)
21917 : {
21918 : // objectArray[i] is a single memory pool
21919 290145 : for (unsigned j=0; j < SgPointerMemberType::pool_size; j++)
21920 : {
21921 290000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
21922 : {
21923 3533 : nodeList.push_back(&(objectArray[i][j]));
21924 : }
21925 : }
21926 : }
21927 :
21928 : // Iterate over the saved list
21929 145 : size_t nodeListSize = nodeList.size();
21930 3678 : for (size_t i=0; i < nodeListSize; i++)
21931 : {
21932 3533 : ROSE_ASSERT(nodeList[i] != NULL);
21933 : #if 0
21934 : traversal.visit(nodeList[i]);
21935 : #else
21936 3533 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
21937 : {
21938 3533 : traversal.visit(nodeList[i]);
21939 : }
21940 : #endif
21941 : }
21942 : #endif
21943 : }
21944 :
21945 : // This should not be required since all previously static data members are
21946 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
21947 :
21948 5668 : }
21949 :
21950 :
21951 : void
21952 194 : SgPointerMemberType::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
21953 : {
21954 : // This function traverses the memory pool for an IR node and
21955 : // calls the function to execute the visitor object.
21956 :
21957 : // Initialize array to the address of the first element of the STL vector
21958 : // (which is guarenteed to be contiguous storage).
21959 : // SgPointerMemberType objectArray [] = *(Memory_Block_List.begin());
21960 194 : if (SgPointerMemberType::pools.empty() == false)
21961 : {
21962 : // Generate an array of memory pools
21963 137 : SgPointerMemberType** objectArray = (SgPointerMemberType**) &(SgPointerMemberType::pools[0]);
21964 :
21965 : // Build a local variable for better performance
21966 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
21967 :
21968 : // Iterate over the memory pools
21969 274 : for (unsigned int i=0; i < SgPointerMemberType::pools.size(); i++)
21970 : {
21971 : // objectArray[i] is a single memory pool
21972 274137 : for (unsigned j=0; j < SgPointerMemberType::pool_size; j++)
21973 : {
21974 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
21975 : {
21976 : // printf ("Found a valid SgPointerMemberType object in the memory pool %d at position %d \n",i,j);
21977 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
21978 3973 : objectArray[i][j].executeVisitorMemberFunction(visitor);
21979 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
21980 : }
21981 : else
21982 : {
21983 : // printf ("Found a INVALID SgPointerMemberType object in the memory pool \n");
21984 : }
21985 : }
21986 : }
21987 : }
21988 :
21989 : // This should not be required since all previously static data members are
21990 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
21991 :
21992 194 : }
21993 :
21994 : void
21995 0 : SgPointerMemberType::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
21996 : {
21997 : // This function visits only a single IR node of the memory pool.
21998 : // it is typically called once for each type of IR node within
21999 : // the automatically generated function: traverseRepresentativeNodes().
22000 :
22001 : // Initialize array to the address of the first element of the STL vector
22002 : // (which is guarenteed to be contiguous storage).
22003 : // SgPointerMemberType objectArray [] = *(Memory_Block_List.begin());
22004 0 : if (SgPointerMemberType::pools.empty() == false)
22005 : {
22006 : // Generate an array of memory pools
22007 0 : SgPointerMemberType** objectArray = (SgPointerMemberType**) &(SgPointerMemberType::pools[0]);
22008 :
22009 : // Build a local variable for better performance
22010 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
22011 :
22012 : // Iterate over the memory pools
22013 0 : bool done = false;
22014 0 : unsigned i=0;
22015 :
22016 : // find the first valid IR node, call visit function, and then leave
22017 0 : while ( done == false && i < SgPointerMemberType::pools.size() )
22018 : {
22019 : // objectArray[i] is a single memory pool
22020 : unsigned j=0;
22021 0 : while (done == false && j < SgPointerMemberType::pool_size)
22022 : {
22023 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
22024 : {
22025 0 : traversal.visit(&(objectArray[i][j]));
22026 0 : done = true;
22027 : }
22028 0 : j++;
22029 : }
22030 0 : i++;
22031 : }
22032 :
22033 : #if 0
22034 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
22035 : if (done == false)
22036 : {
22037 : printf ("No representative for SgPointerMemberType found in memory pools \n");
22038 : }
22039 : #endif
22040 : }
22041 0 : }
22042 :
22043 :
22044 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
22045 : // using values that overflow signed values of int.
22046 : size_t
22047 4 : SgPointerMemberType::numberOfNodes()
22048 : {
22049 : // This function traverses the memory pool for an IR node and
22050 : // counts the number of IR nodes of a particular Sage III IR
22051 : // nodes type.
22052 :
22053 4 : size_t count = 0;
22054 4 : if (SgPointerMemberType::pools.empty() == false)
22055 : {
22056 : // Generate an array of memory pools (this is actually a STL vector,
22057 : // but it is contiguious, so OK to treat this way).
22058 1 : SgPointerMemberType** objectArray = (SgPointerMemberType**) &(SgPointerMemberType::pools[0]);
22059 :
22060 : // Build a local variable for better performance (make it a loop invariant variable).
22061 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
22062 :
22063 : // Iterate over all of the memory pools for this IR node.
22064 2 : for (unsigned int i=0; i < SgPointerMemberType::pools.size(); i++)
22065 : {
22066 : // objectArray[i] is a single memory pool, iterate over all the
22067 : // IR nodes and only count those that are valid IR nodes used in
22068 : // the AST (i.e. allocated IR nodes).
22069 2001 : for (unsigned j=0; j < SgPointerMemberType::pool_size; j++)
22070 : {
22071 : // This is indexing the STL vector of C/C++ style arrays as a doubly
22072 : // indexed array access. It is OK since we have leveraged the semantics
22073 : // of STL vector memory as contigous and cast the memory as an array
22074 : // of arrays to use the 2D array indexing. Hope this is not confusing,
22075 : // but it s very fast as an implementation.
22076 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
22077 : {
22078 29 : count++;
22079 : }
22080 : }
22081 : }
22082 : }
22083 :
22084 :
22085 :
22086 4 : return count;
22087 : }
22088 :
22089 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
22090 : // using values that overflow signed values of int.
22091 : size_t
22092 0 : SgPointerMemberType::memoryUsage()
22093 : {
22094 : // This function is required because we need the class name as a type when we call sizeof
22095 : // There might be another way to implement this if we have a traversal that only called a
22096 : // representative object (one call for each type of Sage IIIIR node).
22097 0 : size_t memory = numberOfNodes() * sizeof(SgPointerMemberType);
22098 :
22099 0 : return memory;
22100 : }
22101 :
22102 : /* #line 22103 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
22103 :
22104 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
22105 : void
22106 5668 : SgReferenceType::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
22107 : {
22108 : // This function traverses the memory pool for only a specific IR node
22109 : // and calls the visit function of the input class execute a traversal
22110 : // similar to the style of the attribute based traversals within ROSE.
22111 : // This traversal will visit ALL nodes of the AST where as the other
22112 : // attribute based traversals visit only the embedded tree within the AST.
22113 :
22114 : // Initialize array to the address of the first element of the STL vector
22115 : // (which is guaranteed to be contiguous storage).
22116 : // SgReferenceType objectArray [] = *(Memory_Block_List.begin());
22117 5668 : if (SgReferenceType::pools.empty() == false)
22118 : {
22119 : // Generate an array of memory pools
22120 876 : SgReferenceType** objectArray = (SgReferenceType**) &(SgReferenceType::pools[0]);
22121 :
22122 : // Build a local variable for better performance
22123 876 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
22124 : #if 0
22125 : // Iterate over the memory pools
22126 : for (unsigned int i=0; i < SgReferenceType::pools.size(); i++)
22127 : {
22128 : // objectArray[i] is a single memory pool
22129 : for (int j=0; j < SgReferenceType::pool_size; j++)
22130 : {
22131 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
22132 : {
22133 : traversal.visit(&(objectArray[i][j]));
22134 : }
22135 : }
22136 : }
22137 : #else
22138 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
22139 : // compute the list first and then call the visit function on each list element.
22140 :
22141 : // printf ("Inside of SgReferenceType::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
22142 :
22143 1752 : std::vector<SgReferenceType*> nodeList;
22144 :
22145 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
22146 1752 : for (unsigned int i=0; i < SgReferenceType::pools.size(); i++)
22147 : {
22148 : // objectArray[i] is a single memory pool
22149 1752880 : for (unsigned j=0; j < SgReferenceType::pool_size; j++)
22150 : {
22151 1752000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
22152 : {
22153 98666 : nodeList.push_back(&(objectArray[i][j]));
22154 : }
22155 : }
22156 : }
22157 :
22158 : // Iterate over the saved list
22159 876 : size_t nodeListSize = nodeList.size();
22160 99542 : for (size_t i=0; i < nodeListSize; i++)
22161 : {
22162 98666 : ROSE_ASSERT(nodeList[i] != NULL);
22163 : #if 0
22164 : traversal.visit(nodeList[i]);
22165 : #else
22166 98666 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
22167 : {
22168 98666 : traversal.visit(nodeList[i]);
22169 : }
22170 : #endif
22171 : }
22172 : #endif
22173 : }
22174 :
22175 : // This should not be required since all previously static data members are
22176 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
22177 :
22178 5668 : }
22179 :
22180 :
22181 : void
22182 194 : SgReferenceType::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
22183 : {
22184 : // This function traverses the memory pool for an IR node and
22185 : // calls the function to execute the visitor object.
22186 :
22187 : // Initialize array to the address of the first element of the STL vector
22188 : // (which is guarenteed to be contiguous storage).
22189 : // SgReferenceType objectArray [] = *(Memory_Block_List.begin());
22190 194 : if (SgReferenceType::pools.empty() == false)
22191 : {
22192 : // Generate an array of memory pools
22193 194 : SgReferenceType** objectArray = (SgReferenceType**) &(SgReferenceType::pools[0]);
22194 :
22195 : // Build a local variable for better performance
22196 194 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
22197 :
22198 : // Iterate over the memory pools
22199 388 : for (unsigned int i=0; i < SgReferenceType::pools.size(); i++)
22200 : {
22201 : // objectArray[i] is a single memory pool
22202 388194 : for (unsigned j=0; j < SgReferenceType::pool_size; j++)
22203 : {
22204 388000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
22205 : {
22206 : // printf ("Found a valid SgReferenceType object in the memory pool %d at position %d \n",i,j);
22207 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
22208 100828 : objectArray[i][j].executeVisitorMemberFunction(visitor);
22209 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
22210 : }
22211 : else
22212 : {
22213 : // printf ("Found a INVALID SgReferenceType object in the memory pool \n");
22214 : }
22215 : }
22216 : }
22217 : }
22218 :
22219 : // This should not be required since all previously static data members are
22220 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
22221 :
22222 194 : }
22223 :
22224 : void
22225 0 : SgReferenceType::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
22226 : {
22227 : // This function visits only a single IR node of the memory pool.
22228 : // it is typically called once for each type of IR node within
22229 : // the automatically generated function: traverseRepresentativeNodes().
22230 :
22231 : // Initialize array to the address of the first element of the STL vector
22232 : // (which is guarenteed to be contiguous storage).
22233 : // SgReferenceType objectArray [] = *(Memory_Block_List.begin());
22234 0 : if (SgReferenceType::pools.empty() == false)
22235 : {
22236 : // Generate an array of memory pools
22237 0 : SgReferenceType** objectArray = (SgReferenceType**) &(SgReferenceType::pools[0]);
22238 :
22239 : // Build a local variable for better performance
22240 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
22241 :
22242 : // Iterate over the memory pools
22243 0 : bool done = false;
22244 0 : unsigned i=0;
22245 :
22246 : // find the first valid IR node, call visit function, and then leave
22247 0 : while ( done == false && i < SgReferenceType::pools.size() )
22248 : {
22249 : // objectArray[i] is a single memory pool
22250 : unsigned j=0;
22251 0 : while (done == false && j < SgReferenceType::pool_size)
22252 : {
22253 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
22254 : {
22255 0 : traversal.visit(&(objectArray[i][j]));
22256 0 : done = true;
22257 : }
22258 0 : j++;
22259 : }
22260 0 : i++;
22261 : }
22262 :
22263 : #if 0
22264 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
22265 : if (done == false)
22266 : {
22267 : printf ("No representative for SgReferenceType found in memory pools \n");
22268 : }
22269 : #endif
22270 : }
22271 0 : }
22272 :
22273 :
22274 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
22275 : // using values that overflow signed values of int.
22276 : size_t
22277 4 : SgReferenceType::numberOfNodes()
22278 : {
22279 : // This function traverses the memory pool for an IR node and
22280 : // counts the number of IR nodes of a particular Sage III IR
22281 : // nodes type.
22282 :
22283 4 : size_t count = 0;
22284 4 : if (SgReferenceType::pools.empty() == false)
22285 : {
22286 : // Generate an array of memory pools (this is actually a STL vector,
22287 : // but it is contiguious, so OK to treat this way).
22288 1 : SgReferenceType** objectArray = (SgReferenceType**) &(SgReferenceType::pools[0]);
22289 :
22290 : // Build a local variable for better performance (make it a loop invariant variable).
22291 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
22292 :
22293 : // Iterate over all of the memory pools for this IR node.
22294 2 : for (unsigned int i=0; i < SgReferenceType::pools.size(); i++)
22295 : {
22296 : // objectArray[i] is a single memory pool, iterate over all the
22297 : // IR nodes and only count those that are valid IR nodes used in
22298 : // the AST (i.e. allocated IR nodes).
22299 2001 : for (unsigned j=0; j < SgReferenceType::pool_size; j++)
22300 : {
22301 : // This is indexing the STL vector of C/C++ style arrays as a doubly
22302 : // indexed array access. It is OK since we have leveraged the semantics
22303 : // of STL vector memory as contigous and cast the memory as an array
22304 : // of arrays to use the 2D array indexing. Hope this is not confusing,
22305 : // but it s very fast as an implementation.
22306 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
22307 : {
22308 724 : count++;
22309 : }
22310 : }
22311 : }
22312 : }
22313 :
22314 :
22315 :
22316 4 : return count;
22317 : }
22318 :
22319 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
22320 : // using values that overflow signed values of int.
22321 : size_t
22322 0 : SgReferenceType::memoryUsage()
22323 : {
22324 : // This function is required because we need the class name as a type when we call sizeof
22325 : // There might be another way to implement this if we have a traversal that only called a
22326 : // representative object (one call for each type of Sage IIIIR node).
22327 0 : size_t memory = numberOfNodes() * sizeof(SgReferenceType);
22328 :
22329 0 : return memory;
22330 : }
22331 :
22332 : /* #line 22333 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
22333 :
22334 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
22335 : void
22336 5668 : SgNamedType::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
22337 : {
22338 : // This function traverses the memory pool for only a specific IR node
22339 : // and calls the visit function of the input class execute a traversal
22340 : // similar to the style of the attribute based traversals within ROSE.
22341 : // This traversal will visit ALL nodes of the AST where as the other
22342 : // attribute based traversals visit only the embedded tree within the AST.
22343 :
22344 : // Initialize array to the address of the first element of the STL vector
22345 : // (which is guaranteed to be contiguous storage).
22346 : // SgNamedType objectArray [] = *(Memory_Block_List.begin());
22347 5668 : if (SgNamedType::pools.empty() == false)
22348 : {
22349 : // Generate an array of memory pools
22350 0 : SgNamedType** objectArray = (SgNamedType**) &(SgNamedType::pools[0]);
22351 :
22352 : // Build a local variable for better performance
22353 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
22354 : #if 0
22355 : // Iterate over the memory pools
22356 : for (unsigned int i=0; i < SgNamedType::pools.size(); i++)
22357 : {
22358 : // objectArray[i] is a single memory pool
22359 : for (int j=0; j < SgNamedType::pool_size; j++)
22360 : {
22361 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
22362 : {
22363 : traversal.visit(&(objectArray[i][j]));
22364 : }
22365 : }
22366 : }
22367 : #else
22368 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
22369 : // compute the list first and then call the visit function on each list element.
22370 :
22371 : // printf ("Inside of SgNamedType::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
22372 :
22373 0 : std::vector<SgNamedType*> nodeList;
22374 :
22375 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
22376 0 : for (unsigned int i=0; i < SgNamedType::pools.size(); i++)
22377 : {
22378 : // objectArray[i] is a single memory pool
22379 0 : for (unsigned j=0; j < SgNamedType::pool_size; j++)
22380 : {
22381 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
22382 : {
22383 0 : nodeList.push_back(&(objectArray[i][j]));
22384 : }
22385 : }
22386 : }
22387 :
22388 : // Iterate over the saved list
22389 0 : size_t nodeListSize = nodeList.size();
22390 0 : for (size_t i=0; i < nodeListSize; i++)
22391 : {
22392 0 : ROSE_ASSERT(nodeList[i] != NULL);
22393 : #if 0
22394 : traversal.visit(nodeList[i]);
22395 : #else
22396 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
22397 : {
22398 0 : traversal.visit(nodeList[i]);
22399 : }
22400 : #endif
22401 : }
22402 : #endif
22403 : }
22404 :
22405 : // This should not be required since all previously static data members are
22406 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
22407 :
22408 5668 : }
22409 :
22410 :
22411 : void
22412 194 : SgNamedType::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
22413 : {
22414 : // This function traverses the memory pool for an IR node and
22415 : // calls the function to execute the visitor object.
22416 :
22417 : // Initialize array to the address of the first element of the STL vector
22418 : // (which is guarenteed to be contiguous storage).
22419 : // SgNamedType objectArray [] = *(Memory_Block_List.begin());
22420 194 : if (SgNamedType::pools.empty() == false)
22421 : {
22422 : // Generate an array of memory pools
22423 0 : SgNamedType** objectArray = (SgNamedType**) &(SgNamedType::pools[0]);
22424 :
22425 : // Build a local variable for better performance
22426 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
22427 :
22428 : // Iterate over the memory pools
22429 0 : for (unsigned int i=0; i < SgNamedType::pools.size(); i++)
22430 : {
22431 : // objectArray[i] is a single memory pool
22432 0 : for (unsigned j=0; j < SgNamedType::pool_size; j++)
22433 : {
22434 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
22435 : {
22436 : // printf ("Found a valid SgNamedType object in the memory pool %d at position %d \n",i,j);
22437 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
22438 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
22439 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
22440 : }
22441 : else
22442 : {
22443 : // printf ("Found a INVALID SgNamedType object in the memory pool \n");
22444 : }
22445 : }
22446 : }
22447 : }
22448 :
22449 : // This should not be required since all previously static data members are
22450 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
22451 :
22452 194 : }
22453 :
22454 : void
22455 0 : SgNamedType::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
22456 : {
22457 : // This function visits only a single IR node of the memory pool.
22458 : // it is typically called once for each type of IR node within
22459 : // the automatically generated function: traverseRepresentativeNodes().
22460 :
22461 : // Initialize array to the address of the first element of the STL vector
22462 : // (which is guarenteed to be contiguous storage).
22463 : // SgNamedType objectArray [] = *(Memory_Block_List.begin());
22464 0 : if (SgNamedType::pools.empty() == false)
22465 : {
22466 : // Generate an array of memory pools
22467 0 : SgNamedType** objectArray = (SgNamedType**) &(SgNamedType::pools[0]);
22468 :
22469 : // Build a local variable for better performance
22470 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
22471 :
22472 : // Iterate over the memory pools
22473 0 : bool done = false;
22474 0 : unsigned i=0;
22475 :
22476 : // find the first valid IR node, call visit function, and then leave
22477 0 : while ( done == false && i < SgNamedType::pools.size() )
22478 : {
22479 : // objectArray[i] is a single memory pool
22480 : unsigned j=0;
22481 0 : while (done == false && j < SgNamedType::pool_size)
22482 : {
22483 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
22484 : {
22485 0 : traversal.visit(&(objectArray[i][j]));
22486 0 : done = true;
22487 : }
22488 0 : j++;
22489 : }
22490 0 : i++;
22491 : }
22492 :
22493 : #if 0
22494 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
22495 : if (done == false)
22496 : {
22497 : printf ("No representative for SgNamedType found in memory pools \n");
22498 : }
22499 : #endif
22500 : }
22501 0 : }
22502 :
22503 :
22504 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
22505 : // using values that overflow signed values of int.
22506 : size_t
22507 4 : SgNamedType::numberOfNodes()
22508 : {
22509 : // This function traverses the memory pool for an IR node and
22510 : // counts the number of IR nodes of a particular Sage III IR
22511 : // nodes type.
22512 :
22513 4 : size_t count = 0;
22514 4 : if (SgNamedType::pools.empty() == false)
22515 : {
22516 : // Generate an array of memory pools (this is actually a STL vector,
22517 : // but it is contiguious, so OK to treat this way).
22518 0 : SgNamedType** objectArray = (SgNamedType**) &(SgNamedType::pools[0]);
22519 :
22520 : // Build a local variable for better performance (make it a loop invariant variable).
22521 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
22522 :
22523 : // Iterate over all of the memory pools for this IR node.
22524 0 : for (unsigned int i=0; i < SgNamedType::pools.size(); i++)
22525 : {
22526 : // objectArray[i] is a single memory pool, iterate over all the
22527 : // IR nodes and only count those that are valid IR nodes used in
22528 : // the AST (i.e. allocated IR nodes).
22529 0 : for (unsigned j=0; j < SgNamedType::pool_size; j++)
22530 : {
22531 : // This is indexing the STL vector of C/C++ style arrays as a doubly
22532 : // indexed array access. It is OK since we have leveraged the semantics
22533 : // of STL vector memory as contigous and cast the memory as an array
22534 : // of arrays to use the 2D array indexing. Hope this is not confusing,
22535 : // but it s very fast as an implementation.
22536 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
22537 : {
22538 0 : count++;
22539 : }
22540 : }
22541 : }
22542 : }
22543 :
22544 :
22545 :
22546 4 : return count;
22547 : }
22548 :
22549 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
22550 : // using values that overflow signed values of int.
22551 : size_t
22552 0 : SgNamedType::memoryUsage()
22553 : {
22554 : // This function is required because we need the class name as a type when we call sizeof
22555 : // There might be another way to implement this if we have a traversal that only called a
22556 : // representative object (one call for each type of Sage IIIIR node).
22557 0 : size_t memory = numberOfNodes() * sizeof(SgNamedType);
22558 :
22559 0 : return memory;
22560 : }
22561 :
22562 : /* #line 22563 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
22563 :
22564 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
22565 : void
22566 5670 : SgClassType::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
22567 : {
22568 : // This function traverses the memory pool for only a specific IR node
22569 : // and calls the visit function of the input class execute a traversal
22570 : // similar to the style of the attribute based traversals within ROSE.
22571 : // This traversal will visit ALL nodes of the AST where as the other
22572 : // attribute based traversals visit only the embedded tree within the AST.
22573 :
22574 : // Initialize array to the address of the first element of the STL vector
22575 : // (which is guaranteed to be contiguous storage).
22576 : // SgClassType objectArray [] = *(Memory_Block_List.begin());
22577 5670 : if (SgClassType::pools.empty() == false)
22578 : {
22579 : // Generate an array of memory pools
22580 3318 : SgClassType** objectArray = (SgClassType**) &(SgClassType::pools[0]);
22581 :
22582 : // Build a local variable for better performance
22583 3318 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
22584 : #if 0
22585 : // Iterate over the memory pools
22586 : for (unsigned int i=0; i < SgClassType::pools.size(); i++)
22587 : {
22588 : // objectArray[i] is a single memory pool
22589 : for (int j=0; j < SgClassType::pool_size; j++)
22590 : {
22591 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
22592 : {
22593 : traversal.visit(&(objectArray[i][j]));
22594 : }
22595 : }
22596 : }
22597 : #else
22598 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
22599 : // compute the list first and then call the visit function on each list element.
22600 :
22601 : // printf ("Inside of SgClassType::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
22602 :
22603 6636 : std::vector<SgClassType*> nodeList;
22604 :
22605 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
22606 6636 : for (unsigned int i=0; i < SgClassType::pools.size(); i++)
22607 : {
22608 : // objectArray[i] is a single memory pool
22609 6639320 : for (unsigned j=0; j < SgClassType::pool_size; j++)
22610 : {
22611 6636000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
22612 : {
22613 285716 : nodeList.push_back(&(objectArray[i][j]));
22614 : }
22615 : }
22616 : }
22617 :
22618 : // Iterate over the saved list
22619 3318 : size_t nodeListSize = nodeList.size();
22620 289034 : for (size_t i=0; i < nodeListSize; i++)
22621 : {
22622 285716 : ROSE_ASSERT(nodeList[i] != NULL);
22623 : #if 0
22624 : traversal.visit(nodeList[i]);
22625 : #else
22626 285716 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
22627 : {
22628 285716 : traversal.visit(nodeList[i]);
22629 : }
22630 : #endif
22631 : }
22632 : #endif
22633 : }
22634 :
22635 : // This should not be required since all previously static data members are
22636 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
22637 :
22638 5670 : }
22639 :
22640 :
22641 : void
22642 194 : SgClassType::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
22643 : {
22644 : // This function traverses the memory pool for an IR node and
22645 : // calls the function to execute the visitor object.
22646 :
22647 : // Initialize array to the address of the first element of the STL vector
22648 : // (which is guarenteed to be contiguous storage).
22649 : // SgClassType objectArray [] = *(Memory_Block_List.begin());
22650 194 : if (SgClassType::pools.empty() == false)
22651 : {
22652 : // Generate an array of memory pools
22653 137 : SgClassType** objectArray = (SgClassType**) &(SgClassType::pools[0]);
22654 :
22655 : // Build a local variable for better performance
22656 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
22657 :
22658 : // Iterate over the memory pools
22659 274 : for (unsigned int i=0; i < SgClassType::pools.size(); i++)
22660 : {
22661 : // objectArray[i] is a single memory pool
22662 274137 : for (unsigned j=0; j < SgClassType::pool_size; j++)
22663 : {
22664 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
22665 : {
22666 : // printf ("Found a valid SgClassType object in the memory pool %d at position %d \n",i,j);
22667 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
22668 192585 : objectArray[i][j].executeVisitorMemberFunction(visitor);
22669 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
22670 : }
22671 : else
22672 : {
22673 : // printf ("Found a INVALID SgClassType object in the memory pool \n");
22674 : }
22675 : }
22676 : }
22677 : }
22678 :
22679 : // This should not be required since all previously static data members are
22680 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
22681 :
22682 194 : }
22683 :
22684 : void
22685 0 : SgClassType::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
22686 : {
22687 : // This function visits only a single IR node of the memory pool.
22688 : // it is typically called once for each type of IR node within
22689 : // the automatically generated function: traverseRepresentativeNodes().
22690 :
22691 : // Initialize array to the address of the first element of the STL vector
22692 : // (which is guarenteed to be contiguous storage).
22693 : // SgClassType objectArray [] = *(Memory_Block_List.begin());
22694 0 : if (SgClassType::pools.empty() == false)
22695 : {
22696 : // Generate an array of memory pools
22697 0 : SgClassType** objectArray = (SgClassType**) &(SgClassType::pools[0]);
22698 :
22699 : // Build a local variable for better performance
22700 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
22701 :
22702 : // Iterate over the memory pools
22703 0 : bool done = false;
22704 0 : unsigned i=0;
22705 :
22706 : // find the first valid IR node, call visit function, and then leave
22707 0 : while ( done == false && i < SgClassType::pools.size() )
22708 : {
22709 : // objectArray[i] is a single memory pool
22710 : unsigned j=0;
22711 0 : while (done == false && j < SgClassType::pool_size)
22712 : {
22713 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
22714 : {
22715 0 : traversal.visit(&(objectArray[i][j]));
22716 0 : done = true;
22717 : }
22718 0 : j++;
22719 : }
22720 0 : i++;
22721 : }
22722 :
22723 : #if 0
22724 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
22725 : if (done == false)
22726 : {
22727 : printf ("No representative for SgClassType found in memory pools \n");
22728 : }
22729 : #endif
22730 : }
22731 0 : }
22732 :
22733 :
22734 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
22735 : // using values that overflow signed values of int.
22736 : size_t
22737 4 : SgClassType::numberOfNodes()
22738 : {
22739 : // This function traverses the memory pool for an IR node and
22740 : // counts the number of IR nodes of a particular Sage III IR
22741 : // nodes type.
22742 :
22743 4 : size_t count = 0;
22744 4 : if (SgClassType::pools.empty() == false)
22745 : {
22746 : // Generate an array of memory pools (this is actually a STL vector,
22747 : // but it is contiguious, so OK to treat this way).
22748 2 : SgClassType** objectArray = (SgClassType**) &(SgClassType::pools[0]);
22749 :
22750 : // Build a local variable for better performance (make it a loop invariant variable).
22751 2 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
22752 :
22753 : // Iterate over all of the memory pools for this IR node.
22754 4 : for (unsigned int i=0; i < SgClassType::pools.size(); i++)
22755 : {
22756 : // objectArray[i] is a single memory pool, iterate over all the
22757 : // IR nodes and only count those that are valid IR nodes used in
22758 : // the AST (i.e. allocated IR nodes).
22759 4002 : for (unsigned j=0; j < SgClassType::pool_size; j++)
22760 : {
22761 : // This is indexing the STL vector of C/C++ style arrays as a doubly
22762 : // indexed array access. It is OK since we have leveraged the semantics
22763 : // of STL vector memory as contigous and cast the memory as an array
22764 : // of arrays to use the 2D array indexing. Hope this is not confusing,
22765 : // but it s very fast as an implementation.
22766 4000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
22767 : {
22768 1401 : count++;
22769 : }
22770 : }
22771 : }
22772 : }
22773 :
22774 :
22775 :
22776 4 : return count;
22777 : }
22778 :
22779 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
22780 : // using values that overflow signed values of int.
22781 : size_t
22782 0 : SgClassType::memoryUsage()
22783 : {
22784 : // This function is required because we need the class name as a type when we call sizeof
22785 : // There might be another way to implement this if we have a traversal that only called a
22786 : // representative object (one call for each type of Sage IIIIR node).
22787 0 : size_t memory = numberOfNodes() * sizeof(SgClassType);
22788 :
22789 0 : return memory;
22790 : }
22791 :
22792 : /* #line 22793 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
22793 :
22794 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
22795 : void
22796 5668 : SgEnumType::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
22797 : {
22798 : // This function traverses the memory pool for only a specific IR node
22799 : // and calls the visit function of the input class execute a traversal
22800 : // similar to the style of the attribute based traversals within ROSE.
22801 : // This traversal will visit ALL nodes of the AST where as the other
22802 : // attribute based traversals visit only the embedded tree within the AST.
22803 :
22804 : // Initialize array to the address of the first element of the STL vector
22805 : // (which is guaranteed to be contiguous storage).
22806 : // SgEnumType objectArray [] = *(Memory_Block_List.begin());
22807 5668 : if (SgEnumType::pools.empty() == false)
22808 : {
22809 : // Generate an array of memory pools
22810 2905 : SgEnumType** objectArray = (SgEnumType**) &(SgEnumType::pools[0]);
22811 :
22812 : // Build a local variable for better performance
22813 2905 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
22814 : #if 0
22815 : // Iterate over the memory pools
22816 : for (unsigned int i=0; i < SgEnumType::pools.size(); i++)
22817 : {
22818 : // objectArray[i] is a single memory pool
22819 : for (int j=0; j < SgEnumType::pool_size; j++)
22820 : {
22821 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
22822 : {
22823 : traversal.visit(&(objectArray[i][j]));
22824 : }
22825 : }
22826 : }
22827 : #else
22828 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
22829 : // compute the list first and then call the visit function on each list element.
22830 :
22831 : // printf ("Inside of SgEnumType::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
22832 :
22833 5810 : std::vector<SgEnumType*> nodeList;
22834 :
22835 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
22836 5810 : for (unsigned int i=0; i < SgEnumType::pools.size(); i++)
22837 : {
22838 : // objectArray[i] is a single memory pool
22839 5812900 : for (unsigned j=0; j < SgEnumType::pool_size; j++)
22840 : {
22841 5810000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
22842 : {
22843 22704 : nodeList.push_back(&(objectArray[i][j]));
22844 : }
22845 : }
22846 : }
22847 :
22848 : // Iterate over the saved list
22849 2905 : size_t nodeListSize = nodeList.size();
22850 25609 : for (size_t i=0; i < nodeListSize; i++)
22851 : {
22852 22704 : ROSE_ASSERT(nodeList[i] != NULL);
22853 : #if 0
22854 : traversal.visit(nodeList[i]);
22855 : #else
22856 22704 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
22857 : {
22858 22704 : traversal.visit(nodeList[i]);
22859 : }
22860 : #endif
22861 : }
22862 : #endif
22863 : }
22864 :
22865 : // This should not be required since all previously static data members are
22866 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
22867 :
22868 5668 : }
22869 :
22870 :
22871 : void
22872 194 : SgEnumType::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
22873 : {
22874 : // This function traverses the memory pool for an IR node and
22875 : // calls the function to execute the visitor object.
22876 :
22877 : // Initialize array to the address of the first element of the STL vector
22878 : // (which is guarenteed to be contiguous storage).
22879 : // SgEnumType objectArray [] = *(Memory_Block_List.begin());
22880 194 : if (SgEnumType::pools.empty() == false)
22881 : {
22882 : // Generate an array of memory pools
22883 137 : SgEnumType** objectArray = (SgEnumType**) &(SgEnumType::pools[0]);
22884 :
22885 : // Build a local variable for better performance
22886 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
22887 :
22888 : // Iterate over the memory pools
22889 274 : for (unsigned int i=0; i < SgEnumType::pools.size(); i++)
22890 : {
22891 : // objectArray[i] is a single memory pool
22892 274137 : for (unsigned j=0; j < SgEnumType::pool_size; j++)
22893 : {
22894 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
22895 : {
22896 : // printf ("Found a valid SgEnumType object in the memory pool %d at position %d \n",i,j);
22897 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
22898 12005 : objectArray[i][j].executeVisitorMemberFunction(visitor);
22899 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
22900 : }
22901 : else
22902 : {
22903 : // printf ("Found a INVALID SgEnumType object in the memory pool \n");
22904 : }
22905 : }
22906 : }
22907 : }
22908 :
22909 : // This should not be required since all previously static data members are
22910 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
22911 :
22912 194 : }
22913 :
22914 : void
22915 0 : SgEnumType::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
22916 : {
22917 : // This function visits only a single IR node of the memory pool.
22918 : // it is typically called once for each type of IR node within
22919 : // the automatically generated function: traverseRepresentativeNodes().
22920 :
22921 : // Initialize array to the address of the first element of the STL vector
22922 : // (which is guarenteed to be contiguous storage).
22923 : // SgEnumType objectArray [] = *(Memory_Block_List.begin());
22924 0 : if (SgEnumType::pools.empty() == false)
22925 : {
22926 : // Generate an array of memory pools
22927 0 : SgEnumType** objectArray = (SgEnumType**) &(SgEnumType::pools[0]);
22928 :
22929 : // Build a local variable for better performance
22930 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
22931 :
22932 : // Iterate over the memory pools
22933 0 : bool done = false;
22934 0 : unsigned i=0;
22935 :
22936 : // find the first valid IR node, call visit function, and then leave
22937 0 : while ( done == false && i < SgEnumType::pools.size() )
22938 : {
22939 : // objectArray[i] is a single memory pool
22940 : unsigned j=0;
22941 0 : while (done == false && j < SgEnumType::pool_size)
22942 : {
22943 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
22944 : {
22945 0 : traversal.visit(&(objectArray[i][j]));
22946 0 : done = true;
22947 : }
22948 0 : j++;
22949 : }
22950 0 : i++;
22951 : }
22952 :
22953 : #if 0
22954 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
22955 : if (done == false)
22956 : {
22957 : printf ("No representative for SgEnumType found in memory pools \n");
22958 : }
22959 : #endif
22960 : }
22961 0 : }
22962 :
22963 :
22964 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
22965 : // using values that overflow signed values of int.
22966 : size_t
22967 4 : SgEnumType::numberOfNodes()
22968 : {
22969 : // This function traverses the memory pool for an IR node and
22970 : // counts the number of IR nodes of a particular Sage III IR
22971 : // nodes type.
22972 :
22973 4 : size_t count = 0;
22974 4 : if (SgEnumType::pools.empty() == false)
22975 : {
22976 : // Generate an array of memory pools (this is actually a STL vector,
22977 : // but it is contiguious, so OK to treat this way).
22978 1 : SgEnumType** objectArray = (SgEnumType**) &(SgEnumType::pools[0]);
22979 :
22980 : // Build a local variable for better performance (make it a loop invariant variable).
22981 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
22982 :
22983 : // Iterate over all of the memory pools for this IR node.
22984 2 : for (unsigned int i=0; i < SgEnumType::pools.size(); i++)
22985 : {
22986 : // objectArray[i] is a single memory pool, iterate over all the
22987 : // IR nodes and only count those that are valid IR nodes used in
22988 : // the AST (i.e. allocated IR nodes).
22989 2001 : for (unsigned j=0; j < SgEnumType::pool_size; j++)
22990 : {
22991 : // This is indexing the STL vector of C/C++ style arrays as a doubly
22992 : // indexed array access. It is OK since we have leveraged the semantics
22993 : // of STL vector memory as contigous and cast the memory as an array
22994 : // of arrays to use the 2D array indexing. Hope this is not confusing,
22995 : // but it s very fast as an implementation.
22996 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
22997 : {
22998 87 : count++;
22999 : }
23000 : }
23001 : }
23002 : }
23003 :
23004 :
23005 :
23006 4 : return count;
23007 : }
23008 :
23009 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
23010 : // using values that overflow signed values of int.
23011 : size_t
23012 0 : SgEnumType::memoryUsage()
23013 : {
23014 : // This function is required because we need the class name as a type when we call sizeof
23015 : // There might be another way to implement this if we have a traversal that only called a
23016 : // representative object (one call for each type of Sage IIIIR node).
23017 0 : size_t memory = numberOfNodes() * sizeof(SgEnumType);
23018 :
23019 0 : return memory;
23020 : }
23021 :
23022 : /* #line 23023 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
23023 :
23024 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
23025 : void
23026 5668 : SgTypedefType::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
23027 : {
23028 : // This function traverses the memory pool for only a specific IR node
23029 : // and calls the visit function of the input class execute a traversal
23030 : // similar to the style of the attribute based traversals within ROSE.
23031 : // This traversal will visit ALL nodes of the AST where as the other
23032 : // attribute based traversals visit only the embedded tree within the AST.
23033 :
23034 : // Initialize array to the address of the first element of the STL vector
23035 : // (which is guaranteed to be contiguous storage).
23036 : // SgTypedefType objectArray [] = *(Memory_Block_List.begin());
23037 5668 : if (SgTypedefType::pools.empty() == false)
23038 : {
23039 : // Generate an array of memory pools
23040 4892 : SgTypedefType** objectArray = (SgTypedefType**) &(SgTypedefType::pools[0]);
23041 :
23042 : // Build a local variable for better performance
23043 4892 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
23044 : #if 0
23045 : // Iterate over the memory pools
23046 : for (unsigned int i=0; i < SgTypedefType::pools.size(); i++)
23047 : {
23048 : // objectArray[i] is a single memory pool
23049 : for (int j=0; j < SgTypedefType::pool_size; j++)
23050 : {
23051 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
23052 : {
23053 : traversal.visit(&(objectArray[i][j]));
23054 : }
23055 : }
23056 : }
23057 : #else
23058 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
23059 : // compute the list first and then call the visit function on each list element.
23060 :
23061 : // printf ("Inside of SgTypedefType::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
23062 :
23063 9784 : std::vector<SgTypedefType*> nodeList;
23064 :
23065 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
23066 9784 : for (unsigned int i=0; i < SgTypedefType::pools.size(); i++)
23067 : {
23068 : // objectArray[i] is a single memory pool
23069 9788890 : for (unsigned j=0; j < SgTypedefType::pool_size; j++)
23070 : {
23071 9784000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
23072 : {
23073 813487 : nodeList.push_back(&(objectArray[i][j]));
23074 : }
23075 : }
23076 : }
23077 :
23078 : // Iterate over the saved list
23079 4892 : size_t nodeListSize = nodeList.size();
23080 818379 : for (size_t i=0; i < nodeListSize; i++)
23081 : {
23082 813487 : ROSE_ASSERT(nodeList[i] != NULL);
23083 : #if 0
23084 : traversal.visit(nodeList[i]);
23085 : #else
23086 813487 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
23087 : {
23088 813487 : traversal.visit(nodeList[i]);
23089 : }
23090 : #endif
23091 : }
23092 : #endif
23093 : }
23094 :
23095 : // This should not be required since all previously static data members are
23096 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
23097 :
23098 5668 : }
23099 :
23100 :
23101 : void
23102 194 : SgTypedefType::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
23103 : {
23104 : // This function traverses the memory pool for an IR node and
23105 : // calls the function to execute the visitor object.
23106 :
23107 : // Initialize array to the address of the first element of the STL vector
23108 : // (which is guarenteed to be contiguous storage).
23109 : // SgTypedefType objectArray [] = *(Memory_Block_List.begin());
23110 194 : if (SgTypedefType::pools.empty() == false)
23111 : {
23112 : // Generate an array of memory pools
23113 194 : SgTypedefType** objectArray = (SgTypedefType**) &(SgTypedefType::pools[0]);
23114 :
23115 : // Build a local variable for better performance
23116 194 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
23117 :
23118 : // Iterate over the memory pools
23119 388 : for (unsigned int i=0; i < SgTypedefType::pools.size(); i++)
23120 : {
23121 : // objectArray[i] is a single memory pool
23122 388194 : for (unsigned j=0; j < SgTypedefType::pool_size; j++)
23123 : {
23124 388000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
23125 : {
23126 : // printf ("Found a valid SgTypedefType object in the memory pool %d at position %d \n",i,j);
23127 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
23128 242426 : objectArray[i][j].executeVisitorMemberFunction(visitor);
23129 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
23130 : }
23131 : else
23132 : {
23133 : // printf ("Found a INVALID SgTypedefType object in the memory pool \n");
23134 : }
23135 : }
23136 : }
23137 : }
23138 :
23139 : // This should not be required since all previously static data members are
23140 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
23141 :
23142 194 : }
23143 :
23144 : void
23145 0 : SgTypedefType::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
23146 : {
23147 : // This function visits only a single IR node of the memory pool.
23148 : // it is typically called once for each type of IR node within
23149 : // the automatically generated function: traverseRepresentativeNodes().
23150 :
23151 : // Initialize array to the address of the first element of the STL vector
23152 : // (which is guarenteed to be contiguous storage).
23153 : // SgTypedefType objectArray [] = *(Memory_Block_List.begin());
23154 0 : if (SgTypedefType::pools.empty() == false)
23155 : {
23156 : // Generate an array of memory pools
23157 0 : SgTypedefType** objectArray = (SgTypedefType**) &(SgTypedefType::pools[0]);
23158 :
23159 : // Build a local variable for better performance
23160 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
23161 :
23162 : // Iterate over the memory pools
23163 0 : bool done = false;
23164 0 : unsigned i=0;
23165 :
23166 : // find the first valid IR node, call visit function, and then leave
23167 0 : while ( done == false && i < SgTypedefType::pools.size() )
23168 : {
23169 : // objectArray[i] is a single memory pool
23170 : unsigned j=0;
23171 0 : while (done == false && j < SgTypedefType::pool_size)
23172 : {
23173 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
23174 : {
23175 0 : traversal.visit(&(objectArray[i][j]));
23176 0 : done = true;
23177 : }
23178 0 : j++;
23179 : }
23180 0 : i++;
23181 : }
23182 :
23183 : #if 0
23184 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
23185 : if (done == false)
23186 : {
23187 : printf ("No representative for SgTypedefType found in memory pools \n");
23188 : }
23189 : #endif
23190 : }
23191 0 : }
23192 :
23193 :
23194 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
23195 : // using values that overflow signed values of int.
23196 : size_t
23197 4 : SgTypedefType::numberOfNodes()
23198 : {
23199 : // This function traverses the memory pool for an IR node and
23200 : // counts the number of IR nodes of a particular Sage III IR
23201 : // nodes type.
23202 :
23203 4 : size_t count = 0;
23204 4 : if (SgTypedefType::pools.empty() == false)
23205 : {
23206 : // Generate an array of memory pools (this is actually a STL vector,
23207 : // but it is contiguious, so OK to treat this way).
23208 2 : SgTypedefType** objectArray = (SgTypedefType**) &(SgTypedefType::pools[0]);
23209 :
23210 : // Build a local variable for better performance (make it a loop invariant variable).
23211 2 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
23212 :
23213 : // Iterate over all of the memory pools for this IR node.
23214 4 : for (unsigned int i=0; i < SgTypedefType::pools.size(); i++)
23215 : {
23216 : // objectArray[i] is a single memory pool, iterate over all the
23217 : // IR nodes and only count those that are valid IR nodes used in
23218 : // the AST (i.e. allocated IR nodes).
23219 4002 : for (unsigned j=0; j < SgTypedefType::pool_size; j++)
23220 : {
23221 : // This is indexing the STL vector of C/C++ style arrays as a doubly
23222 : // indexed array access. It is OK since we have leveraged the semantics
23223 : // of STL vector memory as contigous and cast the memory as an array
23224 : // of arrays to use the 2D array indexing. Hope this is not confusing,
23225 : // but it s very fast as an implementation.
23226 4000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
23227 : {
23228 1848 : count++;
23229 : }
23230 : }
23231 : }
23232 : }
23233 :
23234 :
23235 :
23236 4 : return count;
23237 : }
23238 :
23239 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
23240 : // using values that overflow signed values of int.
23241 : size_t
23242 0 : SgTypedefType::memoryUsage()
23243 : {
23244 : // This function is required because we need the class name as a type when we call sizeof
23245 : // There might be another way to implement this if we have a traversal that only called a
23246 : // representative object (one call for each type of Sage IIIIR node).
23247 0 : size_t memory = numberOfNodes() * sizeof(SgTypedefType);
23248 :
23249 0 : return memory;
23250 : }
23251 :
23252 : /* #line 23253 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
23253 :
23254 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
23255 : void
23256 5668 : SgNonrealType::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
23257 : {
23258 : // This function traverses the memory pool for only a specific IR node
23259 : // and calls the visit function of the input class execute a traversal
23260 : // similar to the style of the attribute based traversals within ROSE.
23261 : // This traversal will visit ALL nodes of the AST where as the other
23262 : // attribute based traversals visit only the embedded tree within the AST.
23263 :
23264 : // Initialize array to the address of the first element of the STL vector
23265 : // (which is guaranteed to be contiguous storage).
23266 : // SgNonrealType objectArray [] = *(Memory_Block_List.begin());
23267 5668 : if (SgNonrealType::pools.empty() == false)
23268 : {
23269 : // Generate an array of memory pools
23270 153 : SgNonrealType** objectArray = (SgNonrealType**) &(SgNonrealType::pools[0]);
23271 :
23272 : // Build a local variable for better performance
23273 153 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
23274 : #if 0
23275 : // Iterate over the memory pools
23276 : for (unsigned int i=0; i < SgNonrealType::pools.size(); i++)
23277 : {
23278 : // objectArray[i] is a single memory pool
23279 : for (int j=0; j < SgNonrealType::pool_size; j++)
23280 : {
23281 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
23282 : {
23283 : traversal.visit(&(objectArray[i][j]));
23284 : }
23285 : }
23286 : }
23287 : #else
23288 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
23289 : // compute the list first and then call the visit function on each list element.
23290 :
23291 : // printf ("Inside of SgNonrealType::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
23292 :
23293 306 : std::vector<SgNonrealType*> nodeList;
23294 :
23295 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
23296 596 : for (unsigned int i=0; i < SgNonrealType::pools.size(); i++)
23297 : {
23298 : // objectArray[i] is a single memory pool
23299 886443 : for (unsigned j=0; j < SgNonrealType::pool_size; j++)
23300 : {
23301 886000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
23302 : {
23303 717414 : nodeList.push_back(&(objectArray[i][j]));
23304 : }
23305 : }
23306 : }
23307 :
23308 : // Iterate over the saved list
23309 153 : size_t nodeListSize = nodeList.size();
23310 717567 : for (size_t i=0; i < nodeListSize; i++)
23311 : {
23312 717414 : ROSE_ASSERT(nodeList[i] != NULL);
23313 : #if 0
23314 : traversal.visit(nodeList[i]);
23315 : #else
23316 717414 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
23317 : {
23318 717414 : traversal.visit(nodeList[i]);
23319 : }
23320 : #endif
23321 : }
23322 : #endif
23323 : }
23324 :
23325 : // This should not be required since all previously static data members are
23326 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
23327 :
23328 5668 : }
23329 :
23330 :
23331 : void
23332 194 : SgNonrealType::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
23333 : {
23334 : // This function traverses the memory pool for an IR node and
23335 : // calls the function to execute the visitor object.
23336 :
23337 : // Initialize array to the address of the first element of the STL vector
23338 : // (which is guarenteed to be contiguous storage).
23339 : // SgNonrealType objectArray [] = *(Memory_Block_List.begin());
23340 194 : if (SgNonrealType::pools.empty() == false)
23341 : {
23342 : // Generate an array of memory pools
23343 137 : SgNonrealType** objectArray = (SgNonrealType**) &(SgNonrealType::pools[0]);
23344 :
23345 : // Build a local variable for better performance
23346 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
23347 :
23348 : // Iterate over the memory pools
23349 548 : for (unsigned int i=0; i < SgNonrealType::pools.size(); i++)
23350 : {
23351 : // objectArray[i] is a single memory pool
23352 822411 : for (unsigned j=0; j < SgNonrealType::pool_size; j++)
23353 : {
23354 822000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
23355 : {
23356 : // printf ("Found a valid SgNonrealType object in the memory pool %d at position %d \n",i,j);
23357 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
23358 704852 : objectArray[i][j].executeVisitorMemberFunction(visitor);
23359 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
23360 : }
23361 : else
23362 : {
23363 : // printf ("Found a INVALID SgNonrealType object in the memory pool \n");
23364 : }
23365 : }
23366 : }
23367 : }
23368 :
23369 : // This should not be required since all previously static data members are
23370 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
23371 :
23372 194 : }
23373 :
23374 : void
23375 0 : SgNonrealType::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
23376 : {
23377 : // This function visits only a single IR node of the memory pool.
23378 : // it is typically called once for each type of IR node within
23379 : // the automatically generated function: traverseRepresentativeNodes().
23380 :
23381 : // Initialize array to the address of the first element of the STL vector
23382 : // (which is guarenteed to be contiguous storage).
23383 : // SgNonrealType objectArray [] = *(Memory_Block_List.begin());
23384 0 : if (SgNonrealType::pools.empty() == false)
23385 : {
23386 : // Generate an array of memory pools
23387 0 : SgNonrealType** objectArray = (SgNonrealType**) &(SgNonrealType::pools[0]);
23388 :
23389 : // Build a local variable for better performance
23390 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
23391 :
23392 : // Iterate over the memory pools
23393 0 : bool done = false;
23394 0 : unsigned i=0;
23395 :
23396 : // find the first valid IR node, call visit function, and then leave
23397 0 : while ( done == false && i < SgNonrealType::pools.size() )
23398 : {
23399 : // objectArray[i] is a single memory pool
23400 : unsigned j=0;
23401 0 : while (done == false && j < SgNonrealType::pool_size)
23402 : {
23403 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
23404 : {
23405 0 : traversal.visit(&(objectArray[i][j]));
23406 0 : done = true;
23407 : }
23408 0 : j++;
23409 : }
23410 0 : i++;
23411 : }
23412 :
23413 : #if 0
23414 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
23415 : if (done == false)
23416 : {
23417 : printf ("No representative for SgNonrealType found in memory pools \n");
23418 : }
23419 : #endif
23420 : }
23421 0 : }
23422 :
23423 :
23424 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
23425 : // using values that overflow signed values of int.
23426 : size_t
23427 4 : SgNonrealType::numberOfNodes()
23428 : {
23429 : // This function traverses the memory pool for an IR node and
23430 : // counts the number of IR nodes of a particular Sage III IR
23431 : // nodes type.
23432 :
23433 4 : size_t count = 0;
23434 4 : if (SgNonrealType::pools.empty() == false)
23435 : {
23436 : // Generate an array of memory pools (this is actually a STL vector,
23437 : // but it is contiguious, so OK to treat this way).
23438 1 : SgNonrealType** objectArray = (SgNonrealType**) &(SgNonrealType::pools[0]);
23439 :
23440 : // Build a local variable for better performance (make it a loop invariant variable).
23441 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
23442 :
23443 : // Iterate over all of the memory pools for this IR node.
23444 4 : for (unsigned int i=0; i < SgNonrealType::pools.size(); i++)
23445 : {
23446 : // objectArray[i] is a single memory pool, iterate over all the
23447 : // IR nodes and only count those that are valid IR nodes used in
23448 : // the AST (i.e. allocated IR nodes).
23449 6003 : for (unsigned j=0; j < SgNonrealType::pool_size; j++)
23450 : {
23451 : // This is indexing the STL vector of C/C++ style arrays as a doubly
23452 : // indexed array access. It is OK since we have leveraged the semantics
23453 : // of STL vector memory as contigous and cast the memory as an array
23454 : // of arrays to use the 2D array indexing. Hope this is not confusing,
23455 : // but it s very fast as an implementation.
23456 6000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
23457 : {
23458 5080 : count++;
23459 : }
23460 : }
23461 : }
23462 : }
23463 :
23464 :
23465 :
23466 4 : return count;
23467 : }
23468 :
23469 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
23470 : // using values that overflow signed values of int.
23471 : size_t
23472 0 : SgNonrealType::memoryUsage()
23473 : {
23474 : // This function is required because we need the class name as a type when we call sizeof
23475 : // There might be another way to implement this if we have a traversal that only called a
23476 : // representative object (one call for each type of Sage IIIIR node).
23477 0 : size_t memory = numberOfNodes() * sizeof(SgNonrealType);
23478 :
23479 0 : return memory;
23480 : }
23481 :
23482 : /* #line 23483 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
23483 :
23484 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
23485 : void
23486 5988 : SgModifierType::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
23487 : {
23488 : // This function traverses the memory pool for only a specific IR node
23489 : // and calls the visit function of the input class execute a traversal
23490 : // similar to the style of the attribute based traversals within ROSE.
23491 : // This traversal will visit ALL nodes of the AST where as the other
23492 : // attribute based traversals visit only the embedded tree within the AST.
23493 :
23494 : // Initialize array to the address of the first element of the STL vector
23495 : // (which is guaranteed to be contiguous storage).
23496 : // SgModifierType objectArray [] = *(Memory_Block_List.begin());
23497 5988 : if (SgModifierType::pools.empty() == false)
23498 : {
23499 : // Generate an array of memory pools
23500 5212 : SgModifierType** objectArray = (SgModifierType**) &(SgModifierType::pools[0]);
23501 :
23502 : // Build a local variable for better performance
23503 5212 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
23504 : #if 0
23505 : // Iterate over the memory pools
23506 : for (unsigned int i=0; i < SgModifierType::pools.size(); i++)
23507 : {
23508 : // objectArray[i] is a single memory pool
23509 : for (int j=0; j < SgModifierType::pool_size; j++)
23510 : {
23511 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
23512 : {
23513 : traversal.visit(&(objectArray[i][j]));
23514 : }
23515 : }
23516 : }
23517 : #else
23518 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
23519 : // compute the list first and then call the visit function on each list element.
23520 :
23521 : // printf ("Inside of SgModifierType::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
23522 :
23523 10424 : std::vector<SgModifierType*> nodeList;
23524 :
23525 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
23526 10424 : for (unsigned int i=0; i < SgModifierType::pools.size(); i++)
23527 : {
23528 : // objectArray[i] is a single memory pool
23529 10429200 : for (unsigned j=0; j < SgModifierType::pool_size; j++)
23530 : {
23531 10424000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
23532 : {
23533 354692 : nodeList.push_back(&(objectArray[i][j]));
23534 : }
23535 : }
23536 : }
23537 :
23538 : // Iterate over the saved list
23539 5212 : size_t nodeListSize = nodeList.size();
23540 359904 : for (size_t i=0; i < nodeListSize; i++)
23541 : {
23542 354692 : ROSE_ASSERT(nodeList[i] != NULL);
23543 : #if 0
23544 : traversal.visit(nodeList[i]);
23545 : #else
23546 354692 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
23547 : {
23548 354692 : traversal.visit(nodeList[i]);
23549 : }
23550 : #endif
23551 : }
23552 : #endif
23553 : }
23554 :
23555 : // This should not be required since all previously static data members are
23556 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
23557 :
23558 5988 : }
23559 :
23560 :
23561 : void
23562 194 : SgModifierType::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
23563 : {
23564 : // This function traverses the memory pool for an IR node and
23565 : // calls the function to execute the visitor object.
23566 :
23567 : // Initialize array to the address of the first element of the STL vector
23568 : // (which is guarenteed to be contiguous storage).
23569 : // SgModifierType objectArray [] = *(Memory_Block_List.begin());
23570 194 : if (SgModifierType::pools.empty() == false)
23571 : {
23572 : // Generate an array of memory pools
23573 194 : SgModifierType** objectArray = (SgModifierType**) &(SgModifierType::pools[0]);
23574 :
23575 : // Build a local variable for better performance
23576 194 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
23577 :
23578 : // Iterate over the memory pools
23579 388 : for (unsigned int i=0; i < SgModifierType::pools.size(); i++)
23580 : {
23581 : // objectArray[i] is a single memory pool
23582 388194 : for (unsigned j=0; j < SgModifierType::pool_size; j++)
23583 : {
23584 388000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
23585 : {
23586 : // printf ("Found a valid SgModifierType object in the memory pool %d at position %d \n",i,j);
23587 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
23588 118952 : objectArray[i][j].executeVisitorMemberFunction(visitor);
23589 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
23590 : }
23591 : else
23592 : {
23593 : // printf ("Found a INVALID SgModifierType object in the memory pool \n");
23594 : }
23595 : }
23596 : }
23597 : }
23598 :
23599 : // This should not be required since all previously static data members are
23600 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
23601 :
23602 194 : }
23603 :
23604 : void
23605 0 : SgModifierType::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
23606 : {
23607 : // This function visits only a single IR node of the memory pool.
23608 : // it is typically called once for each type of IR node within
23609 : // the automatically generated function: traverseRepresentativeNodes().
23610 :
23611 : // Initialize array to the address of the first element of the STL vector
23612 : // (which is guarenteed to be contiguous storage).
23613 : // SgModifierType objectArray [] = *(Memory_Block_List.begin());
23614 0 : if (SgModifierType::pools.empty() == false)
23615 : {
23616 : // Generate an array of memory pools
23617 0 : SgModifierType** objectArray = (SgModifierType**) &(SgModifierType::pools[0]);
23618 :
23619 : // Build a local variable for better performance
23620 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
23621 :
23622 : // Iterate over the memory pools
23623 0 : bool done = false;
23624 0 : unsigned i=0;
23625 :
23626 : // find the first valid IR node, call visit function, and then leave
23627 0 : while ( done == false && i < SgModifierType::pools.size() )
23628 : {
23629 : // objectArray[i] is a single memory pool
23630 : unsigned j=0;
23631 0 : while (done == false && j < SgModifierType::pool_size)
23632 : {
23633 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
23634 : {
23635 0 : traversal.visit(&(objectArray[i][j]));
23636 0 : done = true;
23637 : }
23638 0 : j++;
23639 : }
23640 0 : i++;
23641 : }
23642 :
23643 : #if 0
23644 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
23645 : if (done == false)
23646 : {
23647 : printf ("No representative for SgModifierType found in memory pools \n");
23648 : }
23649 : #endif
23650 : }
23651 0 : }
23652 :
23653 :
23654 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
23655 : // using values that overflow signed values of int.
23656 : size_t
23657 4 : SgModifierType::numberOfNodes()
23658 : {
23659 : // This function traverses the memory pool for an IR node and
23660 : // counts the number of IR nodes of a particular Sage III IR
23661 : // nodes type.
23662 :
23663 4 : size_t count = 0;
23664 4 : if (SgModifierType::pools.empty() == false)
23665 : {
23666 : // Generate an array of memory pools (this is actually a STL vector,
23667 : // but it is contiguious, so OK to treat this way).
23668 2 : SgModifierType** objectArray = (SgModifierType**) &(SgModifierType::pools[0]);
23669 :
23670 : // Build a local variable for better performance (make it a loop invariant variable).
23671 2 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
23672 :
23673 : // Iterate over all of the memory pools for this IR node.
23674 4 : for (unsigned int i=0; i < SgModifierType::pools.size(); i++)
23675 : {
23676 : // objectArray[i] is a single memory pool, iterate over all the
23677 : // IR nodes and only count those that are valid IR nodes used in
23678 : // the AST (i.e. allocated IR nodes).
23679 4002 : for (unsigned j=0; j < SgModifierType::pool_size; j++)
23680 : {
23681 : // This is indexing the STL vector of C/C++ style arrays as a doubly
23682 : // indexed array access. It is OK since we have leveraged the semantics
23683 : // of STL vector memory as contigous and cast the memory as an array
23684 : // of arrays to use the 2D array indexing. Hope this is not confusing,
23685 : // but it s very fast as an implementation.
23686 4000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
23687 : {
23688 876 : count++;
23689 : }
23690 : }
23691 : }
23692 : }
23693 :
23694 :
23695 :
23696 4 : return count;
23697 : }
23698 :
23699 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
23700 : // using values that overflow signed values of int.
23701 : size_t
23702 0 : SgModifierType::memoryUsage()
23703 : {
23704 : // This function is required because we need the class name as a type when we call sizeof
23705 : // There might be another way to implement this if we have a traversal that only called a
23706 : // representative object (one call for each type of Sage IIIIR node).
23707 0 : size_t memory = numberOfNodes() * sizeof(SgModifierType);
23708 :
23709 0 : return memory;
23710 : }
23711 :
23712 : /* #line 23713 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
23713 :
23714 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
23715 : void
23716 6025 : SgFunctionType::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
23717 : {
23718 : // This function traverses the memory pool for only a specific IR node
23719 : // and calls the visit function of the input class execute a traversal
23720 : // similar to the style of the attribute based traversals within ROSE.
23721 : // This traversal will visit ALL nodes of the AST where as the other
23722 : // attribute based traversals visit only the embedded tree within the AST.
23723 :
23724 : // Initialize array to the address of the first element of the STL vector
23725 : // (which is guaranteed to be contiguous storage).
23726 : // SgFunctionType objectArray [] = *(Memory_Block_List.begin());
23727 6025 : if (SgFunctionType::pools.empty() == false)
23728 : {
23729 : // Generate an array of memory pools
23730 5983 : SgFunctionType** objectArray = (SgFunctionType**) &(SgFunctionType::pools[0]);
23731 :
23732 : // Build a local variable for better performance
23733 5983 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
23734 : #if 0
23735 : // Iterate over the memory pools
23736 : for (unsigned int i=0; i < SgFunctionType::pools.size(); i++)
23737 : {
23738 : // objectArray[i] is a single memory pool
23739 : for (int j=0; j < SgFunctionType::pool_size; j++)
23740 : {
23741 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
23742 : {
23743 : traversal.visit(&(objectArray[i][j]));
23744 : }
23745 : }
23746 : }
23747 : #else
23748 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
23749 : // compute the list first and then call the visit function on each list element.
23750 :
23751 : // printf ("Inside of SgFunctionType::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
23752 :
23753 11966 : std::vector<SgFunctionType*> nodeList;
23754 :
23755 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
23756 12095 : for (unsigned int i=0; i < SgFunctionType::pools.size(); i++)
23757 : {
23758 : // objectArray[i] is a single memory pool
23759 12230100 : for (unsigned j=0; j < SgFunctionType::pool_size; j++)
23760 : {
23761 12224000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
23762 : {
23763 3822400 : nodeList.push_back(&(objectArray[i][j]));
23764 : }
23765 : }
23766 : }
23767 :
23768 : // Iterate over the saved list
23769 5983 : size_t nodeListSize = nodeList.size();
23770 3828380 : for (size_t i=0; i < nodeListSize; i++)
23771 : {
23772 3822400 : ROSE_ASSERT(nodeList[i] != NULL);
23773 : #if 0
23774 : traversal.visit(nodeList[i]);
23775 : #else
23776 3822400 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
23777 : {
23778 3822400 : traversal.visit(nodeList[i]);
23779 : }
23780 : #endif
23781 : }
23782 : #endif
23783 : }
23784 :
23785 : // This should not be required since all previously static data members are
23786 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
23787 :
23788 6025 : }
23789 :
23790 :
23791 : void
23792 194 : SgFunctionType::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
23793 : {
23794 : // This function traverses the memory pool for an IR node and
23795 : // calls the function to execute the visitor object.
23796 :
23797 : // Initialize array to the address of the first element of the STL vector
23798 : // (which is guarenteed to be contiguous storage).
23799 : // SgFunctionType objectArray [] = *(Memory_Block_List.begin());
23800 194 : if (SgFunctionType::pools.empty() == false)
23801 : {
23802 : // Generate an array of memory pools
23803 194 : SgFunctionType** objectArray = (SgFunctionType**) &(SgFunctionType::pools[0]);
23804 :
23805 : // Build a local variable for better performance
23806 194 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
23807 :
23808 : // Iterate over the memory pools
23809 525 : for (unsigned int i=0; i < SgFunctionType::pools.size(); i++)
23810 : {
23811 : // objectArray[i] is a single memory pool
23812 662331 : for (unsigned j=0; j < SgFunctionType::pool_size; j++)
23813 : {
23814 662000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
23815 : {
23816 : // printf ("Found a valid SgFunctionType object in the memory pool %d at position %d \n",i,j);
23817 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
23818 382485 : objectArray[i][j].executeVisitorMemberFunction(visitor);
23819 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
23820 : }
23821 : else
23822 : {
23823 : // printf ("Found a INVALID SgFunctionType object in the memory pool \n");
23824 : }
23825 : }
23826 : }
23827 : }
23828 :
23829 : // This should not be required since all previously static data members are
23830 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
23831 :
23832 194 : }
23833 :
23834 : void
23835 0 : SgFunctionType::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
23836 : {
23837 : // This function visits only a single IR node of the memory pool.
23838 : // it is typically called once for each type of IR node within
23839 : // the automatically generated function: traverseRepresentativeNodes().
23840 :
23841 : // Initialize array to the address of the first element of the STL vector
23842 : // (which is guarenteed to be contiguous storage).
23843 : // SgFunctionType objectArray [] = *(Memory_Block_List.begin());
23844 0 : if (SgFunctionType::pools.empty() == false)
23845 : {
23846 : // Generate an array of memory pools
23847 0 : SgFunctionType** objectArray = (SgFunctionType**) &(SgFunctionType::pools[0]);
23848 :
23849 : // Build a local variable for better performance
23850 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
23851 :
23852 : // Iterate over the memory pools
23853 0 : bool done = false;
23854 0 : unsigned i=0;
23855 :
23856 : // find the first valid IR node, call visit function, and then leave
23857 0 : while ( done == false && i < SgFunctionType::pools.size() )
23858 : {
23859 : // objectArray[i] is a single memory pool
23860 : unsigned j=0;
23861 0 : while (done == false && j < SgFunctionType::pool_size)
23862 : {
23863 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
23864 : {
23865 0 : traversal.visit(&(objectArray[i][j]));
23866 0 : done = true;
23867 : }
23868 0 : j++;
23869 : }
23870 0 : i++;
23871 : }
23872 :
23873 : #if 0
23874 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
23875 : if (done == false)
23876 : {
23877 : printf ("No representative for SgFunctionType found in memory pools \n");
23878 : }
23879 : #endif
23880 : }
23881 0 : }
23882 :
23883 :
23884 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
23885 : // using values that overflow signed values of int.
23886 : size_t
23887 4 : SgFunctionType::numberOfNodes()
23888 : {
23889 : // This function traverses the memory pool for an IR node and
23890 : // counts the number of IR nodes of a particular Sage III IR
23891 : // nodes type.
23892 :
23893 4 : size_t count = 0;
23894 4 : if (SgFunctionType::pools.empty() == false)
23895 : {
23896 : // Generate an array of memory pools (this is actually a STL vector,
23897 : // but it is contiguious, so OK to treat this way).
23898 4 : SgFunctionType** objectArray = (SgFunctionType**) &(SgFunctionType::pools[0]);
23899 :
23900 : // Build a local variable for better performance (make it a loop invariant variable).
23901 4 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
23902 :
23903 : // Iterate over all of the memory pools for this IR node.
23904 9 : for (unsigned int i=0; i < SgFunctionType::pools.size(); i++)
23905 : {
23906 : // objectArray[i] is a single memory pool, iterate over all the
23907 : // IR nodes and only count those that are valid IR nodes used in
23908 : // the AST (i.e. allocated IR nodes).
23909 10005 : for (unsigned j=0; j < SgFunctionType::pool_size; j++)
23910 : {
23911 : // This is indexing the STL vector of C/C++ style arrays as a doubly
23912 : // indexed array access. It is OK since we have leveraged the semantics
23913 : // of STL vector memory as contigous and cast the memory as an array
23914 : // of arrays to use the 2D array indexing. Hope this is not confusing,
23915 : // but it s very fast as an implementation.
23916 10000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
23917 : {
23918 3152 : count++;
23919 : }
23920 : }
23921 : }
23922 : }
23923 :
23924 :
23925 :
23926 4 : return count;
23927 : }
23928 :
23929 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
23930 : // using values that overflow signed values of int.
23931 : size_t
23932 0 : SgFunctionType::memoryUsage()
23933 : {
23934 : // This function is required because we need the class name as a type when we call sizeof
23935 : // There might be another way to implement this if we have a traversal that only called a
23936 : // representative object (one call for each type of Sage IIIIR node).
23937 0 : size_t memory = numberOfNodes() * sizeof(SgFunctionType);
23938 :
23939 0 : return memory;
23940 : }
23941 :
23942 : /* #line 23943 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
23943 :
23944 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
23945 : void
23946 6025 : SgMemberFunctionType::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
23947 : {
23948 : // This function traverses the memory pool for only a specific IR node
23949 : // and calls the visit function of the input class execute a traversal
23950 : // similar to the style of the attribute based traversals within ROSE.
23951 : // This traversal will visit ALL nodes of the AST where as the other
23952 : // attribute based traversals visit only the embedded tree within the AST.
23953 :
23954 : // Initialize array to the address of the first element of the STL vector
23955 : // (which is guaranteed to be contiguous storage).
23956 : // SgMemberFunctionType objectArray [] = *(Memory_Block_List.begin());
23957 6025 : if (SgMemberFunctionType::pools.empty() == false)
23958 : {
23959 : // Generate an array of memory pools
23960 264 : SgMemberFunctionType** objectArray = (SgMemberFunctionType**) &(SgMemberFunctionType::pools[0]);
23961 :
23962 : // Build a local variable for better performance
23963 264 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
23964 : #if 0
23965 : // Iterate over the memory pools
23966 : for (unsigned int i=0; i < SgMemberFunctionType::pools.size(); i++)
23967 : {
23968 : // objectArray[i] is a single memory pool
23969 : for (int j=0; j < SgMemberFunctionType::pool_size; j++)
23970 : {
23971 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
23972 : {
23973 : traversal.visit(&(objectArray[i][j]));
23974 : }
23975 : }
23976 : }
23977 : #else
23978 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
23979 : // compute the list first and then call the visit function on each list element.
23980 :
23981 : // printf ("Inside of SgMemberFunctionType::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
23982 :
23983 528 : std::vector<SgMemberFunctionType*> nodeList;
23984 :
23985 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
23986 657 : for (unsigned int i=0; i < SgMemberFunctionType::pools.size(); i++)
23987 : {
23988 : // objectArray[i] is a single memory pool
23989 786393 : for (unsigned j=0; j < SgMemberFunctionType::pool_size; j++)
23990 : {
23991 786000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
23992 : {
23993 301640 : nodeList.push_back(&(objectArray[i][j]));
23994 : }
23995 : }
23996 : }
23997 :
23998 : // Iterate over the saved list
23999 264 : size_t nodeListSize = nodeList.size();
24000 301904 : for (size_t i=0; i < nodeListSize; i++)
24001 : {
24002 301640 : ROSE_ASSERT(nodeList[i] != NULL);
24003 : #if 0
24004 : traversal.visit(nodeList[i]);
24005 : #else
24006 301640 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
24007 : {
24008 301640 : traversal.visit(nodeList[i]);
24009 : }
24010 : #endif
24011 : }
24012 : #endif
24013 : }
24014 :
24015 : // This should not be required since all previously static data members are
24016 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
24017 :
24018 6025 : }
24019 :
24020 :
24021 : void
24022 194 : SgMemberFunctionType::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
24023 : {
24024 : // This function traverses the memory pool for an IR node and
24025 : // calls the function to execute the visitor object.
24026 :
24027 : // Initialize array to the address of the first element of the STL vector
24028 : // (which is guarenteed to be contiguous storage).
24029 : // SgMemberFunctionType objectArray [] = *(Memory_Block_List.begin());
24030 194 : if (SgMemberFunctionType::pools.empty() == false)
24031 : {
24032 : // Generate an array of memory pools
24033 137 : SgMemberFunctionType** objectArray = (SgMemberFunctionType**) &(SgMemberFunctionType::pools[0]);
24034 :
24035 : // Build a local variable for better performance
24036 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
24037 :
24038 : // Iterate over the memory pools
24039 411 : for (unsigned int i=0; i < SgMemberFunctionType::pools.size(); i++)
24040 : {
24041 : // objectArray[i] is a single memory pool
24042 548274 : for (unsigned j=0; j < SgMemberFunctionType::pool_size; j++)
24043 : {
24044 548000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
24045 : {
24046 : // printf ("Found a valid SgMemberFunctionType object in the memory pool %d at position %d \n",i,j);
24047 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
24048 301911 : objectArray[i][j].executeVisitorMemberFunction(visitor);
24049 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
24050 : }
24051 : else
24052 : {
24053 : // printf ("Found a INVALID SgMemberFunctionType object in the memory pool \n");
24054 : }
24055 : }
24056 : }
24057 : }
24058 :
24059 : // This should not be required since all previously static data members are
24060 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
24061 :
24062 194 : }
24063 :
24064 : void
24065 0 : SgMemberFunctionType::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
24066 : {
24067 : // This function visits only a single IR node of the memory pool.
24068 : // it is typically called once for each type of IR node within
24069 : // the automatically generated function: traverseRepresentativeNodes().
24070 :
24071 : // Initialize array to the address of the first element of the STL vector
24072 : // (which is guarenteed to be contiguous storage).
24073 : // SgMemberFunctionType objectArray [] = *(Memory_Block_List.begin());
24074 0 : if (SgMemberFunctionType::pools.empty() == false)
24075 : {
24076 : // Generate an array of memory pools
24077 0 : SgMemberFunctionType** objectArray = (SgMemberFunctionType**) &(SgMemberFunctionType::pools[0]);
24078 :
24079 : // Build a local variable for better performance
24080 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
24081 :
24082 : // Iterate over the memory pools
24083 0 : bool done = false;
24084 0 : unsigned i=0;
24085 :
24086 : // find the first valid IR node, call visit function, and then leave
24087 0 : while ( done == false && i < SgMemberFunctionType::pools.size() )
24088 : {
24089 : // objectArray[i] is a single memory pool
24090 : unsigned j=0;
24091 0 : while (done == false && j < SgMemberFunctionType::pool_size)
24092 : {
24093 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
24094 : {
24095 0 : traversal.visit(&(objectArray[i][j]));
24096 0 : done = true;
24097 : }
24098 0 : j++;
24099 : }
24100 0 : i++;
24101 : }
24102 :
24103 : #if 0
24104 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
24105 : if (done == false)
24106 : {
24107 : printf ("No representative for SgMemberFunctionType found in memory pools \n");
24108 : }
24109 : #endif
24110 : }
24111 0 : }
24112 :
24113 :
24114 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
24115 : // using values that overflow signed values of int.
24116 : size_t
24117 4 : SgMemberFunctionType::numberOfNodes()
24118 : {
24119 : // This function traverses the memory pool for an IR node and
24120 : // counts the number of IR nodes of a particular Sage III IR
24121 : // nodes type.
24122 :
24123 4 : size_t count = 0;
24124 4 : if (SgMemberFunctionType::pools.empty() == false)
24125 : {
24126 : // Generate an array of memory pools (this is actually a STL vector,
24127 : // but it is contiguious, so OK to treat this way).
24128 1 : SgMemberFunctionType** objectArray = (SgMemberFunctionType**) &(SgMemberFunctionType::pools[0]);
24129 :
24130 : // Build a local variable for better performance (make it a loop invariant variable).
24131 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
24132 :
24133 : // Iterate over all of the memory pools for this IR node.
24134 3 : for (unsigned int i=0; i < SgMemberFunctionType::pools.size(); i++)
24135 : {
24136 : // objectArray[i] is a single memory pool, iterate over all the
24137 : // IR nodes and only count those that are valid IR nodes used in
24138 : // the AST (i.e. allocated IR nodes).
24139 4002 : for (unsigned j=0; j < SgMemberFunctionType::pool_size; j++)
24140 : {
24141 : // This is indexing the STL vector of C/C++ style arrays as a doubly
24142 : // indexed array access. It is OK since we have leveraged the semantics
24143 : // of STL vector memory as contigous and cast the memory as an array
24144 : // of arrays to use the 2D array indexing. Hope this is not confusing,
24145 : // but it s very fast as an implementation.
24146 4000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
24147 : {
24148 2167 : count++;
24149 : }
24150 : }
24151 : }
24152 : }
24153 :
24154 :
24155 :
24156 4 : return count;
24157 : }
24158 :
24159 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
24160 : // using values that overflow signed values of int.
24161 : size_t
24162 0 : SgMemberFunctionType::memoryUsage()
24163 : {
24164 : // This function is required because we need the class name as a type when we call sizeof
24165 : // There might be another way to implement this if we have a traversal that only called a
24166 : // representative object (one call for each type of Sage IIIIR node).
24167 0 : size_t memory = numberOfNodes() * sizeof(SgMemberFunctionType);
24168 :
24169 0 : return memory;
24170 : }
24171 :
24172 : /* #line 24173 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
24173 :
24174 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
24175 : void
24176 5668 : SgPartialFunctionType::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
24177 : {
24178 : // This function traverses the memory pool for only a specific IR node
24179 : // and calls the visit function of the input class execute a traversal
24180 : // similar to the style of the attribute based traversals within ROSE.
24181 : // This traversal will visit ALL nodes of the AST where as the other
24182 : // attribute based traversals visit only the embedded tree within the AST.
24183 :
24184 : // Initialize array to the address of the first element of the STL vector
24185 : // (which is guaranteed to be contiguous storage).
24186 : // SgPartialFunctionType objectArray [] = *(Memory_Block_List.begin());
24187 5668 : if (SgPartialFunctionType::pools.empty() == false)
24188 : {
24189 : // Generate an array of memory pools
24190 242 : SgPartialFunctionType** objectArray = (SgPartialFunctionType**) &(SgPartialFunctionType::pools[0]);
24191 :
24192 : // Build a local variable for better performance
24193 242 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
24194 : #if 0
24195 : // Iterate over the memory pools
24196 : for (unsigned int i=0; i < SgPartialFunctionType::pools.size(); i++)
24197 : {
24198 : // objectArray[i] is a single memory pool
24199 : for (int j=0; j < SgPartialFunctionType::pool_size; j++)
24200 : {
24201 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
24202 : {
24203 : traversal.visit(&(objectArray[i][j]));
24204 : }
24205 : }
24206 : }
24207 : #else
24208 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
24209 : // compute the list first and then call the visit function on each list element.
24210 :
24211 : // printf ("Inside of SgPartialFunctionType::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
24212 :
24213 484 : std::vector<SgPartialFunctionType*> nodeList;
24214 :
24215 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
24216 484 : for (unsigned int i=0; i < SgPartialFunctionType::pools.size(); i++)
24217 : {
24218 : // objectArray[i] is a single memory pool
24219 484242 : for (unsigned j=0; j < SgPartialFunctionType::pool_size; j++)
24220 : {
24221 484000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
24222 : {
24223 0 : nodeList.push_back(&(objectArray[i][j]));
24224 : }
24225 : }
24226 : }
24227 :
24228 : // Iterate over the saved list
24229 242 : size_t nodeListSize = nodeList.size();
24230 242 : for (size_t i=0; i < nodeListSize; i++)
24231 : {
24232 0 : ROSE_ASSERT(nodeList[i] != NULL);
24233 : #if 0
24234 : traversal.visit(nodeList[i]);
24235 : #else
24236 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
24237 : {
24238 0 : traversal.visit(nodeList[i]);
24239 : }
24240 : #endif
24241 : }
24242 : #endif
24243 : }
24244 :
24245 : // This should not be required since all previously static data members are
24246 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
24247 :
24248 5668 : }
24249 :
24250 :
24251 : void
24252 194 : SgPartialFunctionType::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
24253 : {
24254 : // This function traverses the memory pool for an IR node and
24255 : // calls the function to execute the visitor object.
24256 :
24257 : // Initialize array to the address of the first element of the STL vector
24258 : // (which is guarenteed to be contiguous storage).
24259 : // SgPartialFunctionType objectArray [] = *(Memory_Block_List.begin());
24260 194 : if (SgPartialFunctionType::pools.empty() == false)
24261 : {
24262 : // Generate an array of memory pools
24263 137 : SgPartialFunctionType** objectArray = (SgPartialFunctionType**) &(SgPartialFunctionType::pools[0]);
24264 :
24265 : // Build a local variable for better performance
24266 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
24267 :
24268 : // Iterate over the memory pools
24269 274 : for (unsigned int i=0; i < SgPartialFunctionType::pools.size(); i++)
24270 : {
24271 : // objectArray[i] is a single memory pool
24272 274137 : for (unsigned j=0; j < SgPartialFunctionType::pool_size; j++)
24273 : {
24274 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
24275 : {
24276 : // printf ("Found a valid SgPartialFunctionType object in the memory pool %d at position %d \n",i,j);
24277 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
24278 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
24279 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
24280 : }
24281 : else
24282 : {
24283 : // printf ("Found a INVALID SgPartialFunctionType object in the memory pool \n");
24284 : }
24285 : }
24286 : }
24287 : }
24288 :
24289 : // This should not be required since all previously static data members are
24290 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
24291 :
24292 194 : }
24293 :
24294 : void
24295 0 : SgPartialFunctionType::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
24296 : {
24297 : // This function visits only a single IR node of the memory pool.
24298 : // it is typically called once for each type of IR node within
24299 : // the automatically generated function: traverseRepresentativeNodes().
24300 :
24301 : // Initialize array to the address of the first element of the STL vector
24302 : // (which is guarenteed to be contiguous storage).
24303 : // SgPartialFunctionType objectArray [] = *(Memory_Block_List.begin());
24304 0 : if (SgPartialFunctionType::pools.empty() == false)
24305 : {
24306 : // Generate an array of memory pools
24307 0 : SgPartialFunctionType** objectArray = (SgPartialFunctionType**) &(SgPartialFunctionType::pools[0]);
24308 :
24309 : // Build a local variable for better performance
24310 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
24311 :
24312 : // Iterate over the memory pools
24313 0 : bool done = false;
24314 0 : unsigned i=0;
24315 :
24316 : // find the first valid IR node, call visit function, and then leave
24317 0 : while ( done == false && i < SgPartialFunctionType::pools.size() )
24318 : {
24319 : // objectArray[i] is a single memory pool
24320 : unsigned j=0;
24321 0 : while (done == false && j < SgPartialFunctionType::pool_size)
24322 : {
24323 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
24324 : {
24325 0 : traversal.visit(&(objectArray[i][j]));
24326 0 : done = true;
24327 : }
24328 0 : j++;
24329 : }
24330 0 : i++;
24331 : }
24332 :
24333 : #if 0
24334 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
24335 : if (done == false)
24336 : {
24337 : printf ("No representative for SgPartialFunctionType found in memory pools \n");
24338 : }
24339 : #endif
24340 : }
24341 0 : }
24342 :
24343 :
24344 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
24345 : // using values that overflow signed values of int.
24346 : size_t
24347 330 : SgPartialFunctionType::numberOfNodes()
24348 : {
24349 : // This function traverses the memory pool for an IR node and
24350 : // counts the number of IR nodes of a particular Sage III IR
24351 : // nodes type.
24352 :
24353 330 : size_t count = 0;
24354 330 : if (SgPartialFunctionType::pools.empty() == false)
24355 : {
24356 : // Generate an array of memory pools (this is actually a STL vector,
24357 : // but it is contiguious, so OK to treat this way).
24358 15 : SgPartialFunctionType** objectArray = (SgPartialFunctionType**) &(SgPartialFunctionType::pools[0]);
24359 :
24360 : // Build a local variable for better performance (make it a loop invariant variable).
24361 15 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
24362 :
24363 : // Iterate over all of the memory pools for this IR node.
24364 30 : for (unsigned int i=0; i < SgPartialFunctionType::pools.size(); i++)
24365 : {
24366 : // objectArray[i] is a single memory pool, iterate over all the
24367 : // IR nodes and only count those that are valid IR nodes used in
24368 : // the AST (i.e. allocated IR nodes).
24369 30015 : for (unsigned j=0; j < SgPartialFunctionType::pool_size; j++)
24370 : {
24371 : // This is indexing the STL vector of C/C++ style arrays as a doubly
24372 : // indexed array access. It is OK since we have leveraged the semantics
24373 : // of STL vector memory as contigous and cast the memory as an array
24374 : // of arrays to use the 2D array indexing. Hope this is not confusing,
24375 : // but it s very fast as an implementation.
24376 30000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
24377 : {
24378 0 : count++;
24379 : }
24380 : }
24381 : }
24382 : }
24383 :
24384 :
24385 :
24386 330 : return count;
24387 : }
24388 :
24389 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
24390 : // using values that overflow signed values of int.
24391 : size_t
24392 0 : SgPartialFunctionType::memoryUsage()
24393 : {
24394 : // This function is required because we need the class name as a type when we call sizeof
24395 : // There might be another way to implement this if we have a traversal that only called a
24396 : // representative object (one call for each type of Sage IIIIR node).
24397 0 : size_t memory = numberOfNodes() * sizeof(SgPartialFunctionType);
24398 :
24399 0 : return memory;
24400 : }
24401 :
24402 : /* #line 24403 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
24403 :
24404 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
24405 : void
24406 5668 : SgPartialFunctionModifierType::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
24407 : {
24408 : // This function traverses the memory pool for only a specific IR node
24409 : // and calls the visit function of the input class execute a traversal
24410 : // similar to the style of the attribute based traversals within ROSE.
24411 : // This traversal will visit ALL nodes of the AST where as the other
24412 : // attribute based traversals visit only the embedded tree within the AST.
24413 :
24414 : // Initialize array to the address of the first element of the STL vector
24415 : // (which is guaranteed to be contiguous storage).
24416 : // SgPartialFunctionModifierType objectArray [] = *(Memory_Block_List.begin());
24417 5668 : if (SgPartialFunctionModifierType::pools.empty() == false)
24418 : {
24419 : // Generate an array of memory pools
24420 0 : SgPartialFunctionModifierType** objectArray = (SgPartialFunctionModifierType**) &(SgPartialFunctionModifierType::pools[0]);
24421 :
24422 : // Build a local variable for better performance
24423 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
24424 : #if 0
24425 : // Iterate over the memory pools
24426 : for (unsigned int i=0; i < SgPartialFunctionModifierType::pools.size(); i++)
24427 : {
24428 : // objectArray[i] is a single memory pool
24429 : for (int j=0; j < SgPartialFunctionModifierType::pool_size; j++)
24430 : {
24431 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
24432 : {
24433 : traversal.visit(&(objectArray[i][j]));
24434 : }
24435 : }
24436 : }
24437 : #else
24438 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
24439 : // compute the list first and then call the visit function on each list element.
24440 :
24441 : // printf ("Inside of SgPartialFunctionModifierType::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
24442 :
24443 0 : std::vector<SgPartialFunctionModifierType*> nodeList;
24444 :
24445 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
24446 0 : for (unsigned int i=0; i < SgPartialFunctionModifierType::pools.size(); i++)
24447 : {
24448 : // objectArray[i] is a single memory pool
24449 0 : for (unsigned j=0; j < SgPartialFunctionModifierType::pool_size; j++)
24450 : {
24451 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
24452 : {
24453 0 : nodeList.push_back(&(objectArray[i][j]));
24454 : }
24455 : }
24456 : }
24457 :
24458 : // Iterate over the saved list
24459 0 : size_t nodeListSize = nodeList.size();
24460 0 : for (size_t i=0; i < nodeListSize; i++)
24461 : {
24462 0 : ROSE_ASSERT(nodeList[i] != NULL);
24463 : #if 0
24464 : traversal.visit(nodeList[i]);
24465 : #else
24466 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
24467 : {
24468 0 : traversal.visit(nodeList[i]);
24469 : }
24470 : #endif
24471 : }
24472 : #endif
24473 : }
24474 :
24475 : // This should not be required since all previously static data members are
24476 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
24477 :
24478 5668 : }
24479 :
24480 :
24481 : void
24482 194 : SgPartialFunctionModifierType::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
24483 : {
24484 : // This function traverses the memory pool for an IR node and
24485 : // calls the function to execute the visitor object.
24486 :
24487 : // Initialize array to the address of the first element of the STL vector
24488 : // (which is guarenteed to be contiguous storage).
24489 : // SgPartialFunctionModifierType objectArray [] = *(Memory_Block_List.begin());
24490 194 : if (SgPartialFunctionModifierType::pools.empty() == false)
24491 : {
24492 : // Generate an array of memory pools
24493 0 : SgPartialFunctionModifierType** objectArray = (SgPartialFunctionModifierType**) &(SgPartialFunctionModifierType::pools[0]);
24494 :
24495 : // Build a local variable for better performance
24496 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
24497 :
24498 : // Iterate over the memory pools
24499 0 : for (unsigned int i=0; i < SgPartialFunctionModifierType::pools.size(); i++)
24500 : {
24501 : // objectArray[i] is a single memory pool
24502 0 : for (unsigned j=0; j < SgPartialFunctionModifierType::pool_size; j++)
24503 : {
24504 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
24505 : {
24506 : // printf ("Found a valid SgPartialFunctionModifierType object in the memory pool %d at position %d \n",i,j);
24507 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
24508 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
24509 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
24510 : }
24511 : else
24512 : {
24513 : // printf ("Found a INVALID SgPartialFunctionModifierType object in the memory pool \n");
24514 : }
24515 : }
24516 : }
24517 : }
24518 :
24519 : // This should not be required since all previously static data members are
24520 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
24521 :
24522 194 : }
24523 :
24524 : void
24525 0 : SgPartialFunctionModifierType::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
24526 : {
24527 : // This function visits only a single IR node of the memory pool.
24528 : // it is typically called once for each type of IR node within
24529 : // the automatically generated function: traverseRepresentativeNodes().
24530 :
24531 : // Initialize array to the address of the first element of the STL vector
24532 : // (which is guarenteed to be contiguous storage).
24533 : // SgPartialFunctionModifierType objectArray [] = *(Memory_Block_List.begin());
24534 0 : if (SgPartialFunctionModifierType::pools.empty() == false)
24535 : {
24536 : // Generate an array of memory pools
24537 0 : SgPartialFunctionModifierType** objectArray = (SgPartialFunctionModifierType**) &(SgPartialFunctionModifierType::pools[0]);
24538 :
24539 : // Build a local variable for better performance
24540 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
24541 :
24542 : // Iterate over the memory pools
24543 0 : bool done = false;
24544 0 : unsigned i=0;
24545 :
24546 : // find the first valid IR node, call visit function, and then leave
24547 0 : while ( done == false && i < SgPartialFunctionModifierType::pools.size() )
24548 : {
24549 : // objectArray[i] is a single memory pool
24550 : unsigned j=0;
24551 0 : while (done == false && j < SgPartialFunctionModifierType::pool_size)
24552 : {
24553 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
24554 : {
24555 0 : traversal.visit(&(objectArray[i][j]));
24556 0 : done = true;
24557 : }
24558 0 : j++;
24559 : }
24560 0 : i++;
24561 : }
24562 :
24563 : #if 0
24564 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
24565 : if (done == false)
24566 : {
24567 : printf ("No representative for SgPartialFunctionModifierType found in memory pools \n");
24568 : }
24569 : #endif
24570 : }
24571 0 : }
24572 :
24573 :
24574 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
24575 : // using values that overflow signed values of int.
24576 : size_t
24577 4 : SgPartialFunctionModifierType::numberOfNodes()
24578 : {
24579 : // This function traverses the memory pool for an IR node and
24580 : // counts the number of IR nodes of a particular Sage III IR
24581 : // nodes type.
24582 :
24583 4 : size_t count = 0;
24584 4 : if (SgPartialFunctionModifierType::pools.empty() == false)
24585 : {
24586 : // Generate an array of memory pools (this is actually a STL vector,
24587 : // but it is contiguious, so OK to treat this way).
24588 0 : SgPartialFunctionModifierType** objectArray = (SgPartialFunctionModifierType**) &(SgPartialFunctionModifierType::pools[0]);
24589 :
24590 : // Build a local variable for better performance (make it a loop invariant variable).
24591 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
24592 :
24593 : // Iterate over all of the memory pools for this IR node.
24594 0 : for (unsigned int i=0; i < SgPartialFunctionModifierType::pools.size(); i++)
24595 : {
24596 : // objectArray[i] is a single memory pool, iterate over all the
24597 : // IR nodes and only count those that are valid IR nodes used in
24598 : // the AST (i.e. allocated IR nodes).
24599 0 : for (unsigned j=0; j < SgPartialFunctionModifierType::pool_size; j++)
24600 : {
24601 : // This is indexing the STL vector of C/C++ style arrays as a doubly
24602 : // indexed array access. It is OK since we have leveraged the semantics
24603 : // of STL vector memory as contigous and cast the memory as an array
24604 : // of arrays to use the 2D array indexing. Hope this is not confusing,
24605 : // but it s very fast as an implementation.
24606 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
24607 : {
24608 0 : count++;
24609 : }
24610 : }
24611 : }
24612 : }
24613 :
24614 :
24615 :
24616 4 : return count;
24617 : }
24618 :
24619 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
24620 : // using values that overflow signed values of int.
24621 : size_t
24622 0 : SgPartialFunctionModifierType::memoryUsage()
24623 : {
24624 : // This function is required because we need the class name as a type when we call sizeof
24625 : // There might be another way to implement this if we have a traversal that only called a
24626 : // representative object (one call for each type of Sage IIIIR node).
24627 0 : size_t memory = numberOfNodes() * sizeof(SgPartialFunctionModifierType);
24628 :
24629 0 : return memory;
24630 : }
24631 :
24632 : /* #line 24633 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
24633 :
24634 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
24635 : void
24636 5668 : SgArrayType::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
24637 : {
24638 : // This function traverses the memory pool for only a specific IR node
24639 : // and calls the visit function of the input class execute a traversal
24640 : // similar to the style of the attribute based traversals within ROSE.
24641 : // This traversal will visit ALL nodes of the AST where as the other
24642 : // attribute based traversals visit only the embedded tree within the AST.
24643 :
24644 : // Initialize array to the address of the first element of the STL vector
24645 : // (which is guaranteed to be contiguous storage).
24646 : // SgArrayType objectArray [] = *(Memory_Block_List.begin());
24647 5668 : if (SgArrayType::pools.empty() == false)
24648 : {
24649 : // Generate an array of memory pools
24650 3925 : SgArrayType** objectArray = (SgArrayType**) &(SgArrayType::pools[0]);
24651 :
24652 : // Build a local variable for better performance
24653 3925 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
24654 : #if 0
24655 : // Iterate over the memory pools
24656 : for (unsigned int i=0; i < SgArrayType::pools.size(); i++)
24657 : {
24658 : // objectArray[i] is a single memory pool
24659 : for (int j=0; j < SgArrayType::pool_size; j++)
24660 : {
24661 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
24662 : {
24663 : traversal.visit(&(objectArray[i][j]));
24664 : }
24665 : }
24666 : }
24667 : #else
24668 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
24669 : // compute the list first and then call the visit function on each list element.
24670 :
24671 : // printf ("Inside of SgArrayType::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
24672 :
24673 7850 : std::vector<SgArrayType*> nodeList;
24674 :
24675 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
24676 7850 : for (unsigned int i=0; i < SgArrayType::pools.size(); i++)
24677 : {
24678 : // objectArray[i] is a single memory pool
24679 7853920 : for (unsigned j=0; j < SgArrayType::pool_size; j++)
24680 : {
24681 7850000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
24682 : {
24683 105019 : nodeList.push_back(&(objectArray[i][j]));
24684 : }
24685 : }
24686 : }
24687 :
24688 : // Iterate over the saved list
24689 3925 : size_t nodeListSize = nodeList.size();
24690 108944 : for (size_t i=0; i < nodeListSize; i++)
24691 : {
24692 105019 : ROSE_ASSERT(nodeList[i] != NULL);
24693 : #if 0
24694 : traversal.visit(nodeList[i]);
24695 : #else
24696 105019 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
24697 : {
24698 105019 : traversal.visit(nodeList[i]);
24699 : }
24700 : #endif
24701 : }
24702 : #endif
24703 : }
24704 :
24705 : // This should not be required since all previously static data members are
24706 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
24707 :
24708 5668 : }
24709 :
24710 :
24711 : void
24712 194 : SgArrayType::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
24713 : {
24714 : // This function traverses the memory pool for an IR node and
24715 : // calls the function to execute the visitor object.
24716 :
24717 : // Initialize array to the address of the first element of the STL vector
24718 : // (which is guarenteed to be contiguous storage).
24719 : // SgArrayType objectArray [] = *(Memory_Block_List.begin());
24720 194 : if (SgArrayType::pools.empty() == false)
24721 : {
24722 : // Generate an array of memory pools
24723 190 : SgArrayType** objectArray = (SgArrayType**) &(SgArrayType::pools[0]);
24724 :
24725 : // Build a local variable for better performance
24726 190 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
24727 :
24728 : // Iterate over the memory pools
24729 380 : for (unsigned int i=0; i < SgArrayType::pools.size(); i++)
24730 : {
24731 : // objectArray[i] is a single memory pool
24732 380190 : for (unsigned j=0; j < SgArrayType::pool_size; j++)
24733 : {
24734 380000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
24735 : {
24736 : // printf ("Found a valid SgArrayType object in the memory pool %d at position %d \n",i,j);
24737 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
24738 14533 : objectArray[i][j].executeVisitorMemberFunction(visitor);
24739 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
24740 : }
24741 : else
24742 : {
24743 : // printf ("Found a INVALID SgArrayType object in the memory pool \n");
24744 : }
24745 : }
24746 : }
24747 : }
24748 :
24749 : // This should not be required since all previously static data members are
24750 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
24751 :
24752 194 : }
24753 :
24754 : void
24755 0 : SgArrayType::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
24756 : {
24757 : // This function visits only a single IR node of the memory pool.
24758 : // it is typically called once for each type of IR node within
24759 : // the automatically generated function: traverseRepresentativeNodes().
24760 :
24761 : // Initialize array to the address of the first element of the STL vector
24762 : // (which is guarenteed to be contiguous storage).
24763 : // SgArrayType objectArray [] = *(Memory_Block_List.begin());
24764 0 : if (SgArrayType::pools.empty() == false)
24765 : {
24766 : // Generate an array of memory pools
24767 0 : SgArrayType** objectArray = (SgArrayType**) &(SgArrayType::pools[0]);
24768 :
24769 : // Build a local variable for better performance
24770 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
24771 :
24772 : // Iterate over the memory pools
24773 0 : bool done = false;
24774 0 : unsigned i=0;
24775 :
24776 : // find the first valid IR node, call visit function, and then leave
24777 0 : while ( done == false && i < SgArrayType::pools.size() )
24778 : {
24779 : // objectArray[i] is a single memory pool
24780 : unsigned j=0;
24781 0 : while (done == false && j < SgArrayType::pool_size)
24782 : {
24783 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
24784 : {
24785 0 : traversal.visit(&(objectArray[i][j]));
24786 0 : done = true;
24787 : }
24788 0 : j++;
24789 : }
24790 0 : i++;
24791 : }
24792 :
24793 : #if 0
24794 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
24795 : if (done == false)
24796 : {
24797 : printf ("No representative for SgArrayType found in memory pools \n");
24798 : }
24799 : #endif
24800 : }
24801 0 : }
24802 :
24803 :
24804 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
24805 : // using values that overflow signed values of int.
24806 : size_t
24807 4 : SgArrayType::numberOfNodes()
24808 : {
24809 : // This function traverses the memory pool for an IR node and
24810 : // counts the number of IR nodes of a particular Sage III IR
24811 : // nodes type.
24812 :
24813 4 : size_t count = 0;
24814 4 : if (SgArrayType::pools.empty() == false)
24815 : {
24816 : // Generate an array of memory pools (this is actually a STL vector,
24817 : // but it is contiguious, so OK to treat this way).
24818 2 : SgArrayType** objectArray = (SgArrayType**) &(SgArrayType::pools[0]);
24819 :
24820 : // Build a local variable for better performance (make it a loop invariant variable).
24821 2 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
24822 :
24823 : // Iterate over all of the memory pools for this IR node.
24824 4 : for (unsigned int i=0; i < SgArrayType::pools.size(); i++)
24825 : {
24826 : // objectArray[i] is a single memory pool, iterate over all the
24827 : // IR nodes and only count those that are valid IR nodes used in
24828 : // the AST (i.e. allocated IR nodes).
24829 4002 : for (unsigned j=0; j < SgArrayType::pool_size; j++)
24830 : {
24831 : // This is indexing the STL vector of C/C++ style arrays as a doubly
24832 : // indexed array access. It is OK since we have leveraged the semantics
24833 : // of STL vector memory as contigous and cast the memory as an array
24834 : // of arrays to use the 2D array indexing. Hope this is not confusing,
24835 : // but it s very fast as an implementation.
24836 4000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
24837 : {
24838 108 : count++;
24839 : }
24840 : }
24841 : }
24842 : }
24843 :
24844 :
24845 :
24846 4 : return count;
24847 : }
24848 :
24849 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
24850 : // using values that overflow signed values of int.
24851 : size_t
24852 0 : SgArrayType::memoryUsage()
24853 : {
24854 : // This function is required because we need the class name as a type when we call sizeof
24855 : // There might be another way to implement this if we have a traversal that only called a
24856 : // representative object (one call for each type of Sage IIIIR node).
24857 0 : size_t memory = numberOfNodes() * sizeof(SgArrayType);
24858 :
24859 0 : return memory;
24860 : }
24861 :
24862 : /* #line 24863 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
24863 :
24864 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
24865 : void
24866 5668 : SgTypeEllipse::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
24867 : {
24868 : // This function traverses the memory pool for only a specific IR node
24869 : // and calls the visit function of the input class execute a traversal
24870 : // similar to the style of the attribute based traversals within ROSE.
24871 : // This traversal will visit ALL nodes of the AST where as the other
24872 : // attribute based traversals visit only the embedded tree within the AST.
24873 :
24874 : // Initialize array to the address of the first element of the STL vector
24875 : // (which is guaranteed to be contiguous storage).
24876 : // SgTypeEllipse objectArray [] = *(Memory_Block_List.begin());
24877 5668 : if (SgTypeEllipse::pools.empty() == false)
24878 : {
24879 : // Generate an array of memory pools
24880 3212 : SgTypeEllipse** objectArray = (SgTypeEllipse**) &(SgTypeEllipse::pools[0]);
24881 :
24882 : // Build a local variable for better performance
24883 3212 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
24884 : #if 0
24885 : // Iterate over the memory pools
24886 : for (unsigned int i=0; i < SgTypeEllipse::pools.size(); i++)
24887 : {
24888 : // objectArray[i] is a single memory pool
24889 : for (int j=0; j < SgTypeEllipse::pool_size; j++)
24890 : {
24891 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
24892 : {
24893 : traversal.visit(&(objectArray[i][j]));
24894 : }
24895 : }
24896 : }
24897 : #else
24898 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
24899 : // compute the list first and then call the visit function on each list element.
24900 :
24901 : // printf ("Inside of SgTypeEllipse::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
24902 :
24903 6424 : std::vector<SgTypeEllipse*> nodeList;
24904 :
24905 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
24906 6424 : for (unsigned int i=0; i < SgTypeEllipse::pools.size(); i++)
24907 : {
24908 : // objectArray[i] is a single memory pool
24909 6427210 : for (unsigned j=0; j < SgTypeEllipse::pool_size; j++)
24910 : {
24911 6424000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
24912 : {
24913 3212 : nodeList.push_back(&(objectArray[i][j]));
24914 : }
24915 : }
24916 : }
24917 :
24918 : // Iterate over the saved list
24919 3212 : size_t nodeListSize = nodeList.size();
24920 6424 : for (size_t i=0; i < nodeListSize; i++)
24921 : {
24922 3212 : ROSE_ASSERT(nodeList[i] != NULL);
24923 : #if 0
24924 : traversal.visit(nodeList[i]);
24925 : #else
24926 3212 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
24927 : {
24928 3212 : traversal.visit(nodeList[i]);
24929 : }
24930 : #endif
24931 : }
24932 : #endif
24933 : }
24934 :
24935 : // This should not be required since all previously static data members are
24936 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
24937 :
24938 5668 : }
24939 :
24940 :
24941 : void
24942 194 : SgTypeEllipse::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
24943 : {
24944 : // This function traverses the memory pool for an IR node and
24945 : // calls the function to execute the visitor object.
24946 :
24947 : // Initialize array to the address of the first element of the STL vector
24948 : // (which is guarenteed to be contiguous storage).
24949 : // SgTypeEllipse objectArray [] = *(Memory_Block_List.begin());
24950 194 : if (SgTypeEllipse::pools.empty() == false)
24951 : {
24952 : // Generate an array of memory pools
24953 194 : SgTypeEllipse** objectArray = (SgTypeEllipse**) &(SgTypeEllipse::pools[0]);
24954 :
24955 : // Build a local variable for better performance
24956 194 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
24957 :
24958 : // Iterate over the memory pools
24959 388 : for (unsigned int i=0; i < SgTypeEllipse::pools.size(); i++)
24960 : {
24961 : // objectArray[i] is a single memory pool
24962 388194 : for (unsigned j=0; j < SgTypeEllipse::pool_size; j++)
24963 : {
24964 388000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
24965 : {
24966 : // printf ("Found a valid SgTypeEllipse object in the memory pool %d at position %d \n",i,j);
24967 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
24968 194 : objectArray[i][j].executeVisitorMemberFunction(visitor);
24969 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
24970 : }
24971 : else
24972 : {
24973 : // printf ("Found a INVALID SgTypeEllipse object in the memory pool \n");
24974 : }
24975 : }
24976 : }
24977 : }
24978 :
24979 : // This should not be required since all previously static data members are
24980 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
24981 :
24982 194 : }
24983 :
24984 : void
24985 0 : SgTypeEllipse::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
24986 : {
24987 : // This function visits only a single IR node of the memory pool.
24988 : // it is typically called once for each type of IR node within
24989 : // the automatically generated function: traverseRepresentativeNodes().
24990 :
24991 : // Initialize array to the address of the first element of the STL vector
24992 : // (which is guarenteed to be contiguous storage).
24993 : // SgTypeEllipse objectArray [] = *(Memory_Block_List.begin());
24994 0 : if (SgTypeEllipse::pools.empty() == false)
24995 : {
24996 : // Generate an array of memory pools
24997 0 : SgTypeEllipse** objectArray = (SgTypeEllipse**) &(SgTypeEllipse::pools[0]);
24998 :
24999 : // Build a local variable for better performance
25000 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
25001 :
25002 : // Iterate over the memory pools
25003 0 : bool done = false;
25004 0 : unsigned i=0;
25005 :
25006 : // find the first valid IR node, call visit function, and then leave
25007 0 : while ( done == false && i < SgTypeEllipse::pools.size() )
25008 : {
25009 : // objectArray[i] is a single memory pool
25010 : unsigned j=0;
25011 0 : while (done == false && j < SgTypeEllipse::pool_size)
25012 : {
25013 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
25014 : {
25015 0 : traversal.visit(&(objectArray[i][j]));
25016 0 : done = true;
25017 : }
25018 0 : j++;
25019 : }
25020 0 : i++;
25021 : }
25022 :
25023 : #if 0
25024 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
25025 : if (done == false)
25026 : {
25027 : printf ("No representative for SgTypeEllipse found in memory pools \n");
25028 : }
25029 : #endif
25030 : }
25031 0 : }
25032 :
25033 :
25034 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
25035 : // using values that overflow signed values of int.
25036 : size_t
25037 4 : SgTypeEllipse::numberOfNodes()
25038 : {
25039 : // This function traverses the memory pool for an IR node and
25040 : // counts the number of IR nodes of a particular Sage III IR
25041 : // nodes type.
25042 :
25043 4 : size_t count = 0;
25044 4 : if (SgTypeEllipse::pools.empty() == false)
25045 : {
25046 : // Generate an array of memory pools (this is actually a STL vector,
25047 : // but it is contiguious, so OK to treat this way).
25048 2 : SgTypeEllipse** objectArray = (SgTypeEllipse**) &(SgTypeEllipse::pools[0]);
25049 :
25050 : // Build a local variable for better performance (make it a loop invariant variable).
25051 2 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
25052 :
25053 : // Iterate over all of the memory pools for this IR node.
25054 4 : for (unsigned int i=0; i < SgTypeEllipse::pools.size(); i++)
25055 : {
25056 : // objectArray[i] is a single memory pool, iterate over all the
25057 : // IR nodes and only count those that are valid IR nodes used in
25058 : // the AST (i.e. allocated IR nodes).
25059 4002 : for (unsigned j=0; j < SgTypeEllipse::pool_size; j++)
25060 : {
25061 : // This is indexing the STL vector of C/C++ style arrays as a doubly
25062 : // indexed array access. It is OK since we have leveraged the semantics
25063 : // of STL vector memory as contigous and cast the memory as an array
25064 : // of arrays to use the 2D array indexing. Hope this is not confusing,
25065 : // but it s very fast as an implementation.
25066 4000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
25067 : {
25068 2 : count++;
25069 : }
25070 : }
25071 : }
25072 : }
25073 :
25074 :
25075 :
25076 4 : return count;
25077 : }
25078 :
25079 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
25080 : // using values that overflow signed values of int.
25081 : size_t
25082 0 : SgTypeEllipse::memoryUsage()
25083 : {
25084 : // This function is required because we need the class name as a type when we call sizeof
25085 : // There might be another way to implement this if we have a traversal that only called a
25086 : // representative object (one call for each type of Sage IIIIR node).
25087 0 : size_t memory = numberOfNodes() * sizeof(SgTypeEllipse);
25088 :
25089 0 : return memory;
25090 : }
25091 :
25092 : /* #line 25093 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
25093 :
25094 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
25095 : void
25096 5668 : SgTemplateType::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
25097 : {
25098 : // This function traverses the memory pool for only a specific IR node
25099 : // and calls the visit function of the input class execute a traversal
25100 : // similar to the style of the attribute based traversals within ROSE.
25101 : // This traversal will visit ALL nodes of the AST where as the other
25102 : // attribute based traversals visit only the embedded tree within the AST.
25103 :
25104 : // Initialize array to the address of the first element of the STL vector
25105 : // (which is guaranteed to be contiguous storage).
25106 : // SgTemplateType objectArray [] = *(Memory_Block_List.begin());
25107 5668 : if (SgTemplateType::pools.empty() == false)
25108 : {
25109 : // Generate an array of memory pools
25110 0 : SgTemplateType** objectArray = (SgTemplateType**) &(SgTemplateType::pools[0]);
25111 :
25112 : // Build a local variable for better performance
25113 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
25114 : #if 0
25115 : // Iterate over the memory pools
25116 : for (unsigned int i=0; i < SgTemplateType::pools.size(); i++)
25117 : {
25118 : // objectArray[i] is a single memory pool
25119 : for (int j=0; j < SgTemplateType::pool_size; j++)
25120 : {
25121 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
25122 : {
25123 : traversal.visit(&(objectArray[i][j]));
25124 : }
25125 : }
25126 : }
25127 : #else
25128 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
25129 : // compute the list first and then call the visit function on each list element.
25130 :
25131 : // printf ("Inside of SgTemplateType::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
25132 :
25133 0 : std::vector<SgTemplateType*> nodeList;
25134 :
25135 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
25136 0 : for (unsigned int i=0; i < SgTemplateType::pools.size(); i++)
25137 : {
25138 : // objectArray[i] is a single memory pool
25139 0 : for (unsigned j=0; j < SgTemplateType::pool_size; j++)
25140 : {
25141 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
25142 : {
25143 0 : nodeList.push_back(&(objectArray[i][j]));
25144 : }
25145 : }
25146 : }
25147 :
25148 : // Iterate over the saved list
25149 0 : size_t nodeListSize = nodeList.size();
25150 0 : for (size_t i=0; i < nodeListSize; i++)
25151 : {
25152 0 : ROSE_ASSERT(nodeList[i] != NULL);
25153 : #if 0
25154 : traversal.visit(nodeList[i]);
25155 : #else
25156 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
25157 : {
25158 0 : traversal.visit(nodeList[i]);
25159 : }
25160 : #endif
25161 : }
25162 : #endif
25163 : }
25164 :
25165 : // This should not be required since all previously static data members are
25166 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
25167 :
25168 5668 : }
25169 :
25170 :
25171 : void
25172 194 : SgTemplateType::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
25173 : {
25174 : // This function traverses the memory pool for an IR node and
25175 : // calls the function to execute the visitor object.
25176 :
25177 : // Initialize array to the address of the first element of the STL vector
25178 : // (which is guarenteed to be contiguous storage).
25179 : // SgTemplateType objectArray [] = *(Memory_Block_List.begin());
25180 194 : if (SgTemplateType::pools.empty() == false)
25181 : {
25182 : // Generate an array of memory pools
25183 0 : SgTemplateType** objectArray = (SgTemplateType**) &(SgTemplateType::pools[0]);
25184 :
25185 : // Build a local variable for better performance
25186 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
25187 :
25188 : // Iterate over the memory pools
25189 0 : for (unsigned int i=0; i < SgTemplateType::pools.size(); i++)
25190 : {
25191 : // objectArray[i] is a single memory pool
25192 0 : for (unsigned j=0; j < SgTemplateType::pool_size; j++)
25193 : {
25194 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
25195 : {
25196 : // printf ("Found a valid SgTemplateType object in the memory pool %d at position %d \n",i,j);
25197 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
25198 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
25199 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
25200 : }
25201 : else
25202 : {
25203 : // printf ("Found a INVALID SgTemplateType object in the memory pool \n");
25204 : }
25205 : }
25206 : }
25207 : }
25208 :
25209 : // This should not be required since all previously static data members are
25210 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
25211 :
25212 194 : }
25213 :
25214 : void
25215 0 : SgTemplateType::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
25216 : {
25217 : // This function visits only a single IR node of the memory pool.
25218 : // it is typically called once for each type of IR node within
25219 : // the automatically generated function: traverseRepresentativeNodes().
25220 :
25221 : // Initialize array to the address of the first element of the STL vector
25222 : // (which is guarenteed to be contiguous storage).
25223 : // SgTemplateType objectArray [] = *(Memory_Block_List.begin());
25224 0 : if (SgTemplateType::pools.empty() == false)
25225 : {
25226 : // Generate an array of memory pools
25227 0 : SgTemplateType** objectArray = (SgTemplateType**) &(SgTemplateType::pools[0]);
25228 :
25229 : // Build a local variable for better performance
25230 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
25231 :
25232 : // Iterate over the memory pools
25233 0 : bool done = false;
25234 0 : unsigned i=0;
25235 :
25236 : // find the first valid IR node, call visit function, and then leave
25237 0 : while ( done == false && i < SgTemplateType::pools.size() )
25238 : {
25239 : // objectArray[i] is a single memory pool
25240 : unsigned j=0;
25241 0 : while (done == false && j < SgTemplateType::pool_size)
25242 : {
25243 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
25244 : {
25245 0 : traversal.visit(&(objectArray[i][j]));
25246 0 : done = true;
25247 : }
25248 0 : j++;
25249 : }
25250 0 : i++;
25251 : }
25252 :
25253 : #if 0
25254 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
25255 : if (done == false)
25256 : {
25257 : printf ("No representative for SgTemplateType found in memory pools \n");
25258 : }
25259 : #endif
25260 : }
25261 0 : }
25262 :
25263 :
25264 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
25265 : // using values that overflow signed values of int.
25266 : size_t
25267 4 : SgTemplateType::numberOfNodes()
25268 : {
25269 : // This function traverses the memory pool for an IR node and
25270 : // counts the number of IR nodes of a particular Sage III IR
25271 : // nodes type.
25272 :
25273 4 : size_t count = 0;
25274 4 : if (SgTemplateType::pools.empty() == false)
25275 : {
25276 : // Generate an array of memory pools (this is actually a STL vector,
25277 : // but it is contiguious, so OK to treat this way).
25278 0 : SgTemplateType** objectArray = (SgTemplateType**) &(SgTemplateType::pools[0]);
25279 :
25280 : // Build a local variable for better performance (make it a loop invariant variable).
25281 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
25282 :
25283 : // Iterate over all of the memory pools for this IR node.
25284 0 : for (unsigned int i=0; i < SgTemplateType::pools.size(); i++)
25285 : {
25286 : // objectArray[i] is a single memory pool, iterate over all the
25287 : // IR nodes and only count those that are valid IR nodes used in
25288 : // the AST (i.e. allocated IR nodes).
25289 0 : for (unsigned j=0; j < SgTemplateType::pool_size; j++)
25290 : {
25291 : // This is indexing the STL vector of C/C++ style arrays as a doubly
25292 : // indexed array access. It is OK since we have leveraged the semantics
25293 : // of STL vector memory as contigous and cast the memory as an array
25294 : // of arrays to use the 2D array indexing. Hope this is not confusing,
25295 : // but it s very fast as an implementation.
25296 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
25297 : {
25298 0 : count++;
25299 : }
25300 : }
25301 : }
25302 : }
25303 :
25304 :
25305 :
25306 4 : return count;
25307 : }
25308 :
25309 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
25310 : // using values that overflow signed values of int.
25311 : size_t
25312 0 : SgTemplateType::memoryUsage()
25313 : {
25314 : // This function is required because we need the class name as a type when we call sizeof
25315 : // There might be another way to implement this if we have a traversal that only called a
25316 : // representative object (one call for each type of Sage IIIIR node).
25317 0 : size_t memory = numberOfNodes() * sizeof(SgTemplateType);
25318 :
25319 0 : return memory;
25320 : }
25321 :
25322 : /* #line 25323 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
25323 :
25324 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
25325 : void
25326 5668 : SgQualifiedNameType::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
25327 : {
25328 : // This function traverses the memory pool for only a specific IR node
25329 : // and calls the visit function of the input class execute a traversal
25330 : // similar to the style of the attribute based traversals within ROSE.
25331 : // This traversal will visit ALL nodes of the AST where as the other
25332 : // attribute based traversals visit only the embedded tree within the AST.
25333 :
25334 : // Initialize array to the address of the first element of the STL vector
25335 : // (which is guaranteed to be contiguous storage).
25336 : // SgQualifiedNameType objectArray [] = *(Memory_Block_List.begin());
25337 5668 : if (SgQualifiedNameType::pools.empty() == false)
25338 : {
25339 : // Generate an array of memory pools
25340 0 : SgQualifiedNameType** objectArray = (SgQualifiedNameType**) &(SgQualifiedNameType::pools[0]);
25341 :
25342 : // Build a local variable for better performance
25343 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
25344 : #if 0
25345 : // Iterate over the memory pools
25346 : for (unsigned int i=0; i < SgQualifiedNameType::pools.size(); i++)
25347 : {
25348 : // objectArray[i] is a single memory pool
25349 : for (int j=0; j < SgQualifiedNameType::pool_size; j++)
25350 : {
25351 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
25352 : {
25353 : traversal.visit(&(objectArray[i][j]));
25354 : }
25355 : }
25356 : }
25357 : #else
25358 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
25359 : // compute the list first and then call the visit function on each list element.
25360 :
25361 : // printf ("Inside of SgQualifiedNameType::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
25362 :
25363 0 : std::vector<SgQualifiedNameType*> nodeList;
25364 :
25365 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
25366 0 : for (unsigned int i=0; i < SgQualifiedNameType::pools.size(); i++)
25367 : {
25368 : // objectArray[i] is a single memory pool
25369 0 : for (unsigned j=0; j < SgQualifiedNameType::pool_size; j++)
25370 : {
25371 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
25372 : {
25373 0 : nodeList.push_back(&(objectArray[i][j]));
25374 : }
25375 : }
25376 : }
25377 :
25378 : // Iterate over the saved list
25379 0 : size_t nodeListSize = nodeList.size();
25380 0 : for (size_t i=0; i < nodeListSize; i++)
25381 : {
25382 0 : ROSE_ASSERT(nodeList[i] != NULL);
25383 : #if 0
25384 : traversal.visit(nodeList[i]);
25385 : #else
25386 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
25387 : {
25388 0 : traversal.visit(nodeList[i]);
25389 : }
25390 : #endif
25391 : }
25392 : #endif
25393 : }
25394 :
25395 : // This should not be required since all previously static data members are
25396 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
25397 :
25398 5668 : }
25399 :
25400 :
25401 : void
25402 194 : SgQualifiedNameType::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
25403 : {
25404 : // This function traverses the memory pool for an IR node and
25405 : // calls the function to execute the visitor object.
25406 :
25407 : // Initialize array to the address of the first element of the STL vector
25408 : // (which is guarenteed to be contiguous storage).
25409 : // SgQualifiedNameType objectArray [] = *(Memory_Block_List.begin());
25410 194 : if (SgQualifiedNameType::pools.empty() == false)
25411 : {
25412 : // Generate an array of memory pools
25413 0 : SgQualifiedNameType** objectArray = (SgQualifiedNameType**) &(SgQualifiedNameType::pools[0]);
25414 :
25415 : // Build a local variable for better performance
25416 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
25417 :
25418 : // Iterate over the memory pools
25419 0 : for (unsigned int i=0; i < SgQualifiedNameType::pools.size(); i++)
25420 : {
25421 : // objectArray[i] is a single memory pool
25422 0 : for (unsigned j=0; j < SgQualifiedNameType::pool_size; j++)
25423 : {
25424 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
25425 : {
25426 : // printf ("Found a valid SgQualifiedNameType object in the memory pool %d at position %d \n",i,j);
25427 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
25428 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
25429 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
25430 : }
25431 : else
25432 : {
25433 : // printf ("Found a INVALID SgQualifiedNameType object in the memory pool \n");
25434 : }
25435 : }
25436 : }
25437 : }
25438 :
25439 : // This should not be required since all previously static data members are
25440 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
25441 :
25442 194 : }
25443 :
25444 : void
25445 0 : SgQualifiedNameType::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
25446 : {
25447 : // This function visits only a single IR node of the memory pool.
25448 : // it is typically called once for each type of IR node within
25449 : // the automatically generated function: traverseRepresentativeNodes().
25450 :
25451 : // Initialize array to the address of the first element of the STL vector
25452 : // (which is guarenteed to be contiguous storage).
25453 : // SgQualifiedNameType objectArray [] = *(Memory_Block_List.begin());
25454 0 : if (SgQualifiedNameType::pools.empty() == false)
25455 : {
25456 : // Generate an array of memory pools
25457 0 : SgQualifiedNameType** objectArray = (SgQualifiedNameType**) &(SgQualifiedNameType::pools[0]);
25458 :
25459 : // Build a local variable for better performance
25460 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
25461 :
25462 : // Iterate over the memory pools
25463 0 : bool done = false;
25464 0 : unsigned i=0;
25465 :
25466 : // find the first valid IR node, call visit function, and then leave
25467 0 : while ( done == false && i < SgQualifiedNameType::pools.size() )
25468 : {
25469 : // objectArray[i] is a single memory pool
25470 : unsigned j=0;
25471 0 : while (done == false && j < SgQualifiedNameType::pool_size)
25472 : {
25473 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
25474 : {
25475 0 : traversal.visit(&(objectArray[i][j]));
25476 0 : done = true;
25477 : }
25478 0 : j++;
25479 : }
25480 0 : i++;
25481 : }
25482 :
25483 : #if 0
25484 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
25485 : if (done == false)
25486 : {
25487 : printf ("No representative for SgQualifiedNameType found in memory pools \n");
25488 : }
25489 : #endif
25490 : }
25491 0 : }
25492 :
25493 :
25494 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
25495 : // using values that overflow signed values of int.
25496 : size_t
25497 4 : SgQualifiedNameType::numberOfNodes()
25498 : {
25499 : // This function traverses the memory pool for an IR node and
25500 : // counts the number of IR nodes of a particular Sage III IR
25501 : // nodes type.
25502 :
25503 4 : size_t count = 0;
25504 4 : if (SgQualifiedNameType::pools.empty() == false)
25505 : {
25506 : // Generate an array of memory pools (this is actually a STL vector,
25507 : // but it is contiguious, so OK to treat this way).
25508 0 : SgQualifiedNameType** objectArray = (SgQualifiedNameType**) &(SgQualifiedNameType::pools[0]);
25509 :
25510 : // Build a local variable for better performance (make it a loop invariant variable).
25511 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
25512 :
25513 : // Iterate over all of the memory pools for this IR node.
25514 0 : for (unsigned int i=0; i < SgQualifiedNameType::pools.size(); i++)
25515 : {
25516 : // objectArray[i] is a single memory pool, iterate over all the
25517 : // IR nodes and only count those that are valid IR nodes used in
25518 : // the AST (i.e. allocated IR nodes).
25519 0 : for (unsigned j=0; j < SgQualifiedNameType::pool_size; j++)
25520 : {
25521 : // This is indexing the STL vector of C/C++ style arrays as a doubly
25522 : // indexed array access. It is OK since we have leveraged the semantics
25523 : // of STL vector memory as contigous and cast the memory as an array
25524 : // of arrays to use the 2D array indexing. Hope this is not confusing,
25525 : // but it s very fast as an implementation.
25526 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
25527 : {
25528 0 : count++;
25529 : }
25530 : }
25531 : }
25532 : }
25533 :
25534 :
25535 :
25536 4 : return count;
25537 : }
25538 :
25539 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
25540 : // using values that overflow signed values of int.
25541 : size_t
25542 0 : SgQualifiedNameType::memoryUsage()
25543 : {
25544 : // This function is required because we need the class name as a type when we call sizeof
25545 : // There might be another way to implement this if we have a traversal that only called a
25546 : // representative object (one call for each type of Sage IIIIR node).
25547 0 : size_t memory = numberOfNodes() * sizeof(SgQualifiedNameType);
25548 :
25549 0 : return memory;
25550 : }
25551 :
25552 : /* #line 25553 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
25553 :
25554 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
25555 : void
25556 5668 : SgTypeComplex::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
25557 : {
25558 : // This function traverses the memory pool for only a specific IR node
25559 : // and calls the visit function of the input class execute a traversal
25560 : // similar to the style of the attribute based traversals within ROSE.
25561 : // This traversal will visit ALL nodes of the AST where as the other
25562 : // attribute based traversals visit only the embedded tree within the AST.
25563 :
25564 : // Initialize array to the address of the first element of the STL vector
25565 : // (which is guaranteed to be contiguous storage).
25566 : // SgTypeComplex objectArray [] = *(Memory_Block_List.begin());
25567 5668 : if (SgTypeComplex::pools.empty() == false)
25568 : {
25569 : // Generate an array of memory pools
25570 4892 : SgTypeComplex** objectArray = (SgTypeComplex**) &(SgTypeComplex::pools[0]);
25571 :
25572 : // Build a local variable for better performance
25573 4892 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
25574 : #if 0
25575 : // Iterate over the memory pools
25576 : for (unsigned int i=0; i < SgTypeComplex::pools.size(); i++)
25577 : {
25578 : // objectArray[i] is a single memory pool
25579 : for (int j=0; j < SgTypeComplex::pool_size; j++)
25580 : {
25581 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
25582 : {
25583 : traversal.visit(&(objectArray[i][j]));
25584 : }
25585 : }
25586 : }
25587 : #else
25588 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
25589 : // compute the list first and then call the visit function on each list element.
25590 :
25591 : // printf ("Inside of SgTypeComplex::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
25592 :
25593 9784 : std::vector<SgTypeComplex*> nodeList;
25594 :
25595 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
25596 9784 : for (unsigned int i=0; i < SgTypeComplex::pools.size(); i++)
25597 : {
25598 : // objectArray[i] is a single memory pool
25599 9788890 : for (unsigned j=0; j < SgTypeComplex::pool_size; j++)
25600 : {
25601 9784000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
25602 : {
25603 15309 : nodeList.push_back(&(objectArray[i][j]));
25604 : }
25605 : }
25606 : }
25607 :
25608 : // Iterate over the saved list
25609 4892 : size_t nodeListSize = nodeList.size();
25610 20201 : for (size_t i=0; i < nodeListSize; i++)
25611 : {
25612 15309 : ROSE_ASSERT(nodeList[i] != NULL);
25613 : #if 0
25614 : traversal.visit(nodeList[i]);
25615 : #else
25616 15309 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
25617 : {
25618 15309 : traversal.visit(nodeList[i]);
25619 : }
25620 : #endif
25621 : }
25622 : #endif
25623 : }
25624 :
25625 : // This should not be required since all previously static data members are
25626 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
25627 :
25628 5668 : }
25629 :
25630 :
25631 : void
25632 194 : SgTypeComplex::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
25633 : {
25634 : // This function traverses the memory pool for an IR node and
25635 : // calls the function to execute the visitor object.
25636 :
25637 : // Initialize array to the address of the first element of the STL vector
25638 : // (which is guarenteed to be contiguous storage).
25639 : // SgTypeComplex objectArray [] = *(Memory_Block_List.begin());
25640 194 : if (SgTypeComplex::pools.empty() == false)
25641 : {
25642 : // Generate an array of memory pools
25643 194 : SgTypeComplex** objectArray = (SgTypeComplex**) &(SgTypeComplex::pools[0]);
25644 :
25645 : // Build a local variable for better performance
25646 194 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
25647 :
25648 : // Iterate over the memory pools
25649 388 : for (unsigned int i=0; i < SgTypeComplex::pools.size(); i++)
25650 : {
25651 : // objectArray[i] is a single memory pool
25652 388194 : for (unsigned j=0; j < SgTypeComplex::pool_size; j++)
25653 : {
25654 388000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
25655 : {
25656 : // printf ("Found a valid SgTypeComplex object in the memory pool %d at position %d \n",i,j);
25657 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
25658 719 : objectArray[i][j].executeVisitorMemberFunction(visitor);
25659 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
25660 : }
25661 : else
25662 : {
25663 : // printf ("Found a INVALID SgTypeComplex object in the memory pool \n");
25664 : }
25665 : }
25666 : }
25667 : }
25668 :
25669 : // This should not be required since all previously static data members are
25670 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
25671 :
25672 194 : }
25673 :
25674 : void
25675 0 : SgTypeComplex::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
25676 : {
25677 : // This function visits only a single IR node of the memory pool.
25678 : // it is typically called once for each type of IR node within
25679 : // the automatically generated function: traverseRepresentativeNodes().
25680 :
25681 : // Initialize array to the address of the first element of the STL vector
25682 : // (which is guarenteed to be contiguous storage).
25683 : // SgTypeComplex objectArray [] = *(Memory_Block_List.begin());
25684 0 : if (SgTypeComplex::pools.empty() == false)
25685 : {
25686 : // Generate an array of memory pools
25687 0 : SgTypeComplex** objectArray = (SgTypeComplex**) &(SgTypeComplex::pools[0]);
25688 :
25689 : // Build a local variable for better performance
25690 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
25691 :
25692 : // Iterate over the memory pools
25693 0 : bool done = false;
25694 0 : unsigned i=0;
25695 :
25696 : // find the first valid IR node, call visit function, and then leave
25697 0 : while ( done == false && i < SgTypeComplex::pools.size() )
25698 : {
25699 : // objectArray[i] is a single memory pool
25700 : unsigned j=0;
25701 0 : while (done == false && j < SgTypeComplex::pool_size)
25702 : {
25703 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
25704 : {
25705 0 : traversal.visit(&(objectArray[i][j]));
25706 0 : done = true;
25707 : }
25708 0 : j++;
25709 : }
25710 0 : i++;
25711 : }
25712 :
25713 : #if 0
25714 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
25715 : if (done == false)
25716 : {
25717 : printf ("No representative for SgTypeComplex found in memory pools \n");
25718 : }
25719 : #endif
25720 : }
25721 0 : }
25722 :
25723 :
25724 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
25725 : // using values that overflow signed values of int.
25726 : size_t
25727 4 : SgTypeComplex::numberOfNodes()
25728 : {
25729 : // This function traverses the memory pool for an IR node and
25730 : // counts the number of IR nodes of a particular Sage III IR
25731 : // nodes type.
25732 :
25733 4 : size_t count = 0;
25734 4 : if (SgTypeComplex::pools.empty() == false)
25735 : {
25736 : // Generate an array of memory pools (this is actually a STL vector,
25737 : // but it is contiguious, so OK to treat this way).
25738 2 : SgTypeComplex** objectArray = (SgTypeComplex**) &(SgTypeComplex::pools[0]);
25739 :
25740 : // Build a local variable for better performance (make it a loop invariant variable).
25741 2 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
25742 :
25743 : // Iterate over all of the memory pools for this IR node.
25744 4 : for (unsigned int i=0; i < SgTypeComplex::pools.size(); i++)
25745 : {
25746 : // objectArray[i] is a single memory pool, iterate over all the
25747 : // IR nodes and only count those that are valid IR nodes used in
25748 : // the AST (i.e. allocated IR nodes).
25749 4002 : for (unsigned j=0; j < SgTypeComplex::pool_size; j++)
25750 : {
25751 : // This is indexing the STL vector of C/C++ style arrays as a doubly
25752 : // indexed array access. It is OK since we have leveraged the semantics
25753 : // of STL vector memory as contigous and cast the memory as an array
25754 : // of arrays to use the 2D array indexing. Hope this is not confusing,
25755 : // but it s very fast as an implementation.
25756 4000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
25757 : {
25758 7 : count++;
25759 : }
25760 : }
25761 : }
25762 : }
25763 :
25764 :
25765 :
25766 4 : return count;
25767 : }
25768 :
25769 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
25770 : // using values that overflow signed values of int.
25771 : size_t
25772 0 : SgTypeComplex::memoryUsage()
25773 : {
25774 : // This function is required because we need the class name as a type when we call sizeof
25775 : // There might be another way to implement this if we have a traversal that only called a
25776 : // representative object (one call for each type of Sage IIIIR node).
25777 0 : size_t memory = numberOfNodes() * sizeof(SgTypeComplex);
25778 :
25779 0 : return memory;
25780 : }
25781 :
25782 : /* #line 25783 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
25783 :
25784 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
25785 : void
25786 5668 : SgTypeImaginary::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
25787 : {
25788 : // This function traverses the memory pool for only a specific IR node
25789 : // and calls the visit function of the input class execute a traversal
25790 : // similar to the style of the attribute based traversals within ROSE.
25791 : // This traversal will visit ALL nodes of the AST where as the other
25792 : // attribute based traversals visit only the embedded tree within the AST.
25793 :
25794 : // Initialize array to the address of the first element of the STL vector
25795 : // (which is guaranteed to be contiguous storage).
25796 : // SgTypeImaginary objectArray [] = *(Memory_Block_List.begin());
25797 5668 : if (SgTypeImaginary::pools.empty() == false)
25798 : {
25799 : // Generate an array of memory pools
25800 0 : SgTypeImaginary** objectArray = (SgTypeImaginary**) &(SgTypeImaginary::pools[0]);
25801 :
25802 : // Build a local variable for better performance
25803 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
25804 : #if 0
25805 : // Iterate over the memory pools
25806 : for (unsigned int i=0; i < SgTypeImaginary::pools.size(); i++)
25807 : {
25808 : // objectArray[i] is a single memory pool
25809 : for (int j=0; j < SgTypeImaginary::pool_size; j++)
25810 : {
25811 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
25812 : {
25813 : traversal.visit(&(objectArray[i][j]));
25814 : }
25815 : }
25816 : }
25817 : #else
25818 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
25819 : // compute the list first and then call the visit function on each list element.
25820 :
25821 : // printf ("Inside of SgTypeImaginary::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
25822 :
25823 0 : std::vector<SgTypeImaginary*> nodeList;
25824 :
25825 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
25826 0 : for (unsigned int i=0; i < SgTypeImaginary::pools.size(); i++)
25827 : {
25828 : // objectArray[i] is a single memory pool
25829 0 : for (unsigned j=0; j < SgTypeImaginary::pool_size; j++)
25830 : {
25831 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
25832 : {
25833 0 : nodeList.push_back(&(objectArray[i][j]));
25834 : }
25835 : }
25836 : }
25837 :
25838 : // Iterate over the saved list
25839 0 : size_t nodeListSize = nodeList.size();
25840 0 : for (size_t i=0; i < nodeListSize; i++)
25841 : {
25842 0 : ROSE_ASSERT(nodeList[i] != NULL);
25843 : #if 0
25844 : traversal.visit(nodeList[i]);
25845 : #else
25846 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
25847 : {
25848 0 : traversal.visit(nodeList[i]);
25849 : }
25850 : #endif
25851 : }
25852 : #endif
25853 : }
25854 :
25855 : // This should not be required since all previously static data members are
25856 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
25857 :
25858 5668 : }
25859 :
25860 :
25861 : void
25862 194 : SgTypeImaginary::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
25863 : {
25864 : // This function traverses the memory pool for an IR node and
25865 : // calls the function to execute the visitor object.
25866 :
25867 : // Initialize array to the address of the first element of the STL vector
25868 : // (which is guarenteed to be contiguous storage).
25869 : // SgTypeImaginary objectArray [] = *(Memory_Block_List.begin());
25870 194 : if (SgTypeImaginary::pools.empty() == false)
25871 : {
25872 : // Generate an array of memory pools
25873 0 : SgTypeImaginary** objectArray = (SgTypeImaginary**) &(SgTypeImaginary::pools[0]);
25874 :
25875 : // Build a local variable for better performance
25876 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
25877 :
25878 : // Iterate over the memory pools
25879 0 : for (unsigned int i=0; i < SgTypeImaginary::pools.size(); i++)
25880 : {
25881 : // objectArray[i] is a single memory pool
25882 0 : for (unsigned j=0; j < SgTypeImaginary::pool_size; j++)
25883 : {
25884 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
25885 : {
25886 : // printf ("Found a valid SgTypeImaginary object in the memory pool %d at position %d \n",i,j);
25887 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
25888 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
25889 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
25890 : }
25891 : else
25892 : {
25893 : // printf ("Found a INVALID SgTypeImaginary object in the memory pool \n");
25894 : }
25895 : }
25896 : }
25897 : }
25898 :
25899 : // This should not be required since all previously static data members are
25900 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
25901 :
25902 194 : }
25903 :
25904 : void
25905 0 : SgTypeImaginary::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
25906 : {
25907 : // This function visits only a single IR node of the memory pool.
25908 : // it is typically called once for each type of IR node within
25909 : // the automatically generated function: traverseRepresentativeNodes().
25910 :
25911 : // Initialize array to the address of the first element of the STL vector
25912 : // (which is guarenteed to be contiguous storage).
25913 : // SgTypeImaginary objectArray [] = *(Memory_Block_List.begin());
25914 0 : if (SgTypeImaginary::pools.empty() == false)
25915 : {
25916 : // Generate an array of memory pools
25917 0 : SgTypeImaginary** objectArray = (SgTypeImaginary**) &(SgTypeImaginary::pools[0]);
25918 :
25919 : // Build a local variable for better performance
25920 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
25921 :
25922 : // Iterate over the memory pools
25923 0 : bool done = false;
25924 0 : unsigned i=0;
25925 :
25926 : // find the first valid IR node, call visit function, and then leave
25927 0 : while ( done == false && i < SgTypeImaginary::pools.size() )
25928 : {
25929 : // objectArray[i] is a single memory pool
25930 : unsigned j=0;
25931 0 : while (done == false && j < SgTypeImaginary::pool_size)
25932 : {
25933 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
25934 : {
25935 0 : traversal.visit(&(objectArray[i][j]));
25936 0 : done = true;
25937 : }
25938 0 : j++;
25939 : }
25940 0 : i++;
25941 : }
25942 :
25943 : #if 0
25944 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
25945 : if (done == false)
25946 : {
25947 : printf ("No representative for SgTypeImaginary found in memory pools \n");
25948 : }
25949 : #endif
25950 : }
25951 0 : }
25952 :
25953 :
25954 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
25955 : // using values that overflow signed values of int.
25956 : size_t
25957 4 : SgTypeImaginary::numberOfNodes()
25958 : {
25959 : // This function traverses the memory pool for an IR node and
25960 : // counts the number of IR nodes of a particular Sage III IR
25961 : // nodes type.
25962 :
25963 4 : size_t count = 0;
25964 4 : if (SgTypeImaginary::pools.empty() == false)
25965 : {
25966 : // Generate an array of memory pools (this is actually a STL vector,
25967 : // but it is contiguious, so OK to treat this way).
25968 0 : SgTypeImaginary** objectArray = (SgTypeImaginary**) &(SgTypeImaginary::pools[0]);
25969 :
25970 : // Build a local variable for better performance (make it a loop invariant variable).
25971 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
25972 :
25973 : // Iterate over all of the memory pools for this IR node.
25974 0 : for (unsigned int i=0; i < SgTypeImaginary::pools.size(); i++)
25975 : {
25976 : // objectArray[i] is a single memory pool, iterate over all the
25977 : // IR nodes and only count those that are valid IR nodes used in
25978 : // the AST (i.e. allocated IR nodes).
25979 0 : for (unsigned j=0; j < SgTypeImaginary::pool_size; j++)
25980 : {
25981 : // This is indexing the STL vector of C/C++ style arrays as a doubly
25982 : // indexed array access. It is OK since we have leveraged the semantics
25983 : // of STL vector memory as contigous and cast the memory as an array
25984 : // of arrays to use the 2D array indexing. Hope this is not confusing,
25985 : // but it s very fast as an implementation.
25986 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
25987 : {
25988 0 : count++;
25989 : }
25990 : }
25991 : }
25992 : }
25993 :
25994 :
25995 :
25996 4 : return count;
25997 : }
25998 :
25999 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
26000 : // using values that overflow signed values of int.
26001 : size_t
26002 0 : SgTypeImaginary::memoryUsage()
26003 : {
26004 : // This function is required because we need the class name as a type when we call sizeof
26005 : // There might be another way to implement this if we have a traversal that only called a
26006 : // representative object (one call for each type of Sage IIIIR node).
26007 0 : size_t memory = numberOfNodes() * sizeof(SgTypeImaginary);
26008 :
26009 0 : return memory;
26010 : }
26011 :
26012 : /* #line 26013 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
26013 :
26014 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
26015 : void
26016 5668 : SgTypeDefault::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
26017 : {
26018 : // This function traverses the memory pool for only a specific IR node
26019 : // and calls the visit function of the input class execute a traversal
26020 : // similar to the style of the attribute based traversals within ROSE.
26021 : // This traversal will visit ALL nodes of the AST where as the other
26022 : // attribute based traversals visit only the embedded tree within the AST.
26023 :
26024 : // Initialize array to the address of the first element of the STL vector
26025 : // (which is guaranteed to be contiguous storage).
26026 : // SgTypeDefault objectArray [] = *(Memory_Block_List.begin());
26027 5668 : if (SgTypeDefault::pools.empty() == false)
26028 : {
26029 : // Generate an array of memory pools
26030 5247 : SgTypeDefault** objectArray = (SgTypeDefault**) &(SgTypeDefault::pools[0]);
26031 :
26032 : // Build a local variable for better performance
26033 5247 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
26034 : #if 0
26035 : // Iterate over the memory pools
26036 : for (unsigned int i=0; i < SgTypeDefault::pools.size(); i++)
26037 : {
26038 : // objectArray[i] is a single memory pool
26039 : for (int j=0; j < SgTypeDefault::pool_size; j++)
26040 : {
26041 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
26042 : {
26043 : traversal.visit(&(objectArray[i][j]));
26044 : }
26045 : }
26046 : }
26047 : #else
26048 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
26049 : // compute the list first and then call the visit function on each list element.
26050 :
26051 : // printf ("Inside of SgTypeDefault::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
26052 :
26053 10494 : std::vector<SgTypeDefault*> nodeList;
26054 :
26055 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
26056 10494 : for (unsigned int i=0; i < SgTypeDefault::pools.size(); i++)
26057 : {
26058 : // objectArray[i] is a single memory pool
26059 10499200 : for (unsigned j=0; j < SgTypeDefault::pool_size; j++)
26060 : {
26061 10494000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
26062 : {
26063 7566 : nodeList.push_back(&(objectArray[i][j]));
26064 : }
26065 : }
26066 : }
26067 :
26068 : // Iterate over the saved list
26069 5247 : size_t nodeListSize = nodeList.size();
26070 12813 : for (size_t i=0; i < nodeListSize; i++)
26071 : {
26072 7566 : ROSE_ASSERT(nodeList[i] != NULL);
26073 : #if 0
26074 : traversal.visit(nodeList[i]);
26075 : #else
26076 7566 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
26077 : {
26078 7566 : traversal.visit(nodeList[i]);
26079 : }
26080 : #endif
26081 : }
26082 : #endif
26083 : }
26084 :
26085 : // This should not be required since all previously static data members are
26086 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
26087 :
26088 5668 : }
26089 :
26090 :
26091 : void
26092 194 : SgTypeDefault::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
26093 : {
26094 : // This function traverses the memory pool for an IR node and
26095 : // calls the function to execute the visitor object.
26096 :
26097 : // Initialize array to the address of the first element of the STL vector
26098 : // (which is guarenteed to be contiguous storage).
26099 : // SgTypeDefault objectArray [] = *(Memory_Block_List.begin());
26100 194 : if (SgTypeDefault::pools.empty() == false)
26101 : {
26102 : // Generate an array of memory pools
26103 194 : SgTypeDefault** objectArray = (SgTypeDefault**) &(SgTypeDefault::pools[0]);
26104 :
26105 : // Build a local variable for better performance
26106 194 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
26107 :
26108 : // Iterate over the memory pools
26109 388 : for (unsigned int i=0; i < SgTypeDefault::pools.size(); i++)
26110 : {
26111 : // objectArray[i] is a single memory pool
26112 388194 : for (unsigned j=0; j < SgTypeDefault::pool_size; j++)
26113 : {
26114 388000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
26115 : {
26116 : // printf ("Found a valid SgTypeDefault object in the memory pool %d at position %d \n",i,j);
26117 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
26118 349 : objectArray[i][j].executeVisitorMemberFunction(visitor);
26119 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
26120 : }
26121 : else
26122 : {
26123 : // printf ("Found a INVALID SgTypeDefault object in the memory pool \n");
26124 : }
26125 : }
26126 : }
26127 : }
26128 :
26129 : // This should not be required since all previously static data members are
26130 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
26131 :
26132 194 : }
26133 :
26134 : void
26135 0 : SgTypeDefault::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
26136 : {
26137 : // This function visits only a single IR node of the memory pool.
26138 : // it is typically called once for each type of IR node within
26139 : // the automatically generated function: traverseRepresentativeNodes().
26140 :
26141 : // Initialize array to the address of the first element of the STL vector
26142 : // (which is guarenteed to be contiguous storage).
26143 : // SgTypeDefault objectArray [] = *(Memory_Block_List.begin());
26144 0 : if (SgTypeDefault::pools.empty() == false)
26145 : {
26146 : // Generate an array of memory pools
26147 0 : SgTypeDefault** objectArray = (SgTypeDefault**) &(SgTypeDefault::pools[0]);
26148 :
26149 : // Build a local variable for better performance
26150 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
26151 :
26152 : // Iterate over the memory pools
26153 0 : bool done = false;
26154 0 : unsigned i=0;
26155 :
26156 : // find the first valid IR node, call visit function, and then leave
26157 0 : while ( done == false && i < SgTypeDefault::pools.size() )
26158 : {
26159 : // objectArray[i] is a single memory pool
26160 : unsigned j=0;
26161 0 : while (done == false && j < SgTypeDefault::pool_size)
26162 : {
26163 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
26164 : {
26165 0 : traversal.visit(&(objectArray[i][j]));
26166 0 : done = true;
26167 : }
26168 0 : j++;
26169 : }
26170 0 : i++;
26171 : }
26172 :
26173 : #if 0
26174 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
26175 : if (done == false)
26176 : {
26177 : printf ("No representative for SgTypeDefault found in memory pools \n");
26178 : }
26179 : #endif
26180 : }
26181 0 : }
26182 :
26183 :
26184 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
26185 : // using values that overflow signed values of int.
26186 : size_t
26187 4 : SgTypeDefault::numberOfNodes()
26188 : {
26189 : // This function traverses the memory pool for an IR node and
26190 : // counts the number of IR nodes of a particular Sage III IR
26191 : // nodes type.
26192 :
26193 4 : size_t count = 0;
26194 4 : if (SgTypeDefault::pools.empty() == false)
26195 : {
26196 : // Generate an array of memory pools (this is actually a STL vector,
26197 : // but it is contiguious, so OK to treat this way).
26198 2 : SgTypeDefault** objectArray = (SgTypeDefault**) &(SgTypeDefault::pools[0]);
26199 :
26200 : // Build a local variable for better performance (make it a loop invariant variable).
26201 2 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
26202 :
26203 : // Iterate over all of the memory pools for this IR node.
26204 4 : for (unsigned int i=0; i < SgTypeDefault::pools.size(); i++)
26205 : {
26206 : // objectArray[i] is a single memory pool, iterate over all the
26207 : // IR nodes and only count those that are valid IR nodes used in
26208 : // the AST (i.e. allocated IR nodes).
26209 4002 : for (unsigned j=0; j < SgTypeDefault::pool_size; j++)
26210 : {
26211 : // This is indexing the STL vector of C/C++ style arrays as a doubly
26212 : // indexed array access. It is OK since we have leveraged the semantics
26213 : // of STL vector memory as contigous and cast the memory as an array
26214 : // of arrays to use the 2D array indexing. Hope this is not confusing,
26215 : // but it s very fast as an implementation.
26216 4000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
26217 : {
26218 4 : count++;
26219 : }
26220 : }
26221 : }
26222 : }
26223 :
26224 :
26225 :
26226 4 : return count;
26227 : }
26228 :
26229 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
26230 : // using values that overflow signed values of int.
26231 : size_t
26232 0 : SgTypeDefault::memoryUsage()
26233 : {
26234 : // This function is required because we need the class name as a type when we call sizeof
26235 : // There might be another way to implement this if we have a traversal that only called a
26236 : // representative object (one call for each type of Sage IIIIR node).
26237 0 : size_t memory = numberOfNodes() * sizeof(SgTypeDefault);
26238 :
26239 0 : return memory;
26240 : }
26241 :
26242 : /* #line 26243 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
26243 :
26244 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
26245 : void
26246 5668 : SgTypeCAFTeam::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
26247 : {
26248 : // This function traverses the memory pool for only a specific IR node
26249 : // and calls the visit function of the input class execute a traversal
26250 : // similar to the style of the attribute based traversals within ROSE.
26251 : // This traversal will visit ALL nodes of the AST where as the other
26252 : // attribute based traversals visit only the embedded tree within the AST.
26253 :
26254 : // Initialize array to the address of the first element of the STL vector
26255 : // (which is guaranteed to be contiguous storage).
26256 : // SgTypeCAFTeam objectArray [] = *(Memory_Block_List.begin());
26257 5668 : if (SgTypeCAFTeam::pools.empty() == false)
26258 : {
26259 : // Generate an array of memory pools
26260 0 : SgTypeCAFTeam** objectArray = (SgTypeCAFTeam**) &(SgTypeCAFTeam::pools[0]);
26261 :
26262 : // Build a local variable for better performance
26263 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
26264 : #if 0
26265 : // Iterate over the memory pools
26266 : for (unsigned int i=0; i < SgTypeCAFTeam::pools.size(); i++)
26267 : {
26268 : // objectArray[i] is a single memory pool
26269 : for (int j=0; j < SgTypeCAFTeam::pool_size; j++)
26270 : {
26271 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
26272 : {
26273 : traversal.visit(&(objectArray[i][j]));
26274 : }
26275 : }
26276 : }
26277 : #else
26278 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
26279 : // compute the list first and then call the visit function on each list element.
26280 :
26281 : // printf ("Inside of SgTypeCAFTeam::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
26282 :
26283 0 : std::vector<SgTypeCAFTeam*> nodeList;
26284 :
26285 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
26286 0 : for (unsigned int i=0; i < SgTypeCAFTeam::pools.size(); i++)
26287 : {
26288 : // objectArray[i] is a single memory pool
26289 0 : for (unsigned j=0; j < SgTypeCAFTeam::pool_size; j++)
26290 : {
26291 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
26292 : {
26293 0 : nodeList.push_back(&(objectArray[i][j]));
26294 : }
26295 : }
26296 : }
26297 :
26298 : // Iterate over the saved list
26299 0 : size_t nodeListSize = nodeList.size();
26300 0 : for (size_t i=0; i < nodeListSize; i++)
26301 : {
26302 0 : ROSE_ASSERT(nodeList[i] != NULL);
26303 : #if 0
26304 : traversal.visit(nodeList[i]);
26305 : #else
26306 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
26307 : {
26308 0 : traversal.visit(nodeList[i]);
26309 : }
26310 : #endif
26311 : }
26312 : #endif
26313 : }
26314 :
26315 : // This should not be required since all previously static data members are
26316 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
26317 :
26318 5668 : }
26319 :
26320 :
26321 : void
26322 194 : SgTypeCAFTeam::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
26323 : {
26324 : // This function traverses the memory pool for an IR node and
26325 : // calls the function to execute the visitor object.
26326 :
26327 : // Initialize array to the address of the first element of the STL vector
26328 : // (which is guarenteed to be contiguous storage).
26329 : // SgTypeCAFTeam objectArray [] = *(Memory_Block_List.begin());
26330 194 : if (SgTypeCAFTeam::pools.empty() == false)
26331 : {
26332 : // Generate an array of memory pools
26333 0 : SgTypeCAFTeam** objectArray = (SgTypeCAFTeam**) &(SgTypeCAFTeam::pools[0]);
26334 :
26335 : // Build a local variable for better performance
26336 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
26337 :
26338 : // Iterate over the memory pools
26339 0 : for (unsigned int i=0; i < SgTypeCAFTeam::pools.size(); i++)
26340 : {
26341 : // objectArray[i] is a single memory pool
26342 0 : for (unsigned j=0; j < SgTypeCAFTeam::pool_size; j++)
26343 : {
26344 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
26345 : {
26346 : // printf ("Found a valid SgTypeCAFTeam object in the memory pool %d at position %d \n",i,j);
26347 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
26348 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
26349 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
26350 : }
26351 : else
26352 : {
26353 : // printf ("Found a INVALID SgTypeCAFTeam object in the memory pool \n");
26354 : }
26355 : }
26356 : }
26357 : }
26358 :
26359 : // This should not be required since all previously static data members are
26360 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
26361 :
26362 194 : }
26363 :
26364 : void
26365 0 : SgTypeCAFTeam::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
26366 : {
26367 : // This function visits only a single IR node of the memory pool.
26368 : // it is typically called once for each type of IR node within
26369 : // the automatically generated function: traverseRepresentativeNodes().
26370 :
26371 : // Initialize array to the address of the first element of the STL vector
26372 : // (which is guarenteed to be contiguous storage).
26373 : // SgTypeCAFTeam objectArray [] = *(Memory_Block_List.begin());
26374 0 : if (SgTypeCAFTeam::pools.empty() == false)
26375 : {
26376 : // Generate an array of memory pools
26377 0 : SgTypeCAFTeam** objectArray = (SgTypeCAFTeam**) &(SgTypeCAFTeam::pools[0]);
26378 :
26379 : // Build a local variable for better performance
26380 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
26381 :
26382 : // Iterate over the memory pools
26383 0 : bool done = false;
26384 0 : unsigned i=0;
26385 :
26386 : // find the first valid IR node, call visit function, and then leave
26387 0 : while ( done == false && i < SgTypeCAFTeam::pools.size() )
26388 : {
26389 : // objectArray[i] is a single memory pool
26390 : unsigned j=0;
26391 0 : while (done == false && j < SgTypeCAFTeam::pool_size)
26392 : {
26393 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
26394 : {
26395 0 : traversal.visit(&(objectArray[i][j]));
26396 0 : done = true;
26397 : }
26398 0 : j++;
26399 : }
26400 0 : i++;
26401 : }
26402 :
26403 : #if 0
26404 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
26405 : if (done == false)
26406 : {
26407 : printf ("No representative for SgTypeCAFTeam found in memory pools \n");
26408 : }
26409 : #endif
26410 : }
26411 0 : }
26412 :
26413 :
26414 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
26415 : // using values that overflow signed values of int.
26416 : size_t
26417 4 : SgTypeCAFTeam::numberOfNodes()
26418 : {
26419 : // This function traverses the memory pool for an IR node and
26420 : // counts the number of IR nodes of a particular Sage III IR
26421 : // nodes type.
26422 :
26423 4 : size_t count = 0;
26424 4 : if (SgTypeCAFTeam::pools.empty() == false)
26425 : {
26426 : // Generate an array of memory pools (this is actually a STL vector,
26427 : // but it is contiguious, so OK to treat this way).
26428 0 : SgTypeCAFTeam** objectArray = (SgTypeCAFTeam**) &(SgTypeCAFTeam::pools[0]);
26429 :
26430 : // Build a local variable for better performance (make it a loop invariant variable).
26431 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
26432 :
26433 : // Iterate over all of the memory pools for this IR node.
26434 0 : for (unsigned int i=0; i < SgTypeCAFTeam::pools.size(); i++)
26435 : {
26436 : // objectArray[i] is a single memory pool, iterate over all the
26437 : // IR nodes and only count those that are valid IR nodes used in
26438 : // the AST (i.e. allocated IR nodes).
26439 0 : for (unsigned j=0; j < SgTypeCAFTeam::pool_size; j++)
26440 : {
26441 : // This is indexing the STL vector of C/C++ style arrays as a doubly
26442 : // indexed array access. It is OK since we have leveraged the semantics
26443 : // of STL vector memory as contigous and cast the memory as an array
26444 : // of arrays to use the 2D array indexing. Hope this is not confusing,
26445 : // but it s very fast as an implementation.
26446 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
26447 : {
26448 0 : count++;
26449 : }
26450 : }
26451 : }
26452 : }
26453 :
26454 :
26455 :
26456 4 : return count;
26457 : }
26458 :
26459 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
26460 : // using values that overflow signed values of int.
26461 : size_t
26462 0 : SgTypeCAFTeam::memoryUsage()
26463 : {
26464 : // This function is required because we need the class name as a type when we call sizeof
26465 : // There might be another way to implement this if we have a traversal that only called a
26466 : // representative object (one call for each type of Sage IIIIR node).
26467 0 : size_t memory = numberOfNodes() * sizeof(SgTypeCAFTeam);
26468 :
26469 0 : return memory;
26470 : }
26471 :
26472 : /* #line 26473 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
26473 :
26474 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
26475 : void
26476 5668 : SgTypeCrayPointer::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
26477 : {
26478 : // This function traverses the memory pool for only a specific IR node
26479 : // and calls the visit function of the input class execute a traversal
26480 : // similar to the style of the attribute based traversals within ROSE.
26481 : // This traversal will visit ALL nodes of the AST where as the other
26482 : // attribute based traversals visit only the embedded tree within the AST.
26483 :
26484 : // Initialize array to the address of the first element of the STL vector
26485 : // (which is guaranteed to be contiguous storage).
26486 : // SgTypeCrayPointer objectArray [] = *(Memory_Block_List.begin());
26487 5668 : if (SgTypeCrayPointer::pools.empty() == false)
26488 : {
26489 : // Generate an array of memory pools
26490 0 : SgTypeCrayPointer** objectArray = (SgTypeCrayPointer**) &(SgTypeCrayPointer::pools[0]);
26491 :
26492 : // Build a local variable for better performance
26493 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
26494 : #if 0
26495 : // Iterate over the memory pools
26496 : for (unsigned int i=0; i < SgTypeCrayPointer::pools.size(); i++)
26497 : {
26498 : // objectArray[i] is a single memory pool
26499 : for (int j=0; j < SgTypeCrayPointer::pool_size; j++)
26500 : {
26501 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
26502 : {
26503 : traversal.visit(&(objectArray[i][j]));
26504 : }
26505 : }
26506 : }
26507 : #else
26508 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
26509 : // compute the list first and then call the visit function on each list element.
26510 :
26511 : // printf ("Inside of SgTypeCrayPointer::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
26512 :
26513 0 : std::vector<SgTypeCrayPointer*> nodeList;
26514 :
26515 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
26516 0 : for (unsigned int i=0; i < SgTypeCrayPointer::pools.size(); i++)
26517 : {
26518 : // objectArray[i] is a single memory pool
26519 0 : for (unsigned j=0; j < SgTypeCrayPointer::pool_size; j++)
26520 : {
26521 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
26522 : {
26523 0 : nodeList.push_back(&(objectArray[i][j]));
26524 : }
26525 : }
26526 : }
26527 :
26528 : // Iterate over the saved list
26529 0 : size_t nodeListSize = nodeList.size();
26530 0 : for (size_t i=0; i < nodeListSize; i++)
26531 : {
26532 0 : ROSE_ASSERT(nodeList[i] != NULL);
26533 : #if 0
26534 : traversal.visit(nodeList[i]);
26535 : #else
26536 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
26537 : {
26538 0 : traversal.visit(nodeList[i]);
26539 : }
26540 : #endif
26541 : }
26542 : #endif
26543 : }
26544 :
26545 : // This should not be required since all previously static data members are
26546 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
26547 :
26548 5668 : }
26549 :
26550 :
26551 : void
26552 194 : SgTypeCrayPointer::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
26553 : {
26554 : // This function traverses the memory pool for an IR node and
26555 : // calls the function to execute the visitor object.
26556 :
26557 : // Initialize array to the address of the first element of the STL vector
26558 : // (which is guarenteed to be contiguous storage).
26559 : // SgTypeCrayPointer objectArray [] = *(Memory_Block_List.begin());
26560 194 : if (SgTypeCrayPointer::pools.empty() == false)
26561 : {
26562 : // Generate an array of memory pools
26563 0 : SgTypeCrayPointer** objectArray = (SgTypeCrayPointer**) &(SgTypeCrayPointer::pools[0]);
26564 :
26565 : // Build a local variable for better performance
26566 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
26567 :
26568 : // Iterate over the memory pools
26569 0 : for (unsigned int i=0; i < SgTypeCrayPointer::pools.size(); i++)
26570 : {
26571 : // objectArray[i] is a single memory pool
26572 0 : for (unsigned j=0; j < SgTypeCrayPointer::pool_size; j++)
26573 : {
26574 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
26575 : {
26576 : // printf ("Found a valid SgTypeCrayPointer object in the memory pool %d at position %d \n",i,j);
26577 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
26578 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
26579 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
26580 : }
26581 : else
26582 : {
26583 : // printf ("Found a INVALID SgTypeCrayPointer object in the memory pool \n");
26584 : }
26585 : }
26586 : }
26587 : }
26588 :
26589 : // This should not be required since all previously static data members are
26590 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
26591 :
26592 194 : }
26593 :
26594 : void
26595 0 : SgTypeCrayPointer::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
26596 : {
26597 : // This function visits only a single IR node of the memory pool.
26598 : // it is typically called once for each type of IR node within
26599 : // the automatically generated function: traverseRepresentativeNodes().
26600 :
26601 : // Initialize array to the address of the first element of the STL vector
26602 : // (which is guarenteed to be contiguous storage).
26603 : // SgTypeCrayPointer objectArray [] = *(Memory_Block_List.begin());
26604 0 : if (SgTypeCrayPointer::pools.empty() == false)
26605 : {
26606 : // Generate an array of memory pools
26607 0 : SgTypeCrayPointer** objectArray = (SgTypeCrayPointer**) &(SgTypeCrayPointer::pools[0]);
26608 :
26609 : // Build a local variable for better performance
26610 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
26611 :
26612 : // Iterate over the memory pools
26613 0 : bool done = false;
26614 0 : unsigned i=0;
26615 :
26616 : // find the first valid IR node, call visit function, and then leave
26617 0 : while ( done == false && i < SgTypeCrayPointer::pools.size() )
26618 : {
26619 : // objectArray[i] is a single memory pool
26620 : unsigned j=0;
26621 0 : while (done == false && j < SgTypeCrayPointer::pool_size)
26622 : {
26623 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
26624 : {
26625 0 : traversal.visit(&(objectArray[i][j]));
26626 0 : done = true;
26627 : }
26628 0 : j++;
26629 : }
26630 0 : i++;
26631 : }
26632 :
26633 : #if 0
26634 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
26635 : if (done == false)
26636 : {
26637 : printf ("No representative for SgTypeCrayPointer found in memory pools \n");
26638 : }
26639 : #endif
26640 : }
26641 0 : }
26642 :
26643 :
26644 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
26645 : // using values that overflow signed values of int.
26646 : size_t
26647 4 : SgTypeCrayPointer::numberOfNodes()
26648 : {
26649 : // This function traverses the memory pool for an IR node and
26650 : // counts the number of IR nodes of a particular Sage III IR
26651 : // nodes type.
26652 :
26653 4 : size_t count = 0;
26654 4 : if (SgTypeCrayPointer::pools.empty() == false)
26655 : {
26656 : // Generate an array of memory pools (this is actually a STL vector,
26657 : // but it is contiguious, so OK to treat this way).
26658 0 : SgTypeCrayPointer** objectArray = (SgTypeCrayPointer**) &(SgTypeCrayPointer::pools[0]);
26659 :
26660 : // Build a local variable for better performance (make it a loop invariant variable).
26661 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
26662 :
26663 : // Iterate over all of the memory pools for this IR node.
26664 0 : for (unsigned int i=0; i < SgTypeCrayPointer::pools.size(); i++)
26665 : {
26666 : // objectArray[i] is a single memory pool, iterate over all the
26667 : // IR nodes and only count those that are valid IR nodes used in
26668 : // the AST (i.e. allocated IR nodes).
26669 0 : for (unsigned j=0; j < SgTypeCrayPointer::pool_size; j++)
26670 : {
26671 : // This is indexing the STL vector of C/C++ style arrays as a doubly
26672 : // indexed array access. It is OK since we have leveraged the semantics
26673 : // of STL vector memory as contigous and cast the memory as an array
26674 : // of arrays to use the 2D array indexing. Hope this is not confusing,
26675 : // but it s very fast as an implementation.
26676 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
26677 : {
26678 0 : count++;
26679 : }
26680 : }
26681 : }
26682 : }
26683 :
26684 :
26685 :
26686 4 : return count;
26687 : }
26688 :
26689 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
26690 : // using values that overflow signed values of int.
26691 : size_t
26692 0 : SgTypeCrayPointer::memoryUsage()
26693 : {
26694 : // This function is required because we need the class name as a type when we call sizeof
26695 : // There might be another way to implement this if we have a traversal that only called a
26696 : // representative object (one call for each type of Sage IIIIR node).
26697 0 : size_t memory = numberOfNodes() * sizeof(SgTypeCrayPointer);
26698 :
26699 0 : return memory;
26700 : }
26701 :
26702 : /* #line 26703 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
26703 :
26704 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
26705 : void
26706 5668 : SgTypeLabel::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
26707 : {
26708 : // This function traverses the memory pool for only a specific IR node
26709 : // and calls the visit function of the input class execute a traversal
26710 : // similar to the style of the attribute based traversals within ROSE.
26711 : // This traversal will visit ALL nodes of the AST where as the other
26712 : // attribute based traversals visit only the embedded tree within the AST.
26713 :
26714 : // Initialize array to the address of the first element of the STL vector
26715 : // (which is guaranteed to be contiguous storage).
26716 : // SgTypeLabel objectArray [] = *(Memory_Block_List.begin());
26717 5668 : if (SgTypeLabel::pools.empty() == false)
26718 : {
26719 : // Generate an array of memory pools
26720 0 : SgTypeLabel** objectArray = (SgTypeLabel**) &(SgTypeLabel::pools[0]);
26721 :
26722 : // Build a local variable for better performance
26723 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
26724 : #if 0
26725 : // Iterate over the memory pools
26726 : for (unsigned int i=0; i < SgTypeLabel::pools.size(); i++)
26727 : {
26728 : // objectArray[i] is a single memory pool
26729 : for (int j=0; j < SgTypeLabel::pool_size; j++)
26730 : {
26731 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
26732 : {
26733 : traversal.visit(&(objectArray[i][j]));
26734 : }
26735 : }
26736 : }
26737 : #else
26738 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
26739 : // compute the list first and then call the visit function on each list element.
26740 :
26741 : // printf ("Inside of SgTypeLabel::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
26742 :
26743 0 : std::vector<SgTypeLabel*> nodeList;
26744 :
26745 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
26746 0 : for (unsigned int i=0; i < SgTypeLabel::pools.size(); i++)
26747 : {
26748 : // objectArray[i] is a single memory pool
26749 0 : for (unsigned j=0; j < SgTypeLabel::pool_size; j++)
26750 : {
26751 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
26752 : {
26753 0 : nodeList.push_back(&(objectArray[i][j]));
26754 : }
26755 : }
26756 : }
26757 :
26758 : // Iterate over the saved list
26759 0 : size_t nodeListSize = nodeList.size();
26760 0 : for (size_t i=0; i < nodeListSize; i++)
26761 : {
26762 0 : ROSE_ASSERT(nodeList[i] != NULL);
26763 : #if 0
26764 : traversal.visit(nodeList[i]);
26765 : #else
26766 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
26767 : {
26768 0 : traversal.visit(nodeList[i]);
26769 : }
26770 : #endif
26771 : }
26772 : #endif
26773 : }
26774 :
26775 : // This should not be required since all previously static data members are
26776 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
26777 :
26778 5668 : }
26779 :
26780 :
26781 : void
26782 194 : SgTypeLabel::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
26783 : {
26784 : // This function traverses the memory pool for an IR node and
26785 : // calls the function to execute the visitor object.
26786 :
26787 : // Initialize array to the address of the first element of the STL vector
26788 : // (which is guarenteed to be contiguous storage).
26789 : // SgTypeLabel objectArray [] = *(Memory_Block_List.begin());
26790 194 : if (SgTypeLabel::pools.empty() == false)
26791 : {
26792 : // Generate an array of memory pools
26793 0 : SgTypeLabel** objectArray = (SgTypeLabel**) &(SgTypeLabel::pools[0]);
26794 :
26795 : // Build a local variable for better performance
26796 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
26797 :
26798 : // Iterate over the memory pools
26799 0 : for (unsigned int i=0; i < SgTypeLabel::pools.size(); i++)
26800 : {
26801 : // objectArray[i] is a single memory pool
26802 0 : for (unsigned j=0; j < SgTypeLabel::pool_size; j++)
26803 : {
26804 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
26805 : {
26806 : // printf ("Found a valid SgTypeLabel object in the memory pool %d at position %d \n",i,j);
26807 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
26808 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
26809 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
26810 : }
26811 : else
26812 : {
26813 : // printf ("Found a INVALID SgTypeLabel object in the memory pool \n");
26814 : }
26815 : }
26816 : }
26817 : }
26818 :
26819 : // This should not be required since all previously static data members are
26820 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
26821 :
26822 194 : }
26823 :
26824 : void
26825 0 : SgTypeLabel::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
26826 : {
26827 : // This function visits only a single IR node of the memory pool.
26828 : // it is typically called once for each type of IR node within
26829 : // the automatically generated function: traverseRepresentativeNodes().
26830 :
26831 : // Initialize array to the address of the first element of the STL vector
26832 : // (which is guarenteed to be contiguous storage).
26833 : // SgTypeLabel objectArray [] = *(Memory_Block_List.begin());
26834 0 : if (SgTypeLabel::pools.empty() == false)
26835 : {
26836 : // Generate an array of memory pools
26837 0 : SgTypeLabel** objectArray = (SgTypeLabel**) &(SgTypeLabel::pools[0]);
26838 :
26839 : // Build a local variable for better performance
26840 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
26841 :
26842 : // Iterate over the memory pools
26843 0 : bool done = false;
26844 0 : unsigned i=0;
26845 :
26846 : // find the first valid IR node, call visit function, and then leave
26847 0 : while ( done == false && i < SgTypeLabel::pools.size() )
26848 : {
26849 : // objectArray[i] is a single memory pool
26850 : unsigned j=0;
26851 0 : while (done == false && j < SgTypeLabel::pool_size)
26852 : {
26853 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
26854 : {
26855 0 : traversal.visit(&(objectArray[i][j]));
26856 0 : done = true;
26857 : }
26858 0 : j++;
26859 : }
26860 0 : i++;
26861 : }
26862 :
26863 : #if 0
26864 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
26865 : if (done == false)
26866 : {
26867 : printf ("No representative for SgTypeLabel found in memory pools \n");
26868 : }
26869 : #endif
26870 : }
26871 0 : }
26872 :
26873 :
26874 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
26875 : // using values that overflow signed values of int.
26876 : size_t
26877 4 : SgTypeLabel::numberOfNodes()
26878 : {
26879 : // This function traverses the memory pool for an IR node and
26880 : // counts the number of IR nodes of a particular Sage III IR
26881 : // nodes type.
26882 :
26883 4 : size_t count = 0;
26884 4 : if (SgTypeLabel::pools.empty() == false)
26885 : {
26886 : // Generate an array of memory pools (this is actually a STL vector,
26887 : // but it is contiguious, so OK to treat this way).
26888 0 : SgTypeLabel** objectArray = (SgTypeLabel**) &(SgTypeLabel::pools[0]);
26889 :
26890 : // Build a local variable for better performance (make it a loop invariant variable).
26891 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
26892 :
26893 : // Iterate over all of the memory pools for this IR node.
26894 0 : for (unsigned int i=0; i < SgTypeLabel::pools.size(); i++)
26895 : {
26896 : // objectArray[i] is a single memory pool, iterate over all the
26897 : // IR nodes and only count those that are valid IR nodes used in
26898 : // the AST (i.e. allocated IR nodes).
26899 0 : for (unsigned j=0; j < SgTypeLabel::pool_size; j++)
26900 : {
26901 : // This is indexing the STL vector of C/C++ style arrays as a doubly
26902 : // indexed array access. It is OK since we have leveraged the semantics
26903 : // of STL vector memory as contigous and cast the memory as an array
26904 : // of arrays to use the 2D array indexing. Hope this is not confusing,
26905 : // but it s very fast as an implementation.
26906 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
26907 : {
26908 0 : count++;
26909 : }
26910 : }
26911 : }
26912 : }
26913 :
26914 :
26915 :
26916 4 : return count;
26917 : }
26918 :
26919 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
26920 : // using values that overflow signed values of int.
26921 : size_t
26922 0 : SgTypeLabel::memoryUsage()
26923 : {
26924 : // This function is required because we need the class name as a type when we call sizeof
26925 : // There might be another way to implement this if we have a traversal that only called a
26926 : // representative object (one call for each type of Sage IIIIR node).
26927 0 : size_t memory = numberOfNodes() * sizeof(SgTypeLabel);
26928 :
26929 0 : return memory;
26930 : }
26931 :
26932 : /* #line 26933 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
26933 :
26934 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
26935 : void
26936 5668 : SgRvalueReferenceType::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
26937 : {
26938 : // This function traverses the memory pool for only a specific IR node
26939 : // and calls the visit function of the input class execute a traversal
26940 : // similar to the style of the attribute based traversals within ROSE.
26941 : // This traversal will visit ALL nodes of the AST where as the other
26942 : // attribute based traversals visit only the embedded tree within the AST.
26943 :
26944 : // Initialize array to the address of the first element of the STL vector
26945 : // (which is guaranteed to be contiguous storage).
26946 : // SgRvalueReferenceType objectArray [] = *(Memory_Block_List.begin());
26947 5668 : if (SgRvalueReferenceType::pools.empty() == false)
26948 : {
26949 : // Generate an array of memory pools
26950 145 : SgRvalueReferenceType** objectArray = (SgRvalueReferenceType**) &(SgRvalueReferenceType::pools[0]);
26951 :
26952 : // Build a local variable for better performance
26953 145 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
26954 : #if 0
26955 : // Iterate over the memory pools
26956 : for (unsigned int i=0; i < SgRvalueReferenceType::pools.size(); i++)
26957 : {
26958 : // objectArray[i] is a single memory pool
26959 : for (int j=0; j < SgRvalueReferenceType::pool_size; j++)
26960 : {
26961 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
26962 : {
26963 : traversal.visit(&(objectArray[i][j]));
26964 : }
26965 : }
26966 : }
26967 : #else
26968 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
26969 : // compute the list first and then call the visit function on each list element.
26970 :
26971 : // printf ("Inside of SgRvalueReferenceType::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
26972 :
26973 290 : std::vector<SgRvalueReferenceType*> nodeList;
26974 :
26975 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
26976 290 : for (unsigned int i=0; i < SgRvalueReferenceType::pools.size(); i++)
26977 : {
26978 : // objectArray[i] is a single memory pool
26979 290145 : for (unsigned j=0; j < SgRvalueReferenceType::pool_size; j++)
26980 : {
26981 290000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
26982 : {
26983 24263 : nodeList.push_back(&(objectArray[i][j]));
26984 : }
26985 : }
26986 : }
26987 :
26988 : // Iterate over the saved list
26989 145 : size_t nodeListSize = nodeList.size();
26990 24408 : for (size_t i=0; i < nodeListSize; i++)
26991 : {
26992 24263 : ROSE_ASSERT(nodeList[i] != NULL);
26993 : #if 0
26994 : traversal.visit(nodeList[i]);
26995 : #else
26996 24263 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
26997 : {
26998 24263 : traversal.visit(nodeList[i]);
26999 : }
27000 : #endif
27001 : }
27002 : #endif
27003 : }
27004 :
27005 : // This should not be required since all previously static data members are
27006 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
27007 :
27008 5668 : }
27009 :
27010 :
27011 : void
27012 194 : SgRvalueReferenceType::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
27013 : {
27014 : // This function traverses the memory pool for an IR node and
27015 : // calls the function to execute the visitor object.
27016 :
27017 : // Initialize array to the address of the first element of the STL vector
27018 : // (which is guarenteed to be contiguous storage).
27019 : // SgRvalueReferenceType objectArray [] = *(Memory_Block_List.begin());
27020 194 : if (SgRvalueReferenceType::pools.empty() == false)
27021 : {
27022 : // Generate an array of memory pools
27023 137 : SgRvalueReferenceType** objectArray = (SgRvalueReferenceType**) &(SgRvalueReferenceType::pools[0]);
27024 :
27025 : // Build a local variable for better performance
27026 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
27027 :
27028 : // Iterate over the memory pools
27029 274 : for (unsigned int i=0; i < SgRvalueReferenceType::pools.size(); i++)
27030 : {
27031 : // objectArray[i] is a single memory pool
27032 274137 : for (unsigned j=0; j < SgRvalueReferenceType::pool_size; j++)
27033 : {
27034 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
27035 : {
27036 : // printf ("Found a valid SgRvalueReferenceType object in the memory pool %d at position %d \n",i,j);
27037 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
27038 25295 : objectArray[i][j].executeVisitorMemberFunction(visitor);
27039 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
27040 : }
27041 : else
27042 : {
27043 : // printf ("Found a INVALID SgRvalueReferenceType object in the memory pool \n");
27044 : }
27045 : }
27046 : }
27047 : }
27048 :
27049 : // This should not be required since all previously static data members are
27050 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
27051 :
27052 194 : }
27053 :
27054 : void
27055 0 : SgRvalueReferenceType::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
27056 : {
27057 : // This function visits only a single IR node of the memory pool.
27058 : // it is typically called once for each type of IR node within
27059 : // the automatically generated function: traverseRepresentativeNodes().
27060 :
27061 : // Initialize array to the address of the first element of the STL vector
27062 : // (which is guarenteed to be contiguous storage).
27063 : // SgRvalueReferenceType objectArray [] = *(Memory_Block_List.begin());
27064 0 : if (SgRvalueReferenceType::pools.empty() == false)
27065 : {
27066 : // Generate an array of memory pools
27067 0 : SgRvalueReferenceType** objectArray = (SgRvalueReferenceType**) &(SgRvalueReferenceType::pools[0]);
27068 :
27069 : // Build a local variable for better performance
27070 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
27071 :
27072 : // Iterate over the memory pools
27073 0 : bool done = false;
27074 0 : unsigned i=0;
27075 :
27076 : // find the first valid IR node, call visit function, and then leave
27077 0 : while ( done == false && i < SgRvalueReferenceType::pools.size() )
27078 : {
27079 : // objectArray[i] is a single memory pool
27080 : unsigned j=0;
27081 0 : while (done == false && j < SgRvalueReferenceType::pool_size)
27082 : {
27083 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
27084 : {
27085 0 : traversal.visit(&(objectArray[i][j]));
27086 0 : done = true;
27087 : }
27088 0 : j++;
27089 : }
27090 0 : i++;
27091 : }
27092 :
27093 : #if 0
27094 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
27095 : if (done == false)
27096 : {
27097 : printf ("No representative for SgRvalueReferenceType found in memory pools \n");
27098 : }
27099 : #endif
27100 : }
27101 0 : }
27102 :
27103 :
27104 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
27105 : // using values that overflow signed values of int.
27106 : size_t
27107 4 : SgRvalueReferenceType::numberOfNodes()
27108 : {
27109 : // This function traverses the memory pool for an IR node and
27110 : // counts the number of IR nodes of a particular Sage III IR
27111 : // nodes type.
27112 :
27113 4 : size_t count = 0;
27114 4 : if (SgRvalueReferenceType::pools.empty() == false)
27115 : {
27116 : // Generate an array of memory pools (this is actually a STL vector,
27117 : // but it is contiguious, so OK to treat this way).
27118 1 : SgRvalueReferenceType** objectArray = (SgRvalueReferenceType**) &(SgRvalueReferenceType::pools[0]);
27119 :
27120 : // Build a local variable for better performance (make it a loop invariant variable).
27121 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
27122 :
27123 : // Iterate over all of the memory pools for this IR node.
27124 2 : for (unsigned int i=0; i < SgRvalueReferenceType::pools.size(); i++)
27125 : {
27126 : // objectArray[i] is a single memory pool, iterate over all the
27127 : // IR nodes and only count those that are valid IR nodes used in
27128 : // the AST (i.e. allocated IR nodes).
27129 2001 : for (unsigned j=0; j < SgRvalueReferenceType::pool_size; j++)
27130 : {
27131 : // This is indexing the STL vector of C/C++ style arrays as a doubly
27132 : // indexed array access. It is OK since we have leveraged the semantics
27133 : // of STL vector memory as contigous and cast the memory as an array
27134 : // of arrays to use the 2D array indexing. Hope this is not confusing,
27135 : // but it s very fast as an implementation.
27136 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
27137 : {
27138 182 : count++;
27139 : }
27140 : }
27141 : }
27142 : }
27143 :
27144 :
27145 :
27146 4 : return count;
27147 : }
27148 :
27149 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
27150 : // using values that overflow signed values of int.
27151 : size_t
27152 0 : SgRvalueReferenceType::memoryUsage()
27153 : {
27154 : // This function is required because we need the class name as a type when we call sizeof
27155 : // There might be another way to implement this if we have a traversal that only called a
27156 : // representative object (one call for each type of Sage IIIIR node).
27157 0 : size_t memory = numberOfNodes() * sizeof(SgRvalueReferenceType);
27158 :
27159 0 : return memory;
27160 : }
27161 :
27162 : /* #line 27163 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
27163 :
27164 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
27165 : void
27166 5668 : SgTypeNullptr::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
27167 : {
27168 : // This function traverses the memory pool for only a specific IR node
27169 : // and calls the visit function of the input class execute a traversal
27170 : // similar to the style of the attribute based traversals within ROSE.
27171 : // This traversal will visit ALL nodes of the AST where as the other
27172 : // attribute based traversals visit only the embedded tree within the AST.
27173 :
27174 : // Initialize array to the address of the first element of the STL vector
27175 : // (which is guaranteed to be contiguous storage).
27176 : // SgTypeNullptr objectArray [] = *(Memory_Block_List.begin());
27177 5668 : if (SgTypeNullptr::pools.empty() == false)
27178 : {
27179 : // Generate an array of memory pools
27180 876 : SgTypeNullptr** objectArray = (SgTypeNullptr**) &(SgTypeNullptr::pools[0]);
27181 :
27182 : // Build a local variable for better performance
27183 876 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
27184 : #if 0
27185 : // Iterate over the memory pools
27186 : for (unsigned int i=0; i < SgTypeNullptr::pools.size(); i++)
27187 : {
27188 : // objectArray[i] is a single memory pool
27189 : for (int j=0; j < SgTypeNullptr::pool_size; j++)
27190 : {
27191 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
27192 : {
27193 : traversal.visit(&(objectArray[i][j]));
27194 : }
27195 : }
27196 : }
27197 : #else
27198 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
27199 : // compute the list first and then call the visit function on each list element.
27200 :
27201 : // printf ("Inside of SgTypeNullptr::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
27202 :
27203 1752 : std::vector<SgTypeNullptr*> nodeList;
27204 :
27205 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
27206 1752 : for (unsigned int i=0; i < SgTypeNullptr::pools.size(); i++)
27207 : {
27208 : // objectArray[i] is a single memory pool
27209 1752880 : for (unsigned j=0; j < SgTypeNullptr::pool_size; j++)
27210 : {
27211 1752000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
27212 : {
27213 876 : nodeList.push_back(&(objectArray[i][j]));
27214 : }
27215 : }
27216 : }
27217 :
27218 : // Iterate over the saved list
27219 876 : size_t nodeListSize = nodeList.size();
27220 1752 : for (size_t i=0; i < nodeListSize; i++)
27221 : {
27222 876 : ROSE_ASSERT(nodeList[i] != NULL);
27223 : #if 0
27224 : traversal.visit(nodeList[i]);
27225 : #else
27226 876 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
27227 : {
27228 876 : traversal.visit(nodeList[i]);
27229 : }
27230 : #endif
27231 : }
27232 : #endif
27233 : }
27234 :
27235 : // This should not be required since all previously static data members are
27236 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
27237 :
27238 5668 : }
27239 :
27240 :
27241 : void
27242 194 : SgTypeNullptr::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
27243 : {
27244 : // This function traverses the memory pool for an IR node and
27245 : // calls the function to execute the visitor object.
27246 :
27247 : // Initialize array to the address of the first element of the STL vector
27248 : // (which is guarenteed to be contiguous storage).
27249 : // SgTypeNullptr objectArray [] = *(Memory_Block_List.begin());
27250 194 : if (SgTypeNullptr::pools.empty() == false)
27251 : {
27252 : // Generate an array of memory pools
27253 194 : SgTypeNullptr** objectArray = (SgTypeNullptr**) &(SgTypeNullptr::pools[0]);
27254 :
27255 : // Build a local variable for better performance
27256 194 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
27257 :
27258 : // Iterate over the memory pools
27259 388 : for (unsigned int i=0; i < SgTypeNullptr::pools.size(); i++)
27260 : {
27261 : // objectArray[i] is a single memory pool
27262 388194 : for (unsigned j=0; j < SgTypeNullptr::pool_size; j++)
27263 : {
27264 388000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
27265 : {
27266 : // printf ("Found a valid SgTypeNullptr object in the memory pool %d at position %d \n",i,j);
27267 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
27268 194 : objectArray[i][j].executeVisitorMemberFunction(visitor);
27269 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
27270 : }
27271 : else
27272 : {
27273 : // printf ("Found a INVALID SgTypeNullptr object in the memory pool \n");
27274 : }
27275 : }
27276 : }
27277 : }
27278 :
27279 : // This should not be required since all previously static data members are
27280 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
27281 :
27282 194 : }
27283 :
27284 : void
27285 0 : SgTypeNullptr::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
27286 : {
27287 : // This function visits only a single IR node of the memory pool.
27288 : // it is typically called once for each type of IR node within
27289 : // the automatically generated function: traverseRepresentativeNodes().
27290 :
27291 : // Initialize array to the address of the first element of the STL vector
27292 : // (which is guarenteed to be contiguous storage).
27293 : // SgTypeNullptr objectArray [] = *(Memory_Block_List.begin());
27294 0 : if (SgTypeNullptr::pools.empty() == false)
27295 : {
27296 : // Generate an array of memory pools
27297 0 : SgTypeNullptr** objectArray = (SgTypeNullptr**) &(SgTypeNullptr::pools[0]);
27298 :
27299 : // Build a local variable for better performance
27300 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
27301 :
27302 : // Iterate over the memory pools
27303 0 : bool done = false;
27304 0 : unsigned i=0;
27305 :
27306 : // find the first valid IR node, call visit function, and then leave
27307 0 : while ( done == false && i < SgTypeNullptr::pools.size() )
27308 : {
27309 : // objectArray[i] is a single memory pool
27310 : unsigned j=0;
27311 0 : while (done == false && j < SgTypeNullptr::pool_size)
27312 : {
27313 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
27314 : {
27315 0 : traversal.visit(&(objectArray[i][j]));
27316 0 : done = true;
27317 : }
27318 0 : j++;
27319 : }
27320 0 : i++;
27321 : }
27322 :
27323 : #if 0
27324 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
27325 : if (done == false)
27326 : {
27327 : printf ("No representative for SgTypeNullptr found in memory pools \n");
27328 : }
27329 : #endif
27330 : }
27331 0 : }
27332 :
27333 :
27334 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
27335 : // using values that overflow signed values of int.
27336 : size_t
27337 4 : SgTypeNullptr::numberOfNodes()
27338 : {
27339 : // This function traverses the memory pool for an IR node and
27340 : // counts the number of IR nodes of a particular Sage III IR
27341 : // nodes type.
27342 :
27343 4 : size_t count = 0;
27344 4 : if (SgTypeNullptr::pools.empty() == false)
27345 : {
27346 : // Generate an array of memory pools (this is actually a STL vector,
27347 : // but it is contiguious, so OK to treat this way).
27348 1 : SgTypeNullptr** objectArray = (SgTypeNullptr**) &(SgTypeNullptr::pools[0]);
27349 :
27350 : // Build a local variable for better performance (make it a loop invariant variable).
27351 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
27352 :
27353 : // Iterate over all of the memory pools for this IR node.
27354 2 : for (unsigned int i=0; i < SgTypeNullptr::pools.size(); i++)
27355 : {
27356 : // objectArray[i] is a single memory pool, iterate over all the
27357 : // IR nodes and only count those that are valid IR nodes used in
27358 : // the AST (i.e. allocated IR nodes).
27359 2001 : for (unsigned j=0; j < SgTypeNullptr::pool_size; j++)
27360 : {
27361 : // This is indexing the STL vector of C/C++ style arrays as a doubly
27362 : // indexed array access. It is OK since we have leveraged the semantics
27363 : // of STL vector memory as contigous and cast the memory as an array
27364 : // of arrays to use the 2D array indexing. Hope this is not confusing,
27365 : // but it s very fast as an implementation.
27366 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
27367 : {
27368 1 : count++;
27369 : }
27370 : }
27371 : }
27372 : }
27373 :
27374 :
27375 :
27376 4 : return count;
27377 : }
27378 :
27379 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
27380 : // using values that overflow signed values of int.
27381 : size_t
27382 0 : SgTypeNullptr::memoryUsage()
27383 : {
27384 : // This function is required because we need the class name as a type when we call sizeof
27385 : // There might be another way to implement this if we have a traversal that only called a
27386 : // representative object (one call for each type of Sage IIIIR node).
27387 0 : size_t memory = numberOfNodes() * sizeof(SgTypeNullptr);
27388 :
27389 0 : return memory;
27390 : }
27391 :
27392 : /* #line 27393 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
27393 :
27394 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
27395 : void
27396 5668 : SgDeclType::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
27397 : {
27398 : // This function traverses the memory pool for only a specific IR node
27399 : // and calls the visit function of the input class execute a traversal
27400 : // similar to the style of the attribute based traversals within ROSE.
27401 : // This traversal will visit ALL nodes of the AST where as the other
27402 : // attribute based traversals visit only the embedded tree within the AST.
27403 :
27404 : // Initialize array to the address of the first element of the STL vector
27405 : // (which is guaranteed to be contiguous storage).
27406 : // SgDeclType objectArray [] = *(Memory_Block_List.begin());
27407 5668 : if (SgDeclType::pools.empty() == false)
27408 : {
27409 : // Generate an array of memory pools
27410 876 : SgDeclType** objectArray = (SgDeclType**) &(SgDeclType::pools[0]);
27411 :
27412 : // Build a local variable for better performance
27413 876 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
27414 : #if 0
27415 : // Iterate over the memory pools
27416 : for (unsigned int i=0; i < SgDeclType::pools.size(); i++)
27417 : {
27418 : // objectArray[i] is a single memory pool
27419 : for (int j=0; j < SgDeclType::pool_size; j++)
27420 : {
27421 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
27422 : {
27423 : traversal.visit(&(objectArray[i][j]));
27424 : }
27425 : }
27426 : }
27427 : #else
27428 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
27429 : // compute the list first and then call the visit function on each list element.
27430 :
27431 : // printf ("Inside of SgDeclType::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
27432 :
27433 1752 : std::vector<SgDeclType*> nodeList;
27434 :
27435 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
27436 1752 : for (unsigned int i=0; i < SgDeclType::pools.size(); i++)
27437 : {
27438 : // objectArray[i] is a single memory pool
27439 1752880 : for (unsigned j=0; j < SgDeclType::pool_size; j++)
27440 : {
27441 1752000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
27442 : {
27443 13088 : nodeList.push_back(&(objectArray[i][j]));
27444 : }
27445 : }
27446 : }
27447 :
27448 : // Iterate over the saved list
27449 876 : size_t nodeListSize = nodeList.size();
27450 13964 : for (size_t i=0; i < nodeListSize; i++)
27451 : {
27452 13088 : ROSE_ASSERT(nodeList[i] != NULL);
27453 : #if 0
27454 : traversal.visit(nodeList[i]);
27455 : #else
27456 13088 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
27457 : {
27458 13088 : traversal.visit(nodeList[i]);
27459 : }
27460 : #endif
27461 : }
27462 : #endif
27463 : }
27464 :
27465 : // This should not be required since all previously static data members are
27466 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
27467 :
27468 5668 : }
27469 :
27470 :
27471 : void
27472 194 : SgDeclType::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
27473 : {
27474 : // This function traverses the memory pool for an IR node and
27475 : // calls the function to execute the visitor object.
27476 :
27477 : // Initialize array to the address of the first element of the STL vector
27478 : // (which is guarenteed to be contiguous storage).
27479 : // SgDeclType objectArray [] = *(Memory_Block_List.begin());
27480 194 : if (SgDeclType::pools.empty() == false)
27481 : {
27482 : // Generate an array of memory pools
27483 194 : SgDeclType** objectArray = (SgDeclType**) &(SgDeclType::pools[0]);
27484 :
27485 : // Build a local variable for better performance
27486 194 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
27487 :
27488 : // Iterate over the memory pools
27489 388 : for (unsigned int i=0; i < SgDeclType::pools.size(); i++)
27490 : {
27491 : // objectArray[i] is a single memory pool
27492 388194 : for (unsigned j=0; j < SgDeclType::pool_size; j++)
27493 : {
27494 388000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
27495 : {
27496 : // printf ("Found a valid SgDeclType object in the memory pool %d at position %d \n",i,j);
27497 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
27498 12645 : objectArray[i][j].executeVisitorMemberFunction(visitor);
27499 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
27500 : }
27501 : else
27502 : {
27503 : // printf ("Found a INVALID SgDeclType object in the memory pool \n");
27504 : }
27505 : }
27506 : }
27507 : }
27508 :
27509 : // This should not be required since all previously static data members are
27510 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
27511 :
27512 194 : }
27513 :
27514 : void
27515 0 : SgDeclType::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
27516 : {
27517 : // This function visits only a single IR node of the memory pool.
27518 : // it is typically called once for each type of IR node within
27519 : // the automatically generated function: traverseRepresentativeNodes().
27520 :
27521 : // Initialize array to the address of the first element of the STL vector
27522 : // (which is guarenteed to be contiguous storage).
27523 : // SgDeclType objectArray [] = *(Memory_Block_List.begin());
27524 0 : if (SgDeclType::pools.empty() == false)
27525 : {
27526 : // Generate an array of memory pools
27527 0 : SgDeclType** objectArray = (SgDeclType**) &(SgDeclType::pools[0]);
27528 :
27529 : // Build a local variable for better performance
27530 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
27531 :
27532 : // Iterate over the memory pools
27533 0 : bool done = false;
27534 0 : unsigned i=0;
27535 :
27536 : // find the first valid IR node, call visit function, and then leave
27537 0 : while ( done == false && i < SgDeclType::pools.size() )
27538 : {
27539 : // objectArray[i] is a single memory pool
27540 : unsigned j=0;
27541 0 : while (done == false && j < SgDeclType::pool_size)
27542 : {
27543 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
27544 : {
27545 0 : traversal.visit(&(objectArray[i][j]));
27546 0 : done = true;
27547 : }
27548 0 : j++;
27549 : }
27550 0 : i++;
27551 : }
27552 :
27553 : #if 0
27554 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
27555 : if (done == false)
27556 : {
27557 : printf ("No representative for SgDeclType found in memory pools \n");
27558 : }
27559 : #endif
27560 : }
27561 0 : }
27562 :
27563 :
27564 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
27565 : // using values that overflow signed values of int.
27566 : size_t
27567 4 : SgDeclType::numberOfNodes()
27568 : {
27569 : // This function traverses the memory pool for an IR node and
27570 : // counts the number of IR nodes of a particular Sage III IR
27571 : // nodes type.
27572 :
27573 4 : size_t count = 0;
27574 4 : if (SgDeclType::pools.empty() == false)
27575 : {
27576 : // Generate an array of memory pools (this is actually a STL vector,
27577 : // but it is contiguious, so OK to treat this way).
27578 1 : SgDeclType** objectArray = (SgDeclType**) &(SgDeclType::pools[0]);
27579 :
27580 : // Build a local variable for better performance (make it a loop invariant variable).
27581 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
27582 :
27583 : // Iterate over all of the memory pools for this IR node.
27584 2 : for (unsigned int i=0; i < SgDeclType::pools.size(); i++)
27585 : {
27586 : // objectArray[i] is a single memory pool, iterate over all the
27587 : // IR nodes and only count those that are valid IR nodes used in
27588 : // the AST (i.e. allocated IR nodes).
27589 2001 : for (unsigned j=0; j < SgDeclType::pool_size; j++)
27590 : {
27591 : // This is indexing the STL vector of C/C++ style arrays as a doubly
27592 : // indexed array access. It is OK since we have leveraged the semantics
27593 : // of STL vector memory as contigous and cast the memory as an array
27594 : // of arrays to use the 2D array indexing. Hope this is not confusing,
27595 : // but it s very fast as an implementation.
27596 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
27597 : {
27598 92 : count++;
27599 : }
27600 : }
27601 : }
27602 : }
27603 :
27604 :
27605 :
27606 4 : return count;
27607 : }
27608 :
27609 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
27610 : // using values that overflow signed values of int.
27611 : size_t
27612 0 : SgDeclType::memoryUsage()
27613 : {
27614 : // This function is required because we need the class name as a type when we call sizeof
27615 : // There might be another way to implement this if we have a traversal that only called a
27616 : // representative object (one call for each type of Sage IIIIR node).
27617 0 : size_t memory = numberOfNodes() * sizeof(SgDeclType);
27618 :
27619 0 : return memory;
27620 : }
27621 :
27622 : /* #line 27623 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
27623 :
27624 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
27625 : void
27626 5668 : SgTypeOfType::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
27627 : {
27628 : // This function traverses the memory pool for only a specific IR node
27629 : // and calls the visit function of the input class execute a traversal
27630 : // similar to the style of the attribute based traversals within ROSE.
27631 : // This traversal will visit ALL nodes of the AST where as the other
27632 : // attribute based traversals visit only the embedded tree within the AST.
27633 :
27634 : // Initialize array to the address of the first element of the STL vector
27635 : // (which is guaranteed to be contiguous storage).
27636 : // SgTypeOfType objectArray [] = *(Memory_Block_List.begin());
27637 5668 : if (SgTypeOfType::pools.empty() == false)
27638 : {
27639 : // Generate an array of memory pools
27640 145 : SgTypeOfType** objectArray = (SgTypeOfType**) &(SgTypeOfType::pools[0]);
27641 :
27642 : // Build a local variable for better performance
27643 145 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
27644 : #if 0
27645 : // Iterate over the memory pools
27646 : for (unsigned int i=0; i < SgTypeOfType::pools.size(); i++)
27647 : {
27648 : // objectArray[i] is a single memory pool
27649 : for (int j=0; j < SgTypeOfType::pool_size; j++)
27650 : {
27651 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
27652 : {
27653 : traversal.visit(&(objectArray[i][j]));
27654 : }
27655 : }
27656 : }
27657 : #else
27658 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
27659 : // compute the list first and then call the visit function on each list element.
27660 :
27661 : // printf ("Inside of SgTypeOfType::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
27662 :
27663 290 : std::vector<SgTypeOfType*> nodeList;
27664 :
27665 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
27666 290 : for (unsigned int i=0; i < SgTypeOfType::pools.size(); i++)
27667 : {
27668 : // objectArray[i] is a single memory pool
27669 290145 : for (unsigned j=0; j < SgTypeOfType::pool_size; j++)
27670 : {
27671 290000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
27672 : {
27673 507 : nodeList.push_back(&(objectArray[i][j]));
27674 : }
27675 : }
27676 : }
27677 :
27678 : // Iterate over the saved list
27679 145 : size_t nodeListSize = nodeList.size();
27680 652 : for (size_t i=0; i < nodeListSize; i++)
27681 : {
27682 507 : ROSE_ASSERT(nodeList[i] != NULL);
27683 : #if 0
27684 : traversal.visit(nodeList[i]);
27685 : #else
27686 507 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
27687 : {
27688 507 : traversal.visit(nodeList[i]);
27689 : }
27690 : #endif
27691 : }
27692 : #endif
27693 : }
27694 :
27695 : // This should not be required since all previously static data members are
27696 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
27697 :
27698 5668 : }
27699 :
27700 :
27701 : void
27702 194 : SgTypeOfType::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
27703 : {
27704 : // This function traverses the memory pool for an IR node and
27705 : // calls the function to execute the visitor object.
27706 :
27707 : // Initialize array to the address of the first element of the STL vector
27708 : // (which is guarenteed to be contiguous storage).
27709 : // SgTypeOfType objectArray [] = *(Memory_Block_List.begin());
27710 194 : if (SgTypeOfType::pools.empty() == false)
27711 : {
27712 : // Generate an array of memory pools
27713 137 : SgTypeOfType** objectArray = (SgTypeOfType**) &(SgTypeOfType::pools[0]);
27714 :
27715 : // Build a local variable for better performance
27716 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
27717 :
27718 : // Iterate over the memory pools
27719 274 : for (unsigned int i=0; i < SgTypeOfType::pools.size(); i++)
27720 : {
27721 : // objectArray[i] is a single memory pool
27722 274137 : for (unsigned j=0; j < SgTypeOfType::pool_size; j++)
27723 : {
27724 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
27725 : {
27726 : // printf ("Found a valid SgTypeOfType object in the memory pool %d at position %d \n",i,j);
27727 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
27728 411 : objectArray[i][j].executeVisitorMemberFunction(visitor);
27729 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
27730 : }
27731 : else
27732 : {
27733 : // printf ("Found a INVALID SgTypeOfType object in the memory pool \n");
27734 : }
27735 : }
27736 : }
27737 : }
27738 :
27739 : // This should not be required since all previously static data members are
27740 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
27741 :
27742 194 : }
27743 :
27744 : void
27745 0 : SgTypeOfType::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
27746 : {
27747 : // This function visits only a single IR node of the memory pool.
27748 : // it is typically called once for each type of IR node within
27749 : // the automatically generated function: traverseRepresentativeNodes().
27750 :
27751 : // Initialize array to the address of the first element of the STL vector
27752 : // (which is guarenteed to be contiguous storage).
27753 : // SgTypeOfType objectArray [] = *(Memory_Block_List.begin());
27754 0 : if (SgTypeOfType::pools.empty() == false)
27755 : {
27756 : // Generate an array of memory pools
27757 0 : SgTypeOfType** objectArray = (SgTypeOfType**) &(SgTypeOfType::pools[0]);
27758 :
27759 : // Build a local variable for better performance
27760 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
27761 :
27762 : // Iterate over the memory pools
27763 0 : bool done = false;
27764 0 : unsigned i=0;
27765 :
27766 : // find the first valid IR node, call visit function, and then leave
27767 0 : while ( done == false && i < SgTypeOfType::pools.size() )
27768 : {
27769 : // objectArray[i] is a single memory pool
27770 : unsigned j=0;
27771 0 : while (done == false && j < SgTypeOfType::pool_size)
27772 : {
27773 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
27774 : {
27775 0 : traversal.visit(&(objectArray[i][j]));
27776 0 : done = true;
27777 : }
27778 0 : j++;
27779 : }
27780 0 : i++;
27781 : }
27782 :
27783 : #if 0
27784 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
27785 : if (done == false)
27786 : {
27787 : printf ("No representative for SgTypeOfType found in memory pools \n");
27788 : }
27789 : #endif
27790 : }
27791 0 : }
27792 :
27793 :
27794 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
27795 : // using values that overflow signed values of int.
27796 : size_t
27797 4 : SgTypeOfType::numberOfNodes()
27798 : {
27799 : // This function traverses the memory pool for an IR node and
27800 : // counts the number of IR nodes of a particular Sage III IR
27801 : // nodes type.
27802 :
27803 4 : size_t count = 0;
27804 4 : if (SgTypeOfType::pools.empty() == false)
27805 : {
27806 : // Generate an array of memory pools (this is actually a STL vector,
27807 : // but it is contiguious, so OK to treat this way).
27808 1 : SgTypeOfType** objectArray = (SgTypeOfType**) &(SgTypeOfType::pools[0]);
27809 :
27810 : // Build a local variable for better performance (make it a loop invariant variable).
27811 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
27812 :
27813 : // Iterate over all of the memory pools for this IR node.
27814 2 : for (unsigned int i=0; i < SgTypeOfType::pools.size(); i++)
27815 : {
27816 : // objectArray[i] is a single memory pool, iterate over all the
27817 : // IR nodes and only count those that are valid IR nodes used in
27818 : // the AST (i.e. allocated IR nodes).
27819 2001 : for (unsigned j=0; j < SgTypeOfType::pool_size; j++)
27820 : {
27821 : // This is indexing the STL vector of C/C++ style arrays as a doubly
27822 : // indexed array access. It is OK since we have leveraged the semantics
27823 : // of STL vector memory as contigous and cast the memory as an array
27824 : // of arrays to use the 2D array indexing. Hope this is not confusing,
27825 : // but it s very fast as an implementation.
27826 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
27827 : {
27828 3 : count++;
27829 : }
27830 : }
27831 : }
27832 : }
27833 :
27834 :
27835 :
27836 4 : return count;
27837 : }
27838 :
27839 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
27840 : // using values that overflow signed values of int.
27841 : size_t
27842 0 : SgTypeOfType::memoryUsage()
27843 : {
27844 : // This function is required because we need the class name as a type when we call sizeof
27845 : // There might be another way to implement this if we have a traversal that only called a
27846 : // representative object (one call for each type of Sage IIIIR node).
27847 0 : size_t memory = numberOfNodes() * sizeof(SgTypeOfType);
27848 :
27849 0 : return memory;
27850 : }
27851 :
27852 : /* #line 27853 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
27853 :
27854 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
27855 : void
27856 5668 : SgTypeMatrix::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
27857 : {
27858 : // This function traverses the memory pool for only a specific IR node
27859 : // and calls the visit function of the input class execute a traversal
27860 : // similar to the style of the attribute based traversals within ROSE.
27861 : // This traversal will visit ALL nodes of the AST where as the other
27862 : // attribute based traversals visit only the embedded tree within the AST.
27863 :
27864 : // Initialize array to the address of the first element of the STL vector
27865 : // (which is guaranteed to be contiguous storage).
27866 : // SgTypeMatrix objectArray [] = *(Memory_Block_List.begin());
27867 5668 : if (SgTypeMatrix::pools.empty() == false)
27868 : {
27869 : // Generate an array of memory pools
27870 0 : SgTypeMatrix** objectArray = (SgTypeMatrix**) &(SgTypeMatrix::pools[0]);
27871 :
27872 : // Build a local variable for better performance
27873 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
27874 : #if 0
27875 : // Iterate over the memory pools
27876 : for (unsigned int i=0; i < SgTypeMatrix::pools.size(); i++)
27877 : {
27878 : // objectArray[i] is a single memory pool
27879 : for (int j=0; j < SgTypeMatrix::pool_size; j++)
27880 : {
27881 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
27882 : {
27883 : traversal.visit(&(objectArray[i][j]));
27884 : }
27885 : }
27886 : }
27887 : #else
27888 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
27889 : // compute the list first and then call the visit function on each list element.
27890 :
27891 : // printf ("Inside of SgTypeMatrix::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
27892 :
27893 0 : std::vector<SgTypeMatrix*> nodeList;
27894 :
27895 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
27896 0 : for (unsigned int i=0; i < SgTypeMatrix::pools.size(); i++)
27897 : {
27898 : // objectArray[i] is a single memory pool
27899 0 : for (unsigned j=0; j < SgTypeMatrix::pool_size; j++)
27900 : {
27901 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
27902 : {
27903 0 : nodeList.push_back(&(objectArray[i][j]));
27904 : }
27905 : }
27906 : }
27907 :
27908 : // Iterate over the saved list
27909 0 : size_t nodeListSize = nodeList.size();
27910 0 : for (size_t i=0; i < nodeListSize; i++)
27911 : {
27912 0 : ROSE_ASSERT(nodeList[i] != NULL);
27913 : #if 0
27914 : traversal.visit(nodeList[i]);
27915 : #else
27916 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
27917 : {
27918 0 : traversal.visit(nodeList[i]);
27919 : }
27920 : #endif
27921 : }
27922 : #endif
27923 : }
27924 :
27925 : // This should not be required since all previously static data members are
27926 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
27927 :
27928 5668 : }
27929 :
27930 :
27931 : void
27932 194 : SgTypeMatrix::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
27933 : {
27934 : // This function traverses the memory pool for an IR node and
27935 : // calls the function to execute the visitor object.
27936 :
27937 : // Initialize array to the address of the first element of the STL vector
27938 : // (which is guarenteed to be contiguous storage).
27939 : // SgTypeMatrix objectArray [] = *(Memory_Block_List.begin());
27940 194 : if (SgTypeMatrix::pools.empty() == false)
27941 : {
27942 : // Generate an array of memory pools
27943 0 : SgTypeMatrix** objectArray = (SgTypeMatrix**) &(SgTypeMatrix::pools[0]);
27944 :
27945 : // Build a local variable for better performance
27946 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
27947 :
27948 : // Iterate over the memory pools
27949 0 : for (unsigned int i=0; i < SgTypeMatrix::pools.size(); i++)
27950 : {
27951 : // objectArray[i] is a single memory pool
27952 0 : for (unsigned j=0; j < SgTypeMatrix::pool_size; j++)
27953 : {
27954 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
27955 : {
27956 : // printf ("Found a valid SgTypeMatrix object in the memory pool %d at position %d \n",i,j);
27957 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
27958 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
27959 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
27960 : }
27961 : else
27962 : {
27963 : // printf ("Found a INVALID SgTypeMatrix object in the memory pool \n");
27964 : }
27965 : }
27966 : }
27967 : }
27968 :
27969 : // This should not be required since all previously static data members are
27970 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
27971 :
27972 194 : }
27973 :
27974 : void
27975 0 : SgTypeMatrix::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
27976 : {
27977 : // This function visits only a single IR node of the memory pool.
27978 : // it is typically called once for each type of IR node within
27979 : // the automatically generated function: traverseRepresentativeNodes().
27980 :
27981 : // Initialize array to the address of the first element of the STL vector
27982 : // (which is guarenteed to be contiguous storage).
27983 : // SgTypeMatrix objectArray [] = *(Memory_Block_List.begin());
27984 0 : if (SgTypeMatrix::pools.empty() == false)
27985 : {
27986 : // Generate an array of memory pools
27987 0 : SgTypeMatrix** objectArray = (SgTypeMatrix**) &(SgTypeMatrix::pools[0]);
27988 :
27989 : // Build a local variable for better performance
27990 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
27991 :
27992 : // Iterate over the memory pools
27993 0 : bool done = false;
27994 0 : unsigned i=0;
27995 :
27996 : // find the first valid IR node, call visit function, and then leave
27997 0 : while ( done == false && i < SgTypeMatrix::pools.size() )
27998 : {
27999 : // objectArray[i] is a single memory pool
28000 : unsigned j=0;
28001 0 : while (done == false && j < SgTypeMatrix::pool_size)
28002 : {
28003 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
28004 : {
28005 0 : traversal.visit(&(objectArray[i][j]));
28006 0 : done = true;
28007 : }
28008 0 : j++;
28009 : }
28010 0 : i++;
28011 : }
28012 :
28013 : #if 0
28014 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
28015 : if (done == false)
28016 : {
28017 : printf ("No representative for SgTypeMatrix found in memory pools \n");
28018 : }
28019 : #endif
28020 : }
28021 0 : }
28022 :
28023 :
28024 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
28025 : // using values that overflow signed values of int.
28026 : size_t
28027 4 : SgTypeMatrix::numberOfNodes()
28028 : {
28029 : // This function traverses the memory pool for an IR node and
28030 : // counts the number of IR nodes of a particular Sage III IR
28031 : // nodes type.
28032 :
28033 4 : size_t count = 0;
28034 4 : if (SgTypeMatrix::pools.empty() == false)
28035 : {
28036 : // Generate an array of memory pools (this is actually a STL vector,
28037 : // but it is contiguious, so OK to treat this way).
28038 0 : SgTypeMatrix** objectArray = (SgTypeMatrix**) &(SgTypeMatrix::pools[0]);
28039 :
28040 : // Build a local variable for better performance (make it a loop invariant variable).
28041 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
28042 :
28043 : // Iterate over all of the memory pools for this IR node.
28044 0 : for (unsigned int i=0; i < SgTypeMatrix::pools.size(); i++)
28045 : {
28046 : // objectArray[i] is a single memory pool, iterate over all the
28047 : // IR nodes and only count those that are valid IR nodes used in
28048 : // the AST (i.e. allocated IR nodes).
28049 0 : for (unsigned j=0; j < SgTypeMatrix::pool_size; j++)
28050 : {
28051 : // This is indexing the STL vector of C/C++ style arrays as a doubly
28052 : // indexed array access. It is OK since we have leveraged the semantics
28053 : // of STL vector memory as contigous and cast the memory as an array
28054 : // of arrays to use the 2D array indexing. Hope this is not confusing,
28055 : // but it s very fast as an implementation.
28056 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
28057 : {
28058 0 : count++;
28059 : }
28060 : }
28061 : }
28062 : }
28063 :
28064 :
28065 :
28066 4 : return count;
28067 : }
28068 :
28069 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
28070 : // using values that overflow signed values of int.
28071 : size_t
28072 0 : SgTypeMatrix::memoryUsage()
28073 : {
28074 : // This function is required because we need the class name as a type when we call sizeof
28075 : // There might be another way to implement this if we have a traversal that only called a
28076 : // representative object (one call for each type of Sage IIIIR node).
28077 0 : size_t memory = numberOfNodes() * sizeof(SgTypeMatrix);
28078 :
28079 0 : return memory;
28080 : }
28081 :
28082 : /* #line 28083 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
28083 :
28084 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
28085 : void
28086 5668 : SgTypeTuple::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
28087 : {
28088 : // This function traverses the memory pool for only a specific IR node
28089 : // and calls the visit function of the input class execute a traversal
28090 : // similar to the style of the attribute based traversals within ROSE.
28091 : // This traversal will visit ALL nodes of the AST where as the other
28092 : // attribute based traversals visit only the embedded tree within the AST.
28093 :
28094 : // Initialize array to the address of the first element of the STL vector
28095 : // (which is guaranteed to be contiguous storage).
28096 : // SgTypeTuple objectArray [] = *(Memory_Block_List.begin());
28097 5668 : if (SgTypeTuple::pools.empty() == false)
28098 : {
28099 : // Generate an array of memory pools
28100 0 : SgTypeTuple** objectArray = (SgTypeTuple**) &(SgTypeTuple::pools[0]);
28101 :
28102 : // Build a local variable for better performance
28103 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
28104 : #if 0
28105 : // Iterate over the memory pools
28106 : for (unsigned int i=0; i < SgTypeTuple::pools.size(); i++)
28107 : {
28108 : // objectArray[i] is a single memory pool
28109 : for (int j=0; j < SgTypeTuple::pool_size; j++)
28110 : {
28111 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
28112 : {
28113 : traversal.visit(&(objectArray[i][j]));
28114 : }
28115 : }
28116 : }
28117 : #else
28118 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
28119 : // compute the list first and then call the visit function on each list element.
28120 :
28121 : // printf ("Inside of SgTypeTuple::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
28122 :
28123 0 : std::vector<SgTypeTuple*> nodeList;
28124 :
28125 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
28126 0 : for (unsigned int i=0; i < SgTypeTuple::pools.size(); i++)
28127 : {
28128 : // objectArray[i] is a single memory pool
28129 0 : for (unsigned j=0; j < SgTypeTuple::pool_size; j++)
28130 : {
28131 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
28132 : {
28133 0 : nodeList.push_back(&(objectArray[i][j]));
28134 : }
28135 : }
28136 : }
28137 :
28138 : // Iterate over the saved list
28139 0 : size_t nodeListSize = nodeList.size();
28140 0 : for (size_t i=0; i < nodeListSize; i++)
28141 : {
28142 0 : ROSE_ASSERT(nodeList[i] != NULL);
28143 : #if 0
28144 : traversal.visit(nodeList[i]);
28145 : #else
28146 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
28147 : {
28148 0 : traversal.visit(nodeList[i]);
28149 : }
28150 : #endif
28151 : }
28152 : #endif
28153 : }
28154 :
28155 : // This should not be required since all previously static data members are
28156 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
28157 :
28158 5668 : }
28159 :
28160 :
28161 : void
28162 194 : SgTypeTuple::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
28163 : {
28164 : // This function traverses the memory pool for an IR node and
28165 : // calls the function to execute the visitor object.
28166 :
28167 : // Initialize array to the address of the first element of the STL vector
28168 : // (which is guarenteed to be contiguous storage).
28169 : // SgTypeTuple objectArray [] = *(Memory_Block_List.begin());
28170 194 : if (SgTypeTuple::pools.empty() == false)
28171 : {
28172 : // Generate an array of memory pools
28173 0 : SgTypeTuple** objectArray = (SgTypeTuple**) &(SgTypeTuple::pools[0]);
28174 :
28175 : // Build a local variable for better performance
28176 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
28177 :
28178 : // Iterate over the memory pools
28179 0 : for (unsigned int i=0; i < SgTypeTuple::pools.size(); i++)
28180 : {
28181 : // objectArray[i] is a single memory pool
28182 0 : for (unsigned j=0; j < SgTypeTuple::pool_size; j++)
28183 : {
28184 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
28185 : {
28186 : // printf ("Found a valid SgTypeTuple object in the memory pool %d at position %d \n",i,j);
28187 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
28188 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
28189 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
28190 : }
28191 : else
28192 : {
28193 : // printf ("Found a INVALID SgTypeTuple object in the memory pool \n");
28194 : }
28195 : }
28196 : }
28197 : }
28198 :
28199 : // This should not be required since all previously static data members are
28200 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
28201 :
28202 194 : }
28203 :
28204 : void
28205 0 : SgTypeTuple::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
28206 : {
28207 : // This function visits only a single IR node of the memory pool.
28208 : // it is typically called once for each type of IR node within
28209 : // the automatically generated function: traverseRepresentativeNodes().
28210 :
28211 : // Initialize array to the address of the first element of the STL vector
28212 : // (which is guarenteed to be contiguous storage).
28213 : // SgTypeTuple objectArray [] = *(Memory_Block_List.begin());
28214 0 : if (SgTypeTuple::pools.empty() == false)
28215 : {
28216 : // Generate an array of memory pools
28217 0 : SgTypeTuple** objectArray = (SgTypeTuple**) &(SgTypeTuple::pools[0]);
28218 :
28219 : // Build a local variable for better performance
28220 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
28221 :
28222 : // Iterate over the memory pools
28223 0 : bool done = false;
28224 0 : unsigned i=0;
28225 :
28226 : // find the first valid IR node, call visit function, and then leave
28227 0 : while ( done == false && i < SgTypeTuple::pools.size() )
28228 : {
28229 : // objectArray[i] is a single memory pool
28230 : unsigned j=0;
28231 0 : while (done == false && j < SgTypeTuple::pool_size)
28232 : {
28233 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
28234 : {
28235 0 : traversal.visit(&(objectArray[i][j]));
28236 0 : done = true;
28237 : }
28238 0 : j++;
28239 : }
28240 0 : i++;
28241 : }
28242 :
28243 : #if 0
28244 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
28245 : if (done == false)
28246 : {
28247 : printf ("No representative for SgTypeTuple found in memory pools \n");
28248 : }
28249 : #endif
28250 : }
28251 0 : }
28252 :
28253 :
28254 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
28255 : // using values that overflow signed values of int.
28256 : size_t
28257 4 : SgTypeTuple::numberOfNodes()
28258 : {
28259 : // This function traverses the memory pool for an IR node and
28260 : // counts the number of IR nodes of a particular Sage III IR
28261 : // nodes type.
28262 :
28263 4 : size_t count = 0;
28264 4 : if (SgTypeTuple::pools.empty() == false)
28265 : {
28266 : // Generate an array of memory pools (this is actually a STL vector,
28267 : // but it is contiguious, so OK to treat this way).
28268 0 : SgTypeTuple** objectArray = (SgTypeTuple**) &(SgTypeTuple::pools[0]);
28269 :
28270 : // Build a local variable for better performance (make it a loop invariant variable).
28271 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
28272 :
28273 : // Iterate over all of the memory pools for this IR node.
28274 0 : for (unsigned int i=0; i < SgTypeTuple::pools.size(); i++)
28275 : {
28276 : // objectArray[i] is a single memory pool, iterate over all the
28277 : // IR nodes and only count those that are valid IR nodes used in
28278 : // the AST (i.e. allocated IR nodes).
28279 0 : for (unsigned j=0; j < SgTypeTuple::pool_size; j++)
28280 : {
28281 : // This is indexing the STL vector of C/C++ style arrays as a doubly
28282 : // indexed array access. It is OK since we have leveraged the semantics
28283 : // of STL vector memory as contigous and cast the memory as an array
28284 : // of arrays to use the 2D array indexing. Hope this is not confusing,
28285 : // but it s very fast as an implementation.
28286 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
28287 : {
28288 0 : count++;
28289 : }
28290 : }
28291 : }
28292 : }
28293 :
28294 :
28295 :
28296 4 : return count;
28297 : }
28298 :
28299 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
28300 : // using values that overflow signed values of int.
28301 : size_t
28302 0 : SgTypeTuple::memoryUsage()
28303 : {
28304 : // This function is required because we need the class name as a type when we call sizeof
28305 : // There might be another way to implement this if we have a traversal that only called a
28306 : // representative object (one call for each type of Sage IIIIR node).
28307 0 : size_t memory = numberOfNodes() * sizeof(SgTypeTuple);
28308 :
28309 0 : return memory;
28310 : }
28311 :
28312 : /* #line 28313 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
28313 :
28314 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
28315 : void
28316 5668 : SgTypeChar16::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
28317 : {
28318 : // This function traverses the memory pool for only a specific IR node
28319 : // and calls the visit function of the input class execute a traversal
28320 : // similar to the style of the attribute based traversals within ROSE.
28321 : // This traversal will visit ALL nodes of the AST where as the other
28322 : // attribute based traversals visit only the embedded tree within the AST.
28323 :
28324 : // Initialize array to the address of the first element of the STL vector
28325 : // (which is guaranteed to be contiguous storage).
28326 : // SgTypeChar16 objectArray [] = *(Memory_Block_List.begin());
28327 5668 : if (SgTypeChar16::pools.empty() == false)
28328 : {
28329 : // Generate an array of memory pools
28330 145 : SgTypeChar16** objectArray = (SgTypeChar16**) &(SgTypeChar16::pools[0]);
28331 :
28332 : // Build a local variable for better performance
28333 145 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
28334 : #if 0
28335 : // Iterate over the memory pools
28336 : for (unsigned int i=0; i < SgTypeChar16::pools.size(); i++)
28337 : {
28338 : // objectArray[i] is a single memory pool
28339 : for (int j=0; j < SgTypeChar16::pool_size; j++)
28340 : {
28341 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
28342 : {
28343 : traversal.visit(&(objectArray[i][j]));
28344 : }
28345 : }
28346 : }
28347 : #else
28348 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
28349 : // compute the list first and then call the visit function on each list element.
28350 :
28351 : // printf ("Inside of SgTypeChar16::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
28352 :
28353 290 : std::vector<SgTypeChar16*> nodeList;
28354 :
28355 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
28356 290 : for (unsigned int i=0; i < SgTypeChar16::pools.size(); i++)
28357 : {
28358 : // objectArray[i] is a single memory pool
28359 290145 : for (unsigned j=0; j < SgTypeChar16::pool_size; j++)
28360 : {
28361 290000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
28362 : {
28363 145 : nodeList.push_back(&(objectArray[i][j]));
28364 : }
28365 : }
28366 : }
28367 :
28368 : // Iterate over the saved list
28369 145 : size_t nodeListSize = nodeList.size();
28370 290 : for (size_t i=0; i < nodeListSize; i++)
28371 : {
28372 145 : ROSE_ASSERT(nodeList[i] != NULL);
28373 : #if 0
28374 : traversal.visit(nodeList[i]);
28375 : #else
28376 145 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
28377 : {
28378 145 : traversal.visit(nodeList[i]);
28379 : }
28380 : #endif
28381 : }
28382 : #endif
28383 : }
28384 :
28385 : // This should not be required since all previously static data members are
28386 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
28387 :
28388 5668 : }
28389 :
28390 :
28391 : void
28392 194 : SgTypeChar16::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
28393 : {
28394 : // This function traverses the memory pool for an IR node and
28395 : // calls the function to execute the visitor object.
28396 :
28397 : // Initialize array to the address of the first element of the STL vector
28398 : // (which is guarenteed to be contiguous storage).
28399 : // SgTypeChar16 objectArray [] = *(Memory_Block_List.begin());
28400 194 : if (SgTypeChar16::pools.empty() == false)
28401 : {
28402 : // Generate an array of memory pools
28403 137 : SgTypeChar16** objectArray = (SgTypeChar16**) &(SgTypeChar16::pools[0]);
28404 :
28405 : // Build a local variable for better performance
28406 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
28407 :
28408 : // Iterate over the memory pools
28409 274 : for (unsigned int i=0; i < SgTypeChar16::pools.size(); i++)
28410 : {
28411 : // objectArray[i] is a single memory pool
28412 274137 : for (unsigned j=0; j < SgTypeChar16::pool_size; j++)
28413 : {
28414 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
28415 : {
28416 : // printf ("Found a valid SgTypeChar16 object in the memory pool %d at position %d \n",i,j);
28417 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
28418 137 : objectArray[i][j].executeVisitorMemberFunction(visitor);
28419 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
28420 : }
28421 : else
28422 : {
28423 : // printf ("Found a INVALID SgTypeChar16 object in the memory pool \n");
28424 : }
28425 : }
28426 : }
28427 : }
28428 :
28429 : // This should not be required since all previously static data members are
28430 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
28431 :
28432 194 : }
28433 :
28434 : void
28435 0 : SgTypeChar16::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
28436 : {
28437 : // This function visits only a single IR node of the memory pool.
28438 : // it is typically called once for each type of IR node within
28439 : // the automatically generated function: traverseRepresentativeNodes().
28440 :
28441 : // Initialize array to the address of the first element of the STL vector
28442 : // (which is guarenteed to be contiguous storage).
28443 : // SgTypeChar16 objectArray [] = *(Memory_Block_List.begin());
28444 0 : if (SgTypeChar16::pools.empty() == false)
28445 : {
28446 : // Generate an array of memory pools
28447 0 : SgTypeChar16** objectArray = (SgTypeChar16**) &(SgTypeChar16::pools[0]);
28448 :
28449 : // Build a local variable for better performance
28450 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
28451 :
28452 : // Iterate over the memory pools
28453 0 : bool done = false;
28454 0 : unsigned i=0;
28455 :
28456 : // find the first valid IR node, call visit function, and then leave
28457 0 : while ( done == false && i < SgTypeChar16::pools.size() )
28458 : {
28459 : // objectArray[i] is a single memory pool
28460 : unsigned j=0;
28461 0 : while (done == false && j < SgTypeChar16::pool_size)
28462 : {
28463 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
28464 : {
28465 0 : traversal.visit(&(objectArray[i][j]));
28466 0 : done = true;
28467 : }
28468 0 : j++;
28469 : }
28470 0 : i++;
28471 : }
28472 :
28473 : #if 0
28474 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
28475 : if (done == false)
28476 : {
28477 : printf ("No representative for SgTypeChar16 found in memory pools \n");
28478 : }
28479 : #endif
28480 : }
28481 0 : }
28482 :
28483 :
28484 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
28485 : // using values that overflow signed values of int.
28486 : size_t
28487 4 : SgTypeChar16::numberOfNodes()
28488 : {
28489 : // This function traverses the memory pool for an IR node and
28490 : // counts the number of IR nodes of a particular Sage III IR
28491 : // nodes type.
28492 :
28493 4 : size_t count = 0;
28494 4 : if (SgTypeChar16::pools.empty() == false)
28495 : {
28496 : // Generate an array of memory pools (this is actually a STL vector,
28497 : // but it is contiguious, so OK to treat this way).
28498 1 : SgTypeChar16** objectArray = (SgTypeChar16**) &(SgTypeChar16::pools[0]);
28499 :
28500 : // Build a local variable for better performance (make it a loop invariant variable).
28501 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
28502 :
28503 : // Iterate over all of the memory pools for this IR node.
28504 2 : for (unsigned int i=0; i < SgTypeChar16::pools.size(); i++)
28505 : {
28506 : // objectArray[i] is a single memory pool, iterate over all the
28507 : // IR nodes and only count those that are valid IR nodes used in
28508 : // the AST (i.e. allocated IR nodes).
28509 2001 : for (unsigned j=0; j < SgTypeChar16::pool_size; j++)
28510 : {
28511 : // This is indexing the STL vector of C/C++ style arrays as a doubly
28512 : // indexed array access. It is OK since we have leveraged the semantics
28513 : // of STL vector memory as contigous and cast the memory as an array
28514 : // of arrays to use the 2D array indexing. Hope this is not confusing,
28515 : // but it s very fast as an implementation.
28516 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
28517 : {
28518 1 : count++;
28519 : }
28520 : }
28521 : }
28522 : }
28523 :
28524 :
28525 :
28526 4 : return count;
28527 : }
28528 :
28529 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
28530 : // using values that overflow signed values of int.
28531 : size_t
28532 0 : SgTypeChar16::memoryUsage()
28533 : {
28534 : // This function is required because we need the class name as a type when we call sizeof
28535 : // There might be another way to implement this if we have a traversal that only called a
28536 : // representative object (one call for each type of Sage IIIIR node).
28537 0 : size_t memory = numberOfNodes() * sizeof(SgTypeChar16);
28538 :
28539 0 : return memory;
28540 : }
28541 :
28542 : /* #line 28543 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
28543 :
28544 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
28545 : void
28546 5668 : SgTypeChar32::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
28547 : {
28548 : // This function traverses the memory pool for only a specific IR node
28549 : // and calls the visit function of the input class execute a traversal
28550 : // similar to the style of the attribute based traversals within ROSE.
28551 : // This traversal will visit ALL nodes of the AST where as the other
28552 : // attribute based traversals visit only the embedded tree within the AST.
28553 :
28554 : // Initialize array to the address of the first element of the STL vector
28555 : // (which is guaranteed to be contiguous storage).
28556 : // SgTypeChar32 objectArray [] = *(Memory_Block_List.begin());
28557 5668 : if (SgTypeChar32::pools.empty() == false)
28558 : {
28559 : // Generate an array of memory pools
28560 145 : SgTypeChar32** objectArray = (SgTypeChar32**) &(SgTypeChar32::pools[0]);
28561 :
28562 : // Build a local variable for better performance
28563 145 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
28564 : #if 0
28565 : // Iterate over the memory pools
28566 : for (unsigned int i=0; i < SgTypeChar32::pools.size(); i++)
28567 : {
28568 : // objectArray[i] is a single memory pool
28569 : for (int j=0; j < SgTypeChar32::pool_size; j++)
28570 : {
28571 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
28572 : {
28573 : traversal.visit(&(objectArray[i][j]));
28574 : }
28575 : }
28576 : }
28577 : #else
28578 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
28579 : // compute the list first and then call the visit function on each list element.
28580 :
28581 : // printf ("Inside of SgTypeChar32::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
28582 :
28583 290 : std::vector<SgTypeChar32*> nodeList;
28584 :
28585 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
28586 290 : for (unsigned int i=0; i < SgTypeChar32::pools.size(); i++)
28587 : {
28588 : // objectArray[i] is a single memory pool
28589 290145 : for (unsigned j=0; j < SgTypeChar32::pool_size; j++)
28590 : {
28591 290000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
28592 : {
28593 145 : nodeList.push_back(&(objectArray[i][j]));
28594 : }
28595 : }
28596 : }
28597 :
28598 : // Iterate over the saved list
28599 145 : size_t nodeListSize = nodeList.size();
28600 290 : for (size_t i=0; i < nodeListSize; i++)
28601 : {
28602 145 : ROSE_ASSERT(nodeList[i] != NULL);
28603 : #if 0
28604 : traversal.visit(nodeList[i]);
28605 : #else
28606 145 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
28607 : {
28608 145 : traversal.visit(nodeList[i]);
28609 : }
28610 : #endif
28611 : }
28612 : #endif
28613 : }
28614 :
28615 : // This should not be required since all previously static data members are
28616 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
28617 :
28618 5668 : }
28619 :
28620 :
28621 : void
28622 194 : SgTypeChar32::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
28623 : {
28624 : // This function traverses the memory pool for an IR node and
28625 : // calls the function to execute the visitor object.
28626 :
28627 : // Initialize array to the address of the first element of the STL vector
28628 : // (which is guarenteed to be contiguous storage).
28629 : // SgTypeChar32 objectArray [] = *(Memory_Block_List.begin());
28630 194 : if (SgTypeChar32::pools.empty() == false)
28631 : {
28632 : // Generate an array of memory pools
28633 137 : SgTypeChar32** objectArray = (SgTypeChar32**) &(SgTypeChar32::pools[0]);
28634 :
28635 : // Build a local variable for better performance
28636 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
28637 :
28638 : // Iterate over the memory pools
28639 274 : for (unsigned int i=0; i < SgTypeChar32::pools.size(); i++)
28640 : {
28641 : // objectArray[i] is a single memory pool
28642 274137 : for (unsigned j=0; j < SgTypeChar32::pool_size; j++)
28643 : {
28644 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
28645 : {
28646 : // printf ("Found a valid SgTypeChar32 object in the memory pool %d at position %d \n",i,j);
28647 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
28648 137 : objectArray[i][j].executeVisitorMemberFunction(visitor);
28649 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
28650 : }
28651 : else
28652 : {
28653 : // printf ("Found a INVALID SgTypeChar32 object in the memory pool \n");
28654 : }
28655 : }
28656 : }
28657 : }
28658 :
28659 : // This should not be required since all previously static data members are
28660 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
28661 :
28662 194 : }
28663 :
28664 : void
28665 0 : SgTypeChar32::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
28666 : {
28667 : // This function visits only a single IR node of the memory pool.
28668 : // it is typically called once for each type of IR node within
28669 : // the automatically generated function: traverseRepresentativeNodes().
28670 :
28671 : // Initialize array to the address of the first element of the STL vector
28672 : // (which is guarenteed to be contiguous storage).
28673 : // SgTypeChar32 objectArray [] = *(Memory_Block_List.begin());
28674 0 : if (SgTypeChar32::pools.empty() == false)
28675 : {
28676 : // Generate an array of memory pools
28677 0 : SgTypeChar32** objectArray = (SgTypeChar32**) &(SgTypeChar32::pools[0]);
28678 :
28679 : // Build a local variable for better performance
28680 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
28681 :
28682 : // Iterate over the memory pools
28683 0 : bool done = false;
28684 0 : unsigned i=0;
28685 :
28686 : // find the first valid IR node, call visit function, and then leave
28687 0 : while ( done == false && i < SgTypeChar32::pools.size() )
28688 : {
28689 : // objectArray[i] is a single memory pool
28690 : unsigned j=0;
28691 0 : while (done == false && j < SgTypeChar32::pool_size)
28692 : {
28693 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
28694 : {
28695 0 : traversal.visit(&(objectArray[i][j]));
28696 0 : done = true;
28697 : }
28698 0 : j++;
28699 : }
28700 0 : i++;
28701 : }
28702 :
28703 : #if 0
28704 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
28705 : if (done == false)
28706 : {
28707 : printf ("No representative for SgTypeChar32 found in memory pools \n");
28708 : }
28709 : #endif
28710 : }
28711 0 : }
28712 :
28713 :
28714 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
28715 : // using values that overflow signed values of int.
28716 : size_t
28717 4 : SgTypeChar32::numberOfNodes()
28718 : {
28719 : // This function traverses the memory pool for an IR node and
28720 : // counts the number of IR nodes of a particular Sage III IR
28721 : // nodes type.
28722 :
28723 4 : size_t count = 0;
28724 4 : if (SgTypeChar32::pools.empty() == false)
28725 : {
28726 : // Generate an array of memory pools (this is actually a STL vector,
28727 : // but it is contiguious, so OK to treat this way).
28728 1 : SgTypeChar32** objectArray = (SgTypeChar32**) &(SgTypeChar32::pools[0]);
28729 :
28730 : // Build a local variable for better performance (make it a loop invariant variable).
28731 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
28732 :
28733 : // Iterate over all of the memory pools for this IR node.
28734 2 : for (unsigned int i=0; i < SgTypeChar32::pools.size(); i++)
28735 : {
28736 : // objectArray[i] is a single memory pool, iterate over all the
28737 : // IR nodes and only count those that are valid IR nodes used in
28738 : // the AST (i.e. allocated IR nodes).
28739 2001 : for (unsigned j=0; j < SgTypeChar32::pool_size; j++)
28740 : {
28741 : // This is indexing the STL vector of C/C++ style arrays as a doubly
28742 : // indexed array access. It is OK since we have leveraged the semantics
28743 : // of STL vector memory as contigous and cast the memory as an array
28744 : // of arrays to use the 2D array indexing. Hope this is not confusing,
28745 : // but it s very fast as an implementation.
28746 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
28747 : {
28748 1 : count++;
28749 : }
28750 : }
28751 : }
28752 : }
28753 :
28754 :
28755 :
28756 4 : return count;
28757 : }
28758 :
28759 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
28760 : // using values that overflow signed values of int.
28761 : size_t
28762 0 : SgTypeChar32::memoryUsage()
28763 : {
28764 : // This function is required because we need the class name as a type when we call sizeof
28765 : // There might be another way to implement this if we have a traversal that only called a
28766 : // representative object (one call for each type of Sage IIIIR node).
28767 0 : size_t memory = numberOfNodes() * sizeof(SgTypeChar32);
28768 :
28769 0 : return memory;
28770 : }
28771 :
28772 : /* #line 28773 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
28773 :
28774 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
28775 : void
28776 5668 : SgTypeFloat128::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
28777 : {
28778 : // This function traverses the memory pool for only a specific IR node
28779 : // and calls the visit function of the input class execute a traversal
28780 : // similar to the style of the attribute based traversals within ROSE.
28781 : // This traversal will visit ALL nodes of the AST where as the other
28782 : // attribute based traversals visit only the embedded tree within the AST.
28783 :
28784 : // Initialize array to the address of the first element of the STL vector
28785 : // (which is guaranteed to be contiguous storage).
28786 : // SgTypeFloat128 objectArray [] = *(Memory_Block_List.begin());
28787 5668 : if (SgTypeFloat128::pools.empty() == false)
28788 : {
28789 : // Generate an array of memory pools
28790 193 : SgTypeFloat128** objectArray = (SgTypeFloat128**) &(SgTypeFloat128::pools[0]);
28791 :
28792 : // Build a local variable for better performance
28793 193 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
28794 : #if 0
28795 : // Iterate over the memory pools
28796 : for (unsigned int i=0; i < SgTypeFloat128::pools.size(); i++)
28797 : {
28798 : // objectArray[i] is a single memory pool
28799 : for (int j=0; j < SgTypeFloat128::pool_size; j++)
28800 : {
28801 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
28802 : {
28803 : traversal.visit(&(objectArray[i][j]));
28804 : }
28805 : }
28806 : }
28807 : #else
28808 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
28809 : // compute the list first and then call the visit function on each list element.
28810 :
28811 : // printf ("Inside of SgTypeFloat128::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
28812 :
28813 386 : std::vector<SgTypeFloat128*> nodeList;
28814 :
28815 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
28816 386 : for (unsigned int i=0; i < SgTypeFloat128::pools.size(); i++)
28817 : {
28818 : // objectArray[i] is a single memory pool
28819 386193 : for (unsigned j=0; j < SgTypeFloat128::pool_size; j++)
28820 : {
28821 386000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
28822 : {
28823 193 : nodeList.push_back(&(objectArray[i][j]));
28824 : }
28825 : }
28826 : }
28827 :
28828 : // Iterate over the saved list
28829 193 : size_t nodeListSize = nodeList.size();
28830 386 : for (size_t i=0; i < nodeListSize; i++)
28831 : {
28832 193 : ROSE_ASSERT(nodeList[i] != NULL);
28833 : #if 0
28834 : traversal.visit(nodeList[i]);
28835 : #else
28836 193 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
28837 : {
28838 193 : traversal.visit(nodeList[i]);
28839 : }
28840 : #endif
28841 : }
28842 : #endif
28843 : }
28844 :
28845 : // This should not be required since all previously static data members are
28846 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
28847 :
28848 5668 : }
28849 :
28850 :
28851 : void
28852 194 : SgTypeFloat128::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
28853 : {
28854 : // This function traverses the memory pool for an IR node and
28855 : // calls the function to execute the visitor object.
28856 :
28857 : // Initialize array to the address of the first element of the STL vector
28858 : // (which is guarenteed to be contiguous storage).
28859 : // SgTypeFloat128 objectArray [] = *(Memory_Block_List.begin());
28860 194 : if (SgTypeFloat128::pools.empty() == false)
28861 : {
28862 : // Generate an array of memory pools
28863 137 : SgTypeFloat128** objectArray = (SgTypeFloat128**) &(SgTypeFloat128::pools[0]);
28864 :
28865 : // Build a local variable for better performance
28866 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
28867 :
28868 : // Iterate over the memory pools
28869 274 : for (unsigned int i=0; i < SgTypeFloat128::pools.size(); i++)
28870 : {
28871 : // objectArray[i] is a single memory pool
28872 274137 : for (unsigned j=0; j < SgTypeFloat128::pool_size; j++)
28873 : {
28874 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
28875 : {
28876 : // printf ("Found a valid SgTypeFloat128 object in the memory pool %d at position %d \n",i,j);
28877 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
28878 137 : objectArray[i][j].executeVisitorMemberFunction(visitor);
28879 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
28880 : }
28881 : else
28882 : {
28883 : // printf ("Found a INVALID SgTypeFloat128 object in the memory pool \n");
28884 : }
28885 : }
28886 : }
28887 : }
28888 :
28889 : // This should not be required since all previously static data members are
28890 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
28891 :
28892 194 : }
28893 :
28894 : void
28895 0 : SgTypeFloat128::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
28896 : {
28897 : // This function visits only a single IR node of the memory pool.
28898 : // it is typically called once for each type of IR node within
28899 : // the automatically generated function: traverseRepresentativeNodes().
28900 :
28901 : // Initialize array to the address of the first element of the STL vector
28902 : // (which is guarenteed to be contiguous storage).
28903 : // SgTypeFloat128 objectArray [] = *(Memory_Block_List.begin());
28904 0 : if (SgTypeFloat128::pools.empty() == false)
28905 : {
28906 : // Generate an array of memory pools
28907 0 : SgTypeFloat128** objectArray = (SgTypeFloat128**) &(SgTypeFloat128::pools[0]);
28908 :
28909 : // Build a local variable for better performance
28910 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
28911 :
28912 : // Iterate over the memory pools
28913 0 : bool done = false;
28914 0 : unsigned i=0;
28915 :
28916 : // find the first valid IR node, call visit function, and then leave
28917 0 : while ( done == false && i < SgTypeFloat128::pools.size() )
28918 : {
28919 : // objectArray[i] is a single memory pool
28920 : unsigned j=0;
28921 0 : while (done == false && j < SgTypeFloat128::pool_size)
28922 : {
28923 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
28924 : {
28925 0 : traversal.visit(&(objectArray[i][j]));
28926 0 : done = true;
28927 : }
28928 0 : j++;
28929 : }
28930 0 : i++;
28931 : }
28932 :
28933 : #if 0
28934 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
28935 : if (done == false)
28936 : {
28937 : printf ("No representative for SgTypeFloat128 found in memory pools \n");
28938 : }
28939 : #endif
28940 : }
28941 0 : }
28942 :
28943 :
28944 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
28945 : // using values that overflow signed values of int.
28946 : size_t
28947 4 : SgTypeFloat128::numberOfNodes()
28948 : {
28949 : // This function traverses the memory pool for an IR node and
28950 : // counts the number of IR nodes of a particular Sage III IR
28951 : // nodes type.
28952 :
28953 4 : size_t count = 0;
28954 4 : if (SgTypeFloat128::pools.empty() == false)
28955 : {
28956 : // Generate an array of memory pools (this is actually a STL vector,
28957 : // but it is contiguious, so OK to treat this way).
28958 1 : SgTypeFloat128** objectArray = (SgTypeFloat128**) &(SgTypeFloat128::pools[0]);
28959 :
28960 : // Build a local variable for better performance (make it a loop invariant variable).
28961 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
28962 :
28963 : // Iterate over all of the memory pools for this IR node.
28964 2 : for (unsigned int i=0; i < SgTypeFloat128::pools.size(); i++)
28965 : {
28966 : // objectArray[i] is a single memory pool, iterate over all the
28967 : // IR nodes and only count those that are valid IR nodes used in
28968 : // the AST (i.e. allocated IR nodes).
28969 2001 : for (unsigned j=0; j < SgTypeFloat128::pool_size; j++)
28970 : {
28971 : // This is indexing the STL vector of C/C++ style arrays as a doubly
28972 : // indexed array access. It is OK since we have leveraged the semantics
28973 : // of STL vector memory as contigous and cast the memory as an array
28974 : // of arrays to use the 2D array indexing. Hope this is not confusing,
28975 : // but it s very fast as an implementation.
28976 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
28977 : {
28978 1 : count++;
28979 : }
28980 : }
28981 : }
28982 : }
28983 :
28984 :
28985 :
28986 4 : return count;
28987 : }
28988 :
28989 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
28990 : // using values that overflow signed values of int.
28991 : size_t
28992 0 : SgTypeFloat128::memoryUsage()
28993 : {
28994 : // This function is required because we need the class name as a type when we call sizeof
28995 : // There might be another way to implement this if we have a traversal that only called a
28996 : // representative object (one call for each type of Sage IIIIR node).
28997 0 : size_t memory = numberOfNodes() * sizeof(SgTypeFloat128);
28998 :
28999 0 : return memory;
29000 : }
29001 :
29002 : /* #line 29003 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
29003 :
29004 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
29005 : void
29006 5668 : SgTypeFixed::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
29007 : {
29008 : // This function traverses the memory pool for only a specific IR node
29009 : // and calls the visit function of the input class execute a traversal
29010 : // similar to the style of the attribute based traversals within ROSE.
29011 : // This traversal will visit ALL nodes of the AST where as the other
29012 : // attribute based traversals visit only the embedded tree within the AST.
29013 :
29014 : // Initialize array to the address of the first element of the STL vector
29015 : // (which is guaranteed to be contiguous storage).
29016 : // SgTypeFixed objectArray [] = *(Memory_Block_List.begin());
29017 5668 : if (SgTypeFixed::pools.empty() == false)
29018 : {
29019 : // Generate an array of memory pools
29020 0 : SgTypeFixed** objectArray = (SgTypeFixed**) &(SgTypeFixed::pools[0]);
29021 :
29022 : // Build a local variable for better performance
29023 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
29024 : #if 0
29025 : // Iterate over the memory pools
29026 : for (unsigned int i=0; i < SgTypeFixed::pools.size(); i++)
29027 : {
29028 : // objectArray[i] is a single memory pool
29029 : for (int j=0; j < SgTypeFixed::pool_size; j++)
29030 : {
29031 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
29032 : {
29033 : traversal.visit(&(objectArray[i][j]));
29034 : }
29035 : }
29036 : }
29037 : #else
29038 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
29039 : // compute the list first and then call the visit function on each list element.
29040 :
29041 : // printf ("Inside of SgTypeFixed::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
29042 :
29043 0 : std::vector<SgTypeFixed*> nodeList;
29044 :
29045 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
29046 0 : for (unsigned int i=0; i < SgTypeFixed::pools.size(); i++)
29047 : {
29048 : // objectArray[i] is a single memory pool
29049 0 : for (unsigned j=0; j < SgTypeFixed::pool_size; j++)
29050 : {
29051 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
29052 : {
29053 0 : nodeList.push_back(&(objectArray[i][j]));
29054 : }
29055 : }
29056 : }
29057 :
29058 : // Iterate over the saved list
29059 0 : size_t nodeListSize = nodeList.size();
29060 0 : for (size_t i=0; i < nodeListSize; i++)
29061 : {
29062 0 : ROSE_ASSERT(nodeList[i] != NULL);
29063 : #if 0
29064 : traversal.visit(nodeList[i]);
29065 : #else
29066 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
29067 : {
29068 0 : traversal.visit(nodeList[i]);
29069 : }
29070 : #endif
29071 : }
29072 : #endif
29073 : }
29074 :
29075 : // This should not be required since all previously static data members are
29076 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
29077 :
29078 5668 : }
29079 :
29080 :
29081 : void
29082 194 : SgTypeFixed::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
29083 : {
29084 : // This function traverses the memory pool for an IR node and
29085 : // calls the function to execute the visitor object.
29086 :
29087 : // Initialize array to the address of the first element of the STL vector
29088 : // (which is guarenteed to be contiguous storage).
29089 : // SgTypeFixed objectArray [] = *(Memory_Block_List.begin());
29090 194 : if (SgTypeFixed::pools.empty() == false)
29091 : {
29092 : // Generate an array of memory pools
29093 0 : SgTypeFixed** objectArray = (SgTypeFixed**) &(SgTypeFixed::pools[0]);
29094 :
29095 : // Build a local variable for better performance
29096 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
29097 :
29098 : // Iterate over the memory pools
29099 0 : for (unsigned int i=0; i < SgTypeFixed::pools.size(); i++)
29100 : {
29101 : // objectArray[i] is a single memory pool
29102 0 : for (unsigned j=0; j < SgTypeFixed::pool_size; j++)
29103 : {
29104 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
29105 : {
29106 : // printf ("Found a valid SgTypeFixed object in the memory pool %d at position %d \n",i,j);
29107 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
29108 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
29109 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
29110 : }
29111 : else
29112 : {
29113 : // printf ("Found a INVALID SgTypeFixed object in the memory pool \n");
29114 : }
29115 : }
29116 : }
29117 : }
29118 :
29119 : // This should not be required since all previously static data members are
29120 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
29121 :
29122 194 : }
29123 :
29124 : void
29125 0 : SgTypeFixed::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
29126 : {
29127 : // This function visits only a single IR node of the memory pool.
29128 : // it is typically called once for each type of IR node within
29129 : // the automatically generated function: traverseRepresentativeNodes().
29130 :
29131 : // Initialize array to the address of the first element of the STL vector
29132 : // (which is guarenteed to be contiguous storage).
29133 : // SgTypeFixed objectArray [] = *(Memory_Block_List.begin());
29134 0 : if (SgTypeFixed::pools.empty() == false)
29135 : {
29136 : // Generate an array of memory pools
29137 0 : SgTypeFixed** objectArray = (SgTypeFixed**) &(SgTypeFixed::pools[0]);
29138 :
29139 : // Build a local variable for better performance
29140 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
29141 :
29142 : // Iterate over the memory pools
29143 0 : bool done = false;
29144 0 : unsigned i=0;
29145 :
29146 : // find the first valid IR node, call visit function, and then leave
29147 0 : while ( done == false && i < SgTypeFixed::pools.size() )
29148 : {
29149 : // objectArray[i] is a single memory pool
29150 : unsigned j=0;
29151 0 : while (done == false && j < SgTypeFixed::pool_size)
29152 : {
29153 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
29154 : {
29155 0 : traversal.visit(&(objectArray[i][j]));
29156 0 : done = true;
29157 : }
29158 0 : j++;
29159 : }
29160 0 : i++;
29161 : }
29162 :
29163 : #if 0
29164 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
29165 : if (done == false)
29166 : {
29167 : printf ("No representative for SgTypeFixed found in memory pools \n");
29168 : }
29169 : #endif
29170 : }
29171 0 : }
29172 :
29173 :
29174 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
29175 : // using values that overflow signed values of int.
29176 : size_t
29177 4 : SgTypeFixed::numberOfNodes()
29178 : {
29179 : // This function traverses the memory pool for an IR node and
29180 : // counts the number of IR nodes of a particular Sage III IR
29181 : // nodes type.
29182 :
29183 4 : size_t count = 0;
29184 4 : if (SgTypeFixed::pools.empty() == false)
29185 : {
29186 : // Generate an array of memory pools (this is actually a STL vector,
29187 : // but it is contiguious, so OK to treat this way).
29188 0 : SgTypeFixed** objectArray = (SgTypeFixed**) &(SgTypeFixed::pools[0]);
29189 :
29190 : // Build a local variable for better performance (make it a loop invariant variable).
29191 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
29192 :
29193 : // Iterate over all of the memory pools for this IR node.
29194 0 : for (unsigned int i=0; i < SgTypeFixed::pools.size(); i++)
29195 : {
29196 : // objectArray[i] is a single memory pool, iterate over all the
29197 : // IR nodes and only count those that are valid IR nodes used in
29198 : // the AST (i.e. allocated IR nodes).
29199 0 : for (unsigned j=0; j < SgTypeFixed::pool_size; j++)
29200 : {
29201 : // This is indexing the STL vector of C/C++ style arrays as a doubly
29202 : // indexed array access. It is OK since we have leveraged the semantics
29203 : // of STL vector memory as contigous and cast the memory as an array
29204 : // of arrays to use the 2D array indexing. Hope this is not confusing,
29205 : // but it s very fast as an implementation.
29206 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
29207 : {
29208 0 : count++;
29209 : }
29210 : }
29211 : }
29212 : }
29213 :
29214 :
29215 :
29216 4 : return count;
29217 : }
29218 :
29219 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
29220 : // using values that overflow signed values of int.
29221 : size_t
29222 0 : SgTypeFixed::memoryUsage()
29223 : {
29224 : // This function is required because we need the class name as a type when we call sizeof
29225 : // There might be another way to implement this if we have a traversal that only called a
29226 : // representative object (one call for each type of Sage IIIIR node).
29227 0 : size_t memory = numberOfNodes() * sizeof(SgTypeFixed);
29228 :
29229 0 : return memory;
29230 : }
29231 :
29232 : /* #line 29233 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
29233 :
29234 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
29235 : void
29236 5668 : SgAutoType::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
29237 : {
29238 : // This function traverses the memory pool for only a specific IR node
29239 : // and calls the visit function of the input class execute a traversal
29240 : // similar to the style of the attribute based traversals within ROSE.
29241 : // This traversal will visit ALL nodes of the AST where as the other
29242 : // attribute based traversals visit only the embedded tree within the AST.
29243 :
29244 : // Initialize array to the address of the first element of the STL vector
29245 : // (which is guaranteed to be contiguous storage).
29246 : // SgAutoType objectArray [] = *(Memory_Block_List.begin());
29247 5668 : if (SgAutoType::pools.empty() == false)
29248 : {
29249 : // Generate an array of memory pools
29250 145 : SgAutoType** objectArray = (SgAutoType**) &(SgAutoType::pools[0]);
29251 :
29252 : // Build a local variable for better performance
29253 145 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
29254 : #if 0
29255 : // Iterate over the memory pools
29256 : for (unsigned int i=0; i < SgAutoType::pools.size(); i++)
29257 : {
29258 : // objectArray[i] is a single memory pool
29259 : for (int j=0; j < SgAutoType::pool_size; j++)
29260 : {
29261 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
29262 : {
29263 : traversal.visit(&(objectArray[i][j]));
29264 : }
29265 : }
29266 : }
29267 : #else
29268 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
29269 : // compute the list first and then call the visit function on each list element.
29270 :
29271 : // printf ("Inside of SgAutoType::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
29272 :
29273 290 : std::vector<SgAutoType*> nodeList;
29274 :
29275 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
29276 290 : for (unsigned int i=0; i < SgAutoType::pools.size(); i++)
29277 : {
29278 : // objectArray[i] is a single memory pool
29279 290145 : for (unsigned j=0; j < SgAutoType::pool_size; j++)
29280 : {
29281 290000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
29282 : {
29283 2078 : nodeList.push_back(&(objectArray[i][j]));
29284 : }
29285 : }
29286 : }
29287 :
29288 : // Iterate over the saved list
29289 145 : size_t nodeListSize = nodeList.size();
29290 2223 : for (size_t i=0; i < nodeListSize; i++)
29291 : {
29292 2078 : ROSE_ASSERT(nodeList[i] != NULL);
29293 : #if 0
29294 : traversal.visit(nodeList[i]);
29295 : #else
29296 2078 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
29297 : {
29298 2078 : traversal.visit(nodeList[i]);
29299 : }
29300 : #endif
29301 : }
29302 : #endif
29303 : }
29304 :
29305 : // This should not be required since all previously static data members are
29306 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
29307 :
29308 5668 : }
29309 :
29310 :
29311 : void
29312 194 : SgAutoType::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
29313 : {
29314 : // This function traverses the memory pool for an IR node and
29315 : // calls the function to execute the visitor object.
29316 :
29317 : // Initialize array to the address of the first element of the STL vector
29318 : // (which is guarenteed to be contiguous storage).
29319 : // SgAutoType objectArray [] = *(Memory_Block_List.begin());
29320 194 : if (SgAutoType::pools.empty() == false)
29321 : {
29322 : // Generate an array of memory pools
29323 137 : SgAutoType** objectArray = (SgAutoType**) &(SgAutoType::pools[0]);
29324 :
29325 : // Build a local variable for better performance
29326 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
29327 :
29328 : // Iterate over the memory pools
29329 274 : for (unsigned int i=0; i < SgAutoType::pools.size(); i++)
29330 : {
29331 : // objectArray[i] is a single memory pool
29332 274137 : for (unsigned j=0; j < SgAutoType::pool_size; j++)
29333 : {
29334 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
29335 : {
29336 : // printf ("Found a valid SgAutoType object in the memory pool %d at position %d \n",i,j);
29337 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
29338 2062 : objectArray[i][j].executeVisitorMemberFunction(visitor);
29339 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
29340 : }
29341 : else
29342 : {
29343 : // printf ("Found a INVALID SgAutoType object in the memory pool \n");
29344 : }
29345 : }
29346 : }
29347 : }
29348 :
29349 : // This should not be required since all previously static data members are
29350 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
29351 :
29352 194 : }
29353 :
29354 : void
29355 0 : SgAutoType::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
29356 : {
29357 : // This function visits only a single IR node of the memory pool.
29358 : // it is typically called once for each type of IR node within
29359 : // the automatically generated function: traverseRepresentativeNodes().
29360 :
29361 : // Initialize array to the address of the first element of the STL vector
29362 : // (which is guarenteed to be contiguous storage).
29363 : // SgAutoType objectArray [] = *(Memory_Block_List.begin());
29364 0 : if (SgAutoType::pools.empty() == false)
29365 : {
29366 : // Generate an array of memory pools
29367 0 : SgAutoType** objectArray = (SgAutoType**) &(SgAutoType::pools[0]);
29368 :
29369 : // Build a local variable for better performance
29370 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
29371 :
29372 : // Iterate over the memory pools
29373 0 : bool done = false;
29374 0 : unsigned i=0;
29375 :
29376 : // find the first valid IR node, call visit function, and then leave
29377 0 : while ( done == false && i < SgAutoType::pools.size() )
29378 : {
29379 : // objectArray[i] is a single memory pool
29380 : unsigned j=0;
29381 0 : while (done == false && j < SgAutoType::pool_size)
29382 : {
29383 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
29384 : {
29385 0 : traversal.visit(&(objectArray[i][j]));
29386 0 : done = true;
29387 : }
29388 0 : j++;
29389 : }
29390 0 : i++;
29391 : }
29392 :
29393 : #if 0
29394 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
29395 : if (done == false)
29396 : {
29397 : printf ("No representative for SgAutoType found in memory pools \n");
29398 : }
29399 : #endif
29400 : }
29401 0 : }
29402 :
29403 :
29404 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
29405 : // using values that overflow signed values of int.
29406 : size_t
29407 4 : SgAutoType::numberOfNodes()
29408 : {
29409 : // This function traverses the memory pool for an IR node and
29410 : // counts the number of IR nodes of a particular Sage III IR
29411 : // nodes type.
29412 :
29413 4 : size_t count = 0;
29414 4 : if (SgAutoType::pools.empty() == false)
29415 : {
29416 : // Generate an array of memory pools (this is actually a STL vector,
29417 : // but it is contiguious, so OK to treat this way).
29418 1 : SgAutoType** objectArray = (SgAutoType**) &(SgAutoType::pools[0]);
29419 :
29420 : // Build a local variable for better performance (make it a loop invariant variable).
29421 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
29422 :
29423 : // Iterate over all of the memory pools for this IR node.
29424 2 : for (unsigned int i=0; i < SgAutoType::pools.size(); i++)
29425 : {
29426 : // objectArray[i] is a single memory pool, iterate over all the
29427 : // IR nodes and only count those that are valid IR nodes used in
29428 : // the AST (i.e. allocated IR nodes).
29429 2001 : for (unsigned j=0; j < SgAutoType::pool_size; j++)
29430 : {
29431 : // This is indexing the STL vector of C/C++ style arrays as a doubly
29432 : // indexed array access. It is OK since we have leveraged the semantics
29433 : // of STL vector memory as contigous and cast the memory as an array
29434 : // of arrays to use the 2D array indexing. Hope this is not confusing,
29435 : // but it s very fast as an implementation.
29436 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
29437 : {
29438 14 : count++;
29439 : }
29440 : }
29441 : }
29442 : }
29443 :
29444 :
29445 :
29446 4 : return count;
29447 : }
29448 :
29449 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
29450 : // using values that overflow signed values of int.
29451 : size_t
29452 0 : SgAutoType::memoryUsage()
29453 : {
29454 : // This function is required because we need the class name as a type when we call sizeof
29455 : // There might be another way to implement this if we have a traversal that only called a
29456 : // representative object (one call for each type of Sage IIIIR node).
29457 0 : size_t memory = numberOfNodes() * sizeof(SgAutoType);
29458 :
29459 0 : return memory;
29460 : }
29461 :
29462 : /* #line 29463 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
29463 :
29464 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
29465 : void
29466 5342 : SgLocatedNode::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
29467 : {
29468 : // This function traverses the memory pool for only a specific IR node
29469 : // and calls the visit function of the input class execute a traversal
29470 : // similar to the style of the attribute based traversals within ROSE.
29471 : // This traversal will visit ALL nodes of the AST where as the other
29472 : // attribute based traversals visit only the embedded tree within the AST.
29473 :
29474 : // Initialize array to the address of the first element of the STL vector
29475 : // (which is guaranteed to be contiguous storage).
29476 : // SgLocatedNode objectArray [] = *(Memory_Block_List.begin());
29477 5342 : if (SgLocatedNode::pools.empty() == false)
29478 : {
29479 : // Generate an array of memory pools
29480 0 : SgLocatedNode** objectArray = (SgLocatedNode**) &(SgLocatedNode::pools[0]);
29481 :
29482 : // Build a local variable for better performance
29483 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
29484 : #if 0
29485 : // Iterate over the memory pools
29486 : for (unsigned int i=0; i < SgLocatedNode::pools.size(); i++)
29487 : {
29488 : // objectArray[i] is a single memory pool
29489 : for (int j=0; j < SgLocatedNode::pool_size; j++)
29490 : {
29491 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
29492 : {
29493 : traversal.visit(&(objectArray[i][j]));
29494 : }
29495 : }
29496 : }
29497 : #else
29498 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
29499 : // compute the list first and then call the visit function on each list element.
29500 :
29501 : // printf ("Inside of SgLocatedNode::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
29502 :
29503 0 : std::vector<SgLocatedNode*> nodeList;
29504 :
29505 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
29506 0 : for (unsigned int i=0; i < SgLocatedNode::pools.size(); i++)
29507 : {
29508 : // objectArray[i] is a single memory pool
29509 0 : for (unsigned j=0; j < SgLocatedNode::pool_size; j++)
29510 : {
29511 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
29512 : {
29513 0 : nodeList.push_back(&(objectArray[i][j]));
29514 : }
29515 : }
29516 : }
29517 :
29518 : // Iterate over the saved list
29519 0 : size_t nodeListSize = nodeList.size();
29520 0 : for (size_t i=0; i < nodeListSize; i++)
29521 : {
29522 0 : ROSE_ASSERT(nodeList[i] != NULL);
29523 : #if 0
29524 : traversal.visit(nodeList[i]);
29525 : #else
29526 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
29527 : {
29528 0 : traversal.visit(nodeList[i]);
29529 : }
29530 : #endif
29531 : }
29532 : #endif
29533 : }
29534 :
29535 : // This should not be required since all previously static data members are
29536 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
29537 :
29538 5342 : }
29539 :
29540 :
29541 : void
29542 194 : SgLocatedNode::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
29543 : {
29544 : // This function traverses the memory pool for an IR node and
29545 : // calls the function to execute the visitor object.
29546 :
29547 : // Initialize array to the address of the first element of the STL vector
29548 : // (which is guarenteed to be contiguous storage).
29549 : // SgLocatedNode objectArray [] = *(Memory_Block_List.begin());
29550 194 : if (SgLocatedNode::pools.empty() == false)
29551 : {
29552 : // Generate an array of memory pools
29553 0 : SgLocatedNode** objectArray = (SgLocatedNode**) &(SgLocatedNode::pools[0]);
29554 :
29555 : // Build a local variable for better performance
29556 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
29557 :
29558 : // Iterate over the memory pools
29559 0 : for (unsigned int i=0; i < SgLocatedNode::pools.size(); i++)
29560 : {
29561 : // objectArray[i] is a single memory pool
29562 0 : for (unsigned j=0; j < SgLocatedNode::pool_size; j++)
29563 : {
29564 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
29565 : {
29566 : // printf ("Found a valid SgLocatedNode object in the memory pool %d at position %d \n",i,j);
29567 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
29568 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
29569 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
29570 : }
29571 : else
29572 : {
29573 : // printf ("Found a INVALID SgLocatedNode object in the memory pool \n");
29574 : }
29575 : }
29576 : }
29577 : }
29578 :
29579 : // This should not be required since all previously static data members are
29580 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
29581 :
29582 194 : }
29583 :
29584 : void
29585 0 : SgLocatedNode::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
29586 : {
29587 : // This function visits only a single IR node of the memory pool.
29588 : // it is typically called once for each type of IR node within
29589 : // the automatically generated function: traverseRepresentativeNodes().
29590 :
29591 : // Initialize array to the address of the first element of the STL vector
29592 : // (which is guarenteed to be contiguous storage).
29593 : // SgLocatedNode objectArray [] = *(Memory_Block_List.begin());
29594 0 : if (SgLocatedNode::pools.empty() == false)
29595 : {
29596 : // Generate an array of memory pools
29597 0 : SgLocatedNode** objectArray = (SgLocatedNode**) &(SgLocatedNode::pools[0]);
29598 :
29599 : // Build a local variable for better performance
29600 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
29601 :
29602 : // Iterate over the memory pools
29603 0 : bool done = false;
29604 0 : unsigned i=0;
29605 :
29606 : // find the first valid IR node, call visit function, and then leave
29607 0 : while ( done == false && i < SgLocatedNode::pools.size() )
29608 : {
29609 : // objectArray[i] is a single memory pool
29610 : unsigned j=0;
29611 0 : while (done == false && j < SgLocatedNode::pool_size)
29612 : {
29613 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
29614 : {
29615 0 : traversal.visit(&(objectArray[i][j]));
29616 0 : done = true;
29617 : }
29618 0 : j++;
29619 : }
29620 0 : i++;
29621 : }
29622 :
29623 : #if 0
29624 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
29625 : if (done == false)
29626 : {
29627 : printf ("No representative for SgLocatedNode found in memory pools \n");
29628 : }
29629 : #endif
29630 : }
29631 0 : }
29632 :
29633 :
29634 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
29635 : // using values that overflow signed values of int.
29636 : size_t
29637 4 : SgLocatedNode::numberOfNodes()
29638 : {
29639 : // This function traverses the memory pool for an IR node and
29640 : // counts the number of IR nodes of a particular Sage III IR
29641 : // nodes type.
29642 :
29643 4 : size_t count = 0;
29644 4 : if (SgLocatedNode::pools.empty() == false)
29645 : {
29646 : // Generate an array of memory pools (this is actually a STL vector,
29647 : // but it is contiguious, so OK to treat this way).
29648 0 : SgLocatedNode** objectArray = (SgLocatedNode**) &(SgLocatedNode::pools[0]);
29649 :
29650 : // Build a local variable for better performance (make it a loop invariant variable).
29651 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
29652 :
29653 : // Iterate over all of the memory pools for this IR node.
29654 0 : for (unsigned int i=0; i < SgLocatedNode::pools.size(); i++)
29655 : {
29656 : // objectArray[i] is a single memory pool, iterate over all the
29657 : // IR nodes and only count those that are valid IR nodes used in
29658 : // the AST (i.e. allocated IR nodes).
29659 0 : for (unsigned j=0; j < SgLocatedNode::pool_size; j++)
29660 : {
29661 : // This is indexing the STL vector of C/C++ style arrays as a doubly
29662 : // indexed array access. It is OK since we have leveraged the semantics
29663 : // of STL vector memory as contigous and cast the memory as an array
29664 : // of arrays to use the 2D array indexing. Hope this is not confusing,
29665 : // but it s very fast as an implementation.
29666 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
29667 : {
29668 0 : count++;
29669 : }
29670 : }
29671 : }
29672 : }
29673 :
29674 :
29675 :
29676 4 : return count;
29677 : }
29678 :
29679 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
29680 : // using values that overflow signed values of int.
29681 : size_t
29682 0 : SgLocatedNode::memoryUsage()
29683 : {
29684 : // This function is required because we need the class name as a type when we call sizeof
29685 : // There might be another way to implement this if we have a traversal that only called a
29686 : // representative object (one call for each type of Sage IIIIR node).
29687 0 : size_t memory = numberOfNodes() * sizeof(SgLocatedNode);
29688 :
29689 0 : return memory;
29690 : }
29691 :
29692 : /* #line 29693 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
29693 :
29694 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
29695 : void
29696 5342 : SgToken::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
29697 : {
29698 : // This function traverses the memory pool for only a specific IR node
29699 : // and calls the visit function of the input class execute a traversal
29700 : // similar to the style of the attribute based traversals within ROSE.
29701 : // This traversal will visit ALL nodes of the AST where as the other
29702 : // attribute based traversals visit only the embedded tree within the AST.
29703 :
29704 : // Initialize array to the address of the first element of the STL vector
29705 : // (which is guaranteed to be contiguous storage).
29706 : // SgToken objectArray [] = *(Memory_Block_List.begin());
29707 5342 : if (SgToken::pools.empty() == false)
29708 : {
29709 : // Generate an array of memory pools
29710 0 : SgToken** objectArray = (SgToken**) &(SgToken::pools[0]);
29711 :
29712 : // Build a local variable for better performance
29713 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
29714 : #if 0
29715 : // Iterate over the memory pools
29716 : for (unsigned int i=0; i < SgToken::pools.size(); i++)
29717 : {
29718 : // objectArray[i] is a single memory pool
29719 : for (int j=0; j < SgToken::pool_size; j++)
29720 : {
29721 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
29722 : {
29723 : traversal.visit(&(objectArray[i][j]));
29724 : }
29725 : }
29726 : }
29727 : #else
29728 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
29729 : // compute the list first and then call the visit function on each list element.
29730 :
29731 : // printf ("Inside of SgToken::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
29732 :
29733 0 : std::vector<SgToken*> nodeList;
29734 :
29735 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
29736 0 : for (unsigned int i=0; i < SgToken::pools.size(); i++)
29737 : {
29738 : // objectArray[i] is a single memory pool
29739 0 : for (unsigned j=0; j < SgToken::pool_size; j++)
29740 : {
29741 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
29742 : {
29743 0 : nodeList.push_back(&(objectArray[i][j]));
29744 : }
29745 : }
29746 : }
29747 :
29748 : // Iterate over the saved list
29749 0 : size_t nodeListSize = nodeList.size();
29750 0 : for (size_t i=0; i < nodeListSize; i++)
29751 : {
29752 0 : ROSE_ASSERT(nodeList[i] != NULL);
29753 : #if 0
29754 : traversal.visit(nodeList[i]);
29755 : #else
29756 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
29757 : {
29758 0 : traversal.visit(nodeList[i]);
29759 : }
29760 : #endif
29761 : }
29762 : #endif
29763 : }
29764 :
29765 : // This should not be required since all previously static data members are
29766 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
29767 :
29768 5342 : }
29769 :
29770 :
29771 : void
29772 194 : SgToken::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
29773 : {
29774 : // This function traverses the memory pool for an IR node and
29775 : // calls the function to execute the visitor object.
29776 :
29777 : // Initialize array to the address of the first element of the STL vector
29778 : // (which is guarenteed to be contiguous storage).
29779 : // SgToken objectArray [] = *(Memory_Block_List.begin());
29780 194 : if (SgToken::pools.empty() == false)
29781 : {
29782 : // Generate an array of memory pools
29783 0 : SgToken** objectArray = (SgToken**) &(SgToken::pools[0]);
29784 :
29785 : // Build a local variable for better performance
29786 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
29787 :
29788 : // Iterate over the memory pools
29789 0 : for (unsigned int i=0; i < SgToken::pools.size(); i++)
29790 : {
29791 : // objectArray[i] is a single memory pool
29792 0 : for (unsigned j=0; j < SgToken::pool_size; j++)
29793 : {
29794 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
29795 : {
29796 : // printf ("Found a valid SgToken object in the memory pool %d at position %d \n",i,j);
29797 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
29798 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
29799 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
29800 : }
29801 : else
29802 : {
29803 : // printf ("Found a INVALID SgToken object in the memory pool \n");
29804 : }
29805 : }
29806 : }
29807 : }
29808 :
29809 : // This should not be required since all previously static data members are
29810 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
29811 :
29812 194 : }
29813 :
29814 : void
29815 0 : SgToken::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
29816 : {
29817 : // This function visits only a single IR node of the memory pool.
29818 : // it is typically called once for each type of IR node within
29819 : // the automatically generated function: traverseRepresentativeNodes().
29820 :
29821 : // Initialize array to the address of the first element of the STL vector
29822 : // (which is guarenteed to be contiguous storage).
29823 : // SgToken objectArray [] = *(Memory_Block_List.begin());
29824 0 : if (SgToken::pools.empty() == false)
29825 : {
29826 : // Generate an array of memory pools
29827 0 : SgToken** objectArray = (SgToken**) &(SgToken::pools[0]);
29828 :
29829 : // Build a local variable for better performance
29830 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
29831 :
29832 : // Iterate over the memory pools
29833 0 : bool done = false;
29834 0 : unsigned i=0;
29835 :
29836 : // find the first valid IR node, call visit function, and then leave
29837 0 : while ( done == false && i < SgToken::pools.size() )
29838 : {
29839 : // objectArray[i] is a single memory pool
29840 : unsigned j=0;
29841 0 : while (done == false && j < SgToken::pool_size)
29842 : {
29843 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
29844 : {
29845 0 : traversal.visit(&(objectArray[i][j]));
29846 0 : done = true;
29847 : }
29848 0 : j++;
29849 : }
29850 0 : i++;
29851 : }
29852 :
29853 : #if 0
29854 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
29855 : if (done == false)
29856 : {
29857 : printf ("No representative for SgToken found in memory pools \n");
29858 : }
29859 : #endif
29860 : }
29861 0 : }
29862 :
29863 :
29864 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
29865 : // using values that overflow signed values of int.
29866 : size_t
29867 4 : SgToken::numberOfNodes()
29868 : {
29869 : // This function traverses the memory pool for an IR node and
29870 : // counts the number of IR nodes of a particular Sage III IR
29871 : // nodes type.
29872 :
29873 4 : size_t count = 0;
29874 4 : if (SgToken::pools.empty() == false)
29875 : {
29876 : // Generate an array of memory pools (this is actually a STL vector,
29877 : // but it is contiguious, so OK to treat this way).
29878 0 : SgToken** objectArray = (SgToken**) &(SgToken::pools[0]);
29879 :
29880 : // Build a local variable for better performance (make it a loop invariant variable).
29881 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
29882 :
29883 : // Iterate over all of the memory pools for this IR node.
29884 0 : for (unsigned int i=0; i < SgToken::pools.size(); i++)
29885 : {
29886 : // objectArray[i] is a single memory pool, iterate over all the
29887 : // IR nodes and only count those that are valid IR nodes used in
29888 : // the AST (i.e. allocated IR nodes).
29889 0 : for (unsigned j=0; j < SgToken::pool_size; j++)
29890 : {
29891 : // This is indexing the STL vector of C/C++ style arrays as a doubly
29892 : // indexed array access. It is OK since we have leveraged the semantics
29893 : // of STL vector memory as contigous and cast the memory as an array
29894 : // of arrays to use the 2D array indexing. Hope this is not confusing,
29895 : // but it s very fast as an implementation.
29896 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
29897 : {
29898 0 : count++;
29899 : }
29900 : }
29901 : }
29902 : }
29903 :
29904 :
29905 :
29906 4 : return count;
29907 : }
29908 :
29909 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
29910 : // using values that overflow signed values of int.
29911 : size_t
29912 0 : SgToken::memoryUsage()
29913 : {
29914 : // This function is required because we need the class name as a type when we call sizeof
29915 : // There might be another way to implement this if we have a traversal that only called a
29916 : // representative object (one call for each type of Sage IIIIR node).
29917 0 : size_t memory = numberOfNodes() * sizeof(SgToken);
29918 :
29919 0 : return memory;
29920 : }
29921 :
29922 : /* #line 29923 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
29923 :
29924 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
29925 : void
29926 5342 : SgLocatedNodeSupport::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
29927 : {
29928 : // This function traverses the memory pool for only a specific IR node
29929 : // and calls the visit function of the input class execute a traversal
29930 : // similar to the style of the attribute based traversals within ROSE.
29931 : // This traversal will visit ALL nodes of the AST where as the other
29932 : // attribute based traversals visit only the embedded tree within the AST.
29933 :
29934 : // Initialize array to the address of the first element of the STL vector
29935 : // (which is guaranteed to be contiguous storage).
29936 : // SgLocatedNodeSupport objectArray [] = *(Memory_Block_List.begin());
29937 5342 : if (SgLocatedNodeSupport::pools.empty() == false)
29938 : {
29939 : // Generate an array of memory pools
29940 0 : SgLocatedNodeSupport** objectArray = (SgLocatedNodeSupport**) &(SgLocatedNodeSupport::pools[0]);
29941 :
29942 : // Build a local variable for better performance
29943 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
29944 : #if 0
29945 : // Iterate over the memory pools
29946 : for (unsigned int i=0; i < SgLocatedNodeSupport::pools.size(); i++)
29947 : {
29948 : // objectArray[i] is a single memory pool
29949 : for (int j=0; j < SgLocatedNodeSupport::pool_size; j++)
29950 : {
29951 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
29952 : {
29953 : traversal.visit(&(objectArray[i][j]));
29954 : }
29955 : }
29956 : }
29957 : #else
29958 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
29959 : // compute the list first and then call the visit function on each list element.
29960 :
29961 : // printf ("Inside of SgLocatedNodeSupport::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
29962 :
29963 0 : std::vector<SgLocatedNodeSupport*> nodeList;
29964 :
29965 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
29966 0 : for (unsigned int i=0; i < SgLocatedNodeSupport::pools.size(); i++)
29967 : {
29968 : // objectArray[i] is a single memory pool
29969 0 : for (unsigned j=0; j < SgLocatedNodeSupport::pool_size; j++)
29970 : {
29971 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
29972 : {
29973 0 : nodeList.push_back(&(objectArray[i][j]));
29974 : }
29975 : }
29976 : }
29977 :
29978 : // Iterate over the saved list
29979 0 : size_t nodeListSize = nodeList.size();
29980 0 : for (size_t i=0; i < nodeListSize; i++)
29981 : {
29982 0 : ROSE_ASSERT(nodeList[i] != NULL);
29983 : #if 0
29984 : traversal.visit(nodeList[i]);
29985 : #else
29986 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
29987 : {
29988 0 : traversal.visit(nodeList[i]);
29989 : }
29990 : #endif
29991 : }
29992 : #endif
29993 : }
29994 :
29995 : // This should not be required since all previously static data members are
29996 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
29997 :
29998 5342 : }
29999 :
30000 :
30001 : void
30002 194 : SgLocatedNodeSupport::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
30003 : {
30004 : // This function traverses the memory pool for an IR node and
30005 : // calls the function to execute the visitor object.
30006 :
30007 : // Initialize array to the address of the first element of the STL vector
30008 : // (which is guarenteed to be contiguous storage).
30009 : // SgLocatedNodeSupport objectArray [] = *(Memory_Block_List.begin());
30010 194 : if (SgLocatedNodeSupport::pools.empty() == false)
30011 : {
30012 : // Generate an array of memory pools
30013 0 : SgLocatedNodeSupport** objectArray = (SgLocatedNodeSupport**) &(SgLocatedNodeSupport::pools[0]);
30014 :
30015 : // Build a local variable for better performance
30016 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
30017 :
30018 : // Iterate over the memory pools
30019 0 : for (unsigned int i=0; i < SgLocatedNodeSupport::pools.size(); i++)
30020 : {
30021 : // objectArray[i] is a single memory pool
30022 0 : for (unsigned j=0; j < SgLocatedNodeSupport::pool_size; j++)
30023 : {
30024 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
30025 : {
30026 : // printf ("Found a valid SgLocatedNodeSupport object in the memory pool %d at position %d \n",i,j);
30027 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
30028 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
30029 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
30030 : }
30031 : else
30032 : {
30033 : // printf ("Found a INVALID SgLocatedNodeSupport object in the memory pool \n");
30034 : }
30035 : }
30036 : }
30037 : }
30038 :
30039 : // This should not be required since all previously static data members are
30040 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
30041 :
30042 194 : }
30043 :
30044 : void
30045 0 : SgLocatedNodeSupport::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
30046 : {
30047 : // This function visits only a single IR node of the memory pool.
30048 : // it is typically called once for each type of IR node within
30049 : // the automatically generated function: traverseRepresentativeNodes().
30050 :
30051 : // Initialize array to the address of the first element of the STL vector
30052 : // (which is guarenteed to be contiguous storage).
30053 : // SgLocatedNodeSupport objectArray [] = *(Memory_Block_List.begin());
30054 0 : if (SgLocatedNodeSupport::pools.empty() == false)
30055 : {
30056 : // Generate an array of memory pools
30057 0 : SgLocatedNodeSupport** objectArray = (SgLocatedNodeSupport**) &(SgLocatedNodeSupport::pools[0]);
30058 :
30059 : // Build a local variable for better performance
30060 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
30061 :
30062 : // Iterate over the memory pools
30063 0 : bool done = false;
30064 0 : unsigned i=0;
30065 :
30066 : // find the first valid IR node, call visit function, and then leave
30067 0 : while ( done == false && i < SgLocatedNodeSupport::pools.size() )
30068 : {
30069 : // objectArray[i] is a single memory pool
30070 : unsigned j=0;
30071 0 : while (done == false && j < SgLocatedNodeSupport::pool_size)
30072 : {
30073 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
30074 : {
30075 0 : traversal.visit(&(objectArray[i][j]));
30076 0 : done = true;
30077 : }
30078 0 : j++;
30079 : }
30080 0 : i++;
30081 : }
30082 :
30083 : #if 0
30084 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
30085 : if (done == false)
30086 : {
30087 : printf ("No representative for SgLocatedNodeSupport found in memory pools \n");
30088 : }
30089 : #endif
30090 : }
30091 0 : }
30092 :
30093 :
30094 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
30095 : // using values that overflow signed values of int.
30096 : size_t
30097 4 : SgLocatedNodeSupport::numberOfNodes()
30098 : {
30099 : // This function traverses the memory pool for an IR node and
30100 : // counts the number of IR nodes of a particular Sage III IR
30101 : // nodes type.
30102 :
30103 4 : size_t count = 0;
30104 4 : if (SgLocatedNodeSupport::pools.empty() == false)
30105 : {
30106 : // Generate an array of memory pools (this is actually a STL vector,
30107 : // but it is contiguious, so OK to treat this way).
30108 0 : SgLocatedNodeSupport** objectArray = (SgLocatedNodeSupport**) &(SgLocatedNodeSupport::pools[0]);
30109 :
30110 : // Build a local variable for better performance (make it a loop invariant variable).
30111 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
30112 :
30113 : // Iterate over all of the memory pools for this IR node.
30114 0 : for (unsigned int i=0; i < SgLocatedNodeSupport::pools.size(); i++)
30115 : {
30116 : // objectArray[i] is a single memory pool, iterate over all the
30117 : // IR nodes and only count those that are valid IR nodes used in
30118 : // the AST (i.e. allocated IR nodes).
30119 0 : for (unsigned j=0; j < SgLocatedNodeSupport::pool_size; j++)
30120 : {
30121 : // This is indexing the STL vector of C/C++ style arrays as a doubly
30122 : // indexed array access. It is OK since we have leveraged the semantics
30123 : // of STL vector memory as contigous and cast the memory as an array
30124 : // of arrays to use the 2D array indexing. Hope this is not confusing,
30125 : // but it s very fast as an implementation.
30126 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
30127 : {
30128 0 : count++;
30129 : }
30130 : }
30131 : }
30132 : }
30133 :
30134 :
30135 :
30136 4 : return count;
30137 : }
30138 :
30139 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
30140 : // using values that overflow signed values of int.
30141 : size_t
30142 0 : SgLocatedNodeSupport::memoryUsage()
30143 : {
30144 : // This function is required because we need the class name as a type when we call sizeof
30145 : // There might be another way to implement this if we have a traversal that only called a
30146 : // representative object (one call for each type of Sage IIIIR node).
30147 0 : size_t memory = numberOfNodes() * sizeof(SgLocatedNodeSupport);
30148 :
30149 0 : return memory;
30150 : }
30151 :
30152 : /* #line 30153 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
30153 :
30154 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
30155 : void
30156 5342 : SgCommonBlockObject::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
30157 : {
30158 : // This function traverses the memory pool for only a specific IR node
30159 : // and calls the visit function of the input class execute a traversal
30160 : // similar to the style of the attribute based traversals within ROSE.
30161 : // This traversal will visit ALL nodes of the AST where as the other
30162 : // attribute based traversals visit only the embedded tree within the AST.
30163 :
30164 : // Initialize array to the address of the first element of the STL vector
30165 : // (which is guaranteed to be contiguous storage).
30166 : // SgCommonBlockObject objectArray [] = *(Memory_Block_List.begin());
30167 5342 : if (SgCommonBlockObject::pools.empty() == false)
30168 : {
30169 : // Generate an array of memory pools
30170 47 : SgCommonBlockObject** objectArray = (SgCommonBlockObject**) &(SgCommonBlockObject::pools[0]);
30171 :
30172 : // Build a local variable for better performance
30173 47 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
30174 : #if 0
30175 : // Iterate over the memory pools
30176 : for (unsigned int i=0; i < SgCommonBlockObject::pools.size(); i++)
30177 : {
30178 : // objectArray[i] is a single memory pool
30179 : for (int j=0; j < SgCommonBlockObject::pool_size; j++)
30180 : {
30181 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
30182 : {
30183 : traversal.visit(&(objectArray[i][j]));
30184 : }
30185 : }
30186 : }
30187 : #else
30188 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
30189 : // compute the list first and then call the visit function on each list element.
30190 :
30191 : // printf ("Inside of SgCommonBlockObject::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
30192 :
30193 94 : std::vector<SgCommonBlockObject*> nodeList;
30194 :
30195 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
30196 94 : for (unsigned int i=0; i < SgCommonBlockObject::pools.size(); i++)
30197 : {
30198 : // objectArray[i] is a single memory pool
30199 94047 : for (unsigned j=0; j < SgCommonBlockObject::pool_size; j++)
30200 : {
30201 94000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
30202 : {
30203 107 : nodeList.push_back(&(objectArray[i][j]));
30204 : }
30205 : }
30206 : }
30207 :
30208 : // Iterate over the saved list
30209 47 : size_t nodeListSize = nodeList.size();
30210 154 : for (size_t i=0; i < nodeListSize; i++)
30211 : {
30212 107 : ROSE_ASSERT(nodeList[i] != NULL);
30213 : #if 0
30214 : traversal.visit(nodeList[i]);
30215 : #else
30216 107 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
30217 : {
30218 107 : traversal.visit(nodeList[i]);
30219 : }
30220 : #endif
30221 : }
30222 : #endif
30223 : }
30224 :
30225 : // This should not be required since all previously static data members are
30226 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
30227 :
30228 5342 : }
30229 :
30230 :
30231 : void
30232 194 : SgCommonBlockObject::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
30233 : {
30234 : // This function traverses the memory pool for an IR node and
30235 : // calls the function to execute the visitor object.
30236 :
30237 : // Initialize array to the address of the first element of the STL vector
30238 : // (which is guarenteed to be contiguous storage).
30239 : // SgCommonBlockObject objectArray [] = *(Memory_Block_List.begin());
30240 194 : if (SgCommonBlockObject::pools.empty() == false)
30241 : {
30242 : // Generate an array of memory pools
30243 0 : SgCommonBlockObject** objectArray = (SgCommonBlockObject**) &(SgCommonBlockObject::pools[0]);
30244 :
30245 : // Build a local variable for better performance
30246 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
30247 :
30248 : // Iterate over the memory pools
30249 0 : for (unsigned int i=0; i < SgCommonBlockObject::pools.size(); i++)
30250 : {
30251 : // objectArray[i] is a single memory pool
30252 0 : for (unsigned j=0; j < SgCommonBlockObject::pool_size; j++)
30253 : {
30254 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
30255 : {
30256 : // printf ("Found a valid SgCommonBlockObject object in the memory pool %d at position %d \n",i,j);
30257 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
30258 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
30259 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
30260 : }
30261 : else
30262 : {
30263 : // printf ("Found a INVALID SgCommonBlockObject object in the memory pool \n");
30264 : }
30265 : }
30266 : }
30267 : }
30268 :
30269 : // This should not be required since all previously static data members are
30270 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
30271 :
30272 194 : }
30273 :
30274 : void
30275 0 : SgCommonBlockObject::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
30276 : {
30277 : // This function visits only a single IR node of the memory pool.
30278 : // it is typically called once for each type of IR node within
30279 : // the automatically generated function: traverseRepresentativeNodes().
30280 :
30281 : // Initialize array to the address of the first element of the STL vector
30282 : // (which is guarenteed to be contiguous storage).
30283 : // SgCommonBlockObject objectArray [] = *(Memory_Block_List.begin());
30284 0 : if (SgCommonBlockObject::pools.empty() == false)
30285 : {
30286 : // Generate an array of memory pools
30287 0 : SgCommonBlockObject** objectArray = (SgCommonBlockObject**) &(SgCommonBlockObject::pools[0]);
30288 :
30289 : // Build a local variable for better performance
30290 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
30291 :
30292 : // Iterate over the memory pools
30293 0 : bool done = false;
30294 0 : unsigned i=0;
30295 :
30296 : // find the first valid IR node, call visit function, and then leave
30297 0 : while ( done == false && i < SgCommonBlockObject::pools.size() )
30298 : {
30299 : // objectArray[i] is a single memory pool
30300 : unsigned j=0;
30301 0 : while (done == false && j < SgCommonBlockObject::pool_size)
30302 : {
30303 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
30304 : {
30305 0 : traversal.visit(&(objectArray[i][j]));
30306 0 : done = true;
30307 : }
30308 0 : j++;
30309 : }
30310 0 : i++;
30311 : }
30312 :
30313 : #if 0
30314 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
30315 : if (done == false)
30316 : {
30317 : printf ("No representative for SgCommonBlockObject found in memory pools \n");
30318 : }
30319 : #endif
30320 : }
30321 0 : }
30322 :
30323 :
30324 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
30325 : // using values that overflow signed values of int.
30326 : size_t
30327 4 : SgCommonBlockObject::numberOfNodes()
30328 : {
30329 : // This function traverses the memory pool for an IR node and
30330 : // counts the number of IR nodes of a particular Sage III IR
30331 : // nodes type.
30332 :
30333 4 : size_t count = 0;
30334 4 : if (SgCommonBlockObject::pools.empty() == false)
30335 : {
30336 : // Generate an array of memory pools (this is actually a STL vector,
30337 : // but it is contiguious, so OK to treat this way).
30338 0 : SgCommonBlockObject** objectArray = (SgCommonBlockObject**) &(SgCommonBlockObject::pools[0]);
30339 :
30340 : // Build a local variable for better performance (make it a loop invariant variable).
30341 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
30342 :
30343 : // Iterate over all of the memory pools for this IR node.
30344 0 : for (unsigned int i=0; i < SgCommonBlockObject::pools.size(); i++)
30345 : {
30346 : // objectArray[i] is a single memory pool, iterate over all the
30347 : // IR nodes and only count those that are valid IR nodes used in
30348 : // the AST (i.e. allocated IR nodes).
30349 0 : for (unsigned j=0; j < SgCommonBlockObject::pool_size; j++)
30350 : {
30351 : // This is indexing the STL vector of C/C++ style arrays as a doubly
30352 : // indexed array access. It is OK since we have leveraged the semantics
30353 : // of STL vector memory as contigous and cast the memory as an array
30354 : // of arrays to use the 2D array indexing. Hope this is not confusing,
30355 : // but it s very fast as an implementation.
30356 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
30357 : {
30358 0 : count++;
30359 : }
30360 : }
30361 : }
30362 : }
30363 :
30364 :
30365 :
30366 4 : return count;
30367 : }
30368 :
30369 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
30370 : // using values that overflow signed values of int.
30371 : size_t
30372 0 : SgCommonBlockObject::memoryUsage()
30373 : {
30374 : // This function is required because we need the class name as a type when we call sizeof
30375 : // There might be another way to implement this if we have a traversal that only called a
30376 : // representative object (one call for each type of Sage IIIIR node).
30377 0 : size_t memory = numberOfNodes() * sizeof(SgCommonBlockObject);
30378 :
30379 0 : return memory;
30380 : }
30381 :
30382 : /* #line 30383 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
30383 :
30384 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
30385 : void
30386 5381 : SgInitializedName::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
30387 : {
30388 : // This function traverses the memory pool for only a specific IR node
30389 : // and calls the visit function of the input class execute a traversal
30390 : // similar to the style of the attribute based traversals within ROSE.
30391 : // This traversal will visit ALL nodes of the AST where as the other
30392 : // attribute based traversals visit only the embedded tree within the AST.
30393 :
30394 : // Initialize array to the address of the first element of the STL vector
30395 : // (which is guaranteed to be contiguous storage).
30396 : // SgInitializedName objectArray [] = *(Memory_Block_List.begin());
30397 5381 : if (SgInitializedName::pools.empty() == false)
30398 : {
30399 : // Generate an array of memory pools
30400 5146 : SgInitializedName** objectArray = (SgInitializedName**) &(SgInitializedName::pools[0]);
30401 :
30402 : // Build a local variable for better performance
30403 5146 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
30404 : #if 0
30405 : // Iterate over the memory pools
30406 : for (unsigned int i=0; i < SgInitializedName::pools.size(); i++)
30407 : {
30408 : // objectArray[i] is a single memory pool
30409 : for (int j=0; j < SgInitializedName::pool_size; j++)
30410 : {
30411 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
30412 : {
30413 : traversal.visit(&(objectArray[i][j]));
30414 : }
30415 : }
30416 : }
30417 : #else
30418 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
30419 : // compute the list first and then call the visit function on each list element.
30420 :
30421 : // printf ("Inside of SgInitializedName::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
30422 :
30423 10292 : std::vector<SgInitializedName*> nodeList;
30424 :
30425 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
30426 54673 : for (unsigned int i=0; i < SgInitializedName::pools.size(); i++)
30427 : {
30428 : // objectArray[i] is a single memory pool
30429 99103500 : for (unsigned j=0; j < SgInitializedName::pool_size; j++)
30430 : {
30431 99054000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
30432 : {
30433 94238400 : nodeList.push_back(&(objectArray[i][j]));
30434 : }
30435 : }
30436 : }
30437 :
30438 : // Iterate over the saved list
30439 5146 : size_t nodeListSize = nodeList.size();
30440 94243600 : for (size_t i=0; i < nodeListSize; i++)
30441 : {
30442 94238400 : ROSE_ASSERT(nodeList[i] != NULL);
30443 : #if 0
30444 : traversal.visit(nodeList[i]);
30445 : #else
30446 94238400 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
30447 : {
30448 94238400 : traversal.visit(nodeList[i]);
30449 : }
30450 : #endif
30451 : }
30452 : #endif
30453 : }
30454 :
30455 : // This should not be required since all previously static data members are
30456 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
30457 :
30458 5381 : }
30459 :
30460 :
30461 : void
30462 194 : SgInitializedName::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
30463 : {
30464 : // This function traverses the memory pool for an IR node and
30465 : // calls the function to execute the visitor object.
30466 :
30467 : // Initialize array to the address of the first element of the STL vector
30468 : // (which is guarenteed to be contiguous storage).
30469 : // SgInitializedName objectArray [] = *(Memory_Block_List.begin());
30470 194 : if (SgInitializedName::pools.empty() == false)
30471 : {
30472 : // Generate an array of memory pools
30473 194 : SgInitializedName** objectArray = (SgInitializedName**) &(SgInitializedName::pools[0]);
30474 :
30475 : // Build a local variable for better performance
30476 194 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
30477 :
30478 : // Iterate over the memory pools
30479 3368 : for (unsigned int i=0; i < SgInitializedName::pools.size(); i++)
30480 : {
30481 : // objectArray[i] is a single memory pool
30482 6351170 : for (unsigned j=0; j < SgInitializedName::pool_size; j++)
30483 : {
30484 6348000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
30485 : {
30486 : // printf ("Found a valid SgInitializedName object in the memory pool %d at position %d \n",i,j);
30487 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
30488 6131590 : objectArray[i][j].executeVisitorMemberFunction(visitor);
30489 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
30490 : }
30491 : else
30492 : {
30493 : // printf ("Found a INVALID SgInitializedName object in the memory pool \n");
30494 : }
30495 : }
30496 : }
30497 : }
30498 :
30499 : // This should not be required since all previously static data members are
30500 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
30501 :
30502 194 : }
30503 :
30504 : void
30505 0 : SgInitializedName::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
30506 : {
30507 : // This function visits only a single IR node of the memory pool.
30508 : // it is typically called once for each type of IR node within
30509 : // the automatically generated function: traverseRepresentativeNodes().
30510 :
30511 : // Initialize array to the address of the first element of the STL vector
30512 : // (which is guarenteed to be contiguous storage).
30513 : // SgInitializedName objectArray [] = *(Memory_Block_List.begin());
30514 0 : if (SgInitializedName::pools.empty() == false)
30515 : {
30516 : // Generate an array of memory pools
30517 0 : SgInitializedName** objectArray = (SgInitializedName**) &(SgInitializedName::pools[0]);
30518 :
30519 : // Build a local variable for better performance
30520 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
30521 :
30522 : // Iterate over the memory pools
30523 0 : bool done = false;
30524 0 : unsigned i=0;
30525 :
30526 : // find the first valid IR node, call visit function, and then leave
30527 0 : while ( done == false && i < SgInitializedName::pools.size() )
30528 : {
30529 : // objectArray[i] is a single memory pool
30530 : unsigned j=0;
30531 0 : while (done == false && j < SgInitializedName::pool_size)
30532 : {
30533 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
30534 : {
30535 0 : traversal.visit(&(objectArray[i][j]));
30536 0 : done = true;
30537 : }
30538 0 : j++;
30539 : }
30540 0 : i++;
30541 : }
30542 :
30543 : #if 0
30544 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
30545 : if (done == false)
30546 : {
30547 : printf ("No representative for SgInitializedName found in memory pools \n");
30548 : }
30549 : #endif
30550 : }
30551 0 : }
30552 :
30553 :
30554 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
30555 : // using values that overflow signed values of int.
30556 : size_t
30557 4 : SgInitializedName::numberOfNodes()
30558 : {
30559 : // This function traverses the memory pool for an IR node and
30560 : // counts the number of IR nodes of a particular Sage III IR
30561 : // nodes type.
30562 :
30563 4 : size_t count = 0;
30564 4 : if (SgInitializedName::pools.empty() == false)
30565 : {
30566 : // Generate an array of memory pools (this is actually a STL vector,
30567 : // but it is contiguious, so OK to treat this way).
30568 3 : SgInitializedName** objectArray = (SgInitializedName**) &(SgInitializedName::pools[0]);
30569 :
30570 : // Build a local variable for better performance (make it a loop invariant variable).
30571 3 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
30572 :
30573 : // Iterate over all of the memory pools for this IR node.
30574 33 : for (unsigned int i=0; i < SgInitializedName::pools.size(); i++)
30575 : {
30576 : // objectArray[i] is a single memory pool, iterate over all the
30577 : // IR nodes and only count those that are valid IR nodes used in
30578 : // the AST (i.e. allocated IR nodes).
30579 60030 : for (unsigned j=0; j < SgInitializedName::pool_size; j++)
30580 : {
30581 : // This is indexing the STL vector of C/C++ style arrays as a doubly
30582 : // indexed array access. It is OK since we have leveraged the semantics
30583 : // of STL vector memory as contigous and cast the memory as an array
30584 : // of arrays to use the 2D array indexing. Hope this is not confusing,
30585 : // but it s very fast as an implementation.
30586 60000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
30587 : {
30588 55229 : count++;
30589 : }
30590 : }
30591 : }
30592 : }
30593 :
30594 :
30595 :
30596 4 : return count;
30597 : }
30598 :
30599 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
30600 : // using values that overflow signed values of int.
30601 : size_t
30602 0 : SgInitializedName::memoryUsage()
30603 : {
30604 : // This function is required because we need the class name as a type when we call sizeof
30605 : // There might be another way to implement this if we have a traversal that only called a
30606 : // representative object (one call for each type of Sage IIIIR node).
30607 0 : size_t memory = numberOfNodes() * sizeof(SgInitializedName);
30608 :
30609 0 : return memory;
30610 : }
30611 :
30612 : /* #line 30613 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
30613 :
30614 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
30615 : void
30616 5342 : SgInterfaceBody::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
30617 : {
30618 : // This function traverses the memory pool for only a specific IR node
30619 : // and calls the visit function of the input class execute a traversal
30620 : // similar to the style of the attribute based traversals within ROSE.
30621 : // This traversal will visit ALL nodes of the AST where as the other
30622 : // attribute based traversals visit only the embedded tree within the AST.
30623 :
30624 : // Initialize array to the address of the first element of the STL vector
30625 : // (which is guaranteed to be contiguous storage).
30626 : // SgInterfaceBody objectArray [] = *(Memory_Block_List.begin());
30627 5342 : if (SgInterfaceBody::pools.empty() == false)
30628 : {
30629 : // Generate an array of memory pools
30630 0 : SgInterfaceBody** objectArray = (SgInterfaceBody**) &(SgInterfaceBody::pools[0]);
30631 :
30632 : // Build a local variable for better performance
30633 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
30634 : #if 0
30635 : // Iterate over the memory pools
30636 : for (unsigned int i=0; i < SgInterfaceBody::pools.size(); i++)
30637 : {
30638 : // objectArray[i] is a single memory pool
30639 : for (int j=0; j < SgInterfaceBody::pool_size; j++)
30640 : {
30641 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
30642 : {
30643 : traversal.visit(&(objectArray[i][j]));
30644 : }
30645 : }
30646 : }
30647 : #else
30648 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
30649 : // compute the list first and then call the visit function on each list element.
30650 :
30651 : // printf ("Inside of SgInterfaceBody::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
30652 :
30653 0 : std::vector<SgInterfaceBody*> nodeList;
30654 :
30655 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
30656 0 : for (unsigned int i=0; i < SgInterfaceBody::pools.size(); i++)
30657 : {
30658 : // objectArray[i] is a single memory pool
30659 0 : for (unsigned j=0; j < SgInterfaceBody::pool_size; j++)
30660 : {
30661 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
30662 : {
30663 0 : nodeList.push_back(&(objectArray[i][j]));
30664 : }
30665 : }
30666 : }
30667 :
30668 : // Iterate over the saved list
30669 0 : size_t nodeListSize = nodeList.size();
30670 0 : for (size_t i=0; i < nodeListSize; i++)
30671 : {
30672 0 : ROSE_ASSERT(nodeList[i] != NULL);
30673 : #if 0
30674 : traversal.visit(nodeList[i]);
30675 : #else
30676 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
30677 : {
30678 0 : traversal.visit(nodeList[i]);
30679 : }
30680 : #endif
30681 : }
30682 : #endif
30683 : }
30684 :
30685 : // This should not be required since all previously static data members are
30686 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
30687 :
30688 5342 : }
30689 :
30690 :
30691 : void
30692 194 : SgInterfaceBody::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
30693 : {
30694 : // This function traverses the memory pool for an IR node and
30695 : // calls the function to execute the visitor object.
30696 :
30697 : // Initialize array to the address of the first element of the STL vector
30698 : // (which is guarenteed to be contiguous storage).
30699 : // SgInterfaceBody objectArray [] = *(Memory_Block_List.begin());
30700 194 : if (SgInterfaceBody::pools.empty() == false)
30701 : {
30702 : // Generate an array of memory pools
30703 0 : SgInterfaceBody** objectArray = (SgInterfaceBody**) &(SgInterfaceBody::pools[0]);
30704 :
30705 : // Build a local variable for better performance
30706 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
30707 :
30708 : // Iterate over the memory pools
30709 0 : for (unsigned int i=0; i < SgInterfaceBody::pools.size(); i++)
30710 : {
30711 : // objectArray[i] is a single memory pool
30712 0 : for (unsigned j=0; j < SgInterfaceBody::pool_size; j++)
30713 : {
30714 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
30715 : {
30716 : // printf ("Found a valid SgInterfaceBody object in the memory pool %d at position %d \n",i,j);
30717 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
30718 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
30719 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
30720 : }
30721 : else
30722 : {
30723 : // printf ("Found a INVALID SgInterfaceBody object in the memory pool \n");
30724 : }
30725 : }
30726 : }
30727 : }
30728 :
30729 : // This should not be required since all previously static data members are
30730 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
30731 :
30732 194 : }
30733 :
30734 : void
30735 0 : SgInterfaceBody::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
30736 : {
30737 : // This function visits only a single IR node of the memory pool.
30738 : // it is typically called once for each type of IR node within
30739 : // the automatically generated function: traverseRepresentativeNodes().
30740 :
30741 : // Initialize array to the address of the first element of the STL vector
30742 : // (which is guarenteed to be contiguous storage).
30743 : // SgInterfaceBody objectArray [] = *(Memory_Block_List.begin());
30744 0 : if (SgInterfaceBody::pools.empty() == false)
30745 : {
30746 : // Generate an array of memory pools
30747 0 : SgInterfaceBody** objectArray = (SgInterfaceBody**) &(SgInterfaceBody::pools[0]);
30748 :
30749 : // Build a local variable for better performance
30750 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
30751 :
30752 : // Iterate over the memory pools
30753 0 : bool done = false;
30754 0 : unsigned i=0;
30755 :
30756 : // find the first valid IR node, call visit function, and then leave
30757 0 : while ( done == false && i < SgInterfaceBody::pools.size() )
30758 : {
30759 : // objectArray[i] is a single memory pool
30760 : unsigned j=0;
30761 0 : while (done == false && j < SgInterfaceBody::pool_size)
30762 : {
30763 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
30764 : {
30765 0 : traversal.visit(&(objectArray[i][j]));
30766 0 : done = true;
30767 : }
30768 0 : j++;
30769 : }
30770 0 : i++;
30771 : }
30772 :
30773 : #if 0
30774 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
30775 : if (done == false)
30776 : {
30777 : printf ("No representative for SgInterfaceBody found in memory pools \n");
30778 : }
30779 : #endif
30780 : }
30781 0 : }
30782 :
30783 :
30784 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
30785 : // using values that overflow signed values of int.
30786 : size_t
30787 4 : SgInterfaceBody::numberOfNodes()
30788 : {
30789 : // This function traverses the memory pool for an IR node and
30790 : // counts the number of IR nodes of a particular Sage III IR
30791 : // nodes type.
30792 :
30793 4 : size_t count = 0;
30794 4 : if (SgInterfaceBody::pools.empty() == false)
30795 : {
30796 : // Generate an array of memory pools (this is actually a STL vector,
30797 : // but it is contiguious, so OK to treat this way).
30798 0 : SgInterfaceBody** objectArray = (SgInterfaceBody**) &(SgInterfaceBody::pools[0]);
30799 :
30800 : // Build a local variable for better performance (make it a loop invariant variable).
30801 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
30802 :
30803 : // Iterate over all of the memory pools for this IR node.
30804 0 : for (unsigned int i=0; i < SgInterfaceBody::pools.size(); i++)
30805 : {
30806 : // objectArray[i] is a single memory pool, iterate over all the
30807 : // IR nodes and only count those that are valid IR nodes used in
30808 : // the AST (i.e. allocated IR nodes).
30809 0 : for (unsigned j=0; j < SgInterfaceBody::pool_size; j++)
30810 : {
30811 : // This is indexing the STL vector of C/C++ style arrays as a doubly
30812 : // indexed array access. It is OK since we have leveraged the semantics
30813 : // of STL vector memory as contigous and cast the memory as an array
30814 : // of arrays to use the 2D array indexing. Hope this is not confusing,
30815 : // but it s very fast as an implementation.
30816 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
30817 : {
30818 0 : count++;
30819 : }
30820 : }
30821 : }
30822 : }
30823 :
30824 :
30825 :
30826 4 : return count;
30827 : }
30828 :
30829 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
30830 : // using values that overflow signed values of int.
30831 : size_t
30832 0 : SgInterfaceBody::memoryUsage()
30833 : {
30834 : // This function is required because we need the class name as a type when we call sizeof
30835 : // There might be another way to implement this if we have a traversal that only called a
30836 : // representative object (one call for each type of Sage IIIIR node).
30837 0 : size_t memory = numberOfNodes() * sizeof(SgInterfaceBody);
30838 :
30839 0 : return memory;
30840 : }
30841 :
30842 : /* #line 30843 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
30843 :
30844 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
30845 : void
30846 5342 : SgHeaderFileBody::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
30847 : {
30848 : // This function traverses the memory pool for only a specific IR node
30849 : // and calls the visit function of the input class execute a traversal
30850 : // similar to the style of the attribute based traversals within ROSE.
30851 : // This traversal will visit ALL nodes of the AST where as the other
30852 : // attribute based traversals visit only the embedded tree within the AST.
30853 :
30854 : // Initialize array to the address of the first element of the STL vector
30855 : // (which is guaranteed to be contiguous storage).
30856 : // SgHeaderFileBody objectArray [] = *(Memory_Block_List.begin());
30857 5342 : if (SgHeaderFileBody::pools.empty() == false)
30858 : {
30859 : // Generate an array of memory pools
30860 0 : SgHeaderFileBody** objectArray = (SgHeaderFileBody**) &(SgHeaderFileBody::pools[0]);
30861 :
30862 : // Build a local variable for better performance
30863 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
30864 : #if 0
30865 : // Iterate over the memory pools
30866 : for (unsigned int i=0; i < SgHeaderFileBody::pools.size(); i++)
30867 : {
30868 : // objectArray[i] is a single memory pool
30869 : for (int j=0; j < SgHeaderFileBody::pool_size; j++)
30870 : {
30871 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
30872 : {
30873 : traversal.visit(&(objectArray[i][j]));
30874 : }
30875 : }
30876 : }
30877 : #else
30878 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
30879 : // compute the list first and then call the visit function on each list element.
30880 :
30881 : // printf ("Inside of SgHeaderFileBody::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
30882 :
30883 0 : std::vector<SgHeaderFileBody*> nodeList;
30884 :
30885 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
30886 0 : for (unsigned int i=0; i < SgHeaderFileBody::pools.size(); i++)
30887 : {
30888 : // objectArray[i] is a single memory pool
30889 0 : for (unsigned j=0; j < SgHeaderFileBody::pool_size; j++)
30890 : {
30891 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
30892 : {
30893 0 : nodeList.push_back(&(objectArray[i][j]));
30894 : }
30895 : }
30896 : }
30897 :
30898 : // Iterate over the saved list
30899 0 : size_t nodeListSize = nodeList.size();
30900 0 : for (size_t i=0; i < nodeListSize; i++)
30901 : {
30902 0 : ROSE_ASSERT(nodeList[i] != NULL);
30903 : #if 0
30904 : traversal.visit(nodeList[i]);
30905 : #else
30906 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
30907 : {
30908 0 : traversal.visit(nodeList[i]);
30909 : }
30910 : #endif
30911 : }
30912 : #endif
30913 : }
30914 :
30915 : // This should not be required since all previously static data members are
30916 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
30917 :
30918 5342 : }
30919 :
30920 :
30921 : void
30922 194 : SgHeaderFileBody::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
30923 : {
30924 : // This function traverses the memory pool for an IR node and
30925 : // calls the function to execute the visitor object.
30926 :
30927 : // Initialize array to the address of the first element of the STL vector
30928 : // (which is guarenteed to be contiguous storage).
30929 : // SgHeaderFileBody objectArray [] = *(Memory_Block_List.begin());
30930 194 : if (SgHeaderFileBody::pools.empty() == false)
30931 : {
30932 : // Generate an array of memory pools
30933 0 : SgHeaderFileBody** objectArray = (SgHeaderFileBody**) &(SgHeaderFileBody::pools[0]);
30934 :
30935 : // Build a local variable for better performance
30936 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
30937 :
30938 : // Iterate over the memory pools
30939 0 : for (unsigned int i=0; i < SgHeaderFileBody::pools.size(); i++)
30940 : {
30941 : // objectArray[i] is a single memory pool
30942 0 : for (unsigned j=0; j < SgHeaderFileBody::pool_size; j++)
30943 : {
30944 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
30945 : {
30946 : // printf ("Found a valid SgHeaderFileBody object in the memory pool %d at position %d \n",i,j);
30947 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
30948 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
30949 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
30950 : }
30951 : else
30952 : {
30953 : // printf ("Found a INVALID SgHeaderFileBody object in the memory pool \n");
30954 : }
30955 : }
30956 : }
30957 : }
30958 :
30959 : // This should not be required since all previously static data members are
30960 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
30961 :
30962 194 : }
30963 :
30964 : void
30965 0 : SgHeaderFileBody::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
30966 : {
30967 : // This function visits only a single IR node of the memory pool.
30968 : // it is typically called once for each type of IR node within
30969 : // the automatically generated function: traverseRepresentativeNodes().
30970 :
30971 : // Initialize array to the address of the first element of the STL vector
30972 : // (which is guarenteed to be contiguous storage).
30973 : // SgHeaderFileBody objectArray [] = *(Memory_Block_List.begin());
30974 0 : if (SgHeaderFileBody::pools.empty() == false)
30975 : {
30976 : // Generate an array of memory pools
30977 0 : SgHeaderFileBody** objectArray = (SgHeaderFileBody**) &(SgHeaderFileBody::pools[0]);
30978 :
30979 : // Build a local variable for better performance
30980 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
30981 :
30982 : // Iterate over the memory pools
30983 0 : bool done = false;
30984 0 : unsigned i=0;
30985 :
30986 : // find the first valid IR node, call visit function, and then leave
30987 0 : while ( done == false && i < SgHeaderFileBody::pools.size() )
30988 : {
30989 : // objectArray[i] is a single memory pool
30990 : unsigned j=0;
30991 0 : while (done == false && j < SgHeaderFileBody::pool_size)
30992 : {
30993 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
30994 : {
30995 0 : traversal.visit(&(objectArray[i][j]));
30996 0 : done = true;
30997 : }
30998 0 : j++;
30999 : }
31000 0 : i++;
31001 : }
31002 :
31003 : #if 0
31004 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
31005 : if (done == false)
31006 : {
31007 : printf ("No representative for SgHeaderFileBody found in memory pools \n");
31008 : }
31009 : #endif
31010 : }
31011 0 : }
31012 :
31013 :
31014 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
31015 : // using values that overflow signed values of int.
31016 : size_t
31017 4 : SgHeaderFileBody::numberOfNodes()
31018 : {
31019 : // This function traverses the memory pool for an IR node and
31020 : // counts the number of IR nodes of a particular Sage III IR
31021 : // nodes type.
31022 :
31023 4 : size_t count = 0;
31024 4 : if (SgHeaderFileBody::pools.empty() == false)
31025 : {
31026 : // Generate an array of memory pools (this is actually a STL vector,
31027 : // but it is contiguious, so OK to treat this way).
31028 0 : SgHeaderFileBody** objectArray = (SgHeaderFileBody**) &(SgHeaderFileBody::pools[0]);
31029 :
31030 : // Build a local variable for better performance (make it a loop invariant variable).
31031 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
31032 :
31033 : // Iterate over all of the memory pools for this IR node.
31034 0 : for (unsigned int i=0; i < SgHeaderFileBody::pools.size(); i++)
31035 : {
31036 : // objectArray[i] is a single memory pool, iterate over all the
31037 : // IR nodes and only count those that are valid IR nodes used in
31038 : // the AST (i.e. allocated IR nodes).
31039 0 : for (unsigned j=0; j < SgHeaderFileBody::pool_size; j++)
31040 : {
31041 : // This is indexing the STL vector of C/C++ style arrays as a doubly
31042 : // indexed array access. It is OK since we have leveraged the semantics
31043 : // of STL vector memory as contigous and cast the memory as an array
31044 : // of arrays to use the 2D array indexing. Hope this is not confusing,
31045 : // but it s very fast as an implementation.
31046 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
31047 : {
31048 0 : count++;
31049 : }
31050 : }
31051 : }
31052 : }
31053 :
31054 :
31055 :
31056 4 : return count;
31057 : }
31058 :
31059 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
31060 : // using values that overflow signed values of int.
31061 : size_t
31062 0 : SgHeaderFileBody::memoryUsage()
31063 : {
31064 : // This function is required because we need the class name as a type when we call sizeof
31065 : // There might be another way to implement this if we have a traversal that only called a
31066 : // representative object (one call for each type of Sage IIIIR node).
31067 0 : size_t memory = numberOfNodes() * sizeof(SgHeaderFileBody);
31068 :
31069 0 : return memory;
31070 : }
31071 :
31072 : /* #line 31073 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
31073 :
31074 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
31075 : void
31076 5342 : SgRenamePair::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
31077 : {
31078 : // This function traverses the memory pool for only a specific IR node
31079 : // and calls the visit function of the input class execute a traversal
31080 : // similar to the style of the attribute based traversals within ROSE.
31081 : // This traversal will visit ALL nodes of the AST where as the other
31082 : // attribute based traversals visit only the embedded tree within the AST.
31083 :
31084 : // Initialize array to the address of the first element of the STL vector
31085 : // (which is guaranteed to be contiguous storage).
31086 : // SgRenamePair objectArray [] = *(Memory_Block_List.begin());
31087 5342 : if (SgRenamePair::pools.empty() == false)
31088 : {
31089 : // Generate an array of memory pools
31090 0 : SgRenamePair** objectArray = (SgRenamePair**) &(SgRenamePair::pools[0]);
31091 :
31092 : // Build a local variable for better performance
31093 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
31094 : #if 0
31095 : // Iterate over the memory pools
31096 : for (unsigned int i=0; i < SgRenamePair::pools.size(); i++)
31097 : {
31098 : // objectArray[i] is a single memory pool
31099 : for (int j=0; j < SgRenamePair::pool_size; j++)
31100 : {
31101 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
31102 : {
31103 : traversal.visit(&(objectArray[i][j]));
31104 : }
31105 : }
31106 : }
31107 : #else
31108 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
31109 : // compute the list first and then call the visit function on each list element.
31110 :
31111 : // printf ("Inside of SgRenamePair::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
31112 :
31113 0 : std::vector<SgRenamePair*> nodeList;
31114 :
31115 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
31116 0 : for (unsigned int i=0; i < SgRenamePair::pools.size(); i++)
31117 : {
31118 : // objectArray[i] is a single memory pool
31119 0 : for (unsigned j=0; j < SgRenamePair::pool_size; j++)
31120 : {
31121 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
31122 : {
31123 0 : nodeList.push_back(&(objectArray[i][j]));
31124 : }
31125 : }
31126 : }
31127 :
31128 : // Iterate over the saved list
31129 0 : size_t nodeListSize = nodeList.size();
31130 0 : for (size_t i=0; i < nodeListSize; i++)
31131 : {
31132 0 : ROSE_ASSERT(nodeList[i] != NULL);
31133 : #if 0
31134 : traversal.visit(nodeList[i]);
31135 : #else
31136 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
31137 : {
31138 0 : traversal.visit(nodeList[i]);
31139 : }
31140 : #endif
31141 : }
31142 : #endif
31143 : }
31144 :
31145 : // This should not be required since all previously static data members are
31146 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
31147 :
31148 5342 : }
31149 :
31150 :
31151 : void
31152 194 : SgRenamePair::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
31153 : {
31154 : // This function traverses the memory pool for an IR node and
31155 : // calls the function to execute the visitor object.
31156 :
31157 : // Initialize array to the address of the first element of the STL vector
31158 : // (which is guarenteed to be contiguous storage).
31159 : // SgRenamePair objectArray [] = *(Memory_Block_List.begin());
31160 194 : if (SgRenamePair::pools.empty() == false)
31161 : {
31162 : // Generate an array of memory pools
31163 0 : SgRenamePair** objectArray = (SgRenamePair**) &(SgRenamePair::pools[0]);
31164 :
31165 : // Build a local variable for better performance
31166 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
31167 :
31168 : // Iterate over the memory pools
31169 0 : for (unsigned int i=0; i < SgRenamePair::pools.size(); i++)
31170 : {
31171 : // objectArray[i] is a single memory pool
31172 0 : for (unsigned j=0; j < SgRenamePair::pool_size; j++)
31173 : {
31174 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
31175 : {
31176 : // printf ("Found a valid SgRenamePair object in the memory pool %d at position %d \n",i,j);
31177 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
31178 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
31179 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
31180 : }
31181 : else
31182 : {
31183 : // printf ("Found a INVALID SgRenamePair object in the memory pool \n");
31184 : }
31185 : }
31186 : }
31187 : }
31188 :
31189 : // This should not be required since all previously static data members are
31190 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
31191 :
31192 194 : }
31193 :
31194 : void
31195 0 : SgRenamePair::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
31196 : {
31197 : // This function visits only a single IR node of the memory pool.
31198 : // it is typically called once for each type of IR node within
31199 : // the automatically generated function: traverseRepresentativeNodes().
31200 :
31201 : // Initialize array to the address of the first element of the STL vector
31202 : // (which is guarenteed to be contiguous storage).
31203 : // SgRenamePair objectArray [] = *(Memory_Block_List.begin());
31204 0 : if (SgRenamePair::pools.empty() == false)
31205 : {
31206 : // Generate an array of memory pools
31207 0 : SgRenamePair** objectArray = (SgRenamePair**) &(SgRenamePair::pools[0]);
31208 :
31209 : // Build a local variable for better performance
31210 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
31211 :
31212 : // Iterate over the memory pools
31213 0 : bool done = false;
31214 0 : unsigned i=0;
31215 :
31216 : // find the first valid IR node, call visit function, and then leave
31217 0 : while ( done == false && i < SgRenamePair::pools.size() )
31218 : {
31219 : // objectArray[i] is a single memory pool
31220 : unsigned j=0;
31221 0 : while (done == false && j < SgRenamePair::pool_size)
31222 : {
31223 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
31224 : {
31225 0 : traversal.visit(&(objectArray[i][j]));
31226 0 : done = true;
31227 : }
31228 0 : j++;
31229 : }
31230 0 : i++;
31231 : }
31232 :
31233 : #if 0
31234 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
31235 : if (done == false)
31236 : {
31237 : printf ("No representative for SgRenamePair found in memory pools \n");
31238 : }
31239 : #endif
31240 : }
31241 0 : }
31242 :
31243 :
31244 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
31245 : // using values that overflow signed values of int.
31246 : size_t
31247 4 : SgRenamePair::numberOfNodes()
31248 : {
31249 : // This function traverses the memory pool for an IR node and
31250 : // counts the number of IR nodes of a particular Sage III IR
31251 : // nodes type.
31252 :
31253 4 : size_t count = 0;
31254 4 : if (SgRenamePair::pools.empty() == false)
31255 : {
31256 : // Generate an array of memory pools (this is actually a STL vector,
31257 : // but it is contiguious, so OK to treat this way).
31258 0 : SgRenamePair** objectArray = (SgRenamePair**) &(SgRenamePair::pools[0]);
31259 :
31260 : // Build a local variable for better performance (make it a loop invariant variable).
31261 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
31262 :
31263 : // Iterate over all of the memory pools for this IR node.
31264 0 : for (unsigned int i=0; i < SgRenamePair::pools.size(); i++)
31265 : {
31266 : // objectArray[i] is a single memory pool, iterate over all the
31267 : // IR nodes and only count those that are valid IR nodes used in
31268 : // the AST (i.e. allocated IR nodes).
31269 0 : for (unsigned j=0; j < SgRenamePair::pool_size; j++)
31270 : {
31271 : // This is indexing the STL vector of C/C++ style arrays as a doubly
31272 : // indexed array access. It is OK since we have leveraged the semantics
31273 : // of STL vector memory as contigous and cast the memory as an array
31274 : // of arrays to use the 2D array indexing. Hope this is not confusing,
31275 : // but it s very fast as an implementation.
31276 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
31277 : {
31278 0 : count++;
31279 : }
31280 : }
31281 : }
31282 : }
31283 :
31284 :
31285 :
31286 4 : return count;
31287 : }
31288 :
31289 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
31290 : // using values that overflow signed values of int.
31291 : size_t
31292 0 : SgRenamePair::memoryUsage()
31293 : {
31294 : // This function is required because we need the class name as a type when we call sizeof
31295 : // There might be another way to implement this if we have a traversal that only called a
31296 : // representative object (one call for each type of Sage IIIIR node).
31297 0 : size_t memory = numberOfNodes() * sizeof(SgRenamePair);
31298 :
31299 0 : return memory;
31300 : }
31301 :
31302 : /* #line 31303 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
31303 :
31304 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
31305 : void
31306 5342 : SgOmpClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
31307 : {
31308 : // This function traverses the memory pool for only a specific IR node
31309 : // and calls the visit function of the input class execute a traversal
31310 : // similar to the style of the attribute based traversals within ROSE.
31311 : // This traversal will visit ALL nodes of the AST where as the other
31312 : // attribute based traversals visit only the embedded tree within the AST.
31313 :
31314 : // Initialize array to the address of the first element of the STL vector
31315 : // (which is guaranteed to be contiguous storage).
31316 : // SgOmpClause objectArray [] = *(Memory_Block_List.begin());
31317 5342 : if (SgOmpClause::pools.empty() == false)
31318 : {
31319 : // Generate an array of memory pools
31320 0 : SgOmpClause** objectArray = (SgOmpClause**) &(SgOmpClause::pools[0]);
31321 :
31322 : // Build a local variable for better performance
31323 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
31324 : #if 0
31325 : // Iterate over the memory pools
31326 : for (unsigned int i=0; i < SgOmpClause::pools.size(); i++)
31327 : {
31328 : // objectArray[i] is a single memory pool
31329 : for (int j=0; j < SgOmpClause::pool_size; j++)
31330 : {
31331 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
31332 : {
31333 : traversal.visit(&(objectArray[i][j]));
31334 : }
31335 : }
31336 : }
31337 : #else
31338 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
31339 : // compute the list first and then call the visit function on each list element.
31340 :
31341 : // printf ("Inside of SgOmpClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
31342 :
31343 0 : std::vector<SgOmpClause*> nodeList;
31344 :
31345 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
31346 0 : for (unsigned int i=0; i < SgOmpClause::pools.size(); i++)
31347 : {
31348 : // objectArray[i] is a single memory pool
31349 0 : for (unsigned j=0; j < SgOmpClause::pool_size; j++)
31350 : {
31351 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
31352 : {
31353 0 : nodeList.push_back(&(objectArray[i][j]));
31354 : }
31355 : }
31356 : }
31357 :
31358 : // Iterate over the saved list
31359 0 : size_t nodeListSize = nodeList.size();
31360 0 : for (size_t i=0; i < nodeListSize; i++)
31361 : {
31362 0 : ROSE_ASSERT(nodeList[i] != NULL);
31363 : #if 0
31364 : traversal.visit(nodeList[i]);
31365 : #else
31366 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
31367 : {
31368 0 : traversal.visit(nodeList[i]);
31369 : }
31370 : #endif
31371 : }
31372 : #endif
31373 : }
31374 :
31375 : // This should not be required since all previously static data members are
31376 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
31377 :
31378 5342 : }
31379 :
31380 :
31381 : void
31382 194 : SgOmpClause::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
31383 : {
31384 : // This function traverses the memory pool for an IR node and
31385 : // calls the function to execute the visitor object.
31386 :
31387 : // Initialize array to the address of the first element of the STL vector
31388 : // (which is guarenteed to be contiguous storage).
31389 : // SgOmpClause objectArray [] = *(Memory_Block_List.begin());
31390 194 : if (SgOmpClause::pools.empty() == false)
31391 : {
31392 : // Generate an array of memory pools
31393 0 : SgOmpClause** objectArray = (SgOmpClause**) &(SgOmpClause::pools[0]);
31394 :
31395 : // Build a local variable for better performance
31396 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
31397 :
31398 : // Iterate over the memory pools
31399 0 : for (unsigned int i=0; i < SgOmpClause::pools.size(); i++)
31400 : {
31401 : // objectArray[i] is a single memory pool
31402 0 : for (unsigned j=0; j < SgOmpClause::pool_size; j++)
31403 : {
31404 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
31405 : {
31406 : // printf ("Found a valid SgOmpClause object in the memory pool %d at position %d \n",i,j);
31407 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
31408 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
31409 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
31410 : }
31411 : else
31412 : {
31413 : // printf ("Found a INVALID SgOmpClause object in the memory pool \n");
31414 : }
31415 : }
31416 : }
31417 : }
31418 :
31419 : // This should not be required since all previously static data members are
31420 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
31421 :
31422 194 : }
31423 :
31424 : void
31425 0 : SgOmpClause::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
31426 : {
31427 : // This function visits only a single IR node of the memory pool.
31428 : // it is typically called once for each type of IR node within
31429 : // the automatically generated function: traverseRepresentativeNodes().
31430 :
31431 : // Initialize array to the address of the first element of the STL vector
31432 : // (which is guarenteed to be contiguous storage).
31433 : // SgOmpClause objectArray [] = *(Memory_Block_List.begin());
31434 0 : if (SgOmpClause::pools.empty() == false)
31435 : {
31436 : // Generate an array of memory pools
31437 0 : SgOmpClause** objectArray = (SgOmpClause**) &(SgOmpClause::pools[0]);
31438 :
31439 : // Build a local variable for better performance
31440 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
31441 :
31442 : // Iterate over the memory pools
31443 0 : bool done = false;
31444 0 : unsigned i=0;
31445 :
31446 : // find the first valid IR node, call visit function, and then leave
31447 0 : while ( done == false && i < SgOmpClause::pools.size() )
31448 : {
31449 : // objectArray[i] is a single memory pool
31450 : unsigned j=0;
31451 0 : while (done == false && j < SgOmpClause::pool_size)
31452 : {
31453 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
31454 : {
31455 0 : traversal.visit(&(objectArray[i][j]));
31456 0 : done = true;
31457 : }
31458 0 : j++;
31459 : }
31460 0 : i++;
31461 : }
31462 :
31463 : #if 0
31464 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
31465 : if (done == false)
31466 : {
31467 : printf ("No representative for SgOmpClause found in memory pools \n");
31468 : }
31469 : #endif
31470 : }
31471 0 : }
31472 :
31473 :
31474 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
31475 : // using values that overflow signed values of int.
31476 : size_t
31477 4 : SgOmpClause::numberOfNodes()
31478 : {
31479 : // This function traverses the memory pool for an IR node and
31480 : // counts the number of IR nodes of a particular Sage III IR
31481 : // nodes type.
31482 :
31483 4 : size_t count = 0;
31484 4 : if (SgOmpClause::pools.empty() == false)
31485 : {
31486 : // Generate an array of memory pools (this is actually a STL vector,
31487 : // but it is contiguious, so OK to treat this way).
31488 0 : SgOmpClause** objectArray = (SgOmpClause**) &(SgOmpClause::pools[0]);
31489 :
31490 : // Build a local variable for better performance (make it a loop invariant variable).
31491 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
31492 :
31493 : // Iterate over all of the memory pools for this IR node.
31494 0 : for (unsigned int i=0; i < SgOmpClause::pools.size(); i++)
31495 : {
31496 : // objectArray[i] is a single memory pool, iterate over all the
31497 : // IR nodes and only count those that are valid IR nodes used in
31498 : // the AST (i.e. allocated IR nodes).
31499 0 : for (unsigned j=0; j < SgOmpClause::pool_size; j++)
31500 : {
31501 : // This is indexing the STL vector of C/C++ style arrays as a doubly
31502 : // indexed array access. It is OK since we have leveraged the semantics
31503 : // of STL vector memory as contigous and cast the memory as an array
31504 : // of arrays to use the 2D array indexing. Hope this is not confusing,
31505 : // but it s very fast as an implementation.
31506 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
31507 : {
31508 0 : count++;
31509 : }
31510 : }
31511 : }
31512 : }
31513 :
31514 :
31515 :
31516 4 : return count;
31517 : }
31518 :
31519 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
31520 : // using values that overflow signed values of int.
31521 : size_t
31522 0 : SgOmpClause::memoryUsage()
31523 : {
31524 : // This function is required because we need the class name as a type when we call sizeof
31525 : // There might be another way to implement this if we have a traversal that only called a
31526 : // representative object (one call for each type of Sage IIIIR node).
31527 0 : size_t memory = numberOfNodes() * sizeof(SgOmpClause);
31528 :
31529 0 : return memory;
31530 : }
31531 :
31532 : /* #line 31533 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
31533 :
31534 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
31535 : void
31536 5342 : SgOmpNowaitClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
31537 : {
31538 : // This function traverses the memory pool for only a specific IR node
31539 : // and calls the visit function of the input class execute a traversal
31540 : // similar to the style of the attribute based traversals within ROSE.
31541 : // This traversal will visit ALL nodes of the AST where as the other
31542 : // attribute based traversals visit only the embedded tree within the AST.
31543 :
31544 : // Initialize array to the address of the first element of the STL vector
31545 : // (which is guaranteed to be contiguous storage).
31546 : // SgOmpNowaitClause objectArray [] = *(Memory_Block_List.begin());
31547 5342 : if (SgOmpNowaitClause::pools.empty() == false)
31548 : {
31549 : // Generate an array of memory pools
31550 161 : SgOmpNowaitClause** objectArray = (SgOmpNowaitClause**) &(SgOmpNowaitClause::pools[0]);
31551 :
31552 : // Build a local variable for better performance
31553 161 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
31554 : #if 0
31555 : // Iterate over the memory pools
31556 : for (unsigned int i=0; i < SgOmpNowaitClause::pools.size(); i++)
31557 : {
31558 : // objectArray[i] is a single memory pool
31559 : for (int j=0; j < SgOmpNowaitClause::pool_size; j++)
31560 : {
31561 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
31562 : {
31563 : traversal.visit(&(objectArray[i][j]));
31564 : }
31565 : }
31566 : }
31567 : #else
31568 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
31569 : // compute the list first and then call the visit function on each list element.
31570 :
31571 : // printf ("Inside of SgOmpNowaitClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
31572 :
31573 322 : std::vector<SgOmpNowaitClause*> nodeList;
31574 :
31575 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
31576 322 : for (unsigned int i=0; i < SgOmpNowaitClause::pools.size(); i++)
31577 : {
31578 : // objectArray[i] is a single memory pool
31579 322161 : for (unsigned j=0; j < SgOmpNowaitClause::pool_size; j++)
31580 : {
31581 322000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
31582 : {
31583 175 : nodeList.push_back(&(objectArray[i][j]));
31584 : }
31585 : }
31586 : }
31587 :
31588 : // Iterate over the saved list
31589 161 : size_t nodeListSize = nodeList.size();
31590 336 : for (size_t i=0; i < nodeListSize; i++)
31591 : {
31592 175 : ROSE_ASSERT(nodeList[i] != NULL);
31593 : #if 0
31594 : traversal.visit(nodeList[i]);
31595 : #else
31596 175 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
31597 : {
31598 175 : traversal.visit(nodeList[i]);
31599 : }
31600 : #endif
31601 : }
31602 : #endif
31603 : }
31604 :
31605 : // This should not be required since all previously static data members are
31606 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
31607 :
31608 5342 : }
31609 :
31610 :
31611 : void
31612 194 : SgOmpNowaitClause::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
31613 : {
31614 : // This function traverses the memory pool for an IR node and
31615 : // calls the function to execute the visitor object.
31616 :
31617 : // Initialize array to the address of the first element of the STL vector
31618 : // (which is guarenteed to be contiguous storage).
31619 : // SgOmpNowaitClause objectArray [] = *(Memory_Block_List.begin());
31620 194 : if (SgOmpNowaitClause::pools.empty() == false)
31621 : {
31622 : // Generate an array of memory pools
31623 0 : SgOmpNowaitClause** objectArray = (SgOmpNowaitClause**) &(SgOmpNowaitClause::pools[0]);
31624 :
31625 : // Build a local variable for better performance
31626 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
31627 :
31628 : // Iterate over the memory pools
31629 0 : for (unsigned int i=0; i < SgOmpNowaitClause::pools.size(); i++)
31630 : {
31631 : // objectArray[i] is a single memory pool
31632 0 : for (unsigned j=0; j < SgOmpNowaitClause::pool_size; j++)
31633 : {
31634 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
31635 : {
31636 : // printf ("Found a valid SgOmpNowaitClause object in the memory pool %d at position %d \n",i,j);
31637 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
31638 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
31639 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
31640 : }
31641 : else
31642 : {
31643 : // printf ("Found a INVALID SgOmpNowaitClause object in the memory pool \n");
31644 : }
31645 : }
31646 : }
31647 : }
31648 :
31649 : // This should not be required since all previously static data members are
31650 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
31651 :
31652 194 : }
31653 :
31654 : void
31655 0 : SgOmpNowaitClause::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
31656 : {
31657 : // This function visits only a single IR node of the memory pool.
31658 : // it is typically called once for each type of IR node within
31659 : // the automatically generated function: traverseRepresentativeNodes().
31660 :
31661 : // Initialize array to the address of the first element of the STL vector
31662 : // (which is guarenteed to be contiguous storage).
31663 : // SgOmpNowaitClause objectArray [] = *(Memory_Block_List.begin());
31664 0 : if (SgOmpNowaitClause::pools.empty() == false)
31665 : {
31666 : // Generate an array of memory pools
31667 0 : SgOmpNowaitClause** objectArray = (SgOmpNowaitClause**) &(SgOmpNowaitClause::pools[0]);
31668 :
31669 : // Build a local variable for better performance
31670 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
31671 :
31672 : // Iterate over the memory pools
31673 0 : bool done = false;
31674 0 : unsigned i=0;
31675 :
31676 : // find the first valid IR node, call visit function, and then leave
31677 0 : while ( done == false && i < SgOmpNowaitClause::pools.size() )
31678 : {
31679 : // objectArray[i] is a single memory pool
31680 : unsigned j=0;
31681 0 : while (done == false && j < SgOmpNowaitClause::pool_size)
31682 : {
31683 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
31684 : {
31685 0 : traversal.visit(&(objectArray[i][j]));
31686 0 : done = true;
31687 : }
31688 0 : j++;
31689 : }
31690 0 : i++;
31691 : }
31692 :
31693 : #if 0
31694 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
31695 : if (done == false)
31696 : {
31697 : printf ("No representative for SgOmpNowaitClause found in memory pools \n");
31698 : }
31699 : #endif
31700 : }
31701 0 : }
31702 :
31703 :
31704 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
31705 : // using values that overflow signed values of int.
31706 : size_t
31707 4 : SgOmpNowaitClause::numberOfNodes()
31708 : {
31709 : // This function traverses the memory pool for an IR node and
31710 : // counts the number of IR nodes of a particular Sage III IR
31711 : // nodes type.
31712 :
31713 4 : size_t count = 0;
31714 4 : if (SgOmpNowaitClause::pools.empty() == false)
31715 : {
31716 : // Generate an array of memory pools (this is actually a STL vector,
31717 : // but it is contiguious, so OK to treat this way).
31718 0 : SgOmpNowaitClause** objectArray = (SgOmpNowaitClause**) &(SgOmpNowaitClause::pools[0]);
31719 :
31720 : // Build a local variable for better performance (make it a loop invariant variable).
31721 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
31722 :
31723 : // Iterate over all of the memory pools for this IR node.
31724 0 : for (unsigned int i=0; i < SgOmpNowaitClause::pools.size(); i++)
31725 : {
31726 : // objectArray[i] is a single memory pool, iterate over all the
31727 : // IR nodes and only count those that are valid IR nodes used in
31728 : // the AST (i.e. allocated IR nodes).
31729 0 : for (unsigned j=0; j < SgOmpNowaitClause::pool_size; j++)
31730 : {
31731 : // This is indexing the STL vector of C/C++ style arrays as a doubly
31732 : // indexed array access. It is OK since we have leveraged the semantics
31733 : // of STL vector memory as contigous and cast the memory as an array
31734 : // of arrays to use the 2D array indexing. Hope this is not confusing,
31735 : // but it s very fast as an implementation.
31736 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
31737 : {
31738 0 : count++;
31739 : }
31740 : }
31741 : }
31742 : }
31743 :
31744 :
31745 :
31746 4 : return count;
31747 : }
31748 :
31749 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
31750 : // using values that overflow signed values of int.
31751 : size_t
31752 0 : SgOmpNowaitClause::memoryUsage()
31753 : {
31754 : // This function is required because we need the class name as a type when we call sizeof
31755 : // There might be another way to implement this if we have a traversal that only called a
31756 : // representative object (one call for each type of Sage IIIIR node).
31757 0 : size_t memory = numberOfNodes() * sizeof(SgOmpNowaitClause);
31758 :
31759 0 : return memory;
31760 : }
31761 :
31762 : /* #line 31763 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
31763 :
31764 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
31765 : void
31766 5342 : SgOmpReadClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
31767 : {
31768 : // This function traverses the memory pool for only a specific IR node
31769 : // and calls the visit function of the input class execute a traversal
31770 : // similar to the style of the attribute based traversals within ROSE.
31771 : // This traversal will visit ALL nodes of the AST where as the other
31772 : // attribute based traversals visit only the embedded tree within the AST.
31773 :
31774 : // Initialize array to the address of the first element of the STL vector
31775 : // (which is guaranteed to be contiguous storage).
31776 : // SgOmpReadClause objectArray [] = *(Memory_Block_List.begin());
31777 5342 : if (SgOmpReadClause::pools.empty() == false)
31778 : {
31779 : // Generate an array of memory pools
31780 14 : SgOmpReadClause** objectArray = (SgOmpReadClause**) &(SgOmpReadClause::pools[0]);
31781 :
31782 : // Build a local variable for better performance
31783 14 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
31784 : #if 0
31785 : // Iterate over the memory pools
31786 : for (unsigned int i=0; i < SgOmpReadClause::pools.size(); i++)
31787 : {
31788 : // objectArray[i] is a single memory pool
31789 : for (int j=0; j < SgOmpReadClause::pool_size; j++)
31790 : {
31791 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
31792 : {
31793 : traversal.visit(&(objectArray[i][j]));
31794 : }
31795 : }
31796 : }
31797 : #else
31798 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
31799 : // compute the list first and then call the visit function on each list element.
31800 :
31801 : // printf ("Inside of SgOmpReadClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
31802 :
31803 28 : std::vector<SgOmpReadClause*> nodeList;
31804 :
31805 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
31806 28 : for (unsigned int i=0; i < SgOmpReadClause::pools.size(); i++)
31807 : {
31808 : // objectArray[i] is a single memory pool
31809 28014 : for (unsigned j=0; j < SgOmpReadClause::pool_size; j++)
31810 : {
31811 28000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
31812 : {
31813 14 : nodeList.push_back(&(objectArray[i][j]));
31814 : }
31815 : }
31816 : }
31817 :
31818 : // Iterate over the saved list
31819 14 : size_t nodeListSize = nodeList.size();
31820 28 : for (size_t i=0; i < nodeListSize; i++)
31821 : {
31822 14 : ROSE_ASSERT(nodeList[i] != NULL);
31823 : #if 0
31824 : traversal.visit(nodeList[i]);
31825 : #else
31826 14 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
31827 : {
31828 14 : traversal.visit(nodeList[i]);
31829 : }
31830 : #endif
31831 : }
31832 : #endif
31833 : }
31834 :
31835 : // This should not be required since all previously static data members are
31836 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
31837 :
31838 5342 : }
31839 :
31840 :
31841 : void
31842 194 : SgOmpReadClause::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
31843 : {
31844 : // This function traverses the memory pool for an IR node and
31845 : // calls the function to execute the visitor object.
31846 :
31847 : // Initialize array to the address of the first element of the STL vector
31848 : // (which is guarenteed to be contiguous storage).
31849 : // SgOmpReadClause objectArray [] = *(Memory_Block_List.begin());
31850 194 : if (SgOmpReadClause::pools.empty() == false)
31851 : {
31852 : // Generate an array of memory pools
31853 0 : SgOmpReadClause** objectArray = (SgOmpReadClause**) &(SgOmpReadClause::pools[0]);
31854 :
31855 : // Build a local variable for better performance
31856 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
31857 :
31858 : // Iterate over the memory pools
31859 0 : for (unsigned int i=0; i < SgOmpReadClause::pools.size(); i++)
31860 : {
31861 : // objectArray[i] is a single memory pool
31862 0 : for (unsigned j=0; j < SgOmpReadClause::pool_size; j++)
31863 : {
31864 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
31865 : {
31866 : // printf ("Found a valid SgOmpReadClause object in the memory pool %d at position %d \n",i,j);
31867 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
31868 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
31869 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
31870 : }
31871 : else
31872 : {
31873 : // printf ("Found a INVALID SgOmpReadClause object in the memory pool \n");
31874 : }
31875 : }
31876 : }
31877 : }
31878 :
31879 : // This should not be required since all previously static data members are
31880 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
31881 :
31882 194 : }
31883 :
31884 : void
31885 0 : SgOmpReadClause::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
31886 : {
31887 : // This function visits only a single IR node of the memory pool.
31888 : // it is typically called once for each type of IR node within
31889 : // the automatically generated function: traverseRepresentativeNodes().
31890 :
31891 : // Initialize array to the address of the first element of the STL vector
31892 : // (which is guarenteed to be contiguous storage).
31893 : // SgOmpReadClause objectArray [] = *(Memory_Block_List.begin());
31894 0 : if (SgOmpReadClause::pools.empty() == false)
31895 : {
31896 : // Generate an array of memory pools
31897 0 : SgOmpReadClause** objectArray = (SgOmpReadClause**) &(SgOmpReadClause::pools[0]);
31898 :
31899 : // Build a local variable for better performance
31900 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
31901 :
31902 : // Iterate over the memory pools
31903 0 : bool done = false;
31904 0 : unsigned i=0;
31905 :
31906 : // find the first valid IR node, call visit function, and then leave
31907 0 : while ( done == false && i < SgOmpReadClause::pools.size() )
31908 : {
31909 : // objectArray[i] is a single memory pool
31910 : unsigned j=0;
31911 0 : while (done == false && j < SgOmpReadClause::pool_size)
31912 : {
31913 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
31914 : {
31915 0 : traversal.visit(&(objectArray[i][j]));
31916 0 : done = true;
31917 : }
31918 0 : j++;
31919 : }
31920 0 : i++;
31921 : }
31922 :
31923 : #if 0
31924 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
31925 : if (done == false)
31926 : {
31927 : printf ("No representative for SgOmpReadClause found in memory pools \n");
31928 : }
31929 : #endif
31930 : }
31931 0 : }
31932 :
31933 :
31934 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
31935 : // using values that overflow signed values of int.
31936 : size_t
31937 4 : SgOmpReadClause::numberOfNodes()
31938 : {
31939 : // This function traverses the memory pool for an IR node and
31940 : // counts the number of IR nodes of a particular Sage III IR
31941 : // nodes type.
31942 :
31943 4 : size_t count = 0;
31944 4 : if (SgOmpReadClause::pools.empty() == false)
31945 : {
31946 : // Generate an array of memory pools (this is actually a STL vector,
31947 : // but it is contiguious, so OK to treat this way).
31948 0 : SgOmpReadClause** objectArray = (SgOmpReadClause**) &(SgOmpReadClause::pools[0]);
31949 :
31950 : // Build a local variable for better performance (make it a loop invariant variable).
31951 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
31952 :
31953 : // Iterate over all of the memory pools for this IR node.
31954 0 : for (unsigned int i=0; i < SgOmpReadClause::pools.size(); i++)
31955 : {
31956 : // objectArray[i] is a single memory pool, iterate over all the
31957 : // IR nodes and only count those that are valid IR nodes used in
31958 : // the AST (i.e. allocated IR nodes).
31959 0 : for (unsigned j=0; j < SgOmpReadClause::pool_size; j++)
31960 : {
31961 : // This is indexing the STL vector of C/C++ style arrays as a doubly
31962 : // indexed array access. It is OK since we have leveraged the semantics
31963 : // of STL vector memory as contigous and cast the memory as an array
31964 : // of arrays to use the 2D array indexing. Hope this is not confusing,
31965 : // but it s very fast as an implementation.
31966 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
31967 : {
31968 0 : count++;
31969 : }
31970 : }
31971 : }
31972 : }
31973 :
31974 :
31975 :
31976 4 : return count;
31977 : }
31978 :
31979 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
31980 : // using values that overflow signed values of int.
31981 : size_t
31982 0 : SgOmpReadClause::memoryUsage()
31983 : {
31984 : // This function is required because we need the class name as a type when we call sizeof
31985 : // There might be another way to implement this if we have a traversal that only called a
31986 : // representative object (one call for each type of Sage IIIIR node).
31987 0 : size_t memory = numberOfNodes() * sizeof(SgOmpReadClause);
31988 :
31989 0 : return memory;
31990 : }
31991 :
31992 : /* #line 31993 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
31993 :
31994 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
31995 : void
31996 5342 : SgOmpThreadsClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
31997 : {
31998 : // This function traverses the memory pool for only a specific IR node
31999 : // and calls the visit function of the input class execute a traversal
32000 : // similar to the style of the attribute based traversals within ROSE.
32001 : // This traversal will visit ALL nodes of the AST where as the other
32002 : // attribute based traversals visit only the embedded tree within the AST.
32003 :
32004 : // Initialize array to the address of the first element of the STL vector
32005 : // (which is guaranteed to be contiguous storage).
32006 : // SgOmpThreadsClause objectArray [] = *(Memory_Block_List.begin());
32007 5342 : if (SgOmpThreadsClause::pools.empty() == false)
32008 : {
32009 : // Generate an array of memory pools
32010 0 : SgOmpThreadsClause** objectArray = (SgOmpThreadsClause**) &(SgOmpThreadsClause::pools[0]);
32011 :
32012 : // Build a local variable for better performance
32013 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
32014 : #if 0
32015 : // Iterate over the memory pools
32016 : for (unsigned int i=0; i < SgOmpThreadsClause::pools.size(); i++)
32017 : {
32018 : // objectArray[i] is a single memory pool
32019 : for (int j=0; j < SgOmpThreadsClause::pool_size; j++)
32020 : {
32021 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
32022 : {
32023 : traversal.visit(&(objectArray[i][j]));
32024 : }
32025 : }
32026 : }
32027 : #else
32028 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
32029 : // compute the list first and then call the visit function on each list element.
32030 :
32031 : // printf ("Inside of SgOmpThreadsClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
32032 :
32033 0 : std::vector<SgOmpThreadsClause*> nodeList;
32034 :
32035 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
32036 0 : for (unsigned int i=0; i < SgOmpThreadsClause::pools.size(); i++)
32037 : {
32038 : // objectArray[i] is a single memory pool
32039 0 : for (unsigned j=0; j < SgOmpThreadsClause::pool_size; j++)
32040 : {
32041 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
32042 : {
32043 0 : nodeList.push_back(&(objectArray[i][j]));
32044 : }
32045 : }
32046 : }
32047 :
32048 : // Iterate over the saved list
32049 0 : size_t nodeListSize = nodeList.size();
32050 0 : for (size_t i=0; i < nodeListSize; i++)
32051 : {
32052 0 : ROSE_ASSERT(nodeList[i] != NULL);
32053 : #if 0
32054 : traversal.visit(nodeList[i]);
32055 : #else
32056 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
32057 : {
32058 0 : traversal.visit(nodeList[i]);
32059 : }
32060 : #endif
32061 : }
32062 : #endif
32063 : }
32064 :
32065 : // This should not be required since all previously static data members are
32066 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
32067 :
32068 5342 : }
32069 :
32070 :
32071 : void
32072 194 : SgOmpThreadsClause::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
32073 : {
32074 : // This function traverses the memory pool for an IR node and
32075 : // calls the function to execute the visitor object.
32076 :
32077 : // Initialize array to the address of the first element of the STL vector
32078 : // (which is guarenteed to be contiguous storage).
32079 : // SgOmpThreadsClause objectArray [] = *(Memory_Block_List.begin());
32080 194 : if (SgOmpThreadsClause::pools.empty() == false)
32081 : {
32082 : // Generate an array of memory pools
32083 0 : SgOmpThreadsClause** objectArray = (SgOmpThreadsClause**) &(SgOmpThreadsClause::pools[0]);
32084 :
32085 : // Build a local variable for better performance
32086 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
32087 :
32088 : // Iterate over the memory pools
32089 0 : for (unsigned int i=0; i < SgOmpThreadsClause::pools.size(); i++)
32090 : {
32091 : // objectArray[i] is a single memory pool
32092 0 : for (unsigned j=0; j < SgOmpThreadsClause::pool_size; j++)
32093 : {
32094 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
32095 : {
32096 : // printf ("Found a valid SgOmpThreadsClause object in the memory pool %d at position %d \n",i,j);
32097 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
32098 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
32099 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
32100 : }
32101 : else
32102 : {
32103 : // printf ("Found a INVALID SgOmpThreadsClause object in the memory pool \n");
32104 : }
32105 : }
32106 : }
32107 : }
32108 :
32109 : // This should not be required since all previously static data members are
32110 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
32111 :
32112 194 : }
32113 :
32114 : void
32115 0 : SgOmpThreadsClause::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
32116 : {
32117 : // This function visits only a single IR node of the memory pool.
32118 : // it is typically called once for each type of IR node within
32119 : // the automatically generated function: traverseRepresentativeNodes().
32120 :
32121 : // Initialize array to the address of the first element of the STL vector
32122 : // (which is guarenteed to be contiguous storage).
32123 : // SgOmpThreadsClause objectArray [] = *(Memory_Block_List.begin());
32124 0 : if (SgOmpThreadsClause::pools.empty() == false)
32125 : {
32126 : // Generate an array of memory pools
32127 0 : SgOmpThreadsClause** objectArray = (SgOmpThreadsClause**) &(SgOmpThreadsClause::pools[0]);
32128 :
32129 : // Build a local variable for better performance
32130 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
32131 :
32132 : // Iterate over the memory pools
32133 0 : bool done = false;
32134 0 : unsigned i=0;
32135 :
32136 : // find the first valid IR node, call visit function, and then leave
32137 0 : while ( done == false && i < SgOmpThreadsClause::pools.size() )
32138 : {
32139 : // objectArray[i] is a single memory pool
32140 : unsigned j=0;
32141 0 : while (done == false && j < SgOmpThreadsClause::pool_size)
32142 : {
32143 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
32144 : {
32145 0 : traversal.visit(&(objectArray[i][j]));
32146 0 : done = true;
32147 : }
32148 0 : j++;
32149 : }
32150 0 : i++;
32151 : }
32152 :
32153 : #if 0
32154 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
32155 : if (done == false)
32156 : {
32157 : printf ("No representative for SgOmpThreadsClause found in memory pools \n");
32158 : }
32159 : #endif
32160 : }
32161 0 : }
32162 :
32163 :
32164 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
32165 : // using values that overflow signed values of int.
32166 : size_t
32167 4 : SgOmpThreadsClause::numberOfNodes()
32168 : {
32169 : // This function traverses the memory pool for an IR node and
32170 : // counts the number of IR nodes of a particular Sage III IR
32171 : // nodes type.
32172 :
32173 4 : size_t count = 0;
32174 4 : if (SgOmpThreadsClause::pools.empty() == false)
32175 : {
32176 : // Generate an array of memory pools (this is actually a STL vector,
32177 : // but it is contiguious, so OK to treat this way).
32178 0 : SgOmpThreadsClause** objectArray = (SgOmpThreadsClause**) &(SgOmpThreadsClause::pools[0]);
32179 :
32180 : // Build a local variable for better performance (make it a loop invariant variable).
32181 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
32182 :
32183 : // Iterate over all of the memory pools for this IR node.
32184 0 : for (unsigned int i=0; i < SgOmpThreadsClause::pools.size(); i++)
32185 : {
32186 : // objectArray[i] is a single memory pool, iterate over all the
32187 : // IR nodes and only count those that are valid IR nodes used in
32188 : // the AST (i.e. allocated IR nodes).
32189 0 : for (unsigned j=0; j < SgOmpThreadsClause::pool_size; j++)
32190 : {
32191 : // This is indexing the STL vector of C/C++ style arrays as a doubly
32192 : // indexed array access. It is OK since we have leveraged the semantics
32193 : // of STL vector memory as contigous and cast the memory as an array
32194 : // of arrays to use the 2D array indexing. Hope this is not confusing,
32195 : // but it s very fast as an implementation.
32196 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
32197 : {
32198 0 : count++;
32199 : }
32200 : }
32201 : }
32202 : }
32203 :
32204 :
32205 :
32206 4 : return count;
32207 : }
32208 :
32209 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
32210 : // using values that overflow signed values of int.
32211 : size_t
32212 0 : SgOmpThreadsClause::memoryUsage()
32213 : {
32214 : // This function is required because we need the class name as a type when we call sizeof
32215 : // There might be another way to implement this if we have a traversal that only called a
32216 : // representative object (one call for each type of Sage IIIIR node).
32217 0 : size_t memory = numberOfNodes() * sizeof(SgOmpThreadsClause);
32218 :
32219 0 : return memory;
32220 : }
32221 :
32222 : /* #line 32223 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
32223 :
32224 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
32225 : void
32226 5342 : SgOmpSimdClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
32227 : {
32228 : // This function traverses the memory pool for only a specific IR node
32229 : // and calls the visit function of the input class execute a traversal
32230 : // similar to the style of the attribute based traversals within ROSE.
32231 : // This traversal will visit ALL nodes of the AST where as the other
32232 : // attribute based traversals visit only the embedded tree within the AST.
32233 :
32234 : // Initialize array to the address of the first element of the STL vector
32235 : // (which is guaranteed to be contiguous storage).
32236 : // SgOmpSimdClause objectArray [] = *(Memory_Block_List.begin());
32237 5342 : if (SgOmpSimdClause::pools.empty() == false)
32238 : {
32239 : // Generate an array of memory pools
32240 0 : SgOmpSimdClause** objectArray = (SgOmpSimdClause**) &(SgOmpSimdClause::pools[0]);
32241 :
32242 : // Build a local variable for better performance
32243 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
32244 : #if 0
32245 : // Iterate over the memory pools
32246 : for (unsigned int i=0; i < SgOmpSimdClause::pools.size(); i++)
32247 : {
32248 : // objectArray[i] is a single memory pool
32249 : for (int j=0; j < SgOmpSimdClause::pool_size; j++)
32250 : {
32251 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
32252 : {
32253 : traversal.visit(&(objectArray[i][j]));
32254 : }
32255 : }
32256 : }
32257 : #else
32258 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
32259 : // compute the list first and then call the visit function on each list element.
32260 :
32261 : // printf ("Inside of SgOmpSimdClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
32262 :
32263 0 : std::vector<SgOmpSimdClause*> nodeList;
32264 :
32265 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
32266 0 : for (unsigned int i=0; i < SgOmpSimdClause::pools.size(); i++)
32267 : {
32268 : // objectArray[i] is a single memory pool
32269 0 : for (unsigned j=0; j < SgOmpSimdClause::pool_size; j++)
32270 : {
32271 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
32272 : {
32273 0 : nodeList.push_back(&(objectArray[i][j]));
32274 : }
32275 : }
32276 : }
32277 :
32278 : // Iterate over the saved list
32279 0 : size_t nodeListSize = nodeList.size();
32280 0 : for (size_t i=0; i < nodeListSize; i++)
32281 : {
32282 0 : ROSE_ASSERT(nodeList[i] != NULL);
32283 : #if 0
32284 : traversal.visit(nodeList[i]);
32285 : #else
32286 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
32287 : {
32288 0 : traversal.visit(nodeList[i]);
32289 : }
32290 : #endif
32291 : }
32292 : #endif
32293 : }
32294 :
32295 : // This should not be required since all previously static data members are
32296 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
32297 :
32298 5342 : }
32299 :
32300 :
32301 : void
32302 194 : SgOmpSimdClause::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
32303 : {
32304 : // This function traverses the memory pool for an IR node and
32305 : // calls the function to execute the visitor object.
32306 :
32307 : // Initialize array to the address of the first element of the STL vector
32308 : // (which is guarenteed to be contiguous storage).
32309 : // SgOmpSimdClause objectArray [] = *(Memory_Block_List.begin());
32310 194 : if (SgOmpSimdClause::pools.empty() == false)
32311 : {
32312 : // Generate an array of memory pools
32313 0 : SgOmpSimdClause** objectArray = (SgOmpSimdClause**) &(SgOmpSimdClause::pools[0]);
32314 :
32315 : // Build a local variable for better performance
32316 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
32317 :
32318 : // Iterate over the memory pools
32319 0 : for (unsigned int i=0; i < SgOmpSimdClause::pools.size(); i++)
32320 : {
32321 : // objectArray[i] is a single memory pool
32322 0 : for (unsigned j=0; j < SgOmpSimdClause::pool_size; j++)
32323 : {
32324 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
32325 : {
32326 : // printf ("Found a valid SgOmpSimdClause object in the memory pool %d at position %d \n",i,j);
32327 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
32328 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
32329 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
32330 : }
32331 : else
32332 : {
32333 : // printf ("Found a INVALID SgOmpSimdClause object in the memory pool \n");
32334 : }
32335 : }
32336 : }
32337 : }
32338 :
32339 : // This should not be required since all previously static data members are
32340 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
32341 :
32342 194 : }
32343 :
32344 : void
32345 0 : SgOmpSimdClause::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
32346 : {
32347 : // This function visits only a single IR node of the memory pool.
32348 : // it is typically called once for each type of IR node within
32349 : // the automatically generated function: traverseRepresentativeNodes().
32350 :
32351 : // Initialize array to the address of the first element of the STL vector
32352 : // (which is guarenteed to be contiguous storage).
32353 : // SgOmpSimdClause objectArray [] = *(Memory_Block_List.begin());
32354 0 : if (SgOmpSimdClause::pools.empty() == false)
32355 : {
32356 : // Generate an array of memory pools
32357 0 : SgOmpSimdClause** objectArray = (SgOmpSimdClause**) &(SgOmpSimdClause::pools[0]);
32358 :
32359 : // Build a local variable for better performance
32360 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
32361 :
32362 : // Iterate over the memory pools
32363 0 : bool done = false;
32364 0 : unsigned i=0;
32365 :
32366 : // find the first valid IR node, call visit function, and then leave
32367 0 : while ( done == false && i < SgOmpSimdClause::pools.size() )
32368 : {
32369 : // objectArray[i] is a single memory pool
32370 : unsigned j=0;
32371 0 : while (done == false && j < SgOmpSimdClause::pool_size)
32372 : {
32373 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
32374 : {
32375 0 : traversal.visit(&(objectArray[i][j]));
32376 0 : done = true;
32377 : }
32378 0 : j++;
32379 : }
32380 0 : i++;
32381 : }
32382 :
32383 : #if 0
32384 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
32385 : if (done == false)
32386 : {
32387 : printf ("No representative for SgOmpSimdClause found in memory pools \n");
32388 : }
32389 : #endif
32390 : }
32391 0 : }
32392 :
32393 :
32394 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
32395 : // using values that overflow signed values of int.
32396 : size_t
32397 4 : SgOmpSimdClause::numberOfNodes()
32398 : {
32399 : // This function traverses the memory pool for an IR node and
32400 : // counts the number of IR nodes of a particular Sage III IR
32401 : // nodes type.
32402 :
32403 4 : size_t count = 0;
32404 4 : if (SgOmpSimdClause::pools.empty() == false)
32405 : {
32406 : // Generate an array of memory pools (this is actually a STL vector,
32407 : // but it is contiguious, so OK to treat this way).
32408 0 : SgOmpSimdClause** objectArray = (SgOmpSimdClause**) &(SgOmpSimdClause::pools[0]);
32409 :
32410 : // Build a local variable for better performance (make it a loop invariant variable).
32411 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
32412 :
32413 : // Iterate over all of the memory pools for this IR node.
32414 0 : for (unsigned int i=0; i < SgOmpSimdClause::pools.size(); i++)
32415 : {
32416 : // objectArray[i] is a single memory pool, iterate over all the
32417 : // IR nodes and only count those that are valid IR nodes used in
32418 : // the AST (i.e. allocated IR nodes).
32419 0 : for (unsigned j=0; j < SgOmpSimdClause::pool_size; j++)
32420 : {
32421 : // This is indexing the STL vector of C/C++ style arrays as a doubly
32422 : // indexed array access. It is OK since we have leveraged the semantics
32423 : // of STL vector memory as contigous and cast the memory as an array
32424 : // of arrays to use the 2D array indexing. Hope this is not confusing,
32425 : // but it s very fast as an implementation.
32426 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
32427 : {
32428 0 : count++;
32429 : }
32430 : }
32431 : }
32432 : }
32433 :
32434 :
32435 :
32436 4 : return count;
32437 : }
32438 :
32439 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
32440 : // using values that overflow signed values of int.
32441 : size_t
32442 0 : SgOmpSimdClause::memoryUsage()
32443 : {
32444 : // This function is required because we need the class name as a type when we call sizeof
32445 : // There might be another way to implement this if we have a traversal that only called a
32446 : // representative object (one call for each type of Sage IIIIR node).
32447 0 : size_t memory = numberOfNodes() * sizeof(SgOmpSimdClause);
32448 :
32449 0 : return memory;
32450 : }
32451 :
32452 : /* #line 32453 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
32453 :
32454 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
32455 : void
32456 5342 : SgOmpWriteClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
32457 : {
32458 : // This function traverses the memory pool for only a specific IR node
32459 : // and calls the visit function of the input class execute a traversal
32460 : // similar to the style of the attribute based traversals within ROSE.
32461 : // This traversal will visit ALL nodes of the AST where as the other
32462 : // attribute based traversals visit only the embedded tree within the AST.
32463 :
32464 : // Initialize array to the address of the first element of the STL vector
32465 : // (which is guaranteed to be contiguous storage).
32466 : // SgOmpWriteClause objectArray [] = *(Memory_Block_List.begin());
32467 5342 : if (SgOmpWriteClause::pools.empty() == false)
32468 : {
32469 : // Generate an array of memory pools
32470 7 : SgOmpWriteClause** objectArray = (SgOmpWriteClause**) &(SgOmpWriteClause::pools[0]);
32471 :
32472 : // Build a local variable for better performance
32473 7 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
32474 : #if 0
32475 : // Iterate over the memory pools
32476 : for (unsigned int i=0; i < SgOmpWriteClause::pools.size(); i++)
32477 : {
32478 : // objectArray[i] is a single memory pool
32479 : for (int j=0; j < SgOmpWriteClause::pool_size; j++)
32480 : {
32481 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
32482 : {
32483 : traversal.visit(&(objectArray[i][j]));
32484 : }
32485 : }
32486 : }
32487 : #else
32488 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
32489 : // compute the list first and then call the visit function on each list element.
32490 :
32491 : // printf ("Inside of SgOmpWriteClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
32492 :
32493 14 : std::vector<SgOmpWriteClause*> nodeList;
32494 :
32495 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
32496 14 : for (unsigned int i=0; i < SgOmpWriteClause::pools.size(); i++)
32497 : {
32498 : // objectArray[i] is a single memory pool
32499 14007 : for (unsigned j=0; j < SgOmpWriteClause::pool_size; j++)
32500 : {
32501 14000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
32502 : {
32503 7 : nodeList.push_back(&(objectArray[i][j]));
32504 : }
32505 : }
32506 : }
32507 :
32508 : // Iterate over the saved list
32509 7 : size_t nodeListSize = nodeList.size();
32510 14 : for (size_t i=0; i < nodeListSize; i++)
32511 : {
32512 7 : ROSE_ASSERT(nodeList[i] != NULL);
32513 : #if 0
32514 : traversal.visit(nodeList[i]);
32515 : #else
32516 7 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
32517 : {
32518 7 : traversal.visit(nodeList[i]);
32519 : }
32520 : #endif
32521 : }
32522 : #endif
32523 : }
32524 :
32525 : // This should not be required since all previously static data members are
32526 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
32527 :
32528 5342 : }
32529 :
32530 :
32531 : void
32532 194 : SgOmpWriteClause::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
32533 : {
32534 : // This function traverses the memory pool for an IR node and
32535 : // calls the function to execute the visitor object.
32536 :
32537 : // Initialize array to the address of the first element of the STL vector
32538 : // (which is guarenteed to be contiguous storage).
32539 : // SgOmpWriteClause objectArray [] = *(Memory_Block_List.begin());
32540 194 : if (SgOmpWriteClause::pools.empty() == false)
32541 : {
32542 : // Generate an array of memory pools
32543 0 : SgOmpWriteClause** objectArray = (SgOmpWriteClause**) &(SgOmpWriteClause::pools[0]);
32544 :
32545 : // Build a local variable for better performance
32546 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
32547 :
32548 : // Iterate over the memory pools
32549 0 : for (unsigned int i=0; i < SgOmpWriteClause::pools.size(); i++)
32550 : {
32551 : // objectArray[i] is a single memory pool
32552 0 : for (unsigned j=0; j < SgOmpWriteClause::pool_size; j++)
32553 : {
32554 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
32555 : {
32556 : // printf ("Found a valid SgOmpWriteClause object in the memory pool %d at position %d \n",i,j);
32557 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
32558 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
32559 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
32560 : }
32561 : else
32562 : {
32563 : // printf ("Found a INVALID SgOmpWriteClause object in the memory pool \n");
32564 : }
32565 : }
32566 : }
32567 : }
32568 :
32569 : // This should not be required since all previously static data members are
32570 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
32571 :
32572 194 : }
32573 :
32574 : void
32575 0 : SgOmpWriteClause::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
32576 : {
32577 : // This function visits only a single IR node of the memory pool.
32578 : // it is typically called once for each type of IR node within
32579 : // the automatically generated function: traverseRepresentativeNodes().
32580 :
32581 : // Initialize array to the address of the first element of the STL vector
32582 : // (which is guarenteed to be contiguous storage).
32583 : // SgOmpWriteClause objectArray [] = *(Memory_Block_List.begin());
32584 0 : if (SgOmpWriteClause::pools.empty() == false)
32585 : {
32586 : // Generate an array of memory pools
32587 0 : SgOmpWriteClause** objectArray = (SgOmpWriteClause**) &(SgOmpWriteClause::pools[0]);
32588 :
32589 : // Build a local variable for better performance
32590 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
32591 :
32592 : // Iterate over the memory pools
32593 0 : bool done = false;
32594 0 : unsigned i=0;
32595 :
32596 : // find the first valid IR node, call visit function, and then leave
32597 0 : while ( done == false && i < SgOmpWriteClause::pools.size() )
32598 : {
32599 : // objectArray[i] is a single memory pool
32600 : unsigned j=0;
32601 0 : while (done == false && j < SgOmpWriteClause::pool_size)
32602 : {
32603 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
32604 : {
32605 0 : traversal.visit(&(objectArray[i][j]));
32606 0 : done = true;
32607 : }
32608 0 : j++;
32609 : }
32610 0 : i++;
32611 : }
32612 :
32613 : #if 0
32614 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
32615 : if (done == false)
32616 : {
32617 : printf ("No representative for SgOmpWriteClause found in memory pools \n");
32618 : }
32619 : #endif
32620 : }
32621 0 : }
32622 :
32623 :
32624 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
32625 : // using values that overflow signed values of int.
32626 : size_t
32627 4 : SgOmpWriteClause::numberOfNodes()
32628 : {
32629 : // This function traverses the memory pool for an IR node and
32630 : // counts the number of IR nodes of a particular Sage III IR
32631 : // nodes type.
32632 :
32633 4 : size_t count = 0;
32634 4 : if (SgOmpWriteClause::pools.empty() == false)
32635 : {
32636 : // Generate an array of memory pools (this is actually a STL vector,
32637 : // but it is contiguious, so OK to treat this way).
32638 0 : SgOmpWriteClause** objectArray = (SgOmpWriteClause**) &(SgOmpWriteClause::pools[0]);
32639 :
32640 : // Build a local variable for better performance (make it a loop invariant variable).
32641 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
32642 :
32643 : // Iterate over all of the memory pools for this IR node.
32644 0 : for (unsigned int i=0; i < SgOmpWriteClause::pools.size(); i++)
32645 : {
32646 : // objectArray[i] is a single memory pool, iterate over all the
32647 : // IR nodes and only count those that are valid IR nodes used in
32648 : // the AST (i.e. allocated IR nodes).
32649 0 : for (unsigned j=0; j < SgOmpWriteClause::pool_size; j++)
32650 : {
32651 : // This is indexing the STL vector of C/C++ style arrays as a doubly
32652 : // indexed array access. It is OK since we have leveraged the semantics
32653 : // of STL vector memory as contigous and cast the memory as an array
32654 : // of arrays to use the 2D array indexing. Hope this is not confusing,
32655 : // but it s very fast as an implementation.
32656 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
32657 : {
32658 0 : count++;
32659 : }
32660 : }
32661 : }
32662 : }
32663 :
32664 :
32665 :
32666 4 : return count;
32667 : }
32668 :
32669 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
32670 : // using values that overflow signed values of int.
32671 : size_t
32672 0 : SgOmpWriteClause::memoryUsage()
32673 : {
32674 : // This function is required because we need the class name as a type when we call sizeof
32675 : // There might be another way to implement this if we have a traversal that only called a
32676 : // representative object (one call for each type of Sage IIIIR node).
32677 0 : size_t memory = numberOfNodes() * sizeof(SgOmpWriteClause);
32678 :
32679 0 : return memory;
32680 : }
32681 :
32682 : /* #line 32683 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
32683 :
32684 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
32685 : void
32686 5342 : SgOmpUpdateClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
32687 : {
32688 : // This function traverses the memory pool for only a specific IR node
32689 : // and calls the visit function of the input class execute a traversal
32690 : // similar to the style of the attribute based traversals within ROSE.
32691 : // This traversal will visit ALL nodes of the AST where as the other
32692 : // attribute based traversals visit only the embedded tree within the AST.
32693 :
32694 : // Initialize array to the address of the first element of the STL vector
32695 : // (which is guaranteed to be contiguous storage).
32696 : // SgOmpUpdateClause objectArray [] = *(Memory_Block_List.begin());
32697 5342 : if (SgOmpUpdateClause::pools.empty() == false)
32698 : {
32699 : // Generate an array of memory pools
32700 7 : SgOmpUpdateClause** objectArray = (SgOmpUpdateClause**) &(SgOmpUpdateClause::pools[0]);
32701 :
32702 : // Build a local variable for better performance
32703 7 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
32704 : #if 0
32705 : // Iterate over the memory pools
32706 : for (unsigned int i=0; i < SgOmpUpdateClause::pools.size(); i++)
32707 : {
32708 : // objectArray[i] is a single memory pool
32709 : for (int j=0; j < SgOmpUpdateClause::pool_size; j++)
32710 : {
32711 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
32712 : {
32713 : traversal.visit(&(objectArray[i][j]));
32714 : }
32715 : }
32716 : }
32717 : #else
32718 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
32719 : // compute the list first and then call the visit function on each list element.
32720 :
32721 : // printf ("Inside of SgOmpUpdateClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
32722 :
32723 14 : std::vector<SgOmpUpdateClause*> nodeList;
32724 :
32725 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
32726 14 : for (unsigned int i=0; i < SgOmpUpdateClause::pools.size(); i++)
32727 : {
32728 : // objectArray[i] is a single memory pool
32729 14007 : for (unsigned j=0; j < SgOmpUpdateClause::pool_size; j++)
32730 : {
32731 14000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
32732 : {
32733 7 : nodeList.push_back(&(objectArray[i][j]));
32734 : }
32735 : }
32736 : }
32737 :
32738 : // Iterate over the saved list
32739 7 : size_t nodeListSize = nodeList.size();
32740 14 : for (size_t i=0; i < nodeListSize; i++)
32741 : {
32742 7 : ROSE_ASSERT(nodeList[i] != NULL);
32743 : #if 0
32744 : traversal.visit(nodeList[i]);
32745 : #else
32746 7 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
32747 : {
32748 7 : traversal.visit(nodeList[i]);
32749 : }
32750 : #endif
32751 : }
32752 : #endif
32753 : }
32754 :
32755 : // This should not be required since all previously static data members are
32756 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
32757 :
32758 5342 : }
32759 :
32760 :
32761 : void
32762 194 : SgOmpUpdateClause::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
32763 : {
32764 : // This function traverses the memory pool for an IR node and
32765 : // calls the function to execute the visitor object.
32766 :
32767 : // Initialize array to the address of the first element of the STL vector
32768 : // (which is guarenteed to be contiguous storage).
32769 : // SgOmpUpdateClause objectArray [] = *(Memory_Block_List.begin());
32770 194 : if (SgOmpUpdateClause::pools.empty() == false)
32771 : {
32772 : // Generate an array of memory pools
32773 0 : SgOmpUpdateClause** objectArray = (SgOmpUpdateClause**) &(SgOmpUpdateClause::pools[0]);
32774 :
32775 : // Build a local variable for better performance
32776 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
32777 :
32778 : // Iterate over the memory pools
32779 0 : for (unsigned int i=0; i < SgOmpUpdateClause::pools.size(); i++)
32780 : {
32781 : // objectArray[i] is a single memory pool
32782 0 : for (unsigned j=0; j < SgOmpUpdateClause::pool_size; j++)
32783 : {
32784 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
32785 : {
32786 : // printf ("Found a valid SgOmpUpdateClause object in the memory pool %d at position %d \n",i,j);
32787 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
32788 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
32789 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
32790 : }
32791 : else
32792 : {
32793 : // printf ("Found a INVALID SgOmpUpdateClause object in the memory pool \n");
32794 : }
32795 : }
32796 : }
32797 : }
32798 :
32799 : // This should not be required since all previously static data members are
32800 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
32801 :
32802 194 : }
32803 :
32804 : void
32805 0 : SgOmpUpdateClause::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
32806 : {
32807 : // This function visits only a single IR node of the memory pool.
32808 : // it is typically called once for each type of IR node within
32809 : // the automatically generated function: traverseRepresentativeNodes().
32810 :
32811 : // Initialize array to the address of the first element of the STL vector
32812 : // (which is guarenteed to be contiguous storage).
32813 : // SgOmpUpdateClause objectArray [] = *(Memory_Block_List.begin());
32814 0 : if (SgOmpUpdateClause::pools.empty() == false)
32815 : {
32816 : // Generate an array of memory pools
32817 0 : SgOmpUpdateClause** objectArray = (SgOmpUpdateClause**) &(SgOmpUpdateClause::pools[0]);
32818 :
32819 : // Build a local variable for better performance
32820 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
32821 :
32822 : // Iterate over the memory pools
32823 0 : bool done = false;
32824 0 : unsigned i=0;
32825 :
32826 : // find the first valid IR node, call visit function, and then leave
32827 0 : while ( done == false && i < SgOmpUpdateClause::pools.size() )
32828 : {
32829 : // objectArray[i] is a single memory pool
32830 : unsigned j=0;
32831 0 : while (done == false && j < SgOmpUpdateClause::pool_size)
32832 : {
32833 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
32834 : {
32835 0 : traversal.visit(&(objectArray[i][j]));
32836 0 : done = true;
32837 : }
32838 0 : j++;
32839 : }
32840 0 : i++;
32841 : }
32842 :
32843 : #if 0
32844 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
32845 : if (done == false)
32846 : {
32847 : printf ("No representative for SgOmpUpdateClause found in memory pools \n");
32848 : }
32849 : #endif
32850 : }
32851 0 : }
32852 :
32853 :
32854 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
32855 : // using values that overflow signed values of int.
32856 : size_t
32857 4 : SgOmpUpdateClause::numberOfNodes()
32858 : {
32859 : // This function traverses the memory pool for an IR node and
32860 : // counts the number of IR nodes of a particular Sage III IR
32861 : // nodes type.
32862 :
32863 4 : size_t count = 0;
32864 4 : if (SgOmpUpdateClause::pools.empty() == false)
32865 : {
32866 : // Generate an array of memory pools (this is actually a STL vector,
32867 : // but it is contiguious, so OK to treat this way).
32868 0 : SgOmpUpdateClause** objectArray = (SgOmpUpdateClause**) &(SgOmpUpdateClause::pools[0]);
32869 :
32870 : // Build a local variable for better performance (make it a loop invariant variable).
32871 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
32872 :
32873 : // Iterate over all of the memory pools for this IR node.
32874 0 : for (unsigned int i=0; i < SgOmpUpdateClause::pools.size(); i++)
32875 : {
32876 : // objectArray[i] is a single memory pool, iterate over all the
32877 : // IR nodes and only count those that are valid IR nodes used in
32878 : // the AST (i.e. allocated IR nodes).
32879 0 : for (unsigned j=0; j < SgOmpUpdateClause::pool_size; j++)
32880 : {
32881 : // This is indexing the STL vector of C/C++ style arrays as a doubly
32882 : // indexed array access. It is OK since we have leveraged the semantics
32883 : // of STL vector memory as contigous and cast the memory as an array
32884 : // of arrays to use the 2D array indexing. Hope this is not confusing,
32885 : // but it s very fast as an implementation.
32886 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
32887 : {
32888 0 : count++;
32889 : }
32890 : }
32891 : }
32892 : }
32893 :
32894 :
32895 :
32896 4 : return count;
32897 : }
32898 :
32899 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
32900 : // using values that overflow signed values of int.
32901 : size_t
32902 0 : SgOmpUpdateClause::memoryUsage()
32903 : {
32904 : // This function is required because we need the class name as a type when we call sizeof
32905 : // There might be another way to implement this if we have a traversal that only called a
32906 : // representative object (one call for each type of Sage IIIIR node).
32907 0 : size_t memory = numberOfNodes() * sizeof(SgOmpUpdateClause);
32908 :
32909 0 : return memory;
32910 : }
32911 :
32912 : /* #line 32913 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
32913 :
32914 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
32915 : void
32916 5342 : SgOmpDepobjUpdateClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
32917 : {
32918 : // This function traverses the memory pool for only a specific IR node
32919 : // and calls the visit function of the input class execute a traversal
32920 : // similar to the style of the attribute based traversals within ROSE.
32921 : // This traversal will visit ALL nodes of the AST where as the other
32922 : // attribute based traversals visit only the embedded tree within the AST.
32923 :
32924 : // Initialize array to the address of the first element of the STL vector
32925 : // (which is guaranteed to be contiguous storage).
32926 : // SgOmpDepobjUpdateClause objectArray [] = *(Memory_Block_List.begin());
32927 5342 : if (SgOmpDepobjUpdateClause::pools.empty() == false)
32928 : {
32929 : // Generate an array of memory pools
32930 7 : SgOmpDepobjUpdateClause** objectArray = (SgOmpDepobjUpdateClause**) &(SgOmpDepobjUpdateClause::pools[0]);
32931 :
32932 : // Build a local variable for better performance
32933 7 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
32934 : #if 0
32935 : // Iterate over the memory pools
32936 : for (unsigned int i=0; i < SgOmpDepobjUpdateClause::pools.size(); i++)
32937 : {
32938 : // objectArray[i] is a single memory pool
32939 : for (int j=0; j < SgOmpDepobjUpdateClause::pool_size; j++)
32940 : {
32941 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
32942 : {
32943 : traversal.visit(&(objectArray[i][j]));
32944 : }
32945 : }
32946 : }
32947 : #else
32948 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
32949 : // compute the list first and then call the visit function on each list element.
32950 :
32951 : // printf ("Inside of SgOmpDepobjUpdateClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
32952 :
32953 14 : std::vector<SgOmpDepobjUpdateClause*> nodeList;
32954 :
32955 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
32956 14 : for (unsigned int i=0; i < SgOmpDepobjUpdateClause::pools.size(); i++)
32957 : {
32958 : // objectArray[i] is a single memory pool
32959 14007 : for (unsigned j=0; j < SgOmpDepobjUpdateClause::pool_size; j++)
32960 : {
32961 14000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
32962 : {
32963 7 : nodeList.push_back(&(objectArray[i][j]));
32964 : }
32965 : }
32966 : }
32967 :
32968 : // Iterate over the saved list
32969 7 : size_t nodeListSize = nodeList.size();
32970 14 : for (size_t i=0; i < nodeListSize; i++)
32971 : {
32972 7 : ROSE_ASSERT(nodeList[i] != NULL);
32973 : #if 0
32974 : traversal.visit(nodeList[i]);
32975 : #else
32976 7 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
32977 : {
32978 7 : traversal.visit(nodeList[i]);
32979 : }
32980 : #endif
32981 : }
32982 : #endif
32983 : }
32984 :
32985 : // This should not be required since all previously static data members are
32986 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
32987 :
32988 5342 : }
32989 :
32990 :
32991 : void
32992 194 : SgOmpDepobjUpdateClause::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
32993 : {
32994 : // This function traverses the memory pool for an IR node and
32995 : // calls the function to execute the visitor object.
32996 :
32997 : // Initialize array to the address of the first element of the STL vector
32998 : // (which is guarenteed to be contiguous storage).
32999 : // SgOmpDepobjUpdateClause objectArray [] = *(Memory_Block_List.begin());
33000 194 : if (SgOmpDepobjUpdateClause::pools.empty() == false)
33001 : {
33002 : // Generate an array of memory pools
33003 0 : SgOmpDepobjUpdateClause** objectArray = (SgOmpDepobjUpdateClause**) &(SgOmpDepobjUpdateClause::pools[0]);
33004 :
33005 : // Build a local variable for better performance
33006 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
33007 :
33008 : // Iterate over the memory pools
33009 0 : for (unsigned int i=0; i < SgOmpDepobjUpdateClause::pools.size(); i++)
33010 : {
33011 : // objectArray[i] is a single memory pool
33012 0 : for (unsigned j=0; j < SgOmpDepobjUpdateClause::pool_size; j++)
33013 : {
33014 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
33015 : {
33016 : // printf ("Found a valid SgOmpDepobjUpdateClause object in the memory pool %d at position %d \n",i,j);
33017 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
33018 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
33019 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
33020 : }
33021 : else
33022 : {
33023 : // printf ("Found a INVALID SgOmpDepobjUpdateClause object in the memory pool \n");
33024 : }
33025 : }
33026 : }
33027 : }
33028 :
33029 : // This should not be required since all previously static data members are
33030 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
33031 :
33032 194 : }
33033 :
33034 : void
33035 0 : SgOmpDepobjUpdateClause::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
33036 : {
33037 : // This function visits only a single IR node of the memory pool.
33038 : // it is typically called once for each type of IR node within
33039 : // the automatically generated function: traverseRepresentativeNodes().
33040 :
33041 : // Initialize array to the address of the first element of the STL vector
33042 : // (which is guarenteed to be contiguous storage).
33043 : // SgOmpDepobjUpdateClause objectArray [] = *(Memory_Block_List.begin());
33044 0 : if (SgOmpDepobjUpdateClause::pools.empty() == false)
33045 : {
33046 : // Generate an array of memory pools
33047 0 : SgOmpDepobjUpdateClause** objectArray = (SgOmpDepobjUpdateClause**) &(SgOmpDepobjUpdateClause::pools[0]);
33048 :
33049 : // Build a local variable for better performance
33050 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
33051 :
33052 : // Iterate over the memory pools
33053 0 : bool done = false;
33054 0 : unsigned i=0;
33055 :
33056 : // find the first valid IR node, call visit function, and then leave
33057 0 : while ( done == false && i < SgOmpDepobjUpdateClause::pools.size() )
33058 : {
33059 : // objectArray[i] is a single memory pool
33060 : unsigned j=0;
33061 0 : while (done == false && j < SgOmpDepobjUpdateClause::pool_size)
33062 : {
33063 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
33064 : {
33065 0 : traversal.visit(&(objectArray[i][j]));
33066 0 : done = true;
33067 : }
33068 0 : j++;
33069 : }
33070 0 : i++;
33071 : }
33072 :
33073 : #if 0
33074 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
33075 : if (done == false)
33076 : {
33077 : printf ("No representative for SgOmpDepobjUpdateClause found in memory pools \n");
33078 : }
33079 : #endif
33080 : }
33081 0 : }
33082 :
33083 :
33084 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
33085 : // using values that overflow signed values of int.
33086 : size_t
33087 4 : SgOmpDepobjUpdateClause::numberOfNodes()
33088 : {
33089 : // This function traverses the memory pool for an IR node and
33090 : // counts the number of IR nodes of a particular Sage III IR
33091 : // nodes type.
33092 :
33093 4 : size_t count = 0;
33094 4 : if (SgOmpDepobjUpdateClause::pools.empty() == false)
33095 : {
33096 : // Generate an array of memory pools (this is actually a STL vector,
33097 : // but it is contiguious, so OK to treat this way).
33098 0 : SgOmpDepobjUpdateClause** objectArray = (SgOmpDepobjUpdateClause**) &(SgOmpDepobjUpdateClause::pools[0]);
33099 :
33100 : // Build a local variable for better performance (make it a loop invariant variable).
33101 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
33102 :
33103 : // Iterate over all of the memory pools for this IR node.
33104 0 : for (unsigned int i=0; i < SgOmpDepobjUpdateClause::pools.size(); i++)
33105 : {
33106 : // objectArray[i] is a single memory pool, iterate over all the
33107 : // IR nodes and only count those that are valid IR nodes used in
33108 : // the AST (i.e. allocated IR nodes).
33109 0 : for (unsigned j=0; j < SgOmpDepobjUpdateClause::pool_size; j++)
33110 : {
33111 : // This is indexing the STL vector of C/C++ style arrays as a doubly
33112 : // indexed array access. It is OK since we have leveraged the semantics
33113 : // of STL vector memory as contigous and cast the memory as an array
33114 : // of arrays to use the 2D array indexing. Hope this is not confusing,
33115 : // but it s very fast as an implementation.
33116 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
33117 : {
33118 0 : count++;
33119 : }
33120 : }
33121 : }
33122 : }
33123 :
33124 :
33125 :
33126 4 : return count;
33127 : }
33128 :
33129 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
33130 : // using values that overflow signed values of int.
33131 : size_t
33132 0 : SgOmpDepobjUpdateClause::memoryUsage()
33133 : {
33134 : // This function is required because we need the class name as a type when we call sizeof
33135 : // There might be another way to implement this if we have a traversal that only called a
33136 : // representative object (one call for each type of Sage IIIIR node).
33137 0 : size_t memory = numberOfNodes() * sizeof(SgOmpDepobjUpdateClause);
33138 :
33139 0 : return memory;
33140 : }
33141 :
33142 : /* #line 33143 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
33143 :
33144 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
33145 : void
33146 5342 : SgOmpDestroyClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
33147 : {
33148 : // This function traverses the memory pool for only a specific IR node
33149 : // and calls the visit function of the input class execute a traversal
33150 : // similar to the style of the attribute based traversals within ROSE.
33151 : // This traversal will visit ALL nodes of the AST where as the other
33152 : // attribute based traversals visit only the embedded tree within the AST.
33153 :
33154 : // Initialize array to the address of the first element of the STL vector
33155 : // (which is guaranteed to be contiguous storage).
33156 : // SgOmpDestroyClause objectArray [] = *(Memory_Block_List.begin());
33157 5342 : if (SgOmpDestroyClause::pools.empty() == false)
33158 : {
33159 : // Generate an array of memory pools
33160 7 : SgOmpDestroyClause** objectArray = (SgOmpDestroyClause**) &(SgOmpDestroyClause::pools[0]);
33161 :
33162 : // Build a local variable for better performance
33163 7 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
33164 : #if 0
33165 : // Iterate over the memory pools
33166 : for (unsigned int i=0; i < SgOmpDestroyClause::pools.size(); i++)
33167 : {
33168 : // objectArray[i] is a single memory pool
33169 : for (int j=0; j < SgOmpDestroyClause::pool_size; j++)
33170 : {
33171 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
33172 : {
33173 : traversal.visit(&(objectArray[i][j]));
33174 : }
33175 : }
33176 : }
33177 : #else
33178 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
33179 : // compute the list first and then call the visit function on each list element.
33180 :
33181 : // printf ("Inside of SgOmpDestroyClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
33182 :
33183 14 : std::vector<SgOmpDestroyClause*> nodeList;
33184 :
33185 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
33186 14 : for (unsigned int i=0; i < SgOmpDestroyClause::pools.size(); i++)
33187 : {
33188 : // objectArray[i] is a single memory pool
33189 14007 : for (unsigned j=0; j < SgOmpDestroyClause::pool_size; j++)
33190 : {
33191 14000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
33192 : {
33193 7 : nodeList.push_back(&(objectArray[i][j]));
33194 : }
33195 : }
33196 : }
33197 :
33198 : // Iterate over the saved list
33199 7 : size_t nodeListSize = nodeList.size();
33200 14 : for (size_t i=0; i < nodeListSize; i++)
33201 : {
33202 7 : ROSE_ASSERT(nodeList[i] != NULL);
33203 : #if 0
33204 : traversal.visit(nodeList[i]);
33205 : #else
33206 7 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
33207 : {
33208 7 : traversal.visit(nodeList[i]);
33209 : }
33210 : #endif
33211 : }
33212 : #endif
33213 : }
33214 :
33215 : // This should not be required since all previously static data members are
33216 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
33217 :
33218 5342 : }
33219 :
33220 :
33221 : void
33222 194 : SgOmpDestroyClause::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
33223 : {
33224 : // This function traverses the memory pool for an IR node and
33225 : // calls the function to execute the visitor object.
33226 :
33227 : // Initialize array to the address of the first element of the STL vector
33228 : // (which is guarenteed to be contiguous storage).
33229 : // SgOmpDestroyClause objectArray [] = *(Memory_Block_List.begin());
33230 194 : if (SgOmpDestroyClause::pools.empty() == false)
33231 : {
33232 : // Generate an array of memory pools
33233 0 : SgOmpDestroyClause** objectArray = (SgOmpDestroyClause**) &(SgOmpDestroyClause::pools[0]);
33234 :
33235 : // Build a local variable for better performance
33236 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
33237 :
33238 : // Iterate over the memory pools
33239 0 : for (unsigned int i=0; i < SgOmpDestroyClause::pools.size(); i++)
33240 : {
33241 : // objectArray[i] is a single memory pool
33242 0 : for (unsigned j=0; j < SgOmpDestroyClause::pool_size; j++)
33243 : {
33244 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
33245 : {
33246 : // printf ("Found a valid SgOmpDestroyClause object in the memory pool %d at position %d \n",i,j);
33247 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
33248 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
33249 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
33250 : }
33251 : else
33252 : {
33253 : // printf ("Found a INVALID SgOmpDestroyClause object in the memory pool \n");
33254 : }
33255 : }
33256 : }
33257 : }
33258 :
33259 : // This should not be required since all previously static data members are
33260 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
33261 :
33262 194 : }
33263 :
33264 : void
33265 0 : SgOmpDestroyClause::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
33266 : {
33267 : // This function visits only a single IR node of the memory pool.
33268 : // it is typically called once for each type of IR node within
33269 : // the automatically generated function: traverseRepresentativeNodes().
33270 :
33271 : // Initialize array to the address of the first element of the STL vector
33272 : // (which is guarenteed to be contiguous storage).
33273 : // SgOmpDestroyClause objectArray [] = *(Memory_Block_List.begin());
33274 0 : if (SgOmpDestroyClause::pools.empty() == false)
33275 : {
33276 : // Generate an array of memory pools
33277 0 : SgOmpDestroyClause** objectArray = (SgOmpDestroyClause**) &(SgOmpDestroyClause::pools[0]);
33278 :
33279 : // Build a local variable for better performance
33280 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
33281 :
33282 : // Iterate over the memory pools
33283 0 : bool done = false;
33284 0 : unsigned i=0;
33285 :
33286 : // find the first valid IR node, call visit function, and then leave
33287 0 : while ( done == false && i < SgOmpDestroyClause::pools.size() )
33288 : {
33289 : // objectArray[i] is a single memory pool
33290 : unsigned j=0;
33291 0 : while (done == false && j < SgOmpDestroyClause::pool_size)
33292 : {
33293 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
33294 : {
33295 0 : traversal.visit(&(objectArray[i][j]));
33296 0 : done = true;
33297 : }
33298 0 : j++;
33299 : }
33300 0 : i++;
33301 : }
33302 :
33303 : #if 0
33304 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
33305 : if (done == false)
33306 : {
33307 : printf ("No representative for SgOmpDestroyClause found in memory pools \n");
33308 : }
33309 : #endif
33310 : }
33311 0 : }
33312 :
33313 :
33314 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
33315 : // using values that overflow signed values of int.
33316 : size_t
33317 4 : SgOmpDestroyClause::numberOfNodes()
33318 : {
33319 : // This function traverses the memory pool for an IR node and
33320 : // counts the number of IR nodes of a particular Sage III IR
33321 : // nodes type.
33322 :
33323 4 : size_t count = 0;
33324 4 : if (SgOmpDestroyClause::pools.empty() == false)
33325 : {
33326 : // Generate an array of memory pools (this is actually a STL vector,
33327 : // but it is contiguious, so OK to treat this way).
33328 0 : SgOmpDestroyClause** objectArray = (SgOmpDestroyClause**) &(SgOmpDestroyClause::pools[0]);
33329 :
33330 : // Build a local variable for better performance (make it a loop invariant variable).
33331 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
33332 :
33333 : // Iterate over all of the memory pools for this IR node.
33334 0 : for (unsigned int i=0; i < SgOmpDestroyClause::pools.size(); i++)
33335 : {
33336 : // objectArray[i] is a single memory pool, iterate over all the
33337 : // IR nodes and only count those that are valid IR nodes used in
33338 : // the AST (i.e. allocated IR nodes).
33339 0 : for (unsigned j=0; j < SgOmpDestroyClause::pool_size; j++)
33340 : {
33341 : // This is indexing the STL vector of C/C++ style arrays as a doubly
33342 : // indexed array access. It is OK since we have leveraged the semantics
33343 : // of STL vector memory as contigous and cast the memory as an array
33344 : // of arrays to use the 2D array indexing. Hope this is not confusing,
33345 : // but it s very fast as an implementation.
33346 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
33347 : {
33348 0 : count++;
33349 : }
33350 : }
33351 : }
33352 : }
33353 :
33354 :
33355 :
33356 4 : return count;
33357 : }
33358 :
33359 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
33360 : // using values that overflow signed values of int.
33361 : size_t
33362 0 : SgOmpDestroyClause::memoryUsage()
33363 : {
33364 : // This function is required because we need the class name as a type when we call sizeof
33365 : // There might be another way to implement this if we have a traversal that only called a
33366 : // representative object (one call for each type of Sage IIIIR node).
33367 0 : size_t memory = numberOfNodes() * sizeof(SgOmpDestroyClause);
33368 :
33369 0 : return memory;
33370 : }
33371 :
33372 : /* #line 33373 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
33373 :
33374 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
33375 : void
33376 5342 : SgOmpCaptureClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
33377 : {
33378 : // This function traverses the memory pool for only a specific IR node
33379 : // and calls the visit function of the input class execute a traversal
33380 : // similar to the style of the attribute based traversals within ROSE.
33381 : // This traversal will visit ALL nodes of the AST where as the other
33382 : // attribute based traversals visit only the embedded tree within the AST.
33383 :
33384 : // Initialize array to the address of the first element of the STL vector
33385 : // (which is guaranteed to be contiguous storage).
33386 : // SgOmpCaptureClause objectArray [] = *(Memory_Block_List.begin());
33387 5342 : if (SgOmpCaptureClause::pools.empty() == false)
33388 : {
33389 : // Generate an array of memory pools
33390 7 : SgOmpCaptureClause** objectArray = (SgOmpCaptureClause**) &(SgOmpCaptureClause::pools[0]);
33391 :
33392 : // Build a local variable for better performance
33393 7 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
33394 : #if 0
33395 : // Iterate over the memory pools
33396 : for (unsigned int i=0; i < SgOmpCaptureClause::pools.size(); i++)
33397 : {
33398 : // objectArray[i] is a single memory pool
33399 : for (int j=0; j < SgOmpCaptureClause::pool_size; j++)
33400 : {
33401 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
33402 : {
33403 : traversal.visit(&(objectArray[i][j]));
33404 : }
33405 : }
33406 : }
33407 : #else
33408 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
33409 : // compute the list first and then call the visit function on each list element.
33410 :
33411 : // printf ("Inside of SgOmpCaptureClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
33412 :
33413 14 : std::vector<SgOmpCaptureClause*> nodeList;
33414 :
33415 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
33416 14 : for (unsigned int i=0; i < SgOmpCaptureClause::pools.size(); i++)
33417 : {
33418 : // objectArray[i] is a single memory pool
33419 14007 : for (unsigned j=0; j < SgOmpCaptureClause::pool_size; j++)
33420 : {
33421 14000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
33422 : {
33423 7 : nodeList.push_back(&(objectArray[i][j]));
33424 : }
33425 : }
33426 : }
33427 :
33428 : // Iterate over the saved list
33429 7 : size_t nodeListSize = nodeList.size();
33430 14 : for (size_t i=0; i < nodeListSize; i++)
33431 : {
33432 7 : ROSE_ASSERT(nodeList[i] != NULL);
33433 : #if 0
33434 : traversal.visit(nodeList[i]);
33435 : #else
33436 7 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
33437 : {
33438 7 : traversal.visit(nodeList[i]);
33439 : }
33440 : #endif
33441 : }
33442 : #endif
33443 : }
33444 :
33445 : // This should not be required since all previously static data members are
33446 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
33447 :
33448 5342 : }
33449 :
33450 :
33451 : void
33452 194 : SgOmpCaptureClause::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
33453 : {
33454 : // This function traverses the memory pool for an IR node and
33455 : // calls the function to execute the visitor object.
33456 :
33457 : // Initialize array to the address of the first element of the STL vector
33458 : // (which is guarenteed to be contiguous storage).
33459 : // SgOmpCaptureClause objectArray [] = *(Memory_Block_List.begin());
33460 194 : if (SgOmpCaptureClause::pools.empty() == false)
33461 : {
33462 : // Generate an array of memory pools
33463 0 : SgOmpCaptureClause** objectArray = (SgOmpCaptureClause**) &(SgOmpCaptureClause::pools[0]);
33464 :
33465 : // Build a local variable for better performance
33466 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
33467 :
33468 : // Iterate over the memory pools
33469 0 : for (unsigned int i=0; i < SgOmpCaptureClause::pools.size(); i++)
33470 : {
33471 : // objectArray[i] is a single memory pool
33472 0 : for (unsigned j=0; j < SgOmpCaptureClause::pool_size; j++)
33473 : {
33474 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
33475 : {
33476 : // printf ("Found a valid SgOmpCaptureClause object in the memory pool %d at position %d \n",i,j);
33477 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
33478 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
33479 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
33480 : }
33481 : else
33482 : {
33483 : // printf ("Found a INVALID SgOmpCaptureClause object in the memory pool \n");
33484 : }
33485 : }
33486 : }
33487 : }
33488 :
33489 : // This should not be required since all previously static data members are
33490 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
33491 :
33492 194 : }
33493 :
33494 : void
33495 0 : SgOmpCaptureClause::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
33496 : {
33497 : // This function visits only a single IR node of the memory pool.
33498 : // it is typically called once for each type of IR node within
33499 : // the automatically generated function: traverseRepresentativeNodes().
33500 :
33501 : // Initialize array to the address of the first element of the STL vector
33502 : // (which is guarenteed to be contiguous storage).
33503 : // SgOmpCaptureClause objectArray [] = *(Memory_Block_List.begin());
33504 0 : if (SgOmpCaptureClause::pools.empty() == false)
33505 : {
33506 : // Generate an array of memory pools
33507 0 : SgOmpCaptureClause** objectArray = (SgOmpCaptureClause**) &(SgOmpCaptureClause::pools[0]);
33508 :
33509 : // Build a local variable for better performance
33510 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
33511 :
33512 : // Iterate over the memory pools
33513 0 : bool done = false;
33514 0 : unsigned i=0;
33515 :
33516 : // find the first valid IR node, call visit function, and then leave
33517 0 : while ( done == false && i < SgOmpCaptureClause::pools.size() )
33518 : {
33519 : // objectArray[i] is a single memory pool
33520 : unsigned j=0;
33521 0 : while (done == false && j < SgOmpCaptureClause::pool_size)
33522 : {
33523 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
33524 : {
33525 0 : traversal.visit(&(objectArray[i][j]));
33526 0 : done = true;
33527 : }
33528 0 : j++;
33529 : }
33530 0 : i++;
33531 : }
33532 :
33533 : #if 0
33534 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
33535 : if (done == false)
33536 : {
33537 : printf ("No representative for SgOmpCaptureClause found in memory pools \n");
33538 : }
33539 : #endif
33540 : }
33541 0 : }
33542 :
33543 :
33544 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
33545 : // using values that overflow signed values of int.
33546 : size_t
33547 4 : SgOmpCaptureClause::numberOfNodes()
33548 : {
33549 : // This function traverses the memory pool for an IR node and
33550 : // counts the number of IR nodes of a particular Sage III IR
33551 : // nodes type.
33552 :
33553 4 : size_t count = 0;
33554 4 : if (SgOmpCaptureClause::pools.empty() == false)
33555 : {
33556 : // Generate an array of memory pools (this is actually a STL vector,
33557 : // but it is contiguious, so OK to treat this way).
33558 0 : SgOmpCaptureClause** objectArray = (SgOmpCaptureClause**) &(SgOmpCaptureClause::pools[0]);
33559 :
33560 : // Build a local variable for better performance (make it a loop invariant variable).
33561 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
33562 :
33563 : // Iterate over all of the memory pools for this IR node.
33564 0 : for (unsigned int i=0; i < SgOmpCaptureClause::pools.size(); i++)
33565 : {
33566 : // objectArray[i] is a single memory pool, iterate over all the
33567 : // IR nodes and only count those that are valid IR nodes used in
33568 : // the AST (i.e. allocated IR nodes).
33569 0 : for (unsigned j=0; j < SgOmpCaptureClause::pool_size; j++)
33570 : {
33571 : // This is indexing the STL vector of C/C++ style arrays as a doubly
33572 : // indexed array access. It is OK since we have leveraged the semantics
33573 : // of STL vector memory as contigous and cast the memory as an array
33574 : // of arrays to use the 2D array indexing. Hope this is not confusing,
33575 : // but it s very fast as an implementation.
33576 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
33577 : {
33578 0 : count++;
33579 : }
33580 : }
33581 : }
33582 : }
33583 :
33584 :
33585 :
33586 4 : return count;
33587 : }
33588 :
33589 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
33590 : // using values that overflow signed values of int.
33591 : size_t
33592 0 : SgOmpCaptureClause::memoryUsage()
33593 : {
33594 : // This function is required because we need the class name as a type when we call sizeof
33595 : // There might be another way to implement this if we have a traversal that only called a
33596 : // representative object (one call for each type of Sage IIIIR node).
33597 0 : size_t memory = numberOfNodes() * sizeof(SgOmpCaptureClause);
33598 :
33599 0 : return memory;
33600 : }
33601 :
33602 : /* #line 33603 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
33603 :
33604 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
33605 : void
33606 5342 : SgOmpBeginClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
33607 : {
33608 : // This function traverses the memory pool for only a specific IR node
33609 : // and calls the visit function of the input class execute a traversal
33610 : // similar to the style of the attribute based traversals within ROSE.
33611 : // This traversal will visit ALL nodes of the AST where as the other
33612 : // attribute based traversals visit only the embedded tree within the AST.
33613 :
33614 : // Initialize array to the address of the first element of the STL vector
33615 : // (which is guaranteed to be contiguous storage).
33616 : // SgOmpBeginClause objectArray [] = *(Memory_Block_List.begin());
33617 5342 : if (SgOmpBeginClause::pools.empty() == false)
33618 : {
33619 : // Generate an array of memory pools
33620 0 : SgOmpBeginClause** objectArray = (SgOmpBeginClause**) &(SgOmpBeginClause::pools[0]);
33621 :
33622 : // Build a local variable for better performance
33623 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
33624 : #if 0
33625 : // Iterate over the memory pools
33626 : for (unsigned int i=0; i < SgOmpBeginClause::pools.size(); i++)
33627 : {
33628 : // objectArray[i] is a single memory pool
33629 : for (int j=0; j < SgOmpBeginClause::pool_size; j++)
33630 : {
33631 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
33632 : {
33633 : traversal.visit(&(objectArray[i][j]));
33634 : }
33635 : }
33636 : }
33637 : #else
33638 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
33639 : // compute the list first and then call the visit function on each list element.
33640 :
33641 : // printf ("Inside of SgOmpBeginClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
33642 :
33643 0 : std::vector<SgOmpBeginClause*> nodeList;
33644 :
33645 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
33646 0 : for (unsigned int i=0; i < SgOmpBeginClause::pools.size(); i++)
33647 : {
33648 : // objectArray[i] is a single memory pool
33649 0 : for (unsigned j=0; j < SgOmpBeginClause::pool_size; j++)
33650 : {
33651 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
33652 : {
33653 0 : nodeList.push_back(&(objectArray[i][j]));
33654 : }
33655 : }
33656 : }
33657 :
33658 : // Iterate over the saved list
33659 0 : size_t nodeListSize = nodeList.size();
33660 0 : for (size_t i=0; i < nodeListSize; i++)
33661 : {
33662 0 : ROSE_ASSERT(nodeList[i] != NULL);
33663 : #if 0
33664 : traversal.visit(nodeList[i]);
33665 : #else
33666 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
33667 : {
33668 0 : traversal.visit(nodeList[i]);
33669 : }
33670 : #endif
33671 : }
33672 : #endif
33673 : }
33674 :
33675 : // This should not be required since all previously static data members are
33676 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
33677 :
33678 5342 : }
33679 :
33680 :
33681 : void
33682 194 : SgOmpBeginClause::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
33683 : {
33684 : // This function traverses the memory pool for an IR node and
33685 : // calls the function to execute the visitor object.
33686 :
33687 : // Initialize array to the address of the first element of the STL vector
33688 : // (which is guarenteed to be contiguous storage).
33689 : // SgOmpBeginClause objectArray [] = *(Memory_Block_List.begin());
33690 194 : if (SgOmpBeginClause::pools.empty() == false)
33691 : {
33692 : // Generate an array of memory pools
33693 0 : SgOmpBeginClause** objectArray = (SgOmpBeginClause**) &(SgOmpBeginClause::pools[0]);
33694 :
33695 : // Build a local variable for better performance
33696 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
33697 :
33698 : // Iterate over the memory pools
33699 0 : for (unsigned int i=0; i < SgOmpBeginClause::pools.size(); i++)
33700 : {
33701 : // objectArray[i] is a single memory pool
33702 0 : for (unsigned j=0; j < SgOmpBeginClause::pool_size; j++)
33703 : {
33704 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
33705 : {
33706 : // printf ("Found a valid SgOmpBeginClause object in the memory pool %d at position %d \n",i,j);
33707 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
33708 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
33709 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
33710 : }
33711 : else
33712 : {
33713 : // printf ("Found a INVALID SgOmpBeginClause object in the memory pool \n");
33714 : }
33715 : }
33716 : }
33717 : }
33718 :
33719 : // This should not be required since all previously static data members are
33720 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
33721 :
33722 194 : }
33723 :
33724 : void
33725 0 : SgOmpBeginClause::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
33726 : {
33727 : // This function visits only a single IR node of the memory pool.
33728 : // it is typically called once for each type of IR node within
33729 : // the automatically generated function: traverseRepresentativeNodes().
33730 :
33731 : // Initialize array to the address of the first element of the STL vector
33732 : // (which is guarenteed to be contiguous storage).
33733 : // SgOmpBeginClause objectArray [] = *(Memory_Block_List.begin());
33734 0 : if (SgOmpBeginClause::pools.empty() == false)
33735 : {
33736 : // Generate an array of memory pools
33737 0 : SgOmpBeginClause** objectArray = (SgOmpBeginClause**) &(SgOmpBeginClause::pools[0]);
33738 :
33739 : // Build a local variable for better performance
33740 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
33741 :
33742 : // Iterate over the memory pools
33743 0 : bool done = false;
33744 0 : unsigned i=0;
33745 :
33746 : // find the first valid IR node, call visit function, and then leave
33747 0 : while ( done == false && i < SgOmpBeginClause::pools.size() )
33748 : {
33749 : // objectArray[i] is a single memory pool
33750 : unsigned j=0;
33751 0 : while (done == false && j < SgOmpBeginClause::pool_size)
33752 : {
33753 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
33754 : {
33755 0 : traversal.visit(&(objectArray[i][j]));
33756 0 : done = true;
33757 : }
33758 0 : j++;
33759 : }
33760 0 : i++;
33761 : }
33762 :
33763 : #if 0
33764 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
33765 : if (done == false)
33766 : {
33767 : printf ("No representative for SgOmpBeginClause found in memory pools \n");
33768 : }
33769 : #endif
33770 : }
33771 0 : }
33772 :
33773 :
33774 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
33775 : // using values that overflow signed values of int.
33776 : size_t
33777 4 : SgOmpBeginClause::numberOfNodes()
33778 : {
33779 : // This function traverses the memory pool for an IR node and
33780 : // counts the number of IR nodes of a particular Sage III IR
33781 : // nodes type.
33782 :
33783 4 : size_t count = 0;
33784 4 : if (SgOmpBeginClause::pools.empty() == false)
33785 : {
33786 : // Generate an array of memory pools (this is actually a STL vector,
33787 : // but it is contiguious, so OK to treat this way).
33788 0 : SgOmpBeginClause** objectArray = (SgOmpBeginClause**) &(SgOmpBeginClause::pools[0]);
33789 :
33790 : // Build a local variable for better performance (make it a loop invariant variable).
33791 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
33792 :
33793 : // Iterate over all of the memory pools for this IR node.
33794 0 : for (unsigned int i=0; i < SgOmpBeginClause::pools.size(); i++)
33795 : {
33796 : // objectArray[i] is a single memory pool, iterate over all the
33797 : // IR nodes and only count those that are valid IR nodes used in
33798 : // the AST (i.e. allocated IR nodes).
33799 0 : for (unsigned j=0; j < SgOmpBeginClause::pool_size; j++)
33800 : {
33801 : // This is indexing the STL vector of C/C++ style arrays as a doubly
33802 : // indexed array access. It is OK since we have leveraged the semantics
33803 : // of STL vector memory as contigous and cast the memory as an array
33804 : // of arrays to use the 2D array indexing. Hope this is not confusing,
33805 : // but it s very fast as an implementation.
33806 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
33807 : {
33808 0 : count++;
33809 : }
33810 : }
33811 : }
33812 : }
33813 :
33814 :
33815 :
33816 4 : return count;
33817 : }
33818 :
33819 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
33820 : // using values that overflow signed values of int.
33821 : size_t
33822 0 : SgOmpBeginClause::memoryUsage()
33823 : {
33824 : // This function is required because we need the class name as a type when we call sizeof
33825 : // There might be another way to implement this if we have a traversal that only called a
33826 : // representative object (one call for each type of Sage IIIIR node).
33827 0 : size_t memory = numberOfNodes() * sizeof(SgOmpBeginClause);
33828 :
33829 0 : return memory;
33830 : }
33831 :
33832 : /* #line 33833 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
33833 :
33834 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
33835 : void
33836 5342 : SgOmpEndClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
33837 : {
33838 : // This function traverses the memory pool for only a specific IR node
33839 : // and calls the visit function of the input class execute a traversal
33840 : // similar to the style of the attribute based traversals within ROSE.
33841 : // This traversal will visit ALL nodes of the AST where as the other
33842 : // attribute based traversals visit only the embedded tree within the AST.
33843 :
33844 : // Initialize array to the address of the first element of the STL vector
33845 : // (which is guaranteed to be contiguous storage).
33846 : // SgOmpEndClause objectArray [] = *(Memory_Block_List.begin());
33847 5342 : if (SgOmpEndClause::pools.empty() == false)
33848 : {
33849 : // Generate an array of memory pools
33850 0 : SgOmpEndClause** objectArray = (SgOmpEndClause**) &(SgOmpEndClause::pools[0]);
33851 :
33852 : // Build a local variable for better performance
33853 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
33854 : #if 0
33855 : // Iterate over the memory pools
33856 : for (unsigned int i=0; i < SgOmpEndClause::pools.size(); i++)
33857 : {
33858 : // objectArray[i] is a single memory pool
33859 : for (int j=0; j < SgOmpEndClause::pool_size; j++)
33860 : {
33861 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
33862 : {
33863 : traversal.visit(&(objectArray[i][j]));
33864 : }
33865 : }
33866 : }
33867 : #else
33868 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
33869 : // compute the list first and then call the visit function on each list element.
33870 :
33871 : // printf ("Inside of SgOmpEndClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
33872 :
33873 0 : std::vector<SgOmpEndClause*> nodeList;
33874 :
33875 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
33876 0 : for (unsigned int i=0; i < SgOmpEndClause::pools.size(); i++)
33877 : {
33878 : // objectArray[i] is a single memory pool
33879 0 : for (unsigned j=0; j < SgOmpEndClause::pool_size; j++)
33880 : {
33881 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
33882 : {
33883 0 : nodeList.push_back(&(objectArray[i][j]));
33884 : }
33885 : }
33886 : }
33887 :
33888 : // Iterate over the saved list
33889 0 : size_t nodeListSize = nodeList.size();
33890 0 : for (size_t i=0; i < nodeListSize; i++)
33891 : {
33892 0 : ROSE_ASSERT(nodeList[i] != NULL);
33893 : #if 0
33894 : traversal.visit(nodeList[i]);
33895 : #else
33896 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
33897 : {
33898 0 : traversal.visit(nodeList[i]);
33899 : }
33900 : #endif
33901 : }
33902 : #endif
33903 : }
33904 :
33905 : // This should not be required since all previously static data members are
33906 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
33907 :
33908 5342 : }
33909 :
33910 :
33911 : void
33912 194 : SgOmpEndClause::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
33913 : {
33914 : // This function traverses the memory pool for an IR node and
33915 : // calls the function to execute the visitor object.
33916 :
33917 : // Initialize array to the address of the first element of the STL vector
33918 : // (which is guarenteed to be contiguous storage).
33919 : // SgOmpEndClause objectArray [] = *(Memory_Block_List.begin());
33920 194 : if (SgOmpEndClause::pools.empty() == false)
33921 : {
33922 : // Generate an array of memory pools
33923 0 : SgOmpEndClause** objectArray = (SgOmpEndClause**) &(SgOmpEndClause::pools[0]);
33924 :
33925 : // Build a local variable for better performance
33926 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
33927 :
33928 : // Iterate over the memory pools
33929 0 : for (unsigned int i=0; i < SgOmpEndClause::pools.size(); i++)
33930 : {
33931 : // objectArray[i] is a single memory pool
33932 0 : for (unsigned j=0; j < SgOmpEndClause::pool_size; j++)
33933 : {
33934 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
33935 : {
33936 : // printf ("Found a valid SgOmpEndClause object in the memory pool %d at position %d \n",i,j);
33937 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
33938 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
33939 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
33940 : }
33941 : else
33942 : {
33943 : // printf ("Found a INVALID SgOmpEndClause object in the memory pool \n");
33944 : }
33945 : }
33946 : }
33947 : }
33948 :
33949 : // This should not be required since all previously static data members are
33950 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
33951 :
33952 194 : }
33953 :
33954 : void
33955 0 : SgOmpEndClause::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
33956 : {
33957 : // This function visits only a single IR node of the memory pool.
33958 : // it is typically called once for each type of IR node within
33959 : // the automatically generated function: traverseRepresentativeNodes().
33960 :
33961 : // Initialize array to the address of the first element of the STL vector
33962 : // (which is guarenteed to be contiguous storage).
33963 : // SgOmpEndClause objectArray [] = *(Memory_Block_List.begin());
33964 0 : if (SgOmpEndClause::pools.empty() == false)
33965 : {
33966 : // Generate an array of memory pools
33967 0 : SgOmpEndClause** objectArray = (SgOmpEndClause**) &(SgOmpEndClause::pools[0]);
33968 :
33969 : // Build a local variable for better performance
33970 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
33971 :
33972 : // Iterate over the memory pools
33973 0 : bool done = false;
33974 0 : unsigned i=0;
33975 :
33976 : // find the first valid IR node, call visit function, and then leave
33977 0 : while ( done == false && i < SgOmpEndClause::pools.size() )
33978 : {
33979 : // objectArray[i] is a single memory pool
33980 : unsigned j=0;
33981 0 : while (done == false && j < SgOmpEndClause::pool_size)
33982 : {
33983 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
33984 : {
33985 0 : traversal.visit(&(objectArray[i][j]));
33986 0 : done = true;
33987 : }
33988 0 : j++;
33989 : }
33990 0 : i++;
33991 : }
33992 :
33993 : #if 0
33994 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
33995 : if (done == false)
33996 : {
33997 : printf ("No representative for SgOmpEndClause found in memory pools \n");
33998 : }
33999 : #endif
34000 : }
34001 0 : }
34002 :
34003 :
34004 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
34005 : // using values that overflow signed values of int.
34006 : size_t
34007 4 : SgOmpEndClause::numberOfNodes()
34008 : {
34009 : // This function traverses the memory pool for an IR node and
34010 : // counts the number of IR nodes of a particular Sage III IR
34011 : // nodes type.
34012 :
34013 4 : size_t count = 0;
34014 4 : if (SgOmpEndClause::pools.empty() == false)
34015 : {
34016 : // Generate an array of memory pools (this is actually a STL vector,
34017 : // but it is contiguious, so OK to treat this way).
34018 0 : SgOmpEndClause** objectArray = (SgOmpEndClause**) &(SgOmpEndClause::pools[0]);
34019 :
34020 : // Build a local variable for better performance (make it a loop invariant variable).
34021 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
34022 :
34023 : // Iterate over all of the memory pools for this IR node.
34024 0 : for (unsigned int i=0; i < SgOmpEndClause::pools.size(); i++)
34025 : {
34026 : // objectArray[i] is a single memory pool, iterate over all the
34027 : // IR nodes and only count those that are valid IR nodes used in
34028 : // the AST (i.e. allocated IR nodes).
34029 0 : for (unsigned j=0; j < SgOmpEndClause::pool_size; j++)
34030 : {
34031 : // This is indexing the STL vector of C/C++ style arrays as a doubly
34032 : // indexed array access. It is OK since we have leveraged the semantics
34033 : // of STL vector memory as contigous and cast the memory as an array
34034 : // of arrays to use the 2D array indexing. Hope this is not confusing,
34035 : // but it s very fast as an implementation.
34036 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
34037 : {
34038 0 : count++;
34039 : }
34040 : }
34041 : }
34042 : }
34043 :
34044 :
34045 :
34046 4 : return count;
34047 : }
34048 :
34049 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
34050 : // using values that overflow signed values of int.
34051 : size_t
34052 0 : SgOmpEndClause::memoryUsage()
34053 : {
34054 : // This function is required because we need the class name as a type when we call sizeof
34055 : // There might be another way to implement this if we have a traversal that only called a
34056 : // representative object (one call for each type of Sage IIIIR node).
34057 0 : size_t memory = numberOfNodes() * sizeof(SgOmpEndClause);
34058 :
34059 0 : return memory;
34060 : }
34061 :
34062 : /* #line 34063 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
34063 :
34064 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
34065 : void
34066 5342 : SgOmpUntiedClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
34067 : {
34068 : // This function traverses the memory pool for only a specific IR node
34069 : // and calls the visit function of the input class execute a traversal
34070 : // similar to the style of the attribute based traversals within ROSE.
34071 : // This traversal will visit ALL nodes of the AST where as the other
34072 : // attribute based traversals visit only the embedded tree within the AST.
34073 :
34074 : // Initialize array to the address of the first element of the STL vector
34075 : // (which is guaranteed to be contiguous storage).
34076 : // SgOmpUntiedClause objectArray [] = *(Memory_Block_List.begin());
34077 5342 : if (SgOmpUntiedClause::pools.empty() == false)
34078 : {
34079 : // Generate an array of memory pools
34080 35 : SgOmpUntiedClause** objectArray = (SgOmpUntiedClause**) &(SgOmpUntiedClause::pools[0]);
34081 :
34082 : // Build a local variable for better performance
34083 35 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
34084 : #if 0
34085 : // Iterate over the memory pools
34086 : for (unsigned int i=0; i < SgOmpUntiedClause::pools.size(); i++)
34087 : {
34088 : // objectArray[i] is a single memory pool
34089 : for (int j=0; j < SgOmpUntiedClause::pool_size; j++)
34090 : {
34091 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
34092 : {
34093 : traversal.visit(&(objectArray[i][j]));
34094 : }
34095 : }
34096 : }
34097 : #else
34098 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
34099 : // compute the list first and then call the visit function on each list element.
34100 :
34101 : // printf ("Inside of SgOmpUntiedClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
34102 :
34103 70 : std::vector<SgOmpUntiedClause*> nodeList;
34104 :
34105 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
34106 70 : for (unsigned int i=0; i < SgOmpUntiedClause::pools.size(); i++)
34107 : {
34108 : // objectArray[i] is a single memory pool
34109 70035 : for (unsigned j=0; j < SgOmpUntiedClause::pool_size; j++)
34110 : {
34111 70000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
34112 : {
34113 35 : nodeList.push_back(&(objectArray[i][j]));
34114 : }
34115 : }
34116 : }
34117 :
34118 : // Iterate over the saved list
34119 35 : size_t nodeListSize = nodeList.size();
34120 70 : for (size_t i=0; i < nodeListSize; i++)
34121 : {
34122 35 : ROSE_ASSERT(nodeList[i] != NULL);
34123 : #if 0
34124 : traversal.visit(nodeList[i]);
34125 : #else
34126 35 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
34127 : {
34128 35 : traversal.visit(nodeList[i]);
34129 : }
34130 : #endif
34131 : }
34132 : #endif
34133 : }
34134 :
34135 : // This should not be required since all previously static data members are
34136 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
34137 :
34138 5342 : }
34139 :
34140 :
34141 : void
34142 194 : SgOmpUntiedClause::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
34143 : {
34144 : // This function traverses the memory pool for an IR node and
34145 : // calls the function to execute the visitor object.
34146 :
34147 : // Initialize array to the address of the first element of the STL vector
34148 : // (which is guarenteed to be contiguous storage).
34149 : // SgOmpUntiedClause objectArray [] = *(Memory_Block_List.begin());
34150 194 : if (SgOmpUntiedClause::pools.empty() == false)
34151 : {
34152 : // Generate an array of memory pools
34153 0 : SgOmpUntiedClause** objectArray = (SgOmpUntiedClause**) &(SgOmpUntiedClause::pools[0]);
34154 :
34155 : // Build a local variable for better performance
34156 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
34157 :
34158 : // Iterate over the memory pools
34159 0 : for (unsigned int i=0; i < SgOmpUntiedClause::pools.size(); i++)
34160 : {
34161 : // objectArray[i] is a single memory pool
34162 0 : for (unsigned j=0; j < SgOmpUntiedClause::pool_size; j++)
34163 : {
34164 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
34165 : {
34166 : // printf ("Found a valid SgOmpUntiedClause object in the memory pool %d at position %d \n",i,j);
34167 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
34168 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
34169 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
34170 : }
34171 : else
34172 : {
34173 : // printf ("Found a INVALID SgOmpUntiedClause object in the memory pool \n");
34174 : }
34175 : }
34176 : }
34177 : }
34178 :
34179 : // This should not be required since all previously static data members are
34180 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
34181 :
34182 194 : }
34183 :
34184 : void
34185 0 : SgOmpUntiedClause::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
34186 : {
34187 : // This function visits only a single IR node of the memory pool.
34188 : // it is typically called once for each type of IR node within
34189 : // the automatically generated function: traverseRepresentativeNodes().
34190 :
34191 : // Initialize array to the address of the first element of the STL vector
34192 : // (which is guarenteed to be contiguous storage).
34193 : // SgOmpUntiedClause objectArray [] = *(Memory_Block_List.begin());
34194 0 : if (SgOmpUntiedClause::pools.empty() == false)
34195 : {
34196 : // Generate an array of memory pools
34197 0 : SgOmpUntiedClause** objectArray = (SgOmpUntiedClause**) &(SgOmpUntiedClause::pools[0]);
34198 :
34199 : // Build a local variable for better performance
34200 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
34201 :
34202 : // Iterate over the memory pools
34203 0 : bool done = false;
34204 0 : unsigned i=0;
34205 :
34206 : // find the first valid IR node, call visit function, and then leave
34207 0 : while ( done == false && i < SgOmpUntiedClause::pools.size() )
34208 : {
34209 : // objectArray[i] is a single memory pool
34210 : unsigned j=0;
34211 0 : while (done == false && j < SgOmpUntiedClause::pool_size)
34212 : {
34213 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
34214 : {
34215 0 : traversal.visit(&(objectArray[i][j]));
34216 0 : done = true;
34217 : }
34218 0 : j++;
34219 : }
34220 0 : i++;
34221 : }
34222 :
34223 : #if 0
34224 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
34225 : if (done == false)
34226 : {
34227 : printf ("No representative for SgOmpUntiedClause found in memory pools \n");
34228 : }
34229 : #endif
34230 : }
34231 0 : }
34232 :
34233 :
34234 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
34235 : // using values that overflow signed values of int.
34236 : size_t
34237 4 : SgOmpUntiedClause::numberOfNodes()
34238 : {
34239 : // This function traverses the memory pool for an IR node and
34240 : // counts the number of IR nodes of a particular Sage III IR
34241 : // nodes type.
34242 :
34243 4 : size_t count = 0;
34244 4 : if (SgOmpUntiedClause::pools.empty() == false)
34245 : {
34246 : // Generate an array of memory pools (this is actually a STL vector,
34247 : // but it is contiguious, so OK to treat this way).
34248 0 : SgOmpUntiedClause** objectArray = (SgOmpUntiedClause**) &(SgOmpUntiedClause::pools[0]);
34249 :
34250 : // Build a local variable for better performance (make it a loop invariant variable).
34251 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
34252 :
34253 : // Iterate over all of the memory pools for this IR node.
34254 0 : for (unsigned int i=0; i < SgOmpUntiedClause::pools.size(); i++)
34255 : {
34256 : // objectArray[i] is a single memory pool, iterate over all the
34257 : // IR nodes and only count those that are valid IR nodes used in
34258 : // the AST (i.e. allocated IR nodes).
34259 0 : for (unsigned j=0; j < SgOmpUntiedClause::pool_size; j++)
34260 : {
34261 : // This is indexing the STL vector of C/C++ style arrays as a doubly
34262 : // indexed array access. It is OK since we have leveraged the semantics
34263 : // of STL vector memory as contigous and cast the memory as an array
34264 : // of arrays to use the 2D array indexing. Hope this is not confusing,
34265 : // but it s very fast as an implementation.
34266 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
34267 : {
34268 0 : count++;
34269 : }
34270 : }
34271 : }
34272 : }
34273 :
34274 :
34275 :
34276 4 : return count;
34277 : }
34278 :
34279 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
34280 : // using values that overflow signed values of int.
34281 : size_t
34282 0 : SgOmpUntiedClause::memoryUsage()
34283 : {
34284 : // This function is required because we need the class name as a type when we call sizeof
34285 : // There might be another way to implement this if we have a traversal that only called a
34286 : // representative object (one call for each type of Sage IIIIR node).
34287 0 : size_t memory = numberOfNodes() * sizeof(SgOmpUntiedClause);
34288 :
34289 0 : return memory;
34290 : }
34291 :
34292 : /* #line 34293 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
34293 :
34294 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
34295 : void
34296 5342 : SgOmpSeqCstClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
34297 : {
34298 : // This function traverses the memory pool for only a specific IR node
34299 : // and calls the visit function of the input class execute a traversal
34300 : // similar to the style of the attribute based traversals within ROSE.
34301 : // This traversal will visit ALL nodes of the AST where as the other
34302 : // attribute based traversals visit only the embedded tree within the AST.
34303 :
34304 : // Initialize array to the address of the first element of the STL vector
34305 : // (which is guaranteed to be contiguous storage).
34306 : // SgOmpSeqCstClause objectArray [] = *(Memory_Block_List.begin());
34307 5342 : if (SgOmpSeqCstClause::pools.empty() == false)
34308 : {
34309 : // Generate an array of memory pools
34310 0 : SgOmpSeqCstClause** objectArray = (SgOmpSeqCstClause**) &(SgOmpSeqCstClause::pools[0]);
34311 :
34312 : // Build a local variable for better performance
34313 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
34314 : #if 0
34315 : // Iterate over the memory pools
34316 : for (unsigned int i=0; i < SgOmpSeqCstClause::pools.size(); i++)
34317 : {
34318 : // objectArray[i] is a single memory pool
34319 : for (int j=0; j < SgOmpSeqCstClause::pool_size; j++)
34320 : {
34321 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
34322 : {
34323 : traversal.visit(&(objectArray[i][j]));
34324 : }
34325 : }
34326 : }
34327 : #else
34328 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
34329 : // compute the list first and then call the visit function on each list element.
34330 :
34331 : // printf ("Inside of SgOmpSeqCstClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
34332 :
34333 0 : std::vector<SgOmpSeqCstClause*> nodeList;
34334 :
34335 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
34336 0 : for (unsigned int i=0; i < SgOmpSeqCstClause::pools.size(); i++)
34337 : {
34338 : // objectArray[i] is a single memory pool
34339 0 : for (unsigned j=0; j < SgOmpSeqCstClause::pool_size; j++)
34340 : {
34341 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
34342 : {
34343 0 : nodeList.push_back(&(objectArray[i][j]));
34344 : }
34345 : }
34346 : }
34347 :
34348 : // Iterate over the saved list
34349 0 : size_t nodeListSize = nodeList.size();
34350 0 : for (size_t i=0; i < nodeListSize; i++)
34351 : {
34352 0 : ROSE_ASSERT(nodeList[i] != NULL);
34353 : #if 0
34354 : traversal.visit(nodeList[i]);
34355 : #else
34356 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
34357 : {
34358 0 : traversal.visit(nodeList[i]);
34359 : }
34360 : #endif
34361 : }
34362 : #endif
34363 : }
34364 :
34365 : // This should not be required since all previously static data members are
34366 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
34367 :
34368 5342 : }
34369 :
34370 :
34371 : void
34372 194 : SgOmpSeqCstClause::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
34373 : {
34374 : // This function traverses the memory pool for an IR node and
34375 : // calls the function to execute the visitor object.
34376 :
34377 : // Initialize array to the address of the first element of the STL vector
34378 : // (which is guarenteed to be contiguous storage).
34379 : // SgOmpSeqCstClause objectArray [] = *(Memory_Block_List.begin());
34380 194 : if (SgOmpSeqCstClause::pools.empty() == false)
34381 : {
34382 : // Generate an array of memory pools
34383 0 : SgOmpSeqCstClause** objectArray = (SgOmpSeqCstClause**) &(SgOmpSeqCstClause::pools[0]);
34384 :
34385 : // Build a local variable for better performance
34386 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
34387 :
34388 : // Iterate over the memory pools
34389 0 : for (unsigned int i=0; i < SgOmpSeqCstClause::pools.size(); i++)
34390 : {
34391 : // objectArray[i] is a single memory pool
34392 0 : for (unsigned j=0; j < SgOmpSeqCstClause::pool_size; j++)
34393 : {
34394 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
34395 : {
34396 : // printf ("Found a valid SgOmpSeqCstClause object in the memory pool %d at position %d \n",i,j);
34397 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
34398 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
34399 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
34400 : }
34401 : else
34402 : {
34403 : // printf ("Found a INVALID SgOmpSeqCstClause object in the memory pool \n");
34404 : }
34405 : }
34406 : }
34407 : }
34408 :
34409 : // This should not be required since all previously static data members are
34410 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
34411 :
34412 194 : }
34413 :
34414 : void
34415 0 : SgOmpSeqCstClause::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
34416 : {
34417 : // This function visits only a single IR node of the memory pool.
34418 : // it is typically called once for each type of IR node within
34419 : // the automatically generated function: traverseRepresentativeNodes().
34420 :
34421 : // Initialize array to the address of the first element of the STL vector
34422 : // (which is guarenteed to be contiguous storage).
34423 : // SgOmpSeqCstClause objectArray [] = *(Memory_Block_List.begin());
34424 0 : if (SgOmpSeqCstClause::pools.empty() == false)
34425 : {
34426 : // Generate an array of memory pools
34427 0 : SgOmpSeqCstClause** objectArray = (SgOmpSeqCstClause**) &(SgOmpSeqCstClause::pools[0]);
34428 :
34429 : // Build a local variable for better performance
34430 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
34431 :
34432 : // Iterate over the memory pools
34433 0 : bool done = false;
34434 0 : unsigned i=0;
34435 :
34436 : // find the first valid IR node, call visit function, and then leave
34437 0 : while ( done == false && i < SgOmpSeqCstClause::pools.size() )
34438 : {
34439 : // objectArray[i] is a single memory pool
34440 : unsigned j=0;
34441 0 : while (done == false && j < SgOmpSeqCstClause::pool_size)
34442 : {
34443 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
34444 : {
34445 0 : traversal.visit(&(objectArray[i][j]));
34446 0 : done = true;
34447 : }
34448 0 : j++;
34449 : }
34450 0 : i++;
34451 : }
34452 :
34453 : #if 0
34454 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
34455 : if (done == false)
34456 : {
34457 : printf ("No representative for SgOmpSeqCstClause found in memory pools \n");
34458 : }
34459 : #endif
34460 : }
34461 0 : }
34462 :
34463 :
34464 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
34465 : // using values that overflow signed values of int.
34466 : size_t
34467 4 : SgOmpSeqCstClause::numberOfNodes()
34468 : {
34469 : // This function traverses the memory pool for an IR node and
34470 : // counts the number of IR nodes of a particular Sage III IR
34471 : // nodes type.
34472 :
34473 4 : size_t count = 0;
34474 4 : if (SgOmpSeqCstClause::pools.empty() == false)
34475 : {
34476 : // Generate an array of memory pools (this is actually a STL vector,
34477 : // but it is contiguious, so OK to treat this way).
34478 0 : SgOmpSeqCstClause** objectArray = (SgOmpSeqCstClause**) &(SgOmpSeqCstClause::pools[0]);
34479 :
34480 : // Build a local variable for better performance (make it a loop invariant variable).
34481 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
34482 :
34483 : // Iterate over all of the memory pools for this IR node.
34484 0 : for (unsigned int i=0; i < SgOmpSeqCstClause::pools.size(); i++)
34485 : {
34486 : // objectArray[i] is a single memory pool, iterate over all the
34487 : // IR nodes and only count those that are valid IR nodes used in
34488 : // the AST (i.e. allocated IR nodes).
34489 0 : for (unsigned j=0; j < SgOmpSeqCstClause::pool_size; j++)
34490 : {
34491 : // This is indexing the STL vector of C/C++ style arrays as a doubly
34492 : // indexed array access. It is OK since we have leveraged the semantics
34493 : // of STL vector memory as contigous and cast the memory as an array
34494 : // of arrays to use the 2D array indexing. Hope this is not confusing,
34495 : // but it s very fast as an implementation.
34496 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
34497 : {
34498 0 : count++;
34499 : }
34500 : }
34501 : }
34502 : }
34503 :
34504 :
34505 :
34506 4 : return count;
34507 : }
34508 :
34509 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
34510 : // using values that overflow signed values of int.
34511 : size_t
34512 0 : SgOmpSeqCstClause::memoryUsage()
34513 : {
34514 : // This function is required because we need the class name as a type when we call sizeof
34515 : // There might be another way to implement this if we have a traversal that only called a
34516 : // representative object (one call for each type of Sage IIIIR node).
34517 0 : size_t memory = numberOfNodes() * sizeof(SgOmpSeqCstClause);
34518 :
34519 0 : return memory;
34520 : }
34521 :
34522 : /* #line 34523 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
34523 :
34524 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
34525 : void
34526 5342 : SgOmpAcqRelClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
34527 : {
34528 : // This function traverses the memory pool for only a specific IR node
34529 : // and calls the visit function of the input class execute a traversal
34530 : // similar to the style of the attribute based traversals within ROSE.
34531 : // This traversal will visit ALL nodes of the AST where as the other
34532 : // attribute based traversals visit only the embedded tree within the AST.
34533 :
34534 : // Initialize array to the address of the first element of the STL vector
34535 : // (which is guaranteed to be contiguous storage).
34536 : // SgOmpAcqRelClause objectArray [] = *(Memory_Block_List.begin());
34537 5342 : if (SgOmpAcqRelClause::pools.empty() == false)
34538 : {
34539 : // Generate an array of memory pools
34540 7 : SgOmpAcqRelClause** objectArray = (SgOmpAcqRelClause**) &(SgOmpAcqRelClause::pools[0]);
34541 :
34542 : // Build a local variable for better performance
34543 7 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
34544 : #if 0
34545 : // Iterate over the memory pools
34546 : for (unsigned int i=0; i < SgOmpAcqRelClause::pools.size(); i++)
34547 : {
34548 : // objectArray[i] is a single memory pool
34549 : for (int j=0; j < SgOmpAcqRelClause::pool_size; j++)
34550 : {
34551 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
34552 : {
34553 : traversal.visit(&(objectArray[i][j]));
34554 : }
34555 : }
34556 : }
34557 : #else
34558 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
34559 : // compute the list first and then call the visit function on each list element.
34560 :
34561 : // printf ("Inside of SgOmpAcqRelClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
34562 :
34563 14 : std::vector<SgOmpAcqRelClause*> nodeList;
34564 :
34565 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
34566 14 : for (unsigned int i=0; i < SgOmpAcqRelClause::pools.size(); i++)
34567 : {
34568 : // objectArray[i] is a single memory pool
34569 14007 : for (unsigned j=0; j < SgOmpAcqRelClause::pool_size; j++)
34570 : {
34571 14000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
34572 : {
34573 7 : nodeList.push_back(&(objectArray[i][j]));
34574 : }
34575 : }
34576 : }
34577 :
34578 : // Iterate over the saved list
34579 7 : size_t nodeListSize = nodeList.size();
34580 14 : for (size_t i=0; i < nodeListSize; i++)
34581 : {
34582 7 : ROSE_ASSERT(nodeList[i] != NULL);
34583 : #if 0
34584 : traversal.visit(nodeList[i]);
34585 : #else
34586 7 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
34587 : {
34588 7 : traversal.visit(nodeList[i]);
34589 : }
34590 : #endif
34591 : }
34592 : #endif
34593 : }
34594 :
34595 : // This should not be required since all previously static data members are
34596 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
34597 :
34598 5342 : }
34599 :
34600 :
34601 : void
34602 194 : SgOmpAcqRelClause::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
34603 : {
34604 : // This function traverses the memory pool for an IR node and
34605 : // calls the function to execute the visitor object.
34606 :
34607 : // Initialize array to the address of the first element of the STL vector
34608 : // (which is guarenteed to be contiguous storage).
34609 : // SgOmpAcqRelClause objectArray [] = *(Memory_Block_List.begin());
34610 194 : if (SgOmpAcqRelClause::pools.empty() == false)
34611 : {
34612 : // Generate an array of memory pools
34613 0 : SgOmpAcqRelClause** objectArray = (SgOmpAcqRelClause**) &(SgOmpAcqRelClause::pools[0]);
34614 :
34615 : // Build a local variable for better performance
34616 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
34617 :
34618 : // Iterate over the memory pools
34619 0 : for (unsigned int i=0; i < SgOmpAcqRelClause::pools.size(); i++)
34620 : {
34621 : // objectArray[i] is a single memory pool
34622 0 : for (unsigned j=0; j < SgOmpAcqRelClause::pool_size; j++)
34623 : {
34624 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
34625 : {
34626 : // printf ("Found a valid SgOmpAcqRelClause object in the memory pool %d at position %d \n",i,j);
34627 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
34628 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
34629 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
34630 : }
34631 : else
34632 : {
34633 : // printf ("Found a INVALID SgOmpAcqRelClause object in the memory pool \n");
34634 : }
34635 : }
34636 : }
34637 : }
34638 :
34639 : // This should not be required since all previously static data members are
34640 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
34641 :
34642 194 : }
34643 :
34644 : void
34645 0 : SgOmpAcqRelClause::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
34646 : {
34647 : // This function visits only a single IR node of the memory pool.
34648 : // it is typically called once for each type of IR node within
34649 : // the automatically generated function: traverseRepresentativeNodes().
34650 :
34651 : // Initialize array to the address of the first element of the STL vector
34652 : // (which is guarenteed to be contiguous storage).
34653 : // SgOmpAcqRelClause objectArray [] = *(Memory_Block_List.begin());
34654 0 : if (SgOmpAcqRelClause::pools.empty() == false)
34655 : {
34656 : // Generate an array of memory pools
34657 0 : SgOmpAcqRelClause** objectArray = (SgOmpAcqRelClause**) &(SgOmpAcqRelClause::pools[0]);
34658 :
34659 : // Build a local variable for better performance
34660 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
34661 :
34662 : // Iterate over the memory pools
34663 0 : bool done = false;
34664 0 : unsigned i=0;
34665 :
34666 : // find the first valid IR node, call visit function, and then leave
34667 0 : while ( done == false && i < SgOmpAcqRelClause::pools.size() )
34668 : {
34669 : // objectArray[i] is a single memory pool
34670 : unsigned j=0;
34671 0 : while (done == false && j < SgOmpAcqRelClause::pool_size)
34672 : {
34673 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
34674 : {
34675 0 : traversal.visit(&(objectArray[i][j]));
34676 0 : done = true;
34677 : }
34678 0 : j++;
34679 : }
34680 0 : i++;
34681 : }
34682 :
34683 : #if 0
34684 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
34685 : if (done == false)
34686 : {
34687 : printf ("No representative for SgOmpAcqRelClause found in memory pools \n");
34688 : }
34689 : #endif
34690 : }
34691 0 : }
34692 :
34693 :
34694 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
34695 : // using values that overflow signed values of int.
34696 : size_t
34697 4 : SgOmpAcqRelClause::numberOfNodes()
34698 : {
34699 : // This function traverses the memory pool for an IR node and
34700 : // counts the number of IR nodes of a particular Sage III IR
34701 : // nodes type.
34702 :
34703 4 : size_t count = 0;
34704 4 : if (SgOmpAcqRelClause::pools.empty() == false)
34705 : {
34706 : // Generate an array of memory pools (this is actually a STL vector,
34707 : // but it is contiguious, so OK to treat this way).
34708 0 : SgOmpAcqRelClause** objectArray = (SgOmpAcqRelClause**) &(SgOmpAcqRelClause::pools[0]);
34709 :
34710 : // Build a local variable for better performance (make it a loop invariant variable).
34711 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
34712 :
34713 : // Iterate over all of the memory pools for this IR node.
34714 0 : for (unsigned int i=0; i < SgOmpAcqRelClause::pools.size(); i++)
34715 : {
34716 : // objectArray[i] is a single memory pool, iterate over all the
34717 : // IR nodes and only count those that are valid IR nodes used in
34718 : // the AST (i.e. allocated IR nodes).
34719 0 : for (unsigned j=0; j < SgOmpAcqRelClause::pool_size; j++)
34720 : {
34721 : // This is indexing the STL vector of C/C++ style arrays as a doubly
34722 : // indexed array access. It is OK since we have leveraged the semantics
34723 : // of STL vector memory as contigous and cast the memory as an array
34724 : // of arrays to use the 2D array indexing. Hope this is not confusing,
34725 : // but it s very fast as an implementation.
34726 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
34727 : {
34728 0 : count++;
34729 : }
34730 : }
34731 : }
34732 : }
34733 :
34734 :
34735 :
34736 4 : return count;
34737 : }
34738 :
34739 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
34740 : // using values that overflow signed values of int.
34741 : size_t
34742 0 : SgOmpAcqRelClause::memoryUsage()
34743 : {
34744 : // This function is required because we need the class name as a type when we call sizeof
34745 : // There might be another way to implement this if we have a traversal that only called a
34746 : // representative object (one call for each type of Sage IIIIR node).
34747 0 : size_t memory = numberOfNodes() * sizeof(SgOmpAcqRelClause);
34748 :
34749 0 : return memory;
34750 : }
34751 :
34752 : /* #line 34753 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
34753 :
34754 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
34755 : void
34756 5342 : SgOmpReleaseClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
34757 : {
34758 : // This function traverses the memory pool for only a specific IR node
34759 : // and calls the visit function of the input class execute a traversal
34760 : // similar to the style of the attribute based traversals within ROSE.
34761 : // This traversal will visit ALL nodes of the AST where as the other
34762 : // attribute based traversals visit only the embedded tree within the AST.
34763 :
34764 : // Initialize array to the address of the first element of the STL vector
34765 : // (which is guaranteed to be contiguous storage).
34766 : // SgOmpReleaseClause objectArray [] = *(Memory_Block_List.begin());
34767 5342 : if (SgOmpReleaseClause::pools.empty() == false)
34768 : {
34769 : // Generate an array of memory pools
34770 7 : SgOmpReleaseClause** objectArray = (SgOmpReleaseClause**) &(SgOmpReleaseClause::pools[0]);
34771 :
34772 : // Build a local variable for better performance
34773 7 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
34774 : #if 0
34775 : // Iterate over the memory pools
34776 : for (unsigned int i=0; i < SgOmpReleaseClause::pools.size(); i++)
34777 : {
34778 : // objectArray[i] is a single memory pool
34779 : for (int j=0; j < SgOmpReleaseClause::pool_size; j++)
34780 : {
34781 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
34782 : {
34783 : traversal.visit(&(objectArray[i][j]));
34784 : }
34785 : }
34786 : }
34787 : #else
34788 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
34789 : // compute the list first and then call the visit function on each list element.
34790 :
34791 : // printf ("Inside of SgOmpReleaseClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
34792 :
34793 14 : std::vector<SgOmpReleaseClause*> nodeList;
34794 :
34795 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
34796 14 : for (unsigned int i=0; i < SgOmpReleaseClause::pools.size(); i++)
34797 : {
34798 : // objectArray[i] is a single memory pool
34799 14007 : for (unsigned j=0; j < SgOmpReleaseClause::pool_size; j++)
34800 : {
34801 14000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
34802 : {
34803 7 : nodeList.push_back(&(objectArray[i][j]));
34804 : }
34805 : }
34806 : }
34807 :
34808 : // Iterate over the saved list
34809 7 : size_t nodeListSize = nodeList.size();
34810 14 : for (size_t i=0; i < nodeListSize; i++)
34811 : {
34812 7 : ROSE_ASSERT(nodeList[i] != NULL);
34813 : #if 0
34814 : traversal.visit(nodeList[i]);
34815 : #else
34816 7 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
34817 : {
34818 7 : traversal.visit(nodeList[i]);
34819 : }
34820 : #endif
34821 : }
34822 : #endif
34823 : }
34824 :
34825 : // This should not be required since all previously static data members are
34826 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
34827 :
34828 5342 : }
34829 :
34830 :
34831 : void
34832 194 : SgOmpReleaseClause::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
34833 : {
34834 : // This function traverses the memory pool for an IR node and
34835 : // calls the function to execute the visitor object.
34836 :
34837 : // Initialize array to the address of the first element of the STL vector
34838 : // (which is guarenteed to be contiguous storage).
34839 : // SgOmpReleaseClause objectArray [] = *(Memory_Block_List.begin());
34840 194 : if (SgOmpReleaseClause::pools.empty() == false)
34841 : {
34842 : // Generate an array of memory pools
34843 0 : SgOmpReleaseClause** objectArray = (SgOmpReleaseClause**) &(SgOmpReleaseClause::pools[0]);
34844 :
34845 : // Build a local variable for better performance
34846 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
34847 :
34848 : // Iterate over the memory pools
34849 0 : for (unsigned int i=0; i < SgOmpReleaseClause::pools.size(); i++)
34850 : {
34851 : // objectArray[i] is a single memory pool
34852 0 : for (unsigned j=0; j < SgOmpReleaseClause::pool_size; j++)
34853 : {
34854 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
34855 : {
34856 : // printf ("Found a valid SgOmpReleaseClause object in the memory pool %d at position %d \n",i,j);
34857 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
34858 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
34859 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
34860 : }
34861 : else
34862 : {
34863 : // printf ("Found a INVALID SgOmpReleaseClause object in the memory pool \n");
34864 : }
34865 : }
34866 : }
34867 : }
34868 :
34869 : // This should not be required since all previously static data members are
34870 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
34871 :
34872 194 : }
34873 :
34874 : void
34875 0 : SgOmpReleaseClause::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
34876 : {
34877 : // This function visits only a single IR node of the memory pool.
34878 : // it is typically called once for each type of IR node within
34879 : // the automatically generated function: traverseRepresentativeNodes().
34880 :
34881 : // Initialize array to the address of the first element of the STL vector
34882 : // (which is guarenteed to be contiguous storage).
34883 : // SgOmpReleaseClause objectArray [] = *(Memory_Block_List.begin());
34884 0 : if (SgOmpReleaseClause::pools.empty() == false)
34885 : {
34886 : // Generate an array of memory pools
34887 0 : SgOmpReleaseClause** objectArray = (SgOmpReleaseClause**) &(SgOmpReleaseClause::pools[0]);
34888 :
34889 : // Build a local variable for better performance
34890 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
34891 :
34892 : // Iterate over the memory pools
34893 0 : bool done = false;
34894 0 : unsigned i=0;
34895 :
34896 : // find the first valid IR node, call visit function, and then leave
34897 0 : while ( done == false && i < SgOmpReleaseClause::pools.size() )
34898 : {
34899 : // objectArray[i] is a single memory pool
34900 : unsigned j=0;
34901 0 : while (done == false && j < SgOmpReleaseClause::pool_size)
34902 : {
34903 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
34904 : {
34905 0 : traversal.visit(&(objectArray[i][j]));
34906 0 : done = true;
34907 : }
34908 0 : j++;
34909 : }
34910 0 : i++;
34911 : }
34912 :
34913 : #if 0
34914 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
34915 : if (done == false)
34916 : {
34917 : printf ("No representative for SgOmpReleaseClause found in memory pools \n");
34918 : }
34919 : #endif
34920 : }
34921 0 : }
34922 :
34923 :
34924 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
34925 : // using values that overflow signed values of int.
34926 : size_t
34927 4 : SgOmpReleaseClause::numberOfNodes()
34928 : {
34929 : // This function traverses the memory pool for an IR node and
34930 : // counts the number of IR nodes of a particular Sage III IR
34931 : // nodes type.
34932 :
34933 4 : size_t count = 0;
34934 4 : if (SgOmpReleaseClause::pools.empty() == false)
34935 : {
34936 : // Generate an array of memory pools (this is actually a STL vector,
34937 : // but it is contiguious, so OK to treat this way).
34938 0 : SgOmpReleaseClause** objectArray = (SgOmpReleaseClause**) &(SgOmpReleaseClause::pools[0]);
34939 :
34940 : // Build a local variable for better performance (make it a loop invariant variable).
34941 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
34942 :
34943 : // Iterate over all of the memory pools for this IR node.
34944 0 : for (unsigned int i=0; i < SgOmpReleaseClause::pools.size(); i++)
34945 : {
34946 : // objectArray[i] is a single memory pool, iterate over all the
34947 : // IR nodes and only count those that are valid IR nodes used in
34948 : // the AST (i.e. allocated IR nodes).
34949 0 : for (unsigned j=0; j < SgOmpReleaseClause::pool_size; j++)
34950 : {
34951 : // This is indexing the STL vector of C/C++ style arrays as a doubly
34952 : // indexed array access. It is OK since we have leveraged the semantics
34953 : // of STL vector memory as contigous and cast the memory as an array
34954 : // of arrays to use the 2D array indexing. Hope this is not confusing,
34955 : // but it s very fast as an implementation.
34956 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
34957 : {
34958 0 : count++;
34959 : }
34960 : }
34961 : }
34962 : }
34963 :
34964 :
34965 :
34966 4 : return count;
34967 : }
34968 :
34969 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
34970 : // using values that overflow signed values of int.
34971 : size_t
34972 0 : SgOmpReleaseClause::memoryUsage()
34973 : {
34974 : // This function is required because we need the class name as a type when we call sizeof
34975 : // There might be another way to implement this if we have a traversal that only called a
34976 : // representative object (one call for each type of Sage IIIIR node).
34977 0 : size_t memory = numberOfNodes() * sizeof(SgOmpReleaseClause);
34978 :
34979 0 : return memory;
34980 : }
34981 :
34982 : /* #line 34983 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
34983 :
34984 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
34985 : void
34986 5342 : SgOmpAcquireClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
34987 : {
34988 : // This function traverses the memory pool for only a specific IR node
34989 : // and calls the visit function of the input class execute a traversal
34990 : // similar to the style of the attribute based traversals within ROSE.
34991 : // This traversal will visit ALL nodes of the AST where as the other
34992 : // attribute based traversals visit only the embedded tree within the AST.
34993 :
34994 : // Initialize array to the address of the first element of the STL vector
34995 : // (which is guaranteed to be contiguous storage).
34996 : // SgOmpAcquireClause objectArray [] = *(Memory_Block_List.begin());
34997 5342 : if (SgOmpAcquireClause::pools.empty() == false)
34998 : {
34999 : // Generate an array of memory pools
35000 0 : SgOmpAcquireClause** objectArray = (SgOmpAcquireClause**) &(SgOmpAcquireClause::pools[0]);
35001 :
35002 : // Build a local variable for better performance
35003 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
35004 : #if 0
35005 : // Iterate over the memory pools
35006 : for (unsigned int i=0; i < SgOmpAcquireClause::pools.size(); i++)
35007 : {
35008 : // objectArray[i] is a single memory pool
35009 : for (int j=0; j < SgOmpAcquireClause::pool_size; j++)
35010 : {
35011 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
35012 : {
35013 : traversal.visit(&(objectArray[i][j]));
35014 : }
35015 : }
35016 : }
35017 : #else
35018 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
35019 : // compute the list first and then call the visit function on each list element.
35020 :
35021 : // printf ("Inside of SgOmpAcquireClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
35022 :
35023 0 : std::vector<SgOmpAcquireClause*> nodeList;
35024 :
35025 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
35026 0 : for (unsigned int i=0; i < SgOmpAcquireClause::pools.size(); i++)
35027 : {
35028 : // objectArray[i] is a single memory pool
35029 0 : for (unsigned j=0; j < SgOmpAcquireClause::pool_size; j++)
35030 : {
35031 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
35032 : {
35033 0 : nodeList.push_back(&(objectArray[i][j]));
35034 : }
35035 : }
35036 : }
35037 :
35038 : // Iterate over the saved list
35039 0 : size_t nodeListSize = nodeList.size();
35040 0 : for (size_t i=0; i < nodeListSize; i++)
35041 : {
35042 0 : ROSE_ASSERT(nodeList[i] != NULL);
35043 : #if 0
35044 : traversal.visit(nodeList[i]);
35045 : #else
35046 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
35047 : {
35048 0 : traversal.visit(nodeList[i]);
35049 : }
35050 : #endif
35051 : }
35052 : #endif
35053 : }
35054 :
35055 : // This should not be required since all previously static data members are
35056 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
35057 :
35058 5342 : }
35059 :
35060 :
35061 : void
35062 194 : SgOmpAcquireClause::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
35063 : {
35064 : // This function traverses the memory pool for an IR node and
35065 : // calls the function to execute the visitor object.
35066 :
35067 : // Initialize array to the address of the first element of the STL vector
35068 : // (which is guarenteed to be contiguous storage).
35069 : // SgOmpAcquireClause objectArray [] = *(Memory_Block_List.begin());
35070 194 : if (SgOmpAcquireClause::pools.empty() == false)
35071 : {
35072 : // Generate an array of memory pools
35073 0 : SgOmpAcquireClause** objectArray = (SgOmpAcquireClause**) &(SgOmpAcquireClause::pools[0]);
35074 :
35075 : // Build a local variable for better performance
35076 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
35077 :
35078 : // Iterate over the memory pools
35079 0 : for (unsigned int i=0; i < SgOmpAcquireClause::pools.size(); i++)
35080 : {
35081 : // objectArray[i] is a single memory pool
35082 0 : for (unsigned j=0; j < SgOmpAcquireClause::pool_size; j++)
35083 : {
35084 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
35085 : {
35086 : // printf ("Found a valid SgOmpAcquireClause object in the memory pool %d at position %d \n",i,j);
35087 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
35088 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
35089 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
35090 : }
35091 : else
35092 : {
35093 : // printf ("Found a INVALID SgOmpAcquireClause object in the memory pool \n");
35094 : }
35095 : }
35096 : }
35097 : }
35098 :
35099 : // This should not be required since all previously static data members are
35100 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
35101 :
35102 194 : }
35103 :
35104 : void
35105 0 : SgOmpAcquireClause::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
35106 : {
35107 : // This function visits only a single IR node of the memory pool.
35108 : // it is typically called once for each type of IR node within
35109 : // the automatically generated function: traverseRepresentativeNodes().
35110 :
35111 : // Initialize array to the address of the first element of the STL vector
35112 : // (which is guarenteed to be contiguous storage).
35113 : // SgOmpAcquireClause objectArray [] = *(Memory_Block_List.begin());
35114 0 : if (SgOmpAcquireClause::pools.empty() == false)
35115 : {
35116 : // Generate an array of memory pools
35117 0 : SgOmpAcquireClause** objectArray = (SgOmpAcquireClause**) &(SgOmpAcquireClause::pools[0]);
35118 :
35119 : // Build a local variable for better performance
35120 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
35121 :
35122 : // Iterate over the memory pools
35123 0 : bool done = false;
35124 0 : unsigned i=0;
35125 :
35126 : // find the first valid IR node, call visit function, and then leave
35127 0 : while ( done == false && i < SgOmpAcquireClause::pools.size() )
35128 : {
35129 : // objectArray[i] is a single memory pool
35130 : unsigned j=0;
35131 0 : while (done == false && j < SgOmpAcquireClause::pool_size)
35132 : {
35133 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
35134 : {
35135 0 : traversal.visit(&(objectArray[i][j]));
35136 0 : done = true;
35137 : }
35138 0 : j++;
35139 : }
35140 0 : i++;
35141 : }
35142 :
35143 : #if 0
35144 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
35145 : if (done == false)
35146 : {
35147 : printf ("No representative for SgOmpAcquireClause found in memory pools \n");
35148 : }
35149 : #endif
35150 : }
35151 0 : }
35152 :
35153 :
35154 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
35155 : // using values that overflow signed values of int.
35156 : size_t
35157 4 : SgOmpAcquireClause::numberOfNodes()
35158 : {
35159 : // This function traverses the memory pool for an IR node and
35160 : // counts the number of IR nodes of a particular Sage III IR
35161 : // nodes type.
35162 :
35163 4 : size_t count = 0;
35164 4 : if (SgOmpAcquireClause::pools.empty() == false)
35165 : {
35166 : // Generate an array of memory pools (this is actually a STL vector,
35167 : // but it is contiguious, so OK to treat this way).
35168 0 : SgOmpAcquireClause** objectArray = (SgOmpAcquireClause**) &(SgOmpAcquireClause::pools[0]);
35169 :
35170 : // Build a local variable for better performance (make it a loop invariant variable).
35171 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
35172 :
35173 : // Iterate over all of the memory pools for this IR node.
35174 0 : for (unsigned int i=0; i < SgOmpAcquireClause::pools.size(); i++)
35175 : {
35176 : // objectArray[i] is a single memory pool, iterate over all the
35177 : // IR nodes and only count those that are valid IR nodes used in
35178 : // the AST (i.e. allocated IR nodes).
35179 0 : for (unsigned j=0; j < SgOmpAcquireClause::pool_size; j++)
35180 : {
35181 : // This is indexing the STL vector of C/C++ style arrays as a doubly
35182 : // indexed array access. It is OK since we have leveraged the semantics
35183 : // of STL vector memory as contigous and cast the memory as an array
35184 : // of arrays to use the 2D array indexing. Hope this is not confusing,
35185 : // but it s very fast as an implementation.
35186 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
35187 : {
35188 0 : count++;
35189 : }
35190 : }
35191 : }
35192 : }
35193 :
35194 :
35195 :
35196 4 : return count;
35197 : }
35198 :
35199 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
35200 : // using values that overflow signed values of int.
35201 : size_t
35202 0 : SgOmpAcquireClause::memoryUsage()
35203 : {
35204 : // This function is required because we need the class name as a type when we call sizeof
35205 : // There might be another way to implement this if we have a traversal that only called a
35206 : // representative object (one call for each type of Sage IIIIR node).
35207 0 : size_t memory = numberOfNodes() * sizeof(SgOmpAcquireClause);
35208 :
35209 0 : return memory;
35210 : }
35211 :
35212 : /* #line 35213 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
35213 :
35214 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
35215 : void
35216 5342 : SgOmpRelaxedClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
35217 : {
35218 : // This function traverses the memory pool for only a specific IR node
35219 : // and calls the visit function of the input class execute a traversal
35220 : // similar to the style of the attribute based traversals within ROSE.
35221 : // This traversal will visit ALL nodes of the AST where as the other
35222 : // attribute based traversals visit only the embedded tree within the AST.
35223 :
35224 : // Initialize array to the address of the first element of the STL vector
35225 : // (which is guaranteed to be contiguous storage).
35226 : // SgOmpRelaxedClause objectArray [] = *(Memory_Block_List.begin());
35227 5342 : if (SgOmpRelaxedClause::pools.empty() == false)
35228 : {
35229 : // Generate an array of memory pools
35230 0 : SgOmpRelaxedClause** objectArray = (SgOmpRelaxedClause**) &(SgOmpRelaxedClause::pools[0]);
35231 :
35232 : // Build a local variable for better performance
35233 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
35234 : #if 0
35235 : // Iterate over the memory pools
35236 : for (unsigned int i=0; i < SgOmpRelaxedClause::pools.size(); i++)
35237 : {
35238 : // objectArray[i] is a single memory pool
35239 : for (int j=0; j < SgOmpRelaxedClause::pool_size; j++)
35240 : {
35241 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
35242 : {
35243 : traversal.visit(&(objectArray[i][j]));
35244 : }
35245 : }
35246 : }
35247 : #else
35248 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
35249 : // compute the list first and then call the visit function on each list element.
35250 :
35251 : // printf ("Inside of SgOmpRelaxedClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
35252 :
35253 0 : std::vector<SgOmpRelaxedClause*> nodeList;
35254 :
35255 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
35256 0 : for (unsigned int i=0; i < SgOmpRelaxedClause::pools.size(); i++)
35257 : {
35258 : // objectArray[i] is a single memory pool
35259 0 : for (unsigned j=0; j < SgOmpRelaxedClause::pool_size; j++)
35260 : {
35261 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
35262 : {
35263 0 : nodeList.push_back(&(objectArray[i][j]));
35264 : }
35265 : }
35266 : }
35267 :
35268 : // Iterate over the saved list
35269 0 : size_t nodeListSize = nodeList.size();
35270 0 : for (size_t i=0; i < nodeListSize; i++)
35271 : {
35272 0 : ROSE_ASSERT(nodeList[i] != NULL);
35273 : #if 0
35274 : traversal.visit(nodeList[i]);
35275 : #else
35276 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
35277 : {
35278 0 : traversal.visit(nodeList[i]);
35279 : }
35280 : #endif
35281 : }
35282 : #endif
35283 : }
35284 :
35285 : // This should not be required since all previously static data members are
35286 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
35287 :
35288 5342 : }
35289 :
35290 :
35291 : void
35292 194 : SgOmpRelaxedClause::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
35293 : {
35294 : // This function traverses the memory pool for an IR node and
35295 : // calls the function to execute the visitor object.
35296 :
35297 : // Initialize array to the address of the first element of the STL vector
35298 : // (which is guarenteed to be contiguous storage).
35299 : // SgOmpRelaxedClause objectArray [] = *(Memory_Block_List.begin());
35300 194 : if (SgOmpRelaxedClause::pools.empty() == false)
35301 : {
35302 : // Generate an array of memory pools
35303 0 : SgOmpRelaxedClause** objectArray = (SgOmpRelaxedClause**) &(SgOmpRelaxedClause::pools[0]);
35304 :
35305 : // Build a local variable for better performance
35306 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
35307 :
35308 : // Iterate over the memory pools
35309 0 : for (unsigned int i=0; i < SgOmpRelaxedClause::pools.size(); i++)
35310 : {
35311 : // objectArray[i] is a single memory pool
35312 0 : for (unsigned j=0; j < SgOmpRelaxedClause::pool_size; j++)
35313 : {
35314 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
35315 : {
35316 : // printf ("Found a valid SgOmpRelaxedClause object in the memory pool %d at position %d \n",i,j);
35317 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
35318 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
35319 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
35320 : }
35321 : else
35322 : {
35323 : // printf ("Found a INVALID SgOmpRelaxedClause object in the memory pool \n");
35324 : }
35325 : }
35326 : }
35327 : }
35328 :
35329 : // This should not be required since all previously static data members are
35330 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
35331 :
35332 194 : }
35333 :
35334 : void
35335 0 : SgOmpRelaxedClause::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
35336 : {
35337 : // This function visits only a single IR node of the memory pool.
35338 : // it is typically called once for each type of IR node within
35339 : // the automatically generated function: traverseRepresentativeNodes().
35340 :
35341 : // Initialize array to the address of the first element of the STL vector
35342 : // (which is guarenteed to be contiguous storage).
35343 : // SgOmpRelaxedClause objectArray [] = *(Memory_Block_List.begin());
35344 0 : if (SgOmpRelaxedClause::pools.empty() == false)
35345 : {
35346 : // Generate an array of memory pools
35347 0 : SgOmpRelaxedClause** objectArray = (SgOmpRelaxedClause**) &(SgOmpRelaxedClause::pools[0]);
35348 :
35349 : // Build a local variable for better performance
35350 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
35351 :
35352 : // Iterate over the memory pools
35353 0 : bool done = false;
35354 0 : unsigned i=0;
35355 :
35356 : // find the first valid IR node, call visit function, and then leave
35357 0 : while ( done == false && i < SgOmpRelaxedClause::pools.size() )
35358 : {
35359 : // objectArray[i] is a single memory pool
35360 : unsigned j=0;
35361 0 : while (done == false && j < SgOmpRelaxedClause::pool_size)
35362 : {
35363 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
35364 : {
35365 0 : traversal.visit(&(objectArray[i][j]));
35366 0 : done = true;
35367 : }
35368 0 : j++;
35369 : }
35370 0 : i++;
35371 : }
35372 :
35373 : #if 0
35374 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
35375 : if (done == false)
35376 : {
35377 : printf ("No representative for SgOmpRelaxedClause found in memory pools \n");
35378 : }
35379 : #endif
35380 : }
35381 0 : }
35382 :
35383 :
35384 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
35385 : // using values that overflow signed values of int.
35386 : size_t
35387 4 : SgOmpRelaxedClause::numberOfNodes()
35388 : {
35389 : // This function traverses the memory pool for an IR node and
35390 : // counts the number of IR nodes of a particular Sage III IR
35391 : // nodes type.
35392 :
35393 4 : size_t count = 0;
35394 4 : if (SgOmpRelaxedClause::pools.empty() == false)
35395 : {
35396 : // Generate an array of memory pools (this is actually a STL vector,
35397 : // but it is contiguious, so OK to treat this way).
35398 0 : SgOmpRelaxedClause** objectArray = (SgOmpRelaxedClause**) &(SgOmpRelaxedClause::pools[0]);
35399 :
35400 : // Build a local variable for better performance (make it a loop invariant variable).
35401 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
35402 :
35403 : // Iterate over all of the memory pools for this IR node.
35404 0 : for (unsigned int i=0; i < SgOmpRelaxedClause::pools.size(); i++)
35405 : {
35406 : // objectArray[i] is a single memory pool, iterate over all the
35407 : // IR nodes and only count those that are valid IR nodes used in
35408 : // the AST (i.e. allocated IR nodes).
35409 0 : for (unsigned j=0; j < SgOmpRelaxedClause::pool_size; j++)
35410 : {
35411 : // This is indexing the STL vector of C/C++ style arrays as a doubly
35412 : // indexed array access. It is OK since we have leveraged the semantics
35413 : // of STL vector memory as contigous and cast the memory as an array
35414 : // of arrays to use the 2D array indexing. Hope this is not confusing,
35415 : // but it s very fast as an implementation.
35416 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
35417 : {
35418 0 : count++;
35419 : }
35420 : }
35421 : }
35422 : }
35423 :
35424 :
35425 :
35426 4 : return count;
35427 : }
35428 :
35429 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
35430 : // using values that overflow signed values of int.
35431 : size_t
35432 0 : SgOmpRelaxedClause::memoryUsage()
35433 : {
35434 : // This function is required because we need the class name as a type when we call sizeof
35435 : // There might be another way to implement this if we have a traversal that only called a
35436 : // representative object (one call for each type of Sage IIIIR node).
35437 0 : size_t memory = numberOfNodes() * sizeof(SgOmpRelaxedClause);
35438 :
35439 0 : return memory;
35440 : }
35441 :
35442 : /* #line 35443 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
35443 :
35444 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
35445 : void
35446 5342 : SgOmpReverseOffloadClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
35447 : {
35448 : // This function traverses the memory pool for only a specific IR node
35449 : // and calls the visit function of the input class execute a traversal
35450 : // similar to the style of the attribute based traversals within ROSE.
35451 : // This traversal will visit ALL nodes of the AST where as the other
35452 : // attribute based traversals visit only the embedded tree within the AST.
35453 :
35454 : // Initialize array to the address of the first element of the STL vector
35455 : // (which is guaranteed to be contiguous storage).
35456 : // SgOmpReverseOffloadClause objectArray [] = *(Memory_Block_List.begin());
35457 5342 : if (SgOmpReverseOffloadClause::pools.empty() == false)
35458 : {
35459 : // Generate an array of memory pools
35460 14 : SgOmpReverseOffloadClause** objectArray = (SgOmpReverseOffloadClause**) &(SgOmpReverseOffloadClause::pools[0]);
35461 :
35462 : // Build a local variable for better performance
35463 14 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
35464 : #if 0
35465 : // Iterate over the memory pools
35466 : for (unsigned int i=0; i < SgOmpReverseOffloadClause::pools.size(); i++)
35467 : {
35468 : // objectArray[i] is a single memory pool
35469 : for (int j=0; j < SgOmpReverseOffloadClause::pool_size; j++)
35470 : {
35471 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
35472 : {
35473 : traversal.visit(&(objectArray[i][j]));
35474 : }
35475 : }
35476 : }
35477 : #else
35478 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
35479 : // compute the list first and then call the visit function on each list element.
35480 :
35481 : // printf ("Inside of SgOmpReverseOffloadClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
35482 :
35483 28 : std::vector<SgOmpReverseOffloadClause*> nodeList;
35484 :
35485 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
35486 28 : for (unsigned int i=0; i < SgOmpReverseOffloadClause::pools.size(); i++)
35487 : {
35488 : // objectArray[i] is a single memory pool
35489 28014 : for (unsigned j=0; j < SgOmpReverseOffloadClause::pool_size; j++)
35490 : {
35491 28000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
35492 : {
35493 14 : nodeList.push_back(&(objectArray[i][j]));
35494 : }
35495 : }
35496 : }
35497 :
35498 : // Iterate over the saved list
35499 14 : size_t nodeListSize = nodeList.size();
35500 28 : for (size_t i=0; i < nodeListSize; i++)
35501 : {
35502 14 : ROSE_ASSERT(nodeList[i] != NULL);
35503 : #if 0
35504 : traversal.visit(nodeList[i]);
35505 : #else
35506 14 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
35507 : {
35508 14 : traversal.visit(nodeList[i]);
35509 : }
35510 : #endif
35511 : }
35512 : #endif
35513 : }
35514 :
35515 : // This should not be required since all previously static data members are
35516 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
35517 :
35518 5342 : }
35519 :
35520 :
35521 : void
35522 194 : SgOmpReverseOffloadClause::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
35523 : {
35524 : // This function traverses the memory pool for an IR node and
35525 : // calls the function to execute the visitor object.
35526 :
35527 : // Initialize array to the address of the first element of the STL vector
35528 : // (which is guarenteed to be contiguous storage).
35529 : // SgOmpReverseOffloadClause objectArray [] = *(Memory_Block_List.begin());
35530 194 : if (SgOmpReverseOffloadClause::pools.empty() == false)
35531 : {
35532 : // Generate an array of memory pools
35533 0 : SgOmpReverseOffloadClause** objectArray = (SgOmpReverseOffloadClause**) &(SgOmpReverseOffloadClause::pools[0]);
35534 :
35535 : // Build a local variable for better performance
35536 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
35537 :
35538 : // Iterate over the memory pools
35539 0 : for (unsigned int i=0; i < SgOmpReverseOffloadClause::pools.size(); i++)
35540 : {
35541 : // objectArray[i] is a single memory pool
35542 0 : for (unsigned j=0; j < SgOmpReverseOffloadClause::pool_size; j++)
35543 : {
35544 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
35545 : {
35546 : // printf ("Found a valid SgOmpReverseOffloadClause object in the memory pool %d at position %d \n",i,j);
35547 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
35548 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
35549 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
35550 : }
35551 : else
35552 : {
35553 : // printf ("Found a INVALID SgOmpReverseOffloadClause object in the memory pool \n");
35554 : }
35555 : }
35556 : }
35557 : }
35558 :
35559 : // This should not be required since all previously static data members are
35560 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
35561 :
35562 194 : }
35563 :
35564 : void
35565 0 : SgOmpReverseOffloadClause::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
35566 : {
35567 : // This function visits only a single IR node of the memory pool.
35568 : // it is typically called once for each type of IR node within
35569 : // the automatically generated function: traverseRepresentativeNodes().
35570 :
35571 : // Initialize array to the address of the first element of the STL vector
35572 : // (which is guarenteed to be contiguous storage).
35573 : // SgOmpReverseOffloadClause objectArray [] = *(Memory_Block_List.begin());
35574 0 : if (SgOmpReverseOffloadClause::pools.empty() == false)
35575 : {
35576 : // Generate an array of memory pools
35577 0 : SgOmpReverseOffloadClause** objectArray = (SgOmpReverseOffloadClause**) &(SgOmpReverseOffloadClause::pools[0]);
35578 :
35579 : // Build a local variable for better performance
35580 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
35581 :
35582 : // Iterate over the memory pools
35583 0 : bool done = false;
35584 0 : unsigned i=0;
35585 :
35586 : // find the first valid IR node, call visit function, and then leave
35587 0 : while ( done == false && i < SgOmpReverseOffloadClause::pools.size() )
35588 : {
35589 : // objectArray[i] is a single memory pool
35590 : unsigned j=0;
35591 0 : while (done == false && j < SgOmpReverseOffloadClause::pool_size)
35592 : {
35593 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
35594 : {
35595 0 : traversal.visit(&(objectArray[i][j]));
35596 0 : done = true;
35597 : }
35598 0 : j++;
35599 : }
35600 0 : i++;
35601 : }
35602 :
35603 : #if 0
35604 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
35605 : if (done == false)
35606 : {
35607 : printf ("No representative for SgOmpReverseOffloadClause found in memory pools \n");
35608 : }
35609 : #endif
35610 : }
35611 0 : }
35612 :
35613 :
35614 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
35615 : // using values that overflow signed values of int.
35616 : size_t
35617 4 : SgOmpReverseOffloadClause::numberOfNodes()
35618 : {
35619 : // This function traverses the memory pool for an IR node and
35620 : // counts the number of IR nodes of a particular Sage III IR
35621 : // nodes type.
35622 :
35623 4 : size_t count = 0;
35624 4 : if (SgOmpReverseOffloadClause::pools.empty() == false)
35625 : {
35626 : // Generate an array of memory pools (this is actually a STL vector,
35627 : // but it is contiguious, so OK to treat this way).
35628 0 : SgOmpReverseOffloadClause** objectArray = (SgOmpReverseOffloadClause**) &(SgOmpReverseOffloadClause::pools[0]);
35629 :
35630 : // Build a local variable for better performance (make it a loop invariant variable).
35631 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
35632 :
35633 : // Iterate over all of the memory pools for this IR node.
35634 0 : for (unsigned int i=0; i < SgOmpReverseOffloadClause::pools.size(); i++)
35635 : {
35636 : // objectArray[i] is a single memory pool, iterate over all the
35637 : // IR nodes and only count those that are valid IR nodes used in
35638 : // the AST (i.e. allocated IR nodes).
35639 0 : for (unsigned j=0; j < SgOmpReverseOffloadClause::pool_size; j++)
35640 : {
35641 : // This is indexing the STL vector of C/C++ style arrays as a doubly
35642 : // indexed array access. It is OK since we have leveraged the semantics
35643 : // of STL vector memory as contigous and cast the memory as an array
35644 : // of arrays to use the 2D array indexing. Hope this is not confusing,
35645 : // but it s very fast as an implementation.
35646 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
35647 : {
35648 0 : count++;
35649 : }
35650 : }
35651 : }
35652 : }
35653 :
35654 :
35655 :
35656 4 : return count;
35657 : }
35658 :
35659 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
35660 : // using values that overflow signed values of int.
35661 : size_t
35662 0 : SgOmpReverseOffloadClause::memoryUsage()
35663 : {
35664 : // This function is required because we need the class name as a type when we call sizeof
35665 : // There might be another way to implement this if we have a traversal that only called a
35666 : // representative object (one call for each type of Sage IIIIR node).
35667 0 : size_t memory = numberOfNodes() * sizeof(SgOmpReverseOffloadClause);
35668 :
35669 0 : return memory;
35670 : }
35671 :
35672 : /* #line 35673 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
35673 :
35674 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
35675 : void
35676 5342 : SgOmpUnifiedAddressClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
35677 : {
35678 : // This function traverses the memory pool for only a specific IR node
35679 : // and calls the visit function of the input class execute a traversal
35680 : // similar to the style of the attribute based traversals within ROSE.
35681 : // This traversal will visit ALL nodes of the AST where as the other
35682 : // attribute based traversals visit only the embedded tree within the AST.
35683 :
35684 : // Initialize array to the address of the first element of the STL vector
35685 : // (which is guaranteed to be contiguous storage).
35686 : // SgOmpUnifiedAddressClause objectArray [] = *(Memory_Block_List.begin());
35687 5342 : if (SgOmpUnifiedAddressClause::pools.empty() == false)
35688 : {
35689 : // Generate an array of memory pools
35690 7 : SgOmpUnifiedAddressClause** objectArray = (SgOmpUnifiedAddressClause**) &(SgOmpUnifiedAddressClause::pools[0]);
35691 :
35692 : // Build a local variable for better performance
35693 7 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
35694 : #if 0
35695 : // Iterate over the memory pools
35696 : for (unsigned int i=0; i < SgOmpUnifiedAddressClause::pools.size(); i++)
35697 : {
35698 : // objectArray[i] is a single memory pool
35699 : for (int j=0; j < SgOmpUnifiedAddressClause::pool_size; j++)
35700 : {
35701 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
35702 : {
35703 : traversal.visit(&(objectArray[i][j]));
35704 : }
35705 : }
35706 : }
35707 : #else
35708 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
35709 : // compute the list first and then call the visit function on each list element.
35710 :
35711 : // printf ("Inside of SgOmpUnifiedAddressClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
35712 :
35713 14 : std::vector<SgOmpUnifiedAddressClause*> nodeList;
35714 :
35715 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
35716 14 : for (unsigned int i=0; i < SgOmpUnifiedAddressClause::pools.size(); i++)
35717 : {
35718 : // objectArray[i] is a single memory pool
35719 14007 : for (unsigned j=0; j < SgOmpUnifiedAddressClause::pool_size; j++)
35720 : {
35721 14000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
35722 : {
35723 7 : nodeList.push_back(&(objectArray[i][j]));
35724 : }
35725 : }
35726 : }
35727 :
35728 : // Iterate over the saved list
35729 7 : size_t nodeListSize = nodeList.size();
35730 14 : for (size_t i=0; i < nodeListSize; i++)
35731 : {
35732 7 : ROSE_ASSERT(nodeList[i] != NULL);
35733 : #if 0
35734 : traversal.visit(nodeList[i]);
35735 : #else
35736 7 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
35737 : {
35738 7 : traversal.visit(nodeList[i]);
35739 : }
35740 : #endif
35741 : }
35742 : #endif
35743 : }
35744 :
35745 : // This should not be required since all previously static data members are
35746 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
35747 :
35748 5342 : }
35749 :
35750 :
35751 : void
35752 194 : SgOmpUnifiedAddressClause::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
35753 : {
35754 : // This function traverses the memory pool for an IR node and
35755 : // calls the function to execute the visitor object.
35756 :
35757 : // Initialize array to the address of the first element of the STL vector
35758 : // (which is guarenteed to be contiguous storage).
35759 : // SgOmpUnifiedAddressClause objectArray [] = *(Memory_Block_List.begin());
35760 194 : if (SgOmpUnifiedAddressClause::pools.empty() == false)
35761 : {
35762 : // Generate an array of memory pools
35763 0 : SgOmpUnifiedAddressClause** objectArray = (SgOmpUnifiedAddressClause**) &(SgOmpUnifiedAddressClause::pools[0]);
35764 :
35765 : // Build a local variable for better performance
35766 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
35767 :
35768 : // Iterate over the memory pools
35769 0 : for (unsigned int i=0; i < SgOmpUnifiedAddressClause::pools.size(); i++)
35770 : {
35771 : // objectArray[i] is a single memory pool
35772 0 : for (unsigned j=0; j < SgOmpUnifiedAddressClause::pool_size; j++)
35773 : {
35774 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
35775 : {
35776 : // printf ("Found a valid SgOmpUnifiedAddressClause object in the memory pool %d at position %d \n",i,j);
35777 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
35778 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
35779 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
35780 : }
35781 : else
35782 : {
35783 : // printf ("Found a INVALID SgOmpUnifiedAddressClause object in the memory pool \n");
35784 : }
35785 : }
35786 : }
35787 : }
35788 :
35789 : // This should not be required since all previously static data members are
35790 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
35791 :
35792 194 : }
35793 :
35794 : void
35795 0 : SgOmpUnifiedAddressClause::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
35796 : {
35797 : // This function visits only a single IR node of the memory pool.
35798 : // it is typically called once for each type of IR node within
35799 : // the automatically generated function: traverseRepresentativeNodes().
35800 :
35801 : // Initialize array to the address of the first element of the STL vector
35802 : // (which is guarenteed to be contiguous storage).
35803 : // SgOmpUnifiedAddressClause objectArray [] = *(Memory_Block_List.begin());
35804 0 : if (SgOmpUnifiedAddressClause::pools.empty() == false)
35805 : {
35806 : // Generate an array of memory pools
35807 0 : SgOmpUnifiedAddressClause** objectArray = (SgOmpUnifiedAddressClause**) &(SgOmpUnifiedAddressClause::pools[0]);
35808 :
35809 : // Build a local variable for better performance
35810 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
35811 :
35812 : // Iterate over the memory pools
35813 0 : bool done = false;
35814 0 : unsigned i=0;
35815 :
35816 : // find the first valid IR node, call visit function, and then leave
35817 0 : while ( done == false && i < SgOmpUnifiedAddressClause::pools.size() )
35818 : {
35819 : // objectArray[i] is a single memory pool
35820 : unsigned j=0;
35821 0 : while (done == false && j < SgOmpUnifiedAddressClause::pool_size)
35822 : {
35823 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
35824 : {
35825 0 : traversal.visit(&(objectArray[i][j]));
35826 0 : done = true;
35827 : }
35828 0 : j++;
35829 : }
35830 0 : i++;
35831 : }
35832 :
35833 : #if 0
35834 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
35835 : if (done == false)
35836 : {
35837 : printf ("No representative for SgOmpUnifiedAddressClause found in memory pools \n");
35838 : }
35839 : #endif
35840 : }
35841 0 : }
35842 :
35843 :
35844 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
35845 : // using values that overflow signed values of int.
35846 : size_t
35847 4 : SgOmpUnifiedAddressClause::numberOfNodes()
35848 : {
35849 : // This function traverses the memory pool for an IR node and
35850 : // counts the number of IR nodes of a particular Sage III IR
35851 : // nodes type.
35852 :
35853 4 : size_t count = 0;
35854 4 : if (SgOmpUnifiedAddressClause::pools.empty() == false)
35855 : {
35856 : // Generate an array of memory pools (this is actually a STL vector,
35857 : // but it is contiguious, so OK to treat this way).
35858 0 : SgOmpUnifiedAddressClause** objectArray = (SgOmpUnifiedAddressClause**) &(SgOmpUnifiedAddressClause::pools[0]);
35859 :
35860 : // Build a local variable for better performance (make it a loop invariant variable).
35861 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
35862 :
35863 : // Iterate over all of the memory pools for this IR node.
35864 0 : for (unsigned int i=0; i < SgOmpUnifiedAddressClause::pools.size(); i++)
35865 : {
35866 : // objectArray[i] is a single memory pool, iterate over all the
35867 : // IR nodes and only count those that are valid IR nodes used in
35868 : // the AST (i.e. allocated IR nodes).
35869 0 : for (unsigned j=0; j < SgOmpUnifiedAddressClause::pool_size; j++)
35870 : {
35871 : // This is indexing the STL vector of C/C++ style arrays as a doubly
35872 : // indexed array access. It is OK since we have leveraged the semantics
35873 : // of STL vector memory as contigous and cast the memory as an array
35874 : // of arrays to use the 2D array indexing. Hope this is not confusing,
35875 : // but it s very fast as an implementation.
35876 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
35877 : {
35878 0 : count++;
35879 : }
35880 : }
35881 : }
35882 : }
35883 :
35884 :
35885 :
35886 4 : return count;
35887 : }
35888 :
35889 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
35890 : // using values that overflow signed values of int.
35891 : size_t
35892 0 : SgOmpUnifiedAddressClause::memoryUsage()
35893 : {
35894 : // This function is required because we need the class name as a type when we call sizeof
35895 : // There might be another way to implement this if we have a traversal that only called a
35896 : // representative object (one call for each type of Sage IIIIR node).
35897 0 : size_t memory = numberOfNodes() * sizeof(SgOmpUnifiedAddressClause);
35898 :
35899 0 : return memory;
35900 : }
35901 :
35902 : /* #line 35903 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
35903 :
35904 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
35905 : void
35906 5342 : SgOmpUnifiedSharedMemoryClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
35907 : {
35908 : // This function traverses the memory pool for only a specific IR node
35909 : // and calls the visit function of the input class execute a traversal
35910 : // similar to the style of the attribute based traversals within ROSE.
35911 : // This traversal will visit ALL nodes of the AST where as the other
35912 : // attribute based traversals visit only the embedded tree within the AST.
35913 :
35914 : // Initialize array to the address of the first element of the STL vector
35915 : // (which is guaranteed to be contiguous storage).
35916 : // SgOmpUnifiedSharedMemoryClause objectArray [] = *(Memory_Block_List.begin());
35917 5342 : if (SgOmpUnifiedSharedMemoryClause::pools.empty() == false)
35918 : {
35919 : // Generate an array of memory pools
35920 7 : SgOmpUnifiedSharedMemoryClause** objectArray = (SgOmpUnifiedSharedMemoryClause**) &(SgOmpUnifiedSharedMemoryClause::pools[0]);
35921 :
35922 : // Build a local variable for better performance
35923 7 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
35924 : #if 0
35925 : // Iterate over the memory pools
35926 : for (unsigned int i=0; i < SgOmpUnifiedSharedMemoryClause::pools.size(); i++)
35927 : {
35928 : // objectArray[i] is a single memory pool
35929 : for (int j=0; j < SgOmpUnifiedSharedMemoryClause::pool_size; j++)
35930 : {
35931 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
35932 : {
35933 : traversal.visit(&(objectArray[i][j]));
35934 : }
35935 : }
35936 : }
35937 : #else
35938 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
35939 : // compute the list first and then call the visit function on each list element.
35940 :
35941 : // printf ("Inside of SgOmpUnifiedSharedMemoryClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
35942 :
35943 14 : std::vector<SgOmpUnifiedSharedMemoryClause*> nodeList;
35944 :
35945 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
35946 14 : for (unsigned int i=0; i < SgOmpUnifiedSharedMemoryClause::pools.size(); i++)
35947 : {
35948 : // objectArray[i] is a single memory pool
35949 14007 : for (unsigned j=0; j < SgOmpUnifiedSharedMemoryClause::pool_size; j++)
35950 : {
35951 14000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
35952 : {
35953 7 : nodeList.push_back(&(objectArray[i][j]));
35954 : }
35955 : }
35956 : }
35957 :
35958 : // Iterate over the saved list
35959 7 : size_t nodeListSize = nodeList.size();
35960 14 : for (size_t i=0; i < nodeListSize; i++)
35961 : {
35962 7 : ROSE_ASSERT(nodeList[i] != NULL);
35963 : #if 0
35964 : traversal.visit(nodeList[i]);
35965 : #else
35966 7 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
35967 : {
35968 7 : traversal.visit(nodeList[i]);
35969 : }
35970 : #endif
35971 : }
35972 : #endif
35973 : }
35974 :
35975 : // This should not be required since all previously static data members are
35976 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
35977 :
35978 5342 : }
35979 :
35980 :
35981 : void
35982 194 : SgOmpUnifiedSharedMemoryClause::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
35983 : {
35984 : // This function traverses the memory pool for an IR node and
35985 : // calls the function to execute the visitor object.
35986 :
35987 : // Initialize array to the address of the first element of the STL vector
35988 : // (which is guarenteed to be contiguous storage).
35989 : // SgOmpUnifiedSharedMemoryClause objectArray [] = *(Memory_Block_List.begin());
35990 194 : if (SgOmpUnifiedSharedMemoryClause::pools.empty() == false)
35991 : {
35992 : // Generate an array of memory pools
35993 0 : SgOmpUnifiedSharedMemoryClause** objectArray = (SgOmpUnifiedSharedMemoryClause**) &(SgOmpUnifiedSharedMemoryClause::pools[0]);
35994 :
35995 : // Build a local variable for better performance
35996 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
35997 :
35998 : // Iterate over the memory pools
35999 0 : for (unsigned int i=0; i < SgOmpUnifiedSharedMemoryClause::pools.size(); i++)
36000 : {
36001 : // objectArray[i] is a single memory pool
36002 0 : for (unsigned j=0; j < SgOmpUnifiedSharedMemoryClause::pool_size; j++)
36003 : {
36004 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
36005 : {
36006 : // printf ("Found a valid SgOmpUnifiedSharedMemoryClause object in the memory pool %d at position %d \n",i,j);
36007 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
36008 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
36009 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
36010 : }
36011 : else
36012 : {
36013 : // printf ("Found a INVALID SgOmpUnifiedSharedMemoryClause object in the memory pool \n");
36014 : }
36015 : }
36016 : }
36017 : }
36018 :
36019 : // This should not be required since all previously static data members are
36020 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
36021 :
36022 194 : }
36023 :
36024 : void
36025 0 : SgOmpUnifiedSharedMemoryClause::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
36026 : {
36027 : // This function visits only a single IR node of the memory pool.
36028 : // it is typically called once for each type of IR node within
36029 : // the automatically generated function: traverseRepresentativeNodes().
36030 :
36031 : // Initialize array to the address of the first element of the STL vector
36032 : // (which is guarenteed to be contiguous storage).
36033 : // SgOmpUnifiedSharedMemoryClause objectArray [] = *(Memory_Block_List.begin());
36034 0 : if (SgOmpUnifiedSharedMemoryClause::pools.empty() == false)
36035 : {
36036 : // Generate an array of memory pools
36037 0 : SgOmpUnifiedSharedMemoryClause** objectArray = (SgOmpUnifiedSharedMemoryClause**) &(SgOmpUnifiedSharedMemoryClause::pools[0]);
36038 :
36039 : // Build a local variable for better performance
36040 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
36041 :
36042 : // Iterate over the memory pools
36043 0 : bool done = false;
36044 0 : unsigned i=0;
36045 :
36046 : // find the first valid IR node, call visit function, and then leave
36047 0 : while ( done == false && i < SgOmpUnifiedSharedMemoryClause::pools.size() )
36048 : {
36049 : // objectArray[i] is a single memory pool
36050 : unsigned j=0;
36051 0 : while (done == false && j < SgOmpUnifiedSharedMemoryClause::pool_size)
36052 : {
36053 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
36054 : {
36055 0 : traversal.visit(&(objectArray[i][j]));
36056 0 : done = true;
36057 : }
36058 0 : j++;
36059 : }
36060 0 : i++;
36061 : }
36062 :
36063 : #if 0
36064 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
36065 : if (done == false)
36066 : {
36067 : printf ("No representative for SgOmpUnifiedSharedMemoryClause found in memory pools \n");
36068 : }
36069 : #endif
36070 : }
36071 0 : }
36072 :
36073 :
36074 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
36075 : // using values that overflow signed values of int.
36076 : size_t
36077 4 : SgOmpUnifiedSharedMemoryClause::numberOfNodes()
36078 : {
36079 : // This function traverses the memory pool for an IR node and
36080 : // counts the number of IR nodes of a particular Sage III IR
36081 : // nodes type.
36082 :
36083 4 : size_t count = 0;
36084 4 : if (SgOmpUnifiedSharedMemoryClause::pools.empty() == false)
36085 : {
36086 : // Generate an array of memory pools (this is actually a STL vector,
36087 : // but it is contiguious, so OK to treat this way).
36088 0 : SgOmpUnifiedSharedMemoryClause** objectArray = (SgOmpUnifiedSharedMemoryClause**) &(SgOmpUnifiedSharedMemoryClause::pools[0]);
36089 :
36090 : // Build a local variable for better performance (make it a loop invariant variable).
36091 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
36092 :
36093 : // Iterate over all of the memory pools for this IR node.
36094 0 : for (unsigned int i=0; i < SgOmpUnifiedSharedMemoryClause::pools.size(); i++)
36095 : {
36096 : // objectArray[i] is a single memory pool, iterate over all the
36097 : // IR nodes and only count those that are valid IR nodes used in
36098 : // the AST (i.e. allocated IR nodes).
36099 0 : for (unsigned j=0; j < SgOmpUnifiedSharedMemoryClause::pool_size; j++)
36100 : {
36101 : // This is indexing the STL vector of C/C++ style arrays as a doubly
36102 : // indexed array access. It is OK since we have leveraged the semantics
36103 : // of STL vector memory as contigous and cast the memory as an array
36104 : // of arrays to use the 2D array indexing. Hope this is not confusing,
36105 : // but it s very fast as an implementation.
36106 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
36107 : {
36108 0 : count++;
36109 : }
36110 : }
36111 : }
36112 : }
36113 :
36114 :
36115 :
36116 4 : return count;
36117 : }
36118 :
36119 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
36120 : // using values that overflow signed values of int.
36121 : size_t
36122 0 : SgOmpUnifiedSharedMemoryClause::memoryUsage()
36123 : {
36124 : // This function is required because we need the class name as a type when we call sizeof
36125 : // There might be another way to implement this if we have a traversal that only called a
36126 : // representative object (one call for each type of Sage IIIIR node).
36127 0 : size_t memory = numberOfNodes() * sizeof(SgOmpUnifiedSharedMemoryClause);
36128 :
36129 0 : return memory;
36130 : }
36131 :
36132 : /* #line 36133 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
36133 :
36134 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
36135 : void
36136 5342 : SgOmpDynamicAllocatorsClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
36137 : {
36138 : // This function traverses the memory pool for only a specific IR node
36139 : // and calls the visit function of the input class execute a traversal
36140 : // similar to the style of the attribute based traversals within ROSE.
36141 : // This traversal will visit ALL nodes of the AST where as the other
36142 : // attribute based traversals visit only the embedded tree within the AST.
36143 :
36144 : // Initialize array to the address of the first element of the STL vector
36145 : // (which is guaranteed to be contiguous storage).
36146 : // SgOmpDynamicAllocatorsClause objectArray [] = *(Memory_Block_List.begin());
36147 5342 : if (SgOmpDynamicAllocatorsClause::pools.empty() == false)
36148 : {
36149 : // Generate an array of memory pools
36150 7 : SgOmpDynamicAllocatorsClause** objectArray = (SgOmpDynamicAllocatorsClause**) &(SgOmpDynamicAllocatorsClause::pools[0]);
36151 :
36152 : // Build a local variable for better performance
36153 7 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
36154 : #if 0
36155 : // Iterate over the memory pools
36156 : for (unsigned int i=0; i < SgOmpDynamicAllocatorsClause::pools.size(); i++)
36157 : {
36158 : // objectArray[i] is a single memory pool
36159 : for (int j=0; j < SgOmpDynamicAllocatorsClause::pool_size; j++)
36160 : {
36161 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
36162 : {
36163 : traversal.visit(&(objectArray[i][j]));
36164 : }
36165 : }
36166 : }
36167 : #else
36168 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
36169 : // compute the list first and then call the visit function on each list element.
36170 :
36171 : // printf ("Inside of SgOmpDynamicAllocatorsClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
36172 :
36173 14 : std::vector<SgOmpDynamicAllocatorsClause*> nodeList;
36174 :
36175 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
36176 14 : for (unsigned int i=0; i < SgOmpDynamicAllocatorsClause::pools.size(); i++)
36177 : {
36178 : // objectArray[i] is a single memory pool
36179 14007 : for (unsigned j=0; j < SgOmpDynamicAllocatorsClause::pool_size; j++)
36180 : {
36181 14000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
36182 : {
36183 7 : nodeList.push_back(&(objectArray[i][j]));
36184 : }
36185 : }
36186 : }
36187 :
36188 : // Iterate over the saved list
36189 7 : size_t nodeListSize = nodeList.size();
36190 14 : for (size_t i=0; i < nodeListSize; i++)
36191 : {
36192 7 : ROSE_ASSERT(nodeList[i] != NULL);
36193 : #if 0
36194 : traversal.visit(nodeList[i]);
36195 : #else
36196 7 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
36197 : {
36198 7 : traversal.visit(nodeList[i]);
36199 : }
36200 : #endif
36201 : }
36202 : #endif
36203 : }
36204 :
36205 : // This should not be required since all previously static data members are
36206 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
36207 :
36208 5342 : }
36209 :
36210 :
36211 : void
36212 194 : SgOmpDynamicAllocatorsClause::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
36213 : {
36214 : // This function traverses the memory pool for an IR node and
36215 : // calls the function to execute the visitor object.
36216 :
36217 : // Initialize array to the address of the first element of the STL vector
36218 : // (which is guarenteed to be contiguous storage).
36219 : // SgOmpDynamicAllocatorsClause objectArray [] = *(Memory_Block_List.begin());
36220 194 : if (SgOmpDynamicAllocatorsClause::pools.empty() == false)
36221 : {
36222 : // Generate an array of memory pools
36223 0 : SgOmpDynamicAllocatorsClause** objectArray = (SgOmpDynamicAllocatorsClause**) &(SgOmpDynamicAllocatorsClause::pools[0]);
36224 :
36225 : // Build a local variable for better performance
36226 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
36227 :
36228 : // Iterate over the memory pools
36229 0 : for (unsigned int i=0; i < SgOmpDynamicAllocatorsClause::pools.size(); i++)
36230 : {
36231 : // objectArray[i] is a single memory pool
36232 0 : for (unsigned j=0; j < SgOmpDynamicAllocatorsClause::pool_size; j++)
36233 : {
36234 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
36235 : {
36236 : // printf ("Found a valid SgOmpDynamicAllocatorsClause object in the memory pool %d at position %d \n",i,j);
36237 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
36238 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
36239 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
36240 : }
36241 : else
36242 : {
36243 : // printf ("Found a INVALID SgOmpDynamicAllocatorsClause object in the memory pool \n");
36244 : }
36245 : }
36246 : }
36247 : }
36248 :
36249 : // This should not be required since all previously static data members are
36250 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
36251 :
36252 194 : }
36253 :
36254 : void
36255 0 : SgOmpDynamicAllocatorsClause::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
36256 : {
36257 : // This function visits only a single IR node of the memory pool.
36258 : // it is typically called once for each type of IR node within
36259 : // the automatically generated function: traverseRepresentativeNodes().
36260 :
36261 : // Initialize array to the address of the first element of the STL vector
36262 : // (which is guarenteed to be contiguous storage).
36263 : // SgOmpDynamicAllocatorsClause objectArray [] = *(Memory_Block_List.begin());
36264 0 : if (SgOmpDynamicAllocatorsClause::pools.empty() == false)
36265 : {
36266 : // Generate an array of memory pools
36267 0 : SgOmpDynamicAllocatorsClause** objectArray = (SgOmpDynamicAllocatorsClause**) &(SgOmpDynamicAllocatorsClause::pools[0]);
36268 :
36269 : // Build a local variable for better performance
36270 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
36271 :
36272 : // Iterate over the memory pools
36273 0 : bool done = false;
36274 0 : unsigned i=0;
36275 :
36276 : // find the first valid IR node, call visit function, and then leave
36277 0 : while ( done == false && i < SgOmpDynamicAllocatorsClause::pools.size() )
36278 : {
36279 : // objectArray[i] is a single memory pool
36280 : unsigned j=0;
36281 0 : while (done == false && j < SgOmpDynamicAllocatorsClause::pool_size)
36282 : {
36283 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
36284 : {
36285 0 : traversal.visit(&(objectArray[i][j]));
36286 0 : done = true;
36287 : }
36288 0 : j++;
36289 : }
36290 0 : i++;
36291 : }
36292 :
36293 : #if 0
36294 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
36295 : if (done == false)
36296 : {
36297 : printf ("No representative for SgOmpDynamicAllocatorsClause found in memory pools \n");
36298 : }
36299 : #endif
36300 : }
36301 0 : }
36302 :
36303 :
36304 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
36305 : // using values that overflow signed values of int.
36306 : size_t
36307 4 : SgOmpDynamicAllocatorsClause::numberOfNodes()
36308 : {
36309 : // This function traverses the memory pool for an IR node and
36310 : // counts the number of IR nodes of a particular Sage III IR
36311 : // nodes type.
36312 :
36313 4 : size_t count = 0;
36314 4 : if (SgOmpDynamicAllocatorsClause::pools.empty() == false)
36315 : {
36316 : // Generate an array of memory pools (this is actually a STL vector,
36317 : // but it is contiguious, so OK to treat this way).
36318 0 : SgOmpDynamicAllocatorsClause** objectArray = (SgOmpDynamicAllocatorsClause**) &(SgOmpDynamicAllocatorsClause::pools[0]);
36319 :
36320 : // Build a local variable for better performance (make it a loop invariant variable).
36321 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
36322 :
36323 : // Iterate over all of the memory pools for this IR node.
36324 0 : for (unsigned int i=0; i < SgOmpDynamicAllocatorsClause::pools.size(); i++)
36325 : {
36326 : // objectArray[i] is a single memory pool, iterate over all the
36327 : // IR nodes and only count those that are valid IR nodes used in
36328 : // the AST (i.e. allocated IR nodes).
36329 0 : for (unsigned j=0; j < SgOmpDynamicAllocatorsClause::pool_size; j++)
36330 : {
36331 : // This is indexing the STL vector of C/C++ style arrays as a doubly
36332 : // indexed array access. It is OK since we have leveraged the semantics
36333 : // of STL vector memory as contigous and cast the memory as an array
36334 : // of arrays to use the 2D array indexing. Hope this is not confusing,
36335 : // but it s very fast as an implementation.
36336 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
36337 : {
36338 0 : count++;
36339 : }
36340 : }
36341 : }
36342 : }
36343 :
36344 :
36345 :
36346 4 : return count;
36347 : }
36348 :
36349 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
36350 : // using values that overflow signed values of int.
36351 : size_t
36352 0 : SgOmpDynamicAllocatorsClause::memoryUsage()
36353 : {
36354 : // This function is required because we need the class name as a type when we call sizeof
36355 : // There might be another way to implement this if we have a traversal that only called a
36356 : // representative object (one call for each type of Sage IIIIR node).
36357 0 : size_t memory = numberOfNodes() * sizeof(SgOmpDynamicAllocatorsClause);
36358 :
36359 0 : return memory;
36360 : }
36361 :
36362 : /* #line 36363 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
36363 :
36364 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
36365 : void
36366 5342 : SgOmpParallelClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
36367 : {
36368 : // This function traverses the memory pool for only a specific IR node
36369 : // and calls the visit function of the input class execute a traversal
36370 : // similar to the style of the attribute based traversals within ROSE.
36371 : // This traversal will visit ALL nodes of the AST where as the other
36372 : // attribute based traversals visit only the embedded tree within the AST.
36373 :
36374 : // Initialize array to the address of the first element of the STL vector
36375 : // (which is guaranteed to be contiguous storage).
36376 : // SgOmpParallelClause objectArray [] = *(Memory_Block_List.begin());
36377 5342 : if (SgOmpParallelClause::pools.empty() == false)
36378 : {
36379 : // Generate an array of memory pools
36380 14 : SgOmpParallelClause** objectArray = (SgOmpParallelClause**) &(SgOmpParallelClause::pools[0]);
36381 :
36382 : // Build a local variable for better performance
36383 14 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
36384 : #if 0
36385 : // Iterate over the memory pools
36386 : for (unsigned int i=0; i < SgOmpParallelClause::pools.size(); i++)
36387 : {
36388 : // objectArray[i] is a single memory pool
36389 : for (int j=0; j < SgOmpParallelClause::pool_size; j++)
36390 : {
36391 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
36392 : {
36393 : traversal.visit(&(objectArray[i][j]));
36394 : }
36395 : }
36396 : }
36397 : #else
36398 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
36399 : // compute the list first and then call the visit function on each list element.
36400 :
36401 : // printf ("Inside of SgOmpParallelClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
36402 :
36403 28 : std::vector<SgOmpParallelClause*> nodeList;
36404 :
36405 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
36406 28 : for (unsigned int i=0; i < SgOmpParallelClause::pools.size(); i++)
36407 : {
36408 : // objectArray[i] is a single memory pool
36409 28014 : for (unsigned j=0; j < SgOmpParallelClause::pool_size; j++)
36410 : {
36411 28000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
36412 : {
36413 14 : nodeList.push_back(&(objectArray[i][j]));
36414 : }
36415 : }
36416 : }
36417 :
36418 : // Iterate over the saved list
36419 14 : size_t nodeListSize = nodeList.size();
36420 28 : for (size_t i=0; i < nodeListSize; i++)
36421 : {
36422 14 : ROSE_ASSERT(nodeList[i] != NULL);
36423 : #if 0
36424 : traversal.visit(nodeList[i]);
36425 : #else
36426 14 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
36427 : {
36428 14 : traversal.visit(nodeList[i]);
36429 : }
36430 : #endif
36431 : }
36432 : #endif
36433 : }
36434 :
36435 : // This should not be required since all previously static data members are
36436 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
36437 :
36438 5342 : }
36439 :
36440 :
36441 : void
36442 194 : SgOmpParallelClause::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
36443 : {
36444 : // This function traverses the memory pool for an IR node and
36445 : // calls the function to execute the visitor object.
36446 :
36447 : // Initialize array to the address of the first element of the STL vector
36448 : // (which is guarenteed to be contiguous storage).
36449 : // SgOmpParallelClause objectArray [] = *(Memory_Block_List.begin());
36450 194 : if (SgOmpParallelClause::pools.empty() == false)
36451 : {
36452 : // Generate an array of memory pools
36453 0 : SgOmpParallelClause** objectArray = (SgOmpParallelClause**) &(SgOmpParallelClause::pools[0]);
36454 :
36455 : // Build a local variable for better performance
36456 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
36457 :
36458 : // Iterate over the memory pools
36459 0 : for (unsigned int i=0; i < SgOmpParallelClause::pools.size(); i++)
36460 : {
36461 : // objectArray[i] is a single memory pool
36462 0 : for (unsigned j=0; j < SgOmpParallelClause::pool_size; j++)
36463 : {
36464 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
36465 : {
36466 : // printf ("Found a valid SgOmpParallelClause object in the memory pool %d at position %d \n",i,j);
36467 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
36468 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
36469 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
36470 : }
36471 : else
36472 : {
36473 : // printf ("Found a INVALID SgOmpParallelClause object in the memory pool \n");
36474 : }
36475 : }
36476 : }
36477 : }
36478 :
36479 : // This should not be required since all previously static data members are
36480 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
36481 :
36482 194 : }
36483 :
36484 : void
36485 0 : SgOmpParallelClause::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
36486 : {
36487 : // This function visits only a single IR node of the memory pool.
36488 : // it is typically called once for each type of IR node within
36489 : // the automatically generated function: traverseRepresentativeNodes().
36490 :
36491 : // Initialize array to the address of the first element of the STL vector
36492 : // (which is guarenteed to be contiguous storage).
36493 : // SgOmpParallelClause objectArray [] = *(Memory_Block_List.begin());
36494 0 : if (SgOmpParallelClause::pools.empty() == false)
36495 : {
36496 : // Generate an array of memory pools
36497 0 : SgOmpParallelClause** objectArray = (SgOmpParallelClause**) &(SgOmpParallelClause::pools[0]);
36498 :
36499 : // Build a local variable for better performance
36500 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
36501 :
36502 : // Iterate over the memory pools
36503 0 : bool done = false;
36504 0 : unsigned i=0;
36505 :
36506 : // find the first valid IR node, call visit function, and then leave
36507 0 : while ( done == false && i < SgOmpParallelClause::pools.size() )
36508 : {
36509 : // objectArray[i] is a single memory pool
36510 : unsigned j=0;
36511 0 : while (done == false && j < SgOmpParallelClause::pool_size)
36512 : {
36513 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
36514 : {
36515 0 : traversal.visit(&(objectArray[i][j]));
36516 0 : done = true;
36517 : }
36518 0 : j++;
36519 : }
36520 0 : i++;
36521 : }
36522 :
36523 : #if 0
36524 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
36525 : if (done == false)
36526 : {
36527 : printf ("No representative for SgOmpParallelClause found in memory pools \n");
36528 : }
36529 : #endif
36530 : }
36531 0 : }
36532 :
36533 :
36534 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
36535 : // using values that overflow signed values of int.
36536 : size_t
36537 4 : SgOmpParallelClause::numberOfNodes()
36538 : {
36539 : // This function traverses the memory pool for an IR node and
36540 : // counts the number of IR nodes of a particular Sage III IR
36541 : // nodes type.
36542 :
36543 4 : size_t count = 0;
36544 4 : if (SgOmpParallelClause::pools.empty() == false)
36545 : {
36546 : // Generate an array of memory pools (this is actually a STL vector,
36547 : // but it is contiguious, so OK to treat this way).
36548 0 : SgOmpParallelClause** objectArray = (SgOmpParallelClause**) &(SgOmpParallelClause::pools[0]);
36549 :
36550 : // Build a local variable for better performance (make it a loop invariant variable).
36551 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
36552 :
36553 : // Iterate over all of the memory pools for this IR node.
36554 0 : for (unsigned int i=0; i < SgOmpParallelClause::pools.size(); i++)
36555 : {
36556 : // objectArray[i] is a single memory pool, iterate over all the
36557 : // IR nodes and only count those that are valid IR nodes used in
36558 : // the AST (i.e. allocated IR nodes).
36559 0 : for (unsigned j=0; j < SgOmpParallelClause::pool_size; j++)
36560 : {
36561 : // This is indexing the STL vector of C/C++ style arrays as a doubly
36562 : // indexed array access. It is OK since we have leveraged the semantics
36563 : // of STL vector memory as contigous and cast the memory as an array
36564 : // of arrays to use the 2D array indexing. Hope this is not confusing,
36565 : // but it s very fast as an implementation.
36566 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
36567 : {
36568 0 : count++;
36569 : }
36570 : }
36571 : }
36572 : }
36573 :
36574 :
36575 :
36576 4 : return count;
36577 : }
36578 :
36579 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
36580 : // using values that overflow signed values of int.
36581 : size_t
36582 0 : SgOmpParallelClause::memoryUsage()
36583 : {
36584 : // This function is required because we need the class name as a type when we call sizeof
36585 : // There might be another way to implement this if we have a traversal that only called a
36586 : // representative object (one call for each type of Sage IIIIR node).
36587 0 : size_t memory = numberOfNodes() * sizeof(SgOmpParallelClause);
36588 :
36589 0 : return memory;
36590 : }
36591 :
36592 : /* #line 36593 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
36593 :
36594 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
36595 : void
36596 5342 : SgOmpSectionsClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
36597 : {
36598 : // This function traverses the memory pool for only a specific IR node
36599 : // and calls the visit function of the input class execute a traversal
36600 : // similar to the style of the attribute based traversals within ROSE.
36601 : // This traversal will visit ALL nodes of the AST where as the other
36602 : // attribute based traversals visit only the embedded tree within the AST.
36603 :
36604 : // Initialize array to the address of the first element of the STL vector
36605 : // (which is guaranteed to be contiguous storage).
36606 : // SgOmpSectionsClause objectArray [] = *(Memory_Block_List.begin());
36607 5342 : if (SgOmpSectionsClause::pools.empty() == false)
36608 : {
36609 : // Generate an array of memory pools
36610 0 : SgOmpSectionsClause** objectArray = (SgOmpSectionsClause**) &(SgOmpSectionsClause::pools[0]);
36611 :
36612 : // Build a local variable for better performance
36613 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
36614 : #if 0
36615 : // Iterate over the memory pools
36616 : for (unsigned int i=0; i < SgOmpSectionsClause::pools.size(); i++)
36617 : {
36618 : // objectArray[i] is a single memory pool
36619 : for (int j=0; j < SgOmpSectionsClause::pool_size; j++)
36620 : {
36621 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
36622 : {
36623 : traversal.visit(&(objectArray[i][j]));
36624 : }
36625 : }
36626 : }
36627 : #else
36628 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
36629 : // compute the list first and then call the visit function on each list element.
36630 :
36631 : // printf ("Inside of SgOmpSectionsClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
36632 :
36633 0 : std::vector<SgOmpSectionsClause*> nodeList;
36634 :
36635 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
36636 0 : for (unsigned int i=0; i < SgOmpSectionsClause::pools.size(); i++)
36637 : {
36638 : // objectArray[i] is a single memory pool
36639 0 : for (unsigned j=0; j < SgOmpSectionsClause::pool_size; j++)
36640 : {
36641 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
36642 : {
36643 0 : nodeList.push_back(&(objectArray[i][j]));
36644 : }
36645 : }
36646 : }
36647 :
36648 : // Iterate over the saved list
36649 0 : size_t nodeListSize = nodeList.size();
36650 0 : for (size_t i=0; i < nodeListSize; i++)
36651 : {
36652 0 : ROSE_ASSERT(nodeList[i] != NULL);
36653 : #if 0
36654 : traversal.visit(nodeList[i]);
36655 : #else
36656 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
36657 : {
36658 0 : traversal.visit(nodeList[i]);
36659 : }
36660 : #endif
36661 : }
36662 : #endif
36663 : }
36664 :
36665 : // This should not be required since all previously static data members are
36666 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
36667 :
36668 5342 : }
36669 :
36670 :
36671 : void
36672 194 : SgOmpSectionsClause::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
36673 : {
36674 : // This function traverses the memory pool for an IR node and
36675 : // calls the function to execute the visitor object.
36676 :
36677 : // Initialize array to the address of the first element of the STL vector
36678 : // (which is guarenteed to be contiguous storage).
36679 : // SgOmpSectionsClause objectArray [] = *(Memory_Block_List.begin());
36680 194 : if (SgOmpSectionsClause::pools.empty() == false)
36681 : {
36682 : // Generate an array of memory pools
36683 0 : SgOmpSectionsClause** objectArray = (SgOmpSectionsClause**) &(SgOmpSectionsClause::pools[0]);
36684 :
36685 : // Build a local variable for better performance
36686 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
36687 :
36688 : // Iterate over the memory pools
36689 0 : for (unsigned int i=0; i < SgOmpSectionsClause::pools.size(); i++)
36690 : {
36691 : // objectArray[i] is a single memory pool
36692 0 : for (unsigned j=0; j < SgOmpSectionsClause::pool_size; j++)
36693 : {
36694 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
36695 : {
36696 : // printf ("Found a valid SgOmpSectionsClause object in the memory pool %d at position %d \n",i,j);
36697 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
36698 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
36699 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
36700 : }
36701 : else
36702 : {
36703 : // printf ("Found a INVALID SgOmpSectionsClause object in the memory pool \n");
36704 : }
36705 : }
36706 : }
36707 : }
36708 :
36709 : // This should not be required since all previously static data members are
36710 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
36711 :
36712 194 : }
36713 :
36714 : void
36715 0 : SgOmpSectionsClause::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
36716 : {
36717 : // This function visits only a single IR node of the memory pool.
36718 : // it is typically called once for each type of IR node within
36719 : // the automatically generated function: traverseRepresentativeNodes().
36720 :
36721 : // Initialize array to the address of the first element of the STL vector
36722 : // (which is guarenteed to be contiguous storage).
36723 : // SgOmpSectionsClause objectArray [] = *(Memory_Block_List.begin());
36724 0 : if (SgOmpSectionsClause::pools.empty() == false)
36725 : {
36726 : // Generate an array of memory pools
36727 0 : SgOmpSectionsClause** objectArray = (SgOmpSectionsClause**) &(SgOmpSectionsClause::pools[0]);
36728 :
36729 : // Build a local variable for better performance
36730 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
36731 :
36732 : // Iterate over the memory pools
36733 0 : bool done = false;
36734 0 : unsigned i=0;
36735 :
36736 : // find the first valid IR node, call visit function, and then leave
36737 0 : while ( done == false && i < SgOmpSectionsClause::pools.size() )
36738 : {
36739 : // objectArray[i] is a single memory pool
36740 : unsigned j=0;
36741 0 : while (done == false && j < SgOmpSectionsClause::pool_size)
36742 : {
36743 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
36744 : {
36745 0 : traversal.visit(&(objectArray[i][j]));
36746 0 : done = true;
36747 : }
36748 0 : j++;
36749 : }
36750 0 : i++;
36751 : }
36752 :
36753 : #if 0
36754 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
36755 : if (done == false)
36756 : {
36757 : printf ("No representative for SgOmpSectionsClause found in memory pools \n");
36758 : }
36759 : #endif
36760 : }
36761 0 : }
36762 :
36763 :
36764 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
36765 : // using values that overflow signed values of int.
36766 : size_t
36767 4 : SgOmpSectionsClause::numberOfNodes()
36768 : {
36769 : // This function traverses the memory pool for an IR node and
36770 : // counts the number of IR nodes of a particular Sage III IR
36771 : // nodes type.
36772 :
36773 4 : size_t count = 0;
36774 4 : if (SgOmpSectionsClause::pools.empty() == false)
36775 : {
36776 : // Generate an array of memory pools (this is actually a STL vector,
36777 : // but it is contiguious, so OK to treat this way).
36778 0 : SgOmpSectionsClause** objectArray = (SgOmpSectionsClause**) &(SgOmpSectionsClause::pools[0]);
36779 :
36780 : // Build a local variable for better performance (make it a loop invariant variable).
36781 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
36782 :
36783 : // Iterate over all of the memory pools for this IR node.
36784 0 : for (unsigned int i=0; i < SgOmpSectionsClause::pools.size(); i++)
36785 : {
36786 : // objectArray[i] is a single memory pool, iterate over all the
36787 : // IR nodes and only count those that are valid IR nodes used in
36788 : // the AST (i.e. allocated IR nodes).
36789 0 : for (unsigned j=0; j < SgOmpSectionsClause::pool_size; j++)
36790 : {
36791 : // This is indexing the STL vector of C/C++ style arrays as a doubly
36792 : // indexed array access. It is OK since we have leveraged the semantics
36793 : // of STL vector memory as contigous and cast the memory as an array
36794 : // of arrays to use the 2D array indexing. Hope this is not confusing,
36795 : // but it s very fast as an implementation.
36796 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
36797 : {
36798 0 : count++;
36799 : }
36800 : }
36801 : }
36802 : }
36803 :
36804 :
36805 :
36806 4 : return count;
36807 : }
36808 :
36809 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
36810 : // using values that overflow signed values of int.
36811 : size_t
36812 0 : SgOmpSectionsClause::memoryUsage()
36813 : {
36814 : // This function is required because we need the class name as a type when we call sizeof
36815 : // There might be another way to implement this if we have a traversal that only called a
36816 : // representative object (one call for each type of Sage IIIIR node).
36817 0 : size_t memory = numberOfNodes() * sizeof(SgOmpSectionsClause);
36818 :
36819 0 : return memory;
36820 : }
36821 :
36822 : /* #line 36823 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
36823 :
36824 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
36825 : void
36826 5342 : SgOmpForClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
36827 : {
36828 : // This function traverses the memory pool for only a specific IR node
36829 : // and calls the visit function of the input class execute a traversal
36830 : // similar to the style of the attribute based traversals within ROSE.
36831 : // This traversal will visit ALL nodes of the AST where as the other
36832 : // attribute based traversals visit only the embedded tree within the AST.
36833 :
36834 : // Initialize array to the address of the first element of the STL vector
36835 : // (which is guaranteed to be contiguous storage).
36836 : // SgOmpForClause objectArray [] = *(Memory_Block_List.begin());
36837 5342 : if (SgOmpForClause::pools.empty() == false)
36838 : {
36839 : // Generate an array of memory pools
36840 0 : SgOmpForClause** objectArray = (SgOmpForClause**) &(SgOmpForClause::pools[0]);
36841 :
36842 : // Build a local variable for better performance
36843 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
36844 : #if 0
36845 : // Iterate over the memory pools
36846 : for (unsigned int i=0; i < SgOmpForClause::pools.size(); i++)
36847 : {
36848 : // objectArray[i] is a single memory pool
36849 : for (int j=0; j < SgOmpForClause::pool_size; j++)
36850 : {
36851 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
36852 : {
36853 : traversal.visit(&(objectArray[i][j]));
36854 : }
36855 : }
36856 : }
36857 : #else
36858 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
36859 : // compute the list first and then call the visit function on each list element.
36860 :
36861 : // printf ("Inside of SgOmpForClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
36862 :
36863 0 : std::vector<SgOmpForClause*> nodeList;
36864 :
36865 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
36866 0 : for (unsigned int i=0; i < SgOmpForClause::pools.size(); i++)
36867 : {
36868 : // objectArray[i] is a single memory pool
36869 0 : for (unsigned j=0; j < SgOmpForClause::pool_size; j++)
36870 : {
36871 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
36872 : {
36873 0 : nodeList.push_back(&(objectArray[i][j]));
36874 : }
36875 : }
36876 : }
36877 :
36878 : // Iterate over the saved list
36879 0 : size_t nodeListSize = nodeList.size();
36880 0 : for (size_t i=0; i < nodeListSize; i++)
36881 : {
36882 0 : ROSE_ASSERT(nodeList[i] != NULL);
36883 : #if 0
36884 : traversal.visit(nodeList[i]);
36885 : #else
36886 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
36887 : {
36888 0 : traversal.visit(nodeList[i]);
36889 : }
36890 : #endif
36891 : }
36892 : #endif
36893 : }
36894 :
36895 : // This should not be required since all previously static data members are
36896 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
36897 :
36898 5342 : }
36899 :
36900 :
36901 : void
36902 194 : SgOmpForClause::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
36903 : {
36904 : // This function traverses the memory pool for an IR node and
36905 : // calls the function to execute the visitor object.
36906 :
36907 : // Initialize array to the address of the first element of the STL vector
36908 : // (which is guarenteed to be contiguous storage).
36909 : // SgOmpForClause objectArray [] = *(Memory_Block_List.begin());
36910 194 : if (SgOmpForClause::pools.empty() == false)
36911 : {
36912 : // Generate an array of memory pools
36913 0 : SgOmpForClause** objectArray = (SgOmpForClause**) &(SgOmpForClause::pools[0]);
36914 :
36915 : // Build a local variable for better performance
36916 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
36917 :
36918 : // Iterate over the memory pools
36919 0 : for (unsigned int i=0; i < SgOmpForClause::pools.size(); i++)
36920 : {
36921 : // objectArray[i] is a single memory pool
36922 0 : for (unsigned j=0; j < SgOmpForClause::pool_size; j++)
36923 : {
36924 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
36925 : {
36926 : // printf ("Found a valid SgOmpForClause object in the memory pool %d at position %d \n",i,j);
36927 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
36928 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
36929 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
36930 : }
36931 : else
36932 : {
36933 : // printf ("Found a INVALID SgOmpForClause object in the memory pool \n");
36934 : }
36935 : }
36936 : }
36937 : }
36938 :
36939 : // This should not be required since all previously static data members are
36940 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
36941 :
36942 194 : }
36943 :
36944 : void
36945 0 : SgOmpForClause::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
36946 : {
36947 : // This function visits only a single IR node of the memory pool.
36948 : // it is typically called once for each type of IR node within
36949 : // the automatically generated function: traverseRepresentativeNodes().
36950 :
36951 : // Initialize array to the address of the first element of the STL vector
36952 : // (which is guarenteed to be contiguous storage).
36953 : // SgOmpForClause objectArray [] = *(Memory_Block_List.begin());
36954 0 : if (SgOmpForClause::pools.empty() == false)
36955 : {
36956 : // Generate an array of memory pools
36957 0 : SgOmpForClause** objectArray = (SgOmpForClause**) &(SgOmpForClause::pools[0]);
36958 :
36959 : // Build a local variable for better performance
36960 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
36961 :
36962 : // Iterate over the memory pools
36963 0 : bool done = false;
36964 0 : unsigned i=0;
36965 :
36966 : // find the first valid IR node, call visit function, and then leave
36967 0 : while ( done == false && i < SgOmpForClause::pools.size() )
36968 : {
36969 : // objectArray[i] is a single memory pool
36970 : unsigned j=0;
36971 0 : while (done == false && j < SgOmpForClause::pool_size)
36972 : {
36973 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
36974 : {
36975 0 : traversal.visit(&(objectArray[i][j]));
36976 0 : done = true;
36977 : }
36978 0 : j++;
36979 : }
36980 0 : i++;
36981 : }
36982 :
36983 : #if 0
36984 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
36985 : if (done == false)
36986 : {
36987 : printf ("No representative for SgOmpForClause found in memory pools \n");
36988 : }
36989 : #endif
36990 : }
36991 0 : }
36992 :
36993 :
36994 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
36995 : // using values that overflow signed values of int.
36996 : size_t
36997 4 : SgOmpForClause::numberOfNodes()
36998 : {
36999 : // This function traverses the memory pool for an IR node and
37000 : // counts the number of IR nodes of a particular Sage III IR
37001 : // nodes type.
37002 :
37003 4 : size_t count = 0;
37004 4 : if (SgOmpForClause::pools.empty() == false)
37005 : {
37006 : // Generate an array of memory pools (this is actually a STL vector,
37007 : // but it is contiguious, so OK to treat this way).
37008 0 : SgOmpForClause** objectArray = (SgOmpForClause**) &(SgOmpForClause::pools[0]);
37009 :
37010 : // Build a local variable for better performance (make it a loop invariant variable).
37011 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
37012 :
37013 : // Iterate over all of the memory pools for this IR node.
37014 0 : for (unsigned int i=0; i < SgOmpForClause::pools.size(); i++)
37015 : {
37016 : // objectArray[i] is a single memory pool, iterate over all the
37017 : // IR nodes and only count those that are valid IR nodes used in
37018 : // the AST (i.e. allocated IR nodes).
37019 0 : for (unsigned j=0; j < SgOmpForClause::pool_size; j++)
37020 : {
37021 : // This is indexing the STL vector of C/C++ style arrays as a doubly
37022 : // indexed array access. It is OK since we have leveraged the semantics
37023 : // of STL vector memory as contigous and cast the memory as an array
37024 : // of arrays to use the 2D array indexing. Hope this is not confusing,
37025 : // but it s very fast as an implementation.
37026 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
37027 : {
37028 0 : count++;
37029 : }
37030 : }
37031 : }
37032 : }
37033 :
37034 :
37035 :
37036 4 : return count;
37037 : }
37038 :
37039 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
37040 : // using values that overflow signed values of int.
37041 : size_t
37042 0 : SgOmpForClause::memoryUsage()
37043 : {
37044 : // This function is required because we need the class name as a type when we call sizeof
37045 : // There might be another way to implement this if we have a traversal that only called a
37046 : // representative object (one call for each type of Sage IIIIR node).
37047 0 : size_t memory = numberOfNodes() * sizeof(SgOmpForClause);
37048 :
37049 0 : return memory;
37050 : }
37051 :
37052 : /* #line 37053 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
37053 :
37054 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
37055 : void
37056 5342 : SgOmpTaskgroupClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
37057 : {
37058 : // This function traverses the memory pool for only a specific IR node
37059 : // and calls the visit function of the input class execute a traversal
37060 : // similar to the style of the attribute based traversals within ROSE.
37061 : // This traversal will visit ALL nodes of the AST where as the other
37062 : // attribute based traversals visit only the embedded tree within the AST.
37063 :
37064 : // Initialize array to the address of the first element of the STL vector
37065 : // (which is guaranteed to be contiguous storage).
37066 : // SgOmpTaskgroupClause objectArray [] = *(Memory_Block_List.begin());
37067 5342 : if (SgOmpTaskgroupClause::pools.empty() == false)
37068 : {
37069 : // Generate an array of memory pools
37070 0 : SgOmpTaskgroupClause** objectArray = (SgOmpTaskgroupClause**) &(SgOmpTaskgroupClause::pools[0]);
37071 :
37072 : // Build a local variable for better performance
37073 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
37074 : #if 0
37075 : // Iterate over the memory pools
37076 : for (unsigned int i=0; i < SgOmpTaskgroupClause::pools.size(); i++)
37077 : {
37078 : // objectArray[i] is a single memory pool
37079 : for (int j=0; j < SgOmpTaskgroupClause::pool_size; j++)
37080 : {
37081 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
37082 : {
37083 : traversal.visit(&(objectArray[i][j]));
37084 : }
37085 : }
37086 : }
37087 : #else
37088 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
37089 : // compute the list first and then call the visit function on each list element.
37090 :
37091 : // printf ("Inside of SgOmpTaskgroupClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
37092 :
37093 0 : std::vector<SgOmpTaskgroupClause*> nodeList;
37094 :
37095 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
37096 0 : for (unsigned int i=0; i < SgOmpTaskgroupClause::pools.size(); i++)
37097 : {
37098 : // objectArray[i] is a single memory pool
37099 0 : for (unsigned j=0; j < SgOmpTaskgroupClause::pool_size; j++)
37100 : {
37101 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
37102 : {
37103 0 : nodeList.push_back(&(objectArray[i][j]));
37104 : }
37105 : }
37106 : }
37107 :
37108 : // Iterate over the saved list
37109 0 : size_t nodeListSize = nodeList.size();
37110 0 : for (size_t i=0; i < nodeListSize; i++)
37111 : {
37112 0 : ROSE_ASSERT(nodeList[i] != NULL);
37113 : #if 0
37114 : traversal.visit(nodeList[i]);
37115 : #else
37116 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
37117 : {
37118 0 : traversal.visit(nodeList[i]);
37119 : }
37120 : #endif
37121 : }
37122 : #endif
37123 : }
37124 :
37125 : // This should not be required since all previously static data members are
37126 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
37127 :
37128 5342 : }
37129 :
37130 :
37131 : void
37132 194 : SgOmpTaskgroupClause::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
37133 : {
37134 : // This function traverses the memory pool for an IR node and
37135 : // calls the function to execute the visitor object.
37136 :
37137 : // Initialize array to the address of the first element of the STL vector
37138 : // (which is guarenteed to be contiguous storage).
37139 : // SgOmpTaskgroupClause objectArray [] = *(Memory_Block_List.begin());
37140 194 : if (SgOmpTaskgroupClause::pools.empty() == false)
37141 : {
37142 : // Generate an array of memory pools
37143 0 : SgOmpTaskgroupClause** objectArray = (SgOmpTaskgroupClause**) &(SgOmpTaskgroupClause::pools[0]);
37144 :
37145 : // Build a local variable for better performance
37146 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
37147 :
37148 : // Iterate over the memory pools
37149 0 : for (unsigned int i=0; i < SgOmpTaskgroupClause::pools.size(); i++)
37150 : {
37151 : // objectArray[i] is a single memory pool
37152 0 : for (unsigned j=0; j < SgOmpTaskgroupClause::pool_size; j++)
37153 : {
37154 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
37155 : {
37156 : // printf ("Found a valid SgOmpTaskgroupClause object in the memory pool %d at position %d \n",i,j);
37157 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
37158 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
37159 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
37160 : }
37161 : else
37162 : {
37163 : // printf ("Found a INVALID SgOmpTaskgroupClause object in the memory pool \n");
37164 : }
37165 : }
37166 : }
37167 : }
37168 :
37169 : // This should not be required since all previously static data members are
37170 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
37171 :
37172 194 : }
37173 :
37174 : void
37175 0 : SgOmpTaskgroupClause::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
37176 : {
37177 : // This function visits only a single IR node of the memory pool.
37178 : // it is typically called once for each type of IR node within
37179 : // the automatically generated function: traverseRepresentativeNodes().
37180 :
37181 : // Initialize array to the address of the first element of the STL vector
37182 : // (which is guarenteed to be contiguous storage).
37183 : // SgOmpTaskgroupClause objectArray [] = *(Memory_Block_List.begin());
37184 0 : if (SgOmpTaskgroupClause::pools.empty() == false)
37185 : {
37186 : // Generate an array of memory pools
37187 0 : SgOmpTaskgroupClause** objectArray = (SgOmpTaskgroupClause**) &(SgOmpTaskgroupClause::pools[0]);
37188 :
37189 : // Build a local variable for better performance
37190 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
37191 :
37192 : // Iterate over the memory pools
37193 0 : bool done = false;
37194 0 : unsigned i=0;
37195 :
37196 : // find the first valid IR node, call visit function, and then leave
37197 0 : while ( done == false && i < SgOmpTaskgroupClause::pools.size() )
37198 : {
37199 : // objectArray[i] is a single memory pool
37200 : unsigned j=0;
37201 0 : while (done == false && j < SgOmpTaskgroupClause::pool_size)
37202 : {
37203 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
37204 : {
37205 0 : traversal.visit(&(objectArray[i][j]));
37206 0 : done = true;
37207 : }
37208 0 : j++;
37209 : }
37210 0 : i++;
37211 : }
37212 :
37213 : #if 0
37214 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
37215 : if (done == false)
37216 : {
37217 : printf ("No representative for SgOmpTaskgroupClause found in memory pools \n");
37218 : }
37219 : #endif
37220 : }
37221 0 : }
37222 :
37223 :
37224 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
37225 : // using values that overflow signed values of int.
37226 : size_t
37227 4 : SgOmpTaskgroupClause::numberOfNodes()
37228 : {
37229 : // This function traverses the memory pool for an IR node and
37230 : // counts the number of IR nodes of a particular Sage III IR
37231 : // nodes type.
37232 :
37233 4 : size_t count = 0;
37234 4 : if (SgOmpTaskgroupClause::pools.empty() == false)
37235 : {
37236 : // Generate an array of memory pools (this is actually a STL vector,
37237 : // but it is contiguious, so OK to treat this way).
37238 0 : SgOmpTaskgroupClause** objectArray = (SgOmpTaskgroupClause**) &(SgOmpTaskgroupClause::pools[0]);
37239 :
37240 : // Build a local variable for better performance (make it a loop invariant variable).
37241 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
37242 :
37243 : // Iterate over all of the memory pools for this IR node.
37244 0 : for (unsigned int i=0; i < SgOmpTaskgroupClause::pools.size(); i++)
37245 : {
37246 : // objectArray[i] is a single memory pool, iterate over all the
37247 : // IR nodes and only count those that are valid IR nodes used in
37248 : // the AST (i.e. allocated IR nodes).
37249 0 : for (unsigned j=0; j < SgOmpTaskgroupClause::pool_size; j++)
37250 : {
37251 : // This is indexing the STL vector of C/C++ style arrays as a doubly
37252 : // indexed array access. It is OK since we have leveraged the semantics
37253 : // of STL vector memory as contigous and cast the memory as an array
37254 : // of arrays to use the 2D array indexing. Hope this is not confusing,
37255 : // but it s very fast as an implementation.
37256 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
37257 : {
37258 0 : count++;
37259 : }
37260 : }
37261 : }
37262 : }
37263 :
37264 :
37265 :
37266 4 : return count;
37267 : }
37268 :
37269 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
37270 : // using values that overflow signed values of int.
37271 : size_t
37272 0 : SgOmpTaskgroupClause::memoryUsage()
37273 : {
37274 : // This function is required because we need the class name as a type when we call sizeof
37275 : // There might be another way to implement this if we have a traversal that only called a
37276 : // representative object (one call for each type of Sage IIIIR node).
37277 0 : size_t memory = numberOfNodes() * sizeof(SgOmpTaskgroupClause);
37278 :
37279 0 : return memory;
37280 : }
37281 :
37282 : /* #line 37283 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
37283 :
37284 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
37285 : void
37286 5342 : SgOmpNogroupClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
37287 : {
37288 : // This function traverses the memory pool for only a specific IR node
37289 : // and calls the visit function of the input class execute a traversal
37290 : // similar to the style of the attribute based traversals within ROSE.
37291 : // This traversal will visit ALL nodes of the AST where as the other
37292 : // attribute based traversals visit only the embedded tree within the AST.
37293 :
37294 : // Initialize array to the address of the first element of the STL vector
37295 : // (which is guaranteed to be contiguous storage).
37296 : // SgOmpNogroupClause objectArray [] = *(Memory_Block_List.begin());
37297 5342 : if (SgOmpNogroupClause::pools.empty() == false)
37298 : {
37299 : // Generate an array of memory pools
37300 7 : SgOmpNogroupClause** objectArray = (SgOmpNogroupClause**) &(SgOmpNogroupClause::pools[0]);
37301 :
37302 : // Build a local variable for better performance
37303 7 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
37304 : #if 0
37305 : // Iterate over the memory pools
37306 : for (unsigned int i=0; i < SgOmpNogroupClause::pools.size(); i++)
37307 : {
37308 : // objectArray[i] is a single memory pool
37309 : for (int j=0; j < SgOmpNogroupClause::pool_size; j++)
37310 : {
37311 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
37312 : {
37313 : traversal.visit(&(objectArray[i][j]));
37314 : }
37315 : }
37316 : }
37317 : #else
37318 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
37319 : // compute the list first and then call the visit function on each list element.
37320 :
37321 : // printf ("Inside of SgOmpNogroupClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
37322 :
37323 14 : std::vector<SgOmpNogroupClause*> nodeList;
37324 :
37325 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
37326 14 : for (unsigned int i=0; i < SgOmpNogroupClause::pools.size(); i++)
37327 : {
37328 : // objectArray[i] is a single memory pool
37329 14007 : for (unsigned j=0; j < SgOmpNogroupClause::pool_size; j++)
37330 : {
37331 14000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
37332 : {
37333 7 : nodeList.push_back(&(objectArray[i][j]));
37334 : }
37335 : }
37336 : }
37337 :
37338 : // Iterate over the saved list
37339 7 : size_t nodeListSize = nodeList.size();
37340 14 : for (size_t i=0; i < nodeListSize; i++)
37341 : {
37342 7 : ROSE_ASSERT(nodeList[i] != NULL);
37343 : #if 0
37344 : traversal.visit(nodeList[i]);
37345 : #else
37346 7 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
37347 : {
37348 7 : traversal.visit(nodeList[i]);
37349 : }
37350 : #endif
37351 : }
37352 : #endif
37353 : }
37354 :
37355 : // This should not be required since all previously static data members are
37356 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
37357 :
37358 5342 : }
37359 :
37360 :
37361 : void
37362 194 : SgOmpNogroupClause::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
37363 : {
37364 : // This function traverses the memory pool for an IR node and
37365 : // calls the function to execute the visitor object.
37366 :
37367 : // Initialize array to the address of the first element of the STL vector
37368 : // (which is guarenteed to be contiguous storage).
37369 : // SgOmpNogroupClause objectArray [] = *(Memory_Block_List.begin());
37370 194 : if (SgOmpNogroupClause::pools.empty() == false)
37371 : {
37372 : // Generate an array of memory pools
37373 0 : SgOmpNogroupClause** objectArray = (SgOmpNogroupClause**) &(SgOmpNogroupClause::pools[0]);
37374 :
37375 : // Build a local variable for better performance
37376 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
37377 :
37378 : // Iterate over the memory pools
37379 0 : for (unsigned int i=0; i < SgOmpNogroupClause::pools.size(); i++)
37380 : {
37381 : // objectArray[i] is a single memory pool
37382 0 : for (unsigned j=0; j < SgOmpNogroupClause::pool_size; j++)
37383 : {
37384 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
37385 : {
37386 : // printf ("Found a valid SgOmpNogroupClause object in the memory pool %d at position %d \n",i,j);
37387 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
37388 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
37389 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
37390 : }
37391 : else
37392 : {
37393 : // printf ("Found a INVALID SgOmpNogroupClause object in the memory pool \n");
37394 : }
37395 : }
37396 : }
37397 : }
37398 :
37399 : // This should not be required since all previously static data members are
37400 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
37401 :
37402 194 : }
37403 :
37404 : void
37405 0 : SgOmpNogroupClause::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
37406 : {
37407 : // This function visits only a single IR node of the memory pool.
37408 : // it is typically called once for each type of IR node within
37409 : // the automatically generated function: traverseRepresentativeNodes().
37410 :
37411 : // Initialize array to the address of the first element of the STL vector
37412 : // (which is guarenteed to be contiguous storage).
37413 : // SgOmpNogroupClause objectArray [] = *(Memory_Block_List.begin());
37414 0 : if (SgOmpNogroupClause::pools.empty() == false)
37415 : {
37416 : // Generate an array of memory pools
37417 0 : SgOmpNogroupClause** objectArray = (SgOmpNogroupClause**) &(SgOmpNogroupClause::pools[0]);
37418 :
37419 : // Build a local variable for better performance
37420 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
37421 :
37422 : // Iterate over the memory pools
37423 0 : bool done = false;
37424 0 : unsigned i=0;
37425 :
37426 : // find the first valid IR node, call visit function, and then leave
37427 0 : while ( done == false && i < SgOmpNogroupClause::pools.size() )
37428 : {
37429 : // objectArray[i] is a single memory pool
37430 : unsigned j=0;
37431 0 : while (done == false && j < SgOmpNogroupClause::pool_size)
37432 : {
37433 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
37434 : {
37435 0 : traversal.visit(&(objectArray[i][j]));
37436 0 : done = true;
37437 : }
37438 0 : j++;
37439 : }
37440 0 : i++;
37441 : }
37442 :
37443 : #if 0
37444 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
37445 : if (done == false)
37446 : {
37447 : printf ("No representative for SgOmpNogroupClause found in memory pools \n");
37448 : }
37449 : #endif
37450 : }
37451 0 : }
37452 :
37453 :
37454 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
37455 : // using values that overflow signed values of int.
37456 : size_t
37457 4 : SgOmpNogroupClause::numberOfNodes()
37458 : {
37459 : // This function traverses the memory pool for an IR node and
37460 : // counts the number of IR nodes of a particular Sage III IR
37461 : // nodes type.
37462 :
37463 4 : size_t count = 0;
37464 4 : if (SgOmpNogroupClause::pools.empty() == false)
37465 : {
37466 : // Generate an array of memory pools (this is actually a STL vector,
37467 : // but it is contiguious, so OK to treat this way).
37468 0 : SgOmpNogroupClause** objectArray = (SgOmpNogroupClause**) &(SgOmpNogroupClause::pools[0]);
37469 :
37470 : // Build a local variable for better performance (make it a loop invariant variable).
37471 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
37472 :
37473 : // Iterate over all of the memory pools for this IR node.
37474 0 : for (unsigned int i=0; i < SgOmpNogroupClause::pools.size(); i++)
37475 : {
37476 : // objectArray[i] is a single memory pool, iterate over all the
37477 : // IR nodes and only count those that are valid IR nodes used in
37478 : // the AST (i.e. allocated IR nodes).
37479 0 : for (unsigned j=0; j < SgOmpNogroupClause::pool_size; j++)
37480 : {
37481 : // This is indexing the STL vector of C/C++ style arrays as a doubly
37482 : // indexed array access. It is OK since we have leveraged the semantics
37483 : // of STL vector memory as contigous and cast the memory as an array
37484 : // of arrays to use the 2D array indexing. Hope this is not confusing,
37485 : // but it s very fast as an implementation.
37486 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
37487 : {
37488 0 : count++;
37489 : }
37490 : }
37491 : }
37492 : }
37493 :
37494 :
37495 :
37496 4 : return count;
37497 : }
37498 :
37499 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
37500 : // using values that overflow signed values of int.
37501 : size_t
37502 0 : SgOmpNogroupClause::memoryUsage()
37503 : {
37504 : // This function is required because we need the class name as a type when we call sizeof
37505 : // There might be another way to implement this if we have a traversal that only called a
37506 : // representative object (one call for each type of Sage IIIIR node).
37507 0 : size_t memory = numberOfNodes() * sizeof(SgOmpNogroupClause);
37508 :
37509 0 : return memory;
37510 : }
37511 :
37512 : /* #line 37513 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
37513 :
37514 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
37515 : void
37516 5342 : SgOmpDefaultClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
37517 : {
37518 : // This function traverses the memory pool for only a specific IR node
37519 : // and calls the visit function of the input class execute a traversal
37520 : // similar to the style of the attribute based traversals within ROSE.
37521 : // This traversal will visit ALL nodes of the AST where as the other
37522 : // attribute based traversals visit only the embedded tree within the AST.
37523 :
37524 : // Initialize array to the address of the first element of the STL vector
37525 : // (which is guaranteed to be contiguous storage).
37526 : // SgOmpDefaultClause objectArray [] = *(Memory_Block_List.begin());
37527 5342 : if (SgOmpDefaultClause::pools.empty() == false)
37528 : {
37529 : // Generate an array of memory pools
37530 35 : SgOmpDefaultClause** objectArray = (SgOmpDefaultClause**) &(SgOmpDefaultClause::pools[0]);
37531 :
37532 : // Build a local variable for better performance
37533 35 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
37534 : #if 0
37535 : // Iterate over the memory pools
37536 : for (unsigned int i=0; i < SgOmpDefaultClause::pools.size(); i++)
37537 : {
37538 : // objectArray[i] is a single memory pool
37539 : for (int j=0; j < SgOmpDefaultClause::pool_size; j++)
37540 : {
37541 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
37542 : {
37543 : traversal.visit(&(objectArray[i][j]));
37544 : }
37545 : }
37546 : }
37547 : #else
37548 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
37549 : // compute the list first and then call the visit function on each list element.
37550 :
37551 : // printf ("Inside of SgOmpDefaultClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
37552 :
37553 70 : std::vector<SgOmpDefaultClause*> nodeList;
37554 :
37555 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
37556 70 : for (unsigned int i=0; i < SgOmpDefaultClause::pools.size(); i++)
37557 : {
37558 : // objectArray[i] is a single memory pool
37559 70035 : for (unsigned j=0; j < SgOmpDefaultClause::pool_size; j++)
37560 : {
37561 70000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
37562 : {
37563 35 : nodeList.push_back(&(objectArray[i][j]));
37564 : }
37565 : }
37566 : }
37567 :
37568 : // Iterate over the saved list
37569 35 : size_t nodeListSize = nodeList.size();
37570 70 : for (size_t i=0; i < nodeListSize; i++)
37571 : {
37572 35 : ROSE_ASSERT(nodeList[i] != NULL);
37573 : #if 0
37574 : traversal.visit(nodeList[i]);
37575 : #else
37576 35 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
37577 : {
37578 35 : traversal.visit(nodeList[i]);
37579 : }
37580 : #endif
37581 : }
37582 : #endif
37583 : }
37584 :
37585 : // This should not be required since all previously static data members are
37586 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
37587 :
37588 5342 : }
37589 :
37590 :
37591 : void
37592 194 : SgOmpDefaultClause::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
37593 : {
37594 : // This function traverses the memory pool for an IR node and
37595 : // calls the function to execute the visitor object.
37596 :
37597 : // Initialize array to the address of the first element of the STL vector
37598 : // (which is guarenteed to be contiguous storage).
37599 : // SgOmpDefaultClause objectArray [] = *(Memory_Block_List.begin());
37600 194 : if (SgOmpDefaultClause::pools.empty() == false)
37601 : {
37602 : // Generate an array of memory pools
37603 0 : SgOmpDefaultClause** objectArray = (SgOmpDefaultClause**) &(SgOmpDefaultClause::pools[0]);
37604 :
37605 : // Build a local variable for better performance
37606 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
37607 :
37608 : // Iterate over the memory pools
37609 0 : for (unsigned int i=0; i < SgOmpDefaultClause::pools.size(); i++)
37610 : {
37611 : // objectArray[i] is a single memory pool
37612 0 : for (unsigned j=0; j < SgOmpDefaultClause::pool_size; j++)
37613 : {
37614 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
37615 : {
37616 : // printf ("Found a valid SgOmpDefaultClause object in the memory pool %d at position %d \n",i,j);
37617 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
37618 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
37619 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
37620 : }
37621 : else
37622 : {
37623 : // printf ("Found a INVALID SgOmpDefaultClause object in the memory pool \n");
37624 : }
37625 : }
37626 : }
37627 : }
37628 :
37629 : // This should not be required since all previously static data members are
37630 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
37631 :
37632 194 : }
37633 :
37634 : void
37635 0 : SgOmpDefaultClause::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
37636 : {
37637 : // This function visits only a single IR node of the memory pool.
37638 : // it is typically called once for each type of IR node within
37639 : // the automatically generated function: traverseRepresentativeNodes().
37640 :
37641 : // Initialize array to the address of the first element of the STL vector
37642 : // (which is guarenteed to be contiguous storage).
37643 : // SgOmpDefaultClause objectArray [] = *(Memory_Block_List.begin());
37644 0 : if (SgOmpDefaultClause::pools.empty() == false)
37645 : {
37646 : // Generate an array of memory pools
37647 0 : SgOmpDefaultClause** objectArray = (SgOmpDefaultClause**) &(SgOmpDefaultClause::pools[0]);
37648 :
37649 : // Build a local variable for better performance
37650 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
37651 :
37652 : // Iterate over the memory pools
37653 0 : bool done = false;
37654 0 : unsigned i=0;
37655 :
37656 : // find the first valid IR node, call visit function, and then leave
37657 0 : while ( done == false && i < SgOmpDefaultClause::pools.size() )
37658 : {
37659 : // objectArray[i] is a single memory pool
37660 : unsigned j=0;
37661 0 : while (done == false && j < SgOmpDefaultClause::pool_size)
37662 : {
37663 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
37664 : {
37665 0 : traversal.visit(&(objectArray[i][j]));
37666 0 : done = true;
37667 : }
37668 0 : j++;
37669 : }
37670 0 : i++;
37671 : }
37672 :
37673 : #if 0
37674 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
37675 : if (done == false)
37676 : {
37677 : printf ("No representative for SgOmpDefaultClause found in memory pools \n");
37678 : }
37679 : #endif
37680 : }
37681 0 : }
37682 :
37683 :
37684 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
37685 : // using values that overflow signed values of int.
37686 : size_t
37687 4 : SgOmpDefaultClause::numberOfNodes()
37688 : {
37689 : // This function traverses the memory pool for an IR node and
37690 : // counts the number of IR nodes of a particular Sage III IR
37691 : // nodes type.
37692 :
37693 4 : size_t count = 0;
37694 4 : if (SgOmpDefaultClause::pools.empty() == false)
37695 : {
37696 : // Generate an array of memory pools (this is actually a STL vector,
37697 : // but it is contiguious, so OK to treat this way).
37698 0 : SgOmpDefaultClause** objectArray = (SgOmpDefaultClause**) &(SgOmpDefaultClause::pools[0]);
37699 :
37700 : // Build a local variable for better performance (make it a loop invariant variable).
37701 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
37702 :
37703 : // Iterate over all of the memory pools for this IR node.
37704 0 : for (unsigned int i=0; i < SgOmpDefaultClause::pools.size(); i++)
37705 : {
37706 : // objectArray[i] is a single memory pool, iterate over all the
37707 : // IR nodes and only count those that are valid IR nodes used in
37708 : // the AST (i.e. allocated IR nodes).
37709 0 : for (unsigned j=0; j < SgOmpDefaultClause::pool_size; j++)
37710 : {
37711 : // This is indexing the STL vector of C/C++ style arrays as a doubly
37712 : // indexed array access. It is OK since we have leveraged the semantics
37713 : // of STL vector memory as contigous and cast the memory as an array
37714 : // of arrays to use the 2D array indexing. Hope this is not confusing,
37715 : // but it s very fast as an implementation.
37716 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
37717 : {
37718 0 : count++;
37719 : }
37720 : }
37721 : }
37722 : }
37723 :
37724 :
37725 :
37726 4 : return count;
37727 : }
37728 :
37729 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
37730 : // using values that overflow signed values of int.
37731 : size_t
37732 0 : SgOmpDefaultClause::memoryUsage()
37733 : {
37734 : // This function is required because we need the class name as a type when we call sizeof
37735 : // There might be another way to implement this if we have a traversal that only called a
37736 : // representative object (one call for each type of Sage IIIIR node).
37737 0 : size_t memory = numberOfNodes() * sizeof(SgOmpDefaultClause);
37738 :
37739 0 : return memory;
37740 : }
37741 :
37742 : /* #line 37743 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
37743 :
37744 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
37745 : void
37746 5342 : SgOmpAllocatorClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
37747 : {
37748 : // This function traverses the memory pool for only a specific IR node
37749 : // and calls the visit function of the input class execute a traversal
37750 : // similar to the style of the attribute based traversals within ROSE.
37751 : // This traversal will visit ALL nodes of the AST where as the other
37752 : // attribute based traversals visit only the embedded tree within the AST.
37753 :
37754 : // Initialize array to the address of the first element of the STL vector
37755 : // (which is guaranteed to be contiguous storage).
37756 : // SgOmpAllocatorClause objectArray [] = *(Memory_Block_List.begin());
37757 5342 : if (SgOmpAllocatorClause::pools.empty() == false)
37758 : {
37759 : // Generate an array of memory pools
37760 7 : SgOmpAllocatorClause** objectArray = (SgOmpAllocatorClause**) &(SgOmpAllocatorClause::pools[0]);
37761 :
37762 : // Build a local variable for better performance
37763 7 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
37764 : #if 0
37765 : // Iterate over the memory pools
37766 : for (unsigned int i=0; i < SgOmpAllocatorClause::pools.size(); i++)
37767 : {
37768 : // objectArray[i] is a single memory pool
37769 : for (int j=0; j < SgOmpAllocatorClause::pool_size; j++)
37770 : {
37771 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
37772 : {
37773 : traversal.visit(&(objectArray[i][j]));
37774 : }
37775 : }
37776 : }
37777 : #else
37778 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
37779 : // compute the list first and then call the visit function on each list element.
37780 :
37781 : // printf ("Inside of SgOmpAllocatorClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
37782 :
37783 14 : std::vector<SgOmpAllocatorClause*> nodeList;
37784 :
37785 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
37786 14 : for (unsigned int i=0; i < SgOmpAllocatorClause::pools.size(); i++)
37787 : {
37788 : // objectArray[i] is a single memory pool
37789 14007 : for (unsigned j=0; j < SgOmpAllocatorClause::pool_size; j++)
37790 : {
37791 14000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
37792 : {
37793 7 : nodeList.push_back(&(objectArray[i][j]));
37794 : }
37795 : }
37796 : }
37797 :
37798 : // Iterate over the saved list
37799 7 : size_t nodeListSize = nodeList.size();
37800 14 : for (size_t i=0; i < nodeListSize; i++)
37801 : {
37802 7 : ROSE_ASSERT(nodeList[i] != NULL);
37803 : #if 0
37804 : traversal.visit(nodeList[i]);
37805 : #else
37806 7 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
37807 : {
37808 7 : traversal.visit(nodeList[i]);
37809 : }
37810 : #endif
37811 : }
37812 : #endif
37813 : }
37814 :
37815 : // This should not be required since all previously static data members are
37816 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
37817 :
37818 5342 : }
37819 :
37820 :
37821 : void
37822 194 : SgOmpAllocatorClause::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
37823 : {
37824 : // This function traverses the memory pool for an IR node and
37825 : // calls the function to execute the visitor object.
37826 :
37827 : // Initialize array to the address of the first element of the STL vector
37828 : // (which is guarenteed to be contiguous storage).
37829 : // SgOmpAllocatorClause objectArray [] = *(Memory_Block_List.begin());
37830 194 : if (SgOmpAllocatorClause::pools.empty() == false)
37831 : {
37832 : // Generate an array of memory pools
37833 0 : SgOmpAllocatorClause** objectArray = (SgOmpAllocatorClause**) &(SgOmpAllocatorClause::pools[0]);
37834 :
37835 : // Build a local variable for better performance
37836 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
37837 :
37838 : // Iterate over the memory pools
37839 0 : for (unsigned int i=0; i < SgOmpAllocatorClause::pools.size(); i++)
37840 : {
37841 : // objectArray[i] is a single memory pool
37842 0 : for (unsigned j=0; j < SgOmpAllocatorClause::pool_size; j++)
37843 : {
37844 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
37845 : {
37846 : // printf ("Found a valid SgOmpAllocatorClause object in the memory pool %d at position %d \n",i,j);
37847 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
37848 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
37849 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
37850 : }
37851 : else
37852 : {
37853 : // printf ("Found a INVALID SgOmpAllocatorClause object in the memory pool \n");
37854 : }
37855 : }
37856 : }
37857 : }
37858 :
37859 : // This should not be required since all previously static data members are
37860 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
37861 :
37862 194 : }
37863 :
37864 : void
37865 0 : SgOmpAllocatorClause::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
37866 : {
37867 : // This function visits only a single IR node of the memory pool.
37868 : // it is typically called once for each type of IR node within
37869 : // the automatically generated function: traverseRepresentativeNodes().
37870 :
37871 : // Initialize array to the address of the first element of the STL vector
37872 : // (which is guarenteed to be contiguous storage).
37873 : // SgOmpAllocatorClause objectArray [] = *(Memory_Block_List.begin());
37874 0 : if (SgOmpAllocatorClause::pools.empty() == false)
37875 : {
37876 : // Generate an array of memory pools
37877 0 : SgOmpAllocatorClause** objectArray = (SgOmpAllocatorClause**) &(SgOmpAllocatorClause::pools[0]);
37878 :
37879 : // Build a local variable for better performance
37880 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
37881 :
37882 : // Iterate over the memory pools
37883 0 : bool done = false;
37884 0 : unsigned i=0;
37885 :
37886 : // find the first valid IR node, call visit function, and then leave
37887 0 : while ( done == false && i < SgOmpAllocatorClause::pools.size() )
37888 : {
37889 : // objectArray[i] is a single memory pool
37890 : unsigned j=0;
37891 0 : while (done == false && j < SgOmpAllocatorClause::pool_size)
37892 : {
37893 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
37894 : {
37895 0 : traversal.visit(&(objectArray[i][j]));
37896 0 : done = true;
37897 : }
37898 0 : j++;
37899 : }
37900 0 : i++;
37901 : }
37902 :
37903 : #if 0
37904 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
37905 : if (done == false)
37906 : {
37907 : printf ("No representative for SgOmpAllocatorClause found in memory pools \n");
37908 : }
37909 : #endif
37910 : }
37911 0 : }
37912 :
37913 :
37914 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
37915 : // using values that overflow signed values of int.
37916 : size_t
37917 4 : SgOmpAllocatorClause::numberOfNodes()
37918 : {
37919 : // This function traverses the memory pool for an IR node and
37920 : // counts the number of IR nodes of a particular Sage III IR
37921 : // nodes type.
37922 :
37923 4 : size_t count = 0;
37924 4 : if (SgOmpAllocatorClause::pools.empty() == false)
37925 : {
37926 : // Generate an array of memory pools (this is actually a STL vector,
37927 : // but it is contiguious, so OK to treat this way).
37928 0 : SgOmpAllocatorClause** objectArray = (SgOmpAllocatorClause**) &(SgOmpAllocatorClause::pools[0]);
37929 :
37930 : // Build a local variable for better performance (make it a loop invariant variable).
37931 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
37932 :
37933 : // Iterate over all of the memory pools for this IR node.
37934 0 : for (unsigned int i=0; i < SgOmpAllocatorClause::pools.size(); i++)
37935 : {
37936 : // objectArray[i] is a single memory pool, iterate over all the
37937 : // IR nodes and only count those that are valid IR nodes used in
37938 : // the AST (i.e. allocated IR nodes).
37939 0 : for (unsigned j=0; j < SgOmpAllocatorClause::pool_size; j++)
37940 : {
37941 : // This is indexing the STL vector of C/C++ style arrays as a doubly
37942 : // indexed array access. It is OK since we have leveraged the semantics
37943 : // of STL vector memory as contigous and cast the memory as an array
37944 : // of arrays to use the 2D array indexing. Hope this is not confusing,
37945 : // but it s very fast as an implementation.
37946 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
37947 : {
37948 0 : count++;
37949 : }
37950 : }
37951 : }
37952 : }
37953 :
37954 :
37955 :
37956 4 : return count;
37957 : }
37958 :
37959 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
37960 : // using values that overflow signed values of int.
37961 : size_t
37962 0 : SgOmpAllocatorClause::memoryUsage()
37963 : {
37964 : // This function is required because we need the class name as a type when we call sizeof
37965 : // There might be another way to implement this if we have a traversal that only called a
37966 : // representative object (one call for each type of Sage IIIIR node).
37967 0 : size_t memory = numberOfNodes() * sizeof(SgOmpAllocatorClause);
37968 :
37969 0 : return memory;
37970 : }
37971 :
37972 : /* #line 37973 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
37973 :
37974 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
37975 : void
37976 5342 : SgOmpAtomicClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
37977 : {
37978 : // This function traverses the memory pool for only a specific IR node
37979 : // and calls the visit function of the input class execute a traversal
37980 : // similar to the style of the attribute based traversals within ROSE.
37981 : // This traversal will visit ALL nodes of the AST where as the other
37982 : // attribute based traversals visit only the embedded tree within the AST.
37983 :
37984 : // Initialize array to the address of the first element of the STL vector
37985 : // (which is guaranteed to be contiguous storage).
37986 : // SgOmpAtomicClause objectArray [] = *(Memory_Block_List.begin());
37987 5342 : if (SgOmpAtomicClause::pools.empty() == false)
37988 : {
37989 : // Generate an array of memory pools
37990 0 : SgOmpAtomicClause** objectArray = (SgOmpAtomicClause**) &(SgOmpAtomicClause::pools[0]);
37991 :
37992 : // Build a local variable for better performance
37993 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
37994 : #if 0
37995 : // Iterate over the memory pools
37996 : for (unsigned int i=0; i < SgOmpAtomicClause::pools.size(); i++)
37997 : {
37998 : // objectArray[i] is a single memory pool
37999 : for (int j=0; j < SgOmpAtomicClause::pool_size; j++)
38000 : {
38001 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
38002 : {
38003 : traversal.visit(&(objectArray[i][j]));
38004 : }
38005 : }
38006 : }
38007 : #else
38008 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
38009 : // compute the list first and then call the visit function on each list element.
38010 :
38011 : // printf ("Inside of SgOmpAtomicClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
38012 :
38013 0 : std::vector<SgOmpAtomicClause*> nodeList;
38014 :
38015 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
38016 0 : for (unsigned int i=0; i < SgOmpAtomicClause::pools.size(); i++)
38017 : {
38018 : // objectArray[i] is a single memory pool
38019 0 : for (unsigned j=0; j < SgOmpAtomicClause::pool_size; j++)
38020 : {
38021 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
38022 : {
38023 0 : nodeList.push_back(&(objectArray[i][j]));
38024 : }
38025 : }
38026 : }
38027 :
38028 : // Iterate over the saved list
38029 0 : size_t nodeListSize = nodeList.size();
38030 0 : for (size_t i=0; i < nodeListSize; i++)
38031 : {
38032 0 : ROSE_ASSERT(nodeList[i] != NULL);
38033 : #if 0
38034 : traversal.visit(nodeList[i]);
38035 : #else
38036 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
38037 : {
38038 0 : traversal.visit(nodeList[i]);
38039 : }
38040 : #endif
38041 : }
38042 : #endif
38043 : }
38044 :
38045 : // This should not be required since all previously static data members are
38046 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
38047 :
38048 5342 : }
38049 :
38050 :
38051 : void
38052 194 : SgOmpAtomicClause::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
38053 : {
38054 : // This function traverses the memory pool for an IR node and
38055 : // calls the function to execute the visitor object.
38056 :
38057 : // Initialize array to the address of the first element of the STL vector
38058 : // (which is guarenteed to be contiguous storage).
38059 : // SgOmpAtomicClause objectArray [] = *(Memory_Block_List.begin());
38060 194 : if (SgOmpAtomicClause::pools.empty() == false)
38061 : {
38062 : // Generate an array of memory pools
38063 0 : SgOmpAtomicClause** objectArray = (SgOmpAtomicClause**) &(SgOmpAtomicClause::pools[0]);
38064 :
38065 : // Build a local variable for better performance
38066 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
38067 :
38068 : // Iterate over the memory pools
38069 0 : for (unsigned int i=0; i < SgOmpAtomicClause::pools.size(); i++)
38070 : {
38071 : // objectArray[i] is a single memory pool
38072 0 : for (unsigned j=0; j < SgOmpAtomicClause::pool_size; j++)
38073 : {
38074 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
38075 : {
38076 : // printf ("Found a valid SgOmpAtomicClause object in the memory pool %d at position %d \n",i,j);
38077 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
38078 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
38079 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
38080 : }
38081 : else
38082 : {
38083 : // printf ("Found a INVALID SgOmpAtomicClause object in the memory pool \n");
38084 : }
38085 : }
38086 : }
38087 : }
38088 :
38089 : // This should not be required since all previously static data members are
38090 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
38091 :
38092 194 : }
38093 :
38094 : void
38095 0 : SgOmpAtomicClause::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
38096 : {
38097 : // This function visits only a single IR node of the memory pool.
38098 : // it is typically called once for each type of IR node within
38099 : // the automatically generated function: traverseRepresentativeNodes().
38100 :
38101 : // Initialize array to the address of the first element of the STL vector
38102 : // (which is guarenteed to be contiguous storage).
38103 : // SgOmpAtomicClause objectArray [] = *(Memory_Block_List.begin());
38104 0 : if (SgOmpAtomicClause::pools.empty() == false)
38105 : {
38106 : // Generate an array of memory pools
38107 0 : SgOmpAtomicClause** objectArray = (SgOmpAtomicClause**) &(SgOmpAtomicClause::pools[0]);
38108 :
38109 : // Build a local variable for better performance
38110 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
38111 :
38112 : // Iterate over the memory pools
38113 0 : bool done = false;
38114 0 : unsigned i=0;
38115 :
38116 : // find the first valid IR node, call visit function, and then leave
38117 0 : while ( done == false && i < SgOmpAtomicClause::pools.size() )
38118 : {
38119 : // objectArray[i] is a single memory pool
38120 : unsigned j=0;
38121 0 : while (done == false && j < SgOmpAtomicClause::pool_size)
38122 : {
38123 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
38124 : {
38125 0 : traversal.visit(&(objectArray[i][j]));
38126 0 : done = true;
38127 : }
38128 0 : j++;
38129 : }
38130 0 : i++;
38131 : }
38132 :
38133 : #if 0
38134 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
38135 : if (done == false)
38136 : {
38137 : printf ("No representative for SgOmpAtomicClause found in memory pools \n");
38138 : }
38139 : #endif
38140 : }
38141 0 : }
38142 :
38143 :
38144 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
38145 : // using values that overflow signed values of int.
38146 : size_t
38147 4 : SgOmpAtomicClause::numberOfNodes()
38148 : {
38149 : // This function traverses the memory pool for an IR node and
38150 : // counts the number of IR nodes of a particular Sage III IR
38151 : // nodes type.
38152 :
38153 4 : size_t count = 0;
38154 4 : if (SgOmpAtomicClause::pools.empty() == false)
38155 : {
38156 : // Generate an array of memory pools (this is actually a STL vector,
38157 : // but it is contiguious, so OK to treat this way).
38158 0 : SgOmpAtomicClause** objectArray = (SgOmpAtomicClause**) &(SgOmpAtomicClause::pools[0]);
38159 :
38160 : // Build a local variable for better performance (make it a loop invariant variable).
38161 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
38162 :
38163 : // Iterate over all of the memory pools for this IR node.
38164 0 : for (unsigned int i=0; i < SgOmpAtomicClause::pools.size(); i++)
38165 : {
38166 : // objectArray[i] is a single memory pool, iterate over all the
38167 : // IR nodes and only count those that are valid IR nodes used in
38168 : // the AST (i.e. allocated IR nodes).
38169 0 : for (unsigned j=0; j < SgOmpAtomicClause::pool_size; j++)
38170 : {
38171 : // This is indexing the STL vector of C/C++ style arrays as a doubly
38172 : // indexed array access. It is OK since we have leveraged the semantics
38173 : // of STL vector memory as contigous and cast the memory as an array
38174 : // of arrays to use the 2D array indexing. Hope this is not confusing,
38175 : // but it s very fast as an implementation.
38176 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
38177 : {
38178 0 : count++;
38179 : }
38180 : }
38181 : }
38182 : }
38183 :
38184 :
38185 :
38186 4 : return count;
38187 : }
38188 :
38189 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
38190 : // using values that overflow signed values of int.
38191 : size_t
38192 0 : SgOmpAtomicClause::memoryUsage()
38193 : {
38194 : // This function is required because we need the class name as a type when we call sizeof
38195 : // There might be another way to implement this if we have a traversal that only called a
38196 : // representative object (one call for each type of Sage IIIIR node).
38197 0 : size_t memory = numberOfNodes() * sizeof(SgOmpAtomicClause);
38198 :
38199 0 : return memory;
38200 : }
38201 :
38202 : /* #line 38203 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
38203 :
38204 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
38205 : void
38206 5342 : SgOmpProcBindClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
38207 : {
38208 : // This function traverses the memory pool for only a specific IR node
38209 : // and calls the visit function of the input class execute a traversal
38210 : // similar to the style of the attribute based traversals within ROSE.
38211 : // This traversal will visit ALL nodes of the AST where as the other
38212 : // attribute based traversals visit only the embedded tree within the AST.
38213 :
38214 : // Initialize array to the address of the first element of the STL vector
38215 : // (which is guaranteed to be contiguous storage).
38216 : // SgOmpProcBindClause objectArray [] = *(Memory_Block_List.begin());
38217 5342 : if (SgOmpProcBindClause::pools.empty() == false)
38218 : {
38219 : // Generate an array of memory pools
38220 7 : SgOmpProcBindClause** objectArray = (SgOmpProcBindClause**) &(SgOmpProcBindClause::pools[0]);
38221 :
38222 : // Build a local variable for better performance
38223 7 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
38224 : #if 0
38225 : // Iterate over the memory pools
38226 : for (unsigned int i=0; i < SgOmpProcBindClause::pools.size(); i++)
38227 : {
38228 : // objectArray[i] is a single memory pool
38229 : for (int j=0; j < SgOmpProcBindClause::pool_size; j++)
38230 : {
38231 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
38232 : {
38233 : traversal.visit(&(objectArray[i][j]));
38234 : }
38235 : }
38236 : }
38237 : #else
38238 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
38239 : // compute the list first and then call the visit function on each list element.
38240 :
38241 : // printf ("Inside of SgOmpProcBindClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
38242 :
38243 14 : std::vector<SgOmpProcBindClause*> nodeList;
38244 :
38245 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
38246 14 : for (unsigned int i=0; i < SgOmpProcBindClause::pools.size(); i++)
38247 : {
38248 : // objectArray[i] is a single memory pool
38249 14007 : for (unsigned j=0; j < SgOmpProcBindClause::pool_size; j++)
38250 : {
38251 14000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
38252 : {
38253 21 : nodeList.push_back(&(objectArray[i][j]));
38254 : }
38255 : }
38256 : }
38257 :
38258 : // Iterate over the saved list
38259 7 : size_t nodeListSize = nodeList.size();
38260 28 : for (size_t i=0; i < nodeListSize; i++)
38261 : {
38262 21 : ROSE_ASSERT(nodeList[i] != NULL);
38263 : #if 0
38264 : traversal.visit(nodeList[i]);
38265 : #else
38266 21 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
38267 : {
38268 21 : traversal.visit(nodeList[i]);
38269 : }
38270 : #endif
38271 : }
38272 : #endif
38273 : }
38274 :
38275 : // This should not be required since all previously static data members are
38276 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
38277 :
38278 5342 : }
38279 :
38280 :
38281 : void
38282 194 : SgOmpProcBindClause::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
38283 : {
38284 : // This function traverses the memory pool for an IR node and
38285 : // calls the function to execute the visitor object.
38286 :
38287 : // Initialize array to the address of the first element of the STL vector
38288 : // (which is guarenteed to be contiguous storage).
38289 : // SgOmpProcBindClause objectArray [] = *(Memory_Block_List.begin());
38290 194 : if (SgOmpProcBindClause::pools.empty() == false)
38291 : {
38292 : // Generate an array of memory pools
38293 0 : SgOmpProcBindClause** objectArray = (SgOmpProcBindClause**) &(SgOmpProcBindClause::pools[0]);
38294 :
38295 : // Build a local variable for better performance
38296 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
38297 :
38298 : // Iterate over the memory pools
38299 0 : for (unsigned int i=0; i < SgOmpProcBindClause::pools.size(); i++)
38300 : {
38301 : // objectArray[i] is a single memory pool
38302 0 : for (unsigned j=0; j < SgOmpProcBindClause::pool_size; j++)
38303 : {
38304 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
38305 : {
38306 : // printf ("Found a valid SgOmpProcBindClause object in the memory pool %d at position %d \n",i,j);
38307 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
38308 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
38309 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
38310 : }
38311 : else
38312 : {
38313 : // printf ("Found a INVALID SgOmpProcBindClause object in the memory pool \n");
38314 : }
38315 : }
38316 : }
38317 : }
38318 :
38319 : // This should not be required since all previously static data members are
38320 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
38321 :
38322 194 : }
38323 :
38324 : void
38325 0 : SgOmpProcBindClause::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
38326 : {
38327 : // This function visits only a single IR node of the memory pool.
38328 : // it is typically called once for each type of IR node within
38329 : // the automatically generated function: traverseRepresentativeNodes().
38330 :
38331 : // Initialize array to the address of the first element of the STL vector
38332 : // (which is guarenteed to be contiguous storage).
38333 : // SgOmpProcBindClause objectArray [] = *(Memory_Block_List.begin());
38334 0 : if (SgOmpProcBindClause::pools.empty() == false)
38335 : {
38336 : // Generate an array of memory pools
38337 0 : SgOmpProcBindClause** objectArray = (SgOmpProcBindClause**) &(SgOmpProcBindClause::pools[0]);
38338 :
38339 : // Build a local variable for better performance
38340 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
38341 :
38342 : // Iterate over the memory pools
38343 0 : bool done = false;
38344 0 : unsigned i=0;
38345 :
38346 : // find the first valid IR node, call visit function, and then leave
38347 0 : while ( done == false && i < SgOmpProcBindClause::pools.size() )
38348 : {
38349 : // objectArray[i] is a single memory pool
38350 : unsigned j=0;
38351 0 : while (done == false && j < SgOmpProcBindClause::pool_size)
38352 : {
38353 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
38354 : {
38355 0 : traversal.visit(&(objectArray[i][j]));
38356 0 : done = true;
38357 : }
38358 0 : j++;
38359 : }
38360 0 : i++;
38361 : }
38362 :
38363 : #if 0
38364 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
38365 : if (done == false)
38366 : {
38367 : printf ("No representative for SgOmpProcBindClause found in memory pools \n");
38368 : }
38369 : #endif
38370 : }
38371 0 : }
38372 :
38373 :
38374 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
38375 : // using values that overflow signed values of int.
38376 : size_t
38377 4 : SgOmpProcBindClause::numberOfNodes()
38378 : {
38379 : // This function traverses the memory pool for an IR node and
38380 : // counts the number of IR nodes of a particular Sage III IR
38381 : // nodes type.
38382 :
38383 4 : size_t count = 0;
38384 4 : if (SgOmpProcBindClause::pools.empty() == false)
38385 : {
38386 : // Generate an array of memory pools (this is actually a STL vector,
38387 : // but it is contiguious, so OK to treat this way).
38388 0 : SgOmpProcBindClause** objectArray = (SgOmpProcBindClause**) &(SgOmpProcBindClause::pools[0]);
38389 :
38390 : // Build a local variable for better performance (make it a loop invariant variable).
38391 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
38392 :
38393 : // Iterate over all of the memory pools for this IR node.
38394 0 : for (unsigned int i=0; i < SgOmpProcBindClause::pools.size(); i++)
38395 : {
38396 : // objectArray[i] is a single memory pool, iterate over all the
38397 : // IR nodes and only count those that are valid IR nodes used in
38398 : // the AST (i.e. allocated IR nodes).
38399 0 : for (unsigned j=0; j < SgOmpProcBindClause::pool_size; j++)
38400 : {
38401 : // This is indexing the STL vector of C/C++ style arrays as a doubly
38402 : // indexed array access. It is OK since we have leveraged the semantics
38403 : // of STL vector memory as contigous and cast the memory as an array
38404 : // of arrays to use the 2D array indexing. Hope this is not confusing,
38405 : // but it s very fast as an implementation.
38406 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
38407 : {
38408 0 : count++;
38409 : }
38410 : }
38411 : }
38412 : }
38413 :
38414 :
38415 :
38416 4 : return count;
38417 : }
38418 :
38419 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
38420 : // using values that overflow signed values of int.
38421 : size_t
38422 0 : SgOmpProcBindClause::memoryUsage()
38423 : {
38424 : // This function is required because we need the class name as a type when we call sizeof
38425 : // There might be another way to implement this if we have a traversal that only called a
38426 : // representative object (one call for each type of Sage IIIIR node).
38427 0 : size_t memory = numberOfNodes() * sizeof(SgOmpProcBindClause);
38428 :
38429 0 : return memory;
38430 : }
38431 :
38432 : /* #line 38433 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
38433 :
38434 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
38435 : void
38436 5342 : SgOmpBindClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
38437 : {
38438 : // This function traverses the memory pool for only a specific IR node
38439 : // and calls the visit function of the input class execute a traversal
38440 : // similar to the style of the attribute based traversals within ROSE.
38441 : // This traversal will visit ALL nodes of the AST where as the other
38442 : // attribute based traversals visit only the embedded tree within the AST.
38443 :
38444 : // Initialize array to the address of the first element of the STL vector
38445 : // (which is guaranteed to be contiguous storage).
38446 : // SgOmpBindClause objectArray [] = *(Memory_Block_List.begin());
38447 5342 : if (SgOmpBindClause::pools.empty() == false)
38448 : {
38449 : // Generate an array of memory pools
38450 7 : SgOmpBindClause** objectArray = (SgOmpBindClause**) &(SgOmpBindClause::pools[0]);
38451 :
38452 : // Build a local variable for better performance
38453 7 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
38454 : #if 0
38455 : // Iterate over the memory pools
38456 : for (unsigned int i=0; i < SgOmpBindClause::pools.size(); i++)
38457 : {
38458 : // objectArray[i] is a single memory pool
38459 : for (int j=0; j < SgOmpBindClause::pool_size; j++)
38460 : {
38461 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
38462 : {
38463 : traversal.visit(&(objectArray[i][j]));
38464 : }
38465 : }
38466 : }
38467 : #else
38468 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
38469 : // compute the list first and then call the visit function on each list element.
38470 :
38471 : // printf ("Inside of SgOmpBindClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
38472 :
38473 14 : std::vector<SgOmpBindClause*> nodeList;
38474 :
38475 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
38476 14 : for (unsigned int i=0; i < SgOmpBindClause::pools.size(); i++)
38477 : {
38478 : // objectArray[i] is a single memory pool
38479 14007 : for (unsigned j=0; j < SgOmpBindClause::pool_size; j++)
38480 : {
38481 14000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
38482 : {
38483 7 : nodeList.push_back(&(objectArray[i][j]));
38484 : }
38485 : }
38486 : }
38487 :
38488 : // Iterate over the saved list
38489 7 : size_t nodeListSize = nodeList.size();
38490 14 : for (size_t i=0; i < nodeListSize; i++)
38491 : {
38492 7 : ROSE_ASSERT(nodeList[i] != NULL);
38493 : #if 0
38494 : traversal.visit(nodeList[i]);
38495 : #else
38496 7 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
38497 : {
38498 7 : traversal.visit(nodeList[i]);
38499 : }
38500 : #endif
38501 : }
38502 : #endif
38503 : }
38504 :
38505 : // This should not be required since all previously static data members are
38506 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
38507 :
38508 5342 : }
38509 :
38510 :
38511 : void
38512 194 : SgOmpBindClause::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
38513 : {
38514 : // This function traverses the memory pool for an IR node and
38515 : // calls the function to execute the visitor object.
38516 :
38517 : // Initialize array to the address of the first element of the STL vector
38518 : // (which is guarenteed to be contiguous storage).
38519 : // SgOmpBindClause objectArray [] = *(Memory_Block_List.begin());
38520 194 : if (SgOmpBindClause::pools.empty() == false)
38521 : {
38522 : // Generate an array of memory pools
38523 0 : SgOmpBindClause** objectArray = (SgOmpBindClause**) &(SgOmpBindClause::pools[0]);
38524 :
38525 : // Build a local variable for better performance
38526 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
38527 :
38528 : // Iterate over the memory pools
38529 0 : for (unsigned int i=0; i < SgOmpBindClause::pools.size(); i++)
38530 : {
38531 : // objectArray[i] is a single memory pool
38532 0 : for (unsigned j=0; j < SgOmpBindClause::pool_size; j++)
38533 : {
38534 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
38535 : {
38536 : // printf ("Found a valid SgOmpBindClause object in the memory pool %d at position %d \n",i,j);
38537 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
38538 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
38539 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
38540 : }
38541 : else
38542 : {
38543 : // printf ("Found a INVALID SgOmpBindClause object in the memory pool \n");
38544 : }
38545 : }
38546 : }
38547 : }
38548 :
38549 : // This should not be required since all previously static data members are
38550 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
38551 :
38552 194 : }
38553 :
38554 : void
38555 0 : SgOmpBindClause::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
38556 : {
38557 : // This function visits only a single IR node of the memory pool.
38558 : // it is typically called once for each type of IR node within
38559 : // the automatically generated function: traverseRepresentativeNodes().
38560 :
38561 : // Initialize array to the address of the first element of the STL vector
38562 : // (which is guarenteed to be contiguous storage).
38563 : // SgOmpBindClause objectArray [] = *(Memory_Block_List.begin());
38564 0 : if (SgOmpBindClause::pools.empty() == false)
38565 : {
38566 : // Generate an array of memory pools
38567 0 : SgOmpBindClause** objectArray = (SgOmpBindClause**) &(SgOmpBindClause::pools[0]);
38568 :
38569 : // Build a local variable for better performance
38570 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
38571 :
38572 : // Iterate over the memory pools
38573 0 : bool done = false;
38574 0 : unsigned i=0;
38575 :
38576 : // find the first valid IR node, call visit function, and then leave
38577 0 : while ( done == false && i < SgOmpBindClause::pools.size() )
38578 : {
38579 : // objectArray[i] is a single memory pool
38580 : unsigned j=0;
38581 0 : while (done == false && j < SgOmpBindClause::pool_size)
38582 : {
38583 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
38584 : {
38585 0 : traversal.visit(&(objectArray[i][j]));
38586 0 : done = true;
38587 : }
38588 0 : j++;
38589 : }
38590 0 : i++;
38591 : }
38592 :
38593 : #if 0
38594 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
38595 : if (done == false)
38596 : {
38597 : printf ("No representative for SgOmpBindClause found in memory pools \n");
38598 : }
38599 : #endif
38600 : }
38601 0 : }
38602 :
38603 :
38604 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
38605 : // using values that overflow signed values of int.
38606 : size_t
38607 4 : SgOmpBindClause::numberOfNodes()
38608 : {
38609 : // This function traverses the memory pool for an IR node and
38610 : // counts the number of IR nodes of a particular Sage III IR
38611 : // nodes type.
38612 :
38613 4 : size_t count = 0;
38614 4 : if (SgOmpBindClause::pools.empty() == false)
38615 : {
38616 : // Generate an array of memory pools (this is actually a STL vector,
38617 : // but it is contiguious, so OK to treat this way).
38618 0 : SgOmpBindClause** objectArray = (SgOmpBindClause**) &(SgOmpBindClause::pools[0]);
38619 :
38620 : // Build a local variable for better performance (make it a loop invariant variable).
38621 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
38622 :
38623 : // Iterate over all of the memory pools for this IR node.
38624 0 : for (unsigned int i=0; i < SgOmpBindClause::pools.size(); i++)
38625 : {
38626 : // objectArray[i] is a single memory pool, iterate over all the
38627 : // IR nodes and only count those that are valid IR nodes used in
38628 : // the AST (i.e. allocated IR nodes).
38629 0 : for (unsigned j=0; j < SgOmpBindClause::pool_size; j++)
38630 : {
38631 : // This is indexing the STL vector of C/C++ style arrays as a doubly
38632 : // indexed array access. It is OK since we have leveraged the semantics
38633 : // of STL vector memory as contigous and cast the memory as an array
38634 : // of arrays to use the 2D array indexing. Hope this is not confusing,
38635 : // but it s very fast as an implementation.
38636 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
38637 : {
38638 0 : count++;
38639 : }
38640 : }
38641 : }
38642 : }
38643 :
38644 :
38645 :
38646 4 : return count;
38647 : }
38648 :
38649 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
38650 : // using values that overflow signed values of int.
38651 : size_t
38652 0 : SgOmpBindClause::memoryUsage()
38653 : {
38654 : // This function is required because we need the class name as a type when we call sizeof
38655 : // There might be another way to implement this if we have a traversal that only called a
38656 : // representative object (one call for each type of Sage IIIIR node).
38657 0 : size_t memory = numberOfNodes() * sizeof(SgOmpBindClause);
38658 :
38659 0 : return memory;
38660 : }
38661 :
38662 : /* #line 38663 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
38663 :
38664 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
38665 : void
38666 5342 : SgOmpOrderClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
38667 : {
38668 : // This function traverses the memory pool for only a specific IR node
38669 : // and calls the visit function of the input class execute a traversal
38670 : // similar to the style of the attribute based traversals within ROSE.
38671 : // This traversal will visit ALL nodes of the AST where as the other
38672 : // attribute based traversals visit only the embedded tree within the AST.
38673 :
38674 : // Initialize array to the address of the first element of the STL vector
38675 : // (which is guaranteed to be contiguous storage).
38676 : // SgOmpOrderClause objectArray [] = *(Memory_Block_List.begin());
38677 5342 : if (SgOmpOrderClause::pools.empty() == false)
38678 : {
38679 : // Generate an array of memory pools
38680 7 : SgOmpOrderClause** objectArray = (SgOmpOrderClause**) &(SgOmpOrderClause::pools[0]);
38681 :
38682 : // Build a local variable for better performance
38683 7 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
38684 : #if 0
38685 : // Iterate over the memory pools
38686 : for (unsigned int i=0; i < SgOmpOrderClause::pools.size(); i++)
38687 : {
38688 : // objectArray[i] is a single memory pool
38689 : for (int j=0; j < SgOmpOrderClause::pool_size; j++)
38690 : {
38691 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
38692 : {
38693 : traversal.visit(&(objectArray[i][j]));
38694 : }
38695 : }
38696 : }
38697 : #else
38698 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
38699 : // compute the list first and then call the visit function on each list element.
38700 :
38701 : // printf ("Inside of SgOmpOrderClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
38702 :
38703 14 : std::vector<SgOmpOrderClause*> nodeList;
38704 :
38705 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
38706 14 : for (unsigned int i=0; i < SgOmpOrderClause::pools.size(); i++)
38707 : {
38708 : // objectArray[i] is a single memory pool
38709 14007 : for (unsigned j=0; j < SgOmpOrderClause::pool_size; j++)
38710 : {
38711 14000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
38712 : {
38713 7 : nodeList.push_back(&(objectArray[i][j]));
38714 : }
38715 : }
38716 : }
38717 :
38718 : // Iterate over the saved list
38719 7 : size_t nodeListSize = nodeList.size();
38720 14 : for (size_t i=0; i < nodeListSize; i++)
38721 : {
38722 7 : ROSE_ASSERT(nodeList[i] != NULL);
38723 : #if 0
38724 : traversal.visit(nodeList[i]);
38725 : #else
38726 7 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
38727 : {
38728 7 : traversal.visit(nodeList[i]);
38729 : }
38730 : #endif
38731 : }
38732 : #endif
38733 : }
38734 :
38735 : // This should not be required since all previously static data members are
38736 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
38737 :
38738 5342 : }
38739 :
38740 :
38741 : void
38742 194 : SgOmpOrderClause::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
38743 : {
38744 : // This function traverses the memory pool for an IR node and
38745 : // calls the function to execute the visitor object.
38746 :
38747 : // Initialize array to the address of the first element of the STL vector
38748 : // (which is guarenteed to be contiguous storage).
38749 : // SgOmpOrderClause objectArray [] = *(Memory_Block_List.begin());
38750 194 : if (SgOmpOrderClause::pools.empty() == false)
38751 : {
38752 : // Generate an array of memory pools
38753 0 : SgOmpOrderClause** objectArray = (SgOmpOrderClause**) &(SgOmpOrderClause::pools[0]);
38754 :
38755 : // Build a local variable for better performance
38756 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
38757 :
38758 : // Iterate over the memory pools
38759 0 : for (unsigned int i=0; i < SgOmpOrderClause::pools.size(); i++)
38760 : {
38761 : // objectArray[i] is a single memory pool
38762 0 : for (unsigned j=0; j < SgOmpOrderClause::pool_size; j++)
38763 : {
38764 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
38765 : {
38766 : // printf ("Found a valid SgOmpOrderClause object in the memory pool %d at position %d \n",i,j);
38767 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
38768 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
38769 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
38770 : }
38771 : else
38772 : {
38773 : // printf ("Found a INVALID SgOmpOrderClause object in the memory pool \n");
38774 : }
38775 : }
38776 : }
38777 : }
38778 :
38779 : // This should not be required since all previously static data members are
38780 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
38781 :
38782 194 : }
38783 :
38784 : void
38785 0 : SgOmpOrderClause::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
38786 : {
38787 : // This function visits only a single IR node of the memory pool.
38788 : // it is typically called once for each type of IR node within
38789 : // the automatically generated function: traverseRepresentativeNodes().
38790 :
38791 : // Initialize array to the address of the first element of the STL vector
38792 : // (which is guarenteed to be contiguous storage).
38793 : // SgOmpOrderClause objectArray [] = *(Memory_Block_List.begin());
38794 0 : if (SgOmpOrderClause::pools.empty() == false)
38795 : {
38796 : // Generate an array of memory pools
38797 0 : SgOmpOrderClause** objectArray = (SgOmpOrderClause**) &(SgOmpOrderClause::pools[0]);
38798 :
38799 : // Build a local variable for better performance
38800 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
38801 :
38802 : // Iterate over the memory pools
38803 0 : bool done = false;
38804 0 : unsigned i=0;
38805 :
38806 : // find the first valid IR node, call visit function, and then leave
38807 0 : while ( done == false && i < SgOmpOrderClause::pools.size() )
38808 : {
38809 : // objectArray[i] is a single memory pool
38810 : unsigned j=0;
38811 0 : while (done == false && j < SgOmpOrderClause::pool_size)
38812 : {
38813 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
38814 : {
38815 0 : traversal.visit(&(objectArray[i][j]));
38816 0 : done = true;
38817 : }
38818 0 : j++;
38819 : }
38820 0 : i++;
38821 : }
38822 :
38823 : #if 0
38824 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
38825 : if (done == false)
38826 : {
38827 : printf ("No representative for SgOmpOrderClause found in memory pools \n");
38828 : }
38829 : #endif
38830 : }
38831 0 : }
38832 :
38833 :
38834 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
38835 : // using values that overflow signed values of int.
38836 : size_t
38837 4 : SgOmpOrderClause::numberOfNodes()
38838 : {
38839 : // This function traverses the memory pool for an IR node and
38840 : // counts the number of IR nodes of a particular Sage III IR
38841 : // nodes type.
38842 :
38843 4 : size_t count = 0;
38844 4 : if (SgOmpOrderClause::pools.empty() == false)
38845 : {
38846 : // Generate an array of memory pools (this is actually a STL vector,
38847 : // but it is contiguious, so OK to treat this way).
38848 0 : SgOmpOrderClause** objectArray = (SgOmpOrderClause**) &(SgOmpOrderClause::pools[0]);
38849 :
38850 : // Build a local variable for better performance (make it a loop invariant variable).
38851 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
38852 :
38853 : // Iterate over all of the memory pools for this IR node.
38854 0 : for (unsigned int i=0; i < SgOmpOrderClause::pools.size(); i++)
38855 : {
38856 : // objectArray[i] is a single memory pool, iterate over all the
38857 : // IR nodes and only count those that are valid IR nodes used in
38858 : // the AST (i.e. allocated IR nodes).
38859 0 : for (unsigned j=0; j < SgOmpOrderClause::pool_size; j++)
38860 : {
38861 : // This is indexing the STL vector of C/C++ style arrays as a doubly
38862 : // indexed array access. It is OK since we have leveraged the semantics
38863 : // of STL vector memory as contigous and cast the memory as an array
38864 : // of arrays to use the 2D array indexing. Hope this is not confusing,
38865 : // but it s very fast as an implementation.
38866 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
38867 : {
38868 0 : count++;
38869 : }
38870 : }
38871 : }
38872 : }
38873 :
38874 :
38875 :
38876 4 : return count;
38877 : }
38878 :
38879 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
38880 : // using values that overflow signed values of int.
38881 : size_t
38882 0 : SgOmpOrderClause::memoryUsage()
38883 : {
38884 : // This function is required because we need the class name as a type when we call sizeof
38885 : // There might be another way to implement this if we have a traversal that only called a
38886 : // representative object (one call for each type of Sage IIIIR node).
38887 0 : size_t memory = numberOfNodes() * sizeof(SgOmpOrderClause);
38888 :
38889 0 : return memory;
38890 : }
38891 :
38892 : /* #line 38893 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
38893 :
38894 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
38895 : void
38896 5342 : SgOmpDistScheduleClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
38897 : {
38898 : // This function traverses the memory pool for only a specific IR node
38899 : // and calls the visit function of the input class execute a traversal
38900 : // similar to the style of the attribute based traversals within ROSE.
38901 : // This traversal will visit ALL nodes of the AST where as the other
38902 : // attribute based traversals visit only the embedded tree within the AST.
38903 :
38904 : // Initialize array to the address of the first element of the STL vector
38905 : // (which is guaranteed to be contiguous storage).
38906 : // SgOmpDistScheduleClause objectArray [] = *(Memory_Block_List.begin());
38907 5342 : if (SgOmpDistScheduleClause::pools.empty() == false)
38908 : {
38909 : // Generate an array of memory pools
38910 7 : SgOmpDistScheduleClause** objectArray = (SgOmpDistScheduleClause**) &(SgOmpDistScheduleClause::pools[0]);
38911 :
38912 : // Build a local variable for better performance
38913 7 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
38914 : #if 0
38915 : // Iterate over the memory pools
38916 : for (unsigned int i=0; i < SgOmpDistScheduleClause::pools.size(); i++)
38917 : {
38918 : // objectArray[i] is a single memory pool
38919 : for (int j=0; j < SgOmpDistScheduleClause::pool_size; j++)
38920 : {
38921 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
38922 : {
38923 : traversal.visit(&(objectArray[i][j]));
38924 : }
38925 : }
38926 : }
38927 : #else
38928 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
38929 : // compute the list first and then call the visit function on each list element.
38930 :
38931 : // printf ("Inside of SgOmpDistScheduleClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
38932 :
38933 14 : std::vector<SgOmpDistScheduleClause*> nodeList;
38934 :
38935 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
38936 14 : for (unsigned int i=0; i < SgOmpDistScheduleClause::pools.size(); i++)
38937 : {
38938 : // objectArray[i] is a single memory pool
38939 14007 : for (unsigned j=0; j < SgOmpDistScheduleClause::pool_size; j++)
38940 : {
38941 14000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
38942 : {
38943 7 : nodeList.push_back(&(objectArray[i][j]));
38944 : }
38945 : }
38946 : }
38947 :
38948 : // Iterate over the saved list
38949 7 : size_t nodeListSize = nodeList.size();
38950 14 : for (size_t i=0; i < nodeListSize; i++)
38951 : {
38952 7 : ROSE_ASSERT(nodeList[i] != NULL);
38953 : #if 0
38954 : traversal.visit(nodeList[i]);
38955 : #else
38956 7 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
38957 : {
38958 7 : traversal.visit(nodeList[i]);
38959 : }
38960 : #endif
38961 : }
38962 : #endif
38963 : }
38964 :
38965 : // This should not be required since all previously static data members are
38966 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
38967 :
38968 5342 : }
38969 :
38970 :
38971 : void
38972 194 : SgOmpDistScheduleClause::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
38973 : {
38974 : // This function traverses the memory pool for an IR node and
38975 : // calls the function to execute the visitor object.
38976 :
38977 : // Initialize array to the address of the first element of the STL vector
38978 : // (which is guarenteed to be contiguous storage).
38979 : // SgOmpDistScheduleClause objectArray [] = *(Memory_Block_List.begin());
38980 194 : if (SgOmpDistScheduleClause::pools.empty() == false)
38981 : {
38982 : // Generate an array of memory pools
38983 0 : SgOmpDistScheduleClause** objectArray = (SgOmpDistScheduleClause**) &(SgOmpDistScheduleClause::pools[0]);
38984 :
38985 : // Build a local variable for better performance
38986 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
38987 :
38988 : // Iterate over the memory pools
38989 0 : for (unsigned int i=0; i < SgOmpDistScheduleClause::pools.size(); i++)
38990 : {
38991 : // objectArray[i] is a single memory pool
38992 0 : for (unsigned j=0; j < SgOmpDistScheduleClause::pool_size; j++)
38993 : {
38994 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
38995 : {
38996 : // printf ("Found a valid SgOmpDistScheduleClause object in the memory pool %d at position %d \n",i,j);
38997 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
38998 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
38999 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
39000 : }
39001 : else
39002 : {
39003 : // printf ("Found a INVALID SgOmpDistScheduleClause object in the memory pool \n");
39004 : }
39005 : }
39006 : }
39007 : }
39008 :
39009 : // This should not be required since all previously static data members are
39010 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
39011 :
39012 194 : }
39013 :
39014 : void
39015 0 : SgOmpDistScheduleClause::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
39016 : {
39017 : // This function visits only a single IR node of the memory pool.
39018 : // it is typically called once for each type of IR node within
39019 : // the automatically generated function: traverseRepresentativeNodes().
39020 :
39021 : // Initialize array to the address of the first element of the STL vector
39022 : // (which is guarenteed to be contiguous storage).
39023 : // SgOmpDistScheduleClause objectArray [] = *(Memory_Block_List.begin());
39024 0 : if (SgOmpDistScheduleClause::pools.empty() == false)
39025 : {
39026 : // Generate an array of memory pools
39027 0 : SgOmpDistScheduleClause** objectArray = (SgOmpDistScheduleClause**) &(SgOmpDistScheduleClause::pools[0]);
39028 :
39029 : // Build a local variable for better performance
39030 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
39031 :
39032 : // Iterate over the memory pools
39033 0 : bool done = false;
39034 0 : unsigned i=0;
39035 :
39036 : // find the first valid IR node, call visit function, and then leave
39037 0 : while ( done == false && i < SgOmpDistScheduleClause::pools.size() )
39038 : {
39039 : // objectArray[i] is a single memory pool
39040 : unsigned j=0;
39041 0 : while (done == false && j < SgOmpDistScheduleClause::pool_size)
39042 : {
39043 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
39044 : {
39045 0 : traversal.visit(&(objectArray[i][j]));
39046 0 : done = true;
39047 : }
39048 0 : j++;
39049 : }
39050 0 : i++;
39051 : }
39052 :
39053 : #if 0
39054 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
39055 : if (done == false)
39056 : {
39057 : printf ("No representative for SgOmpDistScheduleClause found in memory pools \n");
39058 : }
39059 : #endif
39060 : }
39061 0 : }
39062 :
39063 :
39064 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
39065 : // using values that overflow signed values of int.
39066 : size_t
39067 4 : SgOmpDistScheduleClause::numberOfNodes()
39068 : {
39069 : // This function traverses the memory pool for an IR node and
39070 : // counts the number of IR nodes of a particular Sage III IR
39071 : // nodes type.
39072 :
39073 4 : size_t count = 0;
39074 4 : if (SgOmpDistScheduleClause::pools.empty() == false)
39075 : {
39076 : // Generate an array of memory pools (this is actually a STL vector,
39077 : // but it is contiguious, so OK to treat this way).
39078 0 : SgOmpDistScheduleClause** objectArray = (SgOmpDistScheduleClause**) &(SgOmpDistScheduleClause::pools[0]);
39079 :
39080 : // Build a local variable for better performance (make it a loop invariant variable).
39081 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
39082 :
39083 : // Iterate over all of the memory pools for this IR node.
39084 0 : for (unsigned int i=0; i < SgOmpDistScheduleClause::pools.size(); i++)
39085 : {
39086 : // objectArray[i] is a single memory pool, iterate over all the
39087 : // IR nodes and only count those that are valid IR nodes used in
39088 : // the AST (i.e. allocated IR nodes).
39089 0 : for (unsigned j=0; j < SgOmpDistScheduleClause::pool_size; j++)
39090 : {
39091 : // This is indexing the STL vector of C/C++ style arrays as a doubly
39092 : // indexed array access. It is OK since we have leveraged the semantics
39093 : // of STL vector memory as contigous and cast the memory as an array
39094 : // of arrays to use the 2D array indexing. Hope this is not confusing,
39095 : // but it s very fast as an implementation.
39096 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
39097 : {
39098 0 : count++;
39099 : }
39100 : }
39101 : }
39102 : }
39103 :
39104 :
39105 :
39106 4 : return count;
39107 : }
39108 :
39109 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
39110 : // using values that overflow signed values of int.
39111 : size_t
39112 0 : SgOmpDistScheduleClause::memoryUsage()
39113 : {
39114 : // This function is required because we need the class name as a type when we call sizeof
39115 : // There might be another way to implement this if we have a traversal that only called a
39116 : // representative object (one call for each type of Sage IIIIR node).
39117 0 : size_t memory = numberOfNodes() * sizeof(SgOmpDistScheduleClause);
39118 :
39119 0 : return memory;
39120 : }
39121 :
39122 : /* #line 39123 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
39123 :
39124 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
39125 : void
39126 5342 : SgOmpExpressionClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
39127 : {
39128 : // This function traverses the memory pool for only a specific IR node
39129 : // and calls the visit function of the input class execute a traversal
39130 : // similar to the style of the attribute based traversals within ROSE.
39131 : // This traversal will visit ALL nodes of the AST where as the other
39132 : // attribute based traversals visit only the embedded tree within the AST.
39133 :
39134 : // Initialize array to the address of the first element of the STL vector
39135 : // (which is guaranteed to be contiguous storage).
39136 : // SgOmpExpressionClause objectArray [] = *(Memory_Block_List.begin());
39137 5342 : if (SgOmpExpressionClause::pools.empty() == false)
39138 : {
39139 : // Generate an array of memory pools
39140 0 : SgOmpExpressionClause** objectArray = (SgOmpExpressionClause**) &(SgOmpExpressionClause::pools[0]);
39141 :
39142 : // Build a local variable for better performance
39143 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
39144 : #if 0
39145 : // Iterate over the memory pools
39146 : for (unsigned int i=0; i < SgOmpExpressionClause::pools.size(); i++)
39147 : {
39148 : // objectArray[i] is a single memory pool
39149 : for (int j=0; j < SgOmpExpressionClause::pool_size; j++)
39150 : {
39151 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
39152 : {
39153 : traversal.visit(&(objectArray[i][j]));
39154 : }
39155 : }
39156 : }
39157 : #else
39158 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
39159 : // compute the list first and then call the visit function on each list element.
39160 :
39161 : // printf ("Inside of SgOmpExpressionClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
39162 :
39163 0 : std::vector<SgOmpExpressionClause*> nodeList;
39164 :
39165 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
39166 0 : for (unsigned int i=0; i < SgOmpExpressionClause::pools.size(); i++)
39167 : {
39168 : // objectArray[i] is a single memory pool
39169 0 : for (unsigned j=0; j < SgOmpExpressionClause::pool_size; j++)
39170 : {
39171 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
39172 : {
39173 0 : nodeList.push_back(&(objectArray[i][j]));
39174 : }
39175 : }
39176 : }
39177 :
39178 : // Iterate over the saved list
39179 0 : size_t nodeListSize = nodeList.size();
39180 0 : for (size_t i=0; i < nodeListSize; i++)
39181 : {
39182 0 : ROSE_ASSERT(nodeList[i] != NULL);
39183 : #if 0
39184 : traversal.visit(nodeList[i]);
39185 : #else
39186 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
39187 : {
39188 0 : traversal.visit(nodeList[i]);
39189 : }
39190 : #endif
39191 : }
39192 : #endif
39193 : }
39194 :
39195 : // This should not be required since all previously static data members are
39196 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
39197 :
39198 5342 : }
39199 :
39200 :
39201 : void
39202 194 : SgOmpExpressionClause::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
39203 : {
39204 : // This function traverses the memory pool for an IR node and
39205 : // calls the function to execute the visitor object.
39206 :
39207 : // Initialize array to the address of the first element of the STL vector
39208 : // (which is guarenteed to be contiguous storage).
39209 : // SgOmpExpressionClause objectArray [] = *(Memory_Block_List.begin());
39210 194 : if (SgOmpExpressionClause::pools.empty() == false)
39211 : {
39212 : // Generate an array of memory pools
39213 0 : SgOmpExpressionClause** objectArray = (SgOmpExpressionClause**) &(SgOmpExpressionClause::pools[0]);
39214 :
39215 : // Build a local variable for better performance
39216 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
39217 :
39218 : // Iterate over the memory pools
39219 0 : for (unsigned int i=0; i < SgOmpExpressionClause::pools.size(); i++)
39220 : {
39221 : // objectArray[i] is a single memory pool
39222 0 : for (unsigned j=0; j < SgOmpExpressionClause::pool_size; j++)
39223 : {
39224 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
39225 : {
39226 : // printf ("Found a valid SgOmpExpressionClause object in the memory pool %d at position %d \n",i,j);
39227 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
39228 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
39229 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
39230 : }
39231 : else
39232 : {
39233 : // printf ("Found a INVALID SgOmpExpressionClause object in the memory pool \n");
39234 : }
39235 : }
39236 : }
39237 : }
39238 :
39239 : // This should not be required since all previously static data members are
39240 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
39241 :
39242 194 : }
39243 :
39244 : void
39245 0 : SgOmpExpressionClause::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
39246 : {
39247 : // This function visits only a single IR node of the memory pool.
39248 : // it is typically called once for each type of IR node within
39249 : // the automatically generated function: traverseRepresentativeNodes().
39250 :
39251 : // Initialize array to the address of the first element of the STL vector
39252 : // (which is guarenteed to be contiguous storage).
39253 : // SgOmpExpressionClause objectArray [] = *(Memory_Block_List.begin());
39254 0 : if (SgOmpExpressionClause::pools.empty() == false)
39255 : {
39256 : // Generate an array of memory pools
39257 0 : SgOmpExpressionClause** objectArray = (SgOmpExpressionClause**) &(SgOmpExpressionClause::pools[0]);
39258 :
39259 : // Build a local variable for better performance
39260 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
39261 :
39262 : // Iterate over the memory pools
39263 0 : bool done = false;
39264 0 : unsigned i=0;
39265 :
39266 : // find the first valid IR node, call visit function, and then leave
39267 0 : while ( done == false && i < SgOmpExpressionClause::pools.size() )
39268 : {
39269 : // objectArray[i] is a single memory pool
39270 : unsigned j=0;
39271 0 : while (done == false && j < SgOmpExpressionClause::pool_size)
39272 : {
39273 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
39274 : {
39275 0 : traversal.visit(&(objectArray[i][j]));
39276 0 : done = true;
39277 : }
39278 0 : j++;
39279 : }
39280 0 : i++;
39281 : }
39282 :
39283 : #if 0
39284 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
39285 : if (done == false)
39286 : {
39287 : printf ("No representative for SgOmpExpressionClause found in memory pools \n");
39288 : }
39289 : #endif
39290 : }
39291 0 : }
39292 :
39293 :
39294 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
39295 : // using values that overflow signed values of int.
39296 : size_t
39297 4 : SgOmpExpressionClause::numberOfNodes()
39298 : {
39299 : // This function traverses the memory pool for an IR node and
39300 : // counts the number of IR nodes of a particular Sage III IR
39301 : // nodes type.
39302 :
39303 4 : size_t count = 0;
39304 4 : if (SgOmpExpressionClause::pools.empty() == false)
39305 : {
39306 : // Generate an array of memory pools (this is actually a STL vector,
39307 : // but it is contiguious, so OK to treat this way).
39308 0 : SgOmpExpressionClause** objectArray = (SgOmpExpressionClause**) &(SgOmpExpressionClause::pools[0]);
39309 :
39310 : // Build a local variable for better performance (make it a loop invariant variable).
39311 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
39312 :
39313 : // Iterate over all of the memory pools for this IR node.
39314 0 : for (unsigned int i=0; i < SgOmpExpressionClause::pools.size(); i++)
39315 : {
39316 : // objectArray[i] is a single memory pool, iterate over all the
39317 : // IR nodes and only count those that are valid IR nodes used in
39318 : // the AST (i.e. allocated IR nodes).
39319 0 : for (unsigned j=0; j < SgOmpExpressionClause::pool_size; j++)
39320 : {
39321 : // This is indexing the STL vector of C/C++ style arrays as a doubly
39322 : // indexed array access. It is OK since we have leveraged the semantics
39323 : // of STL vector memory as contigous and cast the memory as an array
39324 : // of arrays to use the 2D array indexing. Hope this is not confusing,
39325 : // but it s very fast as an implementation.
39326 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
39327 : {
39328 0 : count++;
39329 : }
39330 : }
39331 : }
39332 : }
39333 :
39334 :
39335 :
39336 4 : return count;
39337 : }
39338 :
39339 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
39340 : // using values that overflow signed values of int.
39341 : size_t
39342 0 : SgOmpExpressionClause::memoryUsage()
39343 : {
39344 : // This function is required because we need the class name as a type when we call sizeof
39345 : // There might be another way to implement this if we have a traversal that only called a
39346 : // representative object (one call for each type of Sage IIIIR node).
39347 0 : size_t memory = numberOfNodes() * sizeof(SgOmpExpressionClause);
39348 :
39349 0 : return memory;
39350 : }
39351 :
39352 : /* #line 39353 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
39353 :
39354 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
39355 : void
39356 5342 : SgOmpOrderedClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
39357 : {
39358 : // This function traverses the memory pool for only a specific IR node
39359 : // and calls the visit function of the input class execute a traversal
39360 : // similar to the style of the attribute based traversals within ROSE.
39361 : // This traversal will visit ALL nodes of the AST where as the other
39362 : // attribute based traversals visit only the embedded tree within the AST.
39363 :
39364 : // Initialize array to the address of the first element of the STL vector
39365 : // (which is guaranteed to be contiguous storage).
39366 : // SgOmpOrderedClause objectArray [] = *(Memory_Block_List.begin());
39367 5342 : if (SgOmpOrderedClause::pools.empty() == false)
39368 : {
39369 : // Generate an array of memory pools
39370 77 : SgOmpOrderedClause** objectArray = (SgOmpOrderedClause**) &(SgOmpOrderedClause::pools[0]);
39371 :
39372 : // Build a local variable for better performance
39373 77 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
39374 : #if 0
39375 : // Iterate over the memory pools
39376 : for (unsigned int i=0; i < SgOmpOrderedClause::pools.size(); i++)
39377 : {
39378 : // objectArray[i] is a single memory pool
39379 : for (int j=0; j < SgOmpOrderedClause::pool_size; j++)
39380 : {
39381 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
39382 : {
39383 : traversal.visit(&(objectArray[i][j]));
39384 : }
39385 : }
39386 : }
39387 : #else
39388 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
39389 : // compute the list first and then call the visit function on each list element.
39390 :
39391 : // printf ("Inside of SgOmpOrderedClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
39392 :
39393 154 : std::vector<SgOmpOrderedClause*> nodeList;
39394 :
39395 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
39396 154 : for (unsigned int i=0; i < SgOmpOrderedClause::pools.size(); i++)
39397 : {
39398 : // objectArray[i] is a single memory pool
39399 154077 : for (unsigned j=0; j < SgOmpOrderedClause::pool_size; j++)
39400 : {
39401 154000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
39402 : {
39403 91 : nodeList.push_back(&(objectArray[i][j]));
39404 : }
39405 : }
39406 : }
39407 :
39408 : // Iterate over the saved list
39409 77 : size_t nodeListSize = nodeList.size();
39410 168 : for (size_t i=0; i < nodeListSize; i++)
39411 : {
39412 91 : ROSE_ASSERT(nodeList[i] != NULL);
39413 : #if 0
39414 : traversal.visit(nodeList[i]);
39415 : #else
39416 91 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
39417 : {
39418 91 : traversal.visit(nodeList[i]);
39419 : }
39420 : #endif
39421 : }
39422 : #endif
39423 : }
39424 :
39425 : // This should not be required since all previously static data members are
39426 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
39427 :
39428 5342 : }
39429 :
39430 :
39431 : void
39432 194 : SgOmpOrderedClause::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
39433 : {
39434 : // This function traverses the memory pool for an IR node and
39435 : // calls the function to execute the visitor object.
39436 :
39437 : // Initialize array to the address of the first element of the STL vector
39438 : // (which is guarenteed to be contiguous storage).
39439 : // SgOmpOrderedClause objectArray [] = *(Memory_Block_List.begin());
39440 194 : if (SgOmpOrderedClause::pools.empty() == false)
39441 : {
39442 : // Generate an array of memory pools
39443 0 : SgOmpOrderedClause** objectArray = (SgOmpOrderedClause**) &(SgOmpOrderedClause::pools[0]);
39444 :
39445 : // Build a local variable for better performance
39446 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
39447 :
39448 : // Iterate over the memory pools
39449 0 : for (unsigned int i=0; i < SgOmpOrderedClause::pools.size(); i++)
39450 : {
39451 : // objectArray[i] is a single memory pool
39452 0 : for (unsigned j=0; j < SgOmpOrderedClause::pool_size; j++)
39453 : {
39454 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
39455 : {
39456 : // printf ("Found a valid SgOmpOrderedClause object in the memory pool %d at position %d \n",i,j);
39457 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
39458 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
39459 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
39460 : }
39461 : else
39462 : {
39463 : // printf ("Found a INVALID SgOmpOrderedClause object in the memory pool \n");
39464 : }
39465 : }
39466 : }
39467 : }
39468 :
39469 : // This should not be required since all previously static data members are
39470 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
39471 :
39472 194 : }
39473 :
39474 : void
39475 0 : SgOmpOrderedClause::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
39476 : {
39477 : // This function visits only a single IR node of the memory pool.
39478 : // it is typically called once for each type of IR node within
39479 : // the automatically generated function: traverseRepresentativeNodes().
39480 :
39481 : // Initialize array to the address of the first element of the STL vector
39482 : // (which is guarenteed to be contiguous storage).
39483 : // SgOmpOrderedClause objectArray [] = *(Memory_Block_List.begin());
39484 0 : if (SgOmpOrderedClause::pools.empty() == false)
39485 : {
39486 : // Generate an array of memory pools
39487 0 : SgOmpOrderedClause** objectArray = (SgOmpOrderedClause**) &(SgOmpOrderedClause::pools[0]);
39488 :
39489 : // Build a local variable for better performance
39490 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
39491 :
39492 : // Iterate over the memory pools
39493 0 : bool done = false;
39494 0 : unsigned i=0;
39495 :
39496 : // find the first valid IR node, call visit function, and then leave
39497 0 : while ( done == false && i < SgOmpOrderedClause::pools.size() )
39498 : {
39499 : // objectArray[i] is a single memory pool
39500 : unsigned j=0;
39501 0 : while (done == false && j < SgOmpOrderedClause::pool_size)
39502 : {
39503 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
39504 : {
39505 0 : traversal.visit(&(objectArray[i][j]));
39506 0 : done = true;
39507 : }
39508 0 : j++;
39509 : }
39510 0 : i++;
39511 : }
39512 :
39513 : #if 0
39514 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
39515 : if (done == false)
39516 : {
39517 : printf ("No representative for SgOmpOrderedClause found in memory pools \n");
39518 : }
39519 : #endif
39520 : }
39521 0 : }
39522 :
39523 :
39524 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
39525 : // using values that overflow signed values of int.
39526 : size_t
39527 4 : SgOmpOrderedClause::numberOfNodes()
39528 : {
39529 : // This function traverses the memory pool for an IR node and
39530 : // counts the number of IR nodes of a particular Sage III IR
39531 : // nodes type.
39532 :
39533 4 : size_t count = 0;
39534 4 : if (SgOmpOrderedClause::pools.empty() == false)
39535 : {
39536 : // Generate an array of memory pools (this is actually a STL vector,
39537 : // but it is contiguious, so OK to treat this way).
39538 0 : SgOmpOrderedClause** objectArray = (SgOmpOrderedClause**) &(SgOmpOrderedClause::pools[0]);
39539 :
39540 : // Build a local variable for better performance (make it a loop invariant variable).
39541 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
39542 :
39543 : // Iterate over all of the memory pools for this IR node.
39544 0 : for (unsigned int i=0; i < SgOmpOrderedClause::pools.size(); i++)
39545 : {
39546 : // objectArray[i] is a single memory pool, iterate over all the
39547 : // IR nodes and only count those that are valid IR nodes used in
39548 : // the AST (i.e. allocated IR nodes).
39549 0 : for (unsigned j=0; j < SgOmpOrderedClause::pool_size; j++)
39550 : {
39551 : // This is indexing the STL vector of C/C++ style arrays as a doubly
39552 : // indexed array access. It is OK since we have leveraged the semantics
39553 : // of STL vector memory as contigous and cast the memory as an array
39554 : // of arrays to use the 2D array indexing. Hope this is not confusing,
39555 : // but it s very fast as an implementation.
39556 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
39557 : {
39558 0 : count++;
39559 : }
39560 : }
39561 : }
39562 : }
39563 :
39564 :
39565 :
39566 4 : return count;
39567 : }
39568 :
39569 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
39570 : // using values that overflow signed values of int.
39571 : size_t
39572 0 : SgOmpOrderedClause::memoryUsage()
39573 : {
39574 : // This function is required because we need the class name as a type when we call sizeof
39575 : // There might be another way to implement this if we have a traversal that only called a
39576 : // representative object (one call for each type of Sage IIIIR node).
39577 0 : size_t memory = numberOfNodes() * sizeof(SgOmpOrderedClause);
39578 :
39579 0 : return memory;
39580 : }
39581 :
39582 : /* #line 39583 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
39583 :
39584 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
39585 : void
39586 5342 : SgOmpCollapseClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
39587 : {
39588 : // This function traverses the memory pool for only a specific IR node
39589 : // and calls the visit function of the input class execute a traversal
39590 : // similar to the style of the attribute based traversals within ROSE.
39591 : // This traversal will visit ALL nodes of the AST where as the other
39592 : // attribute based traversals visit only the embedded tree within the AST.
39593 :
39594 : // Initialize array to the address of the first element of the STL vector
39595 : // (which is guaranteed to be contiguous storage).
39596 : // SgOmpCollapseClause objectArray [] = *(Memory_Block_List.begin());
39597 5342 : if (SgOmpCollapseClause::pools.empty() == false)
39598 : {
39599 : // Generate an array of memory pools
39600 49 : SgOmpCollapseClause** objectArray = (SgOmpCollapseClause**) &(SgOmpCollapseClause::pools[0]);
39601 :
39602 : // Build a local variable for better performance
39603 49 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
39604 : #if 0
39605 : // Iterate over the memory pools
39606 : for (unsigned int i=0; i < SgOmpCollapseClause::pools.size(); i++)
39607 : {
39608 : // objectArray[i] is a single memory pool
39609 : for (int j=0; j < SgOmpCollapseClause::pool_size; j++)
39610 : {
39611 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
39612 : {
39613 : traversal.visit(&(objectArray[i][j]));
39614 : }
39615 : }
39616 : }
39617 : #else
39618 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
39619 : // compute the list first and then call the visit function on each list element.
39620 :
39621 : // printf ("Inside of SgOmpCollapseClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
39622 :
39623 98 : std::vector<SgOmpCollapseClause*> nodeList;
39624 :
39625 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
39626 98 : for (unsigned int i=0; i < SgOmpCollapseClause::pools.size(); i++)
39627 : {
39628 : // objectArray[i] is a single memory pool
39629 98049 : for (unsigned j=0; j < SgOmpCollapseClause::pool_size; j++)
39630 : {
39631 98000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
39632 : {
39633 77 : nodeList.push_back(&(objectArray[i][j]));
39634 : }
39635 : }
39636 : }
39637 :
39638 : // Iterate over the saved list
39639 49 : size_t nodeListSize = nodeList.size();
39640 126 : for (size_t i=0; i < nodeListSize; i++)
39641 : {
39642 77 : ROSE_ASSERT(nodeList[i] != NULL);
39643 : #if 0
39644 : traversal.visit(nodeList[i]);
39645 : #else
39646 77 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
39647 : {
39648 77 : traversal.visit(nodeList[i]);
39649 : }
39650 : #endif
39651 : }
39652 : #endif
39653 : }
39654 :
39655 : // This should not be required since all previously static data members are
39656 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
39657 :
39658 5342 : }
39659 :
39660 :
39661 : void
39662 194 : SgOmpCollapseClause::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
39663 : {
39664 : // This function traverses the memory pool for an IR node and
39665 : // calls the function to execute the visitor object.
39666 :
39667 : // Initialize array to the address of the first element of the STL vector
39668 : // (which is guarenteed to be contiguous storage).
39669 : // SgOmpCollapseClause objectArray [] = *(Memory_Block_List.begin());
39670 194 : if (SgOmpCollapseClause::pools.empty() == false)
39671 : {
39672 : // Generate an array of memory pools
39673 0 : SgOmpCollapseClause** objectArray = (SgOmpCollapseClause**) &(SgOmpCollapseClause::pools[0]);
39674 :
39675 : // Build a local variable for better performance
39676 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
39677 :
39678 : // Iterate over the memory pools
39679 0 : for (unsigned int i=0; i < SgOmpCollapseClause::pools.size(); i++)
39680 : {
39681 : // objectArray[i] is a single memory pool
39682 0 : for (unsigned j=0; j < SgOmpCollapseClause::pool_size; j++)
39683 : {
39684 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
39685 : {
39686 : // printf ("Found a valid SgOmpCollapseClause object in the memory pool %d at position %d \n",i,j);
39687 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
39688 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
39689 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
39690 : }
39691 : else
39692 : {
39693 : // printf ("Found a INVALID SgOmpCollapseClause object in the memory pool \n");
39694 : }
39695 : }
39696 : }
39697 : }
39698 :
39699 : // This should not be required since all previously static data members are
39700 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
39701 :
39702 194 : }
39703 :
39704 : void
39705 0 : SgOmpCollapseClause::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
39706 : {
39707 : // This function visits only a single IR node of the memory pool.
39708 : // it is typically called once for each type of IR node within
39709 : // the automatically generated function: traverseRepresentativeNodes().
39710 :
39711 : // Initialize array to the address of the first element of the STL vector
39712 : // (which is guarenteed to be contiguous storage).
39713 : // SgOmpCollapseClause objectArray [] = *(Memory_Block_List.begin());
39714 0 : if (SgOmpCollapseClause::pools.empty() == false)
39715 : {
39716 : // Generate an array of memory pools
39717 0 : SgOmpCollapseClause** objectArray = (SgOmpCollapseClause**) &(SgOmpCollapseClause::pools[0]);
39718 :
39719 : // Build a local variable for better performance
39720 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
39721 :
39722 : // Iterate over the memory pools
39723 0 : bool done = false;
39724 0 : unsigned i=0;
39725 :
39726 : // find the first valid IR node, call visit function, and then leave
39727 0 : while ( done == false && i < SgOmpCollapseClause::pools.size() )
39728 : {
39729 : // objectArray[i] is a single memory pool
39730 : unsigned j=0;
39731 0 : while (done == false && j < SgOmpCollapseClause::pool_size)
39732 : {
39733 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
39734 : {
39735 0 : traversal.visit(&(objectArray[i][j]));
39736 0 : done = true;
39737 : }
39738 0 : j++;
39739 : }
39740 0 : i++;
39741 : }
39742 :
39743 : #if 0
39744 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
39745 : if (done == false)
39746 : {
39747 : printf ("No representative for SgOmpCollapseClause found in memory pools \n");
39748 : }
39749 : #endif
39750 : }
39751 0 : }
39752 :
39753 :
39754 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
39755 : // using values that overflow signed values of int.
39756 : size_t
39757 4 : SgOmpCollapseClause::numberOfNodes()
39758 : {
39759 : // This function traverses the memory pool for an IR node and
39760 : // counts the number of IR nodes of a particular Sage III IR
39761 : // nodes type.
39762 :
39763 4 : size_t count = 0;
39764 4 : if (SgOmpCollapseClause::pools.empty() == false)
39765 : {
39766 : // Generate an array of memory pools (this is actually a STL vector,
39767 : // but it is contiguious, so OK to treat this way).
39768 0 : SgOmpCollapseClause** objectArray = (SgOmpCollapseClause**) &(SgOmpCollapseClause::pools[0]);
39769 :
39770 : // Build a local variable for better performance (make it a loop invariant variable).
39771 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
39772 :
39773 : // Iterate over all of the memory pools for this IR node.
39774 0 : for (unsigned int i=0; i < SgOmpCollapseClause::pools.size(); i++)
39775 : {
39776 : // objectArray[i] is a single memory pool, iterate over all the
39777 : // IR nodes and only count those that are valid IR nodes used in
39778 : // the AST (i.e. allocated IR nodes).
39779 0 : for (unsigned j=0; j < SgOmpCollapseClause::pool_size; j++)
39780 : {
39781 : // This is indexing the STL vector of C/C++ style arrays as a doubly
39782 : // indexed array access. It is OK since we have leveraged the semantics
39783 : // of STL vector memory as contigous and cast the memory as an array
39784 : // of arrays to use the 2D array indexing. Hope this is not confusing,
39785 : // but it s very fast as an implementation.
39786 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
39787 : {
39788 0 : count++;
39789 : }
39790 : }
39791 : }
39792 : }
39793 :
39794 :
39795 :
39796 4 : return count;
39797 : }
39798 :
39799 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
39800 : // using values that overflow signed values of int.
39801 : size_t
39802 0 : SgOmpCollapseClause::memoryUsage()
39803 : {
39804 : // This function is required because we need the class name as a type when we call sizeof
39805 : // There might be another way to implement this if we have a traversal that only called a
39806 : // representative object (one call for each type of Sage IIIIR node).
39807 0 : size_t memory = numberOfNodes() * sizeof(SgOmpCollapseClause);
39808 :
39809 0 : return memory;
39810 : }
39811 :
39812 : /* #line 39813 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
39813 :
39814 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
39815 : void
39816 5342 : SgOmpIfClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
39817 : {
39818 : // This function traverses the memory pool for only a specific IR node
39819 : // and calls the visit function of the input class execute a traversal
39820 : // similar to the style of the attribute based traversals within ROSE.
39821 : // This traversal will visit ALL nodes of the AST where as the other
39822 : // attribute based traversals visit only the embedded tree within the AST.
39823 :
39824 : // Initialize array to the address of the first element of the STL vector
39825 : // (which is guaranteed to be contiguous storage).
39826 : // SgOmpIfClause objectArray [] = *(Memory_Block_List.begin());
39827 5342 : if (SgOmpIfClause::pools.empty() == false)
39828 : {
39829 : // Generate an array of memory pools
39830 182 : SgOmpIfClause** objectArray = (SgOmpIfClause**) &(SgOmpIfClause::pools[0]);
39831 :
39832 : // Build a local variable for better performance
39833 182 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
39834 : #if 0
39835 : // Iterate over the memory pools
39836 : for (unsigned int i=0; i < SgOmpIfClause::pools.size(); i++)
39837 : {
39838 : // objectArray[i] is a single memory pool
39839 : for (int j=0; j < SgOmpIfClause::pool_size; j++)
39840 : {
39841 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
39842 : {
39843 : traversal.visit(&(objectArray[i][j]));
39844 : }
39845 : }
39846 : }
39847 : #else
39848 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
39849 : // compute the list first and then call the visit function on each list element.
39850 :
39851 : // printf ("Inside of SgOmpIfClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
39852 :
39853 364 : std::vector<SgOmpIfClause*> nodeList;
39854 :
39855 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
39856 364 : for (unsigned int i=0; i < SgOmpIfClause::pools.size(); i++)
39857 : {
39858 : // objectArray[i] is a single memory pool
39859 364182 : for (unsigned j=0; j < SgOmpIfClause::pool_size; j++)
39860 : {
39861 364000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
39862 : {
39863 259 : nodeList.push_back(&(objectArray[i][j]));
39864 : }
39865 : }
39866 : }
39867 :
39868 : // Iterate over the saved list
39869 182 : size_t nodeListSize = nodeList.size();
39870 441 : for (size_t i=0; i < nodeListSize; i++)
39871 : {
39872 259 : ROSE_ASSERT(nodeList[i] != NULL);
39873 : #if 0
39874 : traversal.visit(nodeList[i]);
39875 : #else
39876 259 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
39877 : {
39878 259 : traversal.visit(nodeList[i]);
39879 : }
39880 : #endif
39881 : }
39882 : #endif
39883 : }
39884 :
39885 : // This should not be required since all previously static data members are
39886 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
39887 :
39888 5342 : }
39889 :
39890 :
39891 : void
39892 194 : SgOmpIfClause::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
39893 : {
39894 : // This function traverses the memory pool for an IR node and
39895 : // calls the function to execute the visitor object.
39896 :
39897 : // Initialize array to the address of the first element of the STL vector
39898 : // (which is guarenteed to be contiguous storage).
39899 : // SgOmpIfClause objectArray [] = *(Memory_Block_List.begin());
39900 194 : if (SgOmpIfClause::pools.empty() == false)
39901 : {
39902 : // Generate an array of memory pools
39903 0 : SgOmpIfClause** objectArray = (SgOmpIfClause**) &(SgOmpIfClause::pools[0]);
39904 :
39905 : // Build a local variable for better performance
39906 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
39907 :
39908 : // Iterate over the memory pools
39909 0 : for (unsigned int i=0; i < SgOmpIfClause::pools.size(); i++)
39910 : {
39911 : // objectArray[i] is a single memory pool
39912 0 : for (unsigned j=0; j < SgOmpIfClause::pool_size; j++)
39913 : {
39914 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
39915 : {
39916 : // printf ("Found a valid SgOmpIfClause object in the memory pool %d at position %d \n",i,j);
39917 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
39918 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
39919 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
39920 : }
39921 : else
39922 : {
39923 : // printf ("Found a INVALID SgOmpIfClause object in the memory pool \n");
39924 : }
39925 : }
39926 : }
39927 : }
39928 :
39929 : // This should not be required since all previously static data members are
39930 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
39931 :
39932 194 : }
39933 :
39934 : void
39935 0 : SgOmpIfClause::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
39936 : {
39937 : // This function visits only a single IR node of the memory pool.
39938 : // it is typically called once for each type of IR node within
39939 : // the automatically generated function: traverseRepresentativeNodes().
39940 :
39941 : // Initialize array to the address of the first element of the STL vector
39942 : // (which is guarenteed to be contiguous storage).
39943 : // SgOmpIfClause objectArray [] = *(Memory_Block_List.begin());
39944 0 : if (SgOmpIfClause::pools.empty() == false)
39945 : {
39946 : // Generate an array of memory pools
39947 0 : SgOmpIfClause** objectArray = (SgOmpIfClause**) &(SgOmpIfClause::pools[0]);
39948 :
39949 : // Build a local variable for better performance
39950 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
39951 :
39952 : // Iterate over the memory pools
39953 0 : bool done = false;
39954 0 : unsigned i=0;
39955 :
39956 : // find the first valid IR node, call visit function, and then leave
39957 0 : while ( done == false && i < SgOmpIfClause::pools.size() )
39958 : {
39959 : // objectArray[i] is a single memory pool
39960 : unsigned j=0;
39961 0 : while (done == false && j < SgOmpIfClause::pool_size)
39962 : {
39963 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
39964 : {
39965 0 : traversal.visit(&(objectArray[i][j]));
39966 0 : done = true;
39967 : }
39968 0 : j++;
39969 : }
39970 0 : i++;
39971 : }
39972 :
39973 : #if 0
39974 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
39975 : if (done == false)
39976 : {
39977 : printf ("No representative for SgOmpIfClause found in memory pools \n");
39978 : }
39979 : #endif
39980 : }
39981 0 : }
39982 :
39983 :
39984 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
39985 : // using values that overflow signed values of int.
39986 : size_t
39987 4 : SgOmpIfClause::numberOfNodes()
39988 : {
39989 : // This function traverses the memory pool for an IR node and
39990 : // counts the number of IR nodes of a particular Sage III IR
39991 : // nodes type.
39992 :
39993 4 : size_t count = 0;
39994 4 : if (SgOmpIfClause::pools.empty() == false)
39995 : {
39996 : // Generate an array of memory pools (this is actually a STL vector,
39997 : // but it is contiguious, so OK to treat this way).
39998 0 : SgOmpIfClause** objectArray = (SgOmpIfClause**) &(SgOmpIfClause::pools[0]);
39999 :
40000 : // Build a local variable for better performance (make it a loop invariant variable).
40001 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
40002 :
40003 : // Iterate over all of the memory pools for this IR node.
40004 0 : for (unsigned int i=0; i < SgOmpIfClause::pools.size(); i++)
40005 : {
40006 : // objectArray[i] is a single memory pool, iterate over all the
40007 : // IR nodes and only count those that are valid IR nodes used in
40008 : // the AST (i.e. allocated IR nodes).
40009 0 : for (unsigned j=0; j < SgOmpIfClause::pool_size; j++)
40010 : {
40011 : // This is indexing the STL vector of C/C++ style arrays as a doubly
40012 : // indexed array access. It is OK since we have leveraged the semantics
40013 : // of STL vector memory as contigous and cast the memory as an array
40014 : // of arrays to use the 2D array indexing. Hope this is not confusing,
40015 : // but it s very fast as an implementation.
40016 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
40017 : {
40018 0 : count++;
40019 : }
40020 : }
40021 : }
40022 : }
40023 :
40024 :
40025 :
40026 4 : return count;
40027 : }
40028 :
40029 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
40030 : // using values that overflow signed values of int.
40031 : size_t
40032 0 : SgOmpIfClause::memoryUsage()
40033 : {
40034 : // This function is required because we need the class name as a type when we call sizeof
40035 : // There might be another way to implement this if we have a traversal that only called a
40036 : // representative object (one call for each type of Sage IIIIR node).
40037 0 : size_t memory = numberOfNodes() * sizeof(SgOmpIfClause);
40038 :
40039 0 : return memory;
40040 : }
40041 :
40042 : /* #line 40043 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
40043 :
40044 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
40045 : void
40046 5342 : SgUpirNumUnitsField::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
40047 : {
40048 : // This function traverses the memory pool for only a specific IR node
40049 : // and calls the visit function of the input class execute a traversal
40050 : // similar to the style of the attribute based traversals within ROSE.
40051 : // This traversal will visit ALL nodes of the AST where as the other
40052 : // attribute based traversals visit only the embedded tree within the AST.
40053 :
40054 : // Initialize array to the address of the first element of the STL vector
40055 : // (which is guaranteed to be contiguous storage).
40056 : // SgUpirNumUnitsField objectArray [] = *(Memory_Block_List.begin());
40057 5342 : if (SgUpirNumUnitsField::pools.empty() == false)
40058 : {
40059 : // Generate an array of memory pools
40060 77 : SgUpirNumUnitsField** objectArray = (SgUpirNumUnitsField**) &(SgUpirNumUnitsField::pools[0]);
40061 :
40062 : // Build a local variable for better performance
40063 77 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
40064 : #if 0
40065 : // Iterate over the memory pools
40066 : for (unsigned int i=0; i < SgUpirNumUnitsField::pools.size(); i++)
40067 : {
40068 : // objectArray[i] is a single memory pool
40069 : for (int j=0; j < SgUpirNumUnitsField::pool_size; j++)
40070 : {
40071 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
40072 : {
40073 : traversal.visit(&(objectArray[i][j]));
40074 : }
40075 : }
40076 : }
40077 : #else
40078 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
40079 : // compute the list first and then call the visit function on each list element.
40080 :
40081 : // printf ("Inside of SgUpirNumUnitsField::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
40082 :
40083 154 : std::vector<SgUpirNumUnitsField*> nodeList;
40084 :
40085 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
40086 154 : for (unsigned int i=0; i < SgUpirNumUnitsField::pools.size(); i++)
40087 : {
40088 : // objectArray[i] is a single memory pool
40089 154077 : for (unsigned j=0; j < SgUpirNumUnitsField::pool_size; j++)
40090 : {
40091 154000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
40092 : {
40093 126 : nodeList.push_back(&(objectArray[i][j]));
40094 : }
40095 : }
40096 : }
40097 :
40098 : // Iterate over the saved list
40099 77 : size_t nodeListSize = nodeList.size();
40100 203 : for (size_t i=0; i < nodeListSize; i++)
40101 : {
40102 126 : ROSE_ASSERT(nodeList[i] != NULL);
40103 : #if 0
40104 : traversal.visit(nodeList[i]);
40105 : #else
40106 126 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
40107 : {
40108 126 : traversal.visit(nodeList[i]);
40109 : }
40110 : #endif
40111 : }
40112 : #endif
40113 : }
40114 :
40115 : // This should not be required since all previously static data members are
40116 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
40117 :
40118 5342 : }
40119 :
40120 :
40121 : void
40122 194 : SgUpirNumUnitsField::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
40123 : {
40124 : // This function traverses the memory pool for an IR node and
40125 : // calls the function to execute the visitor object.
40126 :
40127 : // Initialize array to the address of the first element of the STL vector
40128 : // (which is guarenteed to be contiguous storage).
40129 : // SgUpirNumUnitsField objectArray [] = *(Memory_Block_List.begin());
40130 194 : if (SgUpirNumUnitsField::pools.empty() == false)
40131 : {
40132 : // Generate an array of memory pools
40133 0 : SgUpirNumUnitsField** objectArray = (SgUpirNumUnitsField**) &(SgUpirNumUnitsField::pools[0]);
40134 :
40135 : // Build a local variable for better performance
40136 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
40137 :
40138 : // Iterate over the memory pools
40139 0 : for (unsigned int i=0; i < SgUpirNumUnitsField::pools.size(); i++)
40140 : {
40141 : // objectArray[i] is a single memory pool
40142 0 : for (unsigned j=0; j < SgUpirNumUnitsField::pool_size; j++)
40143 : {
40144 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
40145 : {
40146 : // printf ("Found a valid SgUpirNumUnitsField object in the memory pool %d at position %d \n",i,j);
40147 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
40148 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
40149 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
40150 : }
40151 : else
40152 : {
40153 : // printf ("Found a INVALID SgUpirNumUnitsField object in the memory pool \n");
40154 : }
40155 : }
40156 : }
40157 : }
40158 :
40159 : // This should not be required since all previously static data members are
40160 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
40161 :
40162 194 : }
40163 :
40164 : void
40165 0 : SgUpirNumUnitsField::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
40166 : {
40167 : // This function visits only a single IR node of the memory pool.
40168 : // it is typically called once for each type of IR node within
40169 : // the automatically generated function: traverseRepresentativeNodes().
40170 :
40171 : // Initialize array to the address of the first element of the STL vector
40172 : // (which is guarenteed to be contiguous storage).
40173 : // SgUpirNumUnitsField objectArray [] = *(Memory_Block_List.begin());
40174 0 : if (SgUpirNumUnitsField::pools.empty() == false)
40175 : {
40176 : // Generate an array of memory pools
40177 0 : SgUpirNumUnitsField** objectArray = (SgUpirNumUnitsField**) &(SgUpirNumUnitsField::pools[0]);
40178 :
40179 : // Build a local variable for better performance
40180 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
40181 :
40182 : // Iterate over the memory pools
40183 0 : bool done = false;
40184 0 : unsigned i=0;
40185 :
40186 : // find the first valid IR node, call visit function, and then leave
40187 0 : while ( done == false && i < SgUpirNumUnitsField::pools.size() )
40188 : {
40189 : // objectArray[i] is a single memory pool
40190 : unsigned j=0;
40191 0 : while (done == false && j < SgUpirNumUnitsField::pool_size)
40192 : {
40193 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
40194 : {
40195 0 : traversal.visit(&(objectArray[i][j]));
40196 0 : done = true;
40197 : }
40198 0 : j++;
40199 : }
40200 0 : i++;
40201 : }
40202 :
40203 : #if 0
40204 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
40205 : if (done == false)
40206 : {
40207 : printf ("No representative for SgUpirNumUnitsField found in memory pools \n");
40208 : }
40209 : #endif
40210 : }
40211 0 : }
40212 :
40213 :
40214 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
40215 : // using values that overflow signed values of int.
40216 : size_t
40217 4 : SgUpirNumUnitsField::numberOfNodes()
40218 : {
40219 : // This function traverses the memory pool for an IR node and
40220 : // counts the number of IR nodes of a particular Sage III IR
40221 : // nodes type.
40222 :
40223 4 : size_t count = 0;
40224 4 : if (SgUpirNumUnitsField::pools.empty() == false)
40225 : {
40226 : // Generate an array of memory pools (this is actually a STL vector,
40227 : // but it is contiguious, so OK to treat this way).
40228 0 : SgUpirNumUnitsField** objectArray = (SgUpirNumUnitsField**) &(SgUpirNumUnitsField::pools[0]);
40229 :
40230 : // Build a local variable for better performance (make it a loop invariant variable).
40231 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
40232 :
40233 : // Iterate over all of the memory pools for this IR node.
40234 0 : for (unsigned int i=0; i < SgUpirNumUnitsField::pools.size(); i++)
40235 : {
40236 : // objectArray[i] is a single memory pool, iterate over all the
40237 : // IR nodes and only count those that are valid IR nodes used in
40238 : // the AST (i.e. allocated IR nodes).
40239 0 : for (unsigned j=0; j < SgUpirNumUnitsField::pool_size; j++)
40240 : {
40241 : // This is indexing the STL vector of C/C++ style arrays as a doubly
40242 : // indexed array access. It is OK since we have leveraged the semantics
40243 : // of STL vector memory as contigous and cast the memory as an array
40244 : // of arrays to use the 2D array indexing. Hope this is not confusing,
40245 : // but it s very fast as an implementation.
40246 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
40247 : {
40248 0 : count++;
40249 : }
40250 : }
40251 : }
40252 : }
40253 :
40254 :
40255 :
40256 4 : return count;
40257 : }
40258 :
40259 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
40260 : // using values that overflow signed values of int.
40261 : size_t
40262 0 : SgUpirNumUnitsField::memoryUsage()
40263 : {
40264 : // This function is required because we need the class name as a type when we call sizeof
40265 : // There might be another way to implement this if we have a traversal that only called a
40266 : // representative object (one call for each type of Sage IIIIR node).
40267 0 : size_t memory = numberOfNodes() * sizeof(SgUpirNumUnitsField);
40268 :
40269 0 : return memory;
40270 : }
40271 :
40272 : /* #line 40273 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
40273 :
40274 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
40275 : void
40276 5342 : SgOmpNumTeamsClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
40277 : {
40278 : // This function traverses the memory pool for only a specific IR node
40279 : // and calls the visit function of the input class execute a traversal
40280 : // similar to the style of the attribute based traversals within ROSE.
40281 : // This traversal will visit ALL nodes of the AST where as the other
40282 : // attribute based traversals visit only the embedded tree within the AST.
40283 :
40284 : // Initialize array to the address of the first element of the STL vector
40285 : // (which is guaranteed to be contiguous storage).
40286 : // SgOmpNumTeamsClause objectArray [] = *(Memory_Block_List.begin());
40287 5342 : if (SgOmpNumTeamsClause::pools.empty() == false)
40288 : {
40289 : // Generate an array of memory pools
40290 56 : SgOmpNumTeamsClause** objectArray = (SgOmpNumTeamsClause**) &(SgOmpNumTeamsClause::pools[0]);
40291 :
40292 : // Build a local variable for better performance
40293 56 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
40294 : #if 0
40295 : // Iterate over the memory pools
40296 : for (unsigned int i=0; i < SgOmpNumTeamsClause::pools.size(); i++)
40297 : {
40298 : // objectArray[i] is a single memory pool
40299 : for (int j=0; j < SgOmpNumTeamsClause::pool_size; j++)
40300 : {
40301 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
40302 : {
40303 : traversal.visit(&(objectArray[i][j]));
40304 : }
40305 : }
40306 : }
40307 : #else
40308 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
40309 : // compute the list first and then call the visit function on each list element.
40310 :
40311 : // printf ("Inside of SgOmpNumTeamsClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
40312 :
40313 112 : std::vector<SgOmpNumTeamsClause*> nodeList;
40314 :
40315 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
40316 112 : for (unsigned int i=0; i < SgOmpNumTeamsClause::pools.size(); i++)
40317 : {
40318 : // objectArray[i] is a single memory pool
40319 112056 : for (unsigned j=0; j < SgOmpNumTeamsClause::pool_size; j++)
40320 : {
40321 112000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
40322 : {
40323 56 : nodeList.push_back(&(objectArray[i][j]));
40324 : }
40325 : }
40326 : }
40327 :
40328 : // Iterate over the saved list
40329 56 : size_t nodeListSize = nodeList.size();
40330 112 : for (size_t i=0; i < nodeListSize; i++)
40331 : {
40332 56 : ROSE_ASSERT(nodeList[i] != NULL);
40333 : #if 0
40334 : traversal.visit(nodeList[i]);
40335 : #else
40336 56 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
40337 : {
40338 56 : traversal.visit(nodeList[i]);
40339 : }
40340 : #endif
40341 : }
40342 : #endif
40343 : }
40344 :
40345 : // This should not be required since all previously static data members are
40346 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
40347 :
40348 5342 : }
40349 :
40350 :
40351 : void
40352 194 : SgOmpNumTeamsClause::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
40353 : {
40354 : // This function traverses the memory pool for an IR node and
40355 : // calls the function to execute the visitor object.
40356 :
40357 : // Initialize array to the address of the first element of the STL vector
40358 : // (which is guarenteed to be contiguous storage).
40359 : // SgOmpNumTeamsClause objectArray [] = *(Memory_Block_List.begin());
40360 194 : if (SgOmpNumTeamsClause::pools.empty() == false)
40361 : {
40362 : // Generate an array of memory pools
40363 0 : SgOmpNumTeamsClause** objectArray = (SgOmpNumTeamsClause**) &(SgOmpNumTeamsClause::pools[0]);
40364 :
40365 : // Build a local variable for better performance
40366 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
40367 :
40368 : // Iterate over the memory pools
40369 0 : for (unsigned int i=0; i < SgOmpNumTeamsClause::pools.size(); i++)
40370 : {
40371 : // objectArray[i] is a single memory pool
40372 0 : for (unsigned j=0; j < SgOmpNumTeamsClause::pool_size; j++)
40373 : {
40374 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
40375 : {
40376 : // printf ("Found a valid SgOmpNumTeamsClause object in the memory pool %d at position %d \n",i,j);
40377 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
40378 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
40379 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
40380 : }
40381 : else
40382 : {
40383 : // printf ("Found a INVALID SgOmpNumTeamsClause object in the memory pool \n");
40384 : }
40385 : }
40386 : }
40387 : }
40388 :
40389 : // This should not be required since all previously static data members are
40390 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
40391 :
40392 194 : }
40393 :
40394 : void
40395 0 : SgOmpNumTeamsClause::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
40396 : {
40397 : // This function visits only a single IR node of the memory pool.
40398 : // it is typically called once for each type of IR node within
40399 : // the automatically generated function: traverseRepresentativeNodes().
40400 :
40401 : // Initialize array to the address of the first element of the STL vector
40402 : // (which is guarenteed to be contiguous storage).
40403 : // SgOmpNumTeamsClause objectArray [] = *(Memory_Block_List.begin());
40404 0 : if (SgOmpNumTeamsClause::pools.empty() == false)
40405 : {
40406 : // Generate an array of memory pools
40407 0 : SgOmpNumTeamsClause** objectArray = (SgOmpNumTeamsClause**) &(SgOmpNumTeamsClause::pools[0]);
40408 :
40409 : // Build a local variable for better performance
40410 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
40411 :
40412 : // Iterate over the memory pools
40413 0 : bool done = false;
40414 0 : unsigned i=0;
40415 :
40416 : // find the first valid IR node, call visit function, and then leave
40417 0 : while ( done == false && i < SgOmpNumTeamsClause::pools.size() )
40418 : {
40419 : // objectArray[i] is a single memory pool
40420 : unsigned j=0;
40421 0 : while (done == false && j < SgOmpNumTeamsClause::pool_size)
40422 : {
40423 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
40424 : {
40425 0 : traversal.visit(&(objectArray[i][j]));
40426 0 : done = true;
40427 : }
40428 0 : j++;
40429 : }
40430 0 : i++;
40431 : }
40432 :
40433 : #if 0
40434 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
40435 : if (done == false)
40436 : {
40437 : printf ("No representative for SgOmpNumTeamsClause found in memory pools \n");
40438 : }
40439 : #endif
40440 : }
40441 0 : }
40442 :
40443 :
40444 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
40445 : // using values that overflow signed values of int.
40446 : size_t
40447 4 : SgOmpNumTeamsClause::numberOfNodes()
40448 : {
40449 : // This function traverses the memory pool for an IR node and
40450 : // counts the number of IR nodes of a particular Sage III IR
40451 : // nodes type.
40452 :
40453 4 : size_t count = 0;
40454 4 : if (SgOmpNumTeamsClause::pools.empty() == false)
40455 : {
40456 : // Generate an array of memory pools (this is actually a STL vector,
40457 : // but it is contiguious, so OK to treat this way).
40458 0 : SgOmpNumTeamsClause** objectArray = (SgOmpNumTeamsClause**) &(SgOmpNumTeamsClause::pools[0]);
40459 :
40460 : // Build a local variable for better performance (make it a loop invariant variable).
40461 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
40462 :
40463 : // Iterate over all of the memory pools for this IR node.
40464 0 : for (unsigned int i=0; i < SgOmpNumTeamsClause::pools.size(); i++)
40465 : {
40466 : // objectArray[i] is a single memory pool, iterate over all the
40467 : // IR nodes and only count those that are valid IR nodes used in
40468 : // the AST (i.e. allocated IR nodes).
40469 0 : for (unsigned j=0; j < SgOmpNumTeamsClause::pool_size; j++)
40470 : {
40471 : // This is indexing the STL vector of C/C++ style arrays as a doubly
40472 : // indexed array access. It is OK since we have leveraged the semantics
40473 : // of STL vector memory as contigous and cast the memory as an array
40474 : // of arrays to use the 2D array indexing. Hope this is not confusing,
40475 : // but it s very fast as an implementation.
40476 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
40477 : {
40478 0 : count++;
40479 : }
40480 : }
40481 : }
40482 : }
40483 :
40484 :
40485 :
40486 4 : return count;
40487 : }
40488 :
40489 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
40490 : // using values that overflow signed values of int.
40491 : size_t
40492 0 : SgOmpNumTeamsClause::memoryUsage()
40493 : {
40494 : // This function is required because we need the class name as a type when we call sizeof
40495 : // There might be another way to implement this if we have a traversal that only called a
40496 : // representative object (one call for each type of Sage IIIIR node).
40497 0 : size_t memory = numberOfNodes() * sizeof(SgOmpNumTeamsClause);
40498 :
40499 0 : return memory;
40500 : }
40501 :
40502 : /* #line 40503 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
40503 :
40504 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
40505 : void
40506 5342 : SgOmpThreadLimitClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
40507 : {
40508 : // This function traverses the memory pool for only a specific IR node
40509 : // and calls the visit function of the input class execute a traversal
40510 : // similar to the style of the attribute based traversals within ROSE.
40511 : // This traversal will visit ALL nodes of the AST where as the other
40512 : // attribute based traversals visit only the embedded tree within the AST.
40513 :
40514 : // Initialize array to the address of the first element of the STL vector
40515 : // (which is guaranteed to be contiguous storage).
40516 : // SgOmpThreadLimitClause objectArray [] = *(Memory_Block_List.begin());
40517 5342 : if (SgOmpThreadLimitClause::pools.empty() == false)
40518 : {
40519 : // Generate an array of memory pools
40520 14 : SgOmpThreadLimitClause** objectArray = (SgOmpThreadLimitClause**) &(SgOmpThreadLimitClause::pools[0]);
40521 :
40522 : // Build a local variable for better performance
40523 14 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
40524 : #if 0
40525 : // Iterate over the memory pools
40526 : for (unsigned int i=0; i < SgOmpThreadLimitClause::pools.size(); i++)
40527 : {
40528 : // objectArray[i] is a single memory pool
40529 : for (int j=0; j < SgOmpThreadLimitClause::pool_size; j++)
40530 : {
40531 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
40532 : {
40533 : traversal.visit(&(objectArray[i][j]));
40534 : }
40535 : }
40536 : }
40537 : #else
40538 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
40539 : // compute the list first and then call the visit function on each list element.
40540 :
40541 : // printf ("Inside of SgOmpThreadLimitClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
40542 :
40543 28 : std::vector<SgOmpThreadLimitClause*> nodeList;
40544 :
40545 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
40546 28 : for (unsigned int i=0; i < SgOmpThreadLimitClause::pools.size(); i++)
40547 : {
40548 : // objectArray[i] is a single memory pool
40549 28014 : for (unsigned j=0; j < SgOmpThreadLimitClause::pool_size; j++)
40550 : {
40551 28000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
40552 : {
40553 14 : nodeList.push_back(&(objectArray[i][j]));
40554 : }
40555 : }
40556 : }
40557 :
40558 : // Iterate over the saved list
40559 14 : size_t nodeListSize = nodeList.size();
40560 28 : for (size_t i=0; i < nodeListSize; i++)
40561 : {
40562 14 : ROSE_ASSERT(nodeList[i] != NULL);
40563 : #if 0
40564 : traversal.visit(nodeList[i]);
40565 : #else
40566 14 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
40567 : {
40568 14 : traversal.visit(nodeList[i]);
40569 : }
40570 : #endif
40571 : }
40572 : #endif
40573 : }
40574 :
40575 : // This should not be required since all previously static data members are
40576 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
40577 :
40578 5342 : }
40579 :
40580 :
40581 : void
40582 194 : SgOmpThreadLimitClause::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
40583 : {
40584 : // This function traverses the memory pool for an IR node and
40585 : // calls the function to execute the visitor object.
40586 :
40587 : // Initialize array to the address of the first element of the STL vector
40588 : // (which is guarenteed to be contiguous storage).
40589 : // SgOmpThreadLimitClause objectArray [] = *(Memory_Block_List.begin());
40590 194 : if (SgOmpThreadLimitClause::pools.empty() == false)
40591 : {
40592 : // Generate an array of memory pools
40593 0 : SgOmpThreadLimitClause** objectArray = (SgOmpThreadLimitClause**) &(SgOmpThreadLimitClause::pools[0]);
40594 :
40595 : // Build a local variable for better performance
40596 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
40597 :
40598 : // Iterate over the memory pools
40599 0 : for (unsigned int i=0; i < SgOmpThreadLimitClause::pools.size(); i++)
40600 : {
40601 : // objectArray[i] is a single memory pool
40602 0 : for (unsigned j=0; j < SgOmpThreadLimitClause::pool_size; j++)
40603 : {
40604 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
40605 : {
40606 : // printf ("Found a valid SgOmpThreadLimitClause object in the memory pool %d at position %d \n",i,j);
40607 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
40608 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
40609 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
40610 : }
40611 : else
40612 : {
40613 : // printf ("Found a INVALID SgOmpThreadLimitClause object in the memory pool \n");
40614 : }
40615 : }
40616 : }
40617 : }
40618 :
40619 : // This should not be required since all previously static data members are
40620 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
40621 :
40622 194 : }
40623 :
40624 : void
40625 0 : SgOmpThreadLimitClause::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
40626 : {
40627 : // This function visits only a single IR node of the memory pool.
40628 : // it is typically called once for each type of IR node within
40629 : // the automatically generated function: traverseRepresentativeNodes().
40630 :
40631 : // Initialize array to the address of the first element of the STL vector
40632 : // (which is guarenteed to be contiguous storage).
40633 : // SgOmpThreadLimitClause objectArray [] = *(Memory_Block_List.begin());
40634 0 : if (SgOmpThreadLimitClause::pools.empty() == false)
40635 : {
40636 : // Generate an array of memory pools
40637 0 : SgOmpThreadLimitClause** objectArray = (SgOmpThreadLimitClause**) &(SgOmpThreadLimitClause::pools[0]);
40638 :
40639 : // Build a local variable for better performance
40640 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
40641 :
40642 : // Iterate over the memory pools
40643 0 : bool done = false;
40644 0 : unsigned i=0;
40645 :
40646 : // find the first valid IR node, call visit function, and then leave
40647 0 : while ( done == false && i < SgOmpThreadLimitClause::pools.size() )
40648 : {
40649 : // objectArray[i] is a single memory pool
40650 : unsigned j=0;
40651 0 : while (done == false && j < SgOmpThreadLimitClause::pool_size)
40652 : {
40653 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
40654 : {
40655 0 : traversal.visit(&(objectArray[i][j]));
40656 0 : done = true;
40657 : }
40658 0 : j++;
40659 : }
40660 0 : i++;
40661 : }
40662 :
40663 : #if 0
40664 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
40665 : if (done == false)
40666 : {
40667 : printf ("No representative for SgOmpThreadLimitClause found in memory pools \n");
40668 : }
40669 : #endif
40670 : }
40671 0 : }
40672 :
40673 :
40674 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
40675 : // using values that overflow signed values of int.
40676 : size_t
40677 4 : SgOmpThreadLimitClause::numberOfNodes()
40678 : {
40679 : // This function traverses the memory pool for an IR node and
40680 : // counts the number of IR nodes of a particular Sage III IR
40681 : // nodes type.
40682 :
40683 4 : size_t count = 0;
40684 4 : if (SgOmpThreadLimitClause::pools.empty() == false)
40685 : {
40686 : // Generate an array of memory pools (this is actually a STL vector,
40687 : // but it is contiguious, so OK to treat this way).
40688 0 : SgOmpThreadLimitClause** objectArray = (SgOmpThreadLimitClause**) &(SgOmpThreadLimitClause::pools[0]);
40689 :
40690 : // Build a local variable for better performance (make it a loop invariant variable).
40691 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
40692 :
40693 : // Iterate over all of the memory pools for this IR node.
40694 0 : for (unsigned int i=0; i < SgOmpThreadLimitClause::pools.size(); i++)
40695 : {
40696 : // objectArray[i] is a single memory pool, iterate over all the
40697 : // IR nodes and only count those that are valid IR nodes used in
40698 : // the AST (i.e. allocated IR nodes).
40699 0 : for (unsigned j=0; j < SgOmpThreadLimitClause::pool_size; j++)
40700 : {
40701 : // This is indexing the STL vector of C/C++ style arrays as a doubly
40702 : // indexed array access. It is OK since we have leveraged the semantics
40703 : // of STL vector memory as contigous and cast the memory as an array
40704 : // of arrays to use the 2D array indexing. Hope this is not confusing,
40705 : // but it s very fast as an implementation.
40706 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
40707 : {
40708 0 : count++;
40709 : }
40710 : }
40711 : }
40712 : }
40713 :
40714 :
40715 :
40716 4 : return count;
40717 : }
40718 :
40719 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
40720 : // using values that overflow signed values of int.
40721 : size_t
40722 0 : SgOmpThreadLimitClause::memoryUsage()
40723 : {
40724 : // This function is required because we need the class name as a type when we call sizeof
40725 : // There might be another way to implement this if we have a traversal that only called a
40726 : // representative object (one call for each type of Sage IIIIR node).
40727 0 : size_t memory = numberOfNodes() * sizeof(SgOmpThreadLimitClause);
40728 :
40729 0 : return memory;
40730 : }
40731 :
40732 : /* #line 40733 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
40733 :
40734 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
40735 : void
40736 5342 : SgOmpDeviceClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
40737 : {
40738 : // This function traverses the memory pool for only a specific IR node
40739 : // and calls the visit function of the input class execute a traversal
40740 : // similar to the style of the attribute based traversals within ROSE.
40741 : // This traversal will visit ALL nodes of the AST where as the other
40742 : // attribute based traversals visit only the embedded tree within the AST.
40743 :
40744 : // Initialize array to the address of the first element of the STL vector
40745 : // (which is guaranteed to be contiguous storage).
40746 : // SgOmpDeviceClause objectArray [] = *(Memory_Block_List.begin());
40747 5342 : if (SgOmpDeviceClause::pools.empty() == false)
40748 : {
40749 : // Generate an array of memory pools
40750 49 : SgOmpDeviceClause** objectArray = (SgOmpDeviceClause**) &(SgOmpDeviceClause::pools[0]);
40751 :
40752 : // Build a local variable for better performance
40753 49 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
40754 : #if 0
40755 : // Iterate over the memory pools
40756 : for (unsigned int i=0; i < SgOmpDeviceClause::pools.size(); i++)
40757 : {
40758 : // objectArray[i] is a single memory pool
40759 : for (int j=0; j < SgOmpDeviceClause::pool_size; j++)
40760 : {
40761 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
40762 : {
40763 : traversal.visit(&(objectArray[i][j]));
40764 : }
40765 : }
40766 : }
40767 : #else
40768 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
40769 : // compute the list first and then call the visit function on each list element.
40770 :
40771 : // printf ("Inside of SgOmpDeviceClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
40772 :
40773 98 : std::vector<SgOmpDeviceClause*> nodeList;
40774 :
40775 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
40776 98 : for (unsigned int i=0; i < SgOmpDeviceClause::pools.size(); i++)
40777 : {
40778 : // objectArray[i] is a single memory pool
40779 98049 : for (unsigned j=0; j < SgOmpDeviceClause::pool_size; j++)
40780 : {
40781 98000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
40782 : {
40783 63 : nodeList.push_back(&(objectArray[i][j]));
40784 : }
40785 : }
40786 : }
40787 :
40788 : // Iterate over the saved list
40789 49 : size_t nodeListSize = nodeList.size();
40790 112 : for (size_t i=0; i < nodeListSize; i++)
40791 : {
40792 63 : ROSE_ASSERT(nodeList[i] != NULL);
40793 : #if 0
40794 : traversal.visit(nodeList[i]);
40795 : #else
40796 63 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
40797 : {
40798 63 : traversal.visit(nodeList[i]);
40799 : }
40800 : #endif
40801 : }
40802 : #endif
40803 : }
40804 :
40805 : // This should not be required since all previously static data members are
40806 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
40807 :
40808 5342 : }
40809 :
40810 :
40811 : void
40812 194 : SgOmpDeviceClause::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
40813 : {
40814 : // This function traverses the memory pool for an IR node and
40815 : // calls the function to execute the visitor object.
40816 :
40817 : // Initialize array to the address of the first element of the STL vector
40818 : // (which is guarenteed to be contiguous storage).
40819 : // SgOmpDeviceClause objectArray [] = *(Memory_Block_List.begin());
40820 194 : if (SgOmpDeviceClause::pools.empty() == false)
40821 : {
40822 : // Generate an array of memory pools
40823 0 : SgOmpDeviceClause** objectArray = (SgOmpDeviceClause**) &(SgOmpDeviceClause::pools[0]);
40824 :
40825 : // Build a local variable for better performance
40826 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
40827 :
40828 : // Iterate over the memory pools
40829 0 : for (unsigned int i=0; i < SgOmpDeviceClause::pools.size(); i++)
40830 : {
40831 : // objectArray[i] is a single memory pool
40832 0 : for (unsigned j=0; j < SgOmpDeviceClause::pool_size; j++)
40833 : {
40834 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
40835 : {
40836 : // printf ("Found a valid SgOmpDeviceClause object in the memory pool %d at position %d \n",i,j);
40837 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
40838 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
40839 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
40840 : }
40841 : else
40842 : {
40843 : // printf ("Found a INVALID SgOmpDeviceClause object in the memory pool \n");
40844 : }
40845 : }
40846 : }
40847 : }
40848 :
40849 : // This should not be required since all previously static data members are
40850 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
40851 :
40852 194 : }
40853 :
40854 : void
40855 0 : SgOmpDeviceClause::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
40856 : {
40857 : // This function visits only a single IR node of the memory pool.
40858 : // it is typically called once for each type of IR node within
40859 : // the automatically generated function: traverseRepresentativeNodes().
40860 :
40861 : // Initialize array to the address of the first element of the STL vector
40862 : // (which is guarenteed to be contiguous storage).
40863 : // SgOmpDeviceClause objectArray [] = *(Memory_Block_List.begin());
40864 0 : if (SgOmpDeviceClause::pools.empty() == false)
40865 : {
40866 : // Generate an array of memory pools
40867 0 : SgOmpDeviceClause** objectArray = (SgOmpDeviceClause**) &(SgOmpDeviceClause::pools[0]);
40868 :
40869 : // Build a local variable for better performance
40870 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
40871 :
40872 : // Iterate over the memory pools
40873 0 : bool done = false;
40874 0 : unsigned i=0;
40875 :
40876 : // find the first valid IR node, call visit function, and then leave
40877 0 : while ( done == false && i < SgOmpDeviceClause::pools.size() )
40878 : {
40879 : // objectArray[i] is a single memory pool
40880 : unsigned j=0;
40881 0 : while (done == false && j < SgOmpDeviceClause::pool_size)
40882 : {
40883 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
40884 : {
40885 0 : traversal.visit(&(objectArray[i][j]));
40886 0 : done = true;
40887 : }
40888 0 : j++;
40889 : }
40890 0 : i++;
40891 : }
40892 :
40893 : #if 0
40894 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
40895 : if (done == false)
40896 : {
40897 : printf ("No representative for SgOmpDeviceClause found in memory pools \n");
40898 : }
40899 : #endif
40900 : }
40901 0 : }
40902 :
40903 :
40904 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
40905 : // using values that overflow signed values of int.
40906 : size_t
40907 4 : SgOmpDeviceClause::numberOfNodes()
40908 : {
40909 : // This function traverses the memory pool for an IR node and
40910 : // counts the number of IR nodes of a particular Sage III IR
40911 : // nodes type.
40912 :
40913 4 : size_t count = 0;
40914 4 : if (SgOmpDeviceClause::pools.empty() == false)
40915 : {
40916 : // Generate an array of memory pools (this is actually a STL vector,
40917 : // but it is contiguious, so OK to treat this way).
40918 0 : SgOmpDeviceClause** objectArray = (SgOmpDeviceClause**) &(SgOmpDeviceClause::pools[0]);
40919 :
40920 : // Build a local variable for better performance (make it a loop invariant variable).
40921 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
40922 :
40923 : // Iterate over all of the memory pools for this IR node.
40924 0 : for (unsigned int i=0; i < SgOmpDeviceClause::pools.size(); i++)
40925 : {
40926 : // objectArray[i] is a single memory pool, iterate over all the
40927 : // IR nodes and only count those that are valid IR nodes used in
40928 : // the AST (i.e. allocated IR nodes).
40929 0 : for (unsigned j=0; j < SgOmpDeviceClause::pool_size; j++)
40930 : {
40931 : // This is indexing the STL vector of C/C++ style arrays as a doubly
40932 : // indexed array access. It is OK since we have leveraged the semantics
40933 : // of STL vector memory as contigous and cast the memory as an array
40934 : // of arrays to use the 2D array indexing. Hope this is not confusing,
40935 : // but it s very fast as an implementation.
40936 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
40937 : {
40938 0 : count++;
40939 : }
40940 : }
40941 : }
40942 : }
40943 :
40944 :
40945 :
40946 4 : return count;
40947 : }
40948 :
40949 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
40950 : // using values that overflow signed values of int.
40951 : size_t
40952 0 : SgOmpDeviceClause::memoryUsage()
40953 : {
40954 : // This function is required because we need the class name as a type when we call sizeof
40955 : // There might be another way to implement this if we have a traversal that only called a
40956 : // representative object (one call for each type of Sage IIIIR node).
40957 0 : size_t memory = numberOfNodes() * sizeof(SgOmpDeviceClause);
40958 :
40959 0 : return memory;
40960 : }
40961 :
40962 : /* #line 40963 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
40963 :
40964 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
40965 : void
40966 5342 : SgOmpHintClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
40967 : {
40968 : // This function traverses the memory pool for only a specific IR node
40969 : // and calls the visit function of the input class execute a traversal
40970 : // similar to the style of the attribute based traversals within ROSE.
40971 : // This traversal will visit ALL nodes of the AST where as the other
40972 : // attribute based traversals visit only the embedded tree within the AST.
40973 :
40974 : // Initialize array to the address of the first element of the STL vector
40975 : // (which is guaranteed to be contiguous storage).
40976 : // SgOmpHintClause objectArray [] = *(Memory_Block_List.begin());
40977 5342 : if (SgOmpHintClause::pools.empty() == false)
40978 : {
40979 : // Generate an array of memory pools
40980 14 : SgOmpHintClause** objectArray = (SgOmpHintClause**) &(SgOmpHintClause::pools[0]);
40981 :
40982 : // Build a local variable for better performance
40983 14 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
40984 : #if 0
40985 : // Iterate over the memory pools
40986 : for (unsigned int i=0; i < SgOmpHintClause::pools.size(); i++)
40987 : {
40988 : // objectArray[i] is a single memory pool
40989 : for (int j=0; j < SgOmpHintClause::pool_size; j++)
40990 : {
40991 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
40992 : {
40993 : traversal.visit(&(objectArray[i][j]));
40994 : }
40995 : }
40996 : }
40997 : #else
40998 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
40999 : // compute the list first and then call the visit function on each list element.
41000 :
41001 : // printf ("Inside of SgOmpHintClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
41002 :
41003 28 : std::vector<SgOmpHintClause*> nodeList;
41004 :
41005 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
41006 28 : for (unsigned int i=0; i < SgOmpHintClause::pools.size(); i++)
41007 : {
41008 : // objectArray[i] is a single memory pool
41009 28014 : for (unsigned j=0; j < SgOmpHintClause::pool_size; j++)
41010 : {
41011 28000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
41012 : {
41013 21 : nodeList.push_back(&(objectArray[i][j]));
41014 : }
41015 : }
41016 : }
41017 :
41018 : // Iterate over the saved list
41019 14 : size_t nodeListSize = nodeList.size();
41020 35 : for (size_t i=0; i < nodeListSize; i++)
41021 : {
41022 21 : ROSE_ASSERT(nodeList[i] != NULL);
41023 : #if 0
41024 : traversal.visit(nodeList[i]);
41025 : #else
41026 21 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
41027 : {
41028 21 : traversal.visit(nodeList[i]);
41029 : }
41030 : #endif
41031 : }
41032 : #endif
41033 : }
41034 :
41035 : // This should not be required since all previously static data members are
41036 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
41037 :
41038 5342 : }
41039 :
41040 :
41041 : void
41042 194 : SgOmpHintClause::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
41043 : {
41044 : // This function traverses the memory pool for an IR node and
41045 : // calls the function to execute the visitor object.
41046 :
41047 : // Initialize array to the address of the first element of the STL vector
41048 : // (which is guarenteed to be contiguous storage).
41049 : // SgOmpHintClause objectArray [] = *(Memory_Block_List.begin());
41050 194 : if (SgOmpHintClause::pools.empty() == false)
41051 : {
41052 : // Generate an array of memory pools
41053 0 : SgOmpHintClause** objectArray = (SgOmpHintClause**) &(SgOmpHintClause::pools[0]);
41054 :
41055 : // Build a local variable for better performance
41056 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
41057 :
41058 : // Iterate over the memory pools
41059 0 : for (unsigned int i=0; i < SgOmpHintClause::pools.size(); i++)
41060 : {
41061 : // objectArray[i] is a single memory pool
41062 0 : for (unsigned j=0; j < SgOmpHintClause::pool_size; j++)
41063 : {
41064 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
41065 : {
41066 : // printf ("Found a valid SgOmpHintClause object in the memory pool %d at position %d \n",i,j);
41067 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
41068 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
41069 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
41070 : }
41071 : else
41072 : {
41073 : // printf ("Found a INVALID SgOmpHintClause object in the memory pool \n");
41074 : }
41075 : }
41076 : }
41077 : }
41078 :
41079 : // This should not be required since all previously static data members are
41080 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
41081 :
41082 194 : }
41083 :
41084 : void
41085 0 : SgOmpHintClause::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
41086 : {
41087 : // This function visits only a single IR node of the memory pool.
41088 : // it is typically called once for each type of IR node within
41089 : // the automatically generated function: traverseRepresentativeNodes().
41090 :
41091 : // Initialize array to the address of the first element of the STL vector
41092 : // (which is guarenteed to be contiguous storage).
41093 : // SgOmpHintClause objectArray [] = *(Memory_Block_List.begin());
41094 0 : if (SgOmpHintClause::pools.empty() == false)
41095 : {
41096 : // Generate an array of memory pools
41097 0 : SgOmpHintClause** objectArray = (SgOmpHintClause**) &(SgOmpHintClause::pools[0]);
41098 :
41099 : // Build a local variable for better performance
41100 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
41101 :
41102 : // Iterate over the memory pools
41103 0 : bool done = false;
41104 0 : unsigned i=0;
41105 :
41106 : // find the first valid IR node, call visit function, and then leave
41107 0 : while ( done == false && i < SgOmpHintClause::pools.size() )
41108 : {
41109 : // objectArray[i] is a single memory pool
41110 : unsigned j=0;
41111 0 : while (done == false && j < SgOmpHintClause::pool_size)
41112 : {
41113 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
41114 : {
41115 0 : traversal.visit(&(objectArray[i][j]));
41116 0 : done = true;
41117 : }
41118 0 : j++;
41119 : }
41120 0 : i++;
41121 : }
41122 :
41123 : #if 0
41124 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
41125 : if (done == false)
41126 : {
41127 : printf ("No representative for SgOmpHintClause found in memory pools \n");
41128 : }
41129 : #endif
41130 : }
41131 0 : }
41132 :
41133 :
41134 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
41135 : // using values that overflow signed values of int.
41136 : size_t
41137 4 : SgOmpHintClause::numberOfNodes()
41138 : {
41139 : // This function traverses the memory pool for an IR node and
41140 : // counts the number of IR nodes of a particular Sage III IR
41141 : // nodes type.
41142 :
41143 4 : size_t count = 0;
41144 4 : if (SgOmpHintClause::pools.empty() == false)
41145 : {
41146 : // Generate an array of memory pools (this is actually a STL vector,
41147 : // but it is contiguious, so OK to treat this way).
41148 0 : SgOmpHintClause** objectArray = (SgOmpHintClause**) &(SgOmpHintClause::pools[0]);
41149 :
41150 : // Build a local variable for better performance (make it a loop invariant variable).
41151 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
41152 :
41153 : // Iterate over all of the memory pools for this IR node.
41154 0 : for (unsigned int i=0; i < SgOmpHintClause::pools.size(); i++)
41155 : {
41156 : // objectArray[i] is a single memory pool, iterate over all the
41157 : // IR nodes and only count those that are valid IR nodes used in
41158 : // the AST (i.e. allocated IR nodes).
41159 0 : for (unsigned j=0; j < SgOmpHintClause::pool_size; j++)
41160 : {
41161 : // This is indexing the STL vector of C/C++ style arrays as a doubly
41162 : // indexed array access. It is OK since we have leveraged the semantics
41163 : // of STL vector memory as contigous and cast the memory as an array
41164 : // of arrays to use the 2D array indexing. Hope this is not confusing,
41165 : // but it s very fast as an implementation.
41166 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
41167 : {
41168 0 : count++;
41169 : }
41170 : }
41171 : }
41172 : }
41173 :
41174 :
41175 :
41176 4 : return count;
41177 : }
41178 :
41179 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
41180 : // using values that overflow signed values of int.
41181 : size_t
41182 0 : SgOmpHintClause::memoryUsage()
41183 : {
41184 : // This function is required because we need the class name as a type when we call sizeof
41185 : // There might be another way to implement this if we have a traversal that only called a
41186 : // representative object (one call for each type of Sage IIIIR node).
41187 0 : size_t memory = numberOfNodes() * sizeof(SgOmpHintClause);
41188 :
41189 0 : return memory;
41190 : }
41191 :
41192 : /* #line 41193 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
41193 :
41194 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
41195 : void
41196 5342 : SgOmpGrainsizeClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
41197 : {
41198 : // This function traverses the memory pool for only a specific IR node
41199 : // and calls the visit function of the input class execute a traversal
41200 : // similar to the style of the attribute based traversals within ROSE.
41201 : // This traversal will visit ALL nodes of the AST where as the other
41202 : // attribute based traversals visit only the embedded tree within the AST.
41203 :
41204 : // Initialize array to the address of the first element of the STL vector
41205 : // (which is guaranteed to be contiguous storage).
41206 : // SgOmpGrainsizeClause objectArray [] = *(Memory_Block_List.begin());
41207 5342 : if (SgOmpGrainsizeClause::pools.empty() == false)
41208 : {
41209 : // Generate an array of memory pools
41210 0 : SgOmpGrainsizeClause** objectArray = (SgOmpGrainsizeClause**) &(SgOmpGrainsizeClause::pools[0]);
41211 :
41212 : // Build a local variable for better performance
41213 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
41214 : #if 0
41215 : // Iterate over the memory pools
41216 : for (unsigned int i=0; i < SgOmpGrainsizeClause::pools.size(); i++)
41217 : {
41218 : // objectArray[i] is a single memory pool
41219 : for (int j=0; j < SgOmpGrainsizeClause::pool_size; j++)
41220 : {
41221 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
41222 : {
41223 : traversal.visit(&(objectArray[i][j]));
41224 : }
41225 : }
41226 : }
41227 : #else
41228 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
41229 : // compute the list first and then call the visit function on each list element.
41230 :
41231 : // printf ("Inside of SgOmpGrainsizeClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
41232 :
41233 0 : std::vector<SgOmpGrainsizeClause*> nodeList;
41234 :
41235 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
41236 0 : for (unsigned int i=0; i < SgOmpGrainsizeClause::pools.size(); i++)
41237 : {
41238 : // objectArray[i] is a single memory pool
41239 0 : for (unsigned j=0; j < SgOmpGrainsizeClause::pool_size; j++)
41240 : {
41241 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
41242 : {
41243 0 : nodeList.push_back(&(objectArray[i][j]));
41244 : }
41245 : }
41246 : }
41247 :
41248 : // Iterate over the saved list
41249 0 : size_t nodeListSize = nodeList.size();
41250 0 : for (size_t i=0; i < nodeListSize; i++)
41251 : {
41252 0 : ROSE_ASSERT(nodeList[i] != NULL);
41253 : #if 0
41254 : traversal.visit(nodeList[i]);
41255 : #else
41256 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
41257 : {
41258 0 : traversal.visit(nodeList[i]);
41259 : }
41260 : #endif
41261 : }
41262 : #endif
41263 : }
41264 :
41265 : // This should not be required since all previously static data members are
41266 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
41267 :
41268 5342 : }
41269 :
41270 :
41271 : void
41272 194 : SgOmpGrainsizeClause::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
41273 : {
41274 : // This function traverses the memory pool for an IR node and
41275 : // calls the function to execute the visitor object.
41276 :
41277 : // Initialize array to the address of the first element of the STL vector
41278 : // (which is guarenteed to be contiguous storage).
41279 : // SgOmpGrainsizeClause objectArray [] = *(Memory_Block_List.begin());
41280 194 : if (SgOmpGrainsizeClause::pools.empty() == false)
41281 : {
41282 : // Generate an array of memory pools
41283 0 : SgOmpGrainsizeClause** objectArray = (SgOmpGrainsizeClause**) &(SgOmpGrainsizeClause::pools[0]);
41284 :
41285 : // Build a local variable for better performance
41286 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
41287 :
41288 : // Iterate over the memory pools
41289 0 : for (unsigned int i=0; i < SgOmpGrainsizeClause::pools.size(); i++)
41290 : {
41291 : // objectArray[i] is a single memory pool
41292 0 : for (unsigned j=0; j < SgOmpGrainsizeClause::pool_size; j++)
41293 : {
41294 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
41295 : {
41296 : // printf ("Found a valid SgOmpGrainsizeClause object in the memory pool %d at position %d \n",i,j);
41297 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
41298 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
41299 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
41300 : }
41301 : else
41302 : {
41303 : // printf ("Found a INVALID SgOmpGrainsizeClause object in the memory pool \n");
41304 : }
41305 : }
41306 : }
41307 : }
41308 :
41309 : // This should not be required since all previously static data members are
41310 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
41311 :
41312 194 : }
41313 :
41314 : void
41315 0 : SgOmpGrainsizeClause::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
41316 : {
41317 : // This function visits only a single IR node of the memory pool.
41318 : // it is typically called once for each type of IR node within
41319 : // the automatically generated function: traverseRepresentativeNodes().
41320 :
41321 : // Initialize array to the address of the first element of the STL vector
41322 : // (which is guarenteed to be contiguous storage).
41323 : // SgOmpGrainsizeClause objectArray [] = *(Memory_Block_List.begin());
41324 0 : if (SgOmpGrainsizeClause::pools.empty() == false)
41325 : {
41326 : // Generate an array of memory pools
41327 0 : SgOmpGrainsizeClause** objectArray = (SgOmpGrainsizeClause**) &(SgOmpGrainsizeClause::pools[0]);
41328 :
41329 : // Build a local variable for better performance
41330 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
41331 :
41332 : // Iterate over the memory pools
41333 0 : bool done = false;
41334 0 : unsigned i=0;
41335 :
41336 : // find the first valid IR node, call visit function, and then leave
41337 0 : while ( done == false && i < SgOmpGrainsizeClause::pools.size() )
41338 : {
41339 : // objectArray[i] is a single memory pool
41340 : unsigned j=0;
41341 0 : while (done == false && j < SgOmpGrainsizeClause::pool_size)
41342 : {
41343 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
41344 : {
41345 0 : traversal.visit(&(objectArray[i][j]));
41346 0 : done = true;
41347 : }
41348 0 : j++;
41349 : }
41350 0 : i++;
41351 : }
41352 :
41353 : #if 0
41354 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
41355 : if (done == false)
41356 : {
41357 : printf ("No representative for SgOmpGrainsizeClause found in memory pools \n");
41358 : }
41359 : #endif
41360 : }
41361 0 : }
41362 :
41363 :
41364 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
41365 : // using values that overflow signed values of int.
41366 : size_t
41367 4 : SgOmpGrainsizeClause::numberOfNodes()
41368 : {
41369 : // This function traverses the memory pool for an IR node and
41370 : // counts the number of IR nodes of a particular Sage III IR
41371 : // nodes type.
41372 :
41373 4 : size_t count = 0;
41374 4 : if (SgOmpGrainsizeClause::pools.empty() == false)
41375 : {
41376 : // Generate an array of memory pools (this is actually a STL vector,
41377 : // but it is contiguious, so OK to treat this way).
41378 0 : SgOmpGrainsizeClause** objectArray = (SgOmpGrainsizeClause**) &(SgOmpGrainsizeClause::pools[0]);
41379 :
41380 : // Build a local variable for better performance (make it a loop invariant variable).
41381 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
41382 :
41383 : // Iterate over all of the memory pools for this IR node.
41384 0 : for (unsigned int i=0; i < SgOmpGrainsizeClause::pools.size(); i++)
41385 : {
41386 : // objectArray[i] is a single memory pool, iterate over all the
41387 : // IR nodes and only count those that are valid IR nodes used in
41388 : // the AST (i.e. allocated IR nodes).
41389 0 : for (unsigned j=0; j < SgOmpGrainsizeClause::pool_size; j++)
41390 : {
41391 : // This is indexing the STL vector of C/C++ style arrays as a doubly
41392 : // indexed array access. It is OK since we have leveraged the semantics
41393 : // of STL vector memory as contigous and cast the memory as an array
41394 : // of arrays to use the 2D array indexing. Hope this is not confusing,
41395 : // but it s very fast as an implementation.
41396 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
41397 : {
41398 0 : count++;
41399 : }
41400 : }
41401 : }
41402 : }
41403 :
41404 :
41405 :
41406 4 : return count;
41407 : }
41408 :
41409 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
41410 : // using values that overflow signed values of int.
41411 : size_t
41412 0 : SgOmpGrainsizeClause::memoryUsage()
41413 : {
41414 : // This function is required because we need the class name as a type when we call sizeof
41415 : // There might be another way to implement this if we have a traversal that only called a
41416 : // representative object (one call for each type of Sage IIIIR node).
41417 0 : size_t memory = numberOfNodes() * sizeof(SgOmpGrainsizeClause);
41418 :
41419 0 : return memory;
41420 : }
41421 :
41422 : /* #line 41423 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
41423 :
41424 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
41425 : void
41426 5342 : SgOmpNumTasksClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
41427 : {
41428 : // This function traverses the memory pool for only a specific IR node
41429 : // and calls the visit function of the input class execute a traversal
41430 : // similar to the style of the attribute based traversals within ROSE.
41431 : // This traversal will visit ALL nodes of the AST where as the other
41432 : // attribute based traversals visit only the embedded tree within the AST.
41433 :
41434 : // Initialize array to the address of the first element of the STL vector
41435 : // (which is guaranteed to be contiguous storage).
41436 : // SgOmpNumTasksClause objectArray [] = *(Memory_Block_List.begin());
41437 5342 : if (SgOmpNumTasksClause::pools.empty() == false)
41438 : {
41439 : // Generate an array of memory pools
41440 0 : SgOmpNumTasksClause** objectArray = (SgOmpNumTasksClause**) &(SgOmpNumTasksClause::pools[0]);
41441 :
41442 : // Build a local variable for better performance
41443 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
41444 : #if 0
41445 : // Iterate over the memory pools
41446 : for (unsigned int i=0; i < SgOmpNumTasksClause::pools.size(); i++)
41447 : {
41448 : // objectArray[i] is a single memory pool
41449 : for (int j=0; j < SgOmpNumTasksClause::pool_size; j++)
41450 : {
41451 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
41452 : {
41453 : traversal.visit(&(objectArray[i][j]));
41454 : }
41455 : }
41456 : }
41457 : #else
41458 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
41459 : // compute the list first and then call the visit function on each list element.
41460 :
41461 : // printf ("Inside of SgOmpNumTasksClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
41462 :
41463 0 : std::vector<SgOmpNumTasksClause*> nodeList;
41464 :
41465 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
41466 0 : for (unsigned int i=0; i < SgOmpNumTasksClause::pools.size(); i++)
41467 : {
41468 : // objectArray[i] is a single memory pool
41469 0 : for (unsigned j=0; j < SgOmpNumTasksClause::pool_size; j++)
41470 : {
41471 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
41472 : {
41473 0 : nodeList.push_back(&(objectArray[i][j]));
41474 : }
41475 : }
41476 : }
41477 :
41478 : // Iterate over the saved list
41479 0 : size_t nodeListSize = nodeList.size();
41480 0 : for (size_t i=0; i < nodeListSize; i++)
41481 : {
41482 0 : ROSE_ASSERT(nodeList[i] != NULL);
41483 : #if 0
41484 : traversal.visit(nodeList[i]);
41485 : #else
41486 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
41487 : {
41488 0 : traversal.visit(nodeList[i]);
41489 : }
41490 : #endif
41491 : }
41492 : #endif
41493 : }
41494 :
41495 : // This should not be required since all previously static data members are
41496 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
41497 :
41498 5342 : }
41499 :
41500 :
41501 : void
41502 194 : SgOmpNumTasksClause::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
41503 : {
41504 : // This function traverses the memory pool for an IR node and
41505 : // calls the function to execute the visitor object.
41506 :
41507 : // Initialize array to the address of the first element of the STL vector
41508 : // (which is guarenteed to be contiguous storage).
41509 : // SgOmpNumTasksClause objectArray [] = *(Memory_Block_List.begin());
41510 194 : if (SgOmpNumTasksClause::pools.empty() == false)
41511 : {
41512 : // Generate an array of memory pools
41513 0 : SgOmpNumTasksClause** objectArray = (SgOmpNumTasksClause**) &(SgOmpNumTasksClause::pools[0]);
41514 :
41515 : // Build a local variable for better performance
41516 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
41517 :
41518 : // Iterate over the memory pools
41519 0 : for (unsigned int i=0; i < SgOmpNumTasksClause::pools.size(); i++)
41520 : {
41521 : // objectArray[i] is a single memory pool
41522 0 : for (unsigned j=0; j < SgOmpNumTasksClause::pool_size; j++)
41523 : {
41524 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
41525 : {
41526 : // printf ("Found a valid SgOmpNumTasksClause object in the memory pool %d at position %d \n",i,j);
41527 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
41528 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
41529 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
41530 : }
41531 : else
41532 : {
41533 : // printf ("Found a INVALID SgOmpNumTasksClause object in the memory pool \n");
41534 : }
41535 : }
41536 : }
41537 : }
41538 :
41539 : // This should not be required since all previously static data members are
41540 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
41541 :
41542 194 : }
41543 :
41544 : void
41545 0 : SgOmpNumTasksClause::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
41546 : {
41547 : // This function visits only a single IR node of the memory pool.
41548 : // it is typically called once for each type of IR node within
41549 : // the automatically generated function: traverseRepresentativeNodes().
41550 :
41551 : // Initialize array to the address of the first element of the STL vector
41552 : // (which is guarenteed to be contiguous storage).
41553 : // SgOmpNumTasksClause objectArray [] = *(Memory_Block_List.begin());
41554 0 : if (SgOmpNumTasksClause::pools.empty() == false)
41555 : {
41556 : // Generate an array of memory pools
41557 0 : SgOmpNumTasksClause** objectArray = (SgOmpNumTasksClause**) &(SgOmpNumTasksClause::pools[0]);
41558 :
41559 : // Build a local variable for better performance
41560 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
41561 :
41562 : // Iterate over the memory pools
41563 0 : bool done = false;
41564 0 : unsigned i=0;
41565 :
41566 : // find the first valid IR node, call visit function, and then leave
41567 0 : while ( done == false && i < SgOmpNumTasksClause::pools.size() )
41568 : {
41569 : // objectArray[i] is a single memory pool
41570 : unsigned j=0;
41571 0 : while (done == false && j < SgOmpNumTasksClause::pool_size)
41572 : {
41573 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
41574 : {
41575 0 : traversal.visit(&(objectArray[i][j]));
41576 0 : done = true;
41577 : }
41578 0 : j++;
41579 : }
41580 0 : i++;
41581 : }
41582 :
41583 : #if 0
41584 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
41585 : if (done == false)
41586 : {
41587 : printf ("No representative for SgOmpNumTasksClause found in memory pools \n");
41588 : }
41589 : #endif
41590 : }
41591 0 : }
41592 :
41593 :
41594 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
41595 : // using values that overflow signed values of int.
41596 : size_t
41597 4 : SgOmpNumTasksClause::numberOfNodes()
41598 : {
41599 : // This function traverses the memory pool for an IR node and
41600 : // counts the number of IR nodes of a particular Sage III IR
41601 : // nodes type.
41602 :
41603 4 : size_t count = 0;
41604 4 : if (SgOmpNumTasksClause::pools.empty() == false)
41605 : {
41606 : // Generate an array of memory pools (this is actually a STL vector,
41607 : // but it is contiguious, so OK to treat this way).
41608 0 : SgOmpNumTasksClause** objectArray = (SgOmpNumTasksClause**) &(SgOmpNumTasksClause::pools[0]);
41609 :
41610 : // Build a local variable for better performance (make it a loop invariant variable).
41611 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
41612 :
41613 : // Iterate over all of the memory pools for this IR node.
41614 0 : for (unsigned int i=0; i < SgOmpNumTasksClause::pools.size(); i++)
41615 : {
41616 : // objectArray[i] is a single memory pool, iterate over all the
41617 : // IR nodes and only count those that are valid IR nodes used in
41618 : // the AST (i.e. allocated IR nodes).
41619 0 : for (unsigned j=0; j < SgOmpNumTasksClause::pool_size; j++)
41620 : {
41621 : // This is indexing the STL vector of C/C++ style arrays as a doubly
41622 : // indexed array access. It is OK since we have leveraged the semantics
41623 : // of STL vector memory as contigous and cast the memory as an array
41624 : // of arrays to use the 2D array indexing. Hope this is not confusing,
41625 : // but it s very fast as an implementation.
41626 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
41627 : {
41628 0 : count++;
41629 : }
41630 : }
41631 : }
41632 : }
41633 :
41634 :
41635 :
41636 4 : return count;
41637 : }
41638 :
41639 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
41640 : // using values that overflow signed values of int.
41641 : size_t
41642 0 : SgOmpNumTasksClause::memoryUsage()
41643 : {
41644 : // This function is required because we need the class name as a type when we call sizeof
41645 : // There might be another way to implement this if we have a traversal that only called a
41646 : // representative object (one call for each type of Sage IIIIR node).
41647 0 : size_t memory = numberOfNodes() * sizeof(SgOmpNumTasksClause);
41648 :
41649 0 : return memory;
41650 : }
41651 :
41652 : /* #line 41653 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
41653 :
41654 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
41655 : void
41656 5342 : SgOmpDetachClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
41657 : {
41658 : // This function traverses the memory pool for only a specific IR node
41659 : // and calls the visit function of the input class execute a traversal
41660 : // similar to the style of the attribute based traversals within ROSE.
41661 : // This traversal will visit ALL nodes of the AST where as the other
41662 : // attribute based traversals visit only the embedded tree within the AST.
41663 :
41664 : // Initialize array to the address of the first element of the STL vector
41665 : // (which is guaranteed to be contiguous storage).
41666 : // SgOmpDetachClause objectArray [] = *(Memory_Block_List.begin());
41667 5342 : if (SgOmpDetachClause::pools.empty() == false)
41668 : {
41669 : // Generate an array of memory pools
41670 0 : SgOmpDetachClause** objectArray = (SgOmpDetachClause**) &(SgOmpDetachClause::pools[0]);
41671 :
41672 : // Build a local variable for better performance
41673 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
41674 : #if 0
41675 : // Iterate over the memory pools
41676 : for (unsigned int i=0; i < SgOmpDetachClause::pools.size(); i++)
41677 : {
41678 : // objectArray[i] is a single memory pool
41679 : for (int j=0; j < SgOmpDetachClause::pool_size; j++)
41680 : {
41681 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
41682 : {
41683 : traversal.visit(&(objectArray[i][j]));
41684 : }
41685 : }
41686 : }
41687 : #else
41688 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
41689 : // compute the list first and then call the visit function on each list element.
41690 :
41691 : // printf ("Inside of SgOmpDetachClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
41692 :
41693 0 : std::vector<SgOmpDetachClause*> nodeList;
41694 :
41695 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
41696 0 : for (unsigned int i=0; i < SgOmpDetachClause::pools.size(); i++)
41697 : {
41698 : // objectArray[i] is a single memory pool
41699 0 : for (unsigned j=0; j < SgOmpDetachClause::pool_size; j++)
41700 : {
41701 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
41702 : {
41703 0 : nodeList.push_back(&(objectArray[i][j]));
41704 : }
41705 : }
41706 : }
41707 :
41708 : // Iterate over the saved list
41709 0 : size_t nodeListSize = nodeList.size();
41710 0 : for (size_t i=0; i < nodeListSize; i++)
41711 : {
41712 0 : ROSE_ASSERT(nodeList[i] != NULL);
41713 : #if 0
41714 : traversal.visit(nodeList[i]);
41715 : #else
41716 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
41717 : {
41718 0 : traversal.visit(nodeList[i]);
41719 : }
41720 : #endif
41721 : }
41722 : #endif
41723 : }
41724 :
41725 : // This should not be required since all previously static data members are
41726 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
41727 :
41728 5342 : }
41729 :
41730 :
41731 : void
41732 194 : SgOmpDetachClause::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
41733 : {
41734 : // This function traverses the memory pool for an IR node and
41735 : // calls the function to execute the visitor object.
41736 :
41737 : // Initialize array to the address of the first element of the STL vector
41738 : // (which is guarenteed to be contiguous storage).
41739 : // SgOmpDetachClause objectArray [] = *(Memory_Block_List.begin());
41740 194 : if (SgOmpDetachClause::pools.empty() == false)
41741 : {
41742 : // Generate an array of memory pools
41743 0 : SgOmpDetachClause** objectArray = (SgOmpDetachClause**) &(SgOmpDetachClause::pools[0]);
41744 :
41745 : // Build a local variable for better performance
41746 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
41747 :
41748 : // Iterate over the memory pools
41749 0 : for (unsigned int i=0; i < SgOmpDetachClause::pools.size(); i++)
41750 : {
41751 : // objectArray[i] is a single memory pool
41752 0 : for (unsigned j=0; j < SgOmpDetachClause::pool_size; j++)
41753 : {
41754 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
41755 : {
41756 : // printf ("Found a valid SgOmpDetachClause object in the memory pool %d at position %d \n",i,j);
41757 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
41758 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
41759 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
41760 : }
41761 : else
41762 : {
41763 : // printf ("Found a INVALID SgOmpDetachClause object in the memory pool \n");
41764 : }
41765 : }
41766 : }
41767 : }
41768 :
41769 : // This should not be required since all previously static data members are
41770 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
41771 :
41772 194 : }
41773 :
41774 : void
41775 0 : SgOmpDetachClause::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
41776 : {
41777 : // This function visits only a single IR node of the memory pool.
41778 : // it is typically called once for each type of IR node within
41779 : // the automatically generated function: traverseRepresentativeNodes().
41780 :
41781 : // Initialize array to the address of the first element of the STL vector
41782 : // (which is guarenteed to be contiguous storage).
41783 : // SgOmpDetachClause objectArray [] = *(Memory_Block_List.begin());
41784 0 : if (SgOmpDetachClause::pools.empty() == false)
41785 : {
41786 : // Generate an array of memory pools
41787 0 : SgOmpDetachClause** objectArray = (SgOmpDetachClause**) &(SgOmpDetachClause::pools[0]);
41788 :
41789 : // Build a local variable for better performance
41790 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
41791 :
41792 : // Iterate over the memory pools
41793 0 : bool done = false;
41794 0 : unsigned i=0;
41795 :
41796 : // find the first valid IR node, call visit function, and then leave
41797 0 : while ( done == false && i < SgOmpDetachClause::pools.size() )
41798 : {
41799 : // objectArray[i] is a single memory pool
41800 : unsigned j=0;
41801 0 : while (done == false && j < SgOmpDetachClause::pool_size)
41802 : {
41803 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
41804 : {
41805 0 : traversal.visit(&(objectArray[i][j]));
41806 0 : done = true;
41807 : }
41808 0 : j++;
41809 : }
41810 0 : i++;
41811 : }
41812 :
41813 : #if 0
41814 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
41815 : if (done == false)
41816 : {
41817 : printf ("No representative for SgOmpDetachClause found in memory pools \n");
41818 : }
41819 : #endif
41820 : }
41821 0 : }
41822 :
41823 :
41824 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
41825 : // using values that overflow signed values of int.
41826 : size_t
41827 4 : SgOmpDetachClause::numberOfNodes()
41828 : {
41829 : // This function traverses the memory pool for an IR node and
41830 : // counts the number of IR nodes of a particular Sage III IR
41831 : // nodes type.
41832 :
41833 4 : size_t count = 0;
41834 4 : if (SgOmpDetachClause::pools.empty() == false)
41835 : {
41836 : // Generate an array of memory pools (this is actually a STL vector,
41837 : // but it is contiguious, so OK to treat this way).
41838 0 : SgOmpDetachClause** objectArray = (SgOmpDetachClause**) &(SgOmpDetachClause::pools[0]);
41839 :
41840 : // Build a local variable for better performance (make it a loop invariant variable).
41841 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
41842 :
41843 : // Iterate over all of the memory pools for this IR node.
41844 0 : for (unsigned int i=0; i < SgOmpDetachClause::pools.size(); i++)
41845 : {
41846 : // objectArray[i] is a single memory pool, iterate over all the
41847 : // IR nodes and only count those that are valid IR nodes used in
41848 : // the AST (i.e. allocated IR nodes).
41849 0 : for (unsigned j=0; j < SgOmpDetachClause::pool_size; j++)
41850 : {
41851 : // This is indexing the STL vector of C/C++ style arrays as a doubly
41852 : // indexed array access. It is OK since we have leveraged the semantics
41853 : // of STL vector memory as contigous and cast the memory as an array
41854 : // of arrays to use the 2D array indexing. Hope this is not confusing,
41855 : // but it s very fast as an implementation.
41856 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
41857 : {
41858 0 : count++;
41859 : }
41860 : }
41861 : }
41862 : }
41863 :
41864 :
41865 :
41866 4 : return count;
41867 : }
41868 :
41869 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
41870 : // using values that overflow signed values of int.
41871 : size_t
41872 0 : SgOmpDetachClause::memoryUsage()
41873 : {
41874 : // This function is required because we need the class name as a type when we call sizeof
41875 : // There might be another way to implement this if we have a traversal that only called a
41876 : // representative object (one call for each type of Sage IIIIR node).
41877 0 : size_t memory = numberOfNodes() * sizeof(SgOmpDetachClause);
41878 :
41879 0 : return memory;
41880 : }
41881 :
41882 : /* #line 41883 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
41883 :
41884 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
41885 : void
41886 5342 : SgOmpSafelenClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
41887 : {
41888 : // This function traverses the memory pool for only a specific IR node
41889 : // and calls the visit function of the input class execute a traversal
41890 : // similar to the style of the attribute based traversals within ROSE.
41891 : // This traversal will visit ALL nodes of the AST where as the other
41892 : // attribute based traversals visit only the embedded tree within the AST.
41893 :
41894 : // Initialize array to the address of the first element of the STL vector
41895 : // (which is guaranteed to be contiguous storage).
41896 : // SgOmpSafelenClause objectArray [] = *(Memory_Block_List.begin());
41897 5342 : if (SgOmpSafelenClause::pools.empty() == false)
41898 : {
41899 : // Generate an array of memory pools
41900 14 : SgOmpSafelenClause** objectArray = (SgOmpSafelenClause**) &(SgOmpSafelenClause::pools[0]);
41901 :
41902 : // Build a local variable for better performance
41903 14 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
41904 : #if 0
41905 : // Iterate over the memory pools
41906 : for (unsigned int i=0; i < SgOmpSafelenClause::pools.size(); i++)
41907 : {
41908 : // objectArray[i] is a single memory pool
41909 : for (int j=0; j < SgOmpSafelenClause::pool_size; j++)
41910 : {
41911 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
41912 : {
41913 : traversal.visit(&(objectArray[i][j]));
41914 : }
41915 : }
41916 : }
41917 : #else
41918 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
41919 : // compute the list first and then call the visit function on each list element.
41920 :
41921 : // printf ("Inside of SgOmpSafelenClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
41922 :
41923 28 : std::vector<SgOmpSafelenClause*> nodeList;
41924 :
41925 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
41926 28 : for (unsigned int i=0; i < SgOmpSafelenClause::pools.size(); i++)
41927 : {
41928 : // objectArray[i] is a single memory pool
41929 28014 : for (unsigned j=0; j < SgOmpSafelenClause::pool_size; j++)
41930 : {
41931 28000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
41932 : {
41933 14 : nodeList.push_back(&(objectArray[i][j]));
41934 : }
41935 : }
41936 : }
41937 :
41938 : // Iterate over the saved list
41939 14 : size_t nodeListSize = nodeList.size();
41940 28 : for (size_t i=0; i < nodeListSize; i++)
41941 : {
41942 14 : ROSE_ASSERT(nodeList[i] != NULL);
41943 : #if 0
41944 : traversal.visit(nodeList[i]);
41945 : #else
41946 14 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
41947 : {
41948 14 : traversal.visit(nodeList[i]);
41949 : }
41950 : #endif
41951 : }
41952 : #endif
41953 : }
41954 :
41955 : // This should not be required since all previously static data members are
41956 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
41957 :
41958 5342 : }
41959 :
41960 :
41961 : void
41962 194 : SgOmpSafelenClause::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
41963 : {
41964 : // This function traverses the memory pool for an IR node and
41965 : // calls the function to execute the visitor object.
41966 :
41967 : // Initialize array to the address of the first element of the STL vector
41968 : // (which is guarenteed to be contiguous storage).
41969 : // SgOmpSafelenClause objectArray [] = *(Memory_Block_List.begin());
41970 194 : if (SgOmpSafelenClause::pools.empty() == false)
41971 : {
41972 : // Generate an array of memory pools
41973 0 : SgOmpSafelenClause** objectArray = (SgOmpSafelenClause**) &(SgOmpSafelenClause::pools[0]);
41974 :
41975 : // Build a local variable for better performance
41976 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
41977 :
41978 : // Iterate over the memory pools
41979 0 : for (unsigned int i=0; i < SgOmpSafelenClause::pools.size(); i++)
41980 : {
41981 : // objectArray[i] is a single memory pool
41982 0 : for (unsigned j=0; j < SgOmpSafelenClause::pool_size; j++)
41983 : {
41984 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
41985 : {
41986 : // printf ("Found a valid SgOmpSafelenClause object in the memory pool %d at position %d \n",i,j);
41987 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
41988 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
41989 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
41990 : }
41991 : else
41992 : {
41993 : // printf ("Found a INVALID SgOmpSafelenClause object in the memory pool \n");
41994 : }
41995 : }
41996 : }
41997 : }
41998 :
41999 : // This should not be required since all previously static data members are
42000 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
42001 :
42002 194 : }
42003 :
42004 : void
42005 0 : SgOmpSafelenClause::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
42006 : {
42007 : // This function visits only a single IR node of the memory pool.
42008 : // it is typically called once for each type of IR node within
42009 : // the automatically generated function: traverseRepresentativeNodes().
42010 :
42011 : // Initialize array to the address of the first element of the STL vector
42012 : // (which is guarenteed to be contiguous storage).
42013 : // SgOmpSafelenClause objectArray [] = *(Memory_Block_List.begin());
42014 0 : if (SgOmpSafelenClause::pools.empty() == false)
42015 : {
42016 : // Generate an array of memory pools
42017 0 : SgOmpSafelenClause** objectArray = (SgOmpSafelenClause**) &(SgOmpSafelenClause::pools[0]);
42018 :
42019 : // Build a local variable for better performance
42020 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
42021 :
42022 : // Iterate over the memory pools
42023 0 : bool done = false;
42024 0 : unsigned i=0;
42025 :
42026 : // find the first valid IR node, call visit function, and then leave
42027 0 : while ( done == false && i < SgOmpSafelenClause::pools.size() )
42028 : {
42029 : // objectArray[i] is a single memory pool
42030 : unsigned j=0;
42031 0 : while (done == false && j < SgOmpSafelenClause::pool_size)
42032 : {
42033 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
42034 : {
42035 0 : traversal.visit(&(objectArray[i][j]));
42036 0 : done = true;
42037 : }
42038 0 : j++;
42039 : }
42040 0 : i++;
42041 : }
42042 :
42043 : #if 0
42044 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
42045 : if (done == false)
42046 : {
42047 : printf ("No representative for SgOmpSafelenClause found in memory pools \n");
42048 : }
42049 : #endif
42050 : }
42051 0 : }
42052 :
42053 :
42054 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
42055 : // using values that overflow signed values of int.
42056 : size_t
42057 4 : SgOmpSafelenClause::numberOfNodes()
42058 : {
42059 : // This function traverses the memory pool for an IR node and
42060 : // counts the number of IR nodes of a particular Sage III IR
42061 : // nodes type.
42062 :
42063 4 : size_t count = 0;
42064 4 : if (SgOmpSafelenClause::pools.empty() == false)
42065 : {
42066 : // Generate an array of memory pools (this is actually a STL vector,
42067 : // but it is contiguious, so OK to treat this way).
42068 0 : SgOmpSafelenClause** objectArray = (SgOmpSafelenClause**) &(SgOmpSafelenClause::pools[0]);
42069 :
42070 : // Build a local variable for better performance (make it a loop invariant variable).
42071 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
42072 :
42073 : // Iterate over all of the memory pools for this IR node.
42074 0 : for (unsigned int i=0; i < SgOmpSafelenClause::pools.size(); i++)
42075 : {
42076 : // objectArray[i] is a single memory pool, iterate over all the
42077 : // IR nodes and only count those that are valid IR nodes used in
42078 : // the AST (i.e. allocated IR nodes).
42079 0 : for (unsigned j=0; j < SgOmpSafelenClause::pool_size; j++)
42080 : {
42081 : // This is indexing the STL vector of C/C++ style arrays as a doubly
42082 : // indexed array access. It is OK since we have leveraged the semantics
42083 : // of STL vector memory as contigous and cast the memory as an array
42084 : // of arrays to use the 2D array indexing. Hope this is not confusing,
42085 : // but it s very fast as an implementation.
42086 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
42087 : {
42088 0 : count++;
42089 : }
42090 : }
42091 : }
42092 : }
42093 :
42094 :
42095 :
42096 4 : return count;
42097 : }
42098 :
42099 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
42100 : // using values that overflow signed values of int.
42101 : size_t
42102 0 : SgOmpSafelenClause::memoryUsage()
42103 : {
42104 : // This function is required because we need the class name as a type when we call sizeof
42105 : // There might be another way to implement this if we have a traversal that only called a
42106 : // representative object (one call for each type of Sage IIIIR node).
42107 0 : size_t memory = numberOfNodes() * sizeof(SgOmpSafelenClause);
42108 :
42109 0 : return memory;
42110 : }
42111 :
42112 : /* #line 42113 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
42113 :
42114 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
42115 : void
42116 5342 : SgOmpSimdlenClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
42117 : {
42118 : // This function traverses the memory pool for only a specific IR node
42119 : // and calls the visit function of the input class execute a traversal
42120 : // similar to the style of the attribute based traversals within ROSE.
42121 : // This traversal will visit ALL nodes of the AST where as the other
42122 : // attribute based traversals visit only the embedded tree within the AST.
42123 :
42124 : // Initialize array to the address of the first element of the STL vector
42125 : // (which is guaranteed to be contiguous storage).
42126 : // SgOmpSimdlenClause objectArray [] = *(Memory_Block_List.begin());
42127 5342 : if (SgOmpSimdlenClause::pools.empty() == false)
42128 : {
42129 : // Generate an array of memory pools
42130 14 : SgOmpSimdlenClause** objectArray = (SgOmpSimdlenClause**) &(SgOmpSimdlenClause::pools[0]);
42131 :
42132 : // Build a local variable for better performance
42133 14 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
42134 : #if 0
42135 : // Iterate over the memory pools
42136 : for (unsigned int i=0; i < SgOmpSimdlenClause::pools.size(); i++)
42137 : {
42138 : // objectArray[i] is a single memory pool
42139 : for (int j=0; j < SgOmpSimdlenClause::pool_size; j++)
42140 : {
42141 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
42142 : {
42143 : traversal.visit(&(objectArray[i][j]));
42144 : }
42145 : }
42146 : }
42147 : #else
42148 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
42149 : // compute the list first and then call the visit function on each list element.
42150 :
42151 : // printf ("Inside of SgOmpSimdlenClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
42152 :
42153 28 : std::vector<SgOmpSimdlenClause*> nodeList;
42154 :
42155 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
42156 28 : for (unsigned int i=0; i < SgOmpSimdlenClause::pools.size(); i++)
42157 : {
42158 : // objectArray[i] is a single memory pool
42159 28014 : for (unsigned j=0; j < SgOmpSimdlenClause::pool_size; j++)
42160 : {
42161 28000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
42162 : {
42163 14 : nodeList.push_back(&(objectArray[i][j]));
42164 : }
42165 : }
42166 : }
42167 :
42168 : // Iterate over the saved list
42169 14 : size_t nodeListSize = nodeList.size();
42170 28 : for (size_t i=0; i < nodeListSize; i++)
42171 : {
42172 14 : ROSE_ASSERT(nodeList[i] != NULL);
42173 : #if 0
42174 : traversal.visit(nodeList[i]);
42175 : #else
42176 14 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
42177 : {
42178 14 : traversal.visit(nodeList[i]);
42179 : }
42180 : #endif
42181 : }
42182 : #endif
42183 : }
42184 :
42185 : // This should not be required since all previously static data members are
42186 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
42187 :
42188 5342 : }
42189 :
42190 :
42191 : void
42192 194 : SgOmpSimdlenClause::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
42193 : {
42194 : // This function traverses the memory pool for an IR node and
42195 : // calls the function to execute the visitor object.
42196 :
42197 : // Initialize array to the address of the first element of the STL vector
42198 : // (which is guarenteed to be contiguous storage).
42199 : // SgOmpSimdlenClause objectArray [] = *(Memory_Block_List.begin());
42200 194 : if (SgOmpSimdlenClause::pools.empty() == false)
42201 : {
42202 : // Generate an array of memory pools
42203 0 : SgOmpSimdlenClause** objectArray = (SgOmpSimdlenClause**) &(SgOmpSimdlenClause::pools[0]);
42204 :
42205 : // Build a local variable for better performance
42206 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
42207 :
42208 : // Iterate over the memory pools
42209 0 : for (unsigned int i=0; i < SgOmpSimdlenClause::pools.size(); i++)
42210 : {
42211 : // objectArray[i] is a single memory pool
42212 0 : for (unsigned j=0; j < SgOmpSimdlenClause::pool_size; j++)
42213 : {
42214 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
42215 : {
42216 : // printf ("Found a valid SgOmpSimdlenClause object in the memory pool %d at position %d \n",i,j);
42217 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
42218 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
42219 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
42220 : }
42221 : else
42222 : {
42223 : // printf ("Found a INVALID SgOmpSimdlenClause object in the memory pool \n");
42224 : }
42225 : }
42226 : }
42227 : }
42228 :
42229 : // This should not be required since all previously static data members are
42230 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
42231 :
42232 194 : }
42233 :
42234 : void
42235 0 : SgOmpSimdlenClause::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
42236 : {
42237 : // This function visits only a single IR node of the memory pool.
42238 : // it is typically called once for each type of IR node within
42239 : // the automatically generated function: traverseRepresentativeNodes().
42240 :
42241 : // Initialize array to the address of the first element of the STL vector
42242 : // (which is guarenteed to be contiguous storage).
42243 : // SgOmpSimdlenClause objectArray [] = *(Memory_Block_List.begin());
42244 0 : if (SgOmpSimdlenClause::pools.empty() == false)
42245 : {
42246 : // Generate an array of memory pools
42247 0 : SgOmpSimdlenClause** objectArray = (SgOmpSimdlenClause**) &(SgOmpSimdlenClause::pools[0]);
42248 :
42249 : // Build a local variable for better performance
42250 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
42251 :
42252 : // Iterate over the memory pools
42253 0 : bool done = false;
42254 0 : unsigned i=0;
42255 :
42256 : // find the first valid IR node, call visit function, and then leave
42257 0 : while ( done == false && i < SgOmpSimdlenClause::pools.size() )
42258 : {
42259 : // objectArray[i] is a single memory pool
42260 : unsigned j=0;
42261 0 : while (done == false && j < SgOmpSimdlenClause::pool_size)
42262 : {
42263 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
42264 : {
42265 0 : traversal.visit(&(objectArray[i][j]));
42266 0 : done = true;
42267 : }
42268 0 : j++;
42269 : }
42270 0 : i++;
42271 : }
42272 :
42273 : #if 0
42274 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
42275 : if (done == false)
42276 : {
42277 : printf ("No representative for SgOmpSimdlenClause found in memory pools \n");
42278 : }
42279 : #endif
42280 : }
42281 0 : }
42282 :
42283 :
42284 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
42285 : // using values that overflow signed values of int.
42286 : size_t
42287 4 : SgOmpSimdlenClause::numberOfNodes()
42288 : {
42289 : // This function traverses the memory pool for an IR node and
42290 : // counts the number of IR nodes of a particular Sage III IR
42291 : // nodes type.
42292 :
42293 4 : size_t count = 0;
42294 4 : if (SgOmpSimdlenClause::pools.empty() == false)
42295 : {
42296 : // Generate an array of memory pools (this is actually a STL vector,
42297 : // but it is contiguious, so OK to treat this way).
42298 0 : SgOmpSimdlenClause** objectArray = (SgOmpSimdlenClause**) &(SgOmpSimdlenClause::pools[0]);
42299 :
42300 : // Build a local variable for better performance (make it a loop invariant variable).
42301 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
42302 :
42303 : // Iterate over all of the memory pools for this IR node.
42304 0 : for (unsigned int i=0; i < SgOmpSimdlenClause::pools.size(); i++)
42305 : {
42306 : // objectArray[i] is a single memory pool, iterate over all the
42307 : // IR nodes and only count those that are valid IR nodes used in
42308 : // the AST (i.e. allocated IR nodes).
42309 0 : for (unsigned j=0; j < SgOmpSimdlenClause::pool_size; j++)
42310 : {
42311 : // This is indexing the STL vector of C/C++ style arrays as a doubly
42312 : // indexed array access. It is OK since we have leveraged the semantics
42313 : // of STL vector memory as contigous and cast the memory as an array
42314 : // of arrays to use the 2D array indexing. Hope this is not confusing,
42315 : // but it s very fast as an implementation.
42316 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
42317 : {
42318 0 : count++;
42319 : }
42320 : }
42321 : }
42322 : }
42323 :
42324 :
42325 :
42326 4 : return count;
42327 : }
42328 :
42329 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
42330 : // using values that overflow signed values of int.
42331 : size_t
42332 0 : SgOmpSimdlenClause::memoryUsage()
42333 : {
42334 : // This function is required because we need the class name as a type when we call sizeof
42335 : // There might be another way to implement this if we have a traversal that only called a
42336 : // representative object (one call for each type of Sage IIIIR node).
42337 0 : size_t memory = numberOfNodes() * sizeof(SgOmpSimdlenClause);
42338 :
42339 0 : return memory;
42340 : }
42341 :
42342 : /* #line 42343 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
42343 :
42344 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
42345 : void
42346 5342 : SgOmpFinalClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
42347 : {
42348 : // This function traverses the memory pool for only a specific IR node
42349 : // and calls the visit function of the input class execute a traversal
42350 : // similar to the style of the attribute based traversals within ROSE.
42351 : // This traversal will visit ALL nodes of the AST where as the other
42352 : // attribute based traversals visit only the embedded tree within the AST.
42353 :
42354 : // Initialize array to the address of the first element of the STL vector
42355 : // (which is guaranteed to be contiguous storage).
42356 : // SgOmpFinalClause objectArray [] = *(Memory_Block_List.begin());
42357 5342 : if (SgOmpFinalClause::pools.empty() == false)
42358 : {
42359 : // Generate an array of memory pools
42360 14 : SgOmpFinalClause** objectArray = (SgOmpFinalClause**) &(SgOmpFinalClause::pools[0]);
42361 :
42362 : // Build a local variable for better performance
42363 14 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
42364 : #if 0
42365 : // Iterate over the memory pools
42366 : for (unsigned int i=0; i < SgOmpFinalClause::pools.size(); i++)
42367 : {
42368 : // objectArray[i] is a single memory pool
42369 : for (int j=0; j < SgOmpFinalClause::pool_size; j++)
42370 : {
42371 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
42372 : {
42373 : traversal.visit(&(objectArray[i][j]));
42374 : }
42375 : }
42376 : }
42377 : #else
42378 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
42379 : // compute the list first and then call the visit function on each list element.
42380 :
42381 : // printf ("Inside of SgOmpFinalClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
42382 :
42383 28 : std::vector<SgOmpFinalClause*> nodeList;
42384 :
42385 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
42386 28 : for (unsigned int i=0; i < SgOmpFinalClause::pools.size(); i++)
42387 : {
42388 : // objectArray[i] is a single memory pool
42389 28014 : for (unsigned j=0; j < SgOmpFinalClause::pool_size; j++)
42390 : {
42391 28000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
42392 : {
42393 21 : nodeList.push_back(&(objectArray[i][j]));
42394 : }
42395 : }
42396 : }
42397 :
42398 : // Iterate over the saved list
42399 14 : size_t nodeListSize = nodeList.size();
42400 35 : for (size_t i=0; i < nodeListSize; i++)
42401 : {
42402 21 : ROSE_ASSERT(nodeList[i] != NULL);
42403 : #if 0
42404 : traversal.visit(nodeList[i]);
42405 : #else
42406 21 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
42407 : {
42408 21 : traversal.visit(nodeList[i]);
42409 : }
42410 : #endif
42411 : }
42412 : #endif
42413 : }
42414 :
42415 : // This should not be required since all previously static data members are
42416 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
42417 :
42418 5342 : }
42419 :
42420 :
42421 : void
42422 194 : SgOmpFinalClause::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
42423 : {
42424 : // This function traverses the memory pool for an IR node and
42425 : // calls the function to execute the visitor object.
42426 :
42427 : // Initialize array to the address of the first element of the STL vector
42428 : // (which is guarenteed to be contiguous storage).
42429 : // SgOmpFinalClause objectArray [] = *(Memory_Block_List.begin());
42430 194 : if (SgOmpFinalClause::pools.empty() == false)
42431 : {
42432 : // Generate an array of memory pools
42433 0 : SgOmpFinalClause** objectArray = (SgOmpFinalClause**) &(SgOmpFinalClause::pools[0]);
42434 :
42435 : // Build a local variable for better performance
42436 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
42437 :
42438 : // Iterate over the memory pools
42439 0 : for (unsigned int i=0; i < SgOmpFinalClause::pools.size(); i++)
42440 : {
42441 : // objectArray[i] is a single memory pool
42442 0 : for (unsigned j=0; j < SgOmpFinalClause::pool_size; j++)
42443 : {
42444 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
42445 : {
42446 : // printf ("Found a valid SgOmpFinalClause object in the memory pool %d at position %d \n",i,j);
42447 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
42448 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
42449 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
42450 : }
42451 : else
42452 : {
42453 : // printf ("Found a INVALID SgOmpFinalClause object in the memory pool \n");
42454 : }
42455 : }
42456 : }
42457 : }
42458 :
42459 : // This should not be required since all previously static data members are
42460 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
42461 :
42462 194 : }
42463 :
42464 : void
42465 0 : SgOmpFinalClause::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
42466 : {
42467 : // This function visits only a single IR node of the memory pool.
42468 : // it is typically called once for each type of IR node within
42469 : // the automatically generated function: traverseRepresentativeNodes().
42470 :
42471 : // Initialize array to the address of the first element of the STL vector
42472 : // (which is guarenteed to be contiguous storage).
42473 : // SgOmpFinalClause objectArray [] = *(Memory_Block_List.begin());
42474 0 : if (SgOmpFinalClause::pools.empty() == false)
42475 : {
42476 : // Generate an array of memory pools
42477 0 : SgOmpFinalClause** objectArray = (SgOmpFinalClause**) &(SgOmpFinalClause::pools[0]);
42478 :
42479 : // Build a local variable for better performance
42480 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
42481 :
42482 : // Iterate over the memory pools
42483 0 : bool done = false;
42484 0 : unsigned i=0;
42485 :
42486 : // find the first valid IR node, call visit function, and then leave
42487 0 : while ( done == false && i < SgOmpFinalClause::pools.size() )
42488 : {
42489 : // objectArray[i] is a single memory pool
42490 : unsigned j=0;
42491 0 : while (done == false && j < SgOmpFinalClause::pool_size)
42492 : {
42493 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
42494 : {
42495 0 : traversal.visit(&(objectArray[i][j]));
42496 0 : done = true;
42497 : }
42498 0 : j++;
42499 : }
42500 0 : i++;
42501 : }
42502 :
42503 : #if 0
42504 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
42505 : if (done == false)
42506 : {
42507 : printf ("No representative for SgOmpFinalClause found in memory pools \n");
42508 : }
42509 : #endif
42510 : }
42511 0 : }
42512 :
42513 :
42514 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
42515 : // using values that overflow signed values of int.
42516 : size_t
42517 4 : SgOmpFinalClause::numberOfNodes()
42518 : {
42519 : // This function traverses the memory pool for an IR node and
42520 : // counts the number of IR nodes of a particular Sage III IR
42521 : // nodes type.
42522 :
42523 4 : size_t count = 0;
42524 4 : if (SgOmpFinalClause::pools.empty() == false)
42525 : {
42526 : // Generate an array of memory pools (this is actually a STL vector,
42527 : // but it is contiguious, so OK to treat this way).
42528 0 : SgOmpFinalClause** objectArray = (SgOmpFinalClause**) &(SgOmpFinalClause::pools[0]);
42529 :
42530 : // Build a local variable for better performance (make it a loop invariant variable).
42531 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
42532 :
42533 : // Iterate over all of the memory pools for this IR node.
42534 0 : for (unsigned int i=0; i < SgOmpFinalClause::pools.size(); i++)
42535 : {
42536 : // objectArray[i] is a single memory pool, iterate over all the
42537 : // IR nodes and only count those that are valid IR nodes used in
42538 : // the AST (i.e. allocated IR nodes).
42539 0 : for (unsigned j=0; j < SgOmpFinalClause::pool_size; j++)
42540 : {
42541 : // This is indexing the STL vector of C/C++ style arrays as a doubly
42542 : // indexed array access. It is OK since we have leveraged the semantics
42543 : // of STL vector memory as contigous and cast the memory as an array
42544 : // of arrays to use the 2D array indexing. Hope this is not confusing,
42545 : // but it s very fast as an implementation.
42546 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
42547 : {
42548 0 : count++;
42549 : }
42550 : }
42551 : }
42552 : }
42553 :
42554 :
42555 :
42556 4 : return count;
42557 : }
42558 :
42559 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
42560 : // using values that overflow signed values of int.
42561 : size_t
42562 0 : SgOmpFinalClause::memoryUsage()
42563 : {
42564 : // This function is required because we need the class name as a type when we call sizeof
42565 : // There might be another way to implement this if we have a traversal that only called a
42566 : // representative object (one call for each type of Sage IIIIR node).
42567 0 : size_t memory = numberOfNodes() * sizeof(SgOmpFinalClause);
42568 :
42569 0 : return memory;
42570 : }
42571 :
42572 : /* #line 42573 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
42573 :
42574 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
42575 : void
42576 5342 : SgOmpPriorityClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
42577 : {
42578 : // This function traverses the memory pool for only a specific IR node
42579 : // and calls the visit function of the input class execute a traversal
42580 : // similar to the style of the attribute based traversals within ROSE.
42581 : // This traversal will visit ALL nodes of the AST where as the other
42582 : // attribute based traversals visit only the embedded tree within the AST.
42583 :
42584 : // Initialize array to the address of the first element of the STL vector
42585 : // (which is guaranteed to be contiguous storage).
42586 : // SgOmpPriorityClause objectArray [] = *(Memory_Block_List.begin());
42587 5342 : if (SgOmpPriorityClause::pools.empty() == false)
42588 : {
42589 : // Generate an array of memory pools
42590 7 : SgOmpPriorityClause** objectArray = (SgOmpPriorityClause**) &(SgOmpPriorityClause::pools[0]);
42591 :
42592 : // Build a local variable for better performance
42593 7 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
42594 : #if 0
42595 : // Iterate over the memory pools
42596 : for (unsigned int i=0; i < SgOmpPriorityClause::pools.size(); i++)
42597 : {
42598 : // objectArray[i] is a single memory pool
42599 : for (int j=0; j < SgOmpPriorityClause::pool_size; j++)
42600 : {
42601 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
42602 : {
42603 : traversal.visit(&(objectArray[i][j]));
42604 : }
42605 : }
42606 : }
42607 : #else
42608 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
42609 : // compute the list first and then call the visit function on each list element.
42610 :
42611 : // printf ("Inside of SgOmpPriorityClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
42612 :
42613 14 : std::vector<SgOmpPriorityClause*> nodeList;
42614 :
42615 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
42616 14 : for (unsigned int i=0; i < SgOmpPriorityClause::pools.size(); i++)
42617 : {
42618 : // objectArray[i] is a single memory pool
42619 14007 : for (unsigned j=0; j < SgOmpPriorityClause::pool_size; j++)
42620 : {
42621 14000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
42622 : {
42623 7 : nodeList.push_back(&(objectArray[i][j]));
42624 : }
42625 : }
42626 : }
42627 :
42628 : // Iterate over the saved list
42629 7 : size_t nodeListSize = nodeList.size();
42630 14 : for (size_t i=0; i < nodeListSize; i++)
42631 : {
42632 7 : ROSE_ASSERT(nodeList[i] != NULL);
42633 : #if 0
42634 : traversal.visit(nodeList[i]);
42635 : #else
42636 7 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
42637 : {
42638 7 : traversal.visit(nodeList[i]);
42639 : }
42640 : #endif
42641 : }
42642 : #endif
42643 : }
42644 :
42645 : // This should not be required since all previously static data members are
42646 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
42647 :
42648 5342 : }
42649 :
42650 :
42651 : void
42652 194 : SgOmpPriorityClause::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
42653 : {
42654 : // This function traverses the memory pool for an IR node and
42655 : // calls the function to execute the visitor object.
42656 :
42657 : // Initialize array to the address of the first element of the STL vector
42658 : // (which is guarenteed to be contiguous storage).
42659 : // SgOmpPriorityClause objectArray [] = *(Memory_Block_List.begin());
42660 194 : if (SgOmpPriorityClause::pools.empty() == false)
42661 : {
42662 : // Generate an array of memory pools
42663 0 : SgOmpPriorityClause** objectArray = (SgOmpPriorityClause**) &(SgOmpPriorityClause::pools[0]);
42664 :
42665 : // Build a local variable for better performance
42666 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
42667 :
42668 : // Iterate over the memory pools
42669 0 : for (unsigned int i=0; i < SgOmpPriorityClause::pools.size(); i++)
42670 : {
42671 : // objectArray[i] is a single memory pool
42672 0 : for (unsigned j=0; j < SgOmpPriorityClause::pool_size; j++)
42673 : {
42674 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
42675 : {
42676 : // printf ("Found a valid SgOmpPriorityClause object in the memory pool %d at position %d \n",i,j);
42677 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
42678 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
42679 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
42680 : }
42681 : else
42682 : {
42683 : // printf ("Found a INVALID SgOmpPriorityClause object in the memory pool \n");
42684 : }
42685 : }
42686 : }
42687 : }
42688 :
42689 : // This should not be required since all previously static data members are
42690 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
42691 :
42692 194 : }
42693 :
42694 : void
42695 0 : SgOmpPriorityClause::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
42696 : {
42697 : // This function visits only a single IR node of the memory pool.
42698 : // it is typically called once for each type of IR node within
42699 : // the automatically generated function: traverseRepresentativeNodes().
42700 :
42701 : // Initialize array to the address of the first element of the STL vector
42702 : // (which is guarenteed to be contiguous storage).
42703 : // SgOmpPriorityClause objectArray [] = *(Memory_Block_List.begin());
42704 0 : if (SgOmpPriorityClause::pools.empty() == false)
42705 : {
42706 : // Generate an array of memory pools
42707 0 : SgOmpPriorityClause** objectArray = (SgOmpPriorityClause**) &(SgOmpPriorityClause::pools[0]);
42708 :
42709 : // Build a local variable for better performance
42710 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
42711 :
42712 : // Iterate over the memory pools
42713 0 : bool done = false;
42714 0 : unsigned i=0;
42715 :
42716 : // find the first valid IR node, call visit function, and then leave
42717 0 : while ( done == false && i < SgOmpPriorityClause::pools.size() )
42718 : {
42719 : // objectArray[i] is a single memory pool
42720 : unsigned j=0;
42721 0 : while (done == false && j < SgOmpPriorityClause::pool_size)
42722 : {
42723 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
42724 : {
42725 0 : traversal.visit(&(objectArray[i][j]));
42726 0 : done = true;
42727 : }
42728 0 : j++;
42729 : }
42730 0 : i++;
42731 : }
42732 :
42733 : #if 0
42734 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
42735 : if (done == false)
42736 : {
42737 : printf ("No representative for SgOmpPriorityClause found in memory pools \n");
42738 : }
42739 : #endif
42740 : }
42741 0 : }
42742 :
42743 :
42744 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
42745 : // using values that overflow signed values of int.
42746 : size_t
42747 4 : SgOmpPriorityClause::numberOfNodes()
42748 : {
42749 : // This function traverses the memory pool for an IR node and
42750 : // counts the number of IR nodes of a particular Sage III IR
42751 : // nodes type.
42752 :
42753 4 : size_t count = 0;
42754 4 : if (SgOmpPriorityClause::pools.empty() == false)
42755 : {
42756 : // Generate an array of memory pools (this is actually a STL vector,
42757 : // but it is contiguious, so OK to treat this way).
42758 0 : SgOmpPriorityClause** objectArray = (SgOmpPriorityClause**) &(SgOmpPriorityClause::pools[0]);
42759 :
42760 : // Build a local variable for better performance (make it a loop invariant variable).
42761 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
42762 :
42763 : // Iterate over all of the memory pools for this IR node.
42764 0 : for (unsigned int i=0; i < SgOmpPriorityClause::pools.size(); i++)
42765 : {
42766 : // objectArray[i] is a single memory pool, iterate over all the
42767 : // IR nodes and only count those that are valid IR nodes used in
42768 : // the AST (i.e. allocated IR nodes).
42769 0 : for (unsigned j=0; j < SgOmpPriorityClause::pool_size; j++)
42770 : {
42771 : // This is indexing the STL vector of C/C++ style arrays as a doubly
42772 : // indexed array access. It is OK since we have leveraged the semantics
42773 : // of STL vector memory as contigous and cast the memory as an array
42774 : // of arrays to use the 2D array indexing. Hope this is not confusing,
42775 : // but it s very fast as an implementation.
42776 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
42777 : {
42778 0 : count++;
42779 : }
42780 : }
42781 : }
42782 : }
42783 :
42784 :
42785 :
42786 4 : return count;
42787 : }
42788 :
42789 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
42790 : // using values that overflow signed values of int.
42791 : size_t
42792 0 : SgOmpPriorityClause::memoryUsage()
42793 : {
42794 : // This function is required because we need the class name as a type when we call sizeof
42795 : // There might be another way to implement this if we have a traversal that only called a
42796 : // representative object (one call for each type of Sage IIIIR node).
42797 0 : size_t memory = numberOfNodes() * sizeof(SgOmpPriorityClause);
42798 :
42799 0 : return memory;
42800 : }
42801 :
42802 : /* #line 42803 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
42803 :
42804 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
42805 : void
42806 5342 : SgOmpPartialClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
42807 : {
42808 : // This function traverses the memory pool for only a specific IR node
42809 : // and calls the visit function of the input class execute a traversal
42810 : // similar to the style of the attribute based traversals within ROSE.
42811 : // This traversal will visit ALL nodes of the AST where as the other
42812 : // attribute based traversals visit only the embedded tree within the AST.
42813 :
42814 : // Initialize array to the address of the first element of the STL vector
42815 : // (which is guaranteed to be contiguous storage).
42816 : // SgOmpPartialClause objectArray [] = *(Memory_Block_List.begin());
42817 5342 : if (SgOmpPartialClause::pools.empty() == false)
42818 : {
42819 : // Generate an array of memory pools
42820 0 : SgOmpPartialClause** objectArray = (SgOmpPartialClause**) &(SgOmpPartialClause::pools[0]);
42821 :
42822 : // Build a local variable for better performance
42823 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
42824 : #if 0
42825 : // Iterate over the memory pools
42826 : for (unsigned int i=0; i < SgOmpPartialClause::pools.size(); i++)
42827 : {
42828 : // objectArray[i] is a single memory pool
42829 : for (int j=0; j < SgOmpPartialClause::pool_size; j++)
42830 : {
42831 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
42832 : {
42833 : traversal.visit(&(objectArray[i][j]));
42834 : }
42835 : }
42836 : }
42837 : #else
42838 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
42839 : // compute the list first and then call the visit function on each list element.
42840 :
42841 : // printf ("Inside of SgOmpPartialClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
42842 :
42843 0 : std::vector<SgOmpPartialClause*> nodeList;
42844 :
42845 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
42846 0 : for (unsigned int i=0; i < SgOmpPartialClause::pools.size(); i++)
42847 : {
42848 : // objectArray[i] is a single memory pool
42849 0 : for (unsigned j=0; j < SgOmpPartialClause::pool_size; j++)
42850 : {
42851 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
42852 : {
42853 0 : nodeList.push_back(&(objectArray[i][j]));
42854 : }
42855 : }
42856 : }
42857 :
42858 : // Iterate over the saved list
42859 0 : size_t nodeListSize = nodeList.size();
42860 0 : for (size_t i=0; i < nodeListSize; i++)
42861 : {
42862 0 : ROSE_ASSERT(nodeList[i] != NULL);
42863 : #if 0
42864 : traversal.visit(nodeList[i]);
42865 : #else
42866 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
42867 : {
42868 0 : traversal.visit(nodeList[i]);
42869 : }
42870 : #endif
42871 : }
42872 : #endif
42873 : }
42874 :
42875 : // This should not be required since all previously static data members are
42876 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
42877 :
42878 5342 : }
42879 :
42880 :
42881 : void
42882 194 : SgOmpPartialClause::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
42883 : {
42884 : // This function traverses the memory pool for an IR node and
42885 : // calls the function to execute the visitor object.
42886 :
42887 : // Initialize array to the address of the first element of the STL vector
42888 : // (which is guarenteed to be contiguous storage).
42889 : // SgOmpPartialClause objectArray [] = *(Memory_Block_List.begin());
42890 194 : if (SgOmpPartialClause::pools.empty() == false)
42891 : {
42892 : // Generate an array of memory pools
42893 0 : SgOmpPartialClause** objectArray = (SgOmpPartialClause**) &(SgOmpPartialClause::pools[0]);
42894 :
42895 : // Build a local variable for better performance
42896 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
42897 :
42898 : // Iterate over the memory pools
42899 0 : for (unsigned int i=0; i < SgOmpPartialClause::pools.size(); i++)
42900 : {
42901 : // objectArray[i] is a single memory pool
42902 0 : for (unsigned j=0; j < SgOmpPartialClause::pool_size; j++)
42903 : {
42904 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
42905 : {
42906 : // printf ("Found a valid SgOmpPartialClause object in the memory pool %d at position %d \n",i,j);
42907 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
42908 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
42909 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
42910 : }
42911 : else
42912 : {
42913 : // printf ("Found a INVALID SgOmpPartialClause object in the memory pool \n");
42914 : }
42915 : }
42916 : }
42917 : }
42918 :
42919 : // This should not be required since all previously static data members are
42920 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
42921 :
42922 194 : }
42923 :
42924 : void
42925 0 : SgOmpPartialClause::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
42926 : {
42927 : // This function visits only a single IR node of the memory pool.
42928 : // it is typically called once for each type of IR node within
42929 : // the automatically generated function: traverseRepresentativeNodes().
42930 :
42931 : // Initialize array to the address of the first element of the STL vector
42932 : // (which is guarenteed to be contiguous storage).
42933 : // SgOmpPartialClause objectArray [] = *(Memory_Block_List.begin());
42934 0 : if (SgOmpPartialClause::pools.empty() == false)
42935 : {
42936 : // Generate an array of memory pools
42937 0 : SgOmpPartialClause** objectArray = (SgOmpPartialClause**) &(SgOmpPartialClause::pools[0]);
42938 :
42939 : // Build a local variable for better performance
42940 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
42941 :
42942 : // Iterate over the memory pools
42943 0 : bool done = false;
42944 0 : unsigned i=0;
42945 :
42946 : // find the first valid IR node, call visit function, and then leave
42947 0 : while ( done == false && i < SgOmpPartialClause::pools.size() )
42948 : {
42949 : // objectArray[i] is a single memory pool
42950 : unsigned j=0;
42951 0 : while (done == false && j < SgOmpPartialClause::pool_size)
42952 : {
42953 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
42954 : {
42955 0 : traversal.visit(&(objectArray[i][j]));
42956 0 : done = true;
42957 : }
42958 0 : j++;
42959 : }
42960 0 : i++;
42961 : }
42962 :
42963 : #if 0
42964 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
42965 : if (done == false)
42966 : {
42967 : printf ("No representative for SgOmpPartialClause found in memory pools \n");
42968 : }
42969 : #endif
42970 : }
42971 0 : }
42972 :
42973 :
42974 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
42975 : // using values that overflow signed values of int.
42976 : size_t
42977 4 : SgOmpPartialClause::numberOfNodes()
42978 : {
42979 : // This function traverses the memory pool for an IR node and
42980 : // counts the number of IR nodes of a particular Sage III IR
42981 : // nodes type.
42982 :
42983 4 : size_t count = 0;
42984 4 : if (SgOmpPartialClause::pools.empty() == false)
42985 : {
42986 : // Generate an array of memory pools (this is actually a STL vector,
42987 : // but it is contiguious, so OK to treat this way).
42988 0 : SgOmpPartialClause** objectArray = (SgOmpPartialClause**) &(SgOmpPartialClause::pools[0]);
42989 :
42990 : // Build a local variable for better performance (make it a loop invariant variable).
42991 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
42992 :
42993 : // Iterate over all of the memory pools for this IR node.
42994 0 : for (unsigned int i=0; i < SgOmpPartialClause::pools.size(); i++)
42995 : {
42996 : // objectArray[i] is a single memory pool, iterate over all the
42997 : // IR nodes and only count those that are valid IR nodes used in
42998 : // the AST (i.e. allocated IR nodes).
42999 0 : for (unsigned j=0; j < SgOmpPartialClause::pool_size; j++)
43000 : {
43001 : // This is indexing the STL vector of C/C++ style arrays as a doubly
43002 : // indexed array access. It is OK since we have leveraged the semantics
43003 : // of STL vector memory as contigous and cast the memory as an array
43004 : // of arrays to use the 2D array indexing. Hope this is not confusing,
43005 : // but it s very fast as an implementation.
43006 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
43007 : {
43008 0 : count++;
43009 : }
43010 : }
43011 : }
43012 : }
43013 :
43014 :
43015 :
43016 4 : return count;
43017 : }
43018 :
43019 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
43020 : // using values that overflow signed values of int.
43021 : size_t
43022 0 : SgOmpPartialClause::memoryUsage()
43023 : {
43024 : // This function is required because we need the class name as a type when we call sizeof
43025 : // There might be another way to implement this if we have a traversal that only called a
43026 : // representative object (one call for each type of Sage IIIIR node).
43027 0 : size_t memory = numberOfNodes() * sizeof(SgOmpPartialClause);
43028 :
43029 0 : return memory;
43030 : }
43031 :
43032 : /* #line 43033 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
43033 :
43034 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
43035 : void
43036 5342 : SgOmpSizesClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
43037 : {
43038 : // This function traverses the memory pool for only a specific IR node
43039 : // and calls the visit function of the input class execute a traversal
43040 : // similar to the style of the attribute based traversals within ROSE.
43041 : // This traversal will visit ALL nodes of the AST where as the other
43042 : // attribute based traversals visit only the embedded tree within the AST.
43043 :
43044 : // Initialize array to the address of the first element of the STL vector
43045 : // (which is guaranteed to be contiguous storage).
43046 : // SgOmpSizesClause objectArray [] = *(Memory_Block_List.begin());
43047 5342 : if (SgOmpSizesClause::pools.empty() == false)
43048 : {
43049 : // Generate an array of memory pools
43050 0 : SgOmpSizesClause** objectArray = (SgOmpSizesClause**) &(SgOmpSizesClause::pools[0]);
43051 :
43052 : // Build a local variable for better performance
43053 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
43054 : #if 0
43055 : // Iterate over the memory pools
43056 : for (unsigned int i=0; i < SgOmpSizesClause::pools.size(); i++)
43057 : {
43058 : // objectArray[i] is a single memory pool
43059 : for (int j=0; j < SgOmpSizesClause::pool_size; j++)
43060 : {
43061 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
43062 : {
43063 : traversal.visit(&(objectArray[i][j]));
43064 : }
43065 : }
43066 : }
43067 : #else
43068 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
43069 : // compute the list first and then call the visit function on each list element.
43070 :
43071 : // printf ("Inside of SgOmpSizesClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
43072 :
43073 0 : std::vector<SgOmpSizesClause*> nodeList;
43074 :
43075 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
43076 0 : for (unsigned int i=0; i < SgOmpSizesClause::pools.size(); i++)
43077 : {
43078 : // objectArray[i] is a single memory pool
43079 0 : for (unsigned j=0; j < SgOmpSizesClause::pool_size; j++)
43080 : {
43081 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
43082 : {
43083 0 : nodeList.push_back(&(objectArray[i][j]));
43084 : }
43085 : }
43086 : }
43087 :
43088 : // Iterate over the saved list
43089 0 : size_t nodeListSize = nodeList.size();
43090 0 : for (size_t i=0; i < nodeListSize; i++)
43091 : {
43092 0 : ROSE_ASSERT(nodeList[i] != NULL);
43093 : #if 0
43094 : traversal.visit(nodeList[i]);
43095 : #else
43096 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
43097 : {
43098 0 : traversal.visit(nodeList[i]);
43099 : }
43100 : #endif
43101 : }
43102 : #endif
43103 : }
43104 :
43105 : // This should not be required since all previously static data members are
43106 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
43107 :
43108 5342 : }
43109 :
43110 :
43111 : void
43112 194 : SgOmpSizesClause::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
43113 : {
43114 : // This function traverses the memory pool for an IR node and
43115 : // calls the function to execute the visitor object.
43116 :
43117 : // Initialize array to the address of the first element of the STL vector
43118 : // (which is guarenteed to be contiguous storage).
43119 : // SgOmpSizesClause objectArray [] = *(Memory_Block_List.begin());
43120 194 : if (SgOmpSizesClause::pools.empty() == false)
43121 : {
43122 : // Generate an array of memory pools
43123 0 : SgOmpSizesClause** objectArray = (SgOmpSizesClause**) &(SgOmpSizesClause::pools[0]);
43124 :
43125 : // Build a local variable for better performance
43126 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
43127 :
43128 : // Iterate over the memory pools
43129 0 : for (unsigned int i=0; i < SgOmpSizesClause::pools.size(); i++)
43130 : {
43131 : // objectArray[i] is a single memory pool
43132 0 : for (unsigned j=0; j < SgOmpSizesClause::pool_size; j++)
43133 : {
43134 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
43135 : {
43136 : // printf ("Found a valid SgOmpSizesClause object in the memory pool %d at position %d \n",i,j);
43137 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
43138 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
43139 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
43140 : }
43141 : else
43142 : {
43143 : // printf ("Found a INVALID SgOmpSizesClause object in the memory pool \n");
43144 : }
43145 : }
43146 : }
43147 : }
43148 :
43149 : // This should not be required since all previously static data members are
43150 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
43151 :
43152 194 : }
43153 :
43154 : void
43155 0 : SgOmpSizesClause::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
43156 : {
43157 : // This function visits only a single IR node of the memory pool.
43158 : // it is typically called once for each type of IR node within
43159 : // the automatically generated function: traverseRepresentativeNodes().
43160 :
43161 : // Initialize array to the address of the first element of the STL vector
43162 : // (which is guarenteed to be contiguous storage).
43163 : // SgOmpSizesClause objectArray [] = *(Memory_Block_List.begin());
43164 0 : if (SgOmpSizesClause::pools.empty() == false)
43165 : {
43166 : // Generate an array of memory pools
43167 0 : SgOmpSizesClause** objectArray = (SgOmpSizesClause**) &(SgOmpSizesClause::pools[0]);
43168 :
43169 : // Build a local variable for better performance
43170 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
43171 :
43172 : // Iterate over the memory pools
43173 0 : bool done = false;
43174 0 : unsigned i=0;
43175 :
43176 : // find the first valid IR node, call visit function, and then leave
43177 0 : while ( done == false && i < SgOmpSizesClause::pools.size() )
43178 : {
43179 : // objectArray[i] is a single memory pool
43180 : unsigned j=0;
43181 0 : while (done == false && j < SgOmpSizesClause::pool_size)
43182 : {
43183 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
43184 : {
43185 0 : traversal.visit(&(objectArray[i][j]));
43186 0 : done = true;
43187 : }
43188 0 : j++;
43189 : }
43190 0 : i++;
43191 : }
43192 :
43193 : #if 0
43194 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
43195 : if (done == false)
43196 : {
43197 : printf ("No representative for SgOmpSizesClause found in memory pools \n");
43198 : }
43199 : #endif
43200 : }
43201 0 : }
43202 :
43203 :
43204 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
43205 : // using values that overflow signed values of int.
43206 : size_t
43207 4 : SgOmpSizesClause::numberOfNodes()
43208 : {
43209 : // This function traverses the memory pool for an IR node and
43210 : // counts the number of IR nodes of a particular Sage III IR
43211 : // nodes type.
43212 :
43213 4 : size_t count = 0;
43214 4 : if (SgOmpSizesClause::pools.empty() == false)
43215 : {
43216 : // Generate an array of memory pools (this is actually a STL vector,
43217 : // but it is contiguious, so OK to treat this way).
43218 0 : SgOmpSizesClause** objectArray = (SgOmpSizesClause**) &(SgOmpSizesClause::pools[0]);
43219 :
43220 : // Build a local variable for better performance (make it a loop invariant variable).
43221 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
43222 :
43223 : // Iterate over all of the memory pools for this IR node.
43224 0 : for (unsigned int i=0; i < SgOmpSizesClause::pools.size(); i++)
43225 : {
43226 : // objectArray[i] is a single memory pool, iterate over all the
43227 : // IR nodes and only count those that are valid IR nodes used in
43228 : // the AST (i.e. allocated IR nodes).
43229 0 : for (unsigned j=0; j < SgOmpSizesClause::pool_size; j++)
43230 : {
43231 : // This is indexing the STL vector of C/C++ style arrays as a doubly
43232 : // indexed array access. It is OK since we have leveraged the semantics
43233 : // of STL vector memory as contigous and cast the memory as an array
43234 : // of arrays to use the 2D array indexing. Hope this is not confusing,
43235 : // but it s very fast as an implementation.
43236 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
43237 : {
43238 0 : count++;
43239 : }
43240 : }
43241 : }
43242 : }
43243 :
43244 :
43245 :
43246 4 : return count;
43247 : }
43248 :
43249 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
43250 : // using values that overflow signed values of int.
43251 : size_t
43252 0 : SgOmpSizesClause::memoryUsage()
43253 : {
43254 : // This function is required because we need the class name as a type when we call sizeof
43255 : // There might be another way to implement this if we have a traversal that only called a
43256 : // representative object (one call for each type of Sage IIIIR node).
43257 0 : size_t memory = numberOfNodes() * sizeof(SgOmpSizesClause);
43258 :
43259 0 : return memory;
43260 : }
43261 :
43262 : /* #line 43263 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
43263 :
43264 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
43265 : void
43266 5342 : SgOmpInbranchClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
43267 : {
43268 : // This function traverses the memory pool for only a specific IR node
43269 : // and calls the visit function of the input class execute a traversal
43270 : // similar to the style of the attribute based traversals within ROSE.
43271 : // This traversal will visit ALL nodes of the AST where as the other
43272 : // attribute based traversals visit only the embedded tree within the AST.
43273 :
43274 : // Initialize array to the address of the first element of the STL vector
43275 : // (which is guaranteed to be contiguous storage).
43276 : // SgOmpInbranchClause objectArray [] = *(Memory_Block_List.begin());
43277 5342 : if (SgOmpInbranchClause::pools.empty() == false)
43278 : {
43279 : // Generate an array of memory pools
43280 0 : SgOmpInbranchClause** objectArray = (SgOmpInbranchClause**) &(SgOmpInbranchClause::pools[0]);
43281 :
43282 : // Build a local variable for better performance
43283 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
43284 : #if 0
43285 : // Iterate over the memory pools
43286 : for (unsigned int i=0; i < SgOmpInbranchClause::pools.size(); i++)
43287 : {
43288 : // objectArray[i] is a single memory pool
43289 : for (int j=0; j < SgOmpInbranchClause::pool_size; j++)
43290 : {
43291 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
43292 : {
43293 : traversal.visit(&(objectArray[i][j]));
43294 : }
43295 : }
43296 : }
43297 : #else
43298 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
43299 : // compute the list first and then call the visit function on each list element.
43300 :
43301 : // printf ("Inside of SgOmpInbranchClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
43302 :
43303 0 : std::vector<SgOmpInbranchClause*> nodeList;
43304 :
43305 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
43306 0 : for (unsigned int i=0; i < SgOmpInbranchClause::pools.size(); i++)
43307 : {
43308 : // objectArray[i] is a single memory pool
43309 0 : for (unsigned j=0; j < SgOmpInbranchClause::pool_size; j++)
43310 : {
43311 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
43312 : {
43313 0 : nodeList.push_back(&(objectArray[i][j]));
43314 : }
43315 : }
43316 : }
43317 :
43318 : // Iterate over the saved list
43319 0 : size_t nodeListSize = nodeList.size();
43320 0 : for (size_t i=0; i < nodeListSize; i++)
43321 : {
43322 0 : ROSE_ASSERT(nodeList[i] != NULL);
43323 : #if 0
43324 : traversal.visit(nodeList[i]);
43325 : #else
43326 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
43327 : {
43328 0 : traversal.visit(nodeList[i]);
43329 : }
43330 : #endif
43331 : }
43332 : #endif
43333 : }
43334 :
43335 : // This should not be required since all previously static data members are
43336 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
43337 :
43338 5342 : }
43339 :
43340 :
43341 : void
43342 194 : SgOmpInbranchClause::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
43343 : {
43344 : // This function traverses the memory pool for an IR node and
43345 : // calls the function to execute the visitor object.
43346 :
43347 : // Initialize array to the address of the first element of the STL vector
43348 : // (which is guarenteed to be contiguous storage).
43349 : // SgOmpInbranchClause objectArray [] = *(Memory_Block_List.begin());
43350 194 : if (SgOmpInbranchClause::pools.empty() == false)
43351 : {
43352 : // Generate an array of memory pools
43353 0 : SgOmpInbranchClause** objectArray = (SgOmpInbranchClause**) &(SgOmpInbranchClause::pools[0]);
43354 :
43355 : // Build a local variable for better performance
43356 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
43357 :
43358 : // Iterate over the memory pools
43359 0 : for (unsigned int i=0; i < SgOmpInbranchClause::pools.size(); i++)
43360 : {
43361 : // objectArray[i] is a single memory pool
43362 0 : for (unsigned j=0; j < SgOmpInbranchClause::pool_size; j++)
43363 : {
43364 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
43365 : {
43366 : // printf ("Found a valid SgOmpInbranchClause object in the memory pool %d at position %d \n",i,j);
43367 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
43368 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
43369 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
43370 : }
43371 : else
43372 : {
43373 : // printf ("Found a INVALID SgOmpInbranchClause object in the memory pool \n");
43374 : }
43375 : }
43376 : }
43377 : }
43378 :
43379 : // This should not be required since all previously static data members are
43380 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
43381 :
43382 194 : }
43383 :
43384 : void
43385 0 : SgOmpInbranchClause::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
43386 : {
43387 : // This function visits only a single IR node of the memory pool.
43388 : // it is typically called once for each type of IR node within
43389 : // the automatically generated function: traverseRepresentativeNodes().
43390 :
43391 : // Initialize array to the address of the first element of the STL vector
43392 : // (which is guarenteed to be contiguous storage).
43393 : // SgOmpInbranchClause objectArray [] = *(Memory_Block_List.begin());
43394 0 : if (SgOmpInbranchClause::pools.empty() == false)
43395 : {
43396 : // Generate an array of memory pools
43397 0 : SgOmpInbranchClause** objectArray = (SgOmpInbranchClause**) &(SgOmpInbranchClause::pools[0]);
43398 :
43399 : // Build a local variable for better performance
43400 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
43401 :
43402 : // Iterate over the memory pools
43403 0 : bool done = false;
43404 0 : unsigned i=0;
43405 :
43406 : // find the first valid IR node, call visit function, and then leave
43407 0 : while ( done == false && i < SgOmpInbranchClause::pools.size() )
43408 : {
43409 : // objectArray[i] is a single memory pool
43410 : unsigned j=0;
43411 0 : while (done == false && j < SgOmpInbranchClause::pool_size)
43412 : {
43413 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
43414 : {
43415 0 : traversal.visit(&(objectArray[i][j]));
43416 0 : done = true;
43417 : }
43418 0 : j++;
43419 : }
43420 0 : i++;
43421 : }
43422 :
43423 : #if 0
43424 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
43425 : if (done == false)
43426 : {
43427 : printf ("No representative for SgOmpInbranchClause found in memory pools \n");
43428 : }
43429 : #endif
43430 : }
43431 0 : }
43432 :
43433 :
43434 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
43435 : // using values that overflow signed values of int.
43436 : size_t
43437 4 : SgOmpInbranchClause::numberOfNodes()
43438 : {
43439 : // This function traverses the memory pool for an IR node and
43440 : // counts the number of IR nodes of a particular Sage III IR
43441 : // nodes type.
43442 :
43443 4 : size_t count = 0;
43444 4 : if (SgOmpInbranchClause::pools.empty() == false)
43445 : {
43446 : // Generate an array of memory pools (this is actually a STL vector,
43447 : // but it is contiguious, so OK to treat this way).
43448 0 : SgOmpInbranchClause** objectArray = (SgOmpInbranchClause**) &(SgOmpInbranchClause::pools[0]);
43449 :
43450 : // Build a local variable for better performance (make it a loop invariant variable).
43451 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
43452 :
43453 : // Iterate over all of the memory pools for this IR node.
43454 0 : for (unsigned int i=0; i < SgOmpInbranchClause::pools.size(); i++)
43455 : {
43456 : // objectArray[i] is a single memory pool, iterate over all the
43457 : // IR nodes and only count those that are valid IR nodes used in
43458 : // the AST (i.e. allocated IR nodes).
43459 0 : for (unsigned j=0; j < SgOmpInbranchClause::pool_size; j++)
43460 : {
43461 : // This is indexing the STL vector of C/C++ style arrays as a doubly
43462 : // indexed array access. It is OK since we have leveraged the semantics
43463 : // of STL vector memory as contigous and cast the memory as an array
43464 : // of arrays to use the 2D array indexing. Hope this is not confusing,
43465 : // but it s very fast as an implementation.
43466 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
43467 : {
43468 0 : count++;
43469 : }
43470 : }
43471 : }
43472 : }
43473 :
43474 :
43475 :
43476 4 : return count;
43477 : }
43478 :
43479 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
43480 : // using values that overflow signed values of int.
43481 : size_t
43482 0 : SgOmpInbranchClause::memoryUsage()
43483 : {
43484 : // This function is required because we need the class name as a type when we call sizeof
43485 : // There might be another way to implement this if we have a traversal that only called a
43486 : // representative object (one call for each type of Sage IIIIR node).
43487 0 : size_t memory = numberOfNodes() * sizeof(SgOmpInbranchClause);
43488 :
43489 0 : return memory;
43490 : }
43491 :
43492 : /* #line 43493 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
43493 :
43494 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
43495 : void
43496 5342 : SgOmpNotinbranchClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
43497 : {
43498 : // This function traverses the memory pool for only a specific IR node
43499 : // and calls the visit function of the input class execute a traversal
43500 : // similar to the style of the attribute based traversals within ROSE.
43501 : // This traversal will visit ALL nodes of the AST where as the other
43502 : // attribute based traversals visit only the embedded tree within the AST.
43503 :
43504 : // Initialize array to the address of the first element of the STL vector
43505 : // (which is guaranteed to be contiguous storage).
43506 : // SgOmpNotinbranchClause objectArray [] = *(Memory_Block_List.begin());
43507 5342 : if (SgOmpNotinbranchClause::pools.empty() == false)
43508 : {
43509 : // Generate an array of memory pools
43510 0 : SgOmpNotinbranchClause** objectArray = (SgOmpNotinbranchClause**) &(SgOmpNotinbranchClause::pools[0]);
43511 :
43512 : // Build a local variable for better performance
43513 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
43514 : #if 0
43515 : // Iterate over the memory pools
43516 : for (unsigned int i=0; i < SgOmpNotinbranchClause::pools.size(); i++)
43517 : {
43518 : // objectArray[i] is a single memory pool
43519 : for (int j=0; j < SgOmpNotinbranchClause::pool_size; j++)
43520 : {
43521 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
43522 : {
43523 : traversal.visit(&(objectArray[i][j]));
43524 : }
43525 : }
43526 : }
43527 : #else
43528 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
43529 : // compute the list first and then call the visit function on each list element.
43530 :
43531 : // printf ("Inside of SgOmpNotinbranchClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
43532 :
43533 0 : std::vector<SgOmpNotinbranchClause*> nodeList;
43534 :
43535 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
43536 0 : for (unsigned int i=0; i < SgOmpNotinbranchClause::pools.size(); i++)
43537 : {
43538 : // objectArray[i] is a single memory pool
43539 0 : for (unsigned j=0; j < SgOmpNotinbranchClause::pool_size; j++)
43540 : {
43541 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
43542 : {
43543 0 : nodeList.push_back(&(objectArray[i][j]));
43544 : }
43545 : }
43546 : }
43547 :
43548 : // Iterate over the saved list
43549 0 : size_t nodeListSize = nodeList.size();
43550 0 : for (size_t i=0; i < nodeListSize; i++)
43551 : {
43552 0 : ROSE_ASSERT(nodeList[i] != NULL);
43553 : #if 0
43554 : traversal.visit(nodeList[i]);
43555 : #else
43556 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
43557 : {
43558 0 : traversal.visit(nodeList[i]);
43559 : }
43560 : #endif
43561 : }
43562 : #endif
43563 : }
43564 :
43565 : // This should not be required since all previously static data members are
43566 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
43567 :
43568 5342 : }
43569 :
43570 :
43571 : void
43572 194 : SgOmpNotinbranchClause::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
43573 : {
43574 : // This function traverses the memory pool for an IR node and
43575 : // calls the function to execute the visitor object.
43576 :
43577 : // Initialize array to the address of the first element of the STL vector
43578 : // (which is guarenteed to be contiguous storage).
43579 : // SgOmpNotinbranchClause objectArray [] = *(Memory_Block_List.begin());
43580 194 : if (SgOmpNotinbranchClause::pools.empty() == false)
43581 : {
43582 : // Generate an array of memory pools
43583 0 : SgOmpNotinbranchClause** objectArray = (SgOmpNotinbranchClause**) &(SgOmpNotinbranchClause::pools[0]);
43584 :
43585 : // Build a local variable for better performance
43586 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
43587 :
43588 : // Iterate over the memory pools
43589 0 : for (unsigned int i=0; i < SgOmpNotinbranchClause::pools.size(); i++)
43590 : {
43591 : // objectArray[i] is a single memory pool
43592 0 : for (unsigned j=0; j < SgOmpNotinbranchClause::pool_size; j++)
43593 : {
43594 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
43595 : {
43596 : // printf ("Found a valid SgOmpNotinbranchClause object in the memory pool %d at position %d \n",i,j);
43597 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
43598 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
43599 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
43600 : }
43601 : else
43602 : {
43603 : // printf ("Found a INVALID SgOmpNotinbranchClause object in the memory pool \n");
43604 : }
43605 : }
43606 : }
43607 : }
43608 :
43609 : // This should not be required since all previously static data members are
43610 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
43611 :
43612 194 : }
43613 :
43614 : void
43615 0 : SgOmpNotinbranchClause::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
43616 : {
43617 : // This function visits only a single IR node of the memory pool.
43618 : // it is typically called once for each type of IR node within
43619 : // the automatically generated function: traverseRepresentativeNodes().
43620 :
43621 : // Initialize array to the address of the first element of the STL vector
43622 : // (which is guarenteed to be contiguous storage).
43623 : // SgOmpNotinbranchClause objectArray [] = *(Memory_Block_List.begin());
43624 0 : if (SgOmpNotinbranchClause::pools.empty() == false)
43625 : {
43626 : // Generate an array of memory pools
43627 0 : SgOmpNotinbranchClause** objectArray = (SgOmpNotinbranchClause**) &(SgOmpNotinbranchClause::pools[0]);
43628 :
43629 : // Build a local variable for better performance
43630 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
43631 :
43632 : // Iterate over the memory pools
43633 0 : bool done = false;
43634 0 : unsigned i=0;
43635 :
43636 : // find the first valid IR node, call visit function, and then leave
43637 0 : while ( done == false && i < SgOmpNotinbranchClause::pools.size() )
43638 : {
43639 : // objectArray[i] is a single memory pool
43640 : unsigned j=0;
43641 0 : while (done == false && j < SgOmpNotinbranchClause::pool_size)
43642 : {
43643 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
43644 : {
43645 0 : traversal.visit(&(objectArray[i][j]));
43646 0 : done = true;
43647 : }
43648 0 : j++;
43649 : }
43650 0 : i++;
43651 : }
43652 :
43653 : #if 0
43654 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
43655 : if (done == false)
43656 : {
43657 : printf ("No representative for SgOmpNotinbranchClause found in memory pools \n");
43658 : }
43659 : #endif
43660 : }
43661 0 : }
43662 :
43663 :
43664 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
43665 : // using values that overflow signed values of int.
43666 : size_t
43667 4 : SgOmpNotinbranchClause::numberOfNodes()
43668 : {
43669 : // This function traverses the memory pool for an IR node and
43670 : // counts the number of IR nodes of a particular Sage III IR
43671 : // nodes type.
43672 :
43673 4 : size_t count = 0;
43674 4 : if (SgOmpNotinbranchClause::pools.empty() == false)
43675 : {
43676 : // Generate an array of memory pools (this is actually a STL vector,
43677 : // but it is contiguious, so OK to treat this way).
43678 0 : SgOmpNotinbranchClause** objectArray = (SgOmpNotinbranchClause**) &(SgOmpNotinbranchClause::pools[0]);
43679 :
43680 : // Build a local variable for better performance (make it a loop invariant variable).
43681 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
43682 :
43683 : // Iterate over all of the memory pools for this IR node.
43684 0 : for (unsigned int i=0; i < SgOmpNotinbranchClause::pools.size(); i++)
43685 : {
43686 : // objectArray[i] is a single memory pool, iterate over all the
43687 : // IR nodes and only count those that are valid IR nodes used in
43688 : // the AST (i.e. allocated IR nodes).
43689 0 : for (unsigned j=0; j < SgOmpNotinbranchClause::pool_size; j++)
43690 : {
43691 : // This is indexing the STL vector of C/C++ style arrays as a doubly
43692 : // indexed array access. It is OK since we have leveraged the semantics
43693 : // of STL vector memory as contigous and cast the memory as an array
43694 : // of arrays to use the 2D array indexing. Hope this is not confusing,
43695 : // but it s very fast as an implementation.
43696 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
43697 : {
43698 0 : count++;
43699 : }
43700 : }
43701 : }
43702 : }
43703 :
43704 :
43705 :
43706 4 : return count;
43707 : }
43708 :
43709 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
43710 : // using values that overflow signed values of int.
43711 : size_t
43712 0 : SgOmpNotinbranchClause::memoryUsage()
43713 : {
43714 : // This function is required because we need the class name as a type when we call sizeof
43715 : // There might be another way to implement this if we have a traversal that only called a
43716 : // representative object (one call for each type of Sage IIIIR node).
43717 0 : size_t memory = numberOfNodes() * sizeof(SgOmpNotinbranchClause);
43718 :
43719 0 : return memory;
43720 : }
43721 :
43722 : /* #line 43723 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
43723 :
43724 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
43725 : void
43726 5342 : SgOmpDefaultmapClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
43727 : {
43728 : // This function traverses the memory pool for only a specific IR node
43729 : // and calls the visit function of the input class execute a traversal
43730 : // similar to the style of the attribute based traversals within ROSE.
43731 : // This traversal will visit ALL nodes of the AST where as the other
43732 : // attribute based traversals visit only the embedded tree within the AST.
43733 :
43734 : // Initialize array to the address of the first element of the STL vector
43735 : // (which is guaranteed to be contiguous storage).
43736 : // SgOmpDefaultmapClause objectArray [] = *(Memory_Block_List.begin());
43737 5342 : if (SgOmpDefaultmapClause::pools.empty() == false)
43738 : {
43739 : // Generate an array of memory pools
43740 7 : SgOmpDefaultmapClause** objectArray = (SgOmpDefaultmapClause**) &(SgOmpDefaultmapClause::pools[0]);
43741 :
43742 : // Build a local variable for better performance
43743 7 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
43744 : #if 0
43745 : // Iterate over the memory pools
43746 : for (unsigned int i=0; i < SgOmpDefaultmapClause::pools.size(); i++)
43747 : {
43748 : // objectArray[i] is a single memory pool
43749 : for (int j=0; j < SgOmpDefaultmapClause::pool_size; j++)
43750 : {
43751 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
43752 : {
43753 : traversal.visit(&(objectArray[i][j]));
43754 : }
43755 : }
43756 : }
43757 : #else
43758 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
43759 : // compute the list first and then call the visit function on each list element.
43760 :
43761 : // printf ("Inside of SgOmpDefaultmapClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
43762 :
43763 14 : std::vector<SgOmpDefaultmapClause*> nodeList;
43764 :
43765 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
43766 14 : for (unsigned int i=0; i < SgOmpDefaultmapClause::pools.size(); i++)
43767 : {
43768 : // objectArray[i] is a single memory pool
43769 14007 : for (unsigned j=0; j < SgOmpDefaultmapClause::pool_size; j++)
43770 : {
43771 14000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
43772 : {
43773 7 : nodeList.push_back(&(objectArray[i][j]));
43774 : }
43775 : }
43776 : }
43777 :
43778 : // Iterate over the saved list
43779 7 : size_t nodeListSize = nodeList.size();
43780 14 : for (size_t i=0; i < nodeListSize; i++)
43781 : {
43782 7 : ROSE_ASSERT(nodeList[i] != NULL);
43783 : #if 0
43784 : traversal.visit(nodeList[i]);
43785 : #else
43786 7 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
43787 : {
43788 7 : traversal.visit(nodeList[i]);
43789 : }
43790 : #endif
43791 : }
43792 : #endif
43793 : }
43794 :
43795 : // This should not be required since all previously static data members are
43796 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
43797 :
43798 5342 : }
43799 :
43800 :
43801 : void
43802 194 : SgOmpDefaultmapClause::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
43803 : {
43804 : // This function traverses the memory pool for an IR node and
43805 : // calls the function to execute the visitor object.
43806 :
43807 : // Initialize array to the address of the first element of the STL vector
43808 : // (which is guarenteed to be contiguous storage).
43809 : // SgOmpDefaultmapClause objectArray [] = *(Memory_Block_List.begin());
43810 194 : if (SgOmpDefaultmapClause::pools.empty() == false)
43811 : {
43812 : // Generate an array of memory pools
43813 0 : SgOmpDefaultmapClause** objectArray = (SgOmpDefaultmapClause**) &(SgOmpDefaultmapClause::pools[0]);
43814 :
43815 : // Build a local variable for better performance
43816 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
43817 :
43818 : // Iterate over the memory pools
43819 0 : for (unsigned int i=0; i < SgOmpDefaultmapClause::pools.size(); i++)
43820 : {
43821 : // objectArray[i] is a single memory pool
43822 0 : for (unsigned j=0; j < SgOmpDefaultmapClause::pool_size; j++)
43823 : {
43824 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
43825 : {
43826 : // printf ("Found a valid SgOmpDefaultmapClause object in the memory pool %d at position %d \n",i,j);
43827 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
43828 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
43829 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
43830 : }
43831 : else
43832 : {
43833 : // printf ("Found a INVALID SgOmpDefaultmapClause object in the memory pool \n");
43834 : }
43835 : }
43836 : }
43837 : }
43838 :
43839 : // This should not be required since all previously static data members are
43840 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
43841 :
43842 194 : }
43843 :
43844 : void
43845 0 : SgOmpDefaultmapClause::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
43846 : {
43847 : // This function visits only a single IR node of the memory pool.
43848 : // it is typically called once for each type of IR node within
43849 : // the automatically generated function: traverseRepresentativeNodes().
43850 :
43851 : // Initialize array to the address of the first element of the STL vector
43852 : // (which is guarenteed to be contiguous storage).
43853 : // SgOmpDefaultmapClause objectArray [] = *(Memory_Block_List.begin());
43854 0 : if (SgOmpDefaultmapClause::pools.empty() == false)
43855 : {
43856 : // Generate an array of memory pools
43857 0 : SgOmpDefaultmapClause** objectArray = (SgOmpDefaultmapClause**) &(SgOmpDefaultmapClause::pools[0]);
43858 :
43859 : // Build a local variable for better performance
43860 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
43861 :
43862 : // Iterate over the memory pools
43863 0 : bool done = false;
43864 0 : unsigned i=0;
43865 :
43866 : // find the first valid IR node, call visit function, and then leave
43867 0 : while ( done == false && i < SgOmpDefaultmapClause::pools.size() )
43868 : {
43869 : // objectArray[i] is a single memory pool
43870 : unsigned j=0;
43871 0 : while (done == false && j < SgOmpDefaultmapClause::pool_size)
43872 : {
43873 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
43874 : {
43875 0 : traversal.visit(&(objectArray[i][j]));
43876 0 : done = true;
43877 : }
43878 0 : j++;
43879 : }
43880 0 : i++;
43881 : }
43882 :
43883 : #if 0
43884 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
43885 : if (done == false)
43886 : {
43887 : printf ("No representative for SgOmpDefaultmapClause found in memory pools \n");
43888 : }
43889 : #endif
43890 : }
43891 0 : }
43892 :
43893 :
43894 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
43895 : // using values that overflow signed values of int.
43896 : size_t
43897 4 : SgOmpDefaultmapClause::numberOfNodes()
43898 : {
43899 : // This function traverses the memory pool for an IR node and
43900 : // counts the number of IR nodes of a particular Sage III IR
43901 : // nodes type.
43902 :
43903 4 : size_t count = 0;
43904 4 : if (SgOmpDefaultmapClause::pools.empty() == false)
43905 : {
43906 : // Generate an array of memory pools (this is actually a STL vector,
43907 : // but it is contiguious, so OK to treat this way).
43908 0 : SgOmpDefaultmapClause** objectArray = (SgOmpDefaultmapClause**) &(SgOmpDefaultmapClause::pools[0]);
43909 :
43910 : // Build a local variable for better performance (make it a loop invariant variable).
43911 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
43912 :
43913 : // Iterate over all of the memory pools for this IR node.
43914 0 : for (unsigned int i=0; i < SgOmpDefaultmapClause::pools.size(); i++)
43915 : {
43916 : // objectArray[i] is a single memory pool, iterate over all the
43917 : // IR nodes and only count those that are valid IR nodes used in
43918 : // the AST (i.e. allocated IR nodes).
43919 0 : for (unsigned j=0; j < SgOmpDefaultmapClause::pool_size; j++)
43920 : {
43921 : // This is indexing the STL vector of C/C++ style arrays as a doubly
43922 : // indexed array access. It is OK since we have leveraged the semantics
43923 : // of STL vector memory as contigous and cast the memory as an array
43924 : // of arrays to use the 2D array indexing. Hope this is not confusing,
43925 : // but it s very fast as an implementation.
43926 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
43927 : {
43928 0 : count++;
43929 : }
43930 : }
43931 : }
43932 : }
43933 :
43934 :
43935 :
43936 4 : return count;
43937 : }
43938 :
43939 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
43940 : // using values that overflow signed values of int.
43941 : size_t
43942 0 : SgOmpDefaultmapClause::memoryUsage()
43943 : {
43944 : // This function is required because we need the class name as a type when we call sizeof
43945 : // There might be another way to implement this if we have a traversal that only called a
43946 : // representative object (one call for each type of Sage IIIIR node).
43947 0 : size_t memory = numberOfNodes() * sizeof(SgOmpDefaultmapClause);
43948 :
43949 0 : return memory;
43950 : }
43951 :
43952 : /* #line 43953 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
43953 :
43954 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
43955 : void
43956 5342 : SgOmpAtomicDefaultMemOrderClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
43957 : {
43958 : // This function traverses the memory pool for only a specific IR node
43959 : // and calls the visit function of the input class execute a traversal
43960 : // similar to the style of the attribute based traversals within ROSE.
43961 : // This traversal will visit ALL nodes of the AST where as the other
43962 : // attribute based traversals visit only the embedded tree within the AST.
43963 :
43964 : // Initialize array to the address of the first element of the STL vector
43965 : // (which is guaranteed to be contiguous storage).
43966 : // SgOmpAtomicDefaultMemOrderClause objectArray [] = *(Memory_Block_List.begin());
43967 5342 : if (SgOmpAtomicDefaultMemOrderClause::pools.empty() == false)
43968 : {
43969 : // Generate an array of memory pools
43970 7 : SgOmpAtomicDefaultMemOrderClause** objectArray = (SgOmpAtomicDefaultMemOrderClause**) &(SgOmpAtomicDefaultMemOrderClause::pools[0]);
43971 :
43972 : // Build a local variable for better performance
43973 7 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
43974 : #if 0
43975 : // Iterate over the memory pools
43976 : for (unsigned int i=0; i < SgOmpAtomicDefaultMemOrderClause::pools.size(); i++)
43977 : {
43978 : // objectArray[i] is a single memory pool
43979 : for (int j=0; j < SgOmpAtomicDefaultMemOrderClause::pool_size; j++)
43980 : {
43981 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
43982 : {
43983 : traversal.visit(&(objectArray[i][j]));
43984 : }
43985 : }
43986 : }
43987 : #else
43988 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
43989 : // compute the list first and then call the visit function on each list element.
43990 :
43991 : // printf ("Inside of SgOmpAtomicDefaultMemOrderClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
43992 :
43993 14 : std::vector<SgOmpAtomicDefaultMemOrderClause*> nodeList;
43994 :
43995 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
43996 14 : for (unsigned int i=0; i < SgOmpAtomicDefaultMemOrderClause::pools.size(); i++)
43997 : {
43998 : // objectArray[i] is a single memory pool
43999 14007 : for (unsigned j=0; j < SgOmpAtomicDefaultMemOrderClause::pool_size; j++)
44000 : {
44001 14000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
44002 : {
44003 7 : nodeList.push_back(&(objectArray[i][j]));
44004 : }
44005 : }
44006 : }
44007 :
44008 : // Iterate over the saved list
44009 7 : size_t nodeListSize = nodeList.size();
44010 14 : for (size_t i=0; i < nodeListSize; i++)
44011 : {
44012 7 : ROSE_ASSERT(nodeList[i] != NULL);
44013 : #if 0
44014 : traversal.visit(nodeList[i]);
44015 : #else
44016 7 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
44017 : {
44018 7 : traversal.visit(nodeList[i]);
44019 : }
44020 : #endif
44021 : }
44022 : #endif
44023 : }
44024 :
44025 : // This should not be required since all previously static data members are
44026 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
44027 :
44028 5342 : }
44029 :
44030 :
44031 : void
44032 194 : SgOmpAtomicDefaultMemOrderClause::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
44033 : {
44034 : // This function traverses the memory pool for an IR node and
44035 : // calls the function to execute the visitor object.
44036 :
44037 : // Initialize array to the address of the first element of the STL vector
44038 : // (which is guarenteed to be contiguous storage).
44039 : // SgOmpAtomicDefaultMemOrderClause objectArray [] = *(Memory_Block_List.begin());
44040 194 : if (SgOmpAtomicDefaultMemOrderClause::pools.empty() == false)
44041 : {
44042 : // Generate an array of memory pools
44043 0 : SgOmpAtomicDefaultMemOrderClause** objectArray = (SgOmpAtomicDefaultMemOrderClause**) &(SgOmpAtomicDefaultMemOrderClause::pools[0]);
44044 :
44045 : // Build a local variable for better performance
44046 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
44047 :
44048 : // Iterate over the memory pools
44049 0 : for (unsigned int i=0; i < SgOmpAtomicDefaultMemOrderClause::pools.size(); i++)
44050 : {
44051 : // objectArray[i] is a single memory pool
44052 0 : for (unsigned j=0; j < SgOmpAtomicDefaultMemOrderClause::pool_size; j++)
44053 : {
44054 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
44055 : {
44056 : // printf ("Found a valid SgOmpAtomicDefaultMemOrderClause object in the memory pool %d at position %d \n",i,j);
44057 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
44058 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
44059 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
44060 : }
44061 : else
44062 : {
44063 : // printf ("Found a INVALID SgOmpAtomicDefaultMemOrderClause object in the memory pool \n");
44064 : }
44065 : }
44066 : }
44067 : }
44068 :
44069 : // This should not be required since all previously static data members are
44070 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
44071 :
44072 194 : }
44073 :
44074 : void
44075 0 : SgOmpAtomicDefaultMemOrderClause::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
44076 : {
44077 : // This function visits only a single IR node of the memory pool.
44078 : // it is typically called once for each type of IR node within
44079 : // the automatically generated function: traverseRepresentativeNodes().
44080 :
44081 : // Initialize array to the address of the first element of the STL vector
44082 : // (which is guarenteed to be contiguous storage).
44083 : // SgOmpAtomicDefaultMemOrderClause objectArray [] = *(Memory_Block_List.begin());
44084 0 : if (SgOmpAtomicDefaultMemOrderClause::pools.empty() == false)
44085 : {
44086 : // Generate an array of memory pools
44087 0 : SgOmpAtomicDefaultMemOrderClause** objectArray = (SgOmpAtomicDefaultMemOrderClause**) &(SgOmpAtomicDefaultMemOrderClause::pools[0]);
44088 :
44089 : // Build a local variable for better performance
44090 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
44091 :
44092 : // Iterate over the memory pools
44093 0 : bool done = false;
44094 0 : unsigned i=0;
44095 :
44096 : // find the first valid IR node, call visit function, and then leave
44097 0 : while ( done == false && i < SgOmpAtomicDefaultMemOrderClause::pools.size() )
44098 : {
44099 : // objectArray[i] is a single memory pool
44100 : unsigned j=0;
44101 0 : while (done == false && j < SgOmpAtomicDefaultMemOrderClause::pool_size)
44102 : {
44103 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
44104 : {
44105 0 : traversal.visit(&(objectArray[i][j]));
44106 0 : done = true;
44107 : }
44108 0 : j++;
44109 : }
44110 0 : i++;
44111 : }
44112 :
44113 : #if 0
44114 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
44115 : if (done == false)
44116 : {
44117 : printf ("No representative for SgOmpAtomicDefaultMemOrderClause found in memory pools \n");
44118 : }
44119 : #endif
44120 : }
44121 0 : }
44122 :
44123 :
44124 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
44125 : // using values that overflow signed values of int.
44126 : size_t
44127 4 : SgOmpAtomicDefaultMemOrderClause::numberOfNodes()
44128 : {
44129 : // This function traverses the memory pool for an IR node and
44130 : // counts the number of IR nodes of a particular Sage III IR
44131 : // nodes type.
44132 :
44133 4 : size_t count = 0;
44134 4 : if (SgOmpAtomicDefaultMemOrderClause::pools.empty() == false)
44135 : {
44136 : // Generate an array of memory pools (this is actually a STL vector,
44137 : // but it is contiguious, so OK to treat this way).
44138 0 : SgOmpAtomicDefaultMemOrderClause** objectArray = (SgOmpAtomicDefaultMemOrderClause**) &(SgOmpAtomicDefaultMemOrderClause::pools[0]);
44139 :
44140 : // Build a local variable for better performance (make it a loop invariant variable).
44141 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
44142 :
44143 : // Iterate over all of the memory pools for this IR node.
44144 0 : for (unsigned int i=0; i < SgOmpAtomicDefaultMemOrderClause::pools.size(); i++)
44145 : {
44146 : // objectArray[i] is a single memory pool, iterate over all the
44147 : // IR nodes and only count those that are valid IR nodes used in
44148 : // the AST (i.e. allocated IR nodes).
44149 0 : for (unsigned j=0; j < SgOmpAtomicDefaultMemOrderClause::pool_size; j++)
44150 : {
44151 : // This is indexing the STL vector of C/C++ style arrays as a doubly
44152 : // indexed array access. It is OK since we have leveraged the semantics
44153 : // of STL vector memory as contigous and cast the memory as an array
44154 : // of arrays to use the 2D array indexing. Hope this is not confusing,
44155 : // but it s very fast as an implementation.
44156 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
44157 : {
44158 0 : count++;
44159 : }
44160 : }
44161 : }
44162 : }
44163 :
44164 :
44165 :
44166 4 : return count;
44167 : }
44168 :
44169 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
44170 : // using values that overflow signed values of int.
44171 : size_t
44172 0 : SgOmpAtomicDefaultMemOrderClause::memoryUsage()
44173 : {
44174 : // This function is required because we need the class name as a type when we call sizeof
44175 : // There might be another way to implement this if we have a traversal that only called a
44176 : // representative object (one call for each type of Sage IIIIR node).
44177 0 : size_t memory = numberOfNodes() * sizeof(SgOmpAtomicDefaultMemOrderClause);
44178 :
44179 0 : return memory;
44180 : }
44181 :
44182 : /* #line 44183 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
44183 :
44184 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
44185 : void
44186 5342 : SgOmpExtImplementationDefinedRequirementClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
44187 : {
44188 : // This function traverses the memory pool for only a specific IR node
44189 : // and calls the visit function of the input class execute a traversal
44190 : // similar to the style of the attribute based traversals within ROSE.
44191 : // This traversal will visit ALL nodes of the AST where as the other
44192 : // attribute based traversals visit only the embedded tree within the AST.
44193 :
44194 : // Initialize array to the address of the first element of the STL vector
44195 : // (which is guaranteed to be contiguous storage).
44196 : // SgOmpExtImplementationDefinedRequirementClause objectArray [] = *(Memory_Block_List.begin());
44197 5342 : if (SgOmpExtImplementationDefinedRequirementClause::pools.empty() == false)
44198 : {
44199 : // Generate an array of memory pools
44200 7 : SgOmpExtImplementationDefinedRequirementClause** objectArray = (SgOmpExtImplementationDefinedRequirementClause**) &(SgOmpExtImplementationDefinedRequirementClause::pools[0]);
44201 :
44202 : // Build a local variable for better performance
44203 7 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
44204 : #if 0
44205 : // Iterate over the memory pools
44206 : for (unsigned int i=0; i < SgOmpExtImplementationDefinedRequirementClause::pools.size(); i++)
44207 : {
44208 : // objectArray[i] is a single memory pool
44209 : for (int j=0; j < SgOmpExtImplementationDefinedRequirementClause::pool_size; j++)
44210 : {
44211 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
44212 : {
44213 : traversal.visit(&(objectArray[i][j]));
44214 : }
44215 : }
44216 : }
44217 : #else
44218 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
44219 : // compute the list first and then call the visit function on each list element.
44220 :
44221 : // printf ("Inside of SgOmpExtImplementationDefinedRequirementClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
44222 :
44223 14 : std::vector<SgOmpExtImplementationDefinedRequirementClause*> nodeList;
44224 :
44225 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
44226 14 : for (unsigned int i=0; i < SgOmpExtImplementationDefinedRequirementClause::pools.size(); i++)
44227 : {
44228 : // objectArray[i] is a single memory pool
44229 14007 : for (unsigned j=0; j < SgOmpExtImplementationDefinedRequirementClause::pool_size; j++)
44230 : {
44231 14000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
44232 : {
44233 14 : nodeList.push_back(&(objectArray[i][j]));
44234 : }
44235 : }
44236 : }
44237 :
44238 : // Iterate over the saved list
44239 7 : size_t nodeListSize = nodeList.size();
44240 21 : for (size_t i=0; i < nodeListSize; i++)
44241 : {
44242 14 : ROSE_ASSERT(nodeList[i] != NULL);
44243 : #if 0
44244 : traversal.visit(nodeList[i]);
44245 : #else
44246 14 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
44247 : {
44248 14 : traversal.visit(nodeList[i]);
44249 : }
44250 : #endif
44251 : }
44252 : #endif
44253 : }
44254 :
44255 : // This should not be required since all previously static data members are
44256 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
44257 :
44258 5342 : }
44259 :
44260 :
44261 : void
44262 194 : SgOmpExtImplementationDefinedRequirementClause::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
44263 : {
44264 : // This function traverses the memory pool for an IR node and
44265 : // calls the function to execute the visitor object.
44266 :
44267 : // Initialize array to the address of the first element of the STL vector
44268 : // (which is guarenteed to be contiguous storage).
44269 : // SgOmpExtImplementationDefinedRequirementClause objectArray [] = *(Memory_Block_List.begin());
44270 194 : if (SgOmpExtImplementationDefinedRequirementClause::pools.empty() == false)
44271 : {
44272 : // Generate an array of memory pools
44273 0 : SgOmpExtImplementationDefinedRequirementClause** objectArray = (SgOmpExtImplementationDefinedRequirementClause**) &(SgOmpExtImplementationDefinedRequirementClause::pools[0]);
44274 :
44275 : // Build a local variable for better performance
44276 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
44277 :
44278 : // Iterate over the memory pools
44279 0 : for (unsigned int i=0; i < SgOmpExtImplementationDefinedRequirementClause::pools.size(); i++)
44280 : {
44281 : // objectArray[i] is a single memory pool
44282 0 : for (unsigned j=0; j < SgOmpExtImplementationDefinedRequirementClause::pool_size; j++)
44283 : {
44284 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
44285 : {
44286 : // printf ("Found a valid SgOmpExtImplementationDefinedRequirementClause object in the memory pool %d at position %d \n",i,j);
44287 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
44288 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
44289 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
44290 : }
44291 : else
44292 : {
44293 : // printf ("Found a INVALID SgOmpExtImplementationDefinedRequirementClause object in the memory pool \n");
44294 : }
44295 : }
44296 : }
44297 : }
44298 :
44299 : // This should not be required since all previously static data members are
44300 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
44301 :
44302 194 : }
44303 :
44304 : void
44305 0 : SgOmpExtImplementationDefinedRequirementClause::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
44306 : {
44307 : // This function visits only a single IR node of the memory pool.
44308 : // it is typically called once for each type of IR node within
44309 : // the automatically generated function: traverseRepresentativeNodes().
44310 :
44311 : // Initialize array to the address of the first element of the STL vector
44312 : // (which is guarenteed to be contiguous storage).
44313 : // SgOmpExtImplementationDefinedRequirementClause objectArray [] = *(Memory_Block_List.begin());
44314 0 : if (SgOmpExtImplementationDefinedRequirementClause::pools.empty() == false)
44315 : {
44316 : // Generate an array of memory pools
44317 0 : SgOmpExtImplementationDefinedRequirementClause** objectArray = (SgOmpExtImplementationDefinedRequirementClause**) &(SgOmpExtImplementationDefinedRequirementClause::pools[0]);
44318 :
44319 : // Build a local variable for better performance
44320 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
44321 :
44322 : // Iterate over the memory pools
44323 0 : bool done = false;
44324 0 : unsigned i=0;
44325 :
44326 : // find the first valid IR node, call visit function, and then leave
44327 0 : while ( done == false && i < SgOmpExtImplementationDefinedRequirementClause::pools.size() )
44328 : {
44329 : // objectArray[i] is a single memory pool
44330 : unsigned j=0;
44331 0 : while (done == false && j < SgOmpExtImplementationDefinedRequirementClause::pool_size)
44332 : {
44333 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
44334 : {
44335 0 : traversal.visit(&(objectArray[i][j]));
44336 0 : done = true;
44337 : }
44338 0 : j++;
44339 : }
44340 0 : i++;
44341 : }
44342 :
44343 : #if 0
44344 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
44345 : if (done == false)
44346 : {
44347 : printf ("No representative for SgOmpExtImplementationDefinedRequirementClause found in memory pools \n");
44348 : }
44349 : #endif
44350 : }
44351 0 : }
44352 :
44353 :
44354 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
44355 : // using values that overflow signed values of int.
44356 : size_t
44357 4 : SgOmpExtImplementationDefinedRequirementClause::numberOfNodes()
44358 : {
44359 : // This function traverses the memory pool for an IR node and
44360 : // counts the number of IR nodes of a particular Sage III IR
44361 : // nodes type.
44362 :
44363 4 : size_t count = 0;
44364 4 : if (SgOmpExtImplementationDefinedRequirementClause::pools.empty() == false)
44365 : {
44366 : // Generate an array of memory pools (this is actually a STL vector,
44367 : // but it is contiguious, so OK to treat this way).
44368 0 : SgOmpExtImplementationDefinedRequirementClause** objectArray = (SgOmpExtImplementationDefinedRequirementClause**) &(SgOmpExtImplementationDefinedRequirementClause::pools[0]);
44369 :
44370 : // Build a local variable for better performance (make it a loop invariant variable).
44371 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
44372 :
44373 : // Iterate over all of the memory pools for this IR node.
44374 0 : for (unsigned int i=0; i < SgOmpExtImplementationDefinedRequirementClause::pools.size(); i++)
44375 : {
44376 : // objectArray[i] is a single memory pool, iterate over all the
44377 : // IR nodes and only count those that are valid IR nodes used in
44378 : // the AST (i.e. allocated IR nodes).
44379 0 : for (unsigned j=0; j < SgOmpExtImplementationDefinedRequirementClause::pool_size; j++)
44380 : {
44381 : // This is indexing the STL vector of C/C++ style arrays as a doubly
44382 : // indexed array access. It is OK since we have leveraged the semantics
44383 : // of STL vector memory as contigous and cast the memory as an array
44384 : // of arrays to use the 2D array indexing. Hope this is not confusing,
44385 : // but it s very fast as an implementation.
44386 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
44387 : {
44388 0 : count++;
44389 : }
44390 : }
44391 : }
44392 : }
44393 :
44394 :
44395 :
44396 4 : return count;
44397 : }
44398 :
44399 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
44400 : // using values that overflow signed values of int.
44401 : size_t
44402 0 : SgOmpExtImplementationDefinedRequirementClause::memoryUsage()
44403 : {
44404 : // This function is required because we need the class name as a type when we call sizeof
44405 : // There might be another way to implement this if we have a traversal that only called a
44406 : // representative object (one call for each type of Sage IIIIR node).
44407 0 : size_t memory = numberOfNodes() * sizeof(SgOmpExtImplementationDefinedRequirementClause);
44408 :
44409 0 : return memory;
44410 : }
44411 :
44412 : /* #line 44413 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
44413 :
44414 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
44415 : void
44416 5342 : SgOmpUsesAllocatorsDefination::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
44417 : {
44418 : // This function traverses the memory pool for only a specific IR node
44419 : // and calls the visit function of the input class execute a traversal
44420 : // similar to the style of the attribute based traversals within ROSE.
44421 : // This traversal will visit ALL nodes of the AST where as the other
44422 : // attribute based traversals visit only the embedded tree within the AST.
44423 :
44424 : // Initialize array to the address of the first element of the STL vector
44425 : // (which is guaranteed to be contiguous storage).
44426 : // SgOmpUsesAllocatorsDefination objectArray [] = *(Memory_Block_List.begin());
44427 5342 : if (SgOmpUsesAllocatorsDefination::pools.empty() == false)
44428 : {
44429 : // Generate an array of memory pools
44430 7 : SgOmpUsesAllocatorsDefination** objectArray = (SgOmpUsesAllocatorsDefination**) &(SgOmpUsesAllocatorsDefination::pools[0]);
44431 :
44432 : // Build a local variable for better performance
44433 7 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
44434 : #if 0
44435 : // Iterate over the memory pools
44436 : for (unsigned int i=0; i < SgOmpUsesAllocatorsDefination::pools.size(); i++)
44437 : {
44438 : // objectArray[i] is a single memory pool
44439 : for (int j=0; j < SgOmpUsesAllocatorsDefination::pool_size; j++)
44440 : {
44441 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
44442 : {
44443 : traversal.visit(&(objectArray[i][j]));
44444 : }
44445 : }
44446 : }
44447 : #else
44448 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
44449 : // compute the list first and then call the visit function on each list element.
44450 :
44451 : // printf ("Inside of SgOmpUsesAllocatorsDefination::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
44452 :
44453 14 : std::vector<SgOmpUsesAllocatorsDefination*> nodeList;
44454 :
44455 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
44456 14 : for (unsigned int i=0; i < SgOmpUsesAllocatorsDefination::pools.size(); i++)
44457 : {
44458 : // objectArray[i] is a single memory pool
44459 14007 : for (unsigned j=0; j < SgOmpUsesAllocatorsDefination::pool_size; j++)
44460 : {
44461 14000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
44462 : {
44463 14 : nodeList.push_back(&(objectArray[i][j]));
44464 : }
44465 : }
44466 : }
44467 :
44468 : // Iterate over the saved list
44469 7 : size_t nodeListSize = nodeList.size();
44470 21 : for (size_t i=0; i < nodeListSize; i++)
44471 : {
44472 14 : ROSE_ASSERT(nodeList[i] != NULL);
44473 : #if 0
44474 : traversal.visit(nodeList[i]);
44475 : #else
44476 14 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
44477 : {
44478 14 : traversal.visit(nodeList[i]);
44479 : }
44480 : #endif
44481 : }
44482 : #endif
44483 : }
44484 :
44485 : // This should not be required since all previously static data members are
44486 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
44487 :
44488 5342 : }
44489 :
44490 :
44491 : void
44492 194 : SgOmpUsesAllocatorsDefination::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
44493 : {
44494 : // This function traverses the memory pool for an IR node and
44495 : // calls the function to execute the visitor object.
44496 :
44497 : // Initialize array to the address of the first element of the STL vector
44498 : // (which is guarenteed to be contiguous storage).
44499 : // SgOmpUsesAllocatorsDefination objectArray [] = *(Memory_Block_List.begin());
44500 194 : if (SgOmpUsesAllocatorsDefination::pools.empty() == false)
44501 : {
44502 : // Generate an array of memory pools
44503 0 : SgOmpUsesAllocatorsDefination** objectArray = (SgOmpUsesAllocatorsDefination**) &(SgOmpUsesAllocatorsDefination::pools[0]);
44504 :
44505 : // Build a local variable for better performance
44506 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
44507 :
44508 : // Iterate over the memory pools
44509 0 : for (unsigned int i=0; i < SgOmpUsesAllocatorsDefination::pools.size(); i++)
44510 : {
44511 : // objectArray[i] is a single memory pool
44512 0 : for (unsigned j=0; j < SgOmpUsesAllocatorsDefination::pool_size; j++)
44513 : {
44514 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
44515 : {
44516 : // printf ("Found a valid SgOmpUsesAllocatorsDefination object in the memory pool %d at position %d \n",i,j);
44517 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
44518 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
44519 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
44520 : }
44521 : else
44522 : {
44523 : // printf ("Found a INVALID SgOmpUsesAllocatorsDefination object in the memory pool \n");
44524 : }
44525 : }
44526 : }
44527 : }
44528 :
44529 : // This should not be required since all previously static data members are
44530 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
44531 :
44532 194 : }
44533 :
44534 : void
44535 0 : SgOmpUsesAllocatorsDefination::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
44536 : {
44537 : // This function visits only a single IR node of the memory pool.
44538 : // it is typically called once for each type of IR node within
44539 : // the automatically generated function: traverseRepresentativeNodes().
44540 :
44541 : // Initialize array to the address of the first element of the STL vector
44542 : // (which is guarenteed to be contiguous storage).
44543 : // SgOmpUsesAllocatorsDefination objectArray [] = *(Memory_Block_List.begin());
44544 0 : if (SgOmpUsesAllocatorsDefination::pools.empty() == false)
44545 : {
44546 : // Generate an array of memory pools
44547 0 : SgOmpUsesAllocatorsDefination** objectArray = (SgOmpUsesAllocatorsDefination**) &(SgOmpUsesAllocatorsDefination::pools[0]);
44548 :
44549 : // Build a local variable for better performance
44550 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
44551 :
44552 : // Iterate over the memory pools
44553 0 : bool done = false;
44554 0 : unsigned i=0;
44555 :
44556 : // find the first valid IR node, call visit function, and then leave
44557 0 : while ( done == false && i < SgOmpUsesAllocatorsDefination::pools.size() )
44558 : {
44559 : // objectArray[i] is a single memory pool
44560 : unsigned j=0;
44561 0 : while (done == false && j < SgOmpUsesAllocatorsDefination::pool_size)
44562 : {
44563 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
44564 : {
44565 0 : traversal.visit(&(objectArray[i][j]));
44566 0 : done = true;
44567 : }
44568 0 : j++;
44569 : }
44570 0 : i++;
44571 : }
44572 :
44573 : #if 0
44574 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
44575 : if (done == false)
44576 : {
44577 : printf ("No representative for SgOmpUsesAllocatorsDefination found in memory pools \n");
44578 : }
44579 : #endif
44580 : }
44581 0 : }
44582 :
44583 :
44584 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
44585 : // using values that overflow signed values of int.
44586 : size_t
44587 4 : SgOmpUsesAllocatorsDefination::numberOfNodes()
44588 : {
44589 : // This function traverses the memory pool for an IR node and
44590 : // counts the number of IR nodes of a particular Sage III IR
44591 : // nodes type.
44592 :
44593 4 : size_t count = 0;
44594 4 : if (SgOmpUsesAllocatorsDefination::pools.empty() == false)
44595 : {
44596 : // Generate an array of memory pools (this is actually a STL vector,
44597 : // but it is contiguious, so OK to treat this way).
44598 0 : SgOmpUsesAllocatorsDefination** objectArray = (SgOmpUsesAllocatorsDefination**) &(SgOmpUsesAllocatorsDefination::pools[0]);
44599 :
44600 : // Build a local variable for better performance (make it a loop invariant variable).
44601 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
44602 :
44603 : // Iterate over all of the memory pools for this IR node.
44604 0 : for (unsigned int i=0; i < SgOmpUsesAllocatorsDefination::pools.size(); i++)
44605 : {
44606 : // objectArray[i] is a single memory pool, iterate over all the
44607 : // IR nodes and only count those that are valid IR nodes used in
44608 : // the AST (i.e. allocated IR nodes).
44609 0 : for (unsigned j=0; j < SgOmpUsesAllocatorsDefination::pool_size; j++)
44610 : {
44611 : // This is indexing the STL vector of C/C++ style arrays as a doubly
44612 : // indexed array access. It is OK since we have leveraged the semantics
44613 : // of STL vector memory as contigous and cast the memory as an array
44614 : // of arrays to use the 2D array indexing. Hope this is not confusing,
44615 : // but it s very fast as an implementation.
44616 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
44617 : {
44618 0 : count++;
44619 : }
44620 : }
44621 : }
44622 : }
44623 :
44624 :
44625 :
44626 4 : return count;
44627 : }
44628 :
44629 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
44630 : // using values that overflow signed values of int.
44631 : size_t
44632 0 : SgOmpUsesAllocatorsDefination::memoryUsage()
44633 : {
44634 : // This function is required because we need the class name as a type when we call sizeof
44635 : // There might be another way to implement this if we have a traversal that only called a
44636 : // representative object (one call for each type of Sage IIIIR node).
44637 0 : size_t memory = numberOfNodes() * sizeof(SgOmpUsesAllocatorsDefination);
44638 :
44639 0 : return memory;
44640 : }
44641 :
44642 : /* #line 44643 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
44643 :
44644 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
44645 : void
44646 5342 : SgOmpVariablesClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
44647 : {
44648 : // This function traverses the memory pool for only a specific IR node
44649 : // and calls the visit function of the input class execute a traversal
44650 : // similar to the style of the attribute based traversals within ROSE.
44651 : // This traversal will visit ALL nodes of the AST where as the other
44652 : // attribute based traversals visit only the embedded tree within the AST.
44653 :
44654 : // Initialize array to the address of the first element of the STL vector
44655 : // (which is guaranteed to be contiguous storage).
44656 : // SgOmpVariablesClause objectArray [] = *(Memory_Block_List.begin());
44657 5342 : if (SgOmpVariablesClause::pools.empty() == false)
44658 : {
44659 : // Generate an array of memory pools
44660 0 : SgOmpVariablesClause** objectArray = (SgOmpVariablesClause**) &(SgOmpVariablesClause::pools[0]);
44661 :
44662 : // Build a local variable for better performance
44663 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
44664 : #if 0
44665 : // Iterate over the memory pools
44666 : for (unsigned int i=0; i < SgOmpVariablesClause::pools.size(); i++)
44667 : {
44668 : // objectArray[i] is a single memory pool
44669 : for (int j=0; j < SgOmpVariablesClause::pool_size; j++)
44670 : {
44671 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
44672 : {
44673 : traversal.visit(&(objectArray[i][j]));
44674 : }
44675 : }
44676 : }
44677 : #else
44678 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
44679 : // compute the list first and then call the visit function on each list element.
44680 :
44681 : // printf ("Inside of SgOmpVariablesClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
44682 :
44683 0 : std::vector<SgOmpVariablesClause*> nodeList;
44684 :
44685 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
44686 0 : for (unsigned int i=0; i < SgOmpVariablesClause::pools.size(); i++)
44687 : {
44688 : // objectArray[i] is a single memory pool
44689 0 : for (unsigned j=0; j < SgOmpVariablesClause::pool_size; j++)
44690 : {
44691 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
44692 : {
44693 0 : nodeList.push_back(&(objectArray[i][j]));
44694 : }
44695 : }
44696 : }
44697 :
44698 : // Iterate over the saved list
44699 0 : size_t nodeListSize = nodeList.size();
44700 0 : for (size_t i=0; i < nodeListSize; i++)
44701 : {
44702 0 : ROSE_ASSERT(nodeList[i] != NULL);
44703 : #if 0
44704 : traversal.visit(nodeList[i]);
44705 : #else
44706 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
44707 : {
44708 0 : traversal.visit(nodeList[i]);
44709 : }
44710 : #endif
44711 : }
44712 : #endif
44713 : }
44714 :
44715 : // This should not be required since all previously static data members are
44716 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
44717 :
44718 5342 : }
44719 :
44720 :
44721 : void
44722 194 : SgOmpVariablesClause::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
44723 : {
44724 : // This function traverses the memory pool for an IR node and
44725 : // calls the function to execute the visitor object.
44726 :
44727 : // Initialize array to the address of the first element of the STL vector
44728 : // (which is guarenteed to be contiguous storage).
44729 : // SgOmpVariablesClause objectArray [] = *(Memory_Block_List.begin());
44730 194 : if (SgOmpVariablesClause::pools.empty() == false)
44731 : {
44732 : // Generate an array of memory pools
44733 0 : SgOmpVariablesClause** objectArray = (SgOmpVariablesClause**) &(SgOmpVariablesClause::pools[0]);
44734 :
44735 : // Build a local variable for better performance
44736 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
44737 :
44738 : // Iterate over the memory pools
44739 0 : for (unsigned int i=0; i < SgOmpVariablesClause::pools.size(); i++)
44740 : {
44741 : // objectArray[i] is a single memory pool
44742 0 : for (unsigned j=0; j < SgOmpVariablesClause::pool_size; j++)
44743 : {
44744 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
44745 : {
44746 : // printf ("Found a valid SgOmpVariablesClause object in the memory pool %d at position %d \n",i,j);
44747 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
44748 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
44749 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
44750 : }
44751 : else
44752 : {
44753 : // printf ("Found a INVALID SgOmpVariablesClause object in the memory pool \n");
44754 : }
44755 : }
44756 : }
44757 : }
44758 :
44759 : // This should not be required since all previously static data members are
44760 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
44761 :
44762 194 : }
44763 :
44764 : void
44765 0 : SgOmpVariablesClause::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
44766 : {
44767 : // This function visits only a single IR node of the memory pool.
44768 : // it is typically called once for each type of IR node within
44769 : // the automatically generated function: traverseRepresentativeNodes().
44770 :
44771 : // Initialize array to the address of the first element of the STL vector
44772 : // (which is guarenteed to be contiguous storage).
44773 : // SgOmpVariablesClause objectArray [] = *(Memory_Block_List.begin());
44774 0 : if (SgOmpVariablesClause::pools.empty() == false)
44775 : {
44776 : // Generate an array of memory pools
44777 0 : SgOmpVariablesClause** objectArray = (SgOmpVariablesClause**) &(SgOmpVariablesClause::pools[0]);
44778 :
44779 : // Build a local variable for better performance
44780 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
44781 :
44782 : // Iterate over the memory pools
44783 0 : bool done = false;
44784 0 : unsigned i=0;
44785 :
44786 : // find the first valid IR node, call visit function, and then leave
44787 0 : while ( done == false && i < SgOmpVariablesClause::pools.size() )
44788 : {
44789 : // objectArray[i] is a single memory pool
44790 : unsigned j=0;
44791 0 : while (done == false && j < SgOmpVariablesClause::pool_size)
44792 : {
44793 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
44794 : {
44795 0 : traversal.visit(&(objectArray[i][j]));
44796 0 : done = true;
44797 : }
44798 0 : j++;
44799 : }
44800 0 : i++;
44801 : }
44802 :
44803 : #if 0
44804 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
44805 : if (done == false)
44806 : {
44807 : printf ("No representative for SgOmpVariablesClause found in memory pools \n");
44808 : }
44809 : #endif
44810 : }
44811 0 : }
44812 :
44813 :
44814 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
44815 : // using values that overflow signed values of int.
44816 : size_t
44817 4 : SgOmpVariablesClause::numberOfNodes()
44818 : {
44819 : // This function traverses the memory pool for an IR node and
44820 : // counts the number of IR nodes of a particular Sage III IR
44821 : // nodes type.
44822 :
44823 4 : size_t count = 0;
44824 4 : if (SgOmpVariablesClause::pools.empty() == false)
44825 : {
44826 : // Generate an array of memory pools (this is actually a STL vector,
44827 : // but it is contiguious, so OK to treat this way).
44828 0 : SgOmpVariablesClause** objectArray = (SgOmpVariablesClause**) &(SgOmpVariablesClause::pools[0]);
44829 :
44830 : // Build a local variable for better performance (make it a loop invariant variable).
44831 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
44832 :
44833 : // Iterate over all of the memory pools for this IR node.
44834 0 : for (unsigned int i=0; i < SgOmpVariablesClause::pools.size(); i++)
44835 : {
44836 : // objectArray[i] is a single memory pool, iterate over all the
44837 : // IR nodes and only count those that are valid IR nodes used in
44838 : // the AST (i.e. allocated IR nodes).
44839 0 : for (unsigned j=0; j < SgOmpVariablesClause::pool_size; j++)
44840 : {
44841 : // This is indexing the STL vector of C/C++ style arrays as a doubly
44842 : // indexed array access. It is OK since we have leveraged the semantics
44843 : // of STL vector memory as contigous and cast the memory as an array
44844 : // of arrays to use the 2D array indexing. Hope this is not confusing,
44845 : // but it s very fast as an implementation.
44846 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
44847 : {
44848 0 : count++;
44849 : }
44850 : }
44851 : }
44852 : }
44853 :
44854 :
44855 :
44856 4 : return count;
44857 : }
44858 :
44859 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
44860 : // using values that overflow signed values of int.
44861 : size_t
44862 0 : SgOmpVariablesClause::memoryUsage()
44863 : {
44864 : // This function is required because we need the class name as a type when we call sizeof
44865 : // There might be another way to implement this if we have a traversal that only called a
44866 : // representative object (one call for each type of Sage IIIIR node).
44867 0 : size_t memory = numberOfNodes() * sizeof(SgOmpVariablesClause);
44868 :
44869 0 : return memory;
44870 : }
44871 :
44872 : /* #line 44873 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
44873 :
44874 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
44875 : void
44876 5342 : SgOmpCopyprivateClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
44877 : {
44878 : // This function traverses the memory pool for only a specific IR node
44879 : // and calls the visit function of the input class execute a traversal
44880 : // similar to the style of the attribute based traversals within ROSE.
44881 : // This traversal will visit ALL nodes of the AST where as the other
44882 : // attribute based traversals visit only the embedded tree within the AST.
44883 :
44884 : // Initialize array to the address of the first element of the STL vector
44885 : // (which is guaranteed to be contiguous storage).
44886 : // SgOmpCopyprivateClause objectArray [] = *(Memory_Block_List.begin());
44887 5342 : if (SgOmpCopyprivateClause::pools.empty() == false)
44888 : {
44889 : // Generate an array of memory pools
44890 42 : SgOmpCopyprivateClause** objectArray = (SgOmpCopyprivateClause**) &(SgOmpCopyprivateClause::pools[0]);
44891 :
44892 : // Build a local variable for better performance
44893 42 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
44894 : #if 0
44895 : // Iterate over the memory pools
44896 : for (unsigned int i=0; i < SgOmpCopyprivateClause::pools.size(); i++)
44897 : {
44898 : // objectArray[i] is a single memory pool
44899 : for (int j=0; j < SgOmpCopyprivateClause::pool_size; j++)
44900 : {
44901 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
44902 : {
44903 : traversal.visit(&(objectArray[i][j]));
44904 : }
44905 : }
44906 : }
44907 : #else
44908 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
44909 : // compute the list first and then call the visit function on each list element.
44910 :
44911 : // printf ("Inside of SgOmpCopyprivateClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
44912 :
44913 84 : std::vector<SgOmpCopyprivateClause*> nodeList;
44914 :
44915 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
44916 84 : for (unsigned int i=0; i < SgOmpCopyprivateClause::pools.size(); i++)
44917 : {
44918 : // objectArray[i] is a single memory pool
44919 84042 : for (unsigned j=0; j < SgOmpCopyprivateClause::pool_size; j++)
44920 : {
44921 84000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
44922 : {
44923 42 : nodeList.push_back(&(objectArray[i][j]));
44924 : }
44925 : }
44926 : }
44927 :
44928 : // Iterate over the saved list
44929 42 : size_t nodeListSize = nodeList.size();
44930 84 : for (size_t i=0; i < nodeListSize; i++)
44931 : {
44932 42 : ROSE_ASSERT(nodeList[i] != NULL);
44933 : #if 0
44934 : traversal.visit(nodeList[i]);
44935 : #else
44936 42 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
44937 : {
44938 42 : traversal.visit(nodeList[i]);
44939 : }
44940 : #endif
44941 : }
44942 : #endif
44943 : }
44944 :
44945 : // This should not be required since all previously static data members are
44946 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
44947 :
44948 5342 : }
44949 :
44950 :
44951 : void
44952 194 : SgOmpCopyprivateClause::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
44953 : {
44954 : // This function traverses the memory pool for an IR node and
44955 : // calls the function to execute the visitor object.
44956 :
44957 : // Initialize array to the address of the first element of the STL vector
44958 : // (which is guarenteed to be contiguous storage).
44959 : // SgOmpCopyprivateClause objectArray [] = *(Memory_Block_List.begin());
44960 194 : if (SgOmpCopyprivateClause::pools.empty() == false)
44961 : {
44962 : // Generate an array of memory pools
44963 0 : SgOmpCopyprivateClause** objectArray = (SgOmpCopyprivateClause**) &(SgOmpCopyprivateClause::pools[0]);
44964 :
44965 : // Build a local variable for better performance
44966 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
44967 :
44968 : // Iterate over the memory pools
44969 0 : for (unsigned int i=0; i < SgOmpCopyprivateClause::pools.size(); i++)
44970 : {
44971 : // objectArray[i] is a single memory pool
44972 0 : for (unsigned j=0; j < SgOmpCopyprivateClause::pool_size; j++)
44973 : {
44974 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
44975 : {
44976 : // printf ("Found a valid SgOmpCopyprivateClause object in the memory pool %d at position %d \n",i,j);
44977 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
44978 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
44979 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
44980 : }
44981 : else
44982 : {
44983 : // printf ("Found a INVALID SgOmpCopyprivateClause object in the memory pool \n");
44984 : }
44985 : }
44986 : }
44987 : }
44988 :
44989 : // This should not be required since all previously static data members are
44990 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
44991 :
44992 194 : }
44993 :
44994 : void
44995 0 : SgOmpCopyprivateClause::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
44996 : {
44997 : // This function visits only a single IR node of the memory pool.
44998 : // it is typically called once for each type of IR node within
44999 : // the automatically generated function: traverseRepresentativeNodes().
45000 :
45001 : // Initialize array to the address of the first element of the STL vector
45002 : // (which is guarenteed to be contiguous storage).
45003 : // SgOmpCopyprivateClause objectArray [] = *(Memory_Block_List.begin());
45004 0 : if (SgOmpCopyprivateClause::pools.empty() == false)
45005 : {
45006 : // Generate an array of memory pools
45007 0 : SgOmpCopyprivateClause** objectArray = (SgOmpCopyprivateClause**) &(SgOmpCopyprivateClause::pools[0]);
45008 :
45009 : // Build a local variable for better performance
45010 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
45011 :
45012 : // Iterate over the memory pools
45013 0 : bool done = false;
45014 0 : unsigned i=0;
45015 :
45016 : // find the first valid IR node, call visit function, and then leave
45017 0 : while ( done == false && i < SgOmpCopyprivateClause::pools.size() )
45018 : {
45019 : // objectArray[i] is a single memory pool
45020 : unsigned j=0;
45021 0 : while (done == false && j < SgOmpCopyprivateClause::pool_size)
45022 : {
45023 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
45024 : {
45025 0 : traversal.visit(&(objectArray[i][j]));
45026 0 : done = true;
45027 : }
45028 0 : j++;
45029 : }
45030 0 : i++;
45031 : }
45032 :
45033 : #if 0
45034 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
45035 : if (done == false)
45036 : {
45037 : printf ("No representative for SgOmpCopyprivateClause found in memory pools \n");
45038 : }
45039 : #endif
45040 : }
45041 0 : }
45042 :
45043 :
45044 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
45045 : // using values that overflow signed values of int.
45046 : size_t
45047 4 : SgOmpCopyprivateClause::numberOfNodes()
45048 : {
45049 : // This function traverses the memory pool for an IR node and
45050 : // counts the number of IR nodes of a particular Sage III IR
45051 : // nodes type.
45052 :
45053 4 : size_t count = 0;
45054 4 : if (SgOmpCopyprivateClause::pools.empty() == false)
45055 : {
45056 : // Generate an array of memory pools (this is actually a STL vector,
45057 : // but it is contiguious, so OK to treat this way).
45058 0 : SgOmpCopyprivateClause** objectArray = (SgOmpCopyprivateClause**) &(SgOmpCopyprivateClause::pools[0]);
45059 :
45060 : // Build a local variable for better performance (make it a loop invariant variable).
45061 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
45062 :
45063 : // Iterate over all of the memory pools for this IR node.
45064 0 : for (unsigned int i=0; i < SgOmpCopyprivateClause::pools.size(); i++)
45065 : {
45066 : // objectArray[i] is a single memory pool, iterate over all the
45067 : // IR nodes and only count those that are valid IR nodes used in
45068 : // the AST (i.e. allocated IR nodes).
45069 0 : for (unsigned j=0; j < SgOmpCopyprivateClause::pool_size; j++)
45070 : {
45071 : // This is indexing the STL vector of C/C++ style arrays as a doubly
45072 : // indexed array access. It is OK since we have leveraged the semantics
45073 : // of STL vector memory as contigous and cast the memory as an array
45074 : // of arrays to use the 2D array indexing. Hope this is not confusing,
45075 : // but it s very fast as an implementation.
45076 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
45077 : {
45078 0 : count++;
45079 : }
45080 : }
45081 : }
45082 : }
45083 :
45084 :
45085 :
45086 4 : return count;
45087 : }
45088 :
45089 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
45090 : // using values that overflow signed values of int.
45091 : size_t
45092 0 : SgOmpCopyprivateClause::memoryUsage()
45093 : {
45094 : // This function is required because we need the class name as a type when we call sizeof
45095 : // There might be another way to implement this if we have a traversal that only called a
45096 : // representative object (one call for each type of Sage IIIIR node).
45097 0 : size_t memory = numberOfNodes() * sizeof(SgOmpCopyprivateClause);
45098 :
45099 0 : return memory;
45100 : }
45101 :
45102 : /* #line 45103 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
45103 :
45104 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
45105 : void
45106 5342 : SgOmpPrivateClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
45107 : {
45108 : // This function traverses the memory pool for only a specific IR node
45109 : // and calls the visit function of the input class execute a traversal
45110 : // similar to the style of the attribute based traversals within ROSE.
45111 : // This traversal will visit ALL nodes of the AST where as the other
45112 : // attribute based traversals visit only the embedded tree within the AST.
45113 :
45114 : // Initialize array to the address of the first element of the STL vector
45115 : // (which is guaranteed to be contiguous storage).
45116 : // SgOmpPrivateClause objectArray [] = *(Memory_Block_List.begin());
45117 5342 : if (SgOmpPrivateClause::pools.empty() == false)
45118 : {
45119 : // Generate an array of memory pools
45120 511 : SgOmpPrivateClause** objectArray = (SgOmpPrivateClause**) &(SgOmpPrivateClause::pools[0]);
45121 :
45122 : // Build a local variable for better performance
45123 511 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
45124 : #if 0
45125 : // Iterate over the memory pools
45126 : for (unsigned int i=0; i < SgOmpPrivateClause::pools.size(); i++)
45127 : {
45128 : // objectArray[i] is a single memory pool
45129 : for (int j=0; j < SgOmpPrivateClause::pool_size; j++)
45130 : {
45131 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
45132 : {
45133 : traversal.visit(&(objectArray[i][j]));
45134 : }
45135 : }
45136 : }
45137 : #else
45138 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
45139 : // compute the list first and then call the visit function on each list element.
45140 :
45141 : // printf ("Inside of SgOmpPrivateClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
45142 :
45143 1022 : std::vector<SgOmpPrivateClause*> nodeList;
45144 :
45145 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
45146 1022 : for (unsigned int i=0; i < SgOmpPrivateClause::pools.size(); i++)
45147 : {
45148 : // objectArray[i] is a single memory pool
45149 1022510 : for (unsigned j=0; j < SgOmpPrivateClause::pool_size; j++)
45150 : {
45151 1022000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
45152 : {
45153 721 : nodeList.push_back(&(objectArray[i][j]));
45154 : }
45155 : }
45156 : }
45157 :
45158 : // Iterate over the saved list
45159 511 : size_t nodeListSize = nodeList.size();
45160 1232 : for (size_t i=0; i < nodeListSize; i++)
45161 : {
45162 721 : ROSE_ASSERT(nodeList[i] != NULL);
45163 : #if 0
45164 : traversal.visit(nodeList[i]);
45165 : #else
45166 721 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
45167 : {
45168 721 : traversal.visit(nodeList[i]);
45169 : }
45170 : #endif
45171 : }
45172 : #endif
45173 : }
45174 :
45175 : // This should not be required since all previously static data members are
45176 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
45177 :
45178 5342 : }
45179 :
45180 :
45181 : void
45182 194 : SgOmpPrivateClause::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
45183 : {
45184 : // This function traverses the memory pool for an IR node and
45185 : // calls the function to execute the visitor object.
45186 :
45187 : // Initialize array to the address of the first element of the STL vector
45188 : // (which is guarenteed to be contiguous storage).
45189 : // SgOmpPrivateClause objectArray [] = *(Memory_Block_List.begin());
45190 194 : if (SgOmpPrivateClause::pools.empty() == false)
45191 : {
45192 : // Generate an array of memory pools
45193 0 : SgOmpPrivateClause** objectArray = (SgOmpPrivateClause**) &(SgOmpPrivateClause::pools[0]);
45194 :
45195 : // Build a local variable for better performance
45196 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
45197 :
45198 : // Iterate over the memory pools
45199 0 : for (unsigned int i=0; i < SgOmpPrivateClause::pools.size(); i++)
45200 : {
45201 : // objectArray[i] is a single memory pool
45202 0 : for (unsigned j=0; j < SgOmpPrivateClause::pool_size; j++)
45203 : {
45204 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
45205 : {
45206 : // printf ("Found a valid SgOmpPrivateClause object in the memory pool %d at position %d \n",i,j);
45207 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
45208 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
45209 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
45210 : }
45211 : else
45212 : {
45213 : // printf ("Found a INVALID SgOmpPrivateClause object in the memory pool \n");
45214 : }
45215 : }
45216 : }
45217 : }
45218 :
45219 : // This should not be required since all previously static data members are
45220 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
45221 :
45222 194 : }
45223 :
45224 : void
45225 0 : SgOmpPrivateClause::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
45226 : {
45227 : // This function visits only a single IR node of the memory pool.
45228 : // it is typically called once for each type of IR node within
45229 : // the automatically generated function: traverseRepresentativeNodes().
45230 :
45231 : // Initialize array to the address of the first element of the STL vector
45232 : // (which is guarenteed to be contiguous storage).
45233 : // SgOmpPrivateClause objectArray [] = *(Memory_Block_List.begin());
45234 0 : if (SgOmpPrivateClause::pools.empty() == false)
45235 : {
45236 : // Generate an array of memory pools
45237 0 : SgOmpPrivateClause** objectArray = (SgOmpPrivateClause**) &(SgOmpPrivateClause::pools[0]);
45238 :
45239 : // Build a local variable for better performance
45240 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
45241 :
45242 : // Iterate over the memory pools
45243 0 : bool done = false;
45244 0 : unsigned i=0;
45245 :
45246 : // find the first valid IR node, call visit function, and then leave
45247 0 : while ( done == false && i < SgOmpPrivateClause::pools.size() )
45248 : {
45249 : // objectArray[i] is a single memory pool
45250 : unsigned j=0;
45251 0 : while (done == false && j < SgOmpPrivateClause::pool_size)
45252 : {
45253 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
45254 : {
45255 0 : traversal.visit(&(objectArray[i][j]));
45256 0 : done = true;
45257 : }
45258 0 : j++;
45259 : }
45260 0 : i++;
45261 : }
45262 :
45263 : #if 0
45264 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
45265 : if (done == false)
45266 : {
45267 : printf ("No representative for SgOmpPrivateClause found in memory pools \n");
45268 : }
45269 : #endif
45270 : }
45271 0 : }
45272 :
45273 :
45274 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
45275 : // using values that overflow signed values of int.
45276 : size_t
45277 4 : SgOmpPrivateClause::numberOfNodes()
45278 : {
45279 : // This function traverses the memory pool for an IR node and
45280 : // counts the number of IR nodes of a particular Sage III IR
45281 : // nodes type.
45282 :
45283 4 : size_t count = 0;
45284 4 : if (SgOmpPrivateClause::pools.empty() == false)
45285 : {
45286 : // Generate an array of memory pools (this is actually a STL vector,
45287 : // but it is contiguious, so OK to treat this way).
45288 0 : SgOmpPrivateClause** objectArray = (SgOmpPrivateClause**) &(SgOmpPrivateClause::pools[0]);
45289 :
45290 : // Build a local variable for better performance (make it a loop invariant variable).
45291 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
45292 :
45293 : // Iterate over all of the memory pools for this IR node.
45294 0 : for (unsigned int i=0; i < SgOmpPrivateClause::pools.size(); i++)
45295 : {
45296 : // objectArray[i] is a single memory pool, iterate over all the
45297 : // IR nodes and only count those that are valid IR nodes used in
45298 : // the AST (i.e. allocated IR nodes).
45299 0 : for (unsigned j=0; j < SgOmpPrivateClause::pool_size; j++)
45300 : {
45301 : // This is indexing the STL vector of C/C++ style arrays as a doubly
45302 : // indexed array access. It is OK since we have leveraged the semantics
45303 : // of STL vector memory as contigous and cast the memory as an array
45304 : // of arrays to use the 2D array indexing. Hope this is not confusing,
45305 : // but it s very fast as an implementation.
45306 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
45307 : {
45308 0 : count++;
45309 : }
45310 : }
45311 : }
45312 : }
45313 :
45314 :
45315 :
45316 4 : return count;
45317 : }
45318 :
45319 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
45320 : // using values that overflow signed values of int.
45321 : size_t
45322 0 : SgOmpPrivateClause::memoryUsage()
45323 : {
45324 : // This function is required because we need the class name as a type when we call sizeof
45325 : // There might be another way to implement this if we have a traversal that only called a
45326 : // representative object (one call for each type of Sage IIIIR node).
45327 0 : size_t memory = numberOfNodes() * sizeof(SgOmpPrivateClause);
45328 :
45329 0 : return memory;
45330 : }
45331 :
45332 : /* #line 45333 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
45333 :
45334 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
45335 : void
45336 5342 : SgOmpFirstprivateClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
45337 : {
45338 : // This function traverses the memory pool for only a specific IR node
45339 : // and calls the visit function of the input class execute a traversal
45340 : // similar to the style of the attribute based traversals within ROSE.
45341 : // This traversal will visit ALL nodes of the AST where as the other
45342 : // attribute based traversals visit only the embedded tree within the AST.
45343 :
45344 : // Initialize array to the address of the first element of the STL vector
45345 : // (which is guaranteed to be contiguous storage).
45346 : // SgOmpFirstprivateClause objectArray [] = *(Memory_Block_List.begin());
45347 5342 : if (SgOmpFirstprivateClause::pools.empty() == false)
45348 : {
45349 : // Generate an array of memory pools
45350 154 : SgOmpFirstprivateClause** objectArray = (SgOmpFirstprivateClause**) &(SgOmpFirstprivateClause::pools[0]);
45351 :
45352 : // Build a local variable for better performance
45353 154 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
45354 : #if 0
45355 : // Iterate over the memory pools
45356 : for (unsigned int i=0; i < SgOmpFirstprivateClause::pools.size(); i++)
45357 : {
45358 : // objectArray[i] is a single memory pool
45359 : for (int j=0; j < SgOmpFirstprivateClause::pool_size; j++)
45360 : {
45361 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
45362 : {
45363 : traversal.visit(&(objectArray[i][j]));
45364 : }
45365 : }
45366 : }
45367 : #else
45368 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
45369 : // compute the list first and then call the visit function on each list element.
45370 :
45371 : // printf ("Inside of SgOmpFirstprivateClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
45372 :
45373 308 : std::vector<SgOmpFirstprivateClause*> nodeList;
45374 :
45375 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
45376 308 : for (unsigned int i=0; i < SgOmpFirstprivateClause::pools.size(); i++)
45377 : {
45378 : // objectArray[i] is a single memory pool
45379 308154 : for (unsigned j=0; j < SgOmpFirstprivateClause::pool_size; j++)
45380 : {
45381 308000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
45382 : {
45383 259 : nodeList.push_back(&(objectArray[i][j]));
45384 : }
45385 : }
45386 : }
45387 :
45388 : // Iterate over the saved list
45389 154 : size_t nodeListSize = nodeList.size();
45390 413 : for (size_t i=0; i < nodeListSize; i++)
45391 : {
45392 259 : ROSE_ASSERT(nodeList[i] != NULL);
45393 : #if 0
45394 : traversal.visit(nodeList[i]);
45395 : #else
45396 259 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
45397 : {
45398 259 : traversal.visit(nodeList[i]);
45399 : }
45400 : #endif
45401 : }
45402 : #endif
45403 : }
45404 :
45405 : // This should not be required since all previously static data members are
45406 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
45407 :
45408 5342 : }
45409 :
45410 :
45411 : void
45412 194 : SgOmpFirstprivateClause::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
45413 : {
45414 : // This function traverses the memory pool for an IR node and
45415 : // calls the function to execute the visitor object.
45416 :
45417 : // Initialize array to the address of the first element of the STL vector
45418 : // (which is guarenteed to be contiguous storage).
45419 : // SgOmpFirstprivateClause objectArray [] = *(Memory_Block_List.begin());
45420 194 : if (SgOmpFirstprivateClause::pools.empty() == false)
45421 : {
45422 : // Generate an array of memory pools
45423 0 : SgOmpFirstprivateClause** objectArray = (SgOmpFirstprivateClause**) &(SgOmpFirstprivateClause::pools[0]);
45424 :
45425 : // Build a local variable for better performance
45426 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
45427 :
45428 : // Iterate over the memory pools
45429 0 : for (unsigned int i=0; i < SgOmpFirstprivateClause::pools.size(); i++)
45430 : {
45431 : // objectArray[i] is a single memory pool
45432 0 : for (unsigned j=0; j < SgOmpFirstprivateClause::pool_size; j++)
45433 : {
45434 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
45435 : {
45436 : // printf ("Found a valid SgOmpFirstprivateClause object in the memory pool %d at position %d \n",i,j);
45437 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
45438 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
45439 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
45440 : }
45441 : else
45442 : {
45443 : // printf ("Found a INVALID SgOmpFirstprivateClause object in the memory pool \n");
45444 : }
45445 : }
45446 : }
45447 : }
45448 :
45449 : // This should not be required since all previously static data members are
45450 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
45451 :
45452 194 : }
45453 :
45454 : void
45455 0 : SgOmpFirstprivateClause::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
45456 : {
45457 : // This function visits only a single IR node of the memory pool.
45458 : // it is typically called once for each type of IR node within
45459 : // the automatically generated function: traverseRepresentativeNodes().
45460 :
45461 : // Initialize array to the address of the first element of the STL vector
45462 : // (which is guarenteed to be contiguous storage).
45463 : // SgOmpFirstprivateClause objectArray [] = *(Memory_Block_List.begin());
45464 0 : if (SgOmpFirstprivateClause::pools.empty() == false)
45465 : {
45466 : // Generate an array of memory pools
45467 0 : SgOmpFirstprivateClause** objectArray = (SgOmpFirstprivateClause**) &(SgOmpFirstprivateClause::pools[0]);
45468 :
45469 : // Build a local variable for better performance
45470 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
45471 :
45472 : // Iterate over the memory pools
45473 0 : bool done = false;
45474 0 : unsigned i=0;
45475 :
45476 : // find the first valid IR node, call visit function, and then leave
45477 0 : while ( done == false && i < SgOmpFirstprivateClause::pools.size() )
45478 : {
45479 : // objectArray[i] is a single memory pool
45480 : unsigned j=0;
45481 0 : while (done == false && j < SgOmpFirstprivateClause::pool_size)
45482 : {
45483 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
45484 : {
45485 0 : traversal.visit(&(objectArray[i][j]));
45486 0 : done = true;
45487 : }
45488 0 : j++;
45489 : }
45490 0 : i++;
45491 : }
45492 :
45493 : #if 0
45494 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
45495 : if (done == false)
45496 : {
45497 : printf ("No representative for SgOmpFirstprivateClause found in memory pools \n");
45498 : }
45499 : #endif
45500 : }
45501 0 : }
45502 :
45503 :
45504 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
45505 : // using values that overflow signed values of int.
45506 : size_t
45507 4 : SgOmpFirstprivateClause::numberOfNodes()
45508 : {
45509 : // This function traverses the memory pool for an IR node and
45510 : // counts the number of IR nodes of a particular Sage III IR
45511 : // nodes type.
45512 :
45513 4 : size_t count = 0;
45514 4 : if (SgOmpFirstprivateClause::pools.empty() == false)
45515 : {
45516 : // Generate an array of memory pools (this is actually a STL vector,
45517 : // but it is contiguious, so OK to treat this way).
45518 0 : SgOmpFirstprivateClause** objectArray = (SgOmpFirstprivateClause**) &(SgOmpFirstprivateClause::pools[0]);
45519 :
45520 : // Build a local variable for better performance (make it a loop invariant variable).
45521 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
45522 :
45523 : // Iterate over all of the memory pools for this IR node.
45524 0 : for (unsigned int i=0; i < SgOmpFirstprivateClause::pools.size(); i++)
45525 : {
45526 : // objectArray[i] is a single memory pool, iterate over all the
45527 : // IR nodes and only count those that are valid IR nodes used in
45528 : // the AST (i.e. allocated IR nodes).
45529 0 : for (unsigned j=0; j < SgOmpFirstprivateClause::pool_size; j++)
45530 : {
45531 : // This is indexing the STL vector of C/C++ style arrays as a doubly
45532 : // indexed array access. It is OK since we have leveraged the semantics
45533 : // of STL vector memory as contigous and cast the memory as an array
45534 : // of arrays to use the 2D array indexing. Hope this is not confusing,
45535 : // but it s very fast as an implementation.
45536 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
45537 : {
45538 0 : count++;
45539 : }
45540 : }
45541 : }
45542 : }
45543 :
45544 :
45545 :
45546 4 : return count;
45547 : }
45548 :
45549 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
45550 : // using values that overflow signed values of int.
45551 : size_t
45552 0 : SgOmpFirstprivateClause::memoryUsage()
45553 : {
45554 : // This function is required because we need the class name as a type when we call sizeof
45555 : // There might be another way to implement this if we have a traversal that only called a
45556 : // representative object (one call for each type of Sage IIIIR node).
45557 0 : size_t memory = numberOfNodes() * sizeof(SgOmpFirstprivateClause);
45558 :
45559 0 : return memory;
45560 : }
45561 :
45562 : /* #line 45563 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
45563 :
45564 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
45565 : void
45566 5342 : SgOmpNontemporalClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
45567 : {
45568 : // This function traverses the memory pool for only a specific IR node
45569 : // and calls the visit function of the input class execute a traversal
45570 : // similar to the style of the attribute based traversals within ROSE.
45571 : // This traversal will visit ALL nodes of the AST where as the other
45572 : // attribute based traversals visit only the embedded tree within the AST.
45573 :
45574 : // Initialize array to the address of the first element of the STL vector
45575 : // (which is guaranteed to be contiguous storage).
45576 : // SgOmpNontemporalClause objectArray [] = *(Memory_Block_List.begin());
45577 5342 : if (SgOmpNontemporalClause::pools.empty() == false)
45578 : {
45579 : // Generate an array of memory pools
45580 0 : SgOmpNontemporalClause** objectArray = (SgOmpNontemporalClause**) &(SgOmpNontemporalClause::pools[0]);
45581 :
45582 : // Build a local variable for better performance
45583 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
45584 : #if 0
45585 : // Iterate over the memory pools
45586 : for (unsigned int i=0; i < SgOmpNontemporalClause::pools.size(); i++)
45587 : {
45588 : // objectArray[i] is a single memory pool
45589 : for (int j=0; j < SgOmpNontemporalClause::pool_size; j++)
45590 : {
45591 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
45592 : {
45593 : traversal.visit(&(objectArray[i][j]));
45594 : }
45595 : }
45596 : }
45597 : #else
45598 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
45599 : // compute the list first and then call the visit function on each list element.
45600 :
45601 : // printf ("Inside of SgOmpNontemporalClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
45602 :
45603 0 : std::vector<SgOmpNontemporalClause*> nodeList;
45604 :
45605 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
45606 0 : for (unsigned int i=0; i < SgOmpNontemporalClause::pools.size(); i++)
45607 : {
45608 : // objectArray[i] is a single memory pool
45609 0 : for (unsigned j=0; j < SgOmpNontemporalClause::pool_size; j++)
45610 : {
45611 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
45612 : {
45613 0 : nodeList.push_back(&(objectArray[i][j]));
45614 : }
45615 : }
45616 : }
45617 :
45618 : // Iterate over the saved list
45619 0 : size_t nodeListSize = nodeList.size();
45620 0 : for (size_t i=0; i < nodeListSize; i++)
45621 : {
45622 0 : ROSE_ASSERT(nodeList[i] != NULL);
45623 : #if 0
45624 : traversal.visit(nodeList[i]);
45625 : #else
45626 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
45627 : {
45628 0 : traversal.visit(nodeList[i]);
45629 : }
45630 : #endif
45631 : }
45632 : #endif
45633 : }
45634 :
45635 : // This should not be required since all previously static data members are
45636 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
45637 :
45638 5342 : }
45639 :
45640 :
45641 : void
45642 194 : SgOmpNontemporalClause::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
45643 : {
45644 : // This function traverses the memory pool for an IR node and
45645 : // calls the function to execute the visitor object.
45646 :
45647 : // Initialize array to the address of the first element of the STL vector
45648 : // (which is guarenteed to be contiguous storage).
45649 : // SgOmpNontemporalClause objectArray [] = *(Memory_Block_List.begin());
45650 194 : if (SgOmpNontemporalClause::pools.empty() == false)
45651 : {
45652 : // Generate an array of memory pools
45653 0 : SgOmpNontemporalClause** objectArray = (SgOmpNontemporalClause**) &(SgOmpNontemporalClause::pools[0]);
45654 :
45655 : // Build a local variable for better performance
45656 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
45657 :
45658 : // Iterate over the memory pools
45659 0 : for (unsigned int i=0; i < SgOmpNontemporalClause::pools.size(); i++)
45660 : {
45661 : // objectArray[i] is a single memory pool
45662 0 : for (unsigned j=0; j < SgOmpNontemporalClause::pool_size; j++)
45663 : {
45664 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
45665 : {
45666 : // printf ("Found a valid SgOmpNontemporalClause object in the memory pool %d at position %d \n",i,j);
45667 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
45668 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
45669 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
45670 : }
45671 : else
45672 : {
45673 : // printf ("Found a INVALID SgOmpNontemporalClause object in the memory pool \n");
45674 : }
45675 : }
45676 : }
45677 : }
45678 :
45679 : // This should not be required since all previously static data members are
45680 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
45681 :
45682 194 : }
45683 :
45684 : void
45685 0 : SgOmpNontemporalClause::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
45686 : {
45687 : // This function visits only a single IR node of the memory pool.
45688 : // it is typically called once for each type of IR node within
45689 : // the automatically generated function: traverseRepresentativeNodes().
45690 :
45691 : // Initialize array to the address of the first element of the STL vector
45692 : // (which is guarenteed to be contiguous storage).
45693 : // SgOmpNontemporalClause objectArray [] = *(Memory_Block_List.begin());
45694 0 : if (SgOmpNontemporalClause::pools.empty() == false)
45695 : {
45696 : // Generate an array of memory pools
45697 0 : SgOmpNontemporalClause** objectArray = (SgOmpNontemporalClause**) &(SgOmpNontemporalClause::pools[0]);
45698 :
45699 : // Build a local variable for better performance
45700 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
45701 :
45702 : // Iterate over the memory pools
45703 0 : bool done = false;
45704 0 : unsigned i=0;
45705 :
45706 : // find the first valid IR node, call visit function, and then leave
45707 0 : while ( done == false && i < SgOmpNontemporalClause::pools.size() )
45708 : {
45709 : // objectArray[i] is a single memory pool
45710 : unsigned j=0;
45711 0 : while (done == false && j < SgOmpNontemporalClause::pool_size)
45712 : {
45713 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
45714 : {
45715 0 : traversal.visit(&(objectArray[i][j]));
45716 0 : done = true;
45717 : }
45718 0 : j++;
45719 : }
45720 0 : i++;
45721 : }
45722 :
45723 : #if 0
45724 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
45725 : if (done == false)
45726 : {
45727 : printf ("No representative for SgOmpNontemporalClause found in memory pools \n");
45728 : }
45729 : #endif
45730 : }
45731 0 : }
45732 :
45733 :
45734 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
45735 : // using values that overflow signed values of int.
45736 : size_t
45737 4 : SgOmpNontemporalClause::numberOfNodes()
45738 : {
45739 : // This function traverses the memory pool for an IR node and
45740 : // counts the number of IR nodes of a particular Sage III IR
45741 : // nodes type.
45742 :
45743 4 : size_t count = 0;
45744 4 : if (SgOmpNontemporalClause::pools.empty() == false)
45745 : {
45746 : // Generate an array of memory pools (this is actually a STL vector,
45747 : // but it is contiguious, so OK to treat this way).
45748 0 : SgOmpNontemporalClause** objectArray = (SgOmpNontemporalClause**) &(SgOmpNontemporalClause::pools[0]);
45749 :
45750 : // Build a local variable for better performance (make it a loop invariant variable).
45751 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
45752 :
45753 : // Iterate over all of the memory pools for this IR node.
45754 0 : for (unsigned int i=0; i < SgOmpNontemporalClause::pools.size(); i++)
45755 : {
45756 : // objectArray[i] is a single memory pool, iterate over all the
45757 : // IR nodes and only count those that are valid IR nodes used in
45758 : // the AST (i.e. allocated IR nodes).
45759 0 : for (unsigned j=0; j < SgOmpNontemporalClause::pool_size; j++)
45760 : {
45761 : // This is indexing the STL vector of C/C++ style arrays as a doubly
45762 : // indexed array access. It is OK since we have leveraged the semantics
45763 : // of STL vector memory as contigous and cast the memory as an array
45764 : // of arrays to use the 2D array indexing. Hope this is not confusing,
45765 : // but it s very fast as an implementation.
45766 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
45767 : {
45768 0 : count++;
45769 : }
45770 : }
45771 : }
45772 : }
45773 :
45774 :
45775 :
45776 4 : return count;
45777 : }
45778 :
45779 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
45780 : // using values that overflow signed values of int.
45781 : size_t
45782 0 : SgOmpNontemporalClause::memoryUsage()
45783 : {
45784 : // This function is required because we need the class name as a type when we call sizeof
45785 : // There might be another way to implement this if we have a traversal that only called a
45786 : // representative object (one call for each type of Sage IIIIR node).
45787 0 : size_t memory = numberOfNodes() * sizeof(SgOmpNontemporalClause);
45788 :
45789 0 : return memory;
45790 : }
45791 :
45792 : /* #line 45793 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
45793 :
45794 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
45795 : void
45796 5342 : SgOmpInclusiveClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
45797 : {
45798 : // This function traverses the memory pool for only a specific IR node
45799 : // and calls the visit function of the input class execute a traversal
45800 : // similar to the style of the attribute based traversals within ROSE.
45801 : // This traversal will visit ALL nodes of the AST where as the other
45802 : // attribute based traversals visit only the embedded tree within the AST.
45803 :
45804 : // Initialize array to the address of the first element of the STL vector
45805 : // (which is guaranteed to be contiguous storage).
45806 : // SgOmpInclusiveClause objectArray [] = *(Memory_Block_List.begin());
45807 5342 : if (SgOmpInclusiveClause::pools.empty() == false)
45808 : {
45809 : // Generate an array of memory pools
45810 0 : SgOmpInclusiveClause** objectArray = (SgOmpInclusiveClause**) &(SgOmpInclusiveClause::pools[0]);
45811 :
45812 : // Build a local variable for better performance
45813 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
45814 : #if 0
45815 : // Iterate over the memory pools
45816 : for (unsigned int i=0; i < SgOmpInclusiveClause::pools.size(); i++)
45817 : {
45818 : // objectArray[i] is a single memory pool
45819 : for (int j=0; j < SgOmpInclusiveClause::pool_size; j++)
45820 : {
45821 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
45822 : {
45823 : traversal.visit(&(objectArray[i][j]));
45824 : }
45825 : }
45826 : }
45827 : #else
45828 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
45829 : // compute the list first and then call the visit function on each list element.
45830 :
45831 : // printf ("Inside of SgOmpInclusiveClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
45832 :
45833 0 : std::vector<SgOmpInclusiveClause*> nodeList;
45834 :
45835 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
45836 0 : for (unsigned int i=0; i < SgOmpInclusiveClause::pools.size(); i++)
45837 : {
45838 : // objectArray[i] is a single memory pool
45839 0 : for (unsigned j=0; j < SgOmpInclusiveClause::pool_size; j++)
45840 : {
45841 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
45842 : {
45843 0 : nodeList.push_back(&(objectArray[i][j]));
45844 : }
45845 : }
45846 : }
45847 :
45848 : // Iterate over the saved list
45849 0 : size_t nodeListSize = nodeList.size();
45850 0 : for (size_t i=0; i < nodeListSize; i++)
45851 : {
45852 0 : ROSE_ASSERT(nodeList[i] != NULL);
45853 : #if 0
45854 : traversal.visit(nodeList[i]);
45855 : #else
45856 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
45857 : {
45858 0 : traversal.visit(nodeList[i]);
45859 : }
45860 : #endif
45861 : }
45862 : #endif
45863 : }
45864 :
45865 : // This should not be required since all previously static data members are
45866 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
45867 :
45868 5342 : }
45869 :
45870 :
45871 : void
45872 194 : SgOmpInclusiveClause::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
45873 : {
45874 : // This function traverses the memory pool for an IR node and
45875 : // calls the function to execute the visitor object.
45876 :
45877 : // Initialize array to the address of the first element of the STL vector
45878 : // (which is guarenteed to be contiguous storage).
45879 : // SgOmpInclusiveClause objectArray [] = *(Memory_Block_List.begin());
45880 194 : if (SgOmpInclusiveClause::pools.empty() == false)
45881 : {
45882 : // Generate an array of memory pools
45883 0 : SgOmpInclusiveClause** objectArray = (SgOmpInclusiveClause**) &(SgOmpInclusiveClause::pools[0]);
45884 :
45885 : // Build a local variable for better performance
45886 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
45887 :
45888 : // Iterate over the memory pools
45889 0 : for (unsigned int i=0; i < SgOmpInclusiveClause::pools.size(); i++)
45890 : {
45891 : // objectArray[i] is a single memory pool
45892 0 : for (unsigned j=0; j < SgOmpInclusiveClause::pool_size; j++)
45893 : {
45894 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
45895 : {
45896 : // printf ("Found a valid SgOmpInclusiveClause object in the memory pool %d at position %d \n",i,j);
45897 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
45898 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
45899 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
45900 : }
45901 : else
45902 : {
45903 : // printf ("Found a INVALID SgOmpInclusiveClause object in the memory pool \n");
45904 : }
45905 : }
45906 : }
45907 : }
45908 :
45909 : // This should not be required since all previously static data members are
45910 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
45911 :
45912 194 : }
45913 :
45914 : void
45915 0 : SgOmpInclusiveClause::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
45916 : {
45917 : // This function visits only a single IR node of the memory pool.
45918 : // it is typically called once for each type of IR node within
45919 : // the automatically generated function: traverseRepresentativeNodes().
45920 :
45921 : // Initialize array to the address of the first element of the STL vector
45922 : // (which is guarenteed to be contiguous storage).
45923 : // SgOmpInclusiveClause objectArray [] = *(Memory_Block_List.begin());
45924 0 : if (SgOmpInclusiveClause::pools.empty() == false)
45925 : {
45926 : // Generate an array of memory pools
45927 0 : SgOmpInclusiveClause** objectArray = (SgOmpInclusiveClause**) &(SgOmpInclusiveClause::pools[0]);
45928 :
45929 : // Build a local variable for better performance
45930 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
45931 :
45932 : // Iterate over the memory pools
45933 0 : bool done = false;
45934 0 : unsigned i=0;
45935 :
45936 : // find the first valid IR node, call visit function, and then leave
45937 0 : while ( done == false && i < SgOmpInclusiveClause::pools.size() )
45938 : {
45939 : // objectArray[i] is a single memory pool
45940 : unsigned j=0;
45941 0 : while (done == false && j < SgOmpInclusiveClause::pool_size)
45942 : {
45943 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
45944 : {
45945 0 : traversal.visit(&(objectArray[i][j]));
45946 0 : done = true;
45947 : }
45948 0 : j++;
45949 : }
45950 0 : i++;
45951 : }
45952 :
45953 : #if 0
45954 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
45955 : if (done == false)
45956 : {
45957 : printf ("No representative for SgOmpInclusiveClause found in memory pools \n");
45958 : }
45959 : #endif
45960 : }
45961 0 : }
45962 :
45963 :
45964 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
45965 : // using values that overflow signed values of int.
45966 : size_t
45967 4 : SgOmpInclusiveClause::numberOfNodes()
45968 : {
45969 : // This function traverses the memory pool for an IR node and
45970 : // counts the number of IR nodes of a particular Sage III IR
45971 : // nodes type.
45972 :
45973 4 : size_t count = 0;
45974 4 : if (SgOmpInclusiveClause::pools.empty() == false)
45975 : {
45976 : // Generate an array of memory pools (this is actually a STL vector,
45977 : // but it is contiguious, so OK to treat this way).
45978 0 : SgOmpInclusiveClause** objectArray = (SgOmpInclusiveClause**) &(SgOmpInclusiveClause::pools[0]);
45979 :
45980 : // Build a local variable for better performance (make it a loop invariant variable).
45981 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
45982 :
45983 : // Iterate over all of the memory pools for this IR node.
45984 0 : for (unsigned int i=0; i < SgOmpInclusiveClause::pools.size(); i++)
45985 : {
45986 : // objectArray[i] is a single memory pool, iterate over all the
45987 : // IR nodes and only count those that are valid IR nodes used in
45988 : // the AST (i.e. allocated IR nodes).
45989 0 : for (unsigned j=0; j < SgOmpInclusiveClause::pool_size; j++)
45990 : {
45991 : // This is indexing the STL vector of C/C++ style arrays as a doubly
45992 : // indexed array access. It is OK since we have leveraged the semantics
45993 : // of STL vector memory as contigous and cast the memory as an array
45994 : // of arrays to use the 2D array indexing. Hope this is not confusing,
45995 : // but it s very fast as an implementation.
45996 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
45997 : {
45998 0 : count++;
45999 : }
46000 : }
46001 : }
46002 : }
46003 :
46004 :
46005 :
46006 4 : return count;
46007 : }
46008 :
46009 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
46010 : // using values that overflow signed values of int.
46011 : size_t
46012 0 : SgOmpInclusiveClause::memoryUsage()
46013 : {
46014 : // This function is required because we need the class name as a type when we call sizeof
46015 : // There might be another way to implement this if we have a traversal that only called a
46016 : // representative object (one call for each type of Sage IIIIR node).
46017 0 : size_t memory = numberOfNodes() * sizeof(SgOmpInclusiveClause);
46018 :
46019 0 : return memory;
46020 : }
46021 :
46022 : /* #line 46023 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
46023 :
46024 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
46025 : void
46026 5342 : SgOmpExclusiveClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
46027 : {
46028 : // This function traverses the memory pool for only a specific IR node
46029 : // and calls the visit function of the input class execute a traversal
46030 : // similar to the style of the attribute based traversals within ROSE.
46031 : // This traversal will visit ALL nodes of the AST where as the other
46032 : // attribute based traversals visit only the embedded tree within the AST.
46033 :
46034 : // Initialize array to the address of the first element of the STL vector
46035 : // (which is guaranteed to be contiguous storage).
46036 : // SgOmpExclusiveClause objectArray [] = *(Memory_Block_List.begin());
46037 5342 : if (SgOmpExclusiveClause::pools.empty() == false)
46038 : {
46039 : // Generate an array of memory pools
46040 7 : SgOmpExclusiveClause** objectArray = (SgOmpExclusiveClause**) &(SgOmpExclusiveClause::pools[0]);
46041 :
46042 : // Build a local variable for better performance
46043 7 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
46044 : #if 0
46045 : // Iterate over the memory pools
46046 : for (unsigned int i=0; i < SgOmpExclusiveClause::pools.size(); i++)
46047 : {
46048 : // objectArray[i] is a single memory pool
46049 : for (int j=0; j < SgOmpExclusiveClause::pool_size; j++)
46050 : {
46051 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
46052 : {
46053 : traversal.visit(&(objectArray[i][j]));
46054 : }
46055 : }
46056 : }
46057 : #else
46058 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
46059 : // compute the list first and then call the visit function on each list element.
46060 :
46061 : // printf ("Inside of SgOmpExclusiveClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
46062 :
46063 14 : std::vector<SgOmpExclusiveClause*> nodeList;
46064 :
46065 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
46066 14 : for (unsigned int i=0; i < SgOmpExclusiveClause::pools.size(); i++)
46067 : {
46068 : // objectArray[i] is a single memory pool
46069 14007 : for (unsigned j=0; j < SgOmpExclusiveClause::pool_size; j++)
46070 : {
46071 14000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
46072 : {
46073 7 : nodeList.push_back(&(objectArray[i][j]));
46074 : }
46075 : }
46076 : }
46077 :
46078 : // Iterate over the saved list
46079 7 : size_t nodeListSize = nodeList.size();
46080 14 : for (size_t i=0; i < nodeListSize; i++)
46081 : {
46082 7 : ROSE_ASSERT(nodeList[i] != NULL);
46083 : #if 0
46084 : traversal.visit(nodeList[i]);
46085 : #else
46086 7 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
46087 : {
46088 7 : traversal.visit(nodeList[i]);
46089 : }
46090 : #endif
46091 : }
46092 : #endif
46093 : }
46094 :
46095 : // This should not be required since all previously static data members are
46096 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
46097 :
46098 5342 : }
46099 :
46100 :
46101 : void
46102 194 : SgOmpExclusiveClause::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
46103 : {
46104 : // This function traverses the memory pool for an IR node and
46105 : // calls the function to execute the visitor object.
46106 :
46107 : // Initialize array to the address of the first element of the STL vector
46108 : // (which is guarenteed to be contiguous storage).
46109 : // SgOmpExclusiveClause objectArray [] = *(Memory_Block_List.begin());
46110 194 : if (SgOmpExclusiveClause::pools.empty() == false)
46111 : {
46112 : // Generate an array of memory pools
46113 0 : SgOmpExclusiveClause** objectArray = (SgOmpExclusiveClause**) &(SgOmpExclusiveClause::pools[0]);
46114 :
46115 : // Build a local variable for better performance
46116 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
46117 :
46118 : // Iterate over the memory pools
46119 0 : for (unsigned int i=0; i < SgOmpExclusiveClause::pools.size(); i++)
46120 : {
46121 : // objectArray[i] is a single memory pool
46122 0 : for (unsigned j=0; j < SgOmpExclusiveClause::pool_size; j++)
46123 : {
46124 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
46125 : {
46126 : // printf ("Found a valid SgOmpExclusiveClause object in the memory pool %d at position %d \n",i,j);
46127 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
46128 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
46129 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
46130 : }
46131 : else
46132 : {
46133 : // printf ("Found a INVALID SgOmpExclusiveClause object in the memory pool \n");
46134 : }
46135 : }
46136 : }
46137 : }
46138 :
46139 : // This should not be required since all previously static data members are
46140 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
46141 :
46142 194 : }
46143 :
46144 : void
46145 0 : SgOmpExclusiveClause::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
46146 : {
46147 : // This function visits only a single IR node of the memory pool.
46148 : // it is typically called once for each type of IR node within
46149 : // the automatically generated function: traverseRepresentativeNodes().
46150 :
46151 : // Initialize array to the address of the first element of the STL vector
46152 : // (which is guarenteed to be contiguous storage).
46153 : // SgOmpExclusiveClause objectArray [] = *(Memory_Block_List.begin());
46154 0 : if (SgOmpExclusiveClause::pools.empty() == false)
46155 : {
46156 : // Generate an array of memory pools
46157 0 : SgOmpExclusiveClause** objectArray = (SgOmpExclusiveClause**) &(SgOmpExclusiveClause::pools[0]);
46158 :
46159 : // Build a local variable for better performance
46160 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
46161 :
46162 : // Iterate over the memory pools
46163 0 : bool done = false;
46164 0 : unsigned i=0;
46165 :
46166 : // find the first valid IR node, call visit function, and then leave
46167 0 : while ( done == false && i < SgOmpExclusiveClause::pools.size() )
46168 : {
46169 : // objectArray[i] is a single memory pool
46170 : unsigned j=0;
46171 0 : while (done == false && j < SgOmpExclusiveClause::pool_size)
46172 : {
46173 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
46174 : {
46175 0 : traversal.visit(&(objectArray[i][j]));
46176 0 : done = true;
46177 : }
46178 0 : j++;
46179 : }
46180 0 : i++;
46181 : }
46182 :
46183 : #if 0
46184 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
46185 : if (done == false)
46186 : {
46187 : printf ("No representative for SgOmpExclusiveClause found in memory pools \n");
46188 : }
46189 : #endif
46190 : }
46191 0 : }
46192 :
46193 :
46194 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
46195 : // using values that overflow signed values of int.
46196 : size_t
46197 4 : SgOmpExclusiveClause::numberOfNodes()
46198 : {
46199 : // This function traverses the memory pool for an IR node and
46200 : // counts the number of IR nodes of a particular Sage III IR
46201 : // nodes type.
46202 :
46203 4 : size_t count = 0;
46204 4 : if (SgOmpExclusiveClause::pools.empty() == false)
46205 : {
46206 : // Generate an array of memory pools (this is actually a STL vector,
46207 : // but it is contiguious, so OK to treat this way).
46208 0 : SgOmpExclusiveClause** objectArray = (SgOmpExclusiveClause**) &(SgOmpExclusiveClause::pools[0]);
46209 :
46210 : // Build a local variable for better performance (make it a loop invariant variable).
46211 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
46212 :
46213 : // Iterate over all of the memory pools for this IR node.
46214 0 : for (unsigned int i=0; i < SgOmpExclusiveClause::pools.size(); i++)
46215 : {
46216 : // objectArray[i] is a single memory pool, iterate over all the
46217 : // IR nodes and only count those that are valid IR nodes used in
46218 : // the AST (i.e. allocated IR nodes).
46219 0 : for (unsigned j=0; j < SgOmpExclusiveClause::pool_size; j++)
46220 : {
46221 : // This is indexing the STL vector of C/C++ style arrays as a doubly
46222 : // indexed array access. It is OK since we have leveraged the semantics
46223 : // of STL vector memory as contigous and cast the memory as an array
46224 : // of arrays to use the 2D array indexing. Hope this is not confusing,
46225 : // but it s very fast as an implementation.
46226 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
46227 : {
46228 0 : count++;
46229 : }
46230 : }
46231 : }
46232 : }
46233 :
46234 :
46235 :
46236 4 : return count;
46237 : }
46238 :
46239 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
46240 : // using values that overflow signed values of int.
46241 : size_t
46242 0 : SgOmpExclusiveClause::memoryUsage()
46243 : {
46244 : // This function is required because we need the class name as a type when we call sizeof
46245 : // There might be another way to implement this if we have a traversal that only called a
46246 : // representative object (one call for each type of Sage IIIIR node).
46247 0 : size_t memory = numberOfNodes() * sizeof(SgOmpExclusiveClause);
46248 :
46249 0 : return memory;
46250 : }
46251 :
46252 : /* #line 46253 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
46253 :
46254 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
46255 : void
46256 5342 : SgOmpIsDevicePtrClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
46257 : {
46258 : // This function traverses the memory pool for only a specific IR node
46259 : // and calls the visit function of the input class execute a traversal
46260 : // similar to the style of the attribute based traversals within ROSE.
46261 : // This traversal will visit ALL nodes of the AST where as the other
46262 : // attribute based traversals visit only the embedded tree within the AST.
46263 :
46264 : // Initialize array to the address of the first element of the STL vector
46265 : // (which is guaranteed to be contiguous storage).
46266 : // SgOmpIsDevicePtrClause objectArray [] = *(Memory_Block_List.begin());
46267 5342 : if (SgOmpIsDevicePtrClause::pools.empty() == false)
46268 : {
46269 : // Generate an array of memory pools
46270 0 : SgOmpIsDevicePtrClause** objectArray = (SgOmpIsDevicePtrClause**) &(SgOmpIsDevicePtrClause::pools[0]);
46271 :
46272 : // Build a local variable for better performance
46273 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
46274 : #if 0
46275 : // Iterate over the memory pools
46276 : for (unsigned int i=0; i < SgOmpIsDevicePtrClause::pools.size(); i++)
46277 : {
46278 : // objectArray[i] is a single memory pool
46279 : for (int j=0; j < SgOmpIsDevicePtrClause::pool_size; j++)
46280 : {
46281 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
46282 : {
46283 : traversal.visit(&(objectArray[i][j]));
46284 : }
46285 : }
46286 : }
46287 : #else
46288 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
46289 : // compute the list first and then call the visit function on each list element.
46290 :
46291 : // printf ("Inside of SgOmpIsDevicePtrClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
46292 :
46293 0 : std::vector<SgOmpIsDevicePtrClause*> nodeList;
46294 :
46295 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
46296 0 : for (unsigned int i=0; i < SgOmpIsDevicePtrClause::pools.size(); i++)
46297 : {
46298 : // objectArray[i] is a single memory pool
46299 0 : for (unsigned j=0; j < SgOmpIsDevicePtrClause::pool_size; j++)
46300 : {
46301 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
46302 : {
46303 0 : nodeList.push_back(&(objectArray[i][j]));
46304 : }
46305 : }
46306 : }
46307 :
46308 : // Iterate over the saved list
46309 0 : size_t nodeListSize = nodeList.size();
46310 0 : for (size_t i=0; i < nodeListSize; i++)
46311 : {
46312 0 : ROSE_ASSERT(nodeList[i] != NULL);
46313 : #if 0
46314 : traversal.visit(nodeList[i]);
46315 : #else
46316 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
46317 : {
46318 0 : traversal.visit(nodeList[i]);
46319 : }
46320 : #endif
46321 : }
46322 : #endif
46323 : }
46324 :
46325 : // This should not be required since all previously static data members are
46326 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
46327 :
46328 5342 : }
46329 :
46330 :
46331 : void
46332 194 : SgOmpIsDevicePtrClause::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
46333 : {
46334 : // This function traverses the memory pool for an IR node and
46335 : // calls the function to execute the visitor object.
46336 :
46337 : // Initialize array to the address of the first element of the STL vector
46338 : // (which is guarenteed to be contiguous storage).
46339 : // SgOmpIsDevicePtrClause objectArray [] = *(Memory_Block_List.begin());
46340 194 : if (SgOmpIsDevicePtrClause::pools.empty() == false)
46341 : {
46342 : // Generate an array of memory pools
46343 0 : SgOmpIsDevicePtrClause** objectArray = (SgOmpIsDevicePtrClause**) &(SgOmpIsDevicePtrClause::pools[0]);
46344 :
46345 : // Build a local variable for better performance
46346 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
46347 :
46348 : // Iterate over the memory pools
46349 0 : for (unsigned int i=0; i < SgOmpIsDevicePtrClause::pools.size(); i++)
46350 : {
46351 : // objectArray[i] is a single memory pool
46352 0 : for (unsigned j=0; j < SgOmpIsDevicePtrClause::pool_size; j++)
46353 : {
46354 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
46355 : {
46356 : // printf ("Found a valid SgOmpIsDevicePtrClause object in the memory pool %d at position %d \n",i,j);
46357 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
46358 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
46359 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
46360 : }
46361 : else
46362 : {
46363 : // printf ("Found a INVALID SgOmpIsDevicePtrClause object in the memory pool \n");
46364 : }
46365 : }
46366 : }
46367 : }
46368 :
46369 : // This should not be required since all previously static data members are
46370 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
46371 :
46372 194 : }
46373 :
46374 : void
46375 0 : SgOmpIsDevicePtrClause::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
46376 : {
46377 : // This function visits only a single IR node of the memory pool.
46378 : // it is typically called once for each type of IR node within
46379 : // the automatically generated function: traverseRepresentativeNodes().
46380 :
46381 : // Initialize array to the address of the first element of the STL vector
46382 : // (which is guarenteed to be contiguous storage).
46383 : // SgOmpIsDevicePtrClause objectArray [] = *(Memory_Block_List.begin());
46384 0 : if (SgOmpIsDevicePtrClause::pools.empty() == false)
46385 : {
46386 : // Generate an array of memory pools
46387 0 : SgOmpIsDevicePtrClause** objectArray = (SgOmpIsDevicePtrClause**) &(SgOmpIsDevicePtrClause::pools[0]);
46388 :
46389 : // Build a local variable for better performance
46390 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
46391 :
46392 : // Iterate over the memory pools
46393 0 : bool done = false;
46394 0 : unsigned i=0;
46395 :
46396 : // find the first valid IR node, call visit function, and then leave
46397 0 : while ( done == false && i < SgOmpIsDevicePtrClause::pools.size() )
46398 : {
46399 : // objectArray[i] is a single memory pool
46400 : unsigned j=0;
46401 0 : while (done == false && j < SgOmpIsDevicePtrClause::pool_size)
46402 : {
46403 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
46404 : {
46405 0 : traversal.visit(&(objectArray[i][j]));
46406 0 : done = true;
46407 : }
46408 0 : j++;
46409 : }
46410 0 : i++;
46411 : }
46412 :
46413 : #if 0
46414 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
46415 : if (done == false)
46416 : {
46417 : printf ("No representative for SgOmpIsDevicePtrClause found in memory pools \n");
46418 : }
46419 : #endif
46420 : }
46421 0 : }
46422 :
46423 :
46424 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
46425 : // using values that overflow signed values of int.
46426 : size_t
46427 4 : SgOmpIsDevicePtrClause::numberOfNodes()
46428 : {
46429 : // This function traverses the memory pool for an IR node and
46430 : // counts the number of IR nodes of a particular Sage III IR
46431 : // nodes type.
46432 :
46433 4 : size_t count = 0;
46434 4 : if (SgOmpIsDevicePtrClause::pools.empty() == false)
46435 : {
46436 : // Generate an array of memory pools (this is actually a STL vector,
46437 : // but it is contiguious, so OK to treat this way).
46438 0 : SgOmpIsDevicePtrClause** objectArray = (SgOmpIsDevicePtrClause**) &(SgOmpIsDevicePtrClause::pools[0]);
46439 :
46440 : // Build a local variable for better performance (make it a loop invariant variable).
46441 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
46442 :
46443 : // Iterate over all of the memory pools for this IR node.
46444 0 : for (unsigned int i=0; i < SgOmpIsDevicePtrClause::pools.size(); i++)
46445 : {
46446 : // objectArray[i] is a single memory pool, iterate over all the
46447 : // IR nodes and only count those that are valid IR nodes used in
46448 : // the AST (i.e. allocated IR nodes).
46449 0 : for (unsigned j=0; j < SgOmpIsDevicePtrClause::pool_size; j++)
46450 : {
46451 : // This is indexing the STL vector of C/C++ style arrays as a doubly
46452 : // indexed array access. It is OK since we have leveraged the semantics
46453 : // of STL vector memory as contigous and cast the memory as an array
46454 : // of arrays to use the 2D array indexing. Hope this is not confusing,
46455 : // but it s very fast as an implementation.
46456 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
46457 : {
46458 0 : count++;
46459 : }
46460 : }
46461 : }
46462 : }
46463 :
46464 :
46465 :
46466 4 : return count;
46467 : }
46468 :
46469 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
46470 : // using values that overflow signed values of int.
46471 : size_t
46472 0 : SgOmpIsDevicePtrClause::memoryUsage()
46473 : {
46474 : // This function is required because we need the class name as a type when we call sizeof
46475 : // There might be another way to implement this if we have a traversal that only called a
46476 : // representative object (one call for each type of Sage IIIIR node).
46477 0 : size_t memory = numberOfNodes() * sizeof(SgOmpIsDevicePtrClause);
46478 :
46479 0 : return memory;
46480 : }
46481 :
46482 : /* #line 46483 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
46483 :
46484 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
46485 : void
46486 5342 : SgOmpUseDevicePtrClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
46487 : {
46488 : // This function traverses the memory pool for only a specific IR node
46489 : // and calls the visit function of the input class execute a traversal
46490 : // similar to the style of the attribute based traversals within ROSE.
46491 : // This traversal will visit ALL nodes of the AST where as the other
46492 : // attribute based traversals visit only the embedded tree within the AST.
46493 :
46494 : // Initialize array to the address of the first element of the STL vector
46495 : // (which is guaranteed to be contiguous storage).
46496 : // SgOmpUseDevicePtrClause objectArray [] = *(Memory_Block_List.begin());
46497 5342 : if (SgOmpUseDevicePtrClause::pools.empty() == false)
46498 : {
46499 : // Generate an array of memory pools
46500 0 : SgOmpUseDevicePtrClause** objectArray = (SgOmpUseDevicePtrClause**) &(SgOmpUseDevicePtrClause::pools[0]);
46501 :
46502 : // Build a local variable for better performance
46503 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
46504 : #if 0
46505 : // Iterate over the memory pools
46506 : for (unsigned int i=0; i < SgOmpUseDevicePtrClause::pools.size(); i++)
46507 : {
46508 : // objectArray[i] is a single memory pool
46509 : for (int j=0; j < SgOmpUseDevicePtrClause::pool_size; j++)
46510 : {
46511 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
46512 : {
46513 : traversal.visit(&(objectArray[i][j]));
46514 : }
46515 : }
46516 : }
46517 : #else
46518 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
46519 : // compute the list first and then call the visit function on each list element.
46520 :
46521 : // printf ("Inside of SgOmpUseDevicePtrClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
46522 :
46523 0 : std::vector<SgOmpUseDevicePtrClause*> nodeList;
46524 :
46525 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
46526 0 : for (unsigned int i=0; i < SgOmpUseDevicePtrClause::pools.size(); i++)
46527 : {
46528 : // objectArray[i] is a single memory pool
46529 0 : for (unsigned j=0; j < SgOmpUseDevicePtrClause::pool_size; j++)
46530 : {
46531 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
46532 : {
46533 0 : nodeList.push_back(&(objectArray[i][j]));
46534 : }
46535 : }
46536 : }
46537 :
46538 : // Iterate over the saved list
46539 0 : size_t nodeListSize = nodeList.size();
46540 0 : for (size_t i=0; i < nodeListSize; i++)
46541 : {
46542 0 : ROSE_ASSERT(nodeList[i] != NULL);
46543 : #if 0
46544 : traversal.visit(nodeList[i]);
46545 : #else
46546 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
46547 : {
46548 0 : traversal.visit(nodeList[i]);
46549 : }
46550 : #endif
46551 : }
46552 : #endif
46553 : }
46554 :
46555 : // This should not be required since all previously static data members are
46556 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
46557 :
46558 5342 : }
46559 :
46560 :
46561 : void
46562 194 : SgOmpUseDevicePtrClause::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
46563 : {
46564 : // This function traverses the memory pool for an IR node and
46565 : // calls the function to execute the visitor object.
46566 :
46567 : // Initialize array to the address of the first element of the STL vector
46568 : // (which is guarenteed to be contiguous storage).
46569 : // SgOmpUseDevicePtrClause objectArray [] = *(Memory_Block_List.begin());
46570 194 : if (SgOmpUseDevicePtrClause::pools.empty() == false)
46571 : {
46572 : // Generate an array of memory pools
46573 0 : SgOmpUseDevicePtrClause** objectArray = (SgOmpUseDevicePtrClause**) &(SgOmpUseDevicePtrClause::pools[0]);
46574 :
46575 : // Build a local variable for better performance
46576 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
46577 :
46578 : // Iterate over the memory pools
46579 0 : for (unsigned int i=0; i < SgOmpUseDevicePtrClause::pools.size(); i++)
46580 : {
46581 : // objectArray[i] is a single memory pool
46582 0 : for (unsigned j=0; j < SgOmpUseDevicePtrClause::pool_size; j++)
46583 : {
46584 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
46585 : {
46586 : // printf ("Found a valid SgOmpUseDevicePtrClause object in the memory pool %d at position %d \n",i,j);
46587 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
46588 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
46589 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
46590 : }
46591 : else
46592 : {
46593 : // printf ("Found a INVALID SgOmpUseDevicePtrClause object in the memory pool \n");
46594 : }
46595 : }
46596 : }
46597 : }
46598 :
46599 : // This should not be required since all previously static data members are
46600 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
46601 :
46602 194 : }
46603 :
46604 : void
46605 0 : SgOmpUseDevicePtrClause::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
46606 : {
46607 : // This function visits only a single IR node of the memory pool.
46608 : // it is typically called once for each type of IR node within
46609 : // the automatically generated function: traverseRepresentativeNodes().
46610 :
46611 : // Initialize array to the address of the first element of the STL vector
46612 : // (which is guarenteed to be contiguous storage).
46613 : // SgOmpUseDevicePtrClause objectArray [] = *(Memory_Block_List.begin());
46614 0 : if (SgOmpUseDevicePtrClause::pools.empty() == false)
46615 : {
46616 : // Generate an array of memory pools
46617 0 : SgOmpUseDevicePtrClause** objectArray = (SgOmpUseDevicePtrClause**) &(SgOmpUseDevicePtrClause::pools[0]);
46618 :
46619 : // Build a local variable for better performance
46620 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
46621 :
46622 : // Iterate over the memory pools
46623 0 : bool done = false;
46624 0 : unsigned i=0;
46625 :
46626 : // find the first valid IR node, call visit function, and then leave
46627 0 : while ( done == false && i < SgOmpUseDevicePtrClause::pools.size() )
46628 : {
46629 : // objectArray[i] is a single memory pool
46630 : unsigned j=0;
46631 0 : while (done == false && j < SgOmpUseDevicePtrClause::pool_size)
46632 : {
46633 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
46634 : {
46635 0 : traversal.visit(&(objectArray[i][j]));
46636 0 : done = true;
46637 : }
46638 0 : j++;
46639 : }
46640 0 : i++;
46641 : }
46642 :
46643 : #if 0
46644 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
46645 : if (done == false)
46646 : {
46647 : printf ("No representative for SgOmpUseDevicePtrClause found in memory pools \n");
46648 : }
46649 : #endif
46650 : }
46651 0 : }
46652 :
46653 :
46654 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
46655 : // using values that overflow signed values of int.
46656 : size_t
46657 4 : SgOmpUseDevicePtrClause::numberOfNodes()
46658 : {
46659 : // This function traverses the memory pool for an IR node and
46660 : // counts the number of IR nodes of a particular Sage III IR
46661 : // nodes type.
46662 :
46663 4 : size_t count = 0;
46664 4 : if (SgOmpUseDevicePtrClause::pools.empty() == false)
46665 : {
46666 : // Generate an array of memory pools (this is actually a STL vector,
46667 : // but it is contiguious, so OK to treat this way).
46668 0 : SgOmpUseDevicePtrClause** objectArray = (SgOmpUseDevicePtrClause**) &(SgOmpUseDevicePtrClause::pools[0]);
46669 :
46670 : // Build a local variable for better performance (make it a loop invariant variable).
46671 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
46672 :
46673 : // Iterate over all of the memory pools for this IR node.
46674 0 : for (unsigned int i=0; i < SgOmpUseDevicePtrClause::pools.size(); i++)
46675 : {
46676 : // objectArray[i] is a single memory pool, iterate over all the
46677 : // IR nodes and only count those that are valid IR nodes used in
46678 : // the AST (i.e. allocated IR nodes).
46679 0 : for (unsigned j=0; j < SgOmpUseDevicePtrClause::pool_size; j++)
46680 : {
46681 : // This is indexing the STL vector of C/C++ style arrays as a doubly
46682 : // indexed array access. It is OK since we have leveraged the semantics
46683 : // of STL vector memory as contigous and cast the memory as an array
46684 : // of arrays to use the 2D array indexing. Hope this is not confusing,
46685 : // but it s very fast as an implementation.
46686 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
46687 : {
46688 0 : count++;
46689 : }
46690 : }
46691 : }
46692 : }
46693 :
46694 :
46695 :
46696 4 : return count;
46697 : }
46698 :
46699 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
46700 : // using values that overflow signed values of int.
46701 : size_t
46702 0 : SgOmpUseDevicePtrClause::memoryUsage()
46703 : {
46704 : // This function is required because we need the class name as a type when we call sizeof
46705 : // There might be another way to implement this if we have a traversal that only called a
46706 : // representative object (one call for each type of Sage IIIIR node).
46707 0 : size_t memory = numberOfNodes() * sizeof(SgOmpUseDevicePtrClause);
46708 :
46709 0 : return memory;
46710 : }
46711 :
46712 : /* #line 46713 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
46713 :
46714 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
46715 : void
46716 5342 : SgOmpUseDeviceAddrClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
46717 : {
46718 : // This function traverses the memory pool for only a specific IR node
46719 : // and calls the visit function of the input class execute a traversal
46720 : // similar to the style of the attribute based traversals within ROSE.
46721 : // This traversal will visit ALL nodes of the AST where as the other
46722 : // attribute based traversals visit only the embedded tree within the AST.
46723 :
46724 : // Initialize array to the address of the first element of the STL vector
46725 : // (which is guaranteed to be contiguous storage).
46726 : // SgOmpUseDeviceAddrClause objectArray [] = *(Memory_Block_List.begin());
46727 5342 : if (SgOmpUseDeviceAddrClause::pools.empty() == false)
46728 : {
46729 : // Generate an array of memory pools
46730 0 : SgOmpUseDeviceAddrClause** objectArray = (SgOmpUseDeviceAddrClause**) &(SgOmpUseDeviceAddrClause::pools[0]);
46731 :
46732 : // Build a local variable for better performance
46733 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
46734 : #if 0
46735 : // Iterate over the memory pools
46736 : for (unsigned int i=0; i < SgOmpUseDeviceAddrClause::pools.size(); i++)
46737 : {
46738 : // objectArray[i] is a single memory pool
46739 : for (int j=0; j < SgOmpUseDeviceAddrClause::pool_size; j++)
46740 : {
46741 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
46742 : {
46743 : traversal.visit(&(objectArray[i][j]));
46744 : }
46745 : }
46746 : }
46747 : #else
46748 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
46749 : // compute the list first and then call the visit function on each list element.
46750 :
46751 : // printf ("Inside of SgOmpUseDeviceAddrClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
46752 :
46753 0 : std::vector<SgOmpUseDeviceAddrClause*> nodeList;
46754 :
46755 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
46756 0 : for (unsigned int i=0; i < SgOmpUseDeviceAddrClause::pools.size(); i++)
46757 : {
46758 : // objectArray[i] is a single memory pool
46759 0 : for (unsigned j=0; j < SgOmpUseDeviceAddrClause::pool_size; j++)
46760 : {
46761 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
46762 : {
46763 0 : nodeList.push_back(&(objectArray[i][j]));
46764 : }
46765 : }
46766 : }
46767 :
46768 : // Iterate over the saved list
46769 0 : size_t nodeListSize = nodeList.size();
46770 0 : for (size_t i=0; i < nodeListSize; i++)
46771 : {
46772 0 : ROSE_ASSERT(nodeList[i] != NULL);
46773 : #if 0
46774 : traversal.visit(nodeList[i]);
46775 : #else
46776 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
46777 : {
46778 0 : traversal.visit(nodeList[i]);
46779 : }
46780 : #endif
46781 : }
46782 : #endif
46783 : }
46784 :
46785 : // This should not be required since all previously static data members are
46786 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
46787 :
46788 5342 : }
46789 :
46790 :
46791 : void
46792 194 : SgOmpUseDeviceAddrClause::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
46793 : {
46794 : // This function traverses the memory pool for an IR node and
46795 : // calls the function to execute the visitor object.
46796 :
46797 : // Initialize array to the address of the first element of the STL vector
46798 : // (which is guarenteed to be contiguous storage).
46799 : // SgOmpUseDeviceAddrClause objectArray [] = *(Memory_Block_List.begin());
46800 194 : if (SgOmpUseDeviceAddrClause::pools.empty() == false)
46801 : {
46802 : // Generate an array of memory pools
46803 0 : SgOmpUseDeviceAddrClause** objectArray = (SgOmpUseDeviceAddrClause**) &(SgOmpUseDeviceAddrClause::pools[0]);
46804 :
46805 : // Build a local variable for better performance
46806 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
46807 :
46808 : // Iterate over the memory pools
46809 0 : for (unsigned int i=0; i < SgOmpUseDeviceAddrClause::pools.size(); i++)
46810 : {
46811 : // objectArray[i] is a single memory pool
46812 0 : for (unsigned j=0; j < SgOmpUseDeviceAddrClause::pool_size; j++)
46813 : {
46814 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
46815 : {
46816 : // printf ("Found a valid SgOmpUseDeviceAddrClause object in the memory pool %d at position %d \n",i,j);
46817 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
46818 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
46819 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
46820 : }
46821 : else
46822 : {
46823 : // printf ("Found a INVALID SgOmpUseDeviceAddrClause object in the memory pool \n");
46824 : }
46825 : }
46826 : }
46827 : }
46828 :
46829 : // This should not be required since all previously static data members are
46830 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
46831 :
46832 194 : }
46833 :
46834 : void
46835 0 : SgOmpUseDeviceAddrClause::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
46836 : {
46837 : // This function visits only a single IR node of the memory pool.
46838 : // it is typically called once for each type of IR node within
46839 : // the automatically generated function: traverseRepresentativeNodes().
46840 :
46841 : // Initialize array to the address of the first element of the STL vector
46842 : // (which is guarenteed to be contiguous storage).
46843 : // SgOmpUseDeviceAddrClause objectArray [] = *(Memory_Block_List.begin());
46844 0 : if (SgOmpUseDeviceAddrClause::pools.empty() == false)
46845 : {
46846 : // Generate an array of memory pools
46847 0 : SgOmpUseDeviceAddrClause** objectArray = (SgOmpUseDeviceAddrClause**) &(SgOmpUseDeviceAddrClause::pools[0]);
46848 :
46849 : // Build a local variable for better performance
46850 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
46851 :
46852 : // Iterate over the memory pools
46853 0 : bool done = false;
46854 0 : unsigned i=0;
46855 :
46856 : // find the first valid IR node, call visit function, and then leave
46857 0 : while ( done == false && i < SgOmpUseDeviceAddrClause::pools.size() )
46858 : {
46859 : // objectArray[i] is a single memory pool
46860 : unsigned j=0;
46861 0 : while (done == false && j < SgOmpUseDeviceAddrClause::pool_size)
46862 : {
46863 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
46864 : {
46865 0 : traversal.visit(&(objectArray[i][j]));
46866 0 : done = true;
46867 : }
46868 0 : j++;
46869 : }
46870 0 : i++;
46871 : }
46872 :
46873 : #if 0
46874 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
46875 : if (done == false)
46876 : {
46877 : printf ("No representative for SgOmpUseDeviceAddrClause found in memory pools \n");
46878 : }
46879 : #endif
46880 : }
46881 0 : }
46882 :
46883 :
46884 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
46885 : // using values that overflow signed values of int.
46886 : size_t
46887 4 : SgOmpUseDeviceAddrClause::numberOfNodes()
46888 : {
46889 : // This function traverses the memory pool for an IR node and
46890 : // counts the number of IR nodes of a particular Sage III IR
46891 : // nodes type.
46892 :
46893 4 : size_t count = 0;
46894 4 : if (SgOmpUseDeviceAddrClause::pools.empty() == false)
46895 : {
46896 : // Generate an array of memory pools (this is actually a STL vector,
46897 : // but it is contiguious, so OK to treat this way).
46898 0 : SgOmpUseDeviceAddrClause** objectArray = (SgOmpUseDeviceAddrClause**) &(SgOmpUseDeviceAddrClause::pools[0]);
46899 :
46900 : // Build a local variable for better performance (make it a loop invariant variable).
46901 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
46902 :
46903 : // Iterate over all of the memory pools for this IR node.
46904 0 : for (unsigned int i=0; i < SgOmpUseDeviceAddrClause::pools.size(); i++)
46905 : {
46906 : // objectArray[i] is a single memory pool, iterate over all the
46907 : // IR nodes and only count those that are valid IR nodes used in
46908 : // the AST (i.e. allocated IR nodes).
46909 0 : for (unsigned j=0; j < SgOmpUseDeviceAddrClause::pool_size; j++)
46910 : {
46911 : // This is indexing the STL vector of C/C++ style arrays as a doubly
46912 : // indexed array access. It is OK since we have leveraged the semantics
46913 : // of STL vector memory as contigous and cast the memory as an array
46914 : // of arrays to use the 2D array indexing. Hope this is not confusing,
46915 : // but it s very fast as an implementation.
46916 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
46917 : {
46918 0 : count++;
46919 : }
46920 : }
46921 : }
46922 : }
46923 :
46924 :
46925 :
46926 4 : return count;
46927 : }
46928 :
46929 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
46930 : // using values that overflow signed values of int.
46931 : size_t
46932 0 : SgOmpUseDeviceAddrClause::memoryUsage()
46933 : {
46934 : // This function is required because we need the class name as a type when we call sizeof
46935 : // There might be another way to implement this if we have a traversal that only called a
46936 : // representative object (one call for each type of Sage IIIIR node).
46937 0 : size_t memory = numberOfNodes() * sizeof(SgOmpUseDeviceAddrClause);
46938 :
46939 0 : return memory;
46940 : }
46941 :
46942 : /* #line 46943 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
46943 :
46944 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
46945 : void
46946 5342 : SgOmpSharedClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
46947 : {
46948 : // This function traverses the memory pool for only a specific IR node
46949 : // and calls the visit function of the input class execute a traversal
46950 : // similar to the style of the attribute based traversals within ROSE.
46951 : // This traversal will visit ALL nodes of the AST where as the other
46952 : // attribute based traversals visit only the embedded tree within the AST.
46953 :
46954 : // Initialize array to the address of the first element of the STL vector
46955 : // (which is guaranteed to be contiguous storage).
46956 : // SgOmpSharedClause objectArray [] = *(Memory_Block_List.begin());
46957 5342 : if (SgOmpSharedClause::pools.empty() == false)
46958 : {
46959 : // Generate an array of memory pools
46960 182 : SgOmpSharedClause** objectArray = (SgOmpSharedClause**) &(SgOmpSharedClause::pools[0]);
46961 :
46962 : // Build a local variable for better performance
46963 182 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
46964 : #if 0
46965 : // Iterate over the memory pools
46966 : for (unsigned int i=0; i < SgOmpSharedClause::pools.size(); i++)
46967 : {
46968 : // objectArray[i] is a single memory pool
46969 : for (int j=0; j < SgOmpSharedClause::pool_size; j++)
46970 : {
46971 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
46972 : {
46973 : traversal.visit(&(objectArray[i][j]));
46974 : }
46975 : }
46976 : }
46977 : #else
46978 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
46979 : // compute the list first and then call the visit function on each list element.
46980 :
46981 : // printf ("Inside of SgOmpSharedClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
46982 :
46983 364 : std::vector<SgOmpSharedClause*> nodeList;
46984 :
46985 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
46986 364 : for (unsigned int i=0; i < SgOmpSharedClause::pools.size(); i++)
46987 : {
46988 : // objectArray[i] is a single memory pool
46989 364182 : for (unsigned j=0; j < SgOmpSharedClause::pool_size; j++)
46990 : {
46991 364000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
46992 : {
46993 357 : nodeList.push_back(&(objectArray[i][j]));
46994 : }
46995 : }
46996 : }
46997 :
46998 : // Iterate over the saved list
46999 182 : size_t nodeListSize = nodeList.size();
47000 539 : for (size_t i=0; i < nodeListSize; i++)
47001 : {
47002 357 : ROSE_ASSERT(nodeList[i] != NULL);
47003 : #if 0
47004 : traversal.visit(nodeList[i]);
47005 : #else
47006 357 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
47007 : {
47008 357 : traversal.visit(nodeList[i]);
47009 : }
47010 : #endif
47011 : }
47012 : #endif
47013 : }
47014 :
47015 : // This should not be required since all previously static data members are
47016 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
47017 :
47018 5342 : }
47019 :
47020 :
47021 : void
47022 194 : SgOmpSharedClause::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
47023 : {
47024 : // This function traverses the memory pool for an IR node and
47025 : // calls the function to execute the visitor object.
47026 :
47027 : // Initialize array to the address of the first element of the STL vector
47028 : // (which is guarenteed to be contiguous storage).
47029 : // SgOmpSharedClause objectArray [] = *(Memory_Block_List.begin());
47030 194 : if (SgOmpSharedClause::pools.empty() == false)
47031 : {
47032 : // Generate an array of memory pools
47033 0 : SgOmpSharedClause** objectArray = (SgOmpSharedClause**) &(SgOmpSharedClause::pools[0]);
47034 :
47035 : // Build a local variable for better performance
47036 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
47037 :
47038 : // Iterate over the memory pools
47039 0 : for (unsigned int i=0; i < SgOmpSharedClause::pools.size(); i++)
47040 : {
47041 : // objectArray[i] is a single memory pool
47042 0 : for (unsigned j=0; j < SgOmpSharedClause::pool_size; j++)
47043 : {
47044 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
47045 : {
47046 : // printf ("Found a valid SgOmpSharedClause object in the memory pool %d at position %d \n",i,j);
47047 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
47048 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
47049 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
47050 : }
47051 : else
47052 : {
47053 : // printf ("Found a INVALID SgOmpSharedClause object in the memory pool \n");
47054 : }
47055 : }
47056 : }
47057 : }
47058 :
47059 : // This should not be required since all previously static data members are
47060 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
47061 :
47062 194 : }
47063 :
47064 : void
47065 0 : SgOmpSharedClause::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
47066 : {
47067 : // This function visits only a single IR node of the memory pool.
47068 : // it is typically called once for each type of IR node within
47069 : // the automatically generated function: traverseRepresentativeNodes().
47070 :
47071 : // Initialize array to the address of the first element of the STL vector
47072 : // (which is guarenteed to be contiguous storage).
47073 : // SgOmpSharedClause objectArray [] = *(Memory_Block_List.begin());
47074 0 : if (SgOmpSharedClause::pools.empty() == false)
47075 : {
47076 : // Generate an array of memory pools
47077 0 : SgOmpSharedClause** objectArray = (SgOmpSharedClause**) &(SgOmpSharedClause::pools[0]);
47078 :
47079 : // Build a local variable for better performance
47080 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
47081 :
47082 : // Iterate over the memory pools
47083 0 : bool done = false;
47084 0 : unsigned i=0;
47085 :
47086 : // find the first valid IR node, call visit function, and then leave
47087 0 : while ( done == false && i < SgOmpSharedClause::pools.size() )
47088 : {
47089 : // objectArray[i] is a single memory pool
47090 : unsigned j=0;
47091 0 : while (done == false && j < SgOmpSharedClause::pool_size)
47092 : {
47093 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
47094 : {
47095 0 : traversal.visit(&(objectArray[i][j]));
47096 0 : done = true;
47097 : }
47098 0 : j++;
47099 : }
47100 0 : i++;
47101 : }
47102 :
47103 : #if 0
47104 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
47105 : if (done == false)
47106 : {
47107 : printf ("No representative for SgOmpSharedClause found in memory pools \n");
47108 : }
47109 : #endif
47110 : }
47111 0 : }
47112 :
47113 :
47114 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
47115 : // using values that overflow signed values of int.
47116 : size_t
47117 4 : SgOmpSharedClause::numberOfNodes()
47118 : {
47119 : // This function traverses the memory pool for an IR node and
47120 : // counts the number of IR nodes of a particular Sage III IR
47121 : // nodes type.
47122 :
47123 4 : size_t count = 0;
47124 4 : if (SgOmpSharedClause::pools.empty() == false)
47125 : {
47126 : // Generate an array of memory pools (this is actually a STL vector,
47127 : // but it is contiguious, so OK to treat this way).
47128 0 : SgOmpSharedClause** objectArray = (SgOmpSharedClause**) &(SgOmpSharedClause::pools[0]);
47129 :
47130 : // Build a local variable for better performance (make it a loop invariant variable).
47131 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
47132 :
47133 : // Iterate over all of the memory pools for this IR node.
47134 0 : for (unsigned int i=0; i < SgOmpSharedClause::pools.size(); i++)
47135 : {
47136 : // objectArray[i] is a single memory pool, iterate over all the
47137 : // IR nodes and only count those that are valid IR nodes used in
47138 : // the AST (i.e. allocated IR nodes).
47139 0 : for (unsigned j=0; j < SgOmpSharedClause::pool_size; j++)
47140 : {
47141 : // This is indexing the STL vector of C/C++ style arrays as a doubly
47142 : // indexed array access. It is OK since we have leveraged the semantics
47143 : // of STL vector memory as contigous and cast the memory as an array
47144 : // of arrays to use the 2D array indexing. Hope this is not confusing,
47145 : // but it s very fast as an implementation.
47146 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
47147 : {
47148 0 : count++;
47149 : }
47150 : }
47151 : }
47152 : }
47153 :
47154 :
47155 :
47156 4 : return count;
47157 : }
47158 :
47159 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
47160 : // using values that overflow signed values of int.
47161 : size_t
47162 0 : SgOmpSharedClause::memoryUsage()
47163 : {
47164 : // This function is required because we need the class name as a type when we call sizeof
47165 : // There might be another way to implement this if we have a traversal that only called a
47166 : // representative object (one call for each type of Sage IIIIR node).
47167 0 : size_t memory = numberOfNodes() * sizeof(SgOmpSharedClause);
47168 :
47169 0 : return memory;
47170 : }
47171 :
47172 : /* #line 47173 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
47173 :
47174 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
47175 : void
47176 5342 : SgOmpCopyinClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
47177 : {
47178 : // This function traverses the memory pool for only a specific IR node
47179 : // and calls the visit function of the input class execute a traversal
47180 : // similar to the style of the attribute based traversals within ROSE.
47181 : // This traversal will visit ALL nodes of the AST where as the other
47182 : // attribute based traversals visit only the embedded tree within the AST.
47183 :
47184 : // Initialize array to the address of the first element of the STL vector
47185 : // (which is guaranteed to be contiguous storage).
47186 : // SgOmpCopyinClause objectArray [] = *(Memory_Block_List.begin());
47187 5342 : if (SgOmpCopyinClause::pools.empty() == false)
47188 : {
47189 : // Generate an array of memory pools
47190 7 : SgOmpCopyinClause** objectArray = (SgOmpCopyinClause**) &(SgOmpCopyinClause::pools[0]);
47191 :
47192 : // Build a local variable for better performance
47193 7 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
47194 : #if 0
47195 : // Iterate over the memory pools
47196 : for (unsigned int i=0; i < SgOmpCopyinClause::pools.size(); i++)
47197 : {
47198 : // objectArray[i] is a single memory pool
47199 : for (int j=0; j < SgOmpCopyinClause::pool_size; j++)
47200 : {
47201 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
47202 : {
47203 : traversal.visit(&(objectArray[i][j]));
47204 : }
47205 : }
47206 : }
47207 : #else
47208 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
47209 : // compute the list first and then call the visit function on each list element.
47210 :
47211 : // printf ("Inside of SgOmpCopyinClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
47212 :
47213 14 : std::vector<SgOmpCopyinClause*> nodeList;
47214 :
47215 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
47216 14 : for (unsigned int i=0; i < SgOmpCopyinClause::pools.size(); i++)
47217 : {
47218 : // objectArray[i] is a single memory pool
47219 14007 : for (unsigned j=0; j < SgOmpCopyinClause::pool_size; j++)
47220 : {
47221 14000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
47222 : {
47223 7 : nodeList.push_back(&(objectArray[i][j]));
47224 : }
47225 : }
47226 : }
47227 :
47228 : // Iterate over the saved list
47229 7 : size_t nodeListSize = nodeList.size();
47230 14 : for (size_t i=0; i < nodeListSize; i++)
47231 : {
47232 7 : ROSE_ASSERT(nodeList[i] != NULL);
47233 : #if 0
47234 : traversal.visit(nodeList[i]);
47235 : #else
47236 7 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
47237 : {
47238 7 : traversal.visit(nodeList[i]);
47239 : }
47240 : #endif
47241 : }
47242 : #endif
47243 : }
47244 :
47245 : // This should not be required since all previously static data members are
47246 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
47247 :
47248 5342 : }
47249 :
47250 :
47251 : void
47252 194 : SgOmpCopyinClause::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
47253 : {
47254 : // This function traverses the memory pool for an IR node and
47255 : // calls the function to execute the visitor object.
47256 :
47257 : // Initialize array to the address of the first element of the STL vector
47258 : // (which is guarenteed to be contiguous storage).
47259 : // SgOmpCopyinClause objectArray [] = *(Memory_Block_List.begin());
47260 194 : if (SgOmpCopyinClause::pools.empty() == false)
47261 : {
47262 : // Generate an array of memory pools
47263 0 : SgOmpCopyinClause** objectArray = (SgOmpCopyinClause**) &(SgOmpCopyinClause::pools[0]);
47264 :
47265 : // Build a local variable for better performance
47266 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
47267 :
47268 : // Iterate over the memory pools
47269 0 : for (unsigned int i=0; i < SgOmpCopyinClause::pools.size(); i++)
47270 : {
47271 : // objectArray[i] is a single memory pool
47272 0 : for (unsigned j=0; j < SgOmpCopyinClause::pool_size; j++)
47273 : {
47274 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
47275 : {
47276 : // printf ("Found a valid SgOmpCopyinClause object in the memory pool %d at position %d \n",i,j);
47277 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
47278 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
47279 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
47280 : }
47281 : else
47282 : {
47283 : // printf ("Found a INVALID SgOmpCopyinClause object in the memory pool \n");
47284 : }
47285 : }
47286 : }
47287 : }
47288 :
47289 : // This should not be required since all previously static data members are
47290 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
47291 :
47292 194 : }
47293 :
47294 : void
47295 0 : SgOmpCopyinClause::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
47296 : {
47297 : // This function visits only a single IR node of the memory pool.
47298 : // it is typically called once for each type of IR node within
47299 : // the automatically generated function: traverseRepresentativeNodes().
47300 :
47301 : // Initialize array to the address of the first element of the STL vector
47302 : // (which is guarenteed to be contiguous storage).
47303 : // SgOmpCopyinClause objectArray [] = *(Memory_Block_List.begin());
47304 0 : if (SgOmpCopyinClause::pools.empty() == false)
47305 : {
47306 : // Generate an array of memory pools
47307 0 : SgOmpCopyinClause** objectArray = (SgOmpCopyinClause**) &(SgOmpCopyinClause::pools[0]);
47308 :
47309 : // Build a local variable for better performance
47310 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
47311 :
47312 : // Iterate over the memory pools
47313 0 : bool done = false;
47314 0 : unsigned i=0;
47315 :
47316 : // find the first valid IR node, call visit function, and then leave
47317 0 : while ( done == false && i < SgOmpCopyinClause::pools.size() )
47318 : {
47319 : // objectArray[i] is a single memory pool
47320 : unsigned j=0;
47321 0 : while (done == false && j < SgOmpCopyinClause::pool_size)
47322 : {
47323 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
47324 : {
47325 0 : traversal.visit(&(objectArray[i][j]));
47326 0 : done = true;
47327 : }
47328 0 : j++;
47329 : }
47330 0 : i++;
47331 : }
47332 :
47333 : #if 0
47334 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
47335 : if (done == false)
47336 : {
47337 : printf ("No representative for SgOmpCopyinClause found in memory pools \n");
47338 : }
47339 : #endif
47340 : }
47341 0 : }
47342 :
47343 :
47344 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
47345 : // using values that overflow signed values of int.
47346 : size_t
47347 4 : SgOmpCopyinClause::numberOfNodes()
47348 : {
47349 : // This function traverses the memory pool for an IR node and
47350 : // counts the number of IR nodes of a particular Sage III IR
47351 : // nodes type.
47352 :
47353 4 : size_t count = 0;
47354 4 : if (SgOmpCopyinClause::pools.empty() == false)
47355 : {
47356 : // Generate an array of memory pools (this is actually a STL vector,
47357 : // but it is contiguious, so OK to treat this way).
47358 0 : SgOmpCopyinClause** objectArray = (SgOmpCopyinClause**) &(SgOmpCopyinClause::pools[0]);
47359 :
47360 : // Build a local variable for better performance (make it a loop invariant variable).
47361 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
47362 :
47363 : // Iterate over all of the memory pools for this IR node.
47364 0 : for (unsigned int i=0; i < SgOmpCopyinClause::pools.size(); i++)
47365 : {
47366 : // objectArray[i] is a single memory pool, iterate over all the
47367 : // IR nodes and only count those that are valid IR nodes used in
47368 : // the AST (i.e. allocated IR nodes).
47369 0 : for (unsigned j=0; j < SgOmpCopyinClause::pool_size; j++)
47370 : {
47371 : // This is indexing the STL vector of C/C++ style arrays as a doubly
47372 : // indexed array access. It is OK since we have leveraged the semantics
47373 : // of STL vector memory as contigous and cast the memory as an array
47374 : // of arrays to use the 2D array indexing. Hope this is not confusing,
47375 : // but it s very fast as an implementation.
47376 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
47377 : {
47378 0 : count++;
47379 : }
47380 : }
47381 : }
47382 : }
47383 :
47384 :
47385 :
47386 4 : return count;
47387 : }
47388 :
47389 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
47390 : // using values that overflow signed values of int.
47391 : size_t
47392 0 : SgOmpCopyinClause::memoryUsage()
47393 : {
47394 : // This function is required because we need the class name as a type when we call sizeof
47395 : // There might be another way to implement this if we have a traversal that only called a
47396 : // representative object (one call for each type of Sage IIIIR node).
47397 0 : size_t memory = numberOfNodes() * sizeof(SgOmpCopyinClause);
47398 :
47399 0 : return memory;
47400 : }
47401 :
47402 : /* #line 47403 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
47403 :
47404 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
47405 : void
47406 5342 : SgOmpLastprivateClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
47407 : {
47408 : // This function traverses the memory pool for only a specific IR node
47409 : // and calls the visit function of the input class execute a traversal
47410 : // similar to the style of the attribute based traversals within ROSE.
47411 : // This traversal will visit ALL nodes of the AST where as the other
47412 : // attribute based traversals visit only the embedded tree within the AST.
47413 :
47414 : // Initialize array to the address of the first element of the STL vector
47415 : // (which is guaranteed to be contiguous storage).
47416 : // SgOmpLastprivateClause objectArray [] = *(Memory_Block_List.begin());
47417 5342 : if (SgOmpLastprivateClause::pools.empty() == false)
47418 : {
47419 : // Generate an array of memory pools
47420 91 : SgOmpLastprivateClause** objectArray = (SgOmpLastprivateClause**) &(SgOmpLastprivateClause::pools[0]);
47421 :
47422 : // Build a local variable for better performance
47423 91 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
47424 : #if 0
47425 : // Iterate over the memory pools
47426 : for (unsigned int i=0; i < SgOmpLastprivateClause::pools.size(); i++)
47427 : {
47428 : // objectArray[i] is a single memory pool
47429 : for (int j=0; j < SgOmpLastprivateClause::pool_size; j++)
47430 : {
47431 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
47432 : {
47433 : traversal.visit(&(objectArray[i][j]));
47434 : }
47435 : }
47436 : }
47437 : #else
47438 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
47439 : // compute the list first and then call the visit function on each list element.
47440 :
47441 : // printf ("Inside of SgOmpLastprivateClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
47442 :
47443 182 : std::vector<SgOmpLastprivateClause*> nodeList;
47444 :
47445 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
47446 182 : for (unsigned int i=0; i < SgOmpLastprivateClause::pools.size(); i++)
47447 : {
47448 : // objectArray[i] is a single memory pool
47449 182091 : for (unsigned j=0; j < SgOmpLastprivateClause::pool_size; j++)
47450 : {
47451 182000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
47452 : {
47453 98 : nodeList.push_back(&(objectArray[i][j]));
47454 : }
47455 : }
47456 : }
47457 :
47458 : // Iterate over the saved list
47459 91 : size_t nodeListSize = nodeList.size();
47460 189 : for (size_t i=0; i < nodeListSize; i++)
47461 : {
47462 98 : ROSE_ASSERT(nodeList[i] != NULL);
47463 : #if 0
47464 : traversal.visit(nodeList[i]);
47465 : #else
47466 98 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
47467 : {
47468 98 : traversal.visit(nodeList[i]);
47469 : }
47470 : #endif
47471 : }
47472 : #endif
47473 : }
47474 :
47475 : // This should not be required since all previously static data members are
47476 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
47477 :
47478 5342 : }
47479 :
47480 :
47481 : void
47482 194 : SgOmpLastprivateClause::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
47483 : {
47484 : // This function traverses the memory pool for an IR node and
47485 : // calls the function to execute the visitor object.
47486 :
47487 : // Initialize array to the address of the first element of the STL vector
47488 : // (which is guarenteed to be contiguous storage).
47489 : // SgOmpLastprivateClause objectArray [] = *(Memory_Block_List.begin());
47490 194 : if (SgOmpLastprivateClause::pools.empty() == false)
47491 : {
47492 : // Generate an array of memory pools
47493 0 : SgOmpLastprivateClause** objectArray = (SgOmpLastprivateClause**) &(SgOmpLastprivateClause::pools[0]);
47494 :
47495 : // Build a local variable for better performance
47496 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
47497 :
47498 : // Iterate over the memory pools
47499 0 : for (unsigned int i=0; i < SgOmpLastprivateClause::pools.size(); i++)
47500 : {
47501 : // objectArray[i] is a single memory pool
47502 0 : for (unsigned j=0; j < SgOmpLastprivateClause::pool_size; j++)
47503 : {
47504 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
47505 : {
47506 : // printf ("Found a valid SgOmpLastprivateClause object in the memory pool %d at position %d \n",i,j);
47507 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
47508 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
47509 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
47510 : }
47511 : else
47512 : {
47513 : // printf ("Found a INVALID SgOmpLastprivateClause object in the memory pool \n");
47514 : }
47515 : }
47516 : }
47517 : }
47518 :
47519 : // This should not be required since all previously static data members are
47520 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
47521 :
47522 194 : }
47523 :
47524 : void
47525 0 : SgOmpLastprivateClause::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
47526 : {
47527 : // This function visits only a single IR node of the memory pool.
47528 : // it is typically called once for each type of IR node within
47529 : // the automatically generated function: traverseRepresentativeNodes().
47530 :
47531 : // Initialize array to the address of the first element of the STL vector
47532 : // (which is guarenteed to be contiguous storage).
47533 : // SgOmpLastprivateClause objectArray [] = *(Memory_Block_List.begin());
47534 0 : if (SgOmpLastprivateClause::pools.empty() == false)
47535 : {
47536 : // Generate an array of memory pools
47537 0 : SgOmpLastprivateClause** objectArray = (SgOmpLastprivateClause**) &(SgOmpLastprivateClause::pools[0]);
47538 :
47539 : // Build a local variable for better performance
47540 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
47541 :
47542 : // Iterate over the memory pools
47543 0 : bool done = false;
47544 0 : unsigned i=0;
47545 :
47546 : // find the first valid IR node, call visit function, and then leave
47547 0 : while ( done == false && i < SgOmpLastprivateClause::pools.size() )
47548 : {
47549 : // objectArray[i] is a single memory pool
47550 : unsigned j=0;
47551 0 : while (done == false && j < SgOmpLastprivateClause::pool_size)
47552 : {
47553 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
47554 : {
47555 0 : traversal.visit(&(objectArray[i][j]));
47556 0 : done = true;
47557 : }
47558 0 : j++;
47559 : }
47560 0 : i++;
47561 : }
47562 :
47563 : #if 0
47564 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
47565 : if (done == false)
47566 : {
47567 : printf ("No representative for SgOmpLastprivateClause found in memory pools \n");
47568 : }
47569 : #endif
47570 : }
47571 0 : }
47572 :
47573 :
47574 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
47575 : // using values that overflow signed values of int.
47576 : size_t
47577 4 : SgOmpLastprivateClause::numberOfNodes()
47578 : {
47579 : // This function traverses the memory pool for an IR node and
47580 : // counts the number of IR nodes of a particular Sage III IR
47581 : // nodes type.
47582 :
47583 4 : size_t count = 0;
47584 4 : if (SgOmpLastprivateClause::pools.empty() == false)
47585 : {
47586 : // Generate an array of memory pools (this is actually a STL vector,
47587 : // but it is contiguious, so OK to treat this way).
47588 0 : SgOmpLastprivateClause** objectArray = (SgOmpLastprivateClause**) &(SgOmpLastprivateClause::pools[0]);
47589 :
47590 : // Build a local variable for better performance (make it a loop invariant variable).
47591 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
47592 :
47593 : // Iterate over all of the memory pools for this IR node.
47594 0 : for (unsigned int i=0; i < SgOmpLastprivateClause::pools.size(); i++)
47595 : {
47596 : // objectArray[i] is a single memory pool, iterate over all the
47597 : // IR nodes and only count those that are valid IR nodes used in
47598 : // the AST (i.e. allocated IR nodes).
47599 0 : for (unsigned j=0; j < SgOmpLastprivateClause::pool_size; j++)
47600 : {
47601 : // This is indexing the STL vector of C/C++ style arrays as a doubly
47602 : // indexed array access. It is OK since we have leveraged the semantics
47603 : // of STL vector memory as contigous and cast the memory as an array
47604 : // of arrays to use the 2D array indexing. Hope this is not confusing,
47605 : // but it s very fast as an implementation.
47606 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
47607 : {
47608 0 : count++;
47609 : }
47610 : }
47611 : }
47612 : }
47613 :
47614 :
47615 :
47616 4 : return count;
47617 : }
47618 :
47619 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
47620 : // using values that overflow signed values of int.
47621 : size_t
47622 0 : SgOmpLastprivateClause::memoryUsage()
47623 : {
47624 : // This function is required because we need the class name as a type when we call sizeof
47625 : // There might be another way to implement this if we have a traversal that only called a
47626 : // representative object (one call for each type of Sage IIIIR node).
47627 0 : size_t memory = numberOfNodes() * sizeof(SgOmpLastprivateClause);
47628 :
47629 0 : return memory;
47630 : }
47631 :
47632 : /* #line 47633 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
47633 :
47634 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
47635 : void
47636 5342 : SgOmpReductionClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
47637 : {
47638 : // This function traverses the memory pool for only a specific IR node
47639 : // and calls the visit function of the input class execute a traversal
47640 : // similar to the style of the attribute based traversals within ROSE.
47641 : // This traversal will visit ALL nodes of the AST where as the other
47642 : // attribute based traversals visit only the embedded tree within the AST.
47643 :
47644 : // Initialize array to the address of the first element of the STL vector
47645 : // (which is guaranteed to be contiguous storage).
47646 : // SgOmpReductionClause objectArray [] = *(Memory_Block_List.begin());
47647 5342 : if (SgOmpReductionClause::pools.empty() == false)
47648 : {
47649 : // Generate an array of memory pools
47650 294 : SgOmpReductionClause** objectArray = (SgOmpReductionClause**) &(SgOmpReductionClause::pools[0]);
47651 :
47652 : // Build a local variable for better performance
47653 294 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
47654 : #if 0
47655 : // Iterate over the memory pools
47656 : for (unsigned int i=0; i < SgOmpReductionClause::pools.size(); i++)
47657 : {
47658 : // objectArray[i] is a single memory pool
47659 : for (int j=0; j < SgOmpReductionClause::pool_size; j++)
47660 : {
47661 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
47662 : {
47663 : traversal.visit(&(objectArray[i][j]));
47664 : }
47665 : }
47666 : }
47667 : #else
47668 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
47669 : // compute the list first and then call the visit function on each list element.
47670 :
47671 : // printf ("Inside of SgOmpReductionClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
47672 :
47673 588 : std::vector<SgOmpReductionClause*> nodeList;
47674 :
47675 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
47676 588 : for (unsigned int i=0; i < SgOmpReductionClause::pools.size(); i++)
47677 : {
47678 : // objectArray[i] is a single memory pool
47679 588294 : for (unsigned j=0; j < SgOmpReductionClause::pool_size; j++)
47680 : {
47681 588000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
47682 : {
47683 623 : nodeList.push_back(&(objectArray[i][j]));
47684 : }
47685 : }
47686 : }
47687 :
47688 : // Iterate over the saved list
47689 294 : size_t nodeListSize = nodeList.size();
47690 917 : for (size_t i=0; i < nodeListSize; i++)
47691 : {
47692 623 : ROSE_ASSERT(nodeList[i] != NULL);
47693 : #if 0
47694 : traversal.visit(nodeList[i]);
47695 : #else
47696 623 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
47697 : {
47698 623 : traversal.visit(nodeList[i]);
47699 : }
47700 : #endif
47701 : }
47702 : #endif
47703 : }
47704 :
47705 : // This should not be required since all previously static data members are
47706 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
47707 :
47708 5342 : }
47709 :
47710 :
47711 : void
47712 194 : SgOmpReductionClause::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
47713 : {
47714 : // This function traverses the memory pool for an IR node and
47715 : // calls the function to execute the visitor object.
47716 :
47717 : // Initialize array to the address of the first element of the STL vector
47718 : // (which is guarenteed to be contiguous storage).
47719 : // SgOmpReductionClause objectArray [] = *(Memory_Block_List.begin());
47720 194 : if (SgOmpReductionClause::pools.empty() == false)
47721 : {
47722 : // Generate an array of memory pools
47723 0 : SgOmpReductionClause** objectArray = (SgOmpReductionClause**) &(SgOmpReductionClause::pools[0]);
47724 :
47725 : // Build a local variable for better performance
47726 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
47727 :
47728 : // Iterate over the memory pools
47729 0 : for (unsigned int i=0; i < SgOmpReductionClause::pools.size(); i++)
47730 : {
47731 : // objectArray[i] is a single memory pool
47732 0 : for (unsigned j=0; j < SgOmpReductionClause::pool_size; j++)
47733 : {
47734 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
47735 : {
47736 : // printf ("Found a valid SgOmpReductionClause object in the memory pool %d at position %d \n",i,j);
47737 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
47738 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
47739 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
47740 : }
47741 : else
47742 : {
47743 : // printf ("Found a INVALID SgOmpReductionClause object in the memory pool \n");
47744 : }
47745 : }
47746 : }
47747 : }
47748 :
47749 : // This should not be required since all previously static data members are
47750 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
47751 :
47752 194 : }
47753 :
47754 : void
47755 0 : SgOmpReductionClause::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
47756 : {
47757 : // This function visits only a single IR node of the memory pool.
47758 : // it is typically called once for each type of IR node within
47759 : // the automatically generated function: traverseRepresentativeNodes().
47760 :
47761 : // Initialize array to the address of the first element of the STL vector
47762 : // (which is guarenteed to be contiguous storage).
47763 : // SgOmpReductionClause objectArray [] = *(Memory_Block_List.begin());
47764 0 : if (SgOmpReductionClause::pools.empty() == false)
47765 : {
47766 : // Generate an array of memory pools
47767 0 : SgOmpReductionClause** objectArray = (SgOmpReductionClause**) &(SgOmpReductionClause::pools[0]);
47768 :
47769 : // Build a local variable for better performance
47770 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
47771 :
47772 : // Iterate over the memory pools
47773 0 : bool done = false;
47774 0 : unsigned i=0;
47775 :
47776 : // find the first valid IR node, call visit function, and then leave
47777 0 : while ( done == false && i < SgOmpReductionClause::pools.size() )
47778 : {
47779 : // objectArray[i] is a single memory pool
47780 : unsigned j=0;
47781 0 : while (done == false && j < SgOmpReductionClause::pool_size)
47782 : {
47783 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
47784 : {
47785 0 : traversal.visit(&(objectArray[i][j]));
47786 0 : done = true;
47787 : }
47788 0 : j++;
47789 : }
47790 0 : i++;
47791 : }
47792 :
47793 : #if 0
47794 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
47795 : if (done == false)
47796 : {
47797 : printf ("No representative for SgOmpReductionClause found in memory pools \n");
47798 : }
47799 : #endif
47800 : }
47801 0 : }
47802 :
47803 :
47804 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
47805 : // using values that overflow signed values of int.
47806 : size_t
47807 4 : SgOmpReductionClause::numberOfNodes()
47808 : {
47809 : // This function traverses the memory pool for an IR node and
47810 : // counts the number of IR nodes of a particular Sage III IR
47811 : // nodes type.
47812 :
47813 4 : size_t count = 0;
47814 4 : if (SgOmpReductionClause::pools.empty() == false)
47815 : {
47816 : // Generate an array of memory pools (this is actually a STL vector,
47817 : // but it is contiguious, so OK to treat this way).
47818 0 : SgOmpReductionClause** objectArray = (SgOmpReductionClause**) &(SgOmpReductionClause::pools[0]);
47819 :
47820 : // Build a local variable for better performance (make it a loop invariant variable).
47821 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
47822 :
47823 : // Iterate over all of the memory pools for this IR node.
47824 0 : for (unsigned int i=0; i < SgOmpReductionClause::pools.size(); i++)
47825 : {
47826 : // objectArray[i] is a single memory pool, iterate over all the
47827 : // IR nodes and only count those that are valid IR nodes used in
47828 : // the AST (i.e. allocated IR nodes).
47829 0 : for (unsigned j=0; j < SgOmpReductionClause::pool_size; j++)
47830 : {
47831 : // This is indexing the STL vector of C/C++ style arrays as a doubly
47832 : // indexed array access. It is OK since we have leveraged the semantics
47833 : // of STL vector memory as contigous and cast the memory as an array
47834 : // of arrays to use the 2D array indexing. Hope this is not confusing,
47835 : // but it s very fast as an implementation.
47836 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
47837 : {
47838 0 : count++;
47839 : }
47840 : }
47841 : }
47842 : }
47843 :
47844 :
47845 :
47846 4 : return count;
47847 : }
47848 :
47849 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
47850 : // using values that overflow signed values of int.
47851 : size_t
47852 0 : SgOmpReductionClause::memoryUsage()
47853 : {
47854 : // This function is required because we need the class name as a type when we call sizeof
47855 : // There might be another way to implement this if we have a traversal that only called a
47856 : // representative object (one call for each type of Sage IIIIR node).
47857 0 : size_t memory = numberOfNodes() * sizeof(SgOmpReductionClause);
47858 :
47859 0 : return memory;
47860 : }
47861 :
47862 : /* #line 47863 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
47863 :
47864 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
47865 : void
47866 5342 : SgOmpInReductionClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
47867 : {
47868 : // This function traverses the memory pool for only a specific IR node
47869 : // and calls the visit function of the input class execute a traversal
47870 : // similar to the style of the attribute based traversals within ROSE.
47871 : // This traversal will visit ALL nodes of the AST where as the other
47872 : // attribute based traversals visit only the embedded tree within the AST.
47873 :
47874 : // Initialize array to the address of the first element of the STL vector
47875 : // (which is guaranteed to be contiguous storage).
47876 : // SgOmpInReductionClause objectArray [] = *(Memory_Block_List.begin());
47877 5342 : if (SgOmpInReductionClause::pools.empty() == false)
47878 : {
47879 : // Generate an array of memory pools
47880 21 : SgOmpInReductionClause** objectArray = (SgOmpInReductionClause**) &(SgOmpInReductionClause::pools[0]);
47881 :
47882 : // Build a local variable for better performance
47883 21 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
47884 : #if 0
47885 : // Iterate over the memory pools
47886 : for (unsigned int i=0; i < SgOmpInReductionClause::pools.size(); i++)
47887 : {
47888 : // objectArray[i] is a single memory pool
47889 : for (int j=0; j < SgOmpInReductionClause::pool_size; j++)
47890 : {
47891 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
47892 : {
47893 : traversal.visit(&(objectArray[i][j]));
47894 : }
47895 : }
47896 : }
47897 : #else
47898 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
47899 : // compute the list first and then call the visit function on each list element.
47900 :
47901 : // printf ("Inside of SgOmpInReductionClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
47902 :
47903 42 : std::vector<SgOmpInReductionClause*> nodeList;
47904 :
47905 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
47906 42 : for (unsigned int i=0; i < SgOmpInReductionClause::pools.size(); i++)
47907 : {
47908 : // objectArray[i] is a single memory pool
47909 42021 : for (unsigned j=0; j < SgOmpInReductionClause::pool_size; j++)
47910 : {
47911 42000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
47912 : {
47913 42 : nodeList.push_back(&(objectArray[i][j]));
47914 : }
47915 : }
47916 : }
47917 :
47918 : // Iterate over the saved list
47919 21 : size_t nodeListSize = nodeList.size();
47920 63 : for (size_t i=0; i < nodeListSize; i++)
47921 : {
47922 42 : ROSE_ASSERT(nodeList[i] != NULL);
47923 : #if 0
47924 : traversal.visit(nodeList[i]);
47925 : #else
47926 42 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
47927 : {
47928 42 : traversal.visit(nodeList[i]);
47929 : }
47930 : #endif
47931 : }
47932 : #endif
47933 : }
47934 :
47935 : // This should not be required since all previously static data members are
47936 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
47937 :
47938 5342 : }
47939 :
47940 :
47941 : void
47942 194 : SgOmpInReductionClause::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
47943 : {
47944 : // This function traverses the memory pool for an IR node and
47945 : // calls the function to execute the visitor object.
47946 :
47947 : // Initialize array to the address of the first element of the STL vector
47948 : // (which is guarenteed to be contiguous storage).
47949 : // SgOmpInReductionClause objectArray [] = *(Memory_Block_List.begin());
47950 194 : if (SgOmpInReductionClause::pools.empty() == false)
47951 : {
47952 : // Generate an array of memory pools
47953 0 : SgOmpInReductionClause** objectArray = (SgOmpInReductionClause**) &(SgOmpInReductionClause::pools[0]);
47954 :
47955 : // Build a local variable for better performance
47956 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
47957 :
47958 : // Iterate over the memory pools
47959 0 : for (unsigned int i=0; i < SgOmpInReductionClause::pools.size(); i++)
47960 : {
47961 : // objectArray[i] is a single memory pool
47962 0 : for (unsigned j=0; j < SgOmpInReductionClause::pool_size; j++)
47963 : {
47964 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
47965 : {
47966 : // printf ("Found a valid SgOmpInReductionClause object in the memory pool %d at position %d \n",i,j);
47967 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
47968 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
47969 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
47970 : }
47971 : else
47972 : {
47973 : // printf ("Found a INVALID SgOmpInReductionClause object in the memory pool \n");
47974 : }
47975 : }
47976 : }
47977 : }
47978 :
47979 : // This should not be required since all previously static data members are
47980 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
47981 :
47982 194 : }
47983 :
47984 : void
47985 0 : SgOmpInReductionClause::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
47986 : {
47987 : // This function visits only a single IR node of the memory pool.
47988 : // it is typically called once for each type of IR node within
47989 : // the automatically generated function: traverseRepresentativeNodes().
47990 :
47991 : // Initialize array to the address of the first element of the STL vector
47992 : // (which is guarenteed to be contiguous storage).
47993 : // SgOmpInReductionClause objectArray [] = *(Memory_Block_List.begin());
47994 0 : if (SgOmpInReductionClause::pools.empty() == false)
47995 : {
47996 : // Generate an array of memory pools
47997 0 : SgOmpInReductionClause** objectArray = (SgOmpInReductionClause**) &(SgOmpInReductionClause::pools[0]);
47998 :
47999 : // Build a local variable for better performance
48000 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
48001 :
48002 : // Iterate over the memory pools
48003 0 : bool done = false;
48004 0 : unsigned i=0;
48005 :
48006 : // find the first valid IR node, call visit function, and then leave
48007 0 : while ( done == false && i < SgOmpInReductionClause::pools.size() )
48008 : {
48009 : // objectArray[i] is a single memory pool
48010 : unsigned j=0;
48011 0 : while (done == false && j < SgOmpInReductionClause::pool_size)
48012 : {
48013 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
48014 : {
48015 0 : traversal.visit(&(objectArray[i][j]));
48016 0 : done = true;
48017 : }
48018 0 : j++;
48019 : }
48020 0 : i++;
48021 : }
48022 :
48023 : #if 0
48024 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
48025 : if (done == false)
48026 : {
48027 : printf ("No representative for SgOmpInReductionClause found in memory pools \n");
48028 : }
48029 : #endif
48030 : }
48031 0 : }
48032 :
48033 :
48034 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
48035 : // using values that overflow signed values of int.
48036 : size_t
48037 4 : SgOmpInReductionClause::numberOfNodes()
48038 : {
48039 : // This function traverses the memory pool for an IR node and
48040 : // counts the number of IR nodes of a particular Sage III IR
48041 : // nodes type.
48042 :
48043 4 : size_t count = 0;
48044 4 : if (SgOmpInReductionClause::pools.empty() == false)
48045 : {
48046 : // Generate an array of memory pools (this is actually a STL vector,
48047 : // but it is contiguious, so OK to treat this way).
48048 0 : SgOmpInReductionClause** objectArray = (SgOmpInReductionClause**) &(SgOmpInReductionClause::pools[0]);
48049 :
48050 : // Build a local variable for better performance (make it a loop invariant variable).
48051 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
48052 :
48053 : // Iterate over all of the memory pools for this IR node.
48054 0 : for (unsigned int i=0; i < SgOmpInReductionClause::pools.size(); i++)
48055 : {
48056 : // objectArray[i] is a single memory pool, iterate over all the
48057 : // IR nodes and only count those that are valid IR nodes used in
48058 : // the AST (i.e. allocated IR nodes).
48059 0 : for (unsigned j=0; j < SgOmpInReductionClause::pool_size; j++)
48060 : {
48061 : // This is indexing the STL vector of C/C++ style arrays as a doubly
48062 : // indexed array access. It is OK since we have leveraged the semantics
48063 : // of STL vector memory as contigous and cast the memory as an array
48064 : // of arrays to use the 2D array indexing. Hope this is not confusing,
48065 : // but it s very fast as an implementation.
48066 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
48067 : {
48068 0 : count++;
48069 : }
48070 : }
48071 : }
48072 : }
48073 :
48074 :
48075 :
48076 4 : return count;
48077 : }
48078 :
48079 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
48080 : // using values that overflow signed values of int.
48081 : size_t
48082 0 : SgOmpInReductionClause::memoryUsage()
48083 : {
48084 : // This function is required because we need the class name as a type when we call sizeof
48085 : // There might be another way to implement this if we have a traversal that only called a
48086 : // representative object (one call for each type of Sage IIIIR node).
48087 0 : size_t memory = numberOfNodes() * sizeof(SgOmpInReductionClause);
48088 :
48089 0 : return memory;
48090 : }
48091 :
48092 : /* #line 48093 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
48093 :
48094 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
48095 : void
48096 5342 : SgOmpTaskReductionClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
48097 : {
48098 : // This function traverses the memory pool for only a specific IR node
48099 : // and calls the visit function of the input class execute a traversal
48100 : // similar to the style of the attribute based traversals within ROSE.
48101 : // This traversal will visit ALL nodes of the AST where as the other
48102 : // attribute based traversals visit only the embedded tree within the AST.
48103 :
48104 : // Initialize array to the address of the first element of the STL vector
48105 : // (which is guaranteed to be contiguous storage).
48106 : // SgOmpTaskReductionClause objectArray [] = *(Memory_Block_List.begin());
48107 5342 : if (SgOmpTaskReductionClause::pools.empty() == false)
48108 : {
48109 : // Generate an array of memory pools
48110 0 : SgOmpTaskReductionClause** objectArray = (SgOmpTaskReductionClause**) &(SgOmpTaskReductionClause::pools[0]);
48111 :
48112 : // Build a local variable for better performance
48113 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
48114 : #if 0
48115 : // Iterate over the memory pools
48116 : for (unsigned int i=0; i < SgOmpTaskReductionClause::pools.size(); i++)
48117 : {
48118 : // objectArray[i] is a single memory pool
48119 : for (int j=0; j < SgOmpTaskReductionClause::pool_size; j++)
48120 : {
48121 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
48122 : {
48123 : traversal.visit(&(objectArray[i][j]));
48124 : }
48125 : }
48126 : }
48127 : #else
48128 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
48129 : // compute the list first and then call the visit function on each list element.
48130 :
48131 : // printf ("Inside of SgOmpTaskReductionClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
48132 :
48133 0 : std::vector<SgOmpTaskReductionClause*> nodeList;
48134 :
48135 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
48136 0 : for (unsigned int i=0; i < SgOmpTaskReductionClause::pools.size(); i++)
48137 : {
48138 : // objectArray[i] is a single memory pool
48139 0 : for (unsigned j=0; j < SgOmpTaskReductionClause::pool_size; j++)
48140 : {
48141 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
48142 : {
48143 0 : nodeList.push_back(&(objectArray[i][j]));
48144 : }
48145 : }
48146 : }
48147 :
48148 : // Iterate over the saved list
48149 0 : size_t nodeListSize = nodeList.size();
48150 0 : for (size_t i=0; i < nodeListSize; i++)
48151 : {
48152 0 : ROSE_ASSERT(nodeList[i] != NULL);
48153 : #if 0
48154 : traversal.visit(nodeList[i]);
48155 : #else
48156 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
48157 : {
48158 0 : traversal.visit(nodeList[i]);
48159 : }
48160 : #endif
48161 : }
48162 : #endif
48163 : }
48164 :
48165 : // This should not be required since all previously static data members are
48166 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
48167 :
48168 5342 : }
48169 :
48170 :
48171 : void
48172 194 : SgOmpTaskReductionClause::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
48173 : {
48174 : // This function traverses the memory pool for an IR node and
48175 : // calls the function to execute the visitor object.
48176 :
48177 : // Initialize array to the address of the first element of the STL vector
48178 : // (which is guarenteed to be contiguous storage).
48179 : // SgOmpTaskReductionClause objectArray [] = *(Memory_Block_List.begin());
48180 194 : if (SgOmpTaskReductionClause::pools.empty() == false)
48181 : {
48182 : // Generate an array of memory pools
48183 0 : SgOmpTaskReductionClause** objectArray = (SgOmpTaskReductionClause**) &(SgOmpTaskReductionClause::pools[0]);
48184 :
48185 : // Build a local variable for better performance
48186 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
48187 :
48188 : // Iterate over the memory pools
48189 0 : for (unsigned int i=0; i < SgOmpTaskReductionClause::pools.size(); i++)
48190 : {
48191 : // objectArray[i] is a single memory pool
48192 0 : for (unsigned j=0; j < SgOmpTaskReductionClause::pool_size; j++)
48193 : {
48194 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
48195 : {
48196 : // printf ("Found a valid SgOmpTaskReductionClause object in the memory pool %d at position %d \n",i,j);
48197 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
48198 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
48199 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
48200 : }
48201 : else
48202 : {
48203 : // printf ("Found a INVALID SgOmpTaskReductionClause object in the memory pool \n");
48204 : }
48205 : }
48206 : }
48207 : }
48208 :
48209 : // This should not be required since all previously static data members are
48210 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
48211 :
48212 194 : }
48213 :
48214 : void
48215 0 : SgOmpTaskReductionClause::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
48216 : {
48217 : // This function visits only a single IR node of the memory pool.
48218 : // it is typically called once for each type of IR node within
48219 : // the automatically generated function: traverseRepresentativeNodes().
48220 :
48221 : // Initialize array to the address of the first element of the STL vector
48222 : // (which is guarenteed to be contiguous storage).
48223 : // SgOmpTaskReductionClause objectArray [] = *(Memory_Block_List.begin());
48224 0 : if (SgOmpTaskReductionClause::pools.empty() == false)
48225 : {
48226 : // Generate an array of memory pools
48227 0 : SgOmpTaskReductionClause** objectArray = (SgOmpTaskReductionClause**) &(SgOmpTaskReductionClause::pools[0]);
48228 :
48229 : // Build a local variable for better performance
48230 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
48231 :
48232 : // Iterate over the memory pools
48233 0 : bool done = false;
48234 0 : unsigned i=0;
48235 :
48236 : // find the first valid IR node, call visit function, and then leave
48237 0 : while ( done == false && i < SgOmpTaskReductionClause::pools.size() )
48238 : {
48239 : // objectArray[i] is a single memory pool
48240 : unsigned j=0;
48241 0 : while (done == false && j < SgOmpTaskReductionClause::pool_size)
48242 : {
48243 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
48244 : {
48245 0 : traversal.visit(&(objectArray[i][j]));
48246 0 : done = true;
48247 : }
48248 0 : j++;
48249 : }
48250 0 : i++;
48251 : }
48252 :
48253 : #if 0
48254 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
48255 : if (done == false)
48256 : {
48257 : printf ("No representative for SgOmpTaskReductionClause found in memory pools \n");
48258 : }
48259 : #endif
48260 : }
48261 0 : }
48262 :
48263 :
48264 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
48265 : // using values that overflow signed values of int.
48266 : size_t
48267 4 : SgOmpTaskReductionClause::numberOfNodes()
48268 : {
48269 : // This function traverses the memory pool for an IR node and
48270 : // counts the number of IR nodes of a particular Sage III IR
48271 : // nodes type.
48272 :
48273 4 : size_t count = 0;
48274 4 : if (SgOmpTaskReductionClause::pools.empty() == false)
48275 : {
48276 : // Generate an array of memory pools (this is actually a STL vector,
48277 : // but it is contiguious, so OK to treat this way).
48278 0 : SgOmpTaskReductionClause** objectArray = (SgOmpTaskReductionClause**) &(SgOmpTaskReductionClause::pools[0]);
48279 :
48280 : // Build a local variable for better performance (make it a loop invariant variable).
48281 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
48282 :
48283 : // Iterate over all of the memory pools for this IR node.
48284 0 : for (unsigned int i=0; i < SgOmpTaskReductionClause::pools.size(); i++)
48285 : {
48286 : // objectArray[i] is a single memory pool, iterate over all the
48287 : // IR nodes and only count those that are valid IR nodes used in
48288 : // the AST (i.e. allocated IR nodes).
48289 0 : for (unsigned j=0; j < SgOmpTaskReductionClause::pool_size; j++)
48290 : {
48291 : // This is indexing the STL vector of C/C++ style arrays as a doubly
48292 : // indexed array access. It is OK since we have leveraged the semantics
48293 : // of STL vector memory as contigous and cast the memory as an array
48294 : // of arrays to use the 2D array indexing. Hope this is not confusing,
48295 : // but it s very fast as an implementation.
48296 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
48297 : {
48298 0 : count++;
48299 : }
48300 : }
48301 : }
48302 : }
48303 :
48304 :
48305 :
48306 4 : return count;
48307 : }
48308 :
48309 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
48310 : // using values that overflow signed values of int.
48311 : size_t
48312 0 : SgOmpTaskReductionClause::memoryUsage()
48313 : {
48314 : // This function is required because we need the class name as a type when we call sizeof
48315 : // There might be another way to implement this if we have a traversal that only called a
48316 : // representative object (one call for each type of Sage IIIIR node).
48317 0 : size_t memory = numberOfNodes() * sizeof(SgOmpTaskReductionClause);
48318 :
48319 0 : return memory;
48320 : }
48321 :
48322 : /* #line 48323 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
48323 :
48324 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
48325 : void
48326 5342 : SgOmpMapClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
48327 : {
48328 : // This function traverses the memory pool for only a specific IR node
48329 : // and calls the visit function of the input class execute a traversal
48330 : // similar to the style of the attribute based traversals within ROSE.
48331 : // This traversal will visit ALL nodes of the AST where as the other
48332 : // attribute based traversals visit only the embedded tree within the AST.
48333 :
48334 : // Initialize array to the address of the first element of the STL vector
48335 : // (which is guaranteed to be contiguous storage).
48336 : // SgOmpMapClause objectArray [] = *(Memory_Block_List.begin());
48337 5342 : if (SgOmpMapClause::pools.empty() == false)
48338 : {
48339 : // Generate an array of memory pools
48340 98 : SgOmpMapClause** objectArray = (SgOmpMapClause**) &(SgOmpMapClause::pools[0]);
48341 :
48342 : // Build a local variable for better performance
48343 98 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
48344 : #if 0
48345 : // Iterate over the memory pools
48346 : for (unsigned int i=0; i < SgOmpMapClause::pools.size(); i++)
48347 : {
48348 : // objectArray[i] is a single memory pool
48349 : for (int j=0; j < SgOmpMapClause::pool_size; j++)
48350 : {
48351 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
48352 : {
48353 : traversal.visit(&(objectArray[i][j]));
48354 : }
48355 : }
48356 : }
48357 : #else
48358 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
48359 : // compute the list first and then call the visit function on each list element.
48360 :
48361 : // printf ("Inside of SgOmpMapClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
48362 :
48363 196 : std::vector<SgOmpMapClause*> nodeList;
48364 :
48365 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
48366 196 : for (unsigned int i=0; i < SgOmpMapClause::pools.size(); i++)
48367 : {
48368 : // objectArray[i] is a single memory pool
48369 196098 : for (unsigned j=0; j < SgOmpMapClause::pool_size; j++)
48370 : {
48371 196000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
48372 : {
48373 301 : nodeList.push_back(&(objectArray[i][j]));
48374 : }
48375 : }
48376 : }
48377 :
48378 : // Iterate over the saved list
48379 98 : size_t nodeListSize = nodeList.size();
48380 399 : for (size_t i=0; i < nodeListSize; i++)
48381 : {
48382 301 : ROSE_ASSERT(nodeList[i] != NULL);
48383 : #if 0
48384 : traversal.visit(nodeList[i]);
48385 : #else
48386 301 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
48387 : {
48388 301 : traversal.visit(nodeList[i]);
48389 : }
48390 : #endif
48391 : }
48392 : #endif
48393 : }
48394 :
48395 : // This should not be required since all previously static data members are
48396 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
48397 :
48398 5342 : }
48399 :
48400 :
48401 : void
48402 194 : SgOmpMapClause::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
48403 : {
48404 : // This function traverses the memory pool for an IR node and
48405 : // calls the function to execute the visitor object.
48406 :
48407 : // Initialize array to the address of the first element of the STL vector
48408 : // (which is guarenteed to be contiguous storage).
48409 : // SgOmpMapClause objectArray [] = *(Memory_Block_List.begin());
48410 194 : if (SgOmpMapClause::pools.empty() == false)
48411 : {
48412 : // Generate an array of memory pools
48413 0 : SgOmpMapClause** objectArray = (SgOmpMapClause**) &(SgOmpMapClause::pools[0]);
48414 :
48415 : // Build a local variable for better performance
48416 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
48417 :
48418 : // Iterate over the memory pools
48419 0 : for (unsigned int i=0; i < SgOmpMapClause::pools.size(); i++)
48420 : {
48421 : // objectArray[i] is a single memory pool
48422 0 : for (unsigned j=0; j < SgOmpMapClause::pool_size; j++)
48423 : {
48424 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
48425 : {
48426 : // printf ("Found a valid SgOmpMapClause object in the memory pool %d at position %d \n",i,j);
48427 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
48428 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
48429 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
48430 : }
48431 : else
48432 : {
48433 : // printf ("Found a INVALID SgOmpMapClause object in the memory pool \n");
48434 : }
48435 : }
48436 : }
48437 : }
48438 :
48439 : // This should not be required since all previously static data members are
48440 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
48441 :
48442 194 : }
48443 :
48444 : void
48445 0 : SgOmpMapClause::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
48446 : {
48447 : // This function visits only a single IR node of the memory pool.
48448 : // it is typically called once for each type of IR node within
48449 : // the automatically generated function: traverseRepresentativeNodes().
48450 :
48451 : // Initialize array to the address of the first element of the STL vector
48452 : // (which is guarenteed to be contiguous storage).
48453 : // SgOmpMapClause objectArray [] = *(Memory_Block_List.begin());
48454 0 : if (SgOmpMapClause::pools.empty() == false)
48455 : {
48456 : // Generate an array of memory pools
48457 0 : SgOmpMapClause** objectArray = (SgOmpMapClause**) &(SgOmpMapClause::pools[0]);
48458 :
48459 : // Build a local variable for better performance
48460 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
48461 :
48462 : // Iterate over the memory pools
48463 0 : bool done = false;
48464 0 : unsigned i=0;
48465 :
48466 : // find the first valid IR node, call visit function, and then leave
48467 0 : while ( done == false && i < SgOmpMapClause::pools.size() )
48468 : {
48469 : // objectArray[i] is a single memory pool
48470 : unsigned j=0;
48471 0 : while (done == false && j < SgOmpMapClause::pool_size)
48472 : {
48473 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
48474 : {
48475 0 : traversal.visit(&(objectArray[i][j]));
48476 0 : done = true;
48477 : }
48478 0 : j++;
48479 : }
48480 0 : i++;
48481 : }
48482 :
48483 : #if 0
48484 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
48485 : if (done == false)
48486 : {
48487 : printf ("No representative for SgOmpMapClause found in memory pools \n");
48488 : }
48489 : #endif
48490 : }
48491 0 : }
48492 :
48493 :
48494 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
48495 : // using values that overflow signed values of int.
48496 : size_t
48497 4 : SgOmpMapClause::numberOfNodes()
48498 : {
48499 : // This function traverses the memory pool for an IR node and
48500 : // counts the number of IR nodes of a particular Sage III IR
48501 : // nodes type.
48502 :
48503 4 : size_t count = 0;
48504 4 : if (SgOmpMapClause::pools.empty() == false)
48505 : {
48506 : // Generate an array of memory pools (this is actually a STL vector,
48507 : // but it is contiguious, so OK to treat this way).
48508 0 : SgOmpMapClause** objectArray = (SgOmpMapClause**) &(SgOmpMapClause::pools[0]);
48509 :
48510 : // Build a local variable for better performance (make it a loop invariant variable).
48511 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
48512 :
48513 : // Iterate over all of the memory pools for this IR node.
48514 0 : for (unsigned int i=0; i < SgOmpMapClause::pools.size(); i++)
48515 : {
48516 : // objectArray[i] is a single memory pool, iterate over all the
48517 : // IR nodes and only count those that are valid IR nodes used in
48518 : // the AST (i.e. allocated IR nodes).
48519 0 : for (unsigned j=0; j < SgOmpMapClause::pool_size; j++)
48520 : {
48521 : // This is indexing the STL vector of C/C++ style arrays as a doubly
48522 : // indexed array access. It is OK since we have leveraged the semantics
48523 : // of STL vector memory as contigous and cast the memory as an array
48524 : // of arrays to use the 2D array indexing. Hope this is not confusing,
48525 : // but it s very fast as an implementation.
48526 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
48527 : {
48528 0 : count++;
48529 : }
48530 : }
48531 : }
48532 : }
48533 :
48534 :
48535 :
48536 4 : return count;
48537 : }
48538 :
48539 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
48540 : // using values that overflow signed values of int.
48541 : size_t
48542 0 : SgOmpMapClause::memoryUsage()
48543 : {
48544 : // This function is required because we need the class name as a type when we call sizeof
48545 : // There might be another way to implement this if we have a traversal that only called a
48546 : // representative object (one call for each type of Sage IIIIR node).
48547 0 : size_t memory = numberOfNodes() * sizeof(SgOmpMapClause);
48548 :
48549 0 : return memory;
48550 : }
48551 :
48552 : /* #line 48553 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
48553 :
48554 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
48555 : void
48556 5342 : SgOmpAllocateClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
48557 : {
48558 : // This function traverses the memory pool for only a specific IR node
48559 : // and calls the visit function of the input class execute a traversal
48560 : // similar to the style of the attribute based traversals within ROSE.
48561 : // This traversal will visit ALL nodes of the AST where as the other
48562 : // attribute based traversals visit only the embedded tree within the AST.
48563 :
48564 : // Initialize array to the address of the first element of the STL vector
48565 : // (which is guaranteed to be contiguous storage).
48566 : // SgOmpAllocateClause objectArray [] = *(Memory_Block_List.begin());
48567 5342 : if (SgOmpAllocateClause::pools.empty() == false)
48568 : {
48569 : // Generate an array of memory pools
48570 28 : SgOmpAllocateClause** objectArray = (SgOmpAllocateClause**) &(SgOmpAllocateClause::pools[0]);
48571 :
48572 : // Build a local variable for better performance
48573 28 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
48574 : #if 0
48575 : // Iterate over the memory pools
48576 : for (unsigned int i=0; i < SgOmpAllocateClause::pools.size(); i++)
48577 : {
48578 : // objectArray[i] is a single memory pool
48579 : for (int j=0; j < SgOmpAllocateClause::pool_size; j++)
48580 : {
48581 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
48582 : {
48583 : traversal.visit(&(objectArray[i][j]));
48584 : }
48585 : }
48586 : }
48587 : #else
48588 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
48589 : // compute the list first and then call the visit function on each list element.
48590 :
48591 : // printf ("Inside of SgOmpAllocateClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
48592 :
48593 56 : std::vector<SgOmpAllocateClause*> nodeList;
48594 :
48595 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
48596 56 : for (unsigned int i=0; i < SgOmpAllocateClause::pools.size(); i++)
48597 : {
48598 : // objectArray[i] is a single memory pool
48599 56028 : for (unsigned j=0; j < SgOmpAllocateClause::pool_size; j++)
48600 : {
48601 56000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
48602 : {
48603 238 : nodeList.push_back(&(objectArray[i][j]));
48604 : }
48605 : }
48606 : }
48607 :
48608 : // Iterate over the saved list
48609 28 : size_t nodeListSize = nodeList.size();
48610 266 : for (size_t i=0; i < nodeListSize; i++)
48611 : {
48612 238 : ROSE_ASSERT(nodeList[i] != NULL);
48613 : #if 0
48614 : traversal.visit(nodeList[i]);
48615 : #else
48616 238 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
48617 : {
48618 238 : traversal.visit(nodeList[i]);
48619 : }
48620 : #endif
48621 : }
48622 : #endif
48623 : }
48624 :
48625 : // This should not be required since all previously static data members are
48626 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
48627 :
48628 5342 : }
48629 :
48630 :
48631 : void
48632 194 : SgOmpAllocateClause::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
48633 : {
48634 : // This function traverses the memory pool for an IR node and
48635 : // calls the function to execute the visitor object.
48636 :
48637 : // Initialize array to the address of the first element of the STL vector
48638 : // (which is guarenteed to be contiguous storage).
48639 : // SgOmpAllocateClause objectArray [] = *(Memory_Block_List.begin());
48640 194 : if (SgOmpAllocateClause::pools.empty() == false)
48641 : {
48642 : // Generate an array of memory pools
48643 0 : SgOmpAllocateClause** objectArray = (SgOmpAllocateClause**) &(SgOmpAllocateClause::pools[0]);
48644 :
48645 : // Build a local variable for better performance
48646 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
48647 :
48648 : // Iterate over the memory pools
48649 0 : for (unsigned int i=0; i < SgOmpAllocateClause::pools.size(); i++)
48650 : {
48651 : // objectArray[i] is a single memory pool
48652 0 : for (unsigned j=0; j < SgOmpAllocateClause::pool_size; j++)
48653 : {
48654 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
48655 : {
48656 : // printf ("Found a valid SgOmpAllocateClause object in the memory pool %d at position %d \n",i,j);
48657 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
48658 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
48659 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
48660 : }
48661 : else
48662 : {
48663 : // printf ("Found a INVALID SgOmpAllocateClause object in the memory pool \n");
48664 : }
48665 : }
48666 : }
48667 : }
48668 :
48669 : // This should not be required since all previously static data members are
48670 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
48671 :
48672 194 : }
48673 :
48674 : void
48675 0 : SgOmpAllocateClause::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
48676 : {
48677 : // This function visits only a single IR node of the memory pool.
48678 : // it is typically called once for each type of IR node within
48679 : // the automatically generated function: traverseRepresentativeNodes().
48680 :
48681 : // Initialize array to the address of the first element of the STL vector
48682 : // (which is guarenteed to be contiguous storage).
48683 : // SgOmpAllocateClause objectArray [] = *(Memory_Block_List.begin());
48684 0 : if (SgOmpAllocateClause::pools.empty() == false)
48685 : {
48686 : // Generate an array of memory pools
48687 0 : SgOmpAllocateClause** objectArray = (SgOmpAllocateClause**) &(SgOmpAllocateClause::pools[0]);
48688 :
48689 : // Build a local variable for better performance
48690 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
48691 :
48692 : // Iterate over the memory pools
48693 0 : bool done = false;
48694 0 : unsigned i=0;
48695 :
48696 : // find the first valid IR node, call visit function, and then leave
48697 0 : while ( done == false && i < SgOmpAllocateClause::pools.size() )
48698 : {
48699 : // objectArray[i] is a single memory pool
48700 : unsigned j=0;
48701 0 : while (done == false && j < SgOmpAllocateClause::pool_size)
48702 : {
48703 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
48704 : {
48705 0 : traversal.visit(&(objectArray[i][j]));
48706 0 : done = true;
48707 : }
48708 0 : j++;
48709 : }
48710 0 : i++;
48711 : }
48712 :
48713 : #if 0
48714 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
48715 : if (done == false)
48716 : {
48717 : printf ("No representative for SgOmpAllocateClause found in memory pools \n");
48718 : }
48719 : #endif
48720 : }
48721 0 : }
48722 :
48723 :
48724 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
48725 : // using values that overflow signed values of int.
48726 : size_t
48727 4 : SgOmpAllocateClause::numberOfNodes()
48728 : {
48729 : // This function traverses the memory pool for an IR node and
48730 : // counts the number of IR nodes of a particular Sage III IR
48731 : // nodes type.
48732 :
48733 4 : size_t count = 0;
48734 4 : if (SgOmpAllocateClause::pools.empty() == false)
48735 : {
48736 : // Generate an array of memory pools (this is actually a STL vector,
48737 : // but it is contiguious, so OK to treat this way).
48738 0 : SgOmpAllocateClause** objectArray = (SgOmpAllocateClause**) &(SgOmpAllocateClause::pools[0]);
48739 :
48740 : // Build a local variable for better performance (make it a loop invariant variable).
48741 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
48742 :
48743 : // Iterate over all of the memory pools for this IR node.
48744 0 : for (unsigned int i=0; i < SgOmpAllocateClause::pools.size(); i++)
48745 : {
48746 : // objectArray[i] is a single memory pool, iterate over all the
48747 : // IR nodes and only count those that are valid IR nodes used in
48748 : // the AST (i.e. allocated IR nodes).
48749 0 : for (unsigned j=0; j < SgOmpAllocateClause::pool_size; j++)
48750 : {
48751 : // This is indexing the STL vector of C/C++ style arrays as a doubly
48752 : // indexed array access. It is OK since we have leveraged the semantics
48753 : // of STL vector memory as contigous and cast the memory as an array
48754 : // of arrays to use the 2D array indexing. Hope this is not confusing,
48755 : // but it s very fast as an implementation.
48756 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
48757 : {
48758 0 : count++;
48759 : }
48760 : }
48761 : }
48762 : }
48763 :
48764 :
48765 :
48766 4 : return count;
48767 : }
48768 :
48769 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
48770 : // using values that overflow signed values of int.
48771 : size_t
48772 0 : SgOmpAllocateClause::memoryUsage()
48773 : {
48774 : // This function is required because we need the class name as a type when we call sizeof
48775 : // There might be another way to implement this if we have a traversal that only called a
48776 : // representative object (one call for each type of Sage IIIIR node).
48777 0 : size_t memory = numberOfNodes() * sizeof(SgOmpAllocateClause);
48778 :
48779 0 : return memory;
48780 : }
48781 :
48782 : /* #line 48783 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
48783 :
48784 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
48785 : void
48786 5342 : SgOmpUniformClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
48787 : {
48788 : // This function traverses the memory pool for only a specific IR node
48789 : // and calls the visit function of the input class execute a traversal
48790 : // similar to the style of the attribute based traversals within ROSE.
48791 : // This traversal will visit ALL nodes of the AST where as the other
48792 : // attribute based traversals visit only the embedded tree within the AST.
48793 :
48794 : // Initialize array to the address of the first element of the STL vector
48795 : // (which is guaranteed to be contiguous storage).
48796 : // SgOmpUniformClause objectArray [] = *(Memory_Block_List.begin());
48797 5342 : if (SgOmpUniformClause::pools.empty() == false)
48798 : {
48799 : // Generate an array of memory pools
48800 7 : SgOmpUniformClause** objectArray = (SgOmpUniformClause**) &(SgOmpUniformClause::pools[0]);
48801 :
48802 : // Build a local variable for better performance
48803 7 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
48804 : #if 0
48805 : // Iterate over the memory pools
48806 : for (unsigned int i=0; i < SgOmpUniformClause::pools.size(); i++)
48807 : {
48808 : // objectArray[i] is a single memory pool
48809 : for (int j=0; j < SgOmpUniformClause::pool_size; j++)
48810 : {
48811 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
48812 : {
48813 : traversal.visit(&(objectArray[i][j]));
48814 : }
48815 : }
48816 : }
48817 : #else
48818 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
48819 : // compute the list first and then call the visit function on each list element.
48820 :
48821 : // printf ("Inside of SgOmpUniformClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
48822 :
48823 14 : std::vector<SgOmpUniformClause*> nodeList;
48824 :
48825 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
48826 14 : for (unsigned int i=0; i < SgOmpUniformClause::pools.size(); i++)
48827 : {
48828 : // objectArray[i] is a single memory pool
48829 14007 : for (unsigned j=0; j < SgOmpUniformClause::pool_size; j++)
48830 : {
48831 14000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
48832 : {
48833 21 : nodeList.push_back(&(objectArray[i][j]));
48834 : }
48835 : }
48836 : }
48837 :
48838 : // Iterate over the saved list
48839 7 : size_t nodeListSize = nodeList.size();
48840 28 : for (size_t i=0; i < nodeListSize; i++)
48841 : {
48842 21 : ROSE_ASSERT(nodeList[i] != NULL);
48843 : #if 0
48844 : traversal.visit(nodeList[i]);
48845 : #else
48846 21 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
48847 : {
48848 21 : traversal.visit(nodeList[i]);
48849 : }
48850 : #endif
48851 : }
48852 : #endif
48853 : }
48854 :
48855 : // This should not be required since all previously static data members are
48856 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
48857 :
48858 5342 : }
48859 :
48860 :
48861 : void
48862 194 : SgOmpUniformClause::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
48863 : {
48864 : // This function traverses the memory pool for an IR node and
48865 : // calls the function to execute the visitor object.
48866 :
48867 : // Initialize array to the address of the first element of the STL vector
48868 : // (which is guarenteed to be contiguous storage).
48869 : // SgOmpUniformClause objectArray [] = *(Memory_Block_List.begin());
48870 194 : if (SgOmpUniformClause::pools.empty() == false)
48871 : {
48872 : // Generate an array of memory pools
48873 0 : SgOmpUniformClause** objectArray = (SgOmpUniformClause**) &(SgOmpUniformClause::pools[0]);
48874 :
48875 : // Build a local variable for better performance
48876 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
48877 :
48878 : // Iterate over the memory pools
48879 0 : for (unsigned int i=0; i < SgOmpUniformClause::pools.size(); i++)
48880 : {
48881 : // objectArray[i] is a single memory pool
48882 0 : for (unsigned j=0; j < SgOmpUniformClause::pool_size; j++)
48883 : {
48884 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
48885 : {
48886 : // printf ("Found a valid SgOmpUniformClause object in the memory pool %d at position %d \n",i,j);
48887 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
48888 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
48889 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
48890 : }
48891 : else
48892 : {
48893 : // printf ("Found a INVALID SgOmpUniformClause object in the memory pool \n");
48894 : }
48895 : }
48896 : }
48897 : }
48898 :
48899 : // This should not be required since all previously static data members are
48900 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
48901 :
48902 194 : }
48903 :
48904 : void
48905 0 : SgOmpUniformClause::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
48906 : {
48907 : // This function visits only a single IR node of the memory pool.
48908 : // it is typically called once for each type of IR node within
48909 : // the automatically generated function: traverseRepresentativeNodes().
48910 :
48911 : // Initialize array to the address of the first element of the STL vector
48912 : // (which is guarenteed to be contiguous storage).
48913 : // SgOmpUniformClause objectArray [] = *(Memory_Block_List.begin());
48914 0 : if (SgOmpUniformClause::pools.empty() == false)
48915 : {
48916 : // Generate an array of memory pools
48917 0 : SgOmpUniformClause** objectArray = (SgOmpUniformClause**) &(SgOmpUniformClause::pools[0]);
48918 :
48919 : // Build a local variable for better performance
48920 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
48921 :
48922 : // Iterate over the memory pools
48923 0 : bool done = false;
48924 0 : unsigned i=0;
48925 :
48926 : // find the first valid IR node, call visit function, and then leave
48927 0 : while ( done == false && i < SgOmpUniformClause::pools.size() )
48928 : {
48929 : // objectArray[i] is a single memory pool
48930 : unsigned j=0;
48931 0 : while (done == false && j < SgOmpUniformClause::pool_size)
48932 : {
48933 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
48934 : {
48935 0 : traversal.visit(&(objectArray[i][j]));
48936 0 : done = true;
48937 : }
48938 0 : j++;
48939 : }
48940 0 : i++;
48941 : }
48942 :
48943 : #if 0
48944 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
48945 : if (done == false)
48946 : {
48947 : printf ("No representative for SgOmpUniformClause found in memory pools \n");
48948 : }
48949 : #endif
48950 : }
48951 0 : }
48952 :
48953 :
48954 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
48955 : // using values that overflow signed values of int.
48956 : size_t
48957 4 : SgOmpUniformClause::numberOfNodes()
48958 : {
48959 : // This function traverses the memory pool for an IR node and
48960 : // counts the number of IR nodes of a particular Sage III IR
48961 : // nodes type.
48962 :
48963 4 : size_t count = 0;
48964 4 : if (SgOmpUniformClause::pools.empty() == false)
48965 : {
48966 : // Generate an array of memory pools (this is actually a STL vector,
48967 : // but it is contiguious, so OK to treat this way).
48968 0 : SgOmpUniformClause** objectArray = (SgOmpUniformClause**) &(SgOmpUniformClause::pools[0]);
48969 :
48970 : // Build a local variable for better performance (make it a loop invariant variable).
48971 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
48972 :
48973 : // Iterate over all of the memory pools for this IR node.
48974 0 : for (unsigned int i=0; i < SgOmpUniformClause::pools.size(); i++)
48975 : {
48976 : // objectArray[i] is a single memory pool, iterate over all the
48977 : // IR nodes and only count those that are valid IR nodes used in
48978 : // the AST (i.e. allocated IR nodes).
48979 0 : for (unsigned j=0; j < SgOmpUniformClause::pool_size; j++)
48980 : {
48981 : // This is indexing the STL vector of C/C++ style arrays as a doubly
48982 : // indexed array access. It is OK since we have leveraged the semantics
48983 : // of STL vector memory as contigous and cast the memory as an array
48984 : // of arrays to use the 2D array indexing. Hope this is not confusing,
48985 : // but it s very fast as an implementation.
48986 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
48987 : {
48988 0 : count++;
48989 : }
48990 : }
48991 : }
48992 : }
48993 :
48994 :
48995 :
48996 4 : return count;
48997 : }
48998 :
48999 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
49000 : // using values that overflow signed values of int.
49001 : size_t
49002 0 : SgOmpUniformClause::memoryUsage()
49003 : {
49004 : // This function is required because we need the class name as a type when we call sizeof
49005 : // There might be another way to implement this if we have a traversal that only called a
49006 : // representative object (one call for each type of Sage IIIIR node).
49007 0 : size_t memory = numberOfNodes() * sizeof(SgOmpUniformClause);
49008 :
49009 0 : return memory;
49010 : }
49011 :
49012 : /* #line 49013 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
49013 :
49014 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
49015 : void
49016 5342 : SgOmpAlignedClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
49017 : {
49018 : // This function traverses the memory pool for only a specific IR node
49019 : // and calls the visit function of the input class execute a traversal
49020 : // similar to the style of the attribute based traversals within ROSE.
49021 : // This traversal will visit ALL nodes of the AST where as the other
49022 : // attribute based traversals visit only the embedded tree within the AST.
49023 :
49024 : // Initialize array to the address of the first element of the STL vector
49025 : // (which is guaranteed to be contiguous storage).
49026 : // SgOmpAlignedClause objectArray [] = *(Memory_Block_List.begin());
49027 5342 : if (SgOmpAlignedClause::pools.empty() == false)
49028 : {
49029 : // Generate an array of memory pools
49030 7 : SgOmpAlignedClause** objectArray = (SgOmpAlignedClause**) &(SgOmpAlignedClause::pools[0]);
49031 :
49032 : // Build a local variable for better performance
49033 7 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
49034 : #if 0
49035 : // Iterate over the memory pools
49036 : for (unsigned int i=0; i < SgOmpAlignedClause::pools.size(); i++)
49037 : {
49038 : // objectArray[i] is a single memory pool
49039 : for (int j=0; j < SgOmpAlignedClause::pool_size; j++)
49040 : {
49041 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
49042 : {
49043 : traversal.visit(&(objectArray[i][j]));
49044 : }
49045 : }
49046 : }
49047 : #else
49048 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
49049 : // compute the list first and then call the visit function on each list element.
49050 :
49051 : // printf ("Inside of SgOmpAlignedClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
49052 :
49053 14 : std::vector<SgOmpAlignedClause*> nodeList;
49054 :
49055 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
49056 14 : for (unsigned int i=0; i < SgOmpAlignedClause::pools.size(); i++)
49057 : {
49058 : // objectArray[i] is a single memory pool
49059 14007 : for (unsigned j=0; j < SgOmpAlignedClause::pool_size; j++)
49060 : {
49061 14000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
49062 : {
49063 14 : nodeList.push_back(&(objectArray[i][j]));
49064 : }
49065 : }
49066 : }
49067 :
49068 : // Iterate over the saved list
49069 7 : size_t nodeListSize = nodeList.size();
49070 21 : for (size_t i=0; i < nodeListSize; i++)
49071 : {
49072 14 : ROSE_ASSERT(nodeList[i] != NULL);
49073 : #if 0
49074 : traversal.visit(nodeList[i]);
49075 : #else
49076 14 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
49077 : {
49078 14 : traversal.visit(nodeList[i]);
49079 : }
49080 : #endif
49081 : }
49082 : #endif
49083 : }
49084 :
49085 : // This should not be required since all previously static data members are
49086 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
49087 :
49088 5342 : }
49089 :
49090 :
49091 : void
49092 194 : SgOmpAlignedClause::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
49093 : {
49094 : // This function traverses the memory pool for an IR node and
49095 : // calls the function to execute the visitor object.
49096 :
49097 : // Initialize array to the address of the first element of the STL vector
49098 : // (which is guarenteed to be contiguous storage).
49099 : // SgOmpAlignedClause objectArray [] = *(Memory_Block_List.begin());
49100 194 : if (SgOmpAlignedClause::pools.empty() == false)
49101 : {
49102 : // Generate an array of memory pools
49103 0 : SgOmpAlignedClause** objectArray = (SgOmpAlignedClause**) &(SgOmpAlignedClause::pools[0]);
49104 :
49105 : // Build a local variable for better performance
49106 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
49107 :
49108 : // Iterate over the memory pools
49109 0 : for (unsigned int i=0; i < SgOmpAlignedClause::pools.size(); i++)
49110 : {
49111 : // objectArray[i] is a single memory pool
49112 0 : for (unsigned j=0; j < SgOmpAlignedClause::pool_size; j++)
49113 : {
49114 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
49115 : {
49116 : // printf ("Found a valid SgOmpAlignedClause object in the memory pool %d at position %d \n",i,j);
49117 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
49118 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
49119 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
49120 : }
49121 : else
49122 : {
49123 : // printf ("Found a INVALID SgOmpAlignedClause object in the memory pool \n");
49124 : }
49125 : }
49126 : }
49127 : }
49128 :
49129 : // This should not be required since all previously static data members are
49130 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
49131 :
49132 194 : }
49133 :
49134 : void
49135 0 : SgOmpAlignedClause::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
49136 : {
49137 : // This function visits only a single IR node of the memory pool.
49138 : // it is typically called once for each type of IR node within
49139 : // the automatically generated function: traverseRepresentativeNodes().
49140 :
49141 : // Initialize array to the address of the first element of the STL vector
49142 : // (which is guarenteed to be contiguous storage).
49143 : // SgOmpAlignedClause objectArray [] = *(Memory_Block_List.begin());
49144 0 : if (SgOmpAlignedClause::pools.empty() == false)
49145 : {
49146 : // Generate an array of memory pools
49147 0 : SgOmpAlignedClause** objectArray = (SgOmpAlignedClause**) &(SgOmpAlignedClause::pools[0]);
49148 :
49149 : // Build a local variable for better performance
49150 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
49151 :
49152 : // Iterate over the memory pools
49153 0 : bool done = false;
49154 0 : unsigned i=0;
49155 :
49156 : // find the first valid IR node, call visit function, and then leave
49157 0 : while ( done == false && i < SgOmpAlignedClause::pools.size() )
49158 : {
49159 : // objectArray[i] is a single memory pool
49160 : unsigned j=0;
49161 0 : while (done == false && j < SgOmpAlignedClause::pool_size)
49162 : {
49163 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
49164 : {
49165 0 : traversal.visit(&(objectArray[i][j]));
49166 0 : done = true;
49167 : }
49168 0 : j++;
49169 : }
49170 0 : i++;
49171 : }
49172 :
49173 : #if 0
49174 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
49175 : if (done == false)
49176 : {
49177 : printf ("No representative for SgOmpAlignedClause found in memory pools \n");
49178 : }
49179 : #endif
49180 : }
49181 0 : }
49182 :
49183 :
49184 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
49185 : // using values that overflow signed values of int.
49186 : size_t
49187 4 : SgOmpAlignedClause::numberOfNodes()
49188 : {
49189 : // This function traverses the memory pool for an IR node and
49190 : // counts the number of IR nodes of a particular Sage III IR
49191 : // nodes type.
49192 :
49193 4 : size_t count = 0;
49194 4 : if (SgOmpAlignedClause::pools.empty() == false)
49195 : {
49196 : // Generate an array of memory pools (this is actually a STL vector,
49197 : // but it is contiguious, so OK to treat this way).
49198 0 : SgOmpAlignedClause** objectArray = (SgOmpAlignedClause**) &(SgOmpAlignedClause::pools[0]);
49199 :
49200 : // Build a local variable for better performance (make it a loop invariant variable).
49201 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
49202 :
49203 : // Iterate over all of the memory pools for this IR node.
49204 0 : for (unsigned int i=0; i < SgOmpAlignedClause::pools.size(); i++)
49205 : {
49206 : // objectArray[i] is a single memory pool, iterate over all the
49207 : // IR nodes and only count those that are valid IR nodes used in
49208 : // the AST (i.e. allocated IR nodes).
49209 0 : for (unsigned j=0; j < SgOmpAlignedClause::pool_size; j++)
49210 : {
49211 : // This is indexing the STL vector of C/C++ style arrays as a doubly
49212 : // indexed array access. It is OK since we have leveraged the semantics
49213 : // of STL vector memory as contigous and cast the memory as an array
49214 : // of arrays to use the 2D array indexing. Hope this is not confusing,
49215 : // but it s very fast as an implementation.
49216 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
49217 : {
49218 0 : count++;
49219 : }
49220 : }
49221 : }
49222 : }
49223 :
49224 :
49225 :
49226 4 : return count;
49227 : }
49228 :
49229 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
49230 : // using values that overflow signed values of int.
49231 : size_t
49232 0 : SgOmpAlignedClause::memoryUsage()
49233 : {
49234 : // This function is required because we need the class name as a type when we call sizeof
49235 : // There might be another way to implement this if we have a traversal that only called a
49236 : // representative object (one call for each type of Sage IIIIR node).
49237 0 : size_t memory = numberOfNodes() * sizeof(SgOmpAlignedClause);
49238 :
49239 0 : return memory;
49240 : }
49241 :
49242 : /* #line 49243 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
49243 :
49244 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
49245 : void
49246 5342 : SgOmpLinearClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
49247 : {
49248 : // This function traverses the memory pool for only a specific IR node
49249 : // and calls the visit function of the input class execute a traversal
49250 : // similar to the style of the attribute based traversals within ROSE.
49251 : // This traversal will visit ALL nodes of the AST where as the other
49252 : // attribute based traversals visit only the embedded tree within the AST.
49253 :
49254 : // Initialize array to the address of the first element of the STL vector
49255 : // (which is guaranteed to be contiguous storage).
49256 : // SgOmpLinearClause objectArray [] = *(Memory_Block_List.begin());
49257 5342 : if (SgOmpLinearClause::pools.empty() == false)
49258 : {
49259 : // Generate an array of memory pools
49260 28 : SgOmpLinearClause** objectArray = (SgOmpLinearClause**) &(SgOmpLinearClause::pools[0]);
49261 :
49262 : // Build a local variable for better performance
49263 28 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
49264 : #if 0
49265 : // Iterate over the memory pools
49266 : for (unsigned int i=0; i < SgOmpLinearClause::pools.size(); i++)
49267 : {
49268 : // objectArray[i] is a single memory pool
49269 : for (int j=0; j < SgOmpLinearClause::pool_size; j++)
49270 : {
49271 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
49272 : {
49273 : traversal.visit(&(objectArray[i][j]));
49274 : }
49275 : }
49276 : }
49277 : #else
49278 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
49279 : // compute the list first and then call the visit function on each list element.
49280 :
49281 : // printf ("Inside of SgOmpLinearClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
49282 :
49283 56 : std::vector<SgOmpLinearClause*> nodeList;
49284 :
49285 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
49286 56 : for (unsigned int i=0; i < SgOmpLinearClause::pools.size(); i++)
49287 : {
49288 : // objectArray[i] is a single memory pool
49289 56028 : for (unsigned j=0; j < SgOmpLinearClause::pool_size; j++)
49290 : {
49291 56000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
49292 : {
49293 42 : nodeList.push_back(&(objectArray[i][j]));
49294 : }
49295 : }
49296 : }
49297 :
49298 : // Iterate over the saved list
49299 28 : size_t nodeListSize = nodeList.size();
49300 70 : for (size_t i=0; i < nodeListSize; i++)
49301 : {
49302 42 : ROSE_ASSERT(nodeList[i] != NULL);
49303 : #if 0
49304 : traversal.visit(nodeList[i]);
49305 : #else
49306 42 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
49307 : {
49308 42 : traversal.visit(nodeList[i]);
49309 : }
49310 : #endif
49311 : }
49312 : #endif
49313 : }
49314 :
49315 : // This should not be required since all previously static data members are
49316 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
49317 :
49318 5342 : }
49319 :
49320 :
49321 : void
49322 194 : SgOmpLinearClause::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
49323 : {
49324 : // This function traverses the memory pool for an IR node and
49325 : // calls the function to execute the visitor object.
49326 :
49327 : // Initialize array to the address of the first element of the STL vector
49328 : // (which is guarenteed to be contiguous storage).
49329 : // SgOmpLinearClause objectArray [] = *(Memory_Block_List.begin());
49330 194 : if (SgOmpLinearClause::pools.empty() == false)
49331 : {
49332 : // Generate an array of memory pools
49333 0 : SgOmpLinearClause** objectArray = (SgOmpLinearClause**) &(SgOmpLinearClause::pools[0]);
49334 :
49335 : // Build a local variable for better performance
49336 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
49337 :
49338 : // Iterate over the memory pools
49339 0 : for (unsigned int i=0; i < SgOmpLinearClause::pools.size(); i++)
49340 : {
49341 : // objectArray[i] is a single memory pool
49342 0 : for (unsigned j=0; j < SgOmpLinearClause::pool_size; j++)
49343 : {
49344 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
49345 : {
49346 : // printf ("Found a valid SgOmpLinearClause object in the memory pool %d at position %d \n",i,j);
49347 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
49348 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
49349 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
49350 : }
49351 : else
49352 : {
49353 : // printf ("Found a INVALID SgOmpLinearClause object in the memory pool \n");
49354 : }
49355 : }
49356 : }
49357 : }
49358 :
49359 : // This should not be required since all previously static data members are
49360 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
49361 :
49362 194 : }
49363 :
49364 : void
49365 0 : SgOmpLinearClause::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
49366 : {
49367 : // This function visits only a single IR node of the memory pool.
49368 : // it is typically called once for each type of IR node within
49369 : // the automatically generated function: traverseRepresentativeNodes().
49370 :
49371 : // Initialize array to the address of the first element of the STL vector
49372 : // (which is guarenteed to be contiguous storage).
49373 : // SgOmpLinearClause objectArray [] = *(Memory_Block_List.begin());
49374 0 : if (SgOmpLinearClause::pools.empty() == false)
49375 : {
49376 : // Generate an array of memory pools
49377 0 : SgOmpLinearClause** objectArray = (SgOmpLinearClause**) &(SgOmpLinearClause::pools[0]);
49378 :
49379 : // Build a local variable for better performance
49380 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
49381 :
49382 : // Iterate over the memory pools
49383 0 : bool done = false;
49384 0 : unsigned i=0;
49385 :
49386 : // find the first valid IR node, call visit function, and then leave
49387 0 : while ( done == false && i < SgOmpLinearClause::pools.size() )
49388 : {
49389 : // objectArray[i] is a single memory pool
49390 : unsigned j=0;
49391 0 : while (done == false && j < SgOmpLinearClause::pool_size)
49392 : {
49393 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
49394 : {
49395 0 : traversal.visit(&(objectArray[i][j]));
49396 0 : done = true;
49397 : }
49398 0 : j++;
49399 : }
49400 0 : i++;
49401 : }
49402 :
49403 : #if 0
49404 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
49405 : if (done == false)
49406 : {
49407 : printf ("No representative for SgOmpLinearClause found in memory pools \n");
49408 : }
49409 : #endif
49410 : }
49411 0 : }
49412 :
49413 :
49414 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
49415 : // using values that overflow signed values of int.
49416 : size_t
49417 4 : SgOmpLinearClause::numberOfNodes()
49418 : {
49419 : // This function traverses the memory pool for an IR node and
49420 : // counts the number of IR nodes of a particular Sage III IR
49421 : // nodes type.
49422 :
49423 4 : size_t count = 0;
49424 4 : if (SgOmpLinearClause::pools.empty() == false)
49425 : {
49426 : // Generate an array of memory pools (this is actually a STL vector,
49427 : // but it is contiguious, so OK to treat this way).
49428 0 : SgOmpLinearClause** objectArray = (SgOmpLinearClause**) &(SgOmpLinearClause::pools[0]);
49429 :
49430 : // Build a local variable for better performance (make it a loop invariant variable).
49431 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
49432 :
49433 : // Iterate over all of the memory pools for this IR node.
49434 0 : for (unsigned int i=0; i < SgOmpLinearClause::pools.size(); i++)
49435 : {
49436 : // objectArray[i] is a single memory pool, iterate over all the
49437 : // IR nodes and only count those that are valid IR nodes used in
49438 : // the AST (i.e. allocated IR nodes).
49439 0 : for (unsigned j=0; j < SgOmpLinearClause::pool_size; j++)
49440 : {
49441 : // This is indexing the STL vector of C/C++ style arrays as a doubly
49442 : // indexed array access. It is OK since we have leveraged the semantics
49443 : // of STL vector memory as contigous and cast the memory as an array
49444 : // of arrays to use the 2D array indexing. Hope this is not confusing,
49445 : // but it s very fast as an implementation.
49446 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
49447 : {
49448 0 : count++;
49449 : }
49450 : }
49451 : }
49452 : }
49453 :
49454 :
49455 :
49456 4 : return count;
49457 : }
49458 :
49459 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
49460 : // using values that overflow signed values of int.
49461 : size_t
49462 0 : SgOmpLinearClause::memoryUsage()
49463 : {
49464 : // This function is required because we need the class name as a type when we call sizeof
49465 : // There might be another way to implement this if we have a traversal that only called a
49466 : // representative object (one call for each type of Sage IIIIR node).
49467 0 : size_t memory = numberOfNodes() * sizeof(SgOmpLinearClause);
49468 :
49469 0 : return memory;
49470 : }
49471 :
49472 : /* #line 49473 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
49473 :
49474 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
49475 : void
49476 5342 : SgOmpDependClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
49477 : {
49478 : // This function traverses the memory pool for only a specific IR node
49479 : // and calls the visit function of the input class execute a traversal
49480 : // similar to the style of the attribute based traversals within ROSE.
49481 : // This traversal will visit ALL nodes of the AST where as the other
49482 : // attribute based traversals visit only the embedded tree within the AST.
49483 :
49484 : // Initialize array to the address of the first element of the STL vector
49485 : // (which is guaranteed to be contiguous storage).
49486 : // SgOmpDependClause objectArray [] = *(Memory_Block_List.begin());
49487 5342 : if (SgOmpDependClause::pools.empty() == false)
49488 : {
49489 : // Generate an array of memory pools
49490 63 : SgOmpDependClause** objectArray = (SgOmpDependClause**) &(SgOmpDependClause::pools[0]);
49491 :
49492 : // Build a local variable for better performance
49493 63 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
49494 : #if 0
49495 : // Iterate over the memory pools
49496 : for (unsigned int i=0; i < SgOmpDependClause::pools.size(); i++)
49497 : {
49498 : // objectArray[i] is a single memory pool
49499 : for (int j=0; j < SgOmpDependClause::pool_size; j++)
49500 : {
49501 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
49502 : {
49503 : traversal.visit(&(objectArray[i][j]));
49504 : }
49505 : }
49506 : }
49507 : #else
49508 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
49509 : // compute the list first and then call the visit function on each list element.
49510 :
49511 : // printf ("Inside of SgOmpDependClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
49512 :
49513 126 : std::vector<SgOmpDependClause*> nodeList;
49514 :
49515 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
49516 126 : for (unsigned int i=0; i < SgOmpDependClause::pools.size(); i++)
49517 : {
49518 : // objectArray[i] is a single memory pool
49519 126063 : for (unsigned j=0; j < SgOmpDependClause::pool_size; j++)
49520 : {
49521 126000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
49522 : {
49523 133 : nodeList.push_back(&(objectArray[i][j]));
49524 : }
49525 : }
49526 : }
49527 :
49528 : // Iterate over the saved list
49529 63 : size_t nodeListSize = nodeList.size();
49530 196 : for (size_t i=0; i < nodeListSize; i++)
49531 : {
49532 133 : ROSE_ASSERT(nodeList[i] != NULL);
49533 : #if 0
49534 : traversal.visit(nodeList[i]);
49535 : #else
49536 133 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
49537 : {
49538 133 : traversal.visit(nodeList[i]);
49539 : }
49540 : #endif
49541 : }
49542 : #endif
49543 : }
49544 :
49545 : // This should not be required since all previously static data members are
49546 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
49547 :
49548 5342 : }
49549 :
49550 :
49551 : void
49552 194 : SgOmpDependClause::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
49553 : {
49554 : // This function traverses the memory pool for an IR node and
49555 : // calls the function to execute the visitor object.
49556 :
49557 : // Initialize array to the address of the first element of the STL vector
49558 : // (which is guarenteed to be contiguous storage).
49559 : // SgOmpDependClause objectArray [] = *(Memory_Block_List.begin());
49560 194 : if (SgOmpDependClause::pools.empty() == false)
49561 : {
49562 : // Generate an array of memory pools
49563 0 : SgOmpDependClause** objectArray = (SgOmpDependClause**) &(SgOmpDependClause::pools[0]);
49564 :
49565 : // Build a local variable for better performance
49566 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
49567 :
49568 : // Iterate over the memory pools
49569 0 : for (unsigned int i=0; i < SgOmpDependClause::pools.size(); i++)
49570 : {
49571 : // objectArray[i] is a single memory pool
49572 0 : for (unsigned j=0; j < SgOmpDependClause::pool_size; j++)
49573 : {
49574 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
49575 : {
49576 : // printf ("Found a valid SgOmpDependClause object in the memory pool %d at position %d \n",i,j);
49577 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
49578 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
49579 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
49580 : }
49581 : else
49582 : {
49583 : // printf ("Found a INVALID SgOmpDependClause object in the memory pool \n");
49584 : }
49585 : }
49586 : }
49587 : }
49588 :
49589 : // This should not be required since all previously static data members are
49590 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
49591 :
49592 194 : }
49593 :
49594 : void
49595 0 : SgOmpDependClause::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
49596 : {
49597 : // This function visits only a single IR node of the memory pool.
49598 : // it is typically called once for each type of IR node within
49599 : // the automatically generated function: traverseRepresentativeNodes().
49600 :
49601 : // Initialize array to the address of the first element of the STL vector
49602 : // (which is guarenteed to be contiguous storage).
49603 : // SgOmpDependClause objectArray [] = *(Memory_Block_List.begin());
49604 0 : if (SgOmpDependClause::pools.empty() == false)
49605 : {
49606 : // Generate an array of memory pools
49607 0 : SgOmpDependClause** objectArray = (SgOmpDependClause**) &(SgOmpDependClause::pools[0]);
49608 :
49609 : // Build a local variable for better performance
49610 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
49611 :
49612 : // Iterate over the memory pools
49613 0 : bool done = false;
49614 0 : unsigned i=0;
49615 :
49616 : // find the first valid IR node, call visit function, and then leave
49617 0 : while ( done == false && i < SgOmpDependClause::pools.size() )
49618 : {
49619 : // objectArray[i] is a single memory pool
49620 : unsigned j=0;
49621 0 : while (done == false && j < SgOmpDependClause::pool_size)
49622 : {
49623 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
49624 : {
49625 0 : traversal.visit(&(objectArray[i][j]));
49626 0 : done = true;
49627 : }
49628 0 : j++;
49629 : }
49630 0 : i++;
49631 : }
49632 :
49633 : #if 0
49634 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
49635 : if (done == false)
49636 : {
49637 : printf ("No representative for SgOmpDependClause found in memory pools \n");
49638 : }
49639 : #endif
49640 : }
49641 0 : }
49642 :
49643 :
49644 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
49645 : // using values that overflow signed values of int.
49646 : size_t
49647 4 : SgOmpDependClause::numberOfNodes()
49648 : {
49649 : // This function traverses the memory pool for an IR node and
49650 : // counts the number of IR nodes of a particular Sage III IR
49651 : // nodes type.
49652 :
49653 4 : size_t count = 0;
49654 4 : if (SgOmpDependClause::pools.empty() == false)
49655 : {
49656 : // Generate an array of memory pools (this is actually a STL vector,
49657 : // but it is contiguious, so OK to treat this way).
49658 0 : SgOmpDependClause** objectArray = (SgOmpDependClause**) &(SgOmpDependClause::pools[0]);
49659 :
49660 : // Build a local variable for better performance (make it a loop invariant variable).
49661 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
49662 :
49663 : // Iterate over all of the memory pools for this IR node.
49664 0 : for (unsigned int i=0; i < SgOmpDependClause::pools.size(); i++)
49665 : {
49666 : // objectArray[i] is a single memory pool, iterate over all the
49667 : // IR nodes and only count those that are valid IR nodes used in
49668 : // the AST (i.e. allocated IR nodes).
49669 0 : for (unsigned j=0; j < SgOmpDependClause::pool_size; j++)
49670 : {
49671 : // This is indexing the STL vector of C/C++ style arrays as a doubly
49672 : // indexed array access. It is OK since we have leveraged the semantics
49673 : // of STL vector memory as contigous and cast the memory as an array
49674 : // of arrays to use the 2D array indexing. Hope this is not confusing,
49675 : // but it s very fast as an implementation.
49676 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
49677 : {
49678 0 : count++;
49679 : }
49680 : }
49681 : }
49682 : }
49683 :
49684 :
49685 :
49686 4 : return count;
49687 : }
49688 :
49689 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
49690 : // using values that overflow signed values of int.
49691 : size_t
49692 0 : SgOmpDependClause::memoryUsage()
49693 : {
49694 : // This function is required because we need the class name as a type when we call sizeof
49695 : // There might be another way to implement this if we have a traversal that only called a
49696 : // representative object (one call for each type of Sage IIIIR node).
49697 0 : size_t memory = numberOfNodes() * sizeof(SgOmpDependClause);
49698 :
49699 0 : return memory;
49700 : }
49701 :
49702 : /* #line 49703 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
49703 :
49704 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
49705 : void
49706 5342 : SgOmpAffinityClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
49707 : {
49708 : // This function traverses the memory pool for only a specific IR node
49709 : // and calls the visit function of the input class execute a traversal
49710 : // similar to the style of the attribute based traversals within ROSE.
49711 : // This traversal will visit ALL nodes of the AST where as the other
49712 : // attribute based traversals visit only the embedded tree within the AST.
49713 :
49714 : // Initialize array to the address of the first element of the STL vector
49715 : // (which is guaranteed to be contiguous storage).
49716 : // SgOmpAffinityClause objectArray [] = *(Memory_Block_List.begin());
49717 5342 : if (SgOmpAffinityClause::pools.empty() == false)
49718 : {
49719 : // Generate an array of memory pools
49720 14 : SgOmpAffinityClause** objectArray = (SgOmpAffinityClause**) &(SgOmpAffinityClause::pools[0]);
49721 :
49722 : // Build a local variable for better performance
49723 14 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
49724 : #if 0
49725 : // Iterate over the memory pools
49726 : for (unsigned int i=0; i < SgOmpAffinityClause::pools.size(); i++)
49727 : {
49728 : // objectArray[i] is a single memory pool
49729 : for (int j=0; j < SgOmpAffinityClause::pool_size; j++)
49730 : {
49731 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
49732 : {
49733 : traversal.visit(&(objectArray[i][j]));
49734 : }
49735 : }
49736 : }
49737 : #else
49738 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
49739 : // compute the list first and then call the visit function on each list element.
49740 :
49741 : // printf ("Inside of SgOmpAffinityClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
49742 :
49743 28 : std::vector<SgOmpAffinityClause*> nodeList;
49744 :
49745 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
49746 28 : for (unsigned int i=0; i < SgOmpAffinityClause::pools.size(); i++)
49747 : {
49748 : // objectArray[i] is a single memory pool
49749 28014 : for (unsigned j=0; j < SgOmpAffinityClause::pool_size; j++)
49750 : {
49751 28000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
49752 : {
49753 28 : nodeList.push_back(&(objectArray[i][j]));
49754 : }
49755 : }
49756 : }
49757 :
49758 : // Iterate over the saved list
49759 14 : size_t nodeListSize = nodeList.size();
49760 42 : for (size_t i=0; i < nodeListSize; i++)
49761 : {
49762 28 : ROSE_ASSERT(nodeList[i] != NULL);
49763 : #if 0
49764 : traversal.visit(nodeList[i]);
49765 : #else
49766 28 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
49767 : {
49768 28 : traversal.visit(nodeList[i]);
49769 : }
49770 : #endif
49771 : }
49772 : #endif
49773 : }
49774 :
49775 : // This should not be required since all previously static data members are
49776 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
49777 :
49778 5342 : }
49779 :
49780 :
49781 : void
49782 194 : SgOmpAffinityClause::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
49783 : {
49784 : // This function traverses the memory pool for an IR node and
49785 : // calls the function to execute the visitor object.
49786 :
49787 : // Initialize array to the address of the first element of the STL vector
49788 : // (which is guarenteed to be contiguous storage).
49789 : // SgOmpAffinityClause objectArray [] = *(Memory_Block_List.begin());
49790 194 : if (SgOmpAffinityClause::pools.empty() == false)
49791 : {
49792 : // Generate an array of memory pools
49793 0 : SgOmpAffinityClause** objectArray = (SgOmpAffinityClause**) &(SgOmpAffinityClause::pools[0]);
49794 :
49795 : // Build a local variable for better performance
49796 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
49797 :
49798 : // Iterate over the memory pools
49799 0 : for (unsigned int i=0; i < SgOmpAffinityClause::pools.size(); i++)
49800 : {
49801 : // objectArray[i] is a single memory pool
49802 0 : for (unsigned j=0; j < SgOmpAffinityClause::pool_size; j++)
49803 : {
49804 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
49805 : {
49806 : // printf ("Found a valid SgOmpAffinityClause object in the memory pool %d at position %d \n",i,j);
49807 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
49808 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
49809 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
49810 : }
49811 : else
49812 : {
49813 : // printf ("Found a INVALID SgOmpAffinityClause object in the memory pool \n");
49814 : }
49815 : }
49816 : }
49817 : }
49818 :
49819 : // This should not be required since all previously static data members are
49820 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
49821 :
49822 194 : }
49823 :
49824 : void
49825 0 : SgOmpAffinityClause::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
49826 : {
49827 : // This function visits only a single IR node of the memory pool.
49828 : // it is typically called once for each type of IR node within
49829 : // the automatically generated function: traverseRepresentativeNodes().
49830 :
49831 : // Initialize array to the address of the first element of the STL vector
49832 : // (which is guarenteed to be contiguous storage).
49833 : // SgOmpAffinityClause objectArray [] = *(Memory_Block_List.begin());
49834 0 : if (SgOmpAffinityClause::pools.empty() == false)
49835 : {
49836 : // Generate an array of memory pools
49837 0 : SgOmpAffinityClause** objectArray = (SgOmpAffinityClause**) &(SgOmpAffinityClause::pools[0]);
49838 :
49839 : // Build a local variable for better performance
49840 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
49841 :
49842 : // Iterate over the memory pools
49843 0 : bool done = false;
49844 0 : unsigned i=0;
49845 :
49846 : // find the first valid IR node, call visit function, and then leave
49847 0 : while ( done == false && i < SgOmpAffinityClause::pools.size() )
49848 : {
49849 : // objectArray[i] is a single memory pool
49850 : unsigned j=0;
49851 0 : while (done == false && j < SgOmpAffinityClause::pool_size)
49852 : {
49853 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
49854 : {
49855 0 : traversal.visit(&(objectArray[i][j]));
49856 0 : done = true;
49857 : }
49858 0 : j++;
49859 : }
49860 0 : i++;
49861 : }
49862 :
49863 : #if 0
49864 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
49865 : if (done == false)
49866 : {
49867 : printf ("No representative for SgOmpAffinityClause found in memory pools \n");
49868 : }
49869 : #endif
49870 : }
49871 0 : }
49872 :
49873 :
49874 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
49875 : // using values that overflow signed values of int.
49876 : size_t
49877 4 : SgOmpAffinityClause::numberOfNodes()
49878 : {
49879 : // This function traverses the memory pool for an IR node and
49880 : // counts the number of IR nodes of a particular Sage III IR
49881 : // nodes type.
49882 :
49883 4 : size_t count = 0;
49884 4 : if (SgOmpAffinityClause::pools.empty() == false)
49885 : {
49886 : // Generate an array of memory pools (this is actually a STL vector,
49887 : // but it is contiguious, so OK to treat this way).
49888 0 : SgOmpAffinityClause** objectArray = (SgOmpAffinityClause**) &(SgOmpAffinityClause::pools[0]);
49889 :
49890 : // Build a local variable for better performance (make it a loop invariant variable).
49891 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
49892 :
49893 : // Iterate over all of the memory pools for this IR node.
49894 0 : for (unsigned int i=0; i < SgOmpAffinityClause::pools.size(); i++)
49895 : {
49896 : // objectArray[i] is a single memory pool, iterate over all the
49897 : // IR nodes and only count those that are valid IR nodes used in
49898 : // the AST (i.e. allocated IR nodes).
49899 0 : for (unsigned j=0; j < SgOmpAffinityClause::pool_size; j++)
49900 : {
49901 : // This is indexing the STL vector of C/C++ style arrays as a doubly
49902 : // indexed array access. It is OK since we have leveraged the semantics
49903 : // of STL vector memory as contigous and cast the memory as an array
49904 : // of arrays to use the 2D array indexing. Hope this is not confusing,
49905 : // but it s very fast as an implementation.
49906 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
49907 : {
49908 0 : count++;
49909 : }
49910 : }
49911 : }
49912 : }
49913 :
49914 :
49915 :
49916 4 : return count;
49917 : }
49918 :
49919 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
49920 : // using values that overflow signed values of int.
49921 : size_t
49922 0 : SgOmpAffinityClause::memoryUsage()
49923 : {
49924 : // This function is required because we need the class name as a type when we call sizeof
49925 : // There might be another way to implement this if we have a traversal that only called a
49926 : // representative object (one call for each type of Sage IIIIR node).
49927 0 : size_t memory = numberOfNodes() * sizeof(SgOmpAffinityClause);
49928 :
49929 0 : return memory;
49930 : }
49931 :
49932 : /* #line 49933 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
49933 :
49934 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
49935 : void
49936 5342 : SgOmpToClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
49937 : {
49938 : // This function traverses the memory pool for only a specific IR node
49939 : // and calls the visit function of the input class execute a traversal
49940 : // similar to the style of the attribute based traversals within ROSE.
49941 : // This traversal will visit ALL nodes of the AST where as the other
49942 : // attribute based traversals visit only the embedded tree within the AST.
49943 :
49944 : // Initialize array to the address of the first element of the STL vector
49945 : // (which is guaranteed to be contiguous storage).
49946 : // SgOmpToClause objectArray [] = *(Memory_Block_List.begin());
49947 5342 : if (SgOmpToClause::pools.empty() == false)
49948 : {
49949 : // Generate an array of memory pools
49950 14 : SgOmpToClause** objectArray = (SgOmpToClause**) &(SgOmpToClause::pools[0]);
49951 :
49952 : // Build a local variable for better performance
49953 14 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
49954 : #if 0
49955 : // Iterate over the memory pools
49956 : for (unsigned int i=0; i < SgOmpToClause::pools.size(); i++)
49957 : {
49958 : // objectArray[i] is a single memory pool
49959 : for (int j=0; j < SgOmpToClause::pool_size; j++)
49960 : {
49961 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
49962 : {
49963 : traversal.visit(&(objectArray[i][j]));
49964 : }
49965 : }
49966 : }
49967 : #else
49968 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
49969 : // compute the list first and then call the visit function on each list element.
49970 :
49971 : // printf ("Inside of SgOmpToClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
49972 :
49973 28 : std::vector<SgOmpToClause*> nodeList;
49974 :
49975 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
49976 28 : for (unsigned int i=0; i < SgOmpToClause::pools.size(); i++)
49977 : {
49978 : // objectArray[i] is a single memory pool
49979 28014 : for (unsigned j=0; j < SgOmpToClause::pool_size; j++)
49980 : {
49981 28000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
49982 : {
49983 14 : nodeList.push_back(&(objectArray[i][j]));
49984 : }
49985 : }
49986 : }
49987 :
49988 : // Iterate over the saved list
49989 14 : size_t nodeListSize = nodeList.size();
49990 28 : for (size_t i=0; i < nodeListSize; i++)
49991 : {
49992 14 : ROSE_ASSERT(nodeList[i] != NULL);
49993 : #if 0
49994 : traversal.visit(nodeList[i]);
49995 : #else
49996 14 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
49997 : {
49998 14 : traversal.visit(nodeList[i]);
49999 : }
50000 : #endif
50001 : }
50002 : #endif
50003 : }
50004 :
50005 : // This should not be required since all previously static data members are
50006 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
50007 :
50008 5342 : }
50009 :
50010 :
50011 : void
50012 194 : SgOmpToClause::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
50013 : {
50014 : // This function traverses the memory pool for an IR node and
50015 : // calls the function to execute the visitor object.
50016 :
50017 : // Initialize array to the address of the first element of the STL vector
50018 : // (which is guarenteed to be contiguous storage).
50019 : // SgOmpToClause objectArray [] = *(Memory_Block_List.begin());
50020 194 : if (SgOmpToClause::pools.empty() == false)
50021 : {
50022 : // Generate an array of memory pools
50023 0 : SgOmpToClause** objectArray = (SgOmpToClause**) &(SgOmpToClause::pools[0]);
50024 :
50025 : // Build a local variable for better performance
50026 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
50027 :
50028 : // Iterate over the memory pools
50029 0 : for (unsigned int i=0; i < SgOmpToClause::pools.size(); i++)
50030 : {
50031 : // objectArray[i] is a single memory pool
50032 0 : for (unsigned j=0; j < SgOmpToClause::pool_size; j++)
50033 : {
50034 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
50035 : {
50036 : // printf ("Found a valid SgOmpToClause object in the memory pool %d at position %d \n",i,j);
50037 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
50038 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
50039 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
50040 : }
50041 : else
50042 : {
50043 : // printf ("Found a INVALID SgOmpToClause object in the memory pool \n");
50044 : }
50045 : }
50046 : }
50047 : }
50048 :
50049 : // This should not be required since all previously static data members are
50050 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
50051 :
50052 194 : }
50053 :
50054 : void
50055 0 : SgOmpToClause::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
50056 : {
50057 : // This function visits only a single IR node of the memory pool.
50058 : // it is typically called once for each type of IR node within
50059 : // the automatically generated function: traverseRepresentativeNodes().
50060 :
50061 : // Initialize array to the address of the first element of the STL vector
50062 : // (which is guarenteed to be contiguous storage).
50063 : // SgOmpToClause objectArray [] = *(Memory_Block_List.begin());
50064 0 : if (SgOmpToClause::pools.empty() == false)
50065 : {
50066 : // Generate an array of memory pools
50067 0 : SgOmpToClause** objectArray = (SgOmpToClause**) &(SgOmpToClause::pools[0]);
50068 :
50069 : // Build a local variable for better performance
50070 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
50071 :
50072 : // Iterate over the memory pools
50073 0 : bool done = false;
50074 0 : unsigned i=0;
50075 :
50076 : // find the first valid IR node, call visit function, and then leave
50077 0 : while ( done == false && i < SgOmpToClause::pools.size() )
50078 : {
50079 : // objectArray[i] is a single memory pool
50080 : unsigned j=0;
50081 0 : while (done == false && j < SgOmpToClause::pool_size)
50082 : {
50083 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
50084 : {
50085 0 : traversal.visit(&(objectArray[i][j]));
50086 0 : done = true;
50087 : }
50088 0 : j++;
50089 : }
50090 0 : i++;
50091 : }
50092 :
50093 : #if 0
50094 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
50095 : if (done == false)
50096 : {
50097 : printf ("No representative for SgOmpToClause found in memory pools \n");
50098 : }
50099 : #endif
50100 : }
50101 0 : }
50102 :
50103 :
50104 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
50105 : // using values that overflow signed values of int.
50106 : size_t
50107 4 : SgOmpToClause::numberOfNodes()
50108 : {
50109 : // This function traverses the memory pool for an IR node and
50110 : // counts the number of IR nodes of a particular Sage III IR
50111 : // nodes type.
50112 :
50113 4 : size_t count = 0;
50114 4 : if (SgOmpToClause::pools.empty() == false)
50115 : {
50116 : // Generate an array of memory pools (this is actually a STL vector,
50117 : // but it is contiguious, so OK to treat this way).
50118 0 : SgOmpToClause** objectArray = (SgOmpToClause**) &(SgOmpToClause::pools[0]);
50119 :
50120 : // Build a local variable for better performance (make it a loop invariant variable).
50121 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
50122 :
50123 : // Iterate over all of the memory pools for this IR node.
50124 0 : for (unsigned int i=0; i < SgOmpToClause::pools.size(); i++)
50125 : {
50126 : // objectArray[i] is a single memory pool, iterate over all the
50127 : // IR nodes and only count those that are valid IR nodes used in
50128 : // the AST (i.e. allocated IR nodes).
50129 0 : for (unsigned j=0; j < SgOmpToClause::pool_size; j++)
50130 : {
50131 : // This is indexing the STL vector of C/C++ style arrays as a doubly
50132 : // indexed array access. It is OK since we have leveraged the semantics
50133 : // of STL vector memory as contigous and cast the memory as an array
50134 : // of arrays to use the 2D array indexing. Hope this is not confusing,
50135 : // but it s very fast as an implementation.
50136 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
50137 : {
50138 0 : count++;
50139 : }
50140 : }
50141 : }
50142 : }
50143 :
50144 :
50145 :
50146 4 : return count;
50147 : }
50148 :
50149 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
50150 : // using values that overflow signed values of int.
50151 : size_t
50152 0 : SgOmpToClause::memoryUsage()
50153 : {
50154 : // This function is required because we need the class name as a type when we call sizeof
50155 : // There might be another way to implement this if we have a traversal that only called a
50156 : // representative object (one call for each type of Sage IIIIR node).
50157 0 : size_t memory = numberOfNodes() * sizeof(SgOmpToClause);
50158 :
50159 0 : return memory;
50160 : }
50161 :
50162 : /* #line 50163 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
50163 :
50164 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
50165 : void
50166 5342 : SgOmpFromClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
50167 : {
50168 : // This function traverses the memory pool for only a specific IR node
50169 : // and calls the visit function of the input class execute a traversal
50170 : // similar to the style of the attribute based traversals within ROSE.
50171 : // This traversal will visit ALL nodes of the AST where as the other
50172 : // attribute based traversals visit only the embedded tree within the AST.
50173 :
50174 : // Initialize array to the address of the first element of the STL vector
50175 : // (which is guaranteed to be contiguous storage).
50176 : // SgOmpFromClause objectArray [] = *(Memory_Block_List.begin());
50177 5342 : if (SgOmpFromClause::pools.empty() == false)
50178 : {
50179 : // Generate an array of memory pools
50180 7 : SgOmpFromClause** objectArray = (SgOmpFromClause**) &(SgOmpFromClause::pools[0]);
50181 :
50182 : // Build a local variable for better performance
50183 7 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
50184 : #if 0
50185 : // Iterate over the memory pools
50186 : for (unsigned int i=0; i < SgOmpFromClause::pools.size(); i++)
50187 : {
50188 : // objectArray[i] is a single memory pool
50189 : for (int j=0; j < SgOmpFromClause::pool_size; j++)
50190 : {
50191 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
50192 : {
50193 : traversal.visit(&(objectArray[i][j]));
50194 : }
50195 : }
50196 : }
50197 : #else
50198 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
50199 : // compute the list first and then call the visit function on each list element.
50200 :
50201 : // printf ("Inside of SgOmpFromClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
50202 :
50203 14 : std::vector<SgOmpFromClause*> nodeList;
50204 :
50205 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
50206 14 : for (unsigned int i=0; i < SgOmpFromClause::pools.size(); i++)
50207 : {
50208 : // objectArray[i] is a single memory pool
50209 14007 : for (unsigned j=0; j < SgOmpFromClause::pool_size; j++)
50210 : {
50211 14000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
50212 : {
50213 7 : nodeList.push_back(&(objectArray[i][j]));
50214 : }
50215 : }
50216 : }
50217 :
50218 : // Iterate over the saved list
50219 7 : size_t nodeListSize = nodeList.size();
50220 14 : for (size_t i=0; i < nodeListSize; i++)
50221 : {
50222 7 : ROSE_ASSERT(nodeList[i] != NULL);
50223 : #if 0
50224 : traversal.visit(nodeList[i]);
50225 : #else
50226 7 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
50227 : {
50228 7 : traversal.visit(nodeList[i]);
50229 : }
50230 : #endif
50231 : }
50232 : #endif
50233 : }
50234 :
50235 : // This should not be required since all previously static data members are
50236 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
50237 :
50238 5342 : }
50239 :
50240 :
50241 : void
50242 194 : SgOmpFromClause::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
50243 : {
50244 : // This function traverses the memory pool for an IR node and
50245 : // calls the function to execute the visitor object.
50246 :
50247 : // Initialize array to the address of the first element of the STL vector
50248 : // (which is guarenteed to be contiguous storage).
50249 : // SgOmpFromClause objectArray [] = *(Memory_Block_List.begin());
50250 194 : if (SgOmpFromClause::pools.empty() == false)
50251 : {
50252 : // Generate an array of memory pools
50253 0 : SgOmpFromClause** objectArray = (SgOmpFromClause**) &(SgOmpFromClause::pools[0]);
50254 :
50255 : // Build a local variable for better performance
50256 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
50257 :
50258 : // Iterate over the memory pools
50259 0 : for (unsigned int i=0; i < SgOmpFromClause::pools.size(); i++)
50260 : {
50261 : // objectArray[i] is a single memory pool
50262 0 : for (unsigned j=0; j < SgOmpFromClause::pool_size; j++)
50263 : {
50264 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
50265 : {
50266 : // printf ("Found a valid SgOmpFromClause object in the memory pool %d at position %d \n",i,j);
50267 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
50268 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
50269 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
50270 : }
50271 : else
50272 : {
50273 : // printf ("Found a INVALID SgOmpFromClause object in the memory pool \n");
50274 : }
50275 : }
50276 : }
50277 : }
50278 :
50279 : // This should not be required since all previously static data members are
50280 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
50281 :
50282 194 : }
50283 :
50284 : void
50285 0 : SgOmpFromClause::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
50286 : {
50287 : // This function visits only a single IR node of the memory pool.
50288 : // it is typically called once for each type of IR node within
50289 : // the automatically generated function: traverseRepresentativeNodes().
50290 :
50291 : // Initialize array to the address of the first element of the STL vector
50292 : // (which is guarenteed to be contiguous storage).
50293 : // SgOmpFromClause objectArray [] = *(Memory_Block_List.begin());
50294 0 : if (SgOmpFromClause::pools.empty() == false)
50295 : {
50296 : // Generate an array of memory pools
50297 0 : SgOmpFromClause** objectArray = (SgOmpFromClause**) &(SgOmpFromClause::pools[0]);
50298 :
50299 : // Build a local variable for better performance
50300 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
50301 :
50302 : // Iterate over the memory pools
50303 0 : bool done = false;
50304 0 : unsigned i=0;
50305 :
50306 : // find the first valid IR node, call visit function, and then leave
50307 0 : while ( done == false && i < SgOmpFromClause::pools.size() )
50308 : {
50309 : // objectArray[i] is a single memory pool
50310 : unsigned j=0;
50311 0 : while (done == false && j < SgOmpFromClause::pool_size)
50312 : {
50313 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
50314 : {
50315 0 : traversal.visit(&(objectArray[i][j]));
50316 0 : done = true;
50317 : }
50318 0 : j++;
50319 : }
50320 0 : i++;
50321 : }
50322 :
50323 : #if 0
50324 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
50325 : if (done == false)
50326 : {
50327 : printf ("No representative for SgOmpFromClause found in memory pools \n");
50328 : }
50329 : #endif
50330 : }
50331 0 : }
50332 :
50333 :
50334 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
50335 : // using values that overflow signed values of int.
50336 : size_t
50337 4 : SgOmpFromClause::numberOfNodes()
50338 : {
50339 : // This function traverses the memory pool for an IR node and
50340 : // counts the number of IR nodes of a particular Sage III IR
50341 : // nodes type.
50342 :
50343 4 : size_t count = 0;
50344 4 : if (SgOmpFromClause::pools.empty() == false)
50345 : {
50346 : // Generate an array of memory pools (this is actually a STL vector,
50347 : // but it is contiguious, so OK to treat this way).
50348 0 : SgOmpFromClause** objectArray = (SgOmpFromClause**) &(SgOmpFromClause::pools[0]);
50349 :
50350 : // Build a local variable for better performance (make it a loop invariant variable).
50351 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
50352 :
50353 : // Iterate over all of the memory pools for this IR node.
50354 0 : for (unsigned int i=0; i < SgOmpFromClause::pools.size(); i++)
50355 : {
50356 : // objectArray[i] is a single memory pool, iterate over all the
50357 : // IR nodes and only count those that are valid IR nodes used in
50358 : // the AST (i.e. allocated IR nodes).
50359 0 : for (unsigned j=0; j < SgOmpFromClause::pool_size; j++)
50360 : {
50361 : // This is indexing the STL vector of C/C++ style arrays as a doubly
50362 : // indexed array access. It is OK since we have leveraged the semantics
50363 : // of STL vector memory as contigous and cast the memory as an array
50364 : // of arrays to use the 2D array indexing. Hope this is not confusing,
50365 : // but it s very fast as an implementation.
50366 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
50367 : {
50368 0 : count++;
50369 : }
50370 : }
50371 : }
50372 : }
50373 :
50374 :
50375 :
50376 4 : return count;
50377 : }
50378 :
50379 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
50380 : // using values that overflow signed values of int.
50381 : size_t
50382 0 : SgOmpFromClause::memoryUsage()
50383 : {
50384 : // This function is required because we need the class name as a type when we call sizeof
50385 : // There might be another way to implement this if we have a traversal that only called a
50386 : // representative object (one call for each type of Sage IIIIR node).
50387 0 : size_t memory = numberOfNodes() * sizeof(SgOmpFromClause);
50388 :
50389 0 : return memory;
50390 : }
50391 :
50392 : /* #line 50393 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
50393 :
50394 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
50395 : void
50396 5342 : SgOmpScheduleClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
50397 : {
50398 : // This function traverses the memory pool for only a specific IR node
50399 : // and calls the visit function of the input class execute a traversal
50400 : // similar to the style of the attribute based traversals within ROSE.
50401 : // This traversal will visit ALL nodes of the AST where as the other
50402 : // attribute based traversals visit only the embedded tree within the AST.
50403 :
50404 : // Initialize array to the address of the first element of the STL vector
50405 : // (which is guaranteed to be contiguous storage).
50406 : // SgOmpScheduleClause objectArray [] = *(Memory_Block_List.begin());
50407 5342 : if (SgOmpScheduleClause::pools.empty() == false)
50408 : {
50409 : // Generate an array of memory pools
50410 189 : SgOmpScheduleClause** objectArray = (SgOmpScheduleClause**) &(SgOmpScheduleClause::pools[0]);
50411 :
50412 : // Build a local variable for better performance
50413 189 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
50414 : #if 0
50415 : // Iterate over the memory pools
50416 : for (unsigned int i=0; i < SgOmpScheduleClause::pools.size(); i++)
50417 : {
50418 : // objectArray[i] is a single memory pool
50419 : for (int j=0; j < SgOmpScheduleClause::pool_size; j++)
50420 : {
50421 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
50422 : {
50423 : traversal.visit(&(objectArray[i][j]));
50424 : }
50425 : }
50426 : }
50427 : #else
50428 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
50429 : // compute the list first and then call the visit function on each list element.
50430 :
50431 : // printf ("Inside of SgOmpScheduleClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
50432 :
50433 378 : std::vector<SgOmpScheduleClause*> nodeList;
50434 :
50435 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
50436 378 : for (unsigned int i=0; i < SgOmpScheduleClause::pools.size(); i++)
50437 : {
50438 : // objectArray[i] is a single memory pool
50439 378189 : for (unsigned j=0; j < SgOmpScheduleClause::pool_size; j++)
50440 : {
50441 378000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
50442 : {
50443 665 : nodeList.push_back(&(objectArray[i][j]));
50444 : }
50445 : }
50446 : }
50447 :
50448 : // Iterate over the saved list
50449 189 : size_t nodeListSize = nodeList.size();
50450 854 : for (size_t i=0; i < nodeListSize; i++)
50451 : {
50452 665 : ROSE_ASSERT(nodeList[i] != NULL);
50453 : #if 0
50454 : traversal.visit(nodeList[i]);
50455 : #else
50456 665 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
50457 : {
50458 665 : traversal.visit(nodeList[i]);
50459 : }
50460 : #endif
50461 : }
50462 : #endif
50463 : }
50464 :
50465 : // This should not be required since all previously static data members are
50466 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
50467 :
50468 5342 : }
50469 :
50470 :
50471 : void
50472 194 : SgOmpScheduleClause::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
50473 : {
50474 : // This function traverses the memory pool for an IR node and
50475 : // calls the function to execute the visitor object.
50476 :
50477 : // Initialize array to the address of the first element of the STL vector
50478 : // (which is guarenteed to be contiguous storage).
50479 : // SgOmpScheduleClause objectArray [] = *(Memory_Block_List.begin());
50480 194 : if (SgOmpScheduleClause::pools.empty() == false)
50481 : {
50482 : // Generate an array of memory pools
50483 0 : SgOmpScheduleClause** objectArray = (SgOmpScheduleClause**) &(SgOmpScheduleClause::pools[0]);
50484 :
50485 : // Build a local variable for better performance
50486 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
50487 :
50488 : // Iterate over the memory pools
50489 0 : for (unsigned int i=0; i < SgOmpScheduleClause::pools.size(); i++)
50490 : {
50491 : // objectArray[i] is a single memory pool
50492 0 : for (unsigned j=0; j < SgOmpScheduleClause::pool_size; j++)
50493 : {
50494 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
50495 : {
50496 : // printf ("Found a valid SgOmpScheduleClause object in the memory pool %d at position %d \n",i,j);
50497 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
50498 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
50499 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
50500 : }
50501 : else
50502 : {
50503 : // printf ("Found a INVALID SgOmpScheduleClause object in the memory pool \n");
50504 : }
50505 : }
50506 : }
50507 : }
50508 :
50509 : // This should not be required since all previously static data members are
50510 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
50511 :
50512 194 : }
50513 :
50514 : void
50515 0 : SgOmpScheduleClause::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
50516 : {
50517 : // This function visits only a single IR node of the memory pool.
50518 : // it is typically called once for each type of IR node within
50519 : // the automatically generated function: traverseRepresentativeNodes().
50520 :
50521 : // Initialize array to the address of the first element of the STL vector
50522 : // (which is guarenteed to be contiguous storage).
50523 : // SgOmpScheduleClause objectArray [] = *(Memory_Block_List.begin());
50524 0 : if (SgOmpScheduleClause::pools.empty() == false)
50525 : {
50526 : // Generate an array of memory pools
50527 0 : SgOmpScheduleClause** objectArray = (SgOmpScheduleClause**) &(SgOmpScheduleClause::pools[0]);
50528 :
50529 : // Build a local variable for better performance
50530 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
50531 :
50532 : // Iterate over the memory pools
50533 0 : bool done = false;
50534 0 : unsigned i=0;
50535 :
50536 : // find the first valid IR node, call visit function, and then leave
50537 0 : while ( done == false && i < SgOmpScheduleClause::pools.size() )
50538 : {
50539 : // objectArray[i] is a single memory pool
50540 : unsigned j=0;
50541 0 : while (done == false && j < SgOmpScheduleClause::pool_size)
50542 : {
50543 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
50544 : {
50545 0 : traversal.visit(&(objectArray[i][j]));
50546 0 : done = true;
50547 : }
50548 0 : j++;
50549 : }
50550 0 : i++;
50551 : }
50552 :
50553 : #if 0
50554 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
50555 : if (done == false)
50556 : {
50557 : printf ("No representative for SgOmpScheduleClause found in memory pools \n");
50558 : }
50559 : #endif
50560 : }
50561 0 : }
50562 :
50563 :
50564 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
50565 : // using values that overflow signed values of int.
50566 : size_t
50567 4 : SgOmpScheduleClause::numberOfNodes()
50568 : {
50569 : // This function traverses the memory pool for an IR node and
50570 : // counts the number of IR nodes of a particular Sage III IR
50571 : // nodes type.
50572 :
50573 4 : size_t count = 0;
50574 4 : if (SgOmpScheduleClause::pools.empty() == false)
50575 : {
50576 : // Generate an array of memory pools (this is actually a STL vector,
50577 : // but it is contiguious, so OK to treat this way).
50578 0 : SgOmpScheduleClause** objectArray = (SgOmpScheduleClause**) &(SgOmpScheduleClause::pools[0]);
50579 :
50580 : // Build a local variable for better performance (make it a loop invariant variable).
50581 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
50582 :
50583 : // Iterate over all of the memory pools for this IR node.
50584 0 : for (unsigned int i=0; i < SgOmpScheduleClause::pools.size(); i++)
50585 : {
50586 : // objectArray[i] is a single memory pool, iterate over all the
50587 : // IR nodes and only count those that are valid IR nodes used in
50588 : // the AST (i.e. allocated IR nodes).
50589 0 : for (unsigned j=0; j < SgOmpScheduleClause::pool_size; j++)
50590 : {
50591 : // This is indexing the STL vector of C/C++ style arrays as a doubly
50592 : // indexed array access. It is OK since we have leveraged the semantics
50593 : // of STL vector memory as contigous and cast the memory as an array
50594 : // of arrays to use the 2D array indexing. Hope this is not confusing,
50595 : // but it s very fast as an implementation.
50596 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
50597 : {
50598 0 : count++;
50599 : }
50600 : }
50601 : }
50602 : }
50603 :
50604 :
50605 :
50606 4 : return count;
50607 : }
50608 :
50609 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
50610 : // using values that overflow signed values of int.
50611 : size_t
50612 0 : SgOmpScheduleClause::memoryUsage()
50613 : {
50614 : // This function is required because we need the class name as a type when we call sizeof
50615 : // There might be another way to implement this if we have a traversal that only called a
50616 : // representative object (one call for each type of Sage IIIIR node).
50617 0 : size_t memory = numberOfNodes() * sizeof(SgOmpScheduleClause);
50618 :
50619 0 : return memory;
50620 : }
50621 :
50622 : /* #line 50623 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
50623 :
50624 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
50625 : void
50626 5342 : SgOmpMergeableClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
50627 : {
50628 : // This function traverses the memory pool for only a specific IR node
50629 : // and calls the visit function of the input class execute a traversal
50630 : // similar to the style of the attribute based traversals within ROSE.
50631 : // This traversal will visit ALL nodes of the AST where as the other
50632 : // attribute based traversals visit only the embedded tree within the AST.
50633 :
50634 : // Initialize array to the address of the first element of the STL vector
50635 : // (which is guaranteed to be contiguous storage).
50636 : // SgOmpMergeableClause objectArray [] = *(Memory_Block_List.begin());
50637 5342 : if (SgOmpMergeableClause::pools.empty() == false)
50638 : {
50639 : // Generate an array of memory pools
50640 21 : SgOmpMergeableClause** objectArray = (SgOmpMergeableClause**) &(SgOmpMergeableClause::pools[0]);
50641 :
50642 : // Build a local variable for better performance
50643 21 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
50644 : #if 0
50645 : // Iterate over the memory pools
50646 : for (unsigned int i=0; i < SgOmpMergeableClause::pools.size(); i++)
50647 : {
50648 : // objectArray[i] is a single memory pool
50649 : for (int j=0; j < SgOmpMergeableClause::pool_size; j++)
50650 : {
50651 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
50652 : {
50653 : traversal.visit(&(objectArray[i][j]));
50654 : }
50655 : }
50656 : }
50657 : #else
50658 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
50659 : // compute the list first and then call the visit function on each list element.
50660 :
50661 : // printf ("Inside of SgOmpMergeableClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
50662 :
50663 42 : std::vector<SgOmpMergeableClause*> nodeList;
50664 :
50665 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
50666 42 : for (unsigned int i=0; i < SgOmpMergeableClause::pools.size(); i++)
50667 : {
50668 : // objectArray[i] is a single memory pool
50669 42021 : for (unsigned j=0; j < SgOmpMergeableClause::pool_size; j++)
50670 : {
50671 42000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
50672 : {
50673 28 : nodeList.push_back(&(objectArray[i][j]));
50674 : }
50675 : }
50676 : }
50677 :
50678 : // Iterate over the saved list
50679 21 : size_t nodeListSize = nodeList.size();
50680 49 : for (size_t i=0; i < nodeListSize; i++)
50681 : {
50682 28 : ROSE_ASSERT(nodeList[i] != NULL);
50683 : #if 0
50684 : traversal.visit(nodeList[i]);
50685 : #else
50686 28 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
50687 : {
50688 28 : traversal.visit(nodeList[i]);
50689 : }
50690 : #endif
50691 : }
50692 : #endif
50693 : }
50694 :
50695 : // This should not be required since all previously static data members are
50696 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
50697 :
50698 5342 : }
50699 :
50700 :
50701 : void
50702 194 : SgOmpMergeableClause::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
50703 : {
50704 : // This function traverses the memory pool for an IR node and
50705 : // calls the function to execute the visitor object.
50706 :
50707 : // Initialize array to the address of the first element of the STL vector
50708 : // (which is guarenteed to be contiguous storage).
50709 : // SgOmpMergeableClause objectArray [] = *(Memory_Block_List.begin());
50710 194 : if (SgOmpMergeableClause::pools.empty() == false)
50711 : {
50712 : // Generate an array of memory pools
50713 0 : SgOmpMergeableClause** objectArray = (SgOmpMergeableClause**) &(SgOmpMergeableClause::pools[0]);
50714 :
50715 : // Build a local variable for better performance
50716 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
50717 :
50718 : // Iterate over the memory pools
50719 0 : for (unsigned int i=0; i < SgOmpMergeableClause::pools.size(); i++)
50720 : {
50721 : // objectArray[i] is a single memory pool
50722 0 : for (unsigned j=0; j < SgOmpMergeableClause::pool_size; j++)
50723 : {
50724 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
50725 : {
50726 : // printf ("Found a valid SgOmpMergeableClause object in the memory pool %d at position %d \n",i,j);
50727 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
50728 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
50729 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
50730 : }
50731 : else
50732 : {
50733 : // printf ("Found a INVALID SgOmpMergeableClause object in the memory pool \n");
50734 : }
50735 : }
50736 : }
50737 : }
50738 :
50739 : // This should not be required since all previously static data members are
50740 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
50741 :
50742 194 : }
50743 :
50744 : void
50745 0 : SgOmpMergeableClause::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
50746 : {
50747 : // This function visits only a single IR node of the memory pool.
50748 : // it is typically called once for each type of IR node within
50749 : // the automatically generated function: traverseRepresentativeNodes().
50750 :
50751 : // Initialize array to the address of the first element of the STL vector
50752 : // (which is guarenteed to be contiguous storage).
50753 : // SgOmpMergeableClause objectArray [] = *(Memory_Block_List.begin());
50754 0 : if (SgOmpMergeableClause::pools.empty() == false)
50755 : {
50756 : // Generate an array of memory pools
50757 0 : SgOmpMergeableClause** objectArray = (SgOmpMergeableClause**) &(SgOmpMergeableClause::pools[0]);
50758 :
50759 : // Build a local variable for better performance
50760 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
50761 :
50762 : // Iterate over the memory pools
50763 0 : bool done = false;
50764 0 : unsigned i=0;
50765 :
50766 : // find the first valid IR node, call visit function, and then leave
50767 0 : while ( done == false && i < SgOmpMergeableClause::pools.size() )
50768 : {
50769 : // objectArray[i] is a single memory pool
50770 : unsigned j=0;
50771 0 : while (done == false && j < SgOmpMergeableClause::pool_size)
50772 : {
50773 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
50774 : {
50775 0 : traversal.visit(&(objectArray[i][j]));
50776 0 : done = true;
50777 : }
50778 0 : j++;
50779 : }
50780 0 : i++;
50781 : }
50782 :
50783 : #if 0
50784 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
50785 : if (done == false)
50786 : {
50787 : printf ("No representative for SgOmpMergeableClause found in memory pools \n");
50788 : }
50789 : #endif
50790 : }
50791 0 : }
50792 :
50793 :
50794 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
50795 : // using values that overflow signed values of int.
50796 : size_t
50797 4 : SgOmpMergeableClause::numberOfNodes()
50798 : {
50799 : // This function traverses the memory pool for an IR node and
50800 : // counts the number of IR nodes of a particular Sage III IR
50801 : // nodes type.
50802 :
50803 4 : size_t count = 0;
50804 4 : if (SgOmpMergeableClause::pools.empty() == false)
50805 : {
50806 : // Generate an array of memory pools (this is actually a STL vector,
50807 : // but it is contiguious, so OK to treat this way).
50808 0 : SgOmpMergeableClause** objectArray = (SgOmpMergeableClause**) &(SgOmpMergeableClause::pools[0]);
50809 :
50810 : // Build a local variable for better performance (make it a loop invariant variable).
50811 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
50812 :
50813 : // Iterate over all of the memory pools for this IR node.
50814 0 : for (unsigned int i=0; i < SgOmpMergeableClause::pools.size(); i++)
50815 : {
50816 : // objectArray[i] is a single memory pool, iterate over all the
50817 : // IR nodes and only count those that are valid IR nodes used in
50818 : // the AST (i.e. allocated IR nodes).
50819 0 : for (unsigned j=0; j < SgOmpMergeableClause::pool_size; j++)
50820 : {
50821 : // This is indexing the STL vector of C/C++ style arrays as a doubly
50822 : // indexed array access. It is OK since we have leveraged the semantics
50823 : // of STL vector memory as contigous and cast the memory as an array
50824 : // of arrays to use the 2D array indexing. Hope this is not confusing,
50825 : // but it s very fast as an implementation.
50826 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
50827 : {
50828 0 : count++;
50829 : }
50830 : }
50831 : }
50832 : }
50833 :
50834 :
50835 :
50836 4 : return count;
50837 : }
50838 :
50839 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
50840 : // using values that overflow signed values of int.
50841 : size_t
50842 0 : SgOmpMergeableClause::memoryUsage()
50843 : {
50844 : // This function is required because we need the class name as a type when we call sizeof
50845 : // There might be another way to implement this if we have a traversal that only called a
50846 : // representative object (one call for each type of Sage IIIIR node).
50847 0 : size_t memory = numberOfNodes() * sizeof(SgOmpMergeableClause);
50848 :
50849 0 : return memory;
50850 : }
50851 :
50852 : /* #line 50853 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
50853 :
50854 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
50855 : void
50856 5342 : SgOmpWhenClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
50857 : {
50858 : // This function traverses the memory pool for only a specific IR node
50859 : // and calls the visit function of the input class execute a traversal
50860 : // similar to the style of the attribute based traversals within ROSE.
50861 : // This traversal will visit ALL nodes of the AST where as the other
50862 : // attribute based traversals visit only the embedded tree within the AST.
50863 :
50864 : // Initialize array to the address of the first element of the STL vector
50865 : // (which is guaranteed to be contiguous storage).
50866 : // SgOmpWhenClause objectArray [] = *(Memory_Block_List.begin());
50867 5342 : if (SgOmpWhenClause::pools.empty() == false)
50868 : {
50869 : // Generate an array of memory pools
50870 0 : SgOmpWhenClause** objectArray = (SgOmpWhenClause**) &(SgOmpWhenClause::pools[0]);
50871 :
50872 : // Build a local variable for better performance
50873 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
50874 : #if 0
50875 : // Iterate over the memory pools
50876 : for (unsigned int i=0; i < SgOmpWhenClause::pools.size(); i++)
50877 : {
50878 : // objectArray[i] is a single memory pool
50879 : for (int j=0; j < SgOmpWhenClause::pool_size; j++)
50880 : {
50881 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
50882 : {
50883 : traversal.visit(&(objectArray[i][j]));
50884 : }
50885 : }
50886 : }
50887 : #else
50888 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
50889 : // compute the list first and then call the visit function on each list element.
50890 :
50891 : // printf ("Inside of SgOmpWhenClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
50892 :
50893 0 : std::vector<SgOmpWhenClause*> nodeList;
50894 :
50895 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
50896 0 : for (unsigned int i=0; i < SgOmpWhenClause::pools.size(); i++)
50897 : {
50898 : // objectArray[i] is a single memory pool
50899 0 : for (unsigned j=0; j < SgOmpWhenClause::pool_size; j++)
50900 : {
50901 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
50902 : {
50903 0 : nodeList.push_back(&(objectArray[i][j]));
50904 : }
50905 : }
50906 : }
50907 :
50908 : // Iterate over the saved list
50909 0 : size_t nodeListSize = nodeList.size();
50910 0 : for (size_t i=0; i < nodeListSize; i++)
50911 : {
50912 0 : ROSE_ASSERT(nodeList[i] != NULL);
50913 : #if 0
50914 : traversal.visit(nodeList[i]);
50915 : #else
50916 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
50917 : {
50918 0 : traversal.visit(nodeList[i]);
50919 : }
50920 : #endif
50921 : }
50922 : #endif
50923 : }
50924 :
50925 : // This should not be required since all previously static data members are
50926 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
50927 :
50928 5342 : }
50929 :
50930 :
50931 : void
50932 194 : SgOmpWhenClause::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
50933 : {
50934 : // This function traverses the memory pool for an IR node and
50935 : // calls the function to execute the visitor object.
50936 :
50937 : // Initialize array to the address of the first element of the STL vector
50938 : // (which is guarenteed to be contiguous storage).
50939 : // SgOmpWhenClause objectArray [] = *(Memory_Block_List.begin());
50940 194 : if (SgOmpWhenClause::pools.empty() == false)
50941 : {
50942 : // Generate an array of memory pools
50943 0 : SgOmpWhenClause** objectArray = (SgOmpWhenClause**) &(SgOmpWhenClause::pools[0]);
50944 :
50945 : // Build a local variable for better performance
50946 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
50947 :
50948 : // Iterate over the memory pools
50949 0 : for (unsigned int i=0; i < SgOmpWhenClause::pools.size(); i++)
50950 : {
50951 : // objectArray[i] is a single memory pool
50952 0 : for (unsigned j=0; j < SgOmpWhenClause::pool_size; j++)
50953 : {
50954 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
50955 : {
50956 : // printf ("Found a valid SgOmpWhenClause object in the memory pool %d at position %d \n",i,j);
50957 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
50958 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
50959 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
50960 : }
50961 : else
50962 : {
50963 : // printf ("Found a INVALID SgOmpWhenClause object in the memory pool \n");
50964 : }
50965 : }
50966 : }
50967 : }
50968 :
50969 : // This should not be required since all previously static data members are
50970 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
50971 :
50972 194 : }
50973 :
50974 : void
50975 0 : SgOmpWhenClause::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
50976 : {
50977 : // This function visits only a single IR node of the memory pool.
50978 : // it is typically called once for each type of IR node within
50979 : // the automatically generated function: traverseRepresentativeNodes().
50980 :
50981 : // Initialize array to the address of the first element of the STL vector
50982 : // (which is guarenteed to be contiguous storage).
50983 : // SgOmpWhenClause objectArray [] = *(Memory_Block_List.begin());
50984 0 : if (SgOmpWhenClause::pools.empty() == false)
50985 : {
50986 : // Generate an array of memory pools
50987 0 : SgOmpWhenClause** objectArray = (SgOmpWhenClause**) &(SgOmpWhenClause::pools[0]);
50988 :
50989 : // Build a local variable for better performance
50990 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
50991 :
50992 : // Iterate over the memory pools
50993 0 : bool done = false;
50994 0 : unsigned i=0;
50995 :
50996 : // find the first valid IR node, call visit function, and then leave
50997 0 : while ( done == false && i < SgOmpWhenClause::pools.size() )
50998 : {
50999 : // objectArray[i] is a single memory pool
51000 : unsigned j=0;
51001 0 : while (done == false && j < SgOmpWhenClause::pool_size)
51002 : {
51003 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
51004 : {
51005 0 : traversal.visit(&(objectArray[i][j]));
51006 0 : done = true;
51007 : }
51008 0 : j++;
51009 : }
51010 0 : i++;
51011 : }
51012 :
51013 : #if 0
51014 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
51015 : if (done == false)
51016 : {
51017 : printf ("No representative for SgOmpWhenClause found in memory pools \n");
51018 : }
51019 : #endif
51020 : }
51021 0 : }
51022 :
51023 :
51024 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
51025 : // using values that overflow signed values of int.
51026 : size_t
51027 4 : SgOmpWhenClause::numberOfNodes()
51028 : {
51029 : // This function traverses the memory pool for an IR node and
51030 : // counts the number of IR nodes of a particular Sage III IR
51031 : // nodes type.
51032 :
51033 4 : size_t count = 0;
51034 4 : if (SgOmpWhenClause::pools.empty() == false)
51035 : {
51036 : // Generate an array of memory pools (this is actually a STL vector,
51037 : // but it is contiguious, so OK to treat this way).
51038 0 : SgOmpWhenClause** objectArray = (SgOmpWhenClause**) &(SgOmpWhenClause::pools[0]);
51039 :
51040 : // Build a local variable for better performance (make it a loop invariant variable).
51041 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
51042 :
51043 : // Iterate over all of the memory pools for this IR node.
51044 0 : for (unsigned int i=0; i < SgOmpWhenClause::pools.size(); i++)
51045 : {
51046 : // objectArray[i] is a single memory pool, iterate over all the
51047 : // IR nodes and only count those that are valid IR nodes used in
51048 : // the AST (i.e. allocated IR nodes).
51049 0 : for (unsigned j=0; j < SgOmpWhenClause::pool_size; j++)
51050 : {
51051 : // This is indexing the STL vector of C/C++ style arrays as a doubly
51052 : // indexed array access. It is OK since we have leveraged the semantics
51053 : // of STL vector memory as contigous and cast the memory as an array
51054 : // of arrays to use the 2D array indexing. Hope this is not confusing,
51055 : // but it s very fast as an implementation.
51056 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
51057 : {
51058 0 : count++;
51059 : }
51060 : }
51061 : }
51062 : }
51063 :
51064 :
51065 :
51066 4 : return count;
51067 : }
51068 :
51069 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
51070 : // using values that overflow signed values of int.
51071 : size_t
51072 0 : SgOmpWhenClause::memoryUsage()
51073 : {
51074 : // This function is required because we need the class name as a type when we call sizeof
51075 : // There might be another way to implement this if we have a traversal that only called a
51076 : // representative object (one call for each type of Sage IIIIR node).
51077 0 : size_t memory = numberOfNodes() * sizeof(SgOmpWhenClause);
51078 :
51079 0 : return memory;
51080 : }
51081 :
51082 : /* #line 51083 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
51083 :
51084 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
51085 : void
51086 5342 : SgOmpUsesAllocatorsClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
51087 : {
51088 : // This function traverses the memory pool for only a specific IR node
51089 : // and calls the visit function of the input class execute a traversal
51090 : // similar to the style of the attribute based traversals within ROSE.
51091 : // This traversal will visit ALL nodes of the AST where as the other
51092 : // attribute based traversals visit only the embedded tree within the AST.
51093 :
51094 : // Initialize array to the address of the first element of the STL vector
51095 : // (which is guaranteed to be contiguous storage).
51096 : // SgOmpUsesAllocatorsClause objectArray [] = *(Memory_Block_List.begin());
51097 5342 : if (SgOmpUsesAllocatorsClause::pools.empty() == false)
51098 : {
51099 : // Generate an array of memory pools
51100 7 : SgOmpUsesAllocatorsClause** objectArray = (SgOmpUsesAllocatorsClause**) &(SgOmpUsesAllocatorsClause::pools[0]);
51101 :
51102 : // Build a local variable for better performance
51103 7 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
51104 : #if 0
51105 : // Iterate over the memory pools
51106 : for (unsigned int i=0; i < SgOmpUsesAllocatorsClause::pools.size(); i++)
51107 : {
51108 : // objectArray[i] is a single memory pool
51109 : for (int j=0; j < SgOmpUsesAllocatorsClause::pool_size; j++)
51110 : {
51111 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
51112 : {
51113 : traversal.visit(&(objectArray[i][j]));
51114 : }
51115 : }
51116 : }
51117 : #else
51118 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
51119 : // compute the list first and then call the visit function on each list element.
51120 :
51121 : // printf ("Inside of SgOmpUsesAllocatorsClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
51122 :
51123 14 : std::vector<SgOmpUsesAllocatorsClause*> nodeList;
51124 :
51125 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
51126 14 : for (unsigned int i=0; i < SgOmpUsesAllocatorsClause::pools.size(); i++)
51127 : {
51128 : // objectArray[i] is a single memory pool
51129 14007 : for (unsigned j=0; j < SgOmpUsesAllocatorsClause::pool_size; j++)
51130 : {
51131 14000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
51132 : {
51133 7 : nodeList.push_back(&(objectArray[i][j]));
51134 : }
51135 : }
51136 : }
51137 :
51138 : // Iterate over the saved list
51139 7 : size_t nodeListSize = nodeList.size();
51140 14 : for (size_t i=0; i < nodeListSize; i++)
51141 : {
51142 7 : ROSE_ASSERT(nodeList[i] != NULL);
51143 : #if 0
51144 : traversal.visit(nodeList[i]);
51145 : #else
51146 7 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
51147 : {
51148 7 : traversal.visit(nodeList[i]);
51149 : }
51150 : #endif
51151 : }
51152 : #endif
51153 : }
51154 :
51155 : // This should not be required since all previously static data members are
51156 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
51157 :
51158 5342 : }
51159 :
51160 :
51161 : void
51162 194 : SgOmpUsesAllocatorsClause::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
51163 : {
51164 : // This function traverses the memory pool for an IR node and
51165 : // calls the function to execute the visitor object.
51166 :
51167 : // Initialize array to the address of the first element of the STL vector
51168 : // (which is guarenteed to be contiguous storage).
51169 : // SgOmpUsesAllocatorsClause objectArray [] = *(Memory_Block_List.begin());
51170 194 : if (SgOmpUsesAllocatorsClause::pools.empty() == false)
51171 : {
51172 : // Generate an array of memory pools
51173 0 : SgOmpUsesAllocatorsClause** objectArray = (SgOmpUsesAllocatorsClause**) &(SgOmpUsesAllocatorsClause::pools[0]);
51174 :
51175 : // Build a local variable for better performance
51176 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
51177 :
51178 : // Iterate over the memory pools
51179 0 : for (unsigned int i=0; i < SgOmpUsesAllocatorsClause::pools.size(); i++)
51180 : {
51181 : // objectArray[i] is a single memory pool
51182 0 : for (unsigned j=0; j < SgOmpUsesAllocatorsClause::pool_size; j++)
51183 : {
51184 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
51185 : {
51186 : // printf ("Found a valid SgOmpUsesAllocatorsClause object in the memory pool %d at position %d \n",i,j);
51187 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
51188 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
51189 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
51190 : }
51191 : else
51192 : {
51193 : // printf ("Found a INVALID SgOmpUsesAllocatorsClause object in the memory pool \n");
51194 : }
51195 : }
51196 : }
51197 : }
51198 :
51199 : // This should not be required since all previously static data members are
51200 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
51201 :
51202 194 : }
51203 :
51204 : void
51205 0 : SgOmpUsesAllocatorsClause::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
51206 : {
51207 : // This function visits only a single IR node of the memory pool.
51208 : // it is typically called once for each type of IR node within
51209 : // the automatically generated function: traverseRepresentativeNodes().
51210 :
51211 : // Initialize array to the address of the first element of the STL vector
51212 : // (which is guarenteed to be contiguous storage).
51213 : // SgOmpUsesAllocatorsClause objectArray [] = *(Memory_Block_List.begin());
51214 0 : if (SgOmpUsesAllocatorsClause::pools.empty() == false)
51215 : {
51216 : // Generate an array of memory pools
51217 0 : SgOmpUsesAllocatorsClause** objectArray = (SgOmpUsesAllocatorsClause**) &(SgOmpUsesAllocatorsClause::pools[0]);
51218 :
51219 : // Build a local variable for better performance
51220 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
51221 :
51222 : // Iterate over the memory pools
51223 0 : bool done = false;
51224 0 : unsigned i=0;
51225 :
51226 : // find the first valid IR node, call visit function, and then leave
51227 0 : while ( done == false && i < SgOmpUsesAllocatorsClause::pools.size() )
51228 : {
51229 : // objectArray[i] is a single memory pool
51230 : unsigned j=0;
51231 0 : while (done == false && j < SgOmpUsesAllocatorsClause::pool_size)
51232 : {
51233 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
51234 : {
51235 0 : traversal.visit(&(objectArray[i][j]));
51236 0 : done = true;
51237 : }
51238 0 : j++;
51239 : }
51240 0 : i++;
51241 : }
51242 :
51243 : #if 0
51244 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
51245 : if (done == false)
51246 : {
51247 : printf ("No representative for SgOmpUsesAllocatorsClause found in memory pools \n");
51248 : }
51249 : #endif
51250 : }
51251 0 : }
51252 :
51253 :
51254 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
51255 : // using values that overflow signed values of int.
51256 : size_t
51257 4 : SgOmpUsesAllocatorsClause::numberOfNodes()
51258 : {
51259 : // This function traverses the memory pool for an IR node and
51260 : // counts the number of IR nodes of a particular Sage III IR
51261 : // nodes type.
51262 :
51263 4 : size_t count = 0;
51264 4 : if (SgOmpUsesAllocatorsClause::pools.empty() == false)
51265 : {
51266 : // Generate an array of memory pools (this is actually a STL vector,
51267 : // but it is contiguious, so OK to treat this way).
51268 0 : SgOmpUsesAllocatorsClause** objectArray = (SgOmpUsesAllocatorsClause**) &(SgOmpUsesAllocatorsClause::pools[0]);
51269 :
51270 : // Build a local variable for better performance (make it a loop invariant variable).
51271 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
51272 :
51273 : // Iterate over all of the memory pools for this IR node.
51274 0 : for (unsigned int i=0; i < SgOmpUsesAllocatorsClause::pools.size(); i++)
51275 : {
51276 : // objectArray[i] is a single memory pool, iterate over all the
51277 : // IR nodes and only count those that are valid IR nodes used in
51278 : // the AST (i.e. allocated IR nodes).
51279 0 : for (unsigned j=0; j < SgOmpUsesAllocatorsClause::pool_size; j++)
51280 : {
51281 : // This is indexing the STL vector of C/C++ style arrays as a doubly
51282 : // indexed array access. It is OK since we have leveraged the semantics
51283 : // of STL vector memory as contigous and cast the memory as an array
51284 : // of arrays to use the 2D array indexing. Hope this is not confusing,
51285 : // but it s very fast as an implementation.
51286 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
51287 : {
51288 0 : count++;
51289 : }
51290 : }
51291 : }
51292 : }
51293 :
51294 :
51295 :
51296 4 : return count;
51297 : }
51298 :
51299 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
51300 : // using values that overflow signed values of int.
51301 : size_t
51302 0 : SgOmpUsesAllocatorsClause::memoryUsage()
51303 : {
51304 : // This function is required because we need the class name as a type when we call sizeof
51305 : // There might be another way to implement this if we have a traversal that only called a
51306 : // representative object (one call for each type of Sage IIIIR node).
51307 0 : size_t memory = numberOfNodes() * sizeof(SgOmpUsesAllocatorsClause);
51308 :
51309 0 : return memory;
51310 : }
51311 :
51312 : /* #line 51313 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
51313 :
51314 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
51315 : void
51316 5342 : SgOmpFullClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
51317 : {
51318 : // This function traverses the memory pool for only a specific IR node
51319 : // and calls the visit function of the input class execute a traversal
51320 : // similar to the style of the attribute based traversals within ROSE.
51321 : // This traversal will visit ALL nodes of the AST where as the other
51322 : // attribute based traversals visit only the embedded tree within the AST.
51323 :
51324 : // Initialize array to the address of the first element of the STL vector
51325 : // (which is guaranteed to be contiguous storage).
51326 : // SgOmpFullClause objectArray [] = *(Memory_Block_List.begin());
51327 5342 : if (SgOmpFullClause::pools.empty() == false)
51328 : {
51329 : // Generate an array of memory pools
51330 0 : SgOmpFullClause** objectArray = (SgOmpFullClause**) &(SgOmpFullClause::pools[0]);
51331 :
51332 : // Build a local variable for better performance
51333 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
51334 : #if 0
51335 : // Iterate over the memory pools
51336 : for (unsigned int i=0; i < SgOmpFullClause::pools.size(); i++)
51337 : {
51338 : // objectArray[i] is a single memory pool
51339 : for (int j=0; j < SgOmpFullClause::pool_size; j++)
51340 : {
51341 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
51342 : {
51343 : traversal.visit(&(objectArray[i][j]));
51344 : }
51345 : }
51346 : }
51347 : #else
51348 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
51349 : // compute the list first and then call the visit function on each list element.
51350 :
51351 : // printf ("Inside of SgOmpFullClause::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
51352 :
51353 0 : std::vector<SgOmpFullClause*> nodeList;
51354 :
51355 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
51356 0 : for (unsigned int i=0; i < SgOmpFullClause::pools.size(); i++)
51357 : {
51358 : // objectArray[i] is a single memory pool
51359 0 : for (unsigned j=0; j < SgOmpFullClause::pool_size; j++)
51360 : {
51361 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
51362 : {
51363 0 : nodeList.push_back(&(objectArray[i][j]));
51364 : }
51365 : }
51366 : }
51367 :
51368 : // Iterate over the saved list
51369 0 : size_t nodeListSize = nodeList.size();
51370 0 : for (size_t i=0; i < nodeListSize; i++)
51371 : {
51372 0 : ROSE_ASSERT(nodeList[i] != NULL);
51373 : #if 0
51374 : traversal.visit(nodeList[i]);
51375 : #else
51376 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
51377 : {
51378 0 : traversal.visit(nodeList[i]);
51379 : }
51380 : #endif
51381 : }
51382 : #endif
51383 : }
51384 :
51385 : // This should not be required since all previously static data members are
51386 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
51387 :
51388 5342 : }
51389 :
51390 :
51391 : void
51392 194 : SgOmpFullClause::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
51393 : {
51394 : // This function traverses the memory pool for an IR node and
51395 : // calls the function to execute the visitor object.
51396 :
51397 : // Initialize array to the address of the first element of the STL vector
51398 : // (which is guarenteed to be contiguous storage).
51399 : // SgOmpFullClause objectArray [] = *(Memory_Block_List.begin());
51400 194 : if (SgOmpFullClause::pools.empty() == false)
51401 : {
51402 : // Generate an array of memory pools
51403 0 : SgOmpFullClause** objectArray = (SgOmpFullClause**) &(SgOmpFullClause::pools[0]);
51404 :
51405 : // Build a local variable for better performance
51406 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
51407 :
51408 : // Iterate over the memory pools
51409 0 : for (unsigned int i=0; i < SgOmpFullClause::pools.size(); i++)
51410 : {
51411 : // objectArray[i] is a single memory pool
51412 0 : for (unsigned j=0; j < SgOmpFullClause::pool_size; j++)
51413 : {
51414 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
51415 : {
51416 : // printf ("Found a valid SgOmpFullClause object in the memory pool %d at position %d \n",i,j);
51417 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
51418 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
51419 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
51420 : }
51421 : else
51422 : {
51423 : // printf ("Found a INVALID SgOmpFullClause object in the memory pool \n");
51424 : }
51425 : }
51426 : }
51427 : }
51428 :
51429 : // This should not be required since all previously static data members are
51430 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
51431 :
51432 194 : }
51433 :
51434 : void
51435 0 : SgOmpFullClause::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
51436 : {
51437 : // This function visits only a single IR node of the memory pool.
51438 : // it is typically called once for each type of IR node within
51439 : // the automatically generated function: traverseRepresentativeNodes().
51440 :
51441 : // Initialize array to the address of the first element of the STL vector
51442 : // (which is guarenteed to be contiguous storage).
51443 : // SgOmpFullClause objectArray [] = *(Memory_Block_List.begin());
51444 0 : if (SgOmpFullClause::pools.empty() == false)
51445 : {
51446 : // Generate an array of memory pools
51447 0 : SgOmpFullClause** objectArray = (SgOmpFullClause**) &(SgOmpFullClause::pools[0]);
51448 :
51449 : // Build a local variable for better performance
51450 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
51451 :
51452 : // Iterate over the memory pools
51453 0 : bool done = false;
51454 0 : unsigned i=0;
51455 :
51456 : // find the first valid IR node, call visit function, and then leave
51457 0 : while ( done == false && i < SgOmpFullClause::pools.size() )
51458 : {
51459 : // objectArray[i] is a single memory pool
51460 : unsigned j=0;
51461 0 : while (done == false && j < SgOmpFullClause::pool_size)
51462 : {
51463 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
51464 : {
51465 0 : traversal.visit(&(objectArray[i][j]));
51466 0 : done = true;
51467 : }
51468 0 : j++;
51469 : }
51470 0 : i++;
51471 : }
51472 :
51473 : #if 0
51474 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
51475 : if (done == false)
51476 : {
51477 : printf ("No representative for SgOmpFullClause found in memory pools \n");
51478 : }
51479 : #endif
51480 : }
51481 0 : }
51482 :
51483 :
51484 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
51485 : // using values that overflow signed values of int.
51486 : size_t
51487 4 : SgOmpFullClause::numberOfNodes()
51488 : {
51489 : // This function traverses the memory pool for an IR node and
51490 : // counts the number of IR nodes of a particular Sage III IR
51491 : // nodes type.
51492 :
51493 4 : size_t count = 0;
51494 4 : if (SgOmpFullClause::pools.empty() == false)
51495 : {
51496 : // Generate an array of memory pools (this is actually a STL vector,
51497 : // but it is contiguious, so OK to treat this way).
51498 0 : SgOmpFullClause** objectArray = (SgOmpFullClause**) &(SgOmpFullClause::pools[0]);
51499 :
51500 : // Build a local variable for better performance (make it a loop invariant variable).
51501 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
51502 :
51503 : // Iterate over all of the memory pools for this IR node.
51504 0 : for (unsigned int i=0; i < SgOmpFullClause::pools.size(); i++)
51505 : {
51506 : // objectArray[i] is a single memory pool, iterate over all the
51507 : // IR nodes and only count those that are valid IR nodes used in
51508 : // the AST (i.e. allocated IR nodes).
51509 0 : for (unsigned j=0; j < SgOmpFullClause::pool_size; j++)
51510 : {
51511 : // This is indexing the STL vector of C/C++ style arrays as a doubly
51512 : // indexed array access. It is OK since we have leveraged the semantics
51513 : // of STL vector memory as contigous and cast the memory as an array
51514 : // of arrays to use the 2D array indexing. Hope this is not confusing,
51515 : // but it s very fast as an implementation.
51516 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
51517 : {
51518 0 : count++;
51519 : }
51520 : }
51521 : }
51522 : }
51523 :
51524 :
51525 :
51526 4 : return count;
51527 : }
51528 :
51529 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
51530 : // using values that overflow signed values of int.
51531 : size_t
51532 0 : SgOmpFullClause::memoryUsage()
51533 : {
51534 : // This function is required because we need the class name as a type when we call sizeof
51535 : // There might be another way to implement this if we have a traversal that only called a
51536 : // representative object (one call for each type of Sage IIIIR node).
51537 0 : size_t memory = numberOfNodes() * sizeof(SgOmpFullClause);
51538 :
51539 0 : return memory;
51540 : }
51541 :
51542 : /* #line 51543 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
51543 :
51544 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
51545 : void
51546 5342 : SgUpirBranchField::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
51547 : {
51548 : // This function traverses the memory pool for only a specific IR node
51549 : // and calls the visit function of the input class execute a traversal
51550 : // similar to the style of the attribute based traversals within ROSE.
51551 : // This traversal will visit ALL nodes of the AST where as the other
51552 : // attribute based traversals visit only the embedded tree within the AST.
51553 :
51554 : // Initialize array to the address of the first element of the STL vector
51555 : // (which is guaranteed to be contiguous storage).
51556 : // SgUpirBranchField objectArray [] = *(Memory_Block_List.begin());
51557 5342 : if (SgUpirBranchField::pools.empty() == false)
51558 : {
51559 : // Generate an array of memory pools
51560 0 : SgUpirBranchField** objectArray = (SgUpirBranchField**) &(SgUpirBranchField::pools[0]);
51561 :
51562 : // Build a local variable for better performance
51563 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
51564 : #if 0
51565 : // Iterate over the memory pools
51566 : for (unsigned int i=0; i < SgUpirBranchField::pools.size(); i++)
51567 : {
51568 : // objectArray[i] is a single memory pool
51569 : for (int j=0; j < SgUpirBranchField::pool_size; j++)
51570 : {
51571 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
51572 : {
51573 : traversal.visit(&(objectArray[i][j]));
51574 : }
51575 : }
51576 : }
51577 : #else
51578 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
51579 : // compute the list first and then call the visit function on each list element.
51580 :
51581 : // printf ("Inside of SgUpirBranchField::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
51582 :
51583 0 : std::vector<SgUpirBranchField*> nodeList;
51584 :
51585 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
51586 0 : for (unsigned int i=0; i < SgUpirBranchField::pools.size(); i++)
51587 : {
51588 : // objectArray[i] is a single memory pool
51589 0 : for (unsigned j=0; j < SgUpirBranchField::pool_size; j++)
51590 : {
51591 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
51592 : {
51593 0 : nodeList.push_back(&(objectArray[i][j]));
51594 : }
51595 : }
51596 : }
51597 :
51598 : // Iterate over the saved list
51599 0 : size_t nodeListSize = nodeList.size();
51600 0 : for (size_t i=0; i < nodeListSize; i++)
51601 : {
51602 0 : ROSE_ASSERT(nodeList[i] != NULL);
51603 : #if 0
51604 : traversal.visit(nodeList[i]);
51605 : #else
51606 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
51607 : {
51608 0 : traversal.visit(nodeList[i]);
51609 : }
51610 : #endif
51611 : }
51612 : #endif
51613 : }
51614 :
51615 : // This should not be required since all previously static data members are
51616 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
51617 :
51618 5342 : }
51619 :
51620 :
51621 : void
51622 194 : SgUpirBranchField::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
51623 : {
51624 : // This function traverses the memory pool for an IR node and
51625 : // calls the function to execute the visitor object.
51626 :
51627 : // Initialize array to the address of the first element of the STL vector
51628 : // (which is guarenteed to be contiguous storage).
51629 : // SgUpirBranchField objectArray [] = *(Memory_Block_List.begin());
51630 194 : if (SgUpirBranchField::pools.empty() == false)
51631 : {
51632 : // Generate an array of memory pools
51633 0 : SgUpirBranchField** objectArray = (SgUpirBranchField**) &(SgUpirBranchField::pools[0]);
51634 :
51635 : // Build a local variable for better performance
51636 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
51637 :
51638 : // Iterate over the memory pools
51639 0 : for (unsigned int i=0; i < SgUpirBranchField::pools.size(); i++)
51640 : {
51641 : // objectArray[i] is a single memory pool
51642 0 : for (unsigned j=0; j < SgUpirBranchField::pool_size; j++)
51643 : {
51644 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
51645 : {
51646 : // printf ("Found a valid SgUpirBranchField object in the memory pool %d at position %d \n",i,j);
51647 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
51648 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
51649 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
51650 : }
51651 : else
51652 : {
51653 : // printf ("Found a INVALID SgUpirBranchField object in the memory pool \n");
51654 : }
51655 : }
51656 : }
51657 : }
51658 :
51659 : // This should not be required since all previously static data members are
51660 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
51661 :
51662 194 : }
51663 :
51664 : void
51665 0 : SgUpirBranchField::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
51666 : {
51667 : // This function visits only a single IR node of the memory pool.
51668 : // it is typically called once for each type of IR node within
51669 : // the automatically generated function: traverseRepresentativeNodes().
51670 :
51671 : // Initialize array to the address of the first element of the STL vector
51672 : // (which is guarenteed to be contiguous storage).
51673 : // SgUpirBranchField objectArray [] = *(Memory_Block_List.begin());
51674 0 : if (SgUpirBranchField::pools.empty() == false)
51675 : {
51676 : // Generate an array of memory pools
51677 0 : SgUpirBranchField** objectArray = (SgUpirBranchField**) &(SgUpirBranchField::pools[0]);
51678 :
51679 : // Build a local variable for better performance
51680 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
51681 :
51682 : // Iterate over the memory pools
51683 0 : bool done = false;
51684 0 : unsigned i=0;
51685 :
51686 : // find the first valid IR node, call visit function, and then leave
51687 0 : while ( done == false && i < SgUpirBranchField::pools.size() )
51688 : {
51689 : // objectArray[i] is a single memory pool
51690 : unsigned j=0;
51691 0 : while (done == false && j < SgUpirBranchField::pool_size)
51692 : {
51693 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
51694 : {
51695 0 : traversal.visit(&(objectArray[i][j]));
51696 0 : done = true;
51697 : }
51698 0 : j++;
51699 : }
51700 0 : i++;
51701 : }
51702 :
51703 : #if 0
51704 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
51705 : if (done == false)
51706 : {
51707 : printf ("No representative for SgUpirBranchField found in memory pools \n");
51708 : }
51709 : #endif
51710 : }
51711 0 : }
51712 :
51713 :
51714 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
51715 : // using values that overflow signed values of int.
51716 : size_t
51717 4 : SgUpirBranchField::numberOfNodes()
51718 : {
51719 : // This function traverses the memory pool for an IR node and
51720 : // counts the number of IR nodes of a particular Sage III IR
51721 : // nodes type.
51722 :
51723 4 : size_t count = 0;
51724 4 : if (SgUpirBranchField::pools.empty() == false)
51725 : {
51726 : // Generate an array of memory pools (this is actually a STL vector,
51727 : // but it is contiguious, so OK to treat this way).
51728 0 : SgUpirBranchField** objectArray = (SgUpirBranchField**) &(SgUpirBranchField::pools[0]);
51729 :
51730 : // Build a local variable for better performance (make it a loop invariant variable).
51731 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
51732 :
51733 : // Iterate over all of the memory pools for this IR node.
51734 0 : for (unsigned int i=0; i < SgUpirBranchField::pools.size(); i++)
51735 : {
51736 : // objectArray[i] is a single memory pool, iterate over all the
51737 : // IR nodes and only count those that are valid IR nodes used in
51738 : // the AST (i.e. allocated IR nodes).
51739 0 : for (unsigned j=0; j < SgUpirBranchField::pool_size; j++)
51740 : {
51741 : // This is indexing the STL vector of C/C++ style arrays as a doubly
51742 : // indexed array access. It is OK since we have leveraged the semantics
51743 : // of STL vector memory as contigous and cast the memory as an array
51744 : // of arrays to use the 2D array indexing. Hope this is not confusing,
51745 : // but it s very fast as an implementation.
51746 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
51747 : {
51748 0 : count++;
51749 : }
51750 : }
51751 : }
51752 : }
51753 :
51754 :
51755 :
51756 4 : return count;
51757 : }
51758 :
51759 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
51760 : // using values that overflow signed values of int.
51761 : size_t
51762 0 : SgUpirBranchField::memoryUsage()
51763 : {
51764 : // This function is required because we need the class name as a type when we call sizeof
51765 : // There might be another way to implement this if we have a traversal that only called a
51766 : // representative object (one call for each type of Sage IIIIR node).
51767 0 : size_t memory = numberOfNodes() * sizeof(SgUpirBranchField);
51768 :
51769 0 : return memory;
51770 : }
51771 :
51772 : /* #line 51773 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
51773 :
51774 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
51775 : void
51776 5342 : SgUpirNestedLevelField::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
51777 : {
51778 : // This function traverses the memory pool for only a specific IR node
51779 : // and calls the visit function of the input class execute a traversal
51780 : // similar to the style of the attribute based traversals within ROSE.
51781 : // This traversal will visit ALL nodes of the AST where as the other
51782 : // attribute based traversals visit only the embedded tree within the AST.
51783 :
51784 : // Initialize array to the address of the first element of the STL vector
51785 : // (which is guaranteed to be contiguous storage).
51786 : // SgUpirNestedLevelField objectArray [] = *(Memory_Block_List.begin());
51787 5342 : if (SgUpirNestedLevelField::pools.empty() == false)
51788 : {
51789 : // Generate an array of memory pools
51790 0 : SgUpirNestedLevelField** objectArray = (SgUpirNestedLevelField**) &(SgUpirNestedLevelField::pools[0]);
51791 :
51792 : // Build a local variable for better performance
51793 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
51794 : #if 0
51795 : // Iterate over the memory pools
51796 : for (unsigned int i=0; i < SgUpirNestedLevelField::pools.size(); i++)
51797 : {
51798 : // objectArray[i] is a single memory pool
51799 : for (int j=0; j < SgUpirNestedLevelField::pool_size; j++)
51800 : {
51801 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
51802 : {
51803 : traversal.visit(&(objectArray[i][j]));
51804 : }
51805 : }
51806 : }
51807 : #else
51808 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
51809 : // compute the list first and then call the visit function on each list element.
51810 :
51811 : // printf ("Inside of SgUpirNestedLevelField::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
51812 :
51813 0 : std::vector<SgUpirNestedLevelField*> nodeList;
51814 :
51815 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
51816 0 : for (unsigned int i=0; i < SgUpirNestedLevelField::pools.size(); i++)
51817 : {
51818 : // objectArray[i] is a single memory pool
51819 0 : for (unsigned j=0; j < SgUpirNestedLevelField::pool_size; j++)
51820 : {
51821 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
51822 : {
51823 0 : nodeList.push_back(&(objectArray[i][j]));
51824 : }
51825 : }
51826 : }
51827 :
51828 : // Iterate over the saved list
51829 0 : size_t nodeListSize = nodeList.size();
51830 0 : for (size_t i=0; i < nodeListSize; i++)
51831 : {
51832 0 : ROSE_ASSERT(nodeList[i] != NULL);
51833 : #if 0
51834 : traversal.visit(nodeList[i]);
51835 : #else
51836 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
51837 : {
51838 0 : traversal.visit(nodeList[i]);
51839 : }
51840 : #endif
51841 : }
51842 : #endif
51843 : }
51844 :
51845 : // This should not be required since all previously static data members are
51846 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
51847 :
51848 5342 : }
51849 :
51850 :
51851 : void
51852 194 : SgUpirNestedLevelField::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
51853 : {
51854 : // This function traverses the memory pool for an IR node and
51855 : // calls the function to execute the visitor object.
51856 :
51857 : // Initialize array to the address of the first element of the STL vector
51858 : // (which is guarenteed to be contiguous storage).
51859 : // SgUpirNestedLevelField objectArray [] = *(Memory_Block_List.begin());
51860 194 : if (SgUpirNestedLevelField::pools.empty() == false)
51861 : {
51862 : // Generate an array of memory pools
51863 0 : SgUpirNestedLevelField** objectArray = (SgUpirNestedLevelField**) &(SgUpirNestedLevelField::pools[0]);
51864 :
51865 : // Build a local variable for better performance
51866 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
51867 :
51868 : // Iterate over the memory pools
51869 0 : for (unsigned int i=0; i < SgUpirNestedLevelField::pools.size(); i++)
51870 : {
51871 : // objectArray[i] is a single memory pool
51872 0 : for (unsigned j=0; j < SgUpirNestedLevelField::pool_size; j++)
51873 : {
51874 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
51875 : {
51876 : // printf ("Found a valid SgUpirNestedLevelField object in the memory pool %d at position %d \n",i,j);
51877 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
51878 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
51879 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
51880 : }
51881 : else
51882 : {
51883 : // printf ("Found a INVALID SgUpirNestedLevelField object in the memory pool \n");
51884 : }
51885 : }
51886 : }
51887 : }
51888 :
51889 : // This should not be required since all previously static data members are
51890 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
51891 :
51892 194 : }
51893 :
51894 : void
51895 0 : SgUpirNestedLevelField::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
51896 : {
51897 : // This function visits only a single IR node of the memory pool.
51898 : // it is typically called once for each type of IR node within
51899 : // the automatically generated function: traverseRepresentativeNodes().
51900 :
51901 : // Initialize array to the address of the first element of the STL vector
51902 : // (which is guarenteed to be contiguous storage).
51903 : // SgUpirNestedLevelField objectArray [] = *(Memory_Block_List.begin());
51904 0 : if (SgUpirNestedLevelField::pools.empty() == false)
51905 : {
51906 : // Generate an array of memory pools
51907 0 : SgUpirNestedLevelField** objectArray = (SgUpirNestedLevelField**) &(SgUpirNestedLevelField::pools[0]);
51908 :
51909 : // Build a local variable for better performance
51910 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
51911 :
51912 : // Iterate over the memory pools
51913 0 : bool done = false;
51914 0 : unsigned i=0;
51915 :
51916 : // find the first valid IR node, call visit function, and then leave
51917 0 : while ( done == false && i < SgUpirNestedLevelField::pools.size() )
51918 : {
51919 : // objectArray[i] is a single memory pool
51920 : unsigned j=0;
51921 0 : while (done == false && j < SgUpirNestedLevelField::pool_size)
51922 : {
51923 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
51924 : {
51925 0 : traversal.visit(&(objectArray[i][j]));
51926 0 : done = true;
51927 : }
51928 0 : j++;
51929 : }
51930 0 : i++;
51931 : }
51932 :
51933 : #if 0
51934 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
51935 : if (done == false)
51936 : {
51937 : printf ("No representative for SgUpirNestedLevelField found in memory pools \n");
51938 : }
51939 : #endif
51940 : }
51941 0 : }
51942 :
51943 :
51944 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
51945 : // using values that overflow signed values of int.
51946 : size_t
51947 4 : SgUpirNestedLevelField::numberOfNodes()
51948 : {
51949 : // This function traverses the memory pool for an IR node and
51950 : // counts the number of IR nodes of a particular Sage III IR
51951 : // nodes type.
51952 :
51953 4 : size_t count = 0;
51954 4 : if (SgUpirNestedLevelField::pools.empty() == false)
51955 : {
51956 : // Generate an array of memory pools (this is actually a STL vector,
51957 : // but it is contiguious, so OK to treat this way).
51958 0 : SgUpirNestedLevelField** objectArray = (SgUpirNestedLevelField**) &(SgUpirNestedLevelField::pools[0]);
51959 :
51960 : // Build a local variable for better performance (make it a loop invariant variable).
51961 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
51962 :
51963 : // Iterate over all of the memory pools for this IR node.
51964 0 : for (unsigned int i=0; i < SgUpirNestedLevelField::pools.size(); i++)
51965 : {
51966 : // objectArray[i] is a single memory pool, iterate over all the
51967 : // IR nodes and only count those that are valid IR nodes used in
51968 : // the AST (i.e. allocated IR nodes).
51969 0 : for (unsigned j=0; j < SgUpirNestedLevelField::pool_size; j++)
51970 : {
51971 : // This is indexing the STL vector of C/C++ style arrays as a doubly
51972 : // indexed array access. It is OK since we have leveraged the semantics
51973 : // of STL vector memory as contigous and cast the memory as an array
51974 : // of arrays to use the 2D array indexing. Hope this is not confusing,
51975 : // but it s very fast as an implementation.
51976 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
51977 : {
51978 0 : count++;
51979 : }
51980 : }
51981 : }
51982 : }
51983 :
51984 :
51985 :
51986 4 : return count;
51987 : }
51988 :
51989 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
51990 : // using values that overflow signed values of int.
51991 : size_t
51992 0 : SgUpirNestedLevelField::memoryUsage()
51993 : {
51994 : // This function is required because we need the class name as a type when we call sizeof
51995 : // There might be another way to implement this if we have a traversal that only called a
51996 : // representative object (one call for each type of Sage IIIIR node).
51997 0 : size_t memory = numberOfNodes() * sizeof(SgUpirNestedLevelField);
51998 :
51999 0 : return memory;
52000 : }
52001 :
52002 : /* #line 52003 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
52003 :
52004 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
52005 : void
52006 5342 : SgUpirNestedParentField::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
52007 : {
52008 : // This function traverses the memory pool for only a specific IR node
52009 : // and calls the visit function of the input class execute a traversal
52010 : // similar to the style of the attribute based traversals within ROSE.
52011 : // This traversal will visit ALL nodes of the AST where as the other
52012 : // attribute based traversals visit only the embedded tree within the AST.
52013 :
52014 : // Initialize array to the address of the first element of the STL vector
52015 : // (which is guaranteed to be contiguous storage).
52016 : // SgUpirNestedParentField objectArray [] = *(Memory_Block_List.begin());
52017 5342 : if (SgUpirNestedParentField::pools.empty() == false)
52018 : {
52019 : // Generate an array of memory pools
52020 0 : SgUpirNestedParentField** objectArray = (SgUpirNestedParentField**) &(SgUpirNestedParentField::pools[0]);
52021 :
52022 : // Build a local variable for better performance
52023 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
52024 : #if 0
52025 : // Iterate over the memory pools
52026 : for (unsigned int i=0; i < SgUpirNestedParentField::pools.size(); i++)
52027 : {
52028 : // objectArray[i] is a single memory pool
52029 : for (int j=0; j < SgUpirNestedParentField::pool_size; j++)
52030 : {
52031 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
52032 : {
52033 : traversal.visit(&(objectArray[i][j]));
52034 : }
52035 : }
52036 : }
52037 : #else
52038 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
52039 : // compute the list first and then call the visit function on each list element.
52040 :
52041 : // printf ("Inside of SgUpirNestedParentField::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
52042 :
52043 0 : std::vector<SgUpirNestedParentField*> nodeList;
52044 :
52045 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
52046 0 : for (unsigned int i=0; i < SgUpirNestedParentField::pools.size(); i++)
52047 : {
52048 : // objectArray[i] is a single memory pool
52049 0 : for (unsigned j=0; j < SgUpirNestedParentField::pool_size; j++)
52050 : {
52051 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
52052 : {
52053 0 : nodeList.push_back(&(objectArray[i][j]));
52054 : }
52055 : }
52056 : }
52057 :
52058 : // Iterate over the saved list
52059 0 : size_t nodeListSize = nodeList.size();
52060 0 : for (size_t i=0; i < nodeListSize; i++)
52061 : {
52062 0 : ROSE_ASSERT(nodeList[i] != NULL);
52063 : #if 0
52064 : traversal.visit(nodeList[i]);
52065 : #else
52066 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
52067 : {
52068 0 : traversal.visit(nodeList[i]);
52069 : }
52070 : #endif
52071 : }
52072 : #endif
52073 : }
52074 :
52075 : // This should not be required since all previously static data members are
52076 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
52077 :
52078 5342 : }
52079 :
52080 :
52081 : void
52082 194 : SgUpirNestedParentField::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
52083 : {
52084 : // This function traverses the memory pool for an IR node and
52085 : // calls the function to execute the visitor object.
52086 :
52087 : // Initialize array to the address of the first element of the STL vector
52088 : // (which is guarenteed to be contiguous storage).
52089 : // SgUpirNestedParentField objectArray [] = *(Memory_Block_List.begin());
52090 194 : if (SgUpirNestedParentField::pools.empty() == false)
52091 : {
52092 : // Generate an array of memory pools
52093 0 : SgUpirNestedParentField** objectArray = (SgUpirNestedParentField**) &(SgUpirNestedParentField::pools[0]);
52094 :
52095 : // Build a local variable for better performance
52096 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
52097 :
52098 : // Iterate over the memory pools
52099 0 : for (unsigned int i=0; i < SgUpirNestedParentField::pools.size(); i++)
52100 : {
52101 : // objectArray[i] is a single memory pool
52102 0 : for (unsigned j=0; j < SgUpirNestedParentField::pool_size; j++)
52103 : {
52104 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
52105 : {
52106 : // printf ("Found a valid SgUpirNestedParentField object in the memory pool %d at position %d \n",i,j);
52107 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
52108 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
52109 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
52110 : }
52111 : else
52112 : {
52113 : // printf ("Found a INVALID SgUpirNestedParentField object in the memory pool \n");
52114 : }
52115 : }
52116 : }
52117 : }
52118 :
52119 : // This should not be required since all previously static data members are
52120 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
52121 :
52122 194 : }
52123 :
52124 : void
52125 0 : SgUpirNestedParentField::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
52126 : {
52127 : // This function visits only a single IR node of the memory pool.
52128 : // it is typically called once for each type of IR node within
52129 : // the automatically generated function: traverseRepresentativeNodes().
52130 :
52131 : // Initialize array to the address of the first element of the STL vector
52132 : // (which is guarenteed to be contiguous storage).
52133 : // SgUpirNestedParentField objectArray [] = *(Memory_Block_List.begin());
52134 0 : if (SgUpirNestedParentField::pools.empty() == false)
52135 : {
52136 : // Generate an array of memory pools
52137 0 : SgUpirNestedParentField** objectArray = (SgUpirNestedParentField**) &(SgUpirNestedParentField::pools[0]);
52138 :
52139 : // Build a local variable for better performance
52140 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
52141 :
52142 : // Iterate over the memory pools
52143 0 : bool done = false;
52144 0 : unsigned i=0;
52145 :
52146 : // find the first valid IR node, call visit function, and then leave
52147 0 : while ( done == false && i < SgUpirNestedParentField::pools.size() )
52148 : {
52149 : // objectArray[i] is a single memory pool
52150 : unsigned j=0;
52151 0 : while (done == false && j < SgUpirNestedParentField::pool_size)
52152 : {
52153 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
52154 : {
52155 0 : traversal.visit(&(objectArray[i][j]));
52156 0 : done = true;
52157 : }
52158 0 : j++;
52159 : }
52160 0 : i++;
52161 : }
52162 :
52163 : #if 0
52164 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
52165 : if (done == false)
52166 : {
52167 : printf ("No representative for SgUpirNestedParentField found in memory pools \n");
52168 : }
52169 : #endif
52170 : }
52171 0 : }
52172 :
52173 :
52174 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
52175 : // using values that overflow signed values of int.
52176 : size_t
52177 4 : SgUpirNestedParentField::numberOfNodes()
52178 : {
52179 : // This function traverses the memory pool for an IR node and
52180 : // counts the number of IR nodes of a particular Sage III IR
52181 : // nodes type.
52182 :
52183 4 : size_t count = 0;
52184 4 : if (SgUpirNestedParentField::pools.empty() == false)
52185 : {
52186 : // Generate an array of memory pools (this is actually a STL vector,
52187 : // but it is contiguious, so OK to treat this way).
52188 0 : SgUpirNestedParentField** objectArray = (SgUpirNestedParentField**) &(SgUpirNestedParentField::pools[0]);
52189 :
52190 : // Build a local variable for better performance (make it a loop invariant variable).
52191 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
52192 :
52193 : // Iterate over all of the memory pools for this IR node.
52194 0 : for (unsigned int i=0; i < SgUpirNestedParentField::pools.size(); i++)
52195 : {
52196 : // objectArray[i] is a single memory pool, iterate over all the
52197 : // IR nodes and only count those that are valid IR nodes used in
52198 : // the AST (i.e. allocated IR nodes).
52199 0 : for (unsigned j=0; j < SgUpirNestedParentField::pool_size; j++)
52200 : {
52201 : // This is indexing the STL vector of C/C++ style arrays as a doubly
52202 : // indexed array access. It is OK since we have leveraged the semantics
52203 : // of STL vector memory as contigous and cast the memory as an array
52204 : // of arrays to use the 2D array indexing. Hope this is not confusing,
52205 : // but it s very fast as an implementation.
52206 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
52207 : {
52208 0 : count++;
52209 : }
52210 : }
52211 : }
52212 : }
52213 :
52214 :
52215 :
52216 4 : return count;
52217 : }
52218 :
52219 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
52220 : // using values that overflow signed values of int.
52221 : size_t
52222 0 : SgUpirNestedParentField::memoryUsage()
52223 : {
52224 : // This function is required because we need the class name as a type when we call sizeof
52225 : // There might be another way to implement this if we have a traversal that only called a
52226 : // representative object (one call for each type of Sage IIIIR node).
52227 0 : size_t memory = numberOfNodes() * sizeof(SgUpirNestedParentField);
52228 :
52229 0 : return memory;
52230 : }
52231 :
52232 : /* #line 52233 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
52233 :
52234 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
52235 : void
52236 5342 : SgUpirNestedChildField::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
52237 : {
52238 : // This function traverses the memory pool for only a specific IR node
52239 : // and calls the visit function of the input class execute a traversal
52240 : // similar to the style of the attribute based traversals within ROSE.
52241 : // This traversal will visit ALL nodes of the AST where as the other
52242 : // attribute based traversals visit only the embedded tree within the AST.
52243 :
52244 : // Initialize array to the address of the first element of the STL vector
52245 : // (which is guaranteed to be contiguous storage).
52246 : // SgUpirNestedChildField objectArray [] = *(Memory_Block_List.begin());
52247 5342 : if (SgUpirNestedChildField::pools.empty() == false)
52248 : {
52249 : // Generate an array of memory pools
52250 0 : SgUpirNestedChildField** objectArray = (SgUpirNestedChildField**) &(SgUpirNestedChildField::pools[0]);
52251 :
52252 : // Build a local variable for better performance
52253 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
52254 : #if 0
52255 : // Iterate over the memory pools
52256 : for (unsigned int i=0; i < SgUpirNestedChildField::pools.size(); i++)
52257 : {
52258 : // objectArray[i] is a single memory pool
52259 : for (int j=0; j < SgUpirNestedChildField::pool_size; j++)
52260 : {
52261 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
52262 : {
52263 : traversal.visit(&(objectArray[i][j]));
52264 : }
52265 : }
52266 : }
52267 : #else
52268 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
52269 : // compute the list first and then call the visit function on each list element.
52270 :
52271 : // printf ("Inside of SgUpirNestedChildField::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
52272 :
52273 0 : std::vector<SgUpirNestedChildField*> nodeList;
52274 :
52275 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
52276 0 : for (unsigned int i=0; i < SgUpirNestedChildField::pools.size(); i++)
52277 : {
52278 : // objectArray[i] is a single memory pool
52279 0 : for (unsigned j=0; j < SgUpirNestedChildField::pool_size; j++)
52280 : {
52281 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
52282 : {
52283 0 : nodeList.push_back(&(objectArray[i][j]));
52284 : }
52285 : }
52286 : }
52287 :
52288 : // Iterate over the saved list
52289 0 : size_t nodeListSize = nodeList.size();
52290 0 : for (size_t i=0; i < nodeListSize; i++)
52291 : {
52292 0 : ROSE_ASSERT(nodeList[i] != NULL);
52293 : #if 0
52294 : traversal.visit(nodeList[i]);
52295 : #else
52296 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
52297 : {
52298 0 : traversal.visit(nodeList[i]);
52299 : }
52300 : #endif
52301 : }
52302 : #endif
52303 : }
52304 :
52305 : // This should not be required since all previously static data members are
52306 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
52307 :
52308 5342 : }
52309 :
52310 :
52311 : void
52312 194 : SgUpirNestedChildField::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
52313 : {
52314 : // This function traverses the memory pool for an IR node and
52315 : // calls the function to execute the visitor object.
52316 :
52317 : // Initialize array to the address of the first element of the STL vector
52318 : // (which is guarenteed to be contiguous storage).
52319 : // SgUpirNestedChildField objectArray [] = *(Memory_Block_List.begin());
52320 194 : if (SgUpirNestedChildField::pools.empty() == false)
52321 : {
52322 : // Generate an array of memory pools
52323 0 : SgUpirNestedChildField** objectArray = (SgUpirNestedChildField**) &(SgUpirNestedChildField::pools[0]);
52324 :
52325 : // Build a local variable for better performance
52326 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
52327 :
52328 : // Iterate over the memory pools
52329 0 : for (unsigned int i=0; i < SgUpirNestedChildField::pools.size(); i++)
52330 : {
52331 : // objectArray[i] is a single memory pool
52332 0 : for (unsigned j=0; j < SgUpirNestedChildField::pool_size; j++)
52333 : {
52334 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
52335 : {
52336 : // printf ("Found a valid SgUpirNestedChildField object in the memory pool %d at position %d \n",i,j);
52337 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
52338 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
52339 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
52340 : }
52341 : else
52342 : {
52343 : // printf ("Found a INVALID SgUpirNestedChildField object in the memory pool \n");
52344 : }
52345 : }
52346 : }
52347 : }
52348 :
52349 : // This should not be required since all previously static data members are
52350 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
52351 :
52352 194 : }
52353 :
52354 : void
52355 0 : SgUpirNestedChildField::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
52356 : {
52357 : // This function visits only a single IR node of the memory pool.
52358 : // it is typically called once for each type of IR node within
52359 : // the automatically generated function: traverseRepresentativeNodes().
52360 :
52361 : // Initialize array to the address of the first element of the STL vector
52362 : // (which is guarenteed to be contiguous storage).
52363 : // SgUpirNestedChildField objectArray [] = *(Memory_Block_List.begin());
52364 0 : if (SgUpirNestedChildField::pools.empty() == false)
52365 : {
52366 : // Generate an array of memory pools
52367 0 : SgUpirNestedChildField** objectArray = (SgUpirNestedChildField**) &(SgUpirNestedChildField::pools[0]);
52368 :
52369 : // Build a local variable for better performance
52370 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
52371 :
52372 : // Iterate over the memory pools
52373 0 : bool done = false;
52374 0 : unsigned i=0;
52375 :
52376 : // find the first valid IR node, call visit function, and then leave
52377 0 : while ( done == false && i < SgUpirNestedChildField::pools.size() )
52378 : {
52379 : // objectArray[i] is a single memory pool
52380 : unsigned j=0;
52381 0 : while (done == false && j < SgUpirNestedChildField::pool_size)
52382 : {
52383 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
52384 : {
52385 0 : traversal.visit(&(objectArray[i][j]));
52386 0 : done = true;
52387 : }
52388 0 : j++;
52389 : }
52390 0 : i++;
52391 : }
52392 :
52393 : #if 0
52394 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
52395 : if (done == false)
52396 : {
52397 : printf ("No representative for SgUpirNestedChildField found in memory pools \n");
52398 : }
52399 : #endif
52400 : }
52401 0 : }
52402 :
52403 :
52404 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
52405 : // using values that overflow signed values of int.
52406 : size_t
52407 4 : SgUpirNestedChildField::numberOfNodes()
52408 : {
52409 : // This function traverses the memory pool for an IR node and
52410 : // counts the number of IR nodes of a particular Sage III IR
52411 : // nodes type.
52412 :
52413 4 : size_t count = 0;
52414 4 : if (SgUpirNestedChildField::pools.empty() == false)
52415 : {
52416 : // Generate an array of memory pools (this is actually a STL vector,
52417 : // but it is contiguious, so OK to treat this way).
52418 0 : SgUpirNestedChildField** objectArray = (SgUpirNestedChildField**) &(SgUpirNestedChildField::pools[0]);
52419 :
52420 : // Build a local variable for better performance (make it a loop invariant variable).
52421 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
52422 :
52423 : // Iterate over all of the memory pools for this IR node.
52424 0 : for (unsigned int i=0; i < SgUpirNestedChildField::pools.size(); i++)
52425 : {
52426 : // objectArray[i] is a single memory pool, iterate over all the
52427 : // IR nodes and only count those that are valid IR nodes used in
52428 : // the AST (i.e. allocated IR nodes).
52429 0 : for (unsigned j=0; j < SgUpirNestedChildField::pool_size; j++)
52430 : {
52431 : // This is indexing the STL vector of C/C++ style arrays as a doubly
52432 : // indexed array access. It is OK since we have leveraged the semantics
52433 : // of STL vector memory as contigous and cast the memory as an array
52434 : // of arrays to use the 2D array indexing. Hope this is not confusing,
52435 : // but it s very fast as an implementation.
52436 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
52437 : {
52438 0 : count++;
52439 : }
52440 : }
52441 : }
52442 : }
52443 :
52444 :
52445 :
52446 4 : return count;
52447 : }
52448 :
52449 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
52450 : // using values that overflow signed values of int.
52451 : size_t
52452 0 : SgUpirNestedChildField::memoryUsage()
52453 : {
52454 : // This function is required because we need the class name as a type when we call sizeof
52455 : // There might be another way to implement this if we have a traversal that only called a
52456 : // representative object (one call for each type of Sage IIIIR node).
52457 0 : size_t memory = numberOfNodes() * sizeof(SgUpirNestedChildField);
52458 :
52459 0 : return memory;
52460 : }
52461 :
52462 : /* #line 52463 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
52463 :
52464 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
52465 : void
52466 5342 : SgUpirSyncField::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
52467 : {
52468 : // This function traverses the memory pool for only a specific IR node
52469 : // and calls the visit function of the input class execute a traversal
52470 : // similar to the style of the attribute based traversals within ROSE.
52471 : // This traversal will visit ALL nodes of the AST where as the other
52472 : // attribute based traversals visit only the embedded tree within the AST.
52473 :
52474 : // Initialize array to the address of the first element of the STL vector
52475 : // (which is guaranteed to be contiguous storage).
52476 : // SgUpirSyncField objectArray [] = *(Memory_Block_List.begin());
52477 5342 : if (SgUpirSyncField::pools.empty() == false)
52478 : {
52479 : // Generate an array of memory pools
52480 0 : SgUpirSyncField** objectArray = (SgUpirSyncField**) &(SgUpirSyncField::pools[0]);
52481 :
52482 : // Build a local variable for better performance
52483 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
52484 : #if 0
52485 : // Iterate over the memory pools
52486 : for (unsigned int i=0; i < SgUpirSyncField::pools.size(); i++)
52487 : {
52488 : // objectArray[i] is a single memory pool
52489 : for (int j=0; j < SgUpirSyncField::pool_size; j++)
52490 : {
52491 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
52492 : {
52493 : traversal.visit(&(objectArray[i][j]));
52494 : }
52495 : }
52496 : }
52497 : #else
52498 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
52499 : // compute the list first and then call the visit function on each list element.
52500 :
52501 : // printf ("Inside of SgUpirSyncField::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
52502 :
52503 0 : std::vector<SgUpirSyncField*> nodeList;
52504 :
52505 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
52506 0 : for (unsigned int i=0; i < SgUpirSyncField::pools.size(); i++)
52507 : {
52508 : // objectArray[i] is a single memory pool
52509 0 : for (unsigned j=0; j < SgUpirSyncField::pool_size; j++)
52510 : {
52511 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
52512 : {
52513 0 : nodeList.push_back(&(objectArray[i][j]));
52514 : }
52515 : }
52516 : }
52517 :
52518 : // Iterate over the saved list
52519 0 : size_t nodeListSize = nodeList.size();
52520 0 : for (size_t i=0; i < nodeListSize; i++)
52521 : {
52522 0 : ROSE_ASSERT(nodeList[i] != NULL);
52523 : #if 0
52524 : traversal.visit(nodeList[i]);
52525 : #else
52526 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
52527 : {
52528 0 : traversal.visit(nodeList[i]);
52529 : }
52530 : #endif
52531 : }
52532 : #endif
52533 : }
52534 :
52535 : // This should not be required since all previously static data members are
52536 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
52537 :
52538 5342 : }
52539 :
52540 :
52541 : void
52542 194 : SgUpirSyncField::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
52543 : {
52544 : // This function traverses the memory pool for an IR node and
52545 : // calls the function to execute the visitor object.
52546 :
52547 : // Initialize array to the address of the first element of the STL vector
52548 : // (which is guarenteed to be contiguous storage).
52549 : // SgUpirSyncField objectArray [] = *(Memory_Block_List.begin());
52550 194 : if (SgUpirSyncField::pools.empty() == false)
52551 : {
52552 : // Generate an array of memory pools
52553 0 : SgUpirSyncField** objectArray = (SgUpirSyncField**) &(SgUpirSyncField::pools[0]);
52554 :
52555 : // Build a local variable for better performance
52556 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
52557 :
52558 : // Iterate over the memory pools
52559 0 : for (unsigned int i=0; i < SgUpirSyncField::pools.size(); i++)
52560 : {
52561 : // objectArray[i] is a single memory pool
52562 0 : for (unsigned j=0; j < SgUpirSyncField::pool_size; j++)
52563 : {
52564 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
52565 : {
52566 : // printf ("Found a valid SgUpirSyncField object in the memory pool %d at position %d \n",i,j);
52567 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
52568 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
52569 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
52570 : }
52571 : else
52572 : {
52573 : // printf ("Found a INVALID SgUpirSyncField object in the memory pool \n");
52574 : }
52575 : }
52576 : }
52577 : }
52578 :
52579 : // This should not be required since all previously static data members are
52580 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
52581 :
52582 194 : }
52583 :
52584 : void
52585 0 : SgUpirSyncField::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
52586 : {
52587 : // This function visits only a single IR node of the memory pool.
52588 : // it is typically called once for each type of IR node within
52589 : // the automatically generated function: traverseRepresentativeNodes().
52590 :
52591 : // Initialize array to the address of the first element of the STL vector
52592 : // (which is guarenteed to be contiguous storage).
52593 : // SgUpirSyncField objectArray [] = *(Memory_Block_List.begin());
52594 0 : if (SgUpirSyncField::pools.empty() == false)
52595 : {
52596 : // Generate an array of memory pools
52597 0 : SgUpirSyncField** objectArray = (SgUpirSyncField**) &(SgUpirSyncField::pools[0]);
52598 :
52599 : // Build a local variable for better performance
52600 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
52601 :
52602 : // Iterate over the memory pools
52603 0 : bool done = false;
52604 0 : unsigned i=0;
52605 :
52606 : // find the first valid IR node, call visit function, and then leave
52607 0 : while ( done == false && i < SgUpirSyncField::pools.size() )
52608 : {
52609 : // objectArray[i] is a single memory pool
52610 : unsigned j=0;
52611 0 : while (done == false && j < SgUpirSyncField::pool_size)
52612 : {
52613 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
52614 : {
52615 0 : traversal.visit(&(objectArray[i][j]));
52616 0 : done = true;
52617 : }
52618 0 : j++;
52619 : }
52620 0 : i++;
52621 : }
52622 :
52623 : #if 0
52624 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
52625 : if (done == false)
52626 : {
52627 : printf ("No representative for SgUpirSyncField found in memory pools \n");
52628 : }
52629 : #endif
52630 : }
52631 0 : }
52632 :
52633 :
52634 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
52635 : // using values that overflow signed values of int.
52636 : size_t
52637 4 : SgUpirSyncField::numberOfNodes()
52638 : {
52639 : // This function traverses the memory pool for an IR node and
52640 : // counts the number of IR nodes of a particular Sage III IR
52641 : // nodes type.
52642 :
52643 4 : size_t count = 0;
52644 4 : if (SgUpirSyncField::pools.empty() == false)
52645 : {
52646 : // Generate an array of memory pools (this is actually a STL vector,
52647 : // but it is contiguious, so OK to treat this way).
52648 0 : SgUpirSyncField** objectArray = (SgUpirSyncField**) &(SgUpirSyncField::pools[0]);
52649 :
52650 : // Build a local variable for better performance (make it a loop invariant variable).
52651 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
52652 :
52653 : // Iterate over all of the memory pools for this IR node.
52654 0 : for (unsigned int i=0; i < SgUpirSyncField::pools.size(); i++)
52655 : {
52656 : // objectArray[i] is a single memory pool, iterate over all the
52657 : // IR nodes and only count those that are valid IR nodes used in
52658 : // the AST (i.e. allocated IR nodes).
52659 0 : for (unsigned j=0; j < SgUpirSyncField::pool_size; j++)
52660 : {
52661 : // This is indexing the STL vector of C/C++ style arrays as a doubly
52662 : // indexed array access. It is OK since we have leveraged the semantics
52663 : // of STL vector memory as contigous and cast the memory as an array
52664 : // of arrays to use the 2D array indexing. Hope this is not confusing,
52665 : // but it s very fast as an implementation.
52666 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
52667 : {
52668 0 : count++;
52669 : }
52670 : }
52671 : }
52672 : }
52673 :
52674 :
52675 :
52676 4 : return count;
52677 : }
52678 :
52679 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
52680 : // using values that overflow signed values of int.
52681 : size_t
52682 0 : SgUpirSyncField::memoryUsage()
52683 : {
52684 : // This function is required because we need the class name as a type when we call sizeof
52685 : // There might be another way to implement this if we have a traversal that only called a
52686 : // representative object (one call for each type of Sage IIIIR node).
52687 0 : size_t memory = numberOfNodes() * sizeof(SgUpirSyncField);
52688 :
52689 0 : return memory;
52690 : }
52691 :
52692 : /* #line 52693 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
52693 :
52694 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
52695 : void
52696 5342 : SgUpirDataField::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
52697 : {
52698 : // This function traverses the memory pool for only a specific IR node
52699 : // and calls the visit function of the input class execute a traversal
52700 : // similar to the style of the attribute based traversals within ROSE.
52701 : // This traversal will visit ALL nodes of the AST where as the other
52702 : // attribute based traversals visit only the embedded tree within the AST.
52703 :
52704 : // Initialize array to the address of the first element of the STL vector
52705 : // (which is guaranteed to be contiguous storage).
52706 : // SgUpirDataField objectArray [] = *(Memory_Block_List.begin());
52707 5342 : if (SgUpirDataField::pools.empty() == false)
52708 : {
52709 : // Generate an array of memory pools
52710 0 : SgUpirDataField** objectArray = (SgUpirDataField**) &(SgUpirDataField::pools[0]);
52711 :
52712 : // Build a local variable for better performance
52713 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
52714 : #if 0
52715 : // Iterate over the memory pools
52716 : for (unsigned int i=0; i < SgUpirDataField::pools.size(); i++)
52717 : {
52718 : // objectArray[i] is a single memory pool
52719 : for (int j=0; j < SgUpirDataField::pool_size; j++)
52720 : {
52721 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
52722 : {
52723 : traversal.visit(&(objectArray[i][j]));
52724 : }
52725 : }
52726 : }
52727 : #else
52728 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
52729 : // compute the list first and then call the visit function on each list element.
52730 :
52731 : // printf ("Inside of SgUpirDataField::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
52732 :
52733 0 : std::vector<SgUpirDataField*> nodeList;
52734 :
52735 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
52736 0 : for (unsigned int i=0; i < SgUpirDataField::pools.size(); i++)
52737 : {
52738 : // objectArray[i] is a single memory pool
52739 0 : for (unsigned j=0; j < SgUpirDataField::pool_size; j++)
52740 : {
52741 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
52742 : {
52743 0 : nodeList.push_back(&(objectArray[i][j]));
52744 : }
52745 : }
52746 : }
52747 :
52748 : // Iterate over the saved list
52749 0 : size_t nodeListSize = nodeList.size();
52750 0 : for (size_t i=0; i < nodeListSize; i++)
52751 : {
52752 0 : ROSE_ASSERT(nodeList[i] != NULL);
52753 : #if 0
52754 : traversal.visit(nodeList[i]);
52755 : #else
52756 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
52757 : {
52758 0 : traversal.visit(nodeList[i]);
52759 : }
52760 : #endif
52761 : }
52762 : #endif
52763 : }
52764 :
52765 : // This should not be required since all previously static data members are
52766 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
52767 :
52768 5342 : }
52769 :
52770 :
52771 : void
52772 194 : SgUpirDataField::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
52773 : {
52774 : // This function traverses the memory pool for an IR node and
52775 : // calls the function to execute the visitor object.
52776 :
52777 : // Initialize array to the address of the first element of the STL vector
52778 : // (which is guarenteed to be contiguous storage).
52779 : // SgUpirDataField objectArray [] = *(Memory_Block_List.begin());
52780 194 : if (SgUpirDataField::pools.empty() == false)
52781 : {
52782 : // Generate an array of memory pools
52783 0 : SgUpirDataField** objectArray = (SgUpirDataField**) &(SgUpirDataField::pools[0]);
52784 :
52785 : // Build a local variable for better performance
52786 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
52787 :
52788 : // Iterate over the memory pools
52789 0 : for (unsigned int i=0; i < SgUpirDataField::pools.size(); i++)
52790 : {
52791 : // objectArray[i] is a single memory pool
52792 0 : for (unsigned j=0; j < SgUpirDataField::pool_size; j++)
52793 : {
52794 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
52795 : {
52796 : // printf ("Found a valid SgUpirDataField object in the memory pool %d at position %d \n",i,j);
52797 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
52798 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
52799 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
52800 : }
52801 : else
52802 : {
52803 : // printf ("Found a INVALID SgUpirDataField object in the memory pool \n");
52804 : }
52805 : }
52806 : }
52807 : }
52808 :
52809 : // This should not be required since all previously static data members are
52810 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
52811 :
52812 194 : }
52813 :
52814 : void
52815 0 : SgUpirDataField::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
52816 : {
52817 : // This function visits only a single IR node of the memory pool.
52818 : // it is typically called once for each type of IR node within
52819 : // the automatically generated function: traverseRepresentativeNodes().
52820 :
52821 : // Initialize array to the address of the first element of the STL vector
52822 : // (which is guarenteed to be contiguous storage).
52823 : // SgUpirDataField objectArray [] = *(Memory_Block_List.begin());
52824 0 : if (SgUpirDataField::pools.empty() == false)
52825 : {
52826 : // Generate an array of memory pools
52827 0 : SgUpirDataField** objectArray = (SgUpirDataField**) &(SgUpirDataField::pools[0]);
52828 :
52829 : // Build a local variable for better performance
52830 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
52831 :
52832 : // Iterate over the memory pools
52833 0 : bool done = false;
52834 0 : unsigned i=0;
52835 :
52836 : // find the first valid IR node, call visit function, and then leave
52837 0 : while ( done == false && i < SgUpirDataField::pools.size() )
52838 : {
52839 : // objectArray[i] is a single memory pool
52840 : unsigned j=0;
52841 0 : while (done == false && j < SgUpirDataField::pool_size)
52842 : {
52843 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
52844 : {
52845 0 : traversal.visit(&(objectArray[i][j]));
52846 0 : done = true;
52847 : }
52848 0 : j++;
52849 : }
52850 0 : i++;
52851 : }
52852 :
52853 : #if 0
52854 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
52855 : if (done == false)
52856 : {
52857 : printf ("No representative for SgUpirDataField found in memory pools \n");
52858 : }
52859 : #endif
52860 : }
52861 0 : }
52862 :
52863 :
52864 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
52865 : // using values that overflow signed values of int.
52866 : size_t
52867 4 : SgUpirDataField::numberOfNodes()
52868 : {
52869 : // This function traverses the memory pool for an IR node and
52870 : // counts the number of IR nodes of a particular Sage III IR
52871 : // nodes type.
52872 :
52873 4 : size_t count = 0;
52874 4 : if (SgUpirDataField::pools.empty() == false)
52875 : {
52876 : // Generate an array of memory pools (this is actually a STL vector,
52877 : // but it is contiguious, so OK to treat this way).
52878 0 : SgUpirDataField** objectArray = (SgUpirDataField**) &(SgUpirDataField::pools[0]);
52879 :
52880 : // Build a local variable for better performance (make it a loop invariant variable).
52881 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
52882 :
52883 : // Iterate over all of the memory pools for this IR node.
52884 0 : for (unsigned int i=0; i < SgUpirDataField::pools.size(); i++)
52885 : {
52886 : // objectArray[i] is a single memory pool, iterate over all the
52887 : // IR nodes and only count those that are valid IR nodes used in
52888 : // the AST (i.e. allocated IR nodes).
52889 0 : for (unsigned j=0; j < SgUpirDataField::pool_size; j++)
52890 : {
52891 : // This is indexing the STL vector of C/C++ style arrays as a doubly
52892 : // indexed array access. It is OK since we have leveraged the semantics
52893 : // of STL vector memory as contigous and cast the memory as an array
52894 : // of arrays to use the 2D array indexing. Hope this is not confusing,
52895 : // but it s very fast as an implementation.
52896 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
52897 : {
52898 0 : count++;
52899 : }
52900 : }
52901 : }
52902 : }
52903 :
52904 :
52905 :
52906 4 : return count;
52907 : }
52908 :
52909 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
52910 : // using values that overflow signed values of int.
52911 : size_t
52912 0 : SgUpirDataField::memoryUsage()
52913 : {
52914 : // This function is required because we need the class name as a type when we call sizeof
52915 : // There might be another way to implement this if we have a traversal that only called a
52916 : // representative object (one call for each type of Sage IIIIR node).
52917 0 : size_t memory = numberOfNodes() * sizeof(SgUpirDataField);
52918 :
52919 0 : return memory;
52920 : }
52921 :
52922 : /* #line 52923 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
52923 :
52924 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
52925 : void
52926 5342 : SgUpirTargetField::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
52927 : {
52928 : // This function traverses the memory pool for only a specific IR node
52929 : // and calls the visit function of the input class execute a traversal
52930 : // similar to the style of the attribute based traversals within ROSE.
52931 : // This traversal will visit ALL nodes of the AST where as the other
52932 : // attribute based traversals visit only the embedded tree within the AST.
52933 :
52934 : // Initialize array to the address of the first element of the STL vector
52935 : // (which is guaranteed to be contiguous storage).
52936 : // SgUpirTargetField objectArray [] = *(Memory_Block_List.begin());
52937 5342 : if (SgUpirTargetField::pools.empty() == false)
52938 : {
52939 : // Generate an array of memory pools
52940 0 : SgUpirTargetField** objectArray = (SgUpirTargetField**) &(SgUpirTargetField::pools[0]);
52941 :
52942 : // Build a local variable for better performance
52943 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
52944 : #if 0
52945 : // Iterate over the memory pools
52946 : for (unsigned int i=0; i < SgUpirTargetField::pools.size(); i++)
52947 : {
52948 : // objectArray[i] is a single memory pool
52949 : for (int j=0; j < SgUpirTargetField::pool_size; j++)
52950 : {
52951 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
52952 : {
52953 : traversal.visit(&(objectArray[i][j]));
52954 : }
52955 : }
52956 : }
52957 : #else
52958 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
52959 : // compute the list first and then call the visit function on each list element.
52960 :
52961 : // printf ("Inside of SgUpirTargetField::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
52962 :
52963 0 : std::vector<SgUpirTargetField*> nodeList;
52964 :
52965 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
52966 0 : for (unsigned int i=0; i < SgUpirTargetField::pools.size(); i++)
52967 : {
52968 : // objectArray[i] is a single memory pool
52969 0 : for (unsigned j=0; j < SgUpirTargetField::pool_size; j++)
52970 : {
52971 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
52972 : {
52973 0 : nodeList.push_back(&(objectArray[i][j]));
52974 : }
52975 : }
52976 : }
52977 :
52978 : // Iterate over the saved list
52979 0 : size_t nodeListSize = nodeList.size();
52980 0 : for (size_t i=0; i < nodeListSize; i++)
52981 : {
52982 0 : ROSE_ASSERT(nodeList[i] != NULL);
52983 : #if 0
52984 : traversal.visit(nodeList[i]);
52985 : #else
52986 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
52987 : {
52988 0 : traversal.visit(nodeList[i]);
52989 : }
52990 : #endif
52991 : }
52992 : #endif
52993 : }
52994 :
52995 : // This should not be required since all previously static data members are
52996 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
52997 :
52998 5342 : }
52999 :
53000 :
53001 : void
53002 194 : SgUpirTargetField::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
53003 : {
53004 : // This function traverses the memory pool for an IR node and
53005 : // calls the function to execute the visitor object.
53006 :
53007 : // Initialize array to the address of the first element of the STL vector
53008 : // (which is guarenteed to be contiguous storage).
53009 : // SgUpirTargetField objectArray [] = *(Memory_Block_List.begin());
53010 194 : if (SgUpirTargetField::pools.empty() == false)
53011 : {
53012 : // Generate an array of memory pools
53013 0 : SgUpirTargetField** objectArray = (SgUpirTargetField**) &(SgUpirTargetField::pools[0]);
53014 :
53015 : // Build a local variable for better performance
53016 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
53017 :
53018 : // Iterate over the memory pools
53019 0 : for (unsigned int i=0; i < SgUpirTargetField::pools.size(); i++)
53020 : {
53021 : // objectArray[i] is a single memory pool
53022 0 : for (unsigned j=0; j < SgUpirTargetField::pool_size; j++)
53023 : {
53024 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
53025 : {
53026 : // printf ("Found a valid SgUpirTargetField object in the memory pool %d at position %d \n",i,j);
53027 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
53028 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
53029 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
53030 : }
53031 : else
53032 : {
53033 : // printf ("Found a INVALID SgUpirTargetField object in the memory pool \n");
53034 : }
53035 : }
53036 : }
53037 : }
53038 :
53039 : // This should not be required since all previously static data members are
53040 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
53041 :
53042 194 : }
53043 :
53044 : void
53045 0 : SgUpirTargetField::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
53046 : {
53047 : // This function visits only a single IR node of the memory pool.
53048 : // it is typically called once for each type of IR node within
53049 : // the automatically generated function: traverseRepresentativeNodes().
53050 :
53051 : // Initialize array to the address of the first element of the STL vector
53052 : // (which is guarenteed to be contiguous storage).
53053 : // SgUpirTargetField objectArray [] = *(Memory_Block_List.begin());
53054 0 : if (SgUpirTargetField::pools.empty() == false)
53055 : {
53056 : // Generate an array of memory pools
53057 0 : SgUpirTargetField** objectArray = (SgUpirTargetField**) &(SgUpirTargetField::pools[0]);
53058 :
53059 : // Build a local variable for better performance
53060 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
53061 :
53062 : // Iterate over the memory pools
53063 0 : bool done = false;
53064 0 : unsigned i=0;
53065 :
53066 : // find the first valid IR node, call visit function, and then leave
53067 0 : while ( done == false && i < SgUpirTargetField::pools.size() )
53068 : {
53069 : // objectArray[i] is a single memory pool
53070 : unsigned j=0;
53071 0 : while (done == false && j < SgUpirTargetField::pool_size)
53072 : {
53073 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
53074 : {
53075 0 : traversal.visit(&(objectArray[i][j]));
53076 0 : done = true;
53077 : }
53078 0 : j++;
53079 : }
53080 0 : i++;
53081 : }
53082 :
53083 : #if 0
53084 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
53085 : if (done == false)
53086 : {
53087 : printf ("No representative for SgUpirTargetField found in memory pools \n");
53088 : }
53089 : #endif
53090 : }
53091 0 : }
53092 :
53093 :
53094 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
53095 : // using values that overflow signed values of int.
53096 : size_t
53097 4 : SgUpirTargetField::numberOfNodes()
53098 : {
53099 : // This function traverses the memory pool for an IR node and
53100 : // counts the number of IR nodes of a particular Sage III IR
53101 : // nodes type.
53102 :
53103 4 : size_t count = 0;
53104 4 : if (SgUpirTargetField::pools.empty() == false)
53105 : {
53106 : // Generate an array of memory pools (this is actually a STL vector,
53107 : // but it is contiguious, so OK to treat this way).
53108 0 : SgUpirTargetField** objectArray = (SgUpirTargetField**) &(SgUpirTargetField::pools[0]);
53109 :
53110 : // Build a local variable for better performance (make it a loop invariant variable).
53111 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
53112 :
53113 : // Iterate over all of the memory pools for this IR node.
53114 0 : for (unsigned int i=0; i < SgUpirTargetField::pools.size(); i++)
53115 : {
53116 : // objectArray[i] is a single memory pool, iterate over all the
53117 : // IR nodes and only count those that are valid IR nodes used in
53118 : // the AST (i.e. allocated IR nodes).
53119 0 : for (unsigned j=0; j < SgUpirTargetField::pool_size; j++)
53120 : {
53121 : // This is indexing the STL vector of C/C++ style arrays as a doubly
53122 : // indexed array access. It is OK since we have leveraged the semantics
53123 : // of STL vector memory as contigous and cast the memory as an array
53124 : // of arrays to use the 2D array indexing. Hope this is not confusing,
53125 : // but it s very fast as an implementation.
53126 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
53127 : {
53128 0 : count++;
53129 : }
53130 : }
53131 : }
53132 : }
53133 :
53134 :
53135 :
53136 4 : return count;
53137 : }
53138 :
53139 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
53140 : // using values that overflow signed values of int.
53141 : size_t
53142 0 : SgUpirTargetField::memoryUsage()
53143 : {
53144 : // This function is required because we need the class name as a type when we call sizeof
53145 : // There might be another way to implement this if we have a traversal that only called a
53146 : // representative object (one call for each type of Sage IIIIR node).
53147 0 : size_t memory = numberOfNodes() * sizeof(SgUpirTargetField);
53148 :
53149 0 : return memory;
53150 : }
53151 :
53152 : /* #line 53153 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
53153 :
53154 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
53155 : void
53156 5342 : SgUpirDataItemField::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
53157 : {
53158 : // This function traverses the memory pool for only a specific IR node
53159 : // and calls the visit function of the input class execute a traversal
53160 : // similar to the style of the attribute based traversals within ROSE.
53161 : // This traversal will visit ALL nodes of the AST where as the other
53162 : // attribute based traversals visit only the embedded tree within the AST.
53163 :
53164 : // Initialize array to the address of the first element of the STL vector
53165 : // (which is guaranteed to be contiguous storage).
53166 : // SgUpirDataItemField objectArray [] = *(Memory_Block_List.begin());
53167 5342 : if (SgUpirDataItemField::pools.empty() == false)
53168 : {
53169 : // Generate an array of memory pools
53170 0 : SgUpirDataItemField** objectArray = (SgUpirDataItemField**) &(SgUpirDataItemField::pools[0]);
53171 :
53172 : // Build a local variable for better performance
53173 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
53174 : #if 0
53175 : // Iterate over the memory pools
53176 : for (unsigned int i=0; i < SgUpirDataItemField::pools.size(); i++)
53177 : {
53178 : // objectArray[i] is a single memory pool
53179 : for (int j=0; j < SgUpirDataItemField::pool_size; j++)
53180 : {
53181 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
53182 : {
53183 : traversal.visit(&(objectArray[i][j]));
53184 : }
53185 : }
53186 : }
53187 : #else
53188 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
53189 : // compute the list first and then call the visit function on each list element.
53190 :
53191 : // printf ("Inside of SgUpirDataItemField::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
53192 :
53193 0 : std::vector<SgUpirDataItemField*> nodeList;
53194 :
53195 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
53196 0 : for (unsigned int i=0; i < SgUpirDataItemField::pools.size(); i++)
53197 : {
53198 : // objectArray[i] is a single memory pool
53199 0 : for (unsigned j=0; j < SgUpirDataItemField::pool_size; j++)
53200 : {
53201 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
53202 : {
53203 0 : nodeList.push_back(&(objectArray[i][j]));
53204 : }
53205 : }
53206 : }
53207 :
53208 : // Iterate over the saved list
53209 0 : size_t nodeListSize = nodeList.size();
53210 0 : for (size_t i=0; i < nodeListSize; i++)
53211 : {
53212 0 : ROSE_ASSERT(nodeList[i] != NULL);
53213 : #if 0
53214 : traversal.visit(nodeList[i]);
53215 : #else
53216 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
53217 : {
53218 0 : traversal.visit(nodeList[i]);
53219 : }
53220 : #endif
53221 : }
53222 : #endif
53223 : }
53224 :
53225 : // This should not be required since all previously static data members are
53226 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
53227 :
53228 5342 : }
53229 :
53230 :
53231 : void
53232 194 : SgUpirDataItemField::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
53233 : {
53234 : // This function traverses the memory pool for an IR node and
53235 : // calls the function to execute the visitor object.
53236 :
53237 : // Initialize array to the address of the first element of the STL vector
53238 : // (which is guarenteed to be contiguous storage).
53239 : // SgUpirDataItemField objectArray [] = *(Memory_Block_List.begin());
53240 194 : if (SgUpirDataItemField::pools.empty() == false)
53241 : {
53242 : // Generate an array of memory pools
53243 0 : SgUpirDataItemField** objectArray = (SgUpirDataItemField**) &(SgUpirDataItemField::pools[0]);
53244 :
53245 : // Build a local variable for better performance
53246 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
53247 :
53248 : // Iterate over the memory pools
53249 0 : for (unsigned int i=0; i < SgUpirDataItemField::pools.size(); i++)
53250 : {
53251 : // objectArray[i] is a single memory pool
53252 0 : for (unsigned j=0; j < SgUpirDataItemField::pool_size; j++)
53253 : {
53254 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
53255 : {
53256 : // printf ("Found a valid SgUpirDataItemField object in the memory pool %d at position %d \n",i,j);
53257 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
53258 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
53259 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
53260 : }
53261 : else
53262 : {
53263 : // printf ("Found a INVALID SgUpirDataItemField object in the memory pool \n");
53264 : }
53265 : }
53266 : }
53267 : }
53268 :
53269 : // This should not be required since all previously static data members are
53270 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
53271 :
53272 194 : }
53273 :
53274 : void
53275 0 : SgUpirDataItemField::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
53276 : {
53277 : // This function visits only a single IR node of the memory pool.
53278 : // it is typically called once for each type of IR node within
53279 : // the automatically generated function: traverseRepresentativeNodes().
53280 :
53281 : // Initialize array to the address of the first element of the STL vector
53282 : // (which is guarenteed to be contiguous storage).
53283 : // SgUpirDataItemField objectArray [] = *(Memory_Block_List.begin());
53284 0 : if (SgUpirDataItemField::pools.empty() == false)
53285 : {
53286 : // Generate an array of memory pools
53287 0 : SgUpirDataItemField** objectArray = (SgUpirDataItemField**) &(SgUpirDataItemField::pools[0]);
53288 :
53289 : // Build a local variable for better performance
53290 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
53291 :
53292 : // Iterate over the memory pools
53293 0 : bool done = false;
53294 0 : unsigned i=0;
53295 :
53296 : // find the first valid IR node, call visit function, and then leave
53297 0 : while ( done == false && i < SgUpirDataItemField::pools.size() )
53298 : {
53299 : // objectArray[i] is a single memory pool
53300 : unsigned j=0;
53301 0 : while (done == false && j < SgUpirDataItemField::pool_size)
53302 : {
53303 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
53304 : {
53305 0 : traversal.visit(&(objectArray[i][j]));
53306 0 : done = true;
53307 : }
53308 0 : j++;
53309 : }
53310 0 : i++;
53311 : }
53312 :
53313 : #if 0
53314 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
53315 : if (done == false)
53316 : {
53317 : printf ("No representative for SgUpirDataItemField found in memory pools \n");
53318 : }
53319 : #endif
53320 : }
53321 0 : }
53322 :
53323 :
53324 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
53325 : // using values that overflow signed values of int.
53326 : size_t
53327 4 : SgUpirDataItemField::numberOfNodes()
53328 : {
53329 : // This function traverses the memory pool for an IR node and
53330 : // counts the number of IR nodes of a particular Sage III IR
53331 : // nodes type.
53332 :
53333 4 : size_t count = 0;
53334 4 : if (SgUpirDataItemField::pools.empty() == false)
53335 : {
53336 : // Generate an array of memory pools (this is actually a STL vector,
53337 : // but it is contiguious, so OK to treat this way).
53338 0 : SgUpirDataItemField** objectArray = (SgUpirDataItemField**) &(SgUpirDataItemField::pools[0]);
53339 :
53340 : // Build a local variable for better performance (make it a loop invariant variable).
53341 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
53342 :
53343 : // Iterate over all of the memory pools for this IR node.
53344 0 : for (unsigned int i=0; i < SgUpirDataItemField::pools.size(); i++)
53345 : {
53346 : // objectArray[i] is a single memory pool, iterate over all the
53347 : // IR nodes and only count those that are valid IR nodes used in
53348 : // the AST (i.e. allocated IR nodes).
53349 0 : for (unsigned j=0; j < SgUpirDataItemField::pool_size; j++)
53350 : {
53351 : // This is indexing the STL vector of C/C++ style arrays as a doubly
53352 : // indexed array access. It is OK since we have leveraged the semantics
53353 : // of STL vector memory as contigous and cast the memory as an array
53354 : // of arrays to use the 2D array indexing. Hope this is not confusing,
53355 : // but it s very fast as an implementation.
53356 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
53357 : {
53358 0 : count++;
53359 : }
53360 : }
53361 : }
53362 : }
53363 :
53364 :
53365 :
53366 4 : return count;
53367 : }
53368 :
53369 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
53370 : // using values that overflow signed values of int.
53371 : size_t
53372 0 : SgUpirDataItemField::memoryUsage()
53373 : {
53374 : // This function is required because we need the class name as a type when we call sizeof
53375 : // There might be another way to implement this if we have a traversal that only called a
53376 : // representative object (one call for each type of Sage IIIIR node).
53377 0 : size_t memory = numberOfNodes() * sizeof(SgUpirDataItemField);
53378 :
53379 0 : return memory;
53380 : }
53381 :
53382 : /* #line 53383 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
53383 :
53384 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
53385 : void
53386 5342 : SgLambdaCapture::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
53387 : {
53388 : // This function traverses the memory pool for only a specific IR node
53389 : // and calls the visit function of the input class execute a traversal
53390 : // similar to the style of the attribute based traversals within ROSE.
53391 : // This traversal will visit ALL nodes of the AST where as the other
53392 : // attribute based traversals visit only the embedded tree within the AST.
53393 :
53394 : // Initialize array to the address of the first element of the STL vector
53395 : // (which is guaranteed to be contiguous storage).
53396 : // SgLambdaCapture objectArray [] = *(Memory_Block_List.begin());
53397 5342 : if (SgLambdaCapture::pools.empty() == false)
53398 : {
53399 : // Generate an array of memory pools
53400 0 : SgLambdaCapture** objectArray = (SgLambdaCapture**) &(SgLambdaCapture::pools[0]);
53401 :
53402 : // Build a local variable for better performance
53403 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
53404 : #if 0
53405 : // Iterate over the memory pools
53406 : for (unsigned int i=0; i < SgLambdaCapture::pools.size(); i++)
53407 : {
53408 : // objectArray[i] is a single memory pool
53409 : for (int j=0; j < SgLambdaCapture::pool_size; j++)
53410 : {
53411 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
53412 : {
53413 : traversal.visit(&(objectArray[i][j]));
53414 : }
53415 : }
53416 : }
53417 : #else
53418 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
53419 : // compute the list first and then call the visit function on each list element.
53420 :
53421 : // printf ("Inside of SgLambdaCapture::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
53422 :
53423 0 : std::vector<SgLambdaCapture*> nodeList;
53424 :
53425 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
53426 0 : for (unsigned int i=0; i < SgLambdaCapture::pools.size(); i++)
53427 : {
53428 : // objectArray[i] is a single memory pool
53429 0 : for (unsigned j=0; j < SgLambdaCapture::pool_size; j++)
53430 : {
53431 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
53432 : {
53433 0 : nodeList.push_back(&(objectArray[i][j]));
53434 : }
53435 : }
53436 : }
53437 :
53438 : // Iterate over the saved list
53439 0 : size_t nodeListSize = nodeList.size();
53440 0 : for (size_t i=0; i < nodeListSize; i++)
53441 : {
53442 0 : ROSE_ASSERT(nodeList[i] != NULL);
53443 : #if 0
53444 : traversal.visit(nodeList[i]);
53445 : #else
53446 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
53447 : {
53448 0 : traversal.visit(nodeList[i]);
53449 : }
53450 : #endif
53451 : }
53452 : #endif
53453 : }
53454 :
53455 : // This should not be required since all previously static data members are
53456 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
53457 :
53458 5342 : }
53459 :
53460 :
53461 : void
53462 194 : SgLambdaCapture::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
53463 : {
53464 : // This function traverses the memory pool for an IR node and
53465 : // calls the function to execute the visitor object.
53466 :
53467 : // Initialize array to the address of the first element of the STL vector
53468 : // (which is guarenteed to be contiguous storage).
53469 : // SgLambdaCapture objectArray [] = *(Memory_Block_List.begin());
53470 194 : if (SgLambdaCapture::pools.empty() == false)
53471 : {
53472 : // Generate an array of memory pools
53473 0 : SgLambdaCapture** objectArray = (SgLambdaCapture**) &(SgLambdaCapture::pools[0]);
53474 :
53475 : // Build a local variable for better performance
53476 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
53477 :
53478 : // Iterate over the memory pools
53479 0 : for (unsigned int i=0; i < SgLambdaCapture::pools.size(); i++)
53480 : {
53481 : // objectArray[i] is a single memory pool
53482 0 : for (unsigned j=0; j < SgLambdaCapture::pool_size; j++)
53483 : {
53484 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
53485 : {
53486 : // printf ("Found a valid SgLambdaCapture object in the memory pool %d at position %d \n",i,j);
53487 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
53488 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
53489 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
53490 : }
53491 : else
53492 : {
53493 : // printf ("Found a INVALID SgLambdaCapture object in the memory pool \n");
53494 : }
53495 : }
53496 : }
53497 : }
53498 :
53499 : // This should not be required since all previously static data members are
53500 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
53501 :
53502 194 : }
53503 :
53504 : void
53505 0 : SgLambdaCapture::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
53506 : {
53507 : // This function visits only a single IR node of the memory pool.
53508 : // it is typically called once for each type of IR node within
53509 : // the automatically generated function: traverseRepresentativeNodes().
53510 :
53511 : // Initialize array to the address of the first element of the STL vector
53512 : // (which is guarenteed to be contiguous storage).
53513 : // SgLambdaCapture objectArray [] = *(Memory_Block_List.begin());
53514 0 : if (SgLambdaCapture::pools.empty() == false)
53515 : {
53516 : // Generate an array of memory pools
53517 0 : SgLambdaCapture** objectArray = (SgLambdaCapture**) &(SgLambdaCapture::pools[0]);
53518 :
53519 : // Build a local variable for better performance
53520 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
53521 :
53522 : // Iterate over the memory pools
53523 0 : bool done = false;
53524 0 : unsigned i=0;
53525 :
53526 : // find the first valid IR node, call visit function, and then leave
53527 0 : while ( done == false && i < SgLambdaCapture::pools.size() )
53528 : {
53529 : // objectArray[i] is a single memory pool
53530 : unsigned j=0;
53531 0 : while (done == false && j < SgLambdaCapture::pool_size)
53532 : {
53533 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
53534 : {
53535 0 : traversal.visit(&(objectArray[i][j]));
53536 0 : done = true;
53537 : }
53538 0 : j++;
53539 : }
53540 0 : i++;
53541 : }
53542 :
53543 : #if 0
53544 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
53545 : if (done == false)
53546 : {
53547 : printf ("No representative for SgLambdaCapture found in memory pools \n");
53548 : }
53549 : #endif
53550 : }
53551 0 : }
53552 :
53553 :
53554 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
53555 : // using values that overflow signed values of int.
53556 : size_t
53557 4 : SgLambdaCapture::numberOfNodes()
53558 : {
53559 : // This function traverses the memory pool for an IR node and
53560 : // counts the number of IR nodes of a particular Sage III IR
53561 : // nodes type.
53562 :
53563 4 : size_t count = 0;
53564 4 : if (SgLambdaCapture::pools.empty() == false)
53565 : {
53566 : // Generate an array of memory pools (this is actually a STL vector,
53567 : // but it is contiguious, so OK to treat this way).
53568 0 : SgLambdaCapture** objectArray = (SgLambdaCapture**) &(SgLambdaCapture::pools[0]);
53569 :
53570 : // Build a local variable for better performance (make it a loop invariant variable).
53571 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
53572 :
53573 : // Iterate over all of the memory pools for this IR node.
53574 0 : for (unsigned int i=0; i < SgLambdaCapture::pools.size(); i++)
53575 : {
53576 : // objectArray[i] is a single memory pool, iterate over all the
53577 : // IR nodes and only count those that are valid IR nodes used in
53578 : // the AST (i.e. allocated IR nodes).
53579 0 : for (unsigned j=0; j < SgLambdaCapture::pool_size; j++)
53580 : {
53581 : // This is indexing the STL vector of C/C++ style arrays as a doubly
53582 : // indexed array access. It is OK since we have leveraged the semantics
53583 : // of STL vector memory as contigous and cast the memory as an array
53584 : // of arrays to use the 2D array indexing. Hope this is not confusing,
53585 : // but it s very fast as an implementation.
53586 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
53587 : {
53588 0 : count++;
53589 : }
53590 : }
53591 : }
53592 : }
53593 :
53594 :
53595 :
53596 4 : return count;
53597 : }
53598 :
53599 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
53600 : // using values that overflow signed values of int.
53601 : size_t
53602 0 : SgLambdaCapture::memoryUsage()
53603 : {
53604 : // This function is required because we need the class name as a type when we call sizeof
53605 : // There might be another way to implement this if we have a traversal that only called a
53606 : // representative object (one call for each type of Sage IIIIR node).
53607 0 : size_t memory = numberOfNodes() * sizeof(SgLambdaCapture);
53608 :
53609 0 : return memory;
53610 : }
53611 :
53612 : /* #line 53613 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
53613 :
53614 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
53615 : void
53616 5342 : SgLambdaCaptureList::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
53617 : {
53618 : // This function traverses the memory pool for only a specific IR node
53619 : // and calls the visit function of the input class execute a traversal
53620 : // similar to the style of the attribute based traversals within ROSE.
53621 : // This traversal will visit ALL nodes of the AST where as the other
53622 : // attribute based traversals visit only the embedded tree within the AST.
53623 :
53624 : // Initialize array to the address of the first element of the STL vector
53625 : // (which is guaranteed to be contiguous storage).
53626 : // SgLambdaCaptureList objectArray [] = *(Memory_Block_List.begin());
53627 5342 : if (SgLambdaCaptureList::pools.empty() == false)
53628 : {
53629 : // Generate an array of memory pools
53630 0 : SgLambdaCaptureList** objectArray = (SgLambdaCaptureList**) &(SgLambdaCaptureList::pools[0]);
53631 :
53632 : // Build a local variable for better performance
53633 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
53634 : #if 0
53635 : // Iterate over the memory pools
53636 : for (unsigned int i=0; i < SgLambdaCaptureList::pools.size(); i++)
53637 : {
53638 : // objectArray[i] is a single memory pool
53639 : for (int j=0; j < SgLambdaCaptureList::pool_size; j++)
53640 : {
53641 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
53642 : {
53643 : traversal.visit(&(objectArray[i][j]));
53644 : }
53645 : }
53646 : }
53647 : #else
53648 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
53649 : // compute the list first and then call the visit function on each list element.
53650 :
53651 : // printf ("Inside of SgLambdaCaptureList::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
53652 :
53653 0 : std::vector<SgLambdaCaptureList*> nodeList;
53654 :
53655 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
53656 0 : for (unsigned int i=0; i < SgLambdaCaptureList::pools.size(); i++)
53657 : {
53658 : // objectArray[i] is a single memory pool
53659 0 : for (unsigned j=0; j < SgLambdaCaptureList::pool_size; j++)
53660 : {
53661 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
53662 : {
53663 0 : nodeList.push_back(&(objectArray[i][j]));
53664 : }
53665 : }
53666 : }
53667 :
53668 : // Iterate over the saved list
53669 0 : size_t nodeListSize = nodeList.size();
53670 0 : for (size_t i=0; i < nodeListSize; i++)
53671 : {
53672 0 : ROSE_ASSERT(nodeList[i] != NULL);
53673 : #if 0
53674 : traversal.visit(nodeList[i]);
53675 : #else
53676 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
53677 : {
53678 0 : traversal.visit(nodeList[i]);
53679 : }
53680 : #endif
53681 : }
53682 : #endif
53683 : }
53684 :
53685 : // This should not be required since all previously static data members are
53686 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
53687 :
53688 5342 : }
53689 :
53690 :
53691 : void
53692 194 : SgLambdaCaptureList::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
53693 : {
53694 : // This function traverses the memory pool for an IR node and
53695 : // calls the function to execute the visitor object.
53696 :
53697 : // Initialize array to the address of the first element of the STL vector
53698 : // (which is guarenteed to be contiguous storage).
53699 : // SgLambdaCaptureList objectArray [] = *(Memory_Block_List.begin());
53700 194 : if (SgLambdaCaptureList::pools.empty() == false)
53701 : {
53702 : // Generate an array of memory pools
53703 0 : SgLambdaCaptureList** objectArray = (SgLambdaCaptureList**) &(SgLambdaCaptureList::pools[0]);
53704 :
53705 : // Build a local variable for better performance
53706 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
53707 :
53708 : // Iterate over the memory pools
53709 0 : for (unsigned int i=0; i < SgLambdaCaptureList::pools.size(); i++)
53710 : {
53711 : // objectArray[i] is a single memory pool
53712 0 : for (unsigned j=0; j < SgLambdaCaptureList::pool_size; j++)
53713 : {
53714 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
53715 : {
53716 : // printf ("Found a valid SgLambdaCaptureList object in the memory pool %d at position %d \n",i,j);
53717 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
53718 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
53719 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
53720 : }
53721 : else
53722 : {
53723 : // printf ("Found a INVALID SgLambdaCaptureList object in the memory pool \n");
53724 : }
53725 : }
53726 : }
53727 : }
53728 :
53729 : // This should not be required since all previously static data members are
53730 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
53731 :
53732 194 : }
53733 :
53734 : void
53735 0 : SgLambdaCaptureList::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
53736 : {
53737 : // This function visits only a single IR node of the memory pool.
53738 : // it is typically called once for each type of IR node within
53739 : // the automatically generated function: traverseRepresentativeNodes().
53740 :
53741 : // Initialize array to the address of the first element of the STL vector
53742 : // (which is guarenteed to be contiguous storage).
53743 : // SgLambdaCaptureList objectArray [] = *(Memory_Block_List.begin());
53744 0 : if (SgLambdaCaptureList::pools.empty() == false)
53745 : {
53746 : // Generate an array of memory pools
53747 0 : SgLambdaCaptureList** objectArray = (SgLambdaCaptureList**) &(SgLambdaCaptureList::pools[0]);
53748 :
53749 : // Build a local variable for better performance
53750 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
53751 :
53752 : // Iterate over the memory pools
53753 0 : bool done = false;
53754 0 : unsigned i=0;
53755 :
53756 : // find the first valid IR node, call visit function, and then leave
53757 0 : while ( done == false && i < SgLambdaCaptureList::pools.size() )
53758 : {
53759 : // objectArray[i] is a single memory pool
53760 : unsigned j=0;
53761 0 : while (done == false && j < SgLambdaCaptureList::pool_size)
53762 : {
53763 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
53764 : {
53765 0 : traversal.visit(&(objectArray[i][j]));
53766 0 : done = true;
53767 : }
53768 0 : j++;
53769 : }
53770 0 : i++;
53771 : }
53772 :
53773 : #if 0
53774 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
53775 : if (done == false)
53776 : {
53777 : printf ("No representative for SgLambdaCaptureList found in memory pools \n");
53778 : }
53779 : #endif
53780 : }
53781 0 : }
53782 :
53783 :
53784 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
53785 : // using values that overflow signed values of int.
53786 : size_t
53787 4 : SgLambdaCaptureList::numberOfNodes()
53788 : {
53789 : // This function traverses the memory pool for an IR node and
53790 : // counts the number of IR nodes of a particular Sage III IR
53791 : // nodes type.
53792 :
53793 4 : size_t count = 0;
53794 4 : if (SgLambdaCaptureList::pools.empty() == false)
53795 : {
53796 : // Generate an array of memory pools (this is actually a STL vector,
53797 : // but it is contiguious, so OK to treat this way).
53798 0 : SgLambdaCaptureList** objectArray = (SgLambdaCaptureList**) &(SgLambdaCaptureList::pools[0]);
53799 :
53800 : // Build a local variable for better performance (make it a loop invariant variable).
53801 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
53802 :
53803 : // Iterate over all of the memory pools for this IR node.
53804 0 : for (unsigned int i=0; i < SgLambdaCaptureList::pools.size(); i++)
53805 : {
53806 : // objectArray[i] is a single memory pool, iterate over all the
53807 : // IR nodes and only count those that are valid IR nodes used in
53808 : // the AST (i.e. allocated IR nodes).
53809 0 : for (unsigned j=0; j < SgLambdaCaptureList::pool_size; j++)
53810 : {
53811 : // This is indexing the STL vector of C/C++ style arrays as a doubly
53812 : // indexed array access. It is OK since we have leveraged the semantics
53813 : // of STL vector memory as contigous and cast the memory as an array
53814 : // of arrays to use the 2D array indexing. Hope this is not confusing,
53815 : // but it s very fast as an implementation.
53816 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
53817 : {
53818 0 : count++;
53819 : }
53820 : }
53821 : }
53822 : }
53823 :
53824 :
53825 :
53826 4 : return count;
53827 : }
53828 :
53829 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
53830 : // using values that overflow signed values of int.
53831 : size_t
53832 0 : SgLambdaCaptureList::memoryUsage()
53833 : {
53834 : // This function is required because we need the class name as a type when we call sizeof
53835 : // There might be another way to implement this if we have a traversal that only called a
53836 : // representative object (one call for each type of Sage IIIIR node).
53837 0 : size_t memory = numberOfNodes() * sizeof(SgLambdaCaptureList);
53838 :
53839 0 : return memory;
53840 : }
53841 :
53842 : /* #line 53843 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
53843 :
53844 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
53845 : void
53846 5342 : SgStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
53847 : {
53848 : // This function traverses the memory pool for only a specific IR node
53849 : // and calls the visit function of the input class execute a traversal
53850 : // similar to the style of the attribute based traversals within ROSE.
53851 : // This traversal will visit ALL nodes of the AST where as the other
53852 : // attribute based traversals visit only the embedded tree within the AST.
53853 :
53854 : // Initialize array to the address of the first element of the STL vector
53855 : // (which is guaranteed to be contiguous storage).
53856 : // SgStatement objectArray [] = *(Memory_Block_List.begin());
53857 5342 : if (SgStatement::pools.empty() == false)
53858 : {
53859 : // Generate an array of memory pools
53860 0 : SgStatement** objectArray = (SgStatement**) &(SgStatement::pools[0]);
53861 :
53862 : // Build a local variable for better performance
53863 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
53864 : #if 0
53865 : // Iterate over the memory pools
53866 : for (unsigned int i=0; i < SgStatement::pools.size(); i++)
53867 : {
53868 : // objectArray[i] is a single memory pool
53869 : for (int j=0; j < SgStatement::pool_size; j++)
53870 : {
53871 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
53872 : {
53873 : traversal.visit(&(objectArray[i][j]));
53874 : }
53875 : }
53876 : }
53877 : #else
53878 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
53879 : // compute the list first and then call the visit function on each list element.
53880 :
53881 : // printf ("Inside of SgStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
53882 :
53883 0 : std::vector<SgStatement*> nodeList;
53884 :
53885 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
53886 0 : for (unsigned int i=0; i < SgStatement::pools.size(); i++)
53887 : {
53888 : // objectArray[i] is a single memory pool
53889 0 : for (unsigned j=0; j < SgStatement::pool_size; j++)
53890 : {
53891 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
53892 : {
53893 0 : nodeList.push_back(&(objectArray[i][j]));
53894 : }
53895 : }
53896 : }
53897 :
53898 : // Iterate over the saved list
53899 0 : size_t nodeListSize = nodeList.size();
53900 0 : for (size_t i=0; i < nodeListSize; i++)
53901 : {
53902 0 : ROSE_ASSERT(nodeList[i] != NULL);
53903 : #if 0
53904 : traversal.visit(nodeList[i]);
53905 : #else
53906 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
53907 : {
53908 0 : traversal.visit(nodeList[i]);
53909 : }
53910 : #endif
53911 : }
53912 : #endif
53913 : }
53914 :
53915 : // This should not be required since all previously static data members are
53916 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
53917 :
53918 5342 : }
53919 :
53920 :
53921 : void
53922 194 : SgStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
53923 : {
53924 : // This function traverses the memory pool for an IR node and
53925 : // calls the function to execute the visitor object.
53926 :
53927 : // Initialize array to the address of the first element of the STL vector
53928 : // (which is guarenteed to be contiguous storage).
53929 : // SgStatement objectArray [] = *(Memory_Block_List.begin());
53930 194 : if (SgStatement::pools.empty() == false)
53931 : {
53932 : // Generate an array of memory pools
53933 0 : SgStatement** objectArray = (SgStatement**) &(SgStatement::pools[0]);
53934 :
53935 : // Build a local variable for better performance
53936 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
53937 :
53938 : // Iterate over the memory pools
53939 0 : for (unsigned int i=0; i < SgStatement::pools.size(); i++)
53940 : {
53941 : // objectArray[i] is a single memory pool
53942 0 : for (unsigned j=0; j < SgStatement::pool_size; j++)
53943 : {
53944 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
53945 : {
53946 : // printf ("Found a valid SgStatement object in the memory pool %d at position %d \n",i,j);
53947 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
53948 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
53949 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
53950 : }
53951 : else
53952 : {
53953 : // printf ("Found a INVALID SgStatement object in the memory pool \n");
53954 : }
53955 : }
53956 : }
53957 : }
53958 :
53959 : // This should not be required since all previously static data members are
53960 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
53961 :
53962 194 : }
53963 :
53964 : void
53965 0 : SgStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
53966 : {
53967 : // This function visits only a single IR node of the memory pool.
53968 : // it is typically called once for each type of IR node within
53969 : // the automatically generated function: traverseRepresentativeNodes().
53970 :
53971 : // Initialize array to the address of the first element of the STL vector
53972 : // (which is guarenteed to be contiguous storage).
53973 : // SgStatement objectArray [] = *(Memory_Block_List.begin());
53974 0 : if (SgStatement::pools.empty() == false)
53975 : {
53976 : // Generate an array of memory pools
53977 0 : SgStatement** objectArray = (SgStatement**) &(SgStatement::pools[0]);
53978 :
53979 : // Build a local variable for better performance
53980 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
53981 :
53982 : // Iterate over the memory pools
53983 0 : bool done = false;
53984 0 : unsigned i=0;
53985 :
53986 : // find the first valid IR node, call visit function, and then leave
53987 0 : while ( done == false && i < SgStatement::pools.size() )
53988 : {
53989 : // objectArray[i] is a single memory pool
53990 : unsigned j=0;
53991 0 : while (done == false && j < SgStatement::pool_size)
53992 : {
53993 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
53994 : {
53995 0 : traversal.visit(&(objectArray[i][j]));
53996 0 : done = true;
53997 : }
53998 0 : j++;
53999 : }
54000 0 : i++;
54001 : }
54002 :
54003 : #if 0
54004 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
54005 : if (done == false)
54006 : {
54007 : printf ("No representative for SgStatement found in memory pools \n");
54008 : }
54009 : #endif
54010 : }
54011 0 : }
54012 :
54013 :
54014 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
54015 : // using values that overflow signed values of int.
54016 : size_t
54017 4 : SgStatement::numberOfNodes()
54018 : {
54019 : // This function traverses the memory pool for an IR node and
54020 : // counts the number of IR nodes of a particular Sage III IR
54021 : // nodes type.
54022 :
54023 4 : size_t count = 0;
54024 4 : if (SgStatement::pools.empty() == false)
54025 : {
54026 : // Generate an array of memory pools (this is actually a STL vector,
54027 : // but it is contiguious, so OK to treat this way).
54028 0 : SgStatement** objectArray = (SgStatement**) &(SgStatement::pools[0]);
54029 :
54030 : // Build a local variable for better performance (make it a loop invariant variable).
54031 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
54032 :
54033 : // Iterate over all of the memory pools for this IR node.
54034 0 : for (unsigned int i=0; i < SgStatement::pools.size(); i++)
54035 : {
54036 : // objectArray[i] is a single memory pool, iterate over all the
54037 : // IR nodes and only count those that are valid IR nodes used in
54038 : // the AST (i.e. allocated IR nodes).
54039 0 : for (unsigned j=0; j < SgStatement::pool_size; j++)
54040 : {
54041 : // This is indexing the STL vector of C/C++ style arrays as a doubly
54042 : // indexed array access. It is OK since we have leveraged the semantics
54043 : // of STL vector memory as contigous and cast the memory as an array
54044 : // of arrays to use the 2D array indexing. Hope this is not confusing,
54045 : // but it s very fast as an implementation.
54046 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
54047 : {
54048 0 : count++;
54049 : }
54050 : }
54051 : }
54052 : }
54053 :
54054 :
54055 :
54056 4 : return count;
54057 : }
54058 :
54059 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
54060 : // using values that overflow signed values of int.
54061 : size_t
54062 0 : SgStatement::memoryUsage()
54063 : {
54064 : // This function is required because we need the class name as a type when we call sizeof
54065 : // There might be another way to implement this if we have a traversal that only called a
54066 : // representative object (one call for each type of Sage IIIIR node).
54067 0 : size_t memory = numberOfNodes() * sizeof(SgStatement);
54068 :
54069 0 : return memory;
54070 : }
54071 :
54072 : /* #line 54073 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
54073 :
54074 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
54075 : void
54076 5342 : SgScopeStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
54077 : {
54078 : // This function traverses the memory pool for only a specific IR node
54079 : // and calls the visit function of the input class execute a traversal
54080 : // similar to the style of the attribute based traversals within ROSE.
54081 : // This traversal will visit ALL nodes of the AST where as the other
54082 : // attribute based traversals visit only the embedded tree within the AST.
54083 :
54084 : // Initialize array to the address of the first element of the STL vector
54085 : // (which is guaranteed to be contiguous storage).
54086 : // SgScopeStatement objectArray [] = *(Memory_Block_List.begin());
54087 5342 : if (SgScopeStatement::pools.empty() == false)
54088 : {
54089 : // Generate an array of memory pools
54090 0 : SgScopeStatement** objectArray = (SgScopeStatement**) &(SgScopeStatement::pools[0]);
54091 :
54092 : // Build a local variable for better performance
54093 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
54094 : #if 0
54095 : // Iterate over the memory pools
54096 : for (unsigned int i=0; i < SgScopeStatement::pools.size(); i++)
54097 : {
54098 : // objectArray[i] is a single memory pool
54099 : for (int j=0; j < SgScopeStatement::pool_size; j++)
54100 : {
54101 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
54102 : {
54103 : traversal.visit(&(objectArray[i][j]));
54104 : }
54105 : }
54106 : }
54107 : #else
54108 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
54109 : // compute the list first and then call the visit function on each list element.
54110 :
54111 : // printf ("Inside of SgScopeStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
54112 :
54113 0 : std::vector<SgScopeStatement*> nodeList;
54114 :
54115 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
54116 0 : for (unsigned int i=0; i < SgScopeStatement::pools.size(); i++)
54117 : {
54118 : // objectArray[i] is a single memory pool
54119 0 : for (unsigned j=0; j < SgScopeStatement::pool_size; j++)
54120 : {
54121 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
54122 : {
54123 0 : nodeList.push_back(&(objectArray[i][j]));
54124 : }
54125 : }
54126 : }
54127 :
54128 : // Iterate over the saved list
54129 0 : size_t nodeListSize = nodeList.size();
54130 0 : for (size_t i=0; i < nodeListSize; i++)
54131 : {
54132 0 : ROSE_ASSERT(nodeList[i] != NULL);
54133 : #if 0
54134 : traversal.visit(nodeList[i]);
54135 : #else
54136 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
54137 : {
54138 0 : traversal.visit(nodeList[i]);
54139 : }
54140 : #endif
54141 : }
54142 : #endif
54143 : }
54144 :
54145 : // This should not be required since all previously static data members are
54146 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
54147 :
54148 5342 : }
54149 :
54150 :
54151 : void
54152 194 : SgScopeStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
54153 : {
54154 : // This function traverses the memory pool for an IR node and
54155 : // calls the function to execute the visitor object.
54156 :
54157 : // Initialize array to the address of the first element of the STL vector
54158 : // (which is guarenteed to be contiguous storage).
54159 : // SgScopeStatement objectArray [] = *(Memory_Block_List.begin());
54160 194 : if (SgScopeStatement::pools.empty() == false)
54161 : {
54162 : // Generate an array of memory pools
54163 0 : SgScopeStatement** objectArray = (SgScopeStatement**) &(SgScopeStatement::pools[0]);
54164 :
54165 : // Build a local variable for better performance
54166 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
54167 :
54168 : // Iterate over the memory pools
54169 0 : for (unsigned int i=0; i < SgScopeStatement::pools.size(); i++)
54170 : {
54171 : // objectArray[i] is a single memory pool
54172 0 : for (unsigned j=0; j < SgScopeStatement::pool_size; j++)
54173 : {
54174 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
54175 : {
54176 : // printf ("Found a valid SgScopeStatement object in the memory pool %d at position %d \n",i,j);
54177 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
54178 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
54179 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
54180 : }
54181 : else
54182 : {
54183 : // printf ("Found a INVALID SgScopeStatement object in the memory pool \n");
54184 : }
54185 : }
54186 : }
54187 : }
54188 :
54189 : // This should not be required since all previously static data members are
54190 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
54191 :
54192 194 : }
54193 :
54194 : void
54195 0 : SgScopeStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
54196 : {
54197 : // This function visits only a single IR node of the memory pool.
54198 : // it is typically called once for each type of IR node within
54199 : // the automatically generated function: traverseRepresentativeNodes().
54200 :
54201 : // Initialize array to the address of the first element of the STL vector
54202 : // (which is guarenteed to be contiguous storage).
54203 : // SgScopeStatement objectArray [] = *(Memory_Block_List.begin());
54204 0 : if (SgScopeStatement::pools.empty() == false)
54205 : {
54206 : // Generate an array of memory pools
54207 0 : SgScopeStatement** objectArray = (SgScopeStatement**) &(SgScopeStatement::pools[0]);
54208 :
54209 : // Build a local variable for better performance
54210 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
54211 :
54212 : // Iterate over the memory pools
54213 0 : bool done = false;
54214 0 : unsigned i=0;
54215 :
54216 : // find the first valid IR node, call visit function, and then leave
54217 0 : while ( done == false && i < SgScopeStatement::pools.size() )
54218 : {
54219 : // objectArray[i] is a single memory pool
54220 : unsigned j=0;
54221 0 : while (done == false && j < SgScopeStatement::pool_size)
54222 : {
54223 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
54224 : {
54225 0 : traversal.visit(&(objectArray[i][j]));
54226 0 : done = true;
54227 : }
54228 0 : j++;
54229 : }
54230 0 : i++;
54231 : }
54232 :
54233 : #if 0
54234 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
54235 : if (done == false)
54236 : {
54237 : printf ("No representative for SgScopeStatement found in memory pools \n");
54238 : }
54239 : #endif
54240 : }
54241 0 : }
54242 :
54243 :
54244 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
54245 : // using values that overflow signed values of int.
54246 : size_t
54247 4 : SgScopeStatement::numberOfNodes()
54248 : {
54249 : // This function traverses the memory pool for an IR node and
54250 : // counts the number of IR nodes of a particular Sage III IR
54251 : // nodes type.
54252 :
54253 4 : size_t count = 0;
54254 4 : if (SgScopeStatement::pools.empty() == false)
54255 : {
54256 : // Generate an array of memory pools (this is actually a STL vector,
54257 : // but it is contiguious, so OK to treat this way).
54258 0 : SgScopeStatement** objectArray = (SgScopeStatement**) &(SgScopeStatement::pools[0]);
54259 :
54260 : // Build a local variable for better performance (make it a loop invariant variable).
54261 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
54262 :
54263 : // Iterate over all of the memory pools for this IR node.
54264 0 : for (unsigned int i=0; i < SgScopeStatement::pools.size(); i++)
54265 : {
54266 : // objectArray[i] is a single memory pool, iterate over all the
54267 : // IR nodes and only count those that are valid IR nodes used in
54268 : // the AST (i.e. allocated IR nodes).
54269 0 : for (unsigned j=0; j < SgScopeStatement::pool_size; j++)
54270 : {
54271 : // This is indexing the STL vector of C/C++ style arrays as a doubly
54272 : // indexed array access. It is OK since we have leveraged the semantics
54273 : // of STL vector memory as contigous and cast the memory as an array
54274 : // of arrays to use the 2D array indexing. Hope this is not confusing,
54275 : // but it s very fast as an implementation.
54276 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
54277 : {
54278 0 : count++;
54279 : }
54280 : }
54281 : }
54282 : }
54283 :
54284 :
54285 :
54286 4 : return count;
54287 : }
54288 :
54289 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
54290 : // using values that overflow signed values of int.
54291 : size_t
54292 0 : SgScopeStatement::memoryUsage()
54293 : {
54294 : // This function is required because we need the class name as a type when we call sizeof
54295 : // There might be another way to implement this if we have a traversal that only called a
54296 : // representative object (one call for each type of Sage IIIIR node).
54297 0 : size_t memory = numberOfNodes() * sizeof(SgScopeStatement);
54298 :
54299 0 : return memory;
54300 : }
54301 :
54302 : /* #line 54303 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
54303 :
54304 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
54305 : void
54306 5342 : SgGlobal::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
54307 : {
54308 : // This function traverses the memory pool for only a specific IR node
54309 : // and calls the visit function of the input class execute a traversal
54310 : // similar to the style of the attribute based traversals within ROSE.
54311 : // This traversal will visit ALL nodes of the AST where as the other
54312 : // attribute based traversals visit only the embedded tree within the AST.
54313 :
54314 : // Initialize array to the address of the first element of the STL vector
54315 : // (which is guaranteed to be contiguous storage).
54316 : // SgGlobal objectArray [] = *(Memory_Block_List.begin());
54317 5342 : if (SgGlobal::pools.empty() == false)
54318 : {
54319 : // Generate an array of memory pools
54320 5342 : SgGlobal** objectArray = (SgGlobal**) &(SgGlobal::pools[0]);
54321 :
54322 : // Build a local variable for better performance
54323 5342 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
54324 : #if 0
54325 : // Iterate over the memory pools
54326 : for (unsigned int i=0; i < SgGlobal::pools.size(); i++)
54327 : {
54328 : // objectArray[i] is a single memory pool
54329 : for (int j=0; j < SgGlobal::pool_size; j++)
54330 : {
54331 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
54332 : {
54333 : traversal.visit(&(objectArray[i][j]));
54334 : }
54335 : }
54336 : }
54337 : #else
54338 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
54339 : // compute the list first and then call the visit function on each list element.
54340 :
54341 : // printf ("Inside of SgGlobal::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
54342 :
54343 10684 : std::vector<SgGlobal*> nodeList;
54344 :
54345 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
54346 10684 : for (unsigned int i=0; i < SgGlobal::pools.size(); i++)
54347 : {
54348 : // objectArray[i] is a single memory pool
54349 10689300 : for (unsigned j=0; j < SgGlobal::pool_size; j++)
54350 : {
54351 10684000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
54352 : {
54353 10880 : nodeList.push_back(&(objectArray[i][j]));
54354 : }
54355 : }
54356 : }
54357 :
54358 : // Iterate over the saved list
54359 5342 : size_t nodeListSize = nodeList.size();
54360 16222 : for (size_t i=0; i < nodeListSize; i++)
54361 : {
54362 10880 : ROSE_ASSERT(nodeList[i] != NULL);
54363 : #if 0
54364 : traversal.visit(nodeList[i]);
54365 : #else
54366 10880 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
54367 : {
54368 10880 : traversal.visit(nodeList[i]);
54369 : }
54370 : #endif
54371 : }
54372 : #endif
54373 : }
54374 :
54375 : // This should not be required since all previously static data members are
54376 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
54377 :
54378 5342 : }
54379 :
54380 :
54381 : void
54382 194 : SgGlobal::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
54383 : {
54384 : // This function traverses the memory pool for an IR node and
54385 : // calls the function to execute the visitor object.
54386 :
54387 : // Initialize array to the address of the first element of the STL vector
54388 : // (which is guarenteed to be contiguous storage).
54389 : // SgGlobal objectArray [] = *(Memory_Block_List.begin());
54390 194 : if (SgGlobal::pools.empty() == false)
54391 : {
54392 : // Generate an array of memory pools
54393 194 : SgGlobal** objectArray = (SgGlobal**) &(SgGlobal::pools[0]);
54394 :
54395 : // Build a local variable for better performance
54396 194 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
54397 :
54398 : // Iterate over the memory pools
54399 388 : for (unsigned int i=0; i < SgGlobal::pools.size(); i++)
54400 : {
54401 : // objectArray[i] is a single memory pool
54402 388194 : for (unsigned j=0; j < SgGlobal::pool_size; j++)
54403 : {
54404 388000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
54405 : {
54406 : // printf ("Found a valid SgGlobal object in the memory pool %d at position %d \n",i,j);
54407 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
54408 388 : objectArray[i][j].executeVisitorMemberFunction(visitor);
54409 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
54410 : }
54411 : else
54412 : {
54413 : // printf ("Found a INVALID SgGlobal object in the memory pool \n");
54414 : }
54415 : }
54416 : }
54417 : }
54418 :
54419 : // This should not be required since all previously static data members are
54420 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
54421 :
54422 194 : }
54423 :
54424 : void
54425 0 : SgGlobal::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
54426 : {
54427 : // This function visits only a single IR node of the memory pool.
54428 : // it is typically called once for each type of IR node within
54429 : // the automatically generated function: traverseRepresentativeNodes().
54430 :
54431 : // Initialize array to the address of the first element of the STL vector
54432 : // (which is guarenteed to be contiguous storage).
54433 : // SgGlobal objectArray [] = *(Memory_Block_List.begin());
54434 0 : if (SgGlobal::pools.empty() == false)
54435 : {
54436 : // Generate an array of memory pools
54437 0 : SgGlobal** objectArray = (SgGlobal**) &(SgGlobal::pools[0]);
54438 :
54439 : // Build a local variable for better performance
54440 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
54441 :
54442 : // Iterate over the memory pools
54443 0 : bool done = false;
54444 0 : unsigned i=0;
54445 :
54446 : // find the first valid IR node, call visit function, and then leave
54447 0 : while ( done == false && i < SgGlobal::pools.size() )
54448 : {
54449 : // objectArray[i] is a single memory pool
54450 : unsigned j=0;
54451 0 : while (done == false && j < SgGlobal::pool_size)
54452 : {
54453 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
54454 : {
54455 0 : traversal.visit(&(objectArray[i][j]));
54456 0 : done = true;
54457 : }
54458 0 : j++;
54459 : }
54460 0 : i++;
54461 : }
54462 :
54463 : #if 0
54464 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
54465 : if (done == false)
54466 : {
54467 : printf ("No representative for SgGlobal found in memory pools \n");
54468 : }
54469 : #endif
54470 : }
54471 0 : }
54472 :
54473 :
54474 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
54475 : // using values that overflow signed values of int.
54476 : size_t
54477 4 : SgGlobal::numberOfNodes()
54478 : {
54479 : // This function traverses the memory pool for an IR node and
54480 : // counts the number of IR nodes of a particular Sage III IR
54481 : // nodes type.
54482 :
54483 4 : size_t count = 0;
54484 4 : if (SgGlobal::pools.empty() == false)
54485 : {
54486 : // Generate an array of memory pools (this is actually a STL vector,
54487 : // but it is contiguious, so OK to treat this way).
54488 4 : SgGlobal** objectArray = (SgGlobal**) &(SgGlobal::pools[0]);
54489 :
54490 : // Build a local variable for better performance (make it a loop invariant variable).
54491 4 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
54492 :
54493 : // Iterate over all of the memory pools for this IR node.
54494 8 : for (unsigned int i=0; i < SgGlobal::pools.size(); i++)
54495 : {
54496 : // objectArray[i] is a single memory pool, iterate over all the
54497 : // IR nodes and only count those that are valid IR nodes used in
54498 : // the AST (i.e. allocated IR nodes).
54499 8004 : for (unsigned j=0; j < SgGlobal::pool_size; j++)
54500 : {
54501 : // This is indexing the STL vector of C/C++ style arrays as a doubly
54502 : // indexed array access. It is OK since we have leveraged the semantics
54503 : // of STL vector memory as contigous and cast the memory as an array
54504 : // of arrays to use the 2D array indexing. Hope this is not confusing,
54505 : // but it s very fast as an implementation.
54506 8000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
54507 : {
54508 10 : count++;
54509 : }
54510 : }
54511 : }
54512 : }
54513 :
54514 :
54515 :
54516 4 : return count;
54517 : }
54518 :
54519 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
54520 : // using values that overflow signed values of int.
54521 : size_t
54522 0 : SgGlobal::memoryUsage()
54523 : {
54524 : // This function is required because we need the class name as a type when we call sizeof
54525 : // There might be another way to implement this if we have a traversal that only called a
54526 : // representative object (one call for each type of Sage IIIIR node).
54527 0 : size_t memory = numberOfNodes() * sizeof(SgGlobal);
54528 :
54529 0 : return memory;
54530 : }
54531 :
54532 : /* #line 54533 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
54533 :
54534 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
54535 : void
54536 5342 : SgBasicBlock::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
54537 : {
54538 : // This function traverses the memory pool for only a specific IR node
54539 : // and calls the visit function of the input class execute a traversal
54540 : // similar to the style of the attribute based traversals within ROSE.
54541 : // This traversal will visit ALL nodes of the AST where as the other
54542 : // attribute based traversals visit only the embedded tree within the AST.
54543 :
54544 : // Initialize array to the address of the first element of the STL vector
54545 : // (which is guaranteed to be contiguous storage).
54546 : // SgBasicBlock objectArray [] = *(Memory_Block_List.begin());
54547 5342 : if (SgBasicBlock::pools.empty() == false)
54548 : {
54549 : // Generate an array of memory pools
54550 4921 : SgBasicBlock** objectArray = (SgBasicBlock**) &(SgBasicBlock::pools[0]);
54551 :
54552 : // Build a local variable for better performance
54553 4921 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
54554 : #if 0
54555 : // Iterate over the memory pools
54556 : for (unsigned int i=0; i < SgBasicBlock::pools.size(); i++)
54557 : {
54558 : // objectArray[i] is a single memory pool
54559 : for (int j=0; j < SgBasicBlock::pool_size; j++)
54560 : {
54561 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
54562 : {
54563 : traversal.visit(&(objectArray[i][j]));
54564 : }
54565 : }
54566 : }
54567 : #else
54568 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
54569 : // compute the list first and then call the visit function on each list element.
54570 :
54571 : // printf ("Inside of SgBasicBlock::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
54572 :
54573 9842 : std::vector<SgBasicBlock*> nodeList;
54574 :
54575 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
54576 9957 : for (unsigned int i=0; i < SgBasicBlock::pools.size(); i++)
54577 : {
54578 : // objectArray[i] is a single memory pool
54579 10077000 : for (unsigned j=0; j < SgBasicBlock::pool_size; j++)
54580 : {
54581 10072000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
54582 : {
54583 402122 : nodeList.push_back(&(objectArray[i][j]));
54584 : }
54585 : }
54586 : }
54587 :
54588 : // Iterate over the saved list
54589 4921 : size_t nodeListSize = nodeList.size();
54590 407043 : for (size_t i=0; i < nodeListSize; i++)
54591 : {
54592 402122 : ROSE_ASSERT(nodeList[i] != NULL);
54593 : #if 0
54594 : traversal.visit(nodeList[i]);
54595 : #else
54596 402122 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
54597 : {
54598 402122 : traversal.visit(nodeList[i]);
54599 : }
54600 : #endif
54601 : }
54602 : #endif
54603 : }
54604 :
54605 : // This should not be required since all previously static data members are
54606 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
54607 :
54608 5342 : }
54609 :
54610 :
54611 : void
54612 194 : SgBasicBlock::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
54613 : {
54614 : // This function traverses the memory pool for an IR node and
54615 : // calls the function to execute the visitor object.
54616 :
54617 : // Initialize array to the address of the first element of the STL vector
54618 : // (which is guarenteed to be contiguous storage).
54619 : // SgBasicBlock objectArray [] = *(Memory_Block_List.begin());
54620 194 : if (SgBasicBlock::pools.empty() == false)
54621 : {
54622 : // Generate an array of memory pools
54623 194 : SgBasicBlock** objectArray = (SgBasicBlock**) &(SgBasicBlock::pools[0]);
54624 :
54625 : // Build a local variable for better performance
54626 194 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
54627 :
54628 : // Iterate over the memory pools
54629 525 : for (unsigned int i=0; i < SgBasicBlock::pools.size(); i++)
54630 : {
54631 : // objectArray[i] is a single memory pool
54632 662331 : for (unsigned j=0; j < SgBasicBlock::pool_size; j++)
54633 : {
54634 662000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
54635 : {
54636 : // printf ("Found a valid SgBasicBlock object in the memory pool %d at position %d \n",i,j);
54637 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
54638 403228 : objectArray[i][j].executeVisitorMemberFunction(visitor);
54639 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
54640 : }
54641 : else
54642 : {
54643 : // printf ("Found a INVALID SgBasicBlock object in the memory pool \n");
54644 : }
54645 : }
54646 : }
54647 : }
54648 :
54649 : // This should not be required since all previously static data members are
54650 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
54651 :
54652 194 : }
54653 :
54654 : void
54655 0 : SgBasicBlock::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
54656 : {
54657 : // This function visits only a single IR node of the memory pool.
54658 : // it is typically called once for each type of IR node within
54659 : // the automatically generated function: traverseRepresentativeNodes().
54660 :
54661 : // Initialize array to the address of the first element of the STL vector
54662 : // (which is guarenteed to be contiguous storage).
54663 : // SgBasicBlock objectArray [] = *(Memory_Block_List.begin());
54664 0 : if (SgBasicBlock::pools.empty() == false)
54665 : {
54666 : // Generate an array of memory pools
54667 0 : SgBasicBlock** objectArray = (SgBasicBlock**) &(SgBasicBlock::pools[0]);
54668 :
54669 : // Build a local variable for better performance
54670 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
54671 :
54672 : // Iterate over the memory pools
54673 0 : bool done = false;
54674 0 : unsigned i=0;
54675 :
54676 : // find the first valid IR node, call visit function, and then leave
54677 0 : while ( done == false && i < SgBasicBlock::pools.size() )
54678 : {
54679 : // objectArray[i] is a single memory pool
54680 : unsigned j=0;
54681 0 : while (done == false && j < SgBasicBlock::pool_size)
54682 : {
54683 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
54684 : {
54685 0 : traversal.visit(&(objectArray[i][j]));
54686 0 : done = true;
54687 : }
54688 0 : j++;
54689 : }
54690 0 : i++;
54691 : }
54692 :
54693 : #if 0
54694 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
54695 : if (done == false)
54696 : {
54697 : printf ("No representative for SgBasicBlock found in memory pools \n");
54698 : }
54699 : #endif
54700 : }
54701 0 : }
54702 :
54703 :
54704 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
54705 : // using values that overflow signed values of int.
54706 : size_t
54707 4 : SgBasicBlock::numberOfNodes()
54708 : {
54709 : // This function traverses the memory pool for an IR node and
54710 : // counts the number of IR nodes of a particular Sage III IR
54711 : // nodes type.
54712 :
54713 4 : size_t count = 0;
54714 4 : if (SgBasicBlock::pools.empty() == false)
54715 : {
54716 : // Generate an array of memory pools (this is actually a STL vector,
54717 : // but it is contiguious, so OK to treat this way).
54718 4 : SgBasicBlock** objectArray = (SgBasicBlock**) &(SgBasicBlock::pools[0]);
54719 :
54720 : // Build a local variable for better performance (make it a loop invariant variable).
54721 4 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
54722 :
54723 : // Iterate over all of the memory pools for this IR node.
54724 9 : for (unsigned int i=0; i < SgBasicBlock::pools.size(); i++)
54725 : {
54726 : // objectArray[i] is a single memory pool, iterate over all the
54727 : // IR nodes and only count those that are valid IR nodes used in
54728 : // the AST (i.e. allocated IR nodes).
54729 10005 : for (unsigned j=0; j < SgBasicBlock::pool_size; j++)
54730 : {
54731 : // This is indexing the STL vector of C/C++ style arrays as a doubly
54732 : // indexed array access. It is OK since we have leveraged the semantics
54733 : // of STL vector memory as contigous and cast the memory as an array
54734 : // of arrays to use the 2D array indexing. Hope this is not confusing,
54735 : // but it s very fast as an implementation.
54736 10000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
54737 : {
54738 2869 : count++;
54739 : }
54740 : }
54741 : }
54742 : }
54743 :
54744 :
54745 :
54746 4 : return count;
54747 : }
54748 :
54749 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
54750 : // using values that overflow signed values of int.
54751 : size_t
54752 0 : SgBasicBlock::memoryUsage()
54753 : {
54754 : // This function is required because we need the class name as a type when we call sizeof
54755 : // There might be another way to implement this if we have a traversal that only called a
54756 : // representative object (one call for each type of Sage IIIIR node).
54757 0 : size_t memory = numberOfNodes() * sizeof(SgBasicBlock);
54758 :
54759 0 : return memory;
54760 : }
54761 :
54762 : /* #line 54763 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
54763 :
54764 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
54765 : void
54766 5342 : SgIfStmt::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
54767 : {
54768 : // This function traverses the memory pool for only a specific IR node
54769 : // and calls the visit function of the input class execute a traversal
54770 : // similar to the style of the attribute based traversals within ROSE.
54771 : // This traversal will visit ALL nodes of the AST where as the other
54772 : // attribute based traversals visit only the embedded tree within the AST.
54773 :
54774 : // Initialize array to the address of the first element of the STL vector
54775 : // (which is guaranteed to be contiguous storage).
54776 : // SgIfStmt objectArray [] = *(Memory_Block_List.begin());
54777 5342 : if (SgIfStmt::pools.empty() == false)
54778 : {
54779 : // Generate an array of memory pools
54780 1252 : SgIfStmt** objectArray = (SgIfStmt**) &(SgIfStmt::pools[0]);
54781 :
54782 : // Build a local variable for better performance
54783 1252 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
54784 : #if 0
54785 : // Iterate over the memory pools
54786 : for (unsigned int i=0; i < SgIfStmt::pools.size(); i++)
54787 : {
54788 : // objectArray[i] is a single memory pool
54789 : for (int j=0; j < SgIfStmt::pool_size; j++)
54790 : {
54791 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
54792 : {
54793 : traversal.visit(&(objectArray[i][j]));
54794 : }
54795 : }
54796 : }
54797 : #else
54798 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
54799 : // compute the list first and then call the visit function on each list element.
54800 :
54801 : // printf ("Inside of SgIfStmt::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
54802 :
54803 2504 : std::vector<SgIfStmt*> nodeList;
54804 :
54805 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
54806 2504 : for (unsigned int i=0; i < SgIfStmt::pools.size(); i++)
54807 : {
54808 : // objectArray[i] is a single memory pool
54809 2505250 : for (unsigned j=0; j < SgIfStmt::pool_size; j++)
54810 : {
54811 2504000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
54812 : {
54813 75266 : nodeList.push_back(&(objectArray[i][j]));
54814 : }
54815 : }
54816 : }
54817 :
54818 : // Iterate over the saved list
54819 1252 : size_t nodeListSize = nodeList.size();
54820 76518 : for (size_t i=0; i < nodeListSize; i++)
54821 : {
54822 75266 : ROSE_ASSERT(nodeList[i] != NULL);
54823 : #if 0
54824 : traversal.visit(nodeList[i]);
54825 : #else
54826 75266 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
54827 : {
54828 75266 : traversal.visit(nodeList[i]);
54829 : }
54830 : #endif
54831 : }
54832 : #endif
54833 : }
54834 :
54835 : // This should not be required since all previously static data members are
54836 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
54837 :
54838 5342 : }
54839 :
54840 :
54841 : void
54842 194 : SgIfStmt::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
54843 : {
54844 : // This function traverses the memory pool for an IR node and
54845 : // calls the function to execute the visitor object.
54846 :
54847 : // Initialize array to the address of the first element of the STL vector
54848 : // (which is guarenteed to be contiguous storage).
54849 : // SgIfStmt objectArray [] = *(Memory_Block_List.begin());
54850 194 : if (SgIfStmt::pools.empty() == false)
54851 : {
54852 : // Generate an array of memory pools
54853 137 : SgIfStmt** objectArray = (SgIfStmt**) &(SgIfStmt::pools[0]);
54854 :
54855 : // Build a local variable for better performance
54856 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
54857 :
54858 : // Iterate over the memory pools
54859 274 : for (unsigned int i=0; i < SgIfStmt::pools.size(); i++)
54860 : {
54861 : // objectArray[i] is a single memory pool
54862 274137 : for (unsigned j=0; j < SgIfStmt::pool_size; j++)
54863 : {
54864 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
54865 : {
54866 : // printf ("Found a valid SgIfStmt object in the memory pool %d at position %d \n",i,j);
54867 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
54868 82870 : objectArray[i][j].executeVisitorMemberFunction(visitor);
54869 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
54870 : }
54871 : else
54872 : {
54873 : // printf ("Found a INVALID SgIfStmt object in the memory pool \n");
54874 : }
54875 : }
54876 : }
54877 : }
54878 :
54879 : // This should not be required since all previously static data members are
54880 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
54881 :
54882 194 : }
54883 :
54884 : void
54885 0 : SgIfStmt::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
54886 : {
54887 : // This function visits only a single IR node of the memory pool.
54888 : // it is typically called once for each type of IR node within
54889 : // the automatically generated function: traverseRepresentativeNodes().
54890 :
54891 : // Initialize array to the address of the first element of the STL vector
54892 : // (which is guarenteed to be contiguous storage).
54893 : // SgIfStmt objectArray [] = *(Memory_Block_List.begin());
54894 0 : if (SgIfStmt::pools.empty() == false)
54895 : {
54896 : // Generate an array of memory pools
54897 0 : SgIfStmt** objectArray = (SgIfStmt**) &(SgIfStmt::pools[0]);
54898 :
54899 : // Build a local variable for better performance
54900 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
54901 :
54902 : // Iterate over the memory pools
54903 0 : bool done = false;
54904 0 : unsigned i=0;
54905 :
54906 : // find the first valid IR node, call visit function, and then leave
54907 0 : while ( done == false && i < SgIfStmt::pools.size() )
54908 : {
54909 : // objectArray[i] is a single memory pool
54910 : unsigned j=0;
54911 0 : while (done == false && j < SgIfStmt::pool_size)
54912 : {
54913 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
54914 : {
54915 0 : traversal.visit(&(objectArray[i][j]));
54916 0 : done = true;
54917 : }
54918 0 : j++;
54919 : }
54920 0 : i++;
54921 : }
54922 :
54923 : #if 0
54924 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
54925 : if (done == false)
54926 : {
54927 : printf ("No representative for SgIfStmt found in memory pools \n");
54928 : }
54929 : #endif
54930 : }
54931 0 : }
54932 :
54933 :
54934 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
54935 : // using values that overflow signed values of int.
54936 : size_t
54937 4 : SgIfStmt::numberOfNodes()
54938 : {
54939 : // This function traverses the memory pool for an IR node and
54940 : // counts the number of IR nodes of a particular Sage III IR
54941 : // nodes type.
54942 :
54943 4 : size_t count = 0;
54944 4 : if (SgIfStmt::pools.empty() == false)
54945 : {
54946 : // Generate an array of memory pools (this is actually a STL vector,
54947 : // but it is contiguious, so OK to treat this way).
54948 1 : SgIfStmt** objectArray = (SgIfStmt**) &(SgIfStmt::pools[0]);
54949 :
54950 : // Build a local variable for better performance (make it a loop invariant variable).
54951 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
54952 :
54953 : // Iterate over all of the memory pools for this IR node.
54954 2 : for (unsigned int i=0; i < SgIfStmt::pools.size(); i++)
54955 : {
54956 : // objectArray[i] is a single memory pool, iterate over all the
54957 : // IR nodes and only count those that are valid IR nodes used in
54958 : // the AST (i.e. allocated IR nodes).
54959 2001 : for (unsigned j=0; j < SgIfStmt::pool_size; j++)
54960 : {
54961 : // This is indexing the STL vector of C/C++ style arrays as a doubly
54962 : // indexed array access. It is OK since we have leveraged the semantics
54963 : // of STL vector memory as contigous and cast the memory as an array
54964 : // of arrays to use the 2D array indexing. Hope this is not confusing,
54965 : // but it s very fast as an implementation.
54966 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
54967 : {
54968 592 : count++;
54969 : }
54970 : }
54971 : }
54972 : }
54973 :
54974 :
54975 :
54976 4 : return count;
54977 : }
54978 :
54979 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
54980 : // using values that overflow signed values of int.
54981 : size_t
54982 0 : SgIfStmt::memoryUsage()
54983 : {
54984 : // This function is required because we need the class name as a type when we call sizeof
54985 : // There might be another way to implement this if we have a traversal that only called a
54986 : // representative object (one call for each type of Sage IIIIR node).
54987 0 : size_t memory = numberOfNodes() * sizeof(SgIfStmt);
54988 :
54989 0 : return memory;
54990 : }
54991 :
54992 : /* #line 54993 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
54993 :
54994 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
54995 : void
54996 5342 : SgForStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
54997 : {
54998 : // This function traverses the memory pool for only a specific IR node
54999 : // and calls the visit function of the input class execute a traversal
55000 : // similar to the style of the attribute based traversals within ROSE.
55001 : // This traversal will visit ALL nodes of the AST where as the other
55002 : // attribute based traversals visit only the embedded tree within the AST.
55003 :
55004 : // Initialize array to the address of the first element of the STL vector
55005 : // (which is guaranteed to be contiguous storage).
55006 : // SgForStatement objectArray [] = *(Memory_Block_List.begin());
55007 5342 : if (SgForStatement::pools.empty() == false)
55008 : {
55009 : // Generate an array of memory pools
55010 2482 : SgForStatement** objectArray = (SgForStatement**) &(SgForStatement::pools[0]);
55011 :
55012 : // Build a local variable for better performance
55013 2482 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
55014 : #if 0
55015 : // Iterate over the memory pools
55016 : for (unsigned int i=0; i < SgForStatement::pools.size(); i++)
55017 : {
55018 : // objectArray[i] is a single memory pool
55019 : for (int j=0; j < SgForStatement::pool_size; j++)
55020 : {
55021 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
55022 : {
55023 : traversal.visit(&(objectArray[i][j]));
55024 : }
55025 : }
55026 : }
55027 : #else
55028 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
55029 : // compute the list first and then call the visit function on each list element.
55030 :
55031 : // printf ("Inside of SgForStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
55032 :
55033 4964 : std::vector<SgForStatement*> nodeList;
55034 :
55035 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
55036 4964 : for (unsigned int i=0; i < SgForStatement::pools.size(); i++)
55037 : {
55038 : // objectArray[i] is a single memory pool
55039 4966480 : for (unsigned j=0; j < SgForStatement::pool_size; j++)
55040 : {
55041 4964000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
55042 : {
55043 13511 : nodeList.push_back(&(objectArray[i][j]));
55044 : }
55045 : }
55046 : }
55047 :
55048 : // Iterate over the saved list
55049 2482 : size_t nodeListSize = nodeList.size();
55050 15993 : for (size_t i=0; i < nodeListSize; i++)
55051 : {
55052 13511 : ROSE_ASSERT(nodeList[i] != NULL);
55053 : #if 0
55054 : traversal.visit(nodeList[i]);
55055 : #else
55056 13511 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
55057 : {
55058 13511 : traversal.visit(nodeList[i]);
55059 : }
55060 : #endif
55061 : }
55062 : #endif
55063 : }
55064 :
55065 : // This should not be required since all previously static data members are
55066 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
55067 :
55068 5342 : }
55069 :
55070 :
55071 : void
55072 194 : SgForStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
55073 : {
55074 : // This function traverses the memory pool for an IR node and
55075 : // calls the function to execute the visitor object.
55076 :
55077 : // Initialize array to the address of the first element of the STL vector
55078 : // (which is guarenteed to be contiguous storage).
55079 : // SgForStatement objectArray [] = *(Memory_Block_List.begin());
55080 194 : if (SgForStatement::pools.empty() == false)
55081 : {
55082 : // Generate an array of memory pools
55083 190 : SgForStatement** objectArray = (SgForStatement**) &(SgForStatement::pools[0]);
55084 :
55085 : // Build a local variable for better performance
55086 190 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
55087 :
55088 : // Iterate over the memory pools
55089 380 : for (unsigned int i=0; i < SgForStatement::pools.size(); i++)
55090 : {
55091 : // objectArray[i] is a single memory pool
55092 380190 : for (unsigned j=0; j < SgForStatement::pool_size; j++)
55093 : {
55094 380000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
55095 : {
55096 : // printf ("Found a valid SgForStatement object in the memory pool %d at position %d \n",i,j);
55097 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
55098 6160 : objectArray[i][j].executeVisitorMemberFunction(visitor);
55099 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
55100 : }
55101 : else
55102 : {
55103 : // printf ("Found a INVALID SgForStatement object in the memory pool \n");
55104 : }
55105 : }
55106 : }
55107 : }
55108 :
55109 : // This should not be required since all previously static data members are
55110 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
55111 :
55112 194 : }
55113 :
55114 : void
55115 0 : SgForStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
55116 : {
55117 : // This function visits only a single IR node of the memory pool.
55118 : // it is typically called once for each type of IR node within
55119 : // the automatically generated function: traverseRepresentativeNodes().
55120 :
55121 : // Initialize array to the address of the first element of the STL vector
55122 : // (which is guarenteed to be contiguous storage).
55123 : // SgForStatement objectArray [] = *(Memory_Block_List.begin());
55124 0 : if (SgForStatement::pools.empty() == false)
55125 : {
55126 : // Generate an array of memory pools
55127 0 : SgForStatement** objectArray = (SgForStatement**) &(SgForStatement::pools[0]);
55128 :
55129 : // Build a local variable for better performance
55130 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
55131 :
55132 : // Iterate over the memory pools
55133 0 : bool done = false;
55134 0 : unsigned i=0;
55135 :
55136 : // find the first valid IR node, call visit function, and then leave
55137 0 : while ( done == false && i < SgForStatement::pools.size() )
55138 : {
55139 : // objectArray[i] is a single memory pool
55140 : unsigned j=0;
55141 0 : while (done == false && j < SgForStatement::pool_size)
55142 : {
55143 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
55144 : {
55145 0 : traversal.visit(&(objectArray[i][j]));
55146 0 : done = true;
55147 : }
55148 0 : j++;
55149 : }
55150 0 : i++;
55151 : }
55152 :
55153 : #if 0
55154 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
55155 : if (done == false)
55156 : {
55157 : printf ("No representative for SgForStatement found in memory pools \n");
55158 : }
55159 : #endif
55160 : }
55161 0 : }
55162 :
55163 :
55164 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
55165 : // using values that overflow signed values of int.
55166 : size_t
55167 4 : SgForStatement::numberOfNodes()
55168 : {
55169 : // This function traverses the memory pool for an IR node and
55170 : // counts the number of IR nodes of a particular Sage III IR
55171 : // nodes type.
55172 :
55173 4 : size_t count = 0;
55174 4 : if (SgForStatement::pools.empty() == false)
55175 : {
55176 : // Generate an array of memory pools (this is actually a STL vector,
55177 : // but it is contiguious, so OK to treat this way).
55178 1 : SgForStatement** objectArray = (SgForStatement**) &(SgForStatement::pools[0]);
55179 :
55180 : // Build a local variable for better performance (make it a loop invariant variable).
55181 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
55182 :
55183 : // Iterate over all of the memory pools for this IR node.
55184 2 : for (unsigned int i=0; i < SgForStatement::pools.size(); i++)
55185 : {
55186 : // objectArray[i] is a single memory pool, iterate over all the
55187 : // IR nodes and only count those that are valid IR nodes used in
55188 : // the AST (i.e. allocated IR nodes).
55189 2001 : for (unsigned j=0; j < SgForStatement::pool_size; j++)
55190 : {
55191 : // This is indexing the STL vector of C/C++ style arrays as a doubly
55192 : // indexed array access. It is OK since we have leveraged the semantics
55193 : // of STL vector memory as contigous and cast the memory as an array
55194 : // of arrays to use the 2D array indexing. Hope this is not confusing,
55195 : // but it s very fast as an implementation.
55196 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
55197 : {
55198 40 : count++;
55199 : }
55200 : }
55201 : }
55202 : }
55203 :
55204 :
55205 :
55206 4 : return count;
55207 : }
55208 :
55209 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
55210 : // using values that overflow signed values of int.
55211 : size_t
55212 0 : SgForStatement::memoryUsage()
55213 : {
55214 : // This function is required because we need the class name as a type when we call sizeof
55215 : // There might be another way to implement this if we have a traversal that only called a
55216 : // representative object (one call for each type of Sage IIIIR node).
55217 0 : size_t memory = numberOfNodes() * sizeof(SgForStatement);
55218 :
55219 0 : return memory;
55220 : }
55221 :
55222 : /* #line 55223 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
55223 :
55224 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
55225 : void
55226 5342 : SgFunctionDefinition::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
55227 : {
55228 : // This function traverses the memory pool for only a specific IR node
55229 : // and calls the visit function of the input class execute a traversal
55230 : // similar to the style of the attribute based traversals within ROSE.
55231 : // This traversal will visit ALL nodes of the AST where as the other
55232 : // attribute based traversals visit only the embedded tree within the AST.
55233 :
55234 : // Initialize array to the address of the first element of the STL vector
55235 : // (which is guaranteed to be contiguous storage).
55236 : // SgFunctionDefinition objectArray [] = *(Memory_Block_List.begin());
55237 5342 : if (SgFunctionDefinition::pools.empty() == false)
55238 : {
55239 : // Generate an array of memory pools
55240 4921 : SgFunctionDefinition** objectArray = (SgFunctionDefinition**) &(SgFunctionDefinition::pools[0]);
55241 :
55242 : // Build a local variable for better performance
55243 4921 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
55244 : #if 0
55245 : // Iterate over the memory pools
55246 : for (unsigned int i=0; i < SgFunctionDefinition::pools.size(); i++)
55247 : {
55248 : // objectArray[i] is a single memory pool
55249 : for (int j=0; j < SgFunctionDefinition::pool_size; j++)
55250 : {
55251 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
55252 : {
55253 : traversal.visit(&(objectArray[i][j]));
55254 : }
55255 : }
55256 : }
55257 : #else
55258 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
55259 : // compute the list first and then call the visit function on each list element.
55260 :
55261 : // printf ("Inside of SgFunctionDefinition::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
55262 :
55263 9842 : std::vector<SgFunctionDefinition*> nodeList;
55264 :
55265 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
55266 9842 : for (unsigned int i=0; i < SgFunctionDefinition::pools.size(); i++)
55267 : {
55268 : // objectArray[i] is a single memory pool
55269 9846920 : for (unsigned j=0; j < SgFunctionDefinition::pool_size; j++)
55270 : {
55271 9842000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
55272 : {
55273 225656 : nodeList.push_back(&(objectArray[i][j]));
55274 : }
55275 : }
55276 : }
55277 :
55278 : // Iterate over the saved list
55279 4921 : size_t nodeListSize = nodeList.size();
55280 230577 : for (size_t i=0; i < nodeListSize; i++)
55281 : {
55282 225656 : ROSE_ASSERT(nodeList[i] != NULL);
55283 : #if 0
55284 : traversal.visit(nodeList[i]);
55285 : #else
55286 225656 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
55287 : {
55288 225656 : traversal.visit(nodeList[i]);
55289 : }
55290 : #endif
55291 : }
55292 : #endif
55293 : }
55294 :
55295 : // This should not be required since all previously static data members are
55296 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
55297 :
55298 5342 : }
55299 :
55300 :
55301 : void
55302 194 : SgFunctionDefinition::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
55303 : {
55304 : // This function traverses the memory pool for an IR node and
55305 : // calls the function to execute the visitor object.
55306 :
55307 : // Initialize array to the address of the first element of the STL vector
55308 : // (which is guarenteed to be contiguous storage).
55309 : // SgFunctionDefinition objectArray [] = *(Memory_Block_List.begin());
55310 194 : if (SgFunctionDefinition::pools.empty() == false)
55311 : {
55312 : // Generate an array of memory pools
55313 194 : SgFunctionDefinition** objectArray = (SgFunctionDefinition**) &(SgFunctionDefinition::pools[0]);
55314 :
55315 : // Build a local variable for better performance
55316 194 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
55317 :
55318 : // Iterate over the memory pools
55319 388 : for (unsigned int i=0; i < SgFunctionDefinition::pools.size(); i++)
55320 : {
55321 : // objectArray[i] is a single memory pool
55322 388194 : for (unsigned j=0; j < SgFunctionDefinition::pool_size; j++)
55323 : {
55324 388000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
55325 : {
55326 : // printf ("Found a valid SgFunctionDefinition object in the memory pool %d at position %d \n",i,j);
55327 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
55328 222609 : objectArray[i][j].executeVisitorMemberFunction(visitor);
55329 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
55330 : }
55331 : else
55332 : {
55333 : // printf ("Found a INVALID SgFunctionDefinition object in the memory pool \n");
55334 : }
55335 : }
55336 : }
55337 : }
55338 :
55339 : // This should not be required since all previously static data members are
55340 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
55341 :
55342 194 : }
55343 :
55344 : void
55345 0 : SgFunctionDefinition::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
55346 : {
55347 : // This function visits only a single IR node of the memory pool.
55348 : // it is typically called once for each type of IR node within
55349 : // the automatically generated function: traverseRepresentativeNodes().
55350 :
55351 : // Initialize array to the address of the first element of the STL vector
55352 : // (which is guarenteed to be contiguous storage).
55353 : // SgFunctionDefinition objectArray [] = *(Memory_Block_List.begin());
55354 0 : if (SgFunctionDefinition::pools.empty() == false)
55355 : {
55356 : // Generate an array of memory pools
55357 0 : SgFunctionDefinition** objectArray = (SgFunctionDefinition**) &(SgFunctionDefinition::pools[0]);
55358 :
55359 : // Build a local variable for better performance
55360 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
55361 :
55362 : // Iterate over the memory pools
55363 0 : bool done = false;
55364 0 : unsigned i=0;
55365 :
55366 : // find the first valid IR node, call visit function, and then leave
55367 0 : while ( done == false && i < SgFunctionDefinition::pools.size() )
55368 : {
55369 : // objectArray[i] is a single memory pool
55370 : unsigned j=0;
55371 0 : while (done == false && j < SgFunctionDefinition::pool_size)
55372 : {
55373 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
55374 : {
55375 0 : traversal.visit(&(objectArray[i][j]));
55376 0 : done = true;
55377 : }
55378 0 : j++;
55379 : }
55380 0 : i++;
55381 : }
55382 :
55383 : #if 0
55384 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
55385 : if (done == false)
55386 : {
55387 : printf ("No representative for SgFunctionDefinition found in memory pools \n");
55388 : }
55389 : #endif
55390 : }
55391 0 : }
55392 :
55393 :
55394 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
55395 : // using values that overflow signed values of int.
55396 : size_t
55397 4 : SgFunctionDefinition::numberOfNodes()
55398 : {
55399 : // This function traverses the memory pool for an IR node and
55400 : // counts the number of IR nodes of a particular Sage III IR
55401 : // nodes type.
55402 :
55403 4 : size_t count = 0;
55404 4 : if (SgFunctionDefinition::pools.empty() == false)
55405 : {
55406 : // Generate an array of memory pools (this is actually a STL vector,
55407 : // but it is contiguious, so OK to treat this way).
55408 4 : SgFunctionDefinition** objectArray = (SgFunctionDefinition**) &(SgFunctionDefinition::pools[0]);
55409 :
55410 : // Build a local variable for better performance (make it a loop invariant variable).
55411 4 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
55412 :
55413 : // Iterate over all of the memory pools for this IR node.
55414 8 : for (unsigned int i=0; i < SgFunctionDefinition::pools.size(); i++)
55415 : {
55416 : // objectArray[i] is a single memory pool, iterate over all the
55417 : // IR nodes and only count those that are valid IR nodes used in
55418 : // the AST (i.e. allocated IR nodes).
55419 8004 : for (unsigned j=0; j < SgFunctionDefinition::pool_size; j++)
55420 : {
55421 : // This is indexing the STL vector of C/C++ style arrays as a doubly
55422 : // indexed array access. It is OK since we have leveraged the semantics
55423 : // of STL vector memory as contigous and cast the memory as an array
55424 : // of arrays to use the 2D array indexing. Hope this is not confusing,
55425 : // but it s very fast as an implementation.
55426 8000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
55427 : {
55428 1586 : count++;
55429 : }
55430 : }
55431 : }
55432 : }
55433 :
55434 :
55435 :
55436 4 : return count;
55437 : }
55438 :
55439 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
55440 : // using values that overflow signed values of int.
55441 : size_t
55442 0 : SgFunctionDefinition::memoryUsage()
55443 : {
55444 : // This function is required because we need the class name as a type when we call sizeof
55445 : // There might be another way to implement this if we have a traversal that only called a
55446 : // representative object (one call for each type of Sage IIIIR node).
55447 0 : size_t memory = numberOfNodes() * sizeof(SgFunctionDefinition);
55448 :
55449 0 : return memory;
55450 : }
55451 :
55452 : /* #line 55453 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
55453 :
55454 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
55455 : void
55456 5342 : SgTemplateFunctionDefinition::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
55457 : {
55458 : // This function traverses the memory pool for only a specific IR node
55459 : // and calls the visit function of the input class execute a traversal
55460 : // similar to the style of the attribute based traversals within ROSE.
55461 : // This traversal will visit ALL nodes of the AST where as the other
55462 : // attribute based traversals visit only the embedded tree within the AST.
55463 :
55464 : // Initialize array to the address of the first element of the STL vector
55465 : // (which is guaranteed to be contiguous storage).
55466 : // SgTemplateFunctionDefinition objectArray [] = *(Memory_Block_List.begin());
55467 5342 : if (SgTemplateFunctionDefinition::pools.empty() == false)
55468 : {
55469 : // Generate an array of memory pools
55470 138 : SgTemplateFunctionDefinition** objectArray = (SgTemplateFunctionDefinition**) &(SgTemplateFunctionDefinition::pools[0]);
55471 :
55472 : // Build a local variable for better performance
55473 138 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
55474 : #if 0
55475 : // Iterate over the memory pools
55476 : for (unsigned int i=0; i < SgTemplateFunctionDefinition::pools.size(); i++)
55477 : {
55478 : // objectArray[i] is a single memory pool
55479 : for (int j=0; j < SgTemplateFunctionDefinition::pool_size; j++)
55480 : {
55481 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
55482 : {
55483 : traversal.visit(&(objectArray[i][j]));
55484 : }
55485 : }
55486 : }
55487 : #else
55488 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
55489 : // compute the list first and then call the visit function on each list element.
55490 :
55491 : // printf ("Inside of SgTemplateFunctionDefinition::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
55492 :
55493 276 : std::vector<SgTemplateFunctionDefinition*> nodeList;
55494 :
55495 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
55496 276 : for (unsigned int i=0; i < SgTemplateFunctionDefinition::pools.size(); i++)
55497 : {
55498 : // objectArray[i] is a single memory pool
55499 276138 : for (unsigned j=0; j < SgTemplateFunctionDefinition::pool_size; j++)
55500 : {
55501 276000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
55502 : {
55503 43916 : nodeList.push_back(&(objectArray[i][j]));
55504 : }
55505 : }
55506 : }
55507 :
55508 : // Iterate over the saved list
55509 138 : size_t nodeListSize = nodeList.size();
55510 44054 : for (size_t i=0; i < nodeListSize; i++)
55511 : {
55512 43916 : ROSE_ASSERT(nodeList[i] != NULL);
55513 : #if 0
55514 : traversal.visit(nodeList[i]);
55515 : #else
55516 43916 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
55517 : {
55518 43916 : traversal.visit(nodeList[i]);
55519 : }
55520 : #endif
55521 : }
55522 : #endif
55523 : }
55524 :
55525 : // This should not be required since all previously static data members are
55526 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
55527 :
55528 5342 : }
55529 :
55530 :
55531 : void
55532 194 : SgTemplateFunctionDefinition::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
55533 : {
55534 : // This function traverses the memory pool for an IR node and
55535 : // calls the function to execute the visitor object.
55536 :
55537 : // Initialize array to the address of the first element of the STL vector
55538 : // (which is guarenteed to be contiguous storage).
55539 : // SgTemplateFunctionDefinition objectArray [] = *(Memory_Block_List.begin());
55540 194 : if (SgTemplateFunctionDefinition::pools.empty() == false)
55541 : {
55542 : // Generate an array of memory pools
55543 137 : SgTemplateFunctionDefinition** objectArray = (SgTemplateFunctionDefinition**) &(SgTemplateFunctionDefinition::pools[0]);
55544 :
55545 : // Build a local variable for better performance
55546 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
55547 :
55548 : // Iterate over the memory pools
55549 274 : for (unsigned int i=0; i < SgTemplateFunctionDefinition::pools.size(); i++)
55550 : {
55551 : // objectArray[i] is a single memory pool
55552 274137 : for (unsigned j=0; j < SgTemplateFunctionDefinition::pool_size; j++)
55553 : {
55554 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
55555 : {
55556 : // printf ("Found a valid SgTemplateFunctionDefinition object in the memory pool %d at position %d \n",i,j);
55557 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
55558 44001 : objectArray[i][j].executeVisitorMemberFunction(visitor);
55559 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
55560 : }
55561 : else
55562 : {
55563 : // printf ("Found a INVALID SgTemplateFunctionDefinition object in the memory pool \n");
55564 : }
55565 : }
55566 : }
55567 : }
55568 :
55569 : // This should not be required since all previously static data members are
55570 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
55571 :
55572 194 : }
55573 :
55574 : void
55575 0 : SgTemplateFunctionDefinition::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
55576 : {
55577 : // This function visits only a single IR node of the memory pool.
55578 : // it is typically called once for each type of IR node within
55579 : // the automatically generated function: traverseRepresentativeNodes().
55580 :
55581 : // Initialize array to the address of the first element of the STL vector
55582 : // (which is guarenteed to be contiguous storage).
55583 : // SgTemplateFunctionDefinition objectArray [] = *(Memory_Block_List.begin());
55584 0 : if (SgTemplateFunctionDefinition::pools.empty() == false)
55585 : {
55586 : // Generate an array of memory pools
55587 0 : SgTemplateFunctionDefinition** objectArray = (SgTemplateFunctionDefinition**) &(SgTemplateFunctionDefinition::pools[0]);
55588 :
55589 : // Build a local variable for better performance
55590 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
55591 :
55592 : // Iterate over the memory pools
55593 0 : bool done = false;
55594 0 : unsigned i=0;
55595 :
55596 : // find the first valid IR node, call visit function, and then leave
55597 0 : while ( done == false && i < SgTemplateFunctionDefinition::pools.size() )
55598 : {
55599 : // objectArray[i] is a single memory pool
55600 : unsigned j=0;
55601 0 : while (done == false && j < SgTemplateFunctionDefinition::pool_size)
55602 : {
55603 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
55604 : {
55605 0 : traversal.visit(&(objectArray[i][j]));
55606 0 : done = true;
55607 : }
55608 0 : j++;
55609 : }
55610 0 : i++;
55611 : }
55612 :
55613 : #if 0
55614 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
55615 : if (done == false)
55616 : {
55617 : printf ("No representative for SgTemplateFunctionDefinition found in memory pools \n");
55618 : }
55619 : #endif
55620 : }
55621 0 : }
55622 :
55623 :
55624 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
55625 : // using values that overflow signed values of int.
55626 : size_t
55627 4 : SgTemplateFunctionDefinition::numberOfNodes()
55628 : {
55629 : // This function traverses the memory pool for an IR node and
55630 : // counts the number of IR nodes of a particular Sage III IR
55631 : // nodes type.
55632 :
55633 4 : size_t count = 0;
55634 4 : if (SgTemplateFunctionDefinition::pools.empty() == false)
55635 : {
55636 : // Generate an array of memory pools (this is actually a STL vector,
55637 : // but it is contiguious, so OK to treat this way).
55638 1 : SgTemplateFunctionDefinition** objectArray = (SgTemplateFunctionDefinition**) &(SgTemplateFunctionDefinition::pools[0]);
55639 :
55640 : // Build a local variable for better performance (make it a loop invariant variable).
55641 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
55642 :
55643 : // Iterate over all of the memory pools for this IR node.
55644 2 : for (unsigned int i=0; i < SgTemplateFunctionDefinition::pools.size(); i++)
55645 : {
55646 : // objectArray[i] is a single memory pool, iterate over all the
55647 : // IR nodes and only count those that are valid IR nodes used in
55648 : // the AST (i.e. allocated IR nodes).
55649 2001 : for (unsigned j=0; j < SgTemplateFunctionDefinition::pool_size; j++)
55650 : {
55651 : // This is indexing the STL vector of C/C++ style arrays as a doubly
55652 : // indexed array access. It is OK since we have leveraged the semantics
55653 : // of STL vector memory as contigous and cast the memory as an array
55654 : // of arrays to use the 2D array indexing. Hope this is not confusing,
55655 : // but it s very fast as an implementation.
55656 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
55657 : {
55658 315 : count++;
55659 : }
55660 : }
55661 : }
55662 : }
55663 :
55664 :
55665 :
55666 4 : return count;
55667 : }
55668 :
55669 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
55670 : // using values that overflow signed values of int.
55671 : size_t
55672 0 : SgTemplateFunctionDefinition::memoryUsage()
55673 : {
55674 : // This function is required because we need the class name as a type when we call sizeof
55675 : // There might be another way to implement this if we have a traversal that only called a
55676 : // representative object (one call for each type of Sage IIIIR node).
55677 0 : size_t memory = numberOfNodes() * sizeof(SgTemplateFunctionDefinition);
55678 :
55679 0 : return memory;
55680 : }
55681 :
55682 : /* #line 55683 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
55683 :
55684 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
55685 : void
55686 5379 : SgClassDefinition::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
55687 : {
55688 : // This function traverses the memory pool for only a specific IR node
55689 : // and calls the visit function of the input class execute a traversal
55690 : // similar to the style of the attribute based traversals within ROSE.
55691 : // This traversal will visit ALL nodes of the AST where as the other
55692 : // attribute based traversals visit only the embedded tree within the AST.
55693 :
55694 : // Initialize array to the address of the first element of the STL vector
55695 : // (which is guaranteed to be contiguous storage).
55696 : // SgClassDefinition objectArray [] = *(Memory_Block_List.begin());
55697 5379 : if (SgClassDefinition::pools.empty() == false)
55698 : {
55699 : // Generate an array of memory pools
55700 3105 : SgClassDefinition** objectArray = (SgClassDefinition**) &(SgClassDefinition::pools[0]);
55701 :
55702 : // Build a local variable for better performance
55703 3105 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
55704 : #if 0
55705 : // Iterate over the memory pools
55706 : for (unsigned int i=0; i < SgClassDefinition::pools.size(); i++)
55707 : {
55708 : // objectArray[i] is a single memory pool
55709 : for (int j=0; j < SgClassDefinition::pool_size; j++)
55710 : {
55711 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
55712 : {
55713 : traversal.visit(&(objectArray[i][j]));
55714 : }
55715 : }
55716 : }
55717 : #else
55718 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
55719 : // compute the list first and then call the visit function on each list element.
55720 :
55721 : // printf ("Inside of SgClassDefinition::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
55722 :
55723 6210 : std::vector<SgClassDefinition*> nodeList;
55724 :
55725 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
55726 6210 : for (unsigned int i=0; i < SgClassDefinition::pools.size(); i++)
55727 : {
55728 : // objectArray[i] is a single memory pool
55729 6213100 : for (unsigned j=0; j < SgClassDefinition::pool_size; j++)
55730 : {
55731 6210000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
55732 : {
55733 100265 : nodeList.push_back(&(objectArray[i][j]));
55734 : }
55735 : }
55736 : }
55737 :
55738 : // Iterate over the saved list
55739 3105 : size_t nodeListSize = nodeList.size();
55740 103370 : for (size_t i=0; i < nodeListSize; i++)
55741 : {
55742 100265 : ROSE_ASSERT(nodeList[i] != NULL);
55743 : #if 0
55744 : traversal.visit(nodeList[i]);
55745 : #else
55746 100265 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
55747 : {
55748 100265 : traversal.visit(nodeList[i]);
55749 : }
55750 : #endif
55751 : }
55752 : #endif
55753 : }
55754 :
55755 : // This should not be required since all previously static data members are
55756 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
55757 :
55758 5379 : }
55759 :
55760 :
55761 : void
55762 194 : SgClassDefinition::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
55763 : {
55764 : // This function traverses the memory pool for an IR node and
55765 : // calls the function to execute the visitor object.
55766 :
55767 : // Initialize array to the address of the first element of the STL vector
55768 : // (which is guarenteed to be contiguous storage).
55769 : // SgClassDefinition objectArray [] = *(Memory_Block_List.begin());
55770 194 : if (SgClassDefinition::pools.empty() == false)
55771 : {
55772 : // Generate an array of memory pools
55773 137 : SgClassDefinition** objectArray = (SgClassDefinition**) &(SgClassDefinition::pools[0]);
55774 :
55775 : // Build a local variable for better performance
55776 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
55777 :
55778 : // Iterate over the memory pools
55779 274 : for (unsigned int i=0; i < SgClassDefinition::pools.size(); i++)
55780 : {
55781 : // objectArray[i] is a single memory pool
55782 274137 : for (unsigned j=0; j < SgClassDefinition::pool_size; j++)
55783 : {
55784 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
55785 : {
55786 : // printf ("Found a valid SgClassDefinition object in the memory pool %d at position %d \n",i,j);
55787 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
55788 22423 : objectArray[i][j].executeVisitorMemberFunction(visitor);
55789 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
55790 : }
55791 : else
55792 : {
55793 : // printf ("Found a INVALID SgClassDefinition object in the memory pool \n");
55794 : }
55795 : }
55796 : }
55797 : }
55798 :
55799 : // This should not be required since all previously static data members are
55800 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
55801 :
55802 194 : }
55803 :
55804 : void
55805 0 : SgClassDefinition::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
55806 : {
55807 : // This function visits only a single IR node of the memory pool.
55808 : // it is typically called once for each type of IR node within
55809 : // the automatically generated function: traverseRepresentativeNodes().
55810 :
55811 : // Initialize array to the address of the first element of the STL vector
55812 : // (which is guarenteed to be contiguous storage).
55813 : // SgClassDefinition objectArray [] = *(Memory_Block_List.begin());
55814 0 : if (SgClassDefinition::pools.empty() == false)
55815 : {
55816 : // Generate an array of memory pools
55817 0 : SgClassDefinition** objectArray = (SgClassDefinition**) &(SgClassDefinition::pools[0]);
55818 :
55819 : // Build a local variable for better performance
55820 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
55821 :
55822 : // Iterate over the memory pools
55823 0 : bool done = false;
55824 0 : unsigned i=0;
55825 :
55826 : // find the first valid IR node, call visit function, and then leave
55827 0 : while ( done == false && i < SgClassDefinition::pools.size() )
55828 : {
55829 : // objectArray[i] is a single memory pool
55830 : unsigned j=0;
55831 0 : while (done == false && j < SgClassDefinition::pool_size)
55832 : {
55833 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
55834 : {
55835 0 : traversal.visit(&(objectArray[i][j]));
55836 0 : done = true;
55837 : }
55838 0 : j++;
55839 : }
55840 0 : i++;
55841 : }
55842 :
55843 : #if 0
55844 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
55845 : if (done == false)
55846 : {
55847 : printf ("No representative for SgClassDefinition found in memory pools \n");
55848 : }
55849 : #endif
55850 : }
55851 0 : }
55852 :
55853 :
55854 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
55855 : // using values that overflow signed values of int.
55856 : size_t
55857 4 : SgClassDefinition::numberOfNodes()
55858 : {
55859 : // This function traverses the memory pool for an IR node and
55860 : // counts the number of IR nodes of a particular Sage III IR
55861 : // nodes type.
55862 :
55863 4 : size_t count = 0;
55864 4 : if (SgClassDefinition::pools.empty() == false)
55865 : {
55866 : // Generate an array of memory pools (this is actually a STL vector,
55867 : // but it is contiguious, so OK to treat this way).
55868 2 : SgClassDefinition** objectArray = (SgClassDefinition**) &(SgClassDefinition::pools[0]);
55869 :
55870 : // Build a local variable for better performance (make it a loop invariant variable).
55871 2 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
55872 :
55873 : // Iterate over all of the memory pools for this IR node.
55874 4 : for (unsigned int i=0; i < SgClassDefinition::pools.size(); i++)
55875 : {
55876 : // objectArray[i] is a single memory pool, iterate over all the
55877 : // IR nodes and only count those that are valid IR nodes used in
55878 : // the AST (i.e. allocated IR nodes).
55879 4002 : for (unsigned j=0; j < SgClassDefinition::pool_size; j++)
55880 : {
55881 : // This is indexing the STL vector of C/C++ style arrays as a doubly
55882 : // indexed array access. It is OK since we have leveraged the semantics
55883 : // of STL vector memory as contigous and cast the memory as an array
55884 : // of arrays to use the 2D array indexing. Hope this is not confusing,
55885 : // but it s very fast as an implementation.
55886 4000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
55887 : {
55888 168 : count++;
55889 : }
55890 : }
55891 : }
55892 : }
55893 :
55894 :
55895 :
55896 4 : return count;
55897 : }
55898 :
55899 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
55900 : // using values that overflow signed values of int.
55901 : size_t
55902 0 : SgClassDefinition::memoryUsage()
55903 : {
55904 : // This function is required because we need the class name as a type when we call sizeof
55905 : // There might be another way to implement this if we have a traversal that only called a
55906 : // representative object (one call for each type of Sage IIIIR node).
55907 0 : size_t memory = numberOfNodes() * sizeof(SgClassDefinition);
55908 :
55909 0 : return memory;
55910 : }
55911 :
55912 : /* #line 55913 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
55913 :
55914 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
55915 : void
55916 5342 : SgTemplateInstantiationDefn::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
55917 : {
55918 : // This function traverses the memory pool for only a specific IR node
55919 : // and calls the visit function of the input class execute a traversal
55920 : // similar to the style of the attribute based traversals within ROSE.
55921 : // This traversal will visit ALL nodes of the AST where as the other
55922 : // attribute based traversals visit only the embedded tree within the AST.
55923 :
55924 : // Initialize array to the address of the first element of the STL vector
55925 : // (which is guaranteed to be contiguous storage).
55926 : // SgTemplateInstantiationDefn objectArray [] = *(Memory_Block_List.begin());
55927 5342 : if (SgTemplateInstantiationDefn::pools.empty() == false)
55928 : {
55929 : // Generate an array of memory pools
55930 138 : SgTemplateInstantiationDefn** objectArray = (SgTemplateInstantiationDefn**) &(SgTemplateInstantiationDefn::pools[0]);
55931 :
55932 : // Build a local variable for better performance
55933 138 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
55934 : #if 0
55935 : // Iterate over the memory pools
55936 : for (unsigned int i=0; i < SgTemplateInstantiationDefn::pools.size(); i++)
55937 : {
55938 : // objectArray[i] is a single memory pool
55939 : for (int j=0; j < SgTemplateInstantiationDefn::pool_size; j++)
55940 : {
55941 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
55942 : {
55943 : traversal.visit(&(objectArray[i][j]));
55944 : }
55945 : }
55946 : }
55947 : #else
55948 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
55949 : // compute the list first and then call the visit function on each list element.
55950 :
55951 : // printf ("Inside of SgTemplateInstantiationDefn::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
55952 :
55953 276 : std::vector<SgTemplateInstantiationDefn*> nodeList;
55954 :
55955 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
55956 276 : for (unsigned int i=0; i < SgTemplateInstantiationDefn::pools.size(); i++)
55957 : {
55958 : // objectArray[i] is a single memory pool
55959 276138 : for (unsigned j=0; j < SgTemplateInstantiationDefn::pool_size; j++)
55960 : {
55961 276000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
55962 : {
55963 76006 : nodeList.push_back(&(objectArray[i][j]));
55964 : }
55965 : }
55966 : }
55967 :
55968 : // Iterate over the saved list
55969 138 : size_t nodeListSize = nodeList.size();
55970 76144 : for (size_t i=0; i < nodeListSize; i++)
55971 : {
55972 76006 : ROSE_ASSERT(nodeList[i] != NULL);
55973 : #if 0
55974 : traversal.visit(nodeList[i]);
55975 : #else
55976 76006 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
55977 : {
55978 76006 : traversal.visit(nodeList[i]);
55979 : }
55980 : #endif
55981 : }
55982 : #endif
55983 : }
55984 :
55985 : // This should not be required since all previously static data members are
55986 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
55987 :
55988 5342 : }
55989 :
55990 :
55991 : void
55992 194 : SgTemplateInstantiationDefn::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
55993 : {
55994 : // This function traverses the memory pool for an IR node and
55995 : // calls the function to execute the visitor object.
55996 :
55997 : // Initialize array to the address of the first element of the STL vector
55998 : // (which is guarenteed to be contiguous storage).
55999 : // SgTemplateInstantiationDefn objectArray [] = *(Memory_Block_List.begin());
56000 194 : if (SgTemplateInstantiationDefn::pools.empty() == false)
56001 : {
56002 : // Generate an array of memory pools
56003 137 : SgTemplateInstantiationDefn** objectArray = (SgTemplateInstantiationDefn**) &(SgTemplateInstantiationDefn::pools[0]);
56004 :
56005 : // Build a local variable for better performance
56006 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
56007 :
56008 : // Iterate over the memory pools
56009 274 : for (unsigned int i=0; i < SgTemplateInstantiationDefn::pools.size(); i++)
56010 : {
56011 : // objectArray[i] is a single memory pool
56012 274137 : for (unsigned j=0; j < SgTemplateInstantiationDefn::pool_size; j++)
56013 : {
56014 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
56015 : {
56016 : // printf ("Found a valid SgTemplateInstantiationDefn object in the memory pool %d at position %d \n",i,j);
56017 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
56018 83252 : objectArray[i][j].executeVisitorMemberFunction(visitor);
56019 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
56020 : }
56021 : else
56022 : {
56023 : // printf ("Found a INVALID SgTemplateInstantiationDefn object in the memory pool \n");
56024 : }
56025 : }
56026 : }
56027 : }
56028 :
56029 : // This should not be required since all previously static data members are
56030 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
56031 :
56032 194 : }
56033 :
56034 : void
56035 0 : SgTemplateInstantiationDefn::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
56036 : {
56037 : // This function visits only a single IR node of the memory pool.
56038 : // it is typically called once for each type of IR node within
56039 : // the automatically generated function: traverseRepresentativeNodes().
56040 :
56041 : // Initialize array to the address of the first element of the STL vector
56042 : // (which is guarenteed to be contiguous storage).
56043 : // SgTemplateInstantiationDefn objectArray [] = *(Memory_Block_List.begin());
56044 0 : if (SgTemplateInstantiationDefn::pools.empty() == false)
56045 : {
56046 : // Generate an array of memory pools
56047 0 : SgTemplateInstantiationDefn** objectArray = (SgTemplateInstantiationDefn**) &(SgTemplateInstantiationDefn::pools[0]);
56048 :
56049 : // Build a local variable for better performance
56050 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
56051 :
56052 : // Iterate over the memory pools
56053 0 : bool done = false;
56054 0 : unsigned i=0;
56055 :
56056 : // find the first valid IR node, call visit function, and then leave
56057 0 : while ( done == false && i < SgTemplateInstantiationDefn::pools.size() )
56058 : {
56059 : // objectArray[i] is a single memory pool
56060 : unsigned j=0;
56061 0 : while (done == false && j < SgTemplateInstantiationDefn::pool_size)
56062 : {
56063 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
56064 : {
56065 0 : traversal.visit(&(objectArray[i][j]));
56066 0 : done = true;
56067 : }
56068 0 : j++;
56069 : }
56070 0 : i++;
56071 : }
56072 :
56073 : #if 0
56074 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
56075 : if (done == false)
56076 : {
56077 : printf ("No representative for SgTemplateInstantiationDefn found in memory pools \n");
56078 : }
56079 : #endif
56080 : }
56081 0 : }
56082 :
56083 :
56084 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
56085 : // using values that overflow signed values of int.
56086 : size_t
56087 4 : SgTemplateInstantiationDefn::numberOfNodes()
56088 : {
56089 : // This function traverses the memory pool for an IR node and
56090 : // counts the number of IR nodes of a particular Sage III IR
56091 : // nodes type.
56092 :
56093 4 : size_t count = 0;
56094 4 : if (SgTemplateInstantiationDefn::pools.empty() == false)
56095 : {
56096 : // Generate an array of memory pools (this is actually a STL vector,
56097 : // but it is contiguious, so OK to treat this way).
56098 1 : SgTemplateInstantiationDefn** objectArray = (SgTemplateInstantiationDefn**) &(SgTemplateInstantiationDefn::pools[0]);
56099 :
56100 : // Build a local variable for better performance (make it a loop invariant variable).
56101 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
56102 :
56103 : // Iterate over all of the memory pools for this IR node.
56104 2 : for (unsigned int i=0; i < SgTemplateInstantiationDefn::pools.size(); i++)
56105 : {
56106 : // objectArray[i] is a single memory pool, iterate over all the
56107 : // IR nodes and only count those that are valid IR nodes used in
56108 : // the AST (i.e. allocated IR nodes).
56109 2001 : for (unsigned j=0; j < SgTemplateInstantiationDefn::pool_size; j++)
56110 : {
56111 : // This is indexing the STL vector of C/C++ style arrays as a doubly
56112 : // indexed array access. It is OK since we have leveraged the semantics
56113 : // of STL vector memory as contigous and cast the memory as an array
56114 : // of arrays to use the 2D array indexing. Hope this is not confusing,
56115 : // but it s very fast as an implementation.
56116 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
56117 : {
56118 601 : count++;
56119 : }
56120 : }
56121 : }
56122 : }
56123 :
56124 :
56125 :
56126 4 : return count;
56127 : }
56128 :
56129 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
56130 : // using values that overflow signed values of int.
56131 : size_t
56132 0 : SgTemplateInstantiationDefn::memoryUsage()
56133 : {
56134 : // This function is required because we need the class name as a type when we call sizeof
56135 : // There might be another way to implement this if we have a traversal that only called a
56136 : // representative object (one call for each type of Sage IIIIR node).
56137 0 : size_t memory = numberOfNodes() * sizeof(SgTemplateInstantiationDefn);
56138 :
56139 0 : return memory;
56140 : }
56141 :
56142 : /* #line 56143 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
56143 :
56144 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
56145 : void
56146 5342 : SgTemplateClassDefinition::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
56147 : {
56148 : // This function traverses the memory pool for only a specific IR node
56149 : // and calls the visit function of the input class execute a traversal
56150 : // similar to the style of the attribute based traversals within ROSE.
56151 : // This traversal will visit ALL nodes of the AST where as the other
56152 : // attribute based traversals visit only the embedded tree within the AST.
56153 :
56154 : // Initialize array to the address of the first element of the STL vector
56155 : // (which is guaranteed to be contiguous storage).
56156 : // SgTemplateClassDefinition objectArray [] = *(Memory_Block_List.begin());
56157 5342 : if (SgTemplateClassDefinition::pools.empty() == false)
56158 : {
56159 : // Generate an array of memory pools
56160 145 : SgTemplateClassDefinition** objectArray = (SgTemplateClassDefinition**) &(SgTemplateClassDefinition::pools[0]);
56161 :
56162 : // Build a local variable for better performance
56163 145 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
56164 : #if 0
56165 : // Iterate over the memory pools
56166 : for (unsigned int i=0; i < SgTemplateClassDefinition::pools.size(); i++)
56167 : {
56168 : // objectArray[i] is a single memory pool
56169 : for (int j=0; j < SgTemplateClassDefinition::pool_size; j++)
56170 : {
56171 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
56172 : {
56173 : traversal.visit(&(objectArray[i][j]));
56174 : }
56175 : }
56176 : }
56177 : #else
56178 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
56179 : // compute the list first and then call the visit function on each list element.
56180 :
56181 : // printf ("Inside of SgTemplateClassDefinition::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
56182 :
56183 290 : std::vector<SgTemplateClassDefinition*> nodeList;
56184 :
56185 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
56186 290 : for (unsigned int i=0; i < SgTemplateClassDefinition::pools.size(); i++)
56187 : {
56188 : // objectArray[i] is a single memory pool
56189 290145 : for (unsigned j=0; j < SgTemplateClassDefinition::pool_size; j++)
56190 : {
56191 290000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
56192 : {
56193 68184 : nodeList.push_back(&(objectArray[i][j]));
56194 : }
56195 : }
56196 : }
56197 :
56198 : // Iterate over the saved list
56199 145 : size_t nodeListSize = nodeList.size();
56200 68329 : for (size_t i=0; i < nodeListSize; i++)
56201 : {
56202 68184 : ROSE_ASSERT(nodeList[i] != NULL);
56203 : #if 0
56204 : traversal.visit(nodeList[i]);
56205 : #else
56206 68184 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
56207 : {
56208 68184 : traversal.visit(nodeList[i]);
56209 : }
56210 : #endif
56211 : }
56212 : #endif
56213 : }
56214 :
56215 : // This should not be required since all previously static data members are
56216 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
56217 :
56218 5342 : }
56219 :
56220 :
56221 : void
56222 194 : SgTemplateClassDefinition::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
56223 : {
56224 : // This function traverses the memory pool for an IR node and
56225 : // calls the function to execute the visitor object.
56226 :
56227 : // Initialize array to the address of the first element of the STL vector
56228 : // (which is guarenteed to be contiguous storage).
56229 : // SgTemplateClassDefinition objectArray [] = *(Memory_Block_List.begin());
56230 194 : if (SgTemplateClassDefinition::pools.empty() == false)
56231 : {
56232 : // Generate an array of memory pools
56233 137 : SgTemplateClassDefinition** objectArray = (SgTemplateClassDefinition**) &(SgTemplateClassDefinition::pools[0]);
56234 :
56235 : // Build a local variable for better performance
56236 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
56237 :
56238 : // Iterate over the memory pools
56239 274 : for (unsigned int i=0; i < SgTemplateClassDefinition::pools.size(); i++)
56240 : {
56241 : // objectArray[i] is a single memory pool
56242 274137 : for (unsigned j=0; j < SgTemplateClassDefinition::pool_size; j++)
56243 : {
56244 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
56245 : {
56246 : // printf ("Found a valid SgTemplateClassDefinition object in the memory pool %d at position %d \n",i,j);
56247 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
56248 69700 : objectArray[i][j].executeVisitorMemberFunction(visitor);
56249 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
56250 : }
56251 : else
56252 : {
56253 : // printf ("Found a INVALID SgTemplateClassDefinition object in the memory pool \n");
56254 : }
56255 : }
56256 : }
56257 : }
56258 :
56259 : // This should not be required since all previously static data members are
56260 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
56261 :
56262 194 : }
56263 :
56264 : void
56265 0 : SgTemplateClassDefinition::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
56266 : {
56267 : // This function visits only a single IR node of the memory pool.
56268 : // it is typically called once for each type of IR node within
56269 : // the automatically generated function: traverseRepresentativeNodes().
56270 :
56271 : // Initialize array to the address of the first element of the STL vector
56272 : // (which is guarenteed to be contiguous storage).
56273 : // SgTemplateClassDefinition objectArray [] = *(Memory_Block_List.begin());
56274 0 : if (SgTemplateClassDefinition::pools.empty() == false)
56275 : {
56276 : // Generate an array of memory pools
56277 0 : SgTemplateClassDefinition** objectArray = (SgTemplateClassDefinition**) &(SgTemplateClassDefinition::pools[0]);
56278 :
56279 : // Build a local variable for better performance
56280 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
56281 :
56282 : // Iterate over the memory pools
56283 0 : bool done = false;
56284 0 : unsigned i=0;
56285 :
56286 : // find the first valid IR node, call visit function, and then leave
56287 0 : while ( done == false && i < SgTemplateClassDefinition::pools.size() )
56288 : {
56289 : // objectArray[i] is a single memory pool
56290 : unsigned j=0;
56291 0 : while (done == false && j < SgTemplateClassDefinition::pool_size)
56292 : {
56293 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
56294 : {
56295 0 : traversal.visit(&(objectArray[i][j]));
56296 0 : done = true;
56297 : }
56298 0 : j++;
56299 : }
56300 0 : i++;
56301 : }
56302 :
56303 : #if 0
56304 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
56305 : if (done == false)
56306 : {
56307 : printf ("No representative for SgTemplateClassDefinition found in memory pools \n");
56308 : }
56309 : #endif
56310 : }
56311 0 : }
56312 :
56313 :
56314 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
56315 : // using values that overflow signed values of int.
56316 : size_t
56317 4 : SgTemplateClassDefinition::numberOfNodes()
56318 : {
56319 : // This function traverses the memory pool for an IR node and
56320 : // counts the number of IR nodes of a particular Sage III IR
56321 : // nodes type.
56322 :
56323 4 : size_t count = 0;
56324 4 : if (SgTemplateClassDefinition::pools.empty() == false)
56325 : {
56326 : // Generate an array of memory pools (this is actually a STL vector,
56327 : // but it is contiguious, so OK to treat this way).
56328 1 : SgTemplateClassDefinition** objectArray = (SgTemplateClassDefinition**) &(SgTemplateClassDefinition::pools[0]);
56329 :
56330 : // Build a local variable for better performance (make it a loop invariant variable).
56331 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
56332 :
56333 : // Iterate over all of the memory pools for this IR node.
56334 2 : for (unsigned int i=0; i < SgTemplateClassDefinition::pools.size(); i++)
56335 : {
56336 : // objectArray[i] is a single memory pool, iterate over all the
56337 : // IR nodes and only count those that are valid IR nodes used in
56338 : // the AST (i.e. allocated IR nodes).
56339 2001 : for (unsigned j=0; j < SgTemplateClassDefinition::pool_size; j++)
56340 : {
56341 : // This is indexing the STL vector of C/C++ style arrays as a doubly
56342 : // indexed array access. It is OK since we have leveraged the semantics
56343 : // of STL vector memory as contigous and cast the memory as an array
56344 : // of arrays to use the 2D array indexing. Hope this is not confusing,
56345 : // but it s very fast as an implementation.
56346 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
56347 : {
56348 506 : count++;
56349 : }
56350 : }
56351 : }
56352 : }
56353 :
56354 :
56355 :
56356 4 : return count;
56357 : }
56358 :
56359 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
56360 : // using values that overflow signed values of int.
56361 : size_t
56362 0 : SgTemplateClassDefinition::memoryUsage()
56363 : {
56364 : // This function is required because we need the class name as a type when we call sizeof
56365 : // There might be another way to implement this if we have a traversal that only called a
56366 : // representative object (one call for each type of Sage IIIIR node).
56367 0 : size_t memory = numberOfNodes() * sizeof(SgTemplateClassDefinition);
56368 :
56369 0 : return memory;
56370 : }
56371 :
56372 : /* #line 56373 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
56373 :
56374 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
56375 : void
56376 5342 : SgWhileStmt::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
56377 : {
56378 : // This function traverses the memory pool for only a specific IR node
56379 : // and calls the visit function of the input class execute a traversal
56380 : // similar to the style of the attribute based traversals within ROSE.
56381 : // This traversal will visit ALL nodes of the AST where as the other
56382 : // attribute based traversals visit only the embedded tree within the AST.
56383 :
56384 : // Initialize array to the address of the first element of the STL vector
56385 : // (which is guaranteed to be contiguous storage).
56386 : // SgWhileStmt objectArray [] = *(Memory_Block_List.begin());
56387 5342 : if (SgWhileStmt::pools.empty() == false)
56388 : {
56389 : // Generate an array of memory pools
56390 400 : SgWhileStmt** objectArray = (SgWhileStmt**) &(SgWhileStmt::pools[0]);
56391 :
56392 : // Build a local variable for better performance
56393 400 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
56394 : #if 0
56395 : // Iterate over the memory pools
56396 : for (unsigned int i=0; i < SgWhileStmt::pools.size(); i++)
56397 : {
56398 : // objectArray[i] is a single memory pool
56399 : for (int j=0; j < SgWhileStmt::pool_size; j++)
56400 : {
56401 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
56402 : {
56403 : traversal.visit(&(objectArray[i][j]));
56404 : }
56405 : }
56406 : }
56407 : #else
56408 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
56409 : // compute the list first and then call the visit function on each list element.
56410 :
56411 : // printf ("Inside of SgWhileStmt::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
56412 :
56413 800 : std::vector<SgWhileStmt*> nodeList;
56414 :
56415 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
56416 800 : for (unsigned int i=0; i < SgWhileStmt::pools.size(); i++)
56417 : {
56418 : // objectArray[i] is a single memory pool
56419 800400 : for (unsigned j=0; j < SgWhileStmt::pool_size; j++)
56420 : {
56421 800000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
56422 : {
56423 5906 : nodeList.push_back(&(objectArray[i][j]));
56424 : }
56425 : }
56426 : }
56427 :
56428 : // Iterate over the saved list
56429 400 : size_t nodeListSize = nodeList.size();
56430 6306 : for (size_t i=0; i < nodeListSize; i++)
56431 : {
56432 5906 : ROSE_ASSERT(nodeList[i] != NULL);
56433 : #if 0
56434 : traversal.visit(nodeList[i]);
56435 : #else
56436 5906 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
56437 : {
56438 5906 : traversal.visit(nodeList[i]);
56439 : }
56440 : #endif
56441 : }
56442 : #endif
56443 : }
56444 :
56445 : // This should not be required since all previously static data members are
56446 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
56447 :
56448 5342 : }
56449 :
56450 :
56451 : void
56452 194 : SgWhileStmt::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
56453 : {
56454 : // This function traverses the memory pool for an IR node and
56455 : // calls the function to execute the visitor object.
56456 :
56457 : // Initialize array to the address of the first element of the STL vector
56458 : // (which is guarenteed to be contiguous storage).
56459 : // SgWhileStmt objectArray [] = *(Memory_Block_List.begin());
56460 194 : if (SgWhileStmt::pools.empty() == false)
56461 : {
56462 : // Generate an array of memory pools
56463 137 : SgWhileStmt** objectArray = (SgWhileStmt**) &(SgWhileStmt::pools[0]);
56464 :
56465 : // Build a local variable for better performance
56466 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
56467 :
56468 : // Iterate over the memory pools
56469 274 : for (unsigned int i=0; i < SgWhileStmt::pools.size(); i++)
56470 : {
56471 : // objectArray[i] is a single memory pool
56472 274137 : for (unsigned j=0; j < SgWhileStmt::pool_size; j++)
56473 : {
56474 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
56475 : {
56476 : // printf ("Found a valid SgWhileStmt object in the memory pool %d at position %d \n",i,j);
56477 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
56478 6457 : objectArray[i][j].executeVisitorMemberFunction(visitor);
56479 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
56480 : }
56481 : else
56482 : {
56483 : // printf ("Found a INVALID SgWhileStmt object in the memory pool \n");
56484 : }
56485 : }
56486 : }
56487 : }
56488 :
56489 : // This should not be required since all previously static data members are
56490 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
56491 :
56492 194 : }
56493 :
56494 : void
56495 0 : SgWhileStmt::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
56496 : {
56497 : // This function visits only a single IR node of the memory pool.
56498 : // it is typically called once for each type of IR node within
56499 : // the automatically generated function: traverseRepresentativeNodes().
56500 :
56501 : // Initialize array to the address of the first element of the STL vector
56502 : // (which is guarenteed to be contiguous storage).
56503 : // SgWhileStmt objectArray [] = *(Memory_Block_List.begin());
56504 0 : if (SgWhileStmt::pools.empty() == false)
56505 : {
56506 : // Generate an array of memory pools
56507 0 : SgWhileStmt** objectArray = (SgWhileStmt**) &(SgWhileStmt::pools[0]);
56508 :
56509 : // Build a local variable for better performance
56510 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
56511 :
56512 : // Iterate over the memory pools
56513 0 : bool done = false;
56514 0 : unsigned i=0;
56515 :
56516 : // find the first valid IR node, call visit function, and then leave
56517 0 : while ( done == false && i < SgWhileStmt::pools.size() )
56518 : {
56519 : // objectArray[i] is a single memory pool
56520 : unsigned j=0;
56521 0 : while (done == false && j < SgWhileStmt::pool_size)
56522 : {
56523 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
56524 : {
56525 0 : traversal.visit(&(objectArray[i][j]));
56526 0 : done = true;
56527 : }
56528 0 : j++;
56529 : }
56530 0 : i++;
56531 : }
56532 :
56533 : #if 0
56534 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
56535 : if (done == false)
56536 : {
56537 : printf ("No representative for SgWhileStmt found in memory pools \n");
56538 : }
56539 : #endif
56540 : }
56541 0 : }
56542 :
56543 :
56544 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
56545 : // using values that overflow signed values of int.
56546 : size_t
56547 4 : SgWhileStmt::numberOfNodes()
56548 : {
56549 : // This function traverses the memory pool for an IR node and
56550 : // counts the number of IR nodes of a particular Sage III IR
56551 : // nodes type.
56552 :
56553 4 : size_t count = 0;
56554 4 : if (SgWhileStmt::pools.empty() == false)
56555 : {
56556 : // Generate an array of memory pools (this is actually a STL vector,
56557 : // but it is contiguious, so OK to treat this way).
56558 1 : SgWhileStmt** objectArray = (SgWhileStmt**) &(SgWhileStmt::pools[0]);
56559 :
56560 : // Build a local variable for better performance (make it a loop invariant variable).
56561 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
56562 :
56563 : // Iterate over all of the memory pools for this IR node.
56564 2 : for (unsigned int i=0; i < SgWhileStmt::pools.size(); i++)
56565 : {
56566 : // objectArray[i] is a single memory pool, iterate over all the
56567 : // IR nodes and only count those that are valid IR nodes used in
56568 : // the AST (i.e. allocated IR nodes).
56569 2001 : for (unsigned j=0; j < SgWhileStmt::pool_size; j++)
56570 : {
56571 : // This is indexing the STL vector of C/C++ style arrays as a doubly
56572 : // indexed array access. It is OK since we have leveraged the semantics
56573 : // of STL vector memory as contigous and cast the memory as an array
56574 : // of arrays to use the 2D array indexing. Hope this is not confusing,
56575 : // but it s very fast as an implementation.
56576 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
56577 : {
56578 47 : count++;
56579 : }
56580 : }
56581 : }
56582 : }
56583 :
56584 :
56585 :
56586 4 : return count;
56587 : }
56588 :
56589 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
56590 : // using values that overflow signed values of int.
56591 : size_t
56592 0 : SgWhileStmt::memoryUsage()
56593 : {
56594 : // This function is required because we need the class name as a type when we call sizeof
56595 : // There might be another way to implement this if we have a traversal that only called a
56596 : // representative object (one call for each type of Sage IIIIR node).
56597 0 : size_t memory = numberOfNodes() * sizeof(SgWhileStmt);
56598 :
56599 0 : return memory;
56600 : }
56601 :
56602 : /* #line 56603 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
56603 :
56604 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
56605 : void
56606 5342 : SgDoWhileStmt::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
56607 : {
56608 : // This function traverses the memory pool for only a specific IR node
56609 : // and calls the visit function of the input class execute a traversal
56610 : // similar to the style of the attribute based traversals within ROSE.
56611 : // This traversal will visit ALL nodes of the AST where as the other
56612 : // attribute based traversals visit only the embedded tree within the AST.
56613 :
56614 : // Initialize array to the address of the first element of the STL vector
56615 : // (which is guaranteed to be contiguous storage).
56616 : // SgDoWhileStmt objectArray [] = *(Memory_Block_List.begin());
56617 5342 : if (SgDoWhileStmt::pools.empty() == false)
56618 : {
56619 : // Generate an array of memory pools
56620 122 : SgDoWhileStmt** objectArray = (SgDoWhileStmt**) &(SgDoWhileStmt::pools[0]);
56621 :
56622 : // Build a local variable for better performance
56623 122 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
56624 : #if 0
56625 : // Iterate over the memory pools
56626 : for (unsigned int i=0; i < SgDoWhileStmt::pools.size(); i++)
56627 : {
56628 : // objectArray[i] is a single memory pool
56629 : for (int j=0; j < SgDoWhileStmt::pool_size; j++)
56630 : {
56631 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
56632 : {
56633 : traversal.visit(&(objectArray[i][j]));
56634 : }
56635 : }
56636 : }
56637 : #else
56638 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
56639 : // compute the list first and then call the visit function on each list element.
56640 :
56641 : // printf ("Inside of SgDoWhileStmt::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
56642 :
56643 244 : std::vector<SgDoWhileStmt*> nodeList;
56644 :
56645 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
56646 244 : for (unsigned int i=0; i < SgDoWhileStmt::pools.size(); i++)
56647 : {
56648 : // objectArray[i] is a single memory pool
56649 244122 : for (unsigned j=0; j < SgDoWhileStmt::pool_size; j++)
56650 : {
56651 244000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
56652 : {
56653 821 : nodeList.push_back(&(objectArray[i][j]));
56654 : }
56655 : }
56656 : }
56657 :
56658 : // Iterate over the saved list
56659 122 : size_t nodeListSize = nodeList.size();
56660 943 : for (size_t i=0; i < nodeListSize; i++)
56661 : {
56662 821 : ROSE_ASSERT(nodeList[i] != NULL);
56663 : #if 0
56664 : traversal.visit(nodeList[i]);
56665 : #else
56666 821 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
56667 : {
56668 821 : traversal.visit(nodeList[i]);
56669 : }
56670 : #endif
56671 : }
56672 : #endif
56673 : }
56674 :
56675 : // This should not be required since all previously static data members are
56676 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
56677 :
56678 5342 : }
56679 :
56680 :
56681 : void
56682 194 : SgDoWhileStmt::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
56683 : {
56684 : // This function traverses the memory pool for an IR node and
56685 : // calls the function to execute the visitor object.
56686 :
56687 : // Initialize array to the address of the first element of the STL vector
56688 : // (which is guarenteed to be contiguous storage).
56689 : // SgDoWhileStmt objectArray [] = *(Memory_Block_List.begin());
56690 194 : if (SgDoWhileStmt::pools.empty() == false)
56691 : {
56692 : // Generate an array of memory pools
56693 137 : SgDoWhileStmt** objectArray = (SgDoWhileStmt**) &(SgDoWhileStmt::pools[0]);
56694 :
56695 : // Build a local variable for better performance
56696 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
56697 :
56698 : // Iterate over the memory pools
56699 274 : for (unsigned int i=0; i < SgDoWhileStmt::pools.size(); i++)
56700 : {
56701 : // objectArray[i] is a single memory pool
56702 274137 : for (unsigned j=0; j < SgDoWhileStmt::pool_size; j++)
56703 : {
56704 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
56705 : {
56706 : // printf ("Found a valid SgDoWhileStmt object in the memory pool %d at position %d \n",i,j);
56707 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
56708 977 : objectArray[i][j].executeVisitorMemberFunction(visitor);
56709 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
56710 : }
56711 : else
56712 : {
56713 : // printf ("Found a INVALID SgDoWhileStmt object in the memory pool \n");
56714 : }
56715 : }
56716 : }
56717 : }
56718 :
56719 : // This should not be required since all previously static data members are
56720 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
56721 :
56722 194 : }
56723 :
56724 : void
56725 0 : SgDoWhileStmt::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
56726 : {
56727 : // This function visits only a single IR node of the memory pool.
56728 : // it is typically called once for each type of IR node within
56729 : // the automatically generated function: traverseRepresentativeNodes().
56730 :
56731 : // Initialize array to the address of the first element of the STL vector
56732 : // (which is guarenteed to be contiguous storage).
56733 : // SgDoWhileStmt objectArray [] = *(Memory_Block_List.begin());
56734 0 : if (SgDoWhileStmt::pools.empty() == false)
56735 : {
56736 : // Generate an array of memory pools
56737 0 : SgDoWhileStmt** objectArray = (SgDoWhileStmt**) &(SgDoWhileStmt::pools[0]);
56738 :
56739 : // Build a local variable for better performance
56740 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
56741 :
56742 : // Iterate over the memory pools
56743 0 : bool done = false;
56744 0 : unsigned i=0;
56745 :
56746 : // find the first valid IR node, call visit function, and then leave
56747 0 : while ( done == false && i < SgDoWhileStmt::pools.size() )
56748 : {
56749 : // objectArray[i] is a single memory pool
56750 : unsigned j=0;
56751 0 : while (done == false && j < SgDoWhileStmt::pool_size)
56752 : {
56753 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
56754 : {
56755 0 : traversal.visit(&(objectArray[i][j]));
56756 0 : done = true;
56757 : }
56758 0 : j++;
56759 : }
56760 0 : i++;
56761 : }
56762 :
56763 : #if 0
56764 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
56765 : if (done == false)
56766 : {
56767 : printf ("No representative for SgDoWhileStmt found in memory pools \n");
56768 : }
56769 : #endif
56770 : }
56771 0 : }
56772 :
56773 :
56774 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
56775 : // using values that overflow signed values of int.
56776 : size_t
56777 4 : SgDoWhileStmt::numberOfNodes()
56778 : {
56779 : // This function traverses the memory pool for an IR node and
56780 : // counts the number of IR nodes of a particular Sage III IR
56781 : // nodes type.
56782 :
56783 4 : size_t count = 0;
56784 4 : if (SgDoWhileStmt::pools.empty() == false)
56785 : {
56786 : // Generate an array of memory pools (this is actually a STL vector,
56787 : // but it is contiguious, so OK to treat this way).
56788 1 : SgDoWhileStmt** objectArray = (SgDoWhileStmt**) &(SgDoWhileStmt::pools[0]);
56789 :
56790 : // Build a local variable for better performance (make it a loop invariant variable).
56791 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
56792 :
56793 : // Iterate over all of the memory pools for this IR node.
56794 2 : for (unsigned int i=0; i < SgDoWhileStmt::pools.size(); i++)
56795 : {
56796 : // objectArray[i] is a single memory pool, iterate over all the
56797 : // IR nodes and only count those that are valid IR nodes used in
56798 : // the AST (i.e. allocated IR nodes).
56799 2001 : for (unsigned j=0; j < SgDoWhileStmt::pool_size; j++)
56800 : {
56801 : // This is indexing the STL vector of C/C++ style arrays as a doubly
56802 : // indexed array access. It is OK since we have leveraged the semantics
56803 : // of STL vector memory as contigous and cast the memory as an array
56804 : // of arrays to use the 2D array indexing. Hope this is not confusing,
56805 : // but it s very fast as an implementation.
56806 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
56807 : {
56808 7 : count++;
56809 : }
56810 : }
56811 : }
56812 : }
56813 :
56814 :
56815 :
56816 4 : return count;
56817 : }
56818 :
56819 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
56820 : // using values that overflow signed values of int.
56821 : size_t
56822 0 : SgDoWhileStmt::memoryUsage()
56823 : {
56824 : // This function is required because we need the class name as a type when we call sizeof
56825 : // There might be another way to implement this if we have a traversal that only called a
56826 : // representative object (one call for each type of Sage IIIIR node).
56827 0 : size_t memory = numberOfNodes() * sizeof(SgDoWhileStmt);
56828 :
56829 0 : return memory;
56830 : }
56831 :
56832 : /* #line 56833 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
56833 :
56834 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
56835 : void
56836 5342 : SgSwitchStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
56837 : {
56838 : // This function traverses the memory pool for only a specific IR node
56839 : // and calls the visit function of the input class execute a traversal
56840 : // similar to the style of the attribute based traversals within ROSE.
56841 : // This traversal will visit ALL nodes of the AST where as the other
56842 : // attribute based traversals visit only the embedded tree within the AST.
56843 :
56844 : // Initialize array to the address of the first element of the STL vector
56845 : // (which is guaranteed to be contiguous storage).
56846 : // SgSwitchStatement objectArray [] = *(Memory_Block_List.begin());
56847 5342 : if (SgSwitchStatement::pools.empty() == false)
56848 : {
56849 : // Generate an array of memory pools
56850 9 : SgSwitchStatement** objectArray = (SgSwitchStatement**) &(SgSwitchStatement::pools[0]);
56851 :
56852 : // Build a local variable for better performance
56853 9 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
56854 : #if 0
56855 : // Iterate over the memory pools
56856 : for (unsigned int i=0; i < SgSwitchStatement::pools.size(); i++)
56857 : {
56858 : // objectArray[i] is a single memory pool
56859 : for (int j=0; j < SgSwitchStatement::pool_size; j++)
56860 : {
56861 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
56862 : {
56863 : traversal.visit(&(objectArray[i][j]));
56864 : }
56865 : }
56866 : }
56867 : #else
56868 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
56869 : // compute the list first and then call the visit function on each list element.
56870 :
56871 : // printf ("Inside of SgSwitchStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
56872 :
56873 18 : std::vector<SgSwitchStatement*> nodeList;
56874 :
56875 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
56876 18 : for (unsigned int i=0; i < SgSwitchStatement::pools.size(); i++)
56877 : {
56878 : // objectArray[i] is a single memory pool
56879 18009 : for (unsigned j=0; j < SgSwitchStatement::pool_size; j++)
56880 : {
56881 18000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
56882 : {
56883 9 : nodeList.push_back(&(objectArray[i][j]));
56884 : }
56885 : }
56886 : }
56887 :
56888 : // Iterate over the saved list
56889 9 : size_t nodeListSize = nodeList.size();
56890 18 : for (size_t i=0; i < nodeListSize; i++)
56891 : {
56892 9 : ROSE_ASSERT(nodeList[i] != NULL);
56893 : #if 0
56894 : traversal.visit(nodeList[i]);
56895 : #else
56896 9 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
56897 : {
56898 9 : traversal.visit(nodeList[i]);
56899 : }
56900 : #endif
56901 : }
56902 : #endif
56903 : }
56904 :
56905 : // This should not be required since all previously static data members are
56906 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
56907 :
56908 5342 : }
56909 :
56910 :
56911 : void
56912 194 : SgSwitchStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
56913 : {
56914 : // This function traverses the memory pool for an IR node and
56915 : // calls the function to execute the visitor object.
56916 :
56917 : // Initialize array to the address of the first element of the STL vector
56918 : // (which is guarenteed to be contiguous storage).
56919 : // SgSwitchStatement objectArray [] = *(Memory_Block_List.begin());
56920 194 : if (SgSwitchStatement::pools.empty() == false)
56921 : {
56922 : // Generate an array of memory pools
56923 18 : SgSwitchStatement** objectArray = (SgSwitchStatement**) &(SgSwitchStatement::pools[0]);
56924 :
56925 : // Build a local variable for better performance
56926 18 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
56927 :
56928 : // Iterate over the memory pools
56929 36 : for (unsigned int i=0; i < SgSwitchStatement::pools.size(); i++)
56930 : {
56931 : // objectArray[i] is a single memory pool
56932 36018 : for (unsigned j=0; j < SgSwitchStatement::pool_size; j++)
56933 : {
56934 36000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
56935 : {
56936 : // printf ("Found a valid SgSwitchStatement object in the memory pool %d at position %d \n",i,j);
56937 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
56938 18 : objectArray[i][j].executeVisitorMemberFunction(visitor);
56939 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
56940 : }
56941 : else
56942 : {
56943 : // printf ("Found a INVALID SgSwitchStatement object in the memory pool \n");
56944 : }
56945 : }
56946 : }
56947 : }
56948 :
56949 : // This should not be required since all previously static data members are
56950 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
56951 :
56952 194 : }
56953 :
56954 : void
56955 0 : SgSwitchStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
56956 : {
56957 : // This function visits only a single IR node of the memory pool.
56958 : // it is typically called once for each type of IR node within
56959 : // the automatically generated function: traverseRepresentativeNodes().
56960 :
56961 : // Initialize array to the address of the first element of the STL vector
56962 : // (which is guarenteed to be contiguous storage).
56963 : // SgSwitchStatement objectArray [] = *(Memory_Block_List.begin());
56964 0 : if (SgSwitchStatement::pools.empty() == false)
56965 : {
56966 : // Generate an array of memory pools
56967 0 : SgSwitchStatement** objectArray = (SgSwitchStatement**) &(SgSwitchStatement::pools[0]);
56968 :
56969 : // Build a local variable for better performance
56970 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
56971 :
56972 : // Iterate over the memory pools
56973 0 : bool done = false;
56974 0 : unsigned i=0;
56975 :
56976 : // find the first valid IR node, call visit function, and then leave
56977 0 : while ( done == false && i < SgSwitchStatement::pools.size() )
56978 : {
56979 : // objectArray[i] is a single memory pool
56980 : unsigned j=0;
56981 0 : while (done == false && j < SgSwitchStatement::pool_size)
56982 : {
56983 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
56984 : {
56985 0 : traversal.visit(&(objectArray[i][j]));
56986 0 : done = true;
56987 : }
56988 0 : j++;
56989 : }
56990 0 : i++;
56991 : }
56992 :
56993 : #if 0
56994 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
56995 : if (done == false)
56996 : {
56997 : printf ("No representative for SgSwitchStatement found in memory pools \n");
56998 : }
56999 : #endif
57000 : }
57001 0 : }
57002 :
57003 :
57004 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
57005 : // using values that overflow signed values of int.
57006 : size_t
57007 4 : SgSwitchStatement::numberOfNodes()
57008 : {
57009 : // This function traverses the memory pool for an IR node and
57010 : // counts the number of IR nodes of a particular Sage III IR
57011 : // nodes type.
57012 :
57013 4 : size_t count = 0;
57014 4 : if (SgSwitchStatement::pools.empty() == false)
57015 : {
57016 : // Generate an array of memory pools (this is actually a STL vector,
57017 : // but it is contiguious, so OK to treat this way).
57018 0 : SgSwitchStatement** objectArray = (SgSwitchStatement**) &(SgSwitchStatement::pools[0]);
57019 :
57020 : // Build a local variable for better performance (make it a loop invariant variable).
57021 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
57022 :
57023 : // Iterate over all of the memory pools for this IR node.
57024 0 : for (unsigned int i=0; i < SgSwitchStatement::pools.size(); i++)
57025 : {
57026 : // objectArray[i] is a single memory pool, iterate over all the
57027 : // IR nodes and only count those that are valid IR nodes used in
57028 : // the AST (i.e. allocated IR nodes).
57029 0 : for (unsigned j=0; j < SgSwitchStatement::pool_size; j++)
57030 : {
57031 : // This is indexing the STL vector of C/C++ style arrays as a doubly
57032 : // indexed array access. It is OK since we have leveraged the semantics
57033 : // of STL vector memory as contigous and cast the memory as an array
57034 : // of arrays to use the 2D array indexing. Hope this is not confusing,
57035 : // but it s very fast as an implementation.
57036 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
57037 : {
57038 0 : count++;
57039 : }
57040 : }
57041 : }
57042 : }
57043 :
57044 :
57045 :
57046 4 : return count;
57047 : }
57048 :
57049 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
57050 : // using values that overflow signed values of int.
57051 : size_t
57052 0 : SgSwitchStatement::memoryUsage()
57053 : {
57054 : // This function is required because we need the class name as a type when we call sizeof
57055 : // There might be another way to implement this if we have a traversal that only called a
57056 : // representative object (one call for each type of Sage IIIIR node).
57057 0 : size_t memory = numberOfNodes() * sizeof(SgSwitchStatement);
57058 :
57059 0 : return memory;
57060 : }
57061 :
57062 : /* #line 57063 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
57063 :
57064 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
57065 : void
57066 5342 : SgCatchOptionStmt::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
57067 : {
57068 : // This function traverses the memory pool for only a specific IR node
57069 : // and calls the visit function of the input class execute a traversal
57070 : // similar to the style of the attribute based traversals within ROSE.
57071 : // This traversal will visit ALL nodes of the AST where as the other
57072 : // attribute based traversals visit only the embedded tree within the AST.
57073 :
57074 : // Initialize array to the address of the first element of the STL vector
57075 : // (which is guaranteed to be contiguous storage).
57076 : // SgCatchOptionStmt objectArray [] = *(Memory_Block_List.begin());
57077 5342 : if (SgCatchOptionStmt::pools.empty() == false)
57078 : {
57079 : // Generate an array of memory pools
57080 138 : SgCatchOptionStmt** objectArray = (SgCatchOptionStmt**) &(SgCatchOptionStmt::pools[0]);
57081 :
57082 : // Build a local variable for better performance
57083 138 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
57084 : #if 0
57085 : // Iterate over the memory pools
57086 : for (unsigned int i=0; i < SgCatchOptionStmt::pools.size(); i++)
57087 : {
57088 : // objectArray[i] is a single memory pool
57089 : for (int j=0; j < SgCatchOptionStmt::pool_size; j++)
57090 : {
57091 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
57092 : {
57093 : traversal.visit(&(objectArray[i][j]));
57094 : }
57095 : }
57096 : }
57097 : #else
57098 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
57099 : // compute the list first and then call the visit function on each list element.
57100 :
57101 : // printf ("Inside of SgCatchOptionStmt::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
57102 :
57103 276 : std::vector<SgCatchOptionStmt*> nodeList;
57104 :
57105 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
57106 276 : for (unsigned int i=0; i < SgCatchOptionStmt::pools.size(); i++)
57107 : {
57108 : // objectArray[i] is a single memory pool
57109 276138 : for (unsigned j=0; j < SgCatchOptionStmt::pool_size; j++)
57110 : {
57111 276000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
57112 : {
57113 11228 : nodeList.push_back(&(objectArray[i][j]));
57114 : }
57115 : }
57116 : }
57117 :
57118 : // Iterate over the saved list
57119 138 : size_t nodeListSize = nodeList.size();
57120 11366 : for (size_t i=0; i < nodeListSize; i++)
57121 : {
57122 11228 : ROSE_ASSERT(nodeList[i] != NULL);
57123 : #if 0
57124 : traversal.visit(nodeList[i]);
57125 : #else
57126 11228 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
57127 : {
57128 11228 : traversal.visit(nodeList[i]);
57129 : }
57130 : #endif
57131 : }
57132 : #endif
57133 : }
57134 :
57135 : // This should not be required since all previously static data members are
57136 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
57137 :
57138 5342 : }
57139 :
57140 :
57141 : void
57142 194 : SgCatchOptionStmt::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
57143 : {
57144 : // This function traverses the memory pool for an IR node and
57145 : // calls the function to execute the visitor object.
57146 :
57147 : // Initialize array to the address of the first element of the STL vector
57148 : // (which is guarenteed to be contiguous storage).
57149 : // SgCatchOptionStmt objectArray [] = *(Memory_Block_List.begin());
57150 194 : if (SgCatchOptionStmt::pools.empty() == false)
57151 : {
57152 : // Generate an array of memory pools
57153 137 : SgCatchOptionStmt** objectArray = (SgCatchOptionStmt**) &(SgCatchOptionStmt::pools[0]);
57154 :
57155 : // Build a local variable for better performance
57156 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
57157 :
57158 : // Iterate over the memory pools
57159 274 : for (unsigned int i=0; i < SgCatchOptionStmt::pools.size(); i++)
57160 : {
57161 : // objectArray[i] is a single memory pool
57162 274137 : for (unsigned j=0; j < SgCatchOptionStmt::pool_size; j++)
57163 : {
57164 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
57165 : {
57166 : // printf ("Found a valid SgCatchOptionStmt object in the memory pool %d at position %d \n",i,j);
57167 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
57168 12798 : objectArray[i][j].executeVisitorMemberFunction(visitor);
57169 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
57170 : }
57171 : else
57172 : {
57173 : // printf ("Found a INVALID SgCatchOptionStmt object in the memory pool \n");
57174 : }
57175 : }
57176 : }
57177 : }
57178 :
57179 : // This should not be required since all previously static data members are
57180 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
57181 :
57182 194 : }
57183 :
57184 : void
57185 0 : SgCatchOptionStmt::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
57186 : {
57187 : // This function visits only a single IR node of the memory pool.
57188 : // it is typically called once for each type of IR node within
57189 : // the automatically generated function: traverseRepresentativeNodes().
57190 :
57191 : // Initialize array to the address of the first element of the STL vector
57192 : // (which is guarenteed to be contiguous storage).
57193 : // SgCatchOptionStmt objectArray [] = *(Memory_Block_List.begin());
57194 0 : if (SgCatchOptionStmt::pools.empty() == false)
57195 : {
57196 : // Generate an array of memory pools
57197 0 : SgCatchOptionStmt** objectArray = (SgCatchOptionStmt**) &(SgCatchOptionStmt::pools[0]);
57198 :
57199 : // Build a local variable for better performance
57200 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
57201 :
57202 : // Iterate over the memory pools
57203 0 : bool done = false;
57204 0 : unsigned i=0;
57205 :
57206 : // find the first valid IR node, call visit function, and then leave
57207 0 : while ( done == false && i < SgCatchOptionStmt::pools.size() )
57208 : {
57209 : // objectArray[i] is a single memory pool
57210 : unsigned j=0;
57211 0 : while (done == false && j < SgCatchOptionStmt::pool_size)
57212 : {
57213 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
57214 : {
57215 0 : traversal.visit(&(objectArray[i][j]));
57216 0 : done = true;
57217 : }
57218 0 : j++;
57219 : }
57220 0 : i++;
57221 : }
57222 :
57223 : #if 0
57224 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
57225 : if (done == false)
57226 : {
57227 : printf ("No representative for SgCatchOptionStmt found in memory pools \n");
57228 : }
57229 : #endif
57230 : }
57231 0 : }
57232 :
57233 :
57234 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
57235 : // using values that overflow signed values of int.
57236 : size_t
57237 4 : SgCatchOptionStmt::numberOfNodes()
57238 : {
57239 : // This function traverses the memory pool for an IR node and
57240 : // counts the number of IR nodes of a particular Sage III IR
57241 : // nodes type.
57242 :
57243 4 : size_t count = 0;
57244 4 : if (SgCatchOptionStmt::pools.empty() == false)
57245 : {
57246 : // Generate an array of memory pools (this is actually a STL vector,
57247 : // but it is contiguious, so OK to treat this way).
57248 1 : SgCatchOptionStmt** objectArray = (SgCatchOptionStmt**) &(SgCatchOptionStmt::pools[0]);
57249 :
57250 : // Build a local variable for better performance (make it a loop invariant variable).
57251 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
57252 :
57253 : // Iterate over all of the memory pools for this IR node.
57254 2 : for (unsigned int i=0; i < SgCatchOptionStmt::pools.size(); i++)
57255 : {
57256 : // objectArray[i] is a single memory pool, iterate over all the
57257 : // IR nodes and only count those that are valid IR nodes used in
57258 : // the AST (i.e. allocated IR nodes).
57259 2001 : for (unsigned j=0; j < SgCatchOptionStmt::pool_size; j++)
57260 : {
57261 : // This is indexing the STL vector of C/C++ style arrays as a doubly
57262 : // indexed array access. It is OK since we have leveraged the semantics
57263 : // of STL vector memory as contigous and cast the memory as an array
57264 : // of arrays to use the 2D array indexing. Hope this is not confusing,
57265 : // but it s very fast as an implementation.
57266 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
57267 : {
57268 90 : count++;
57269 : }
57270 : }
57271 : }
57272 : }
57273 :
57274 :
57275 :
57276 4 : return count;
57277 : }
57278 :
57279 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
57280 : // using values that overflow signed values of int.
57281 : size_t
57282 0 : SgCatchOptionStmt::memoryUsage()
57283 : {
57284 : // This function is required because we need the class name as a type when we call sizeof
57285 : // There might be another way to implement this if we have a traversal that only called a
57286 : // representative object (one call for each type of Sage IIIIR node).
57287 0 : size_t memory = numberOfNodes() * sizeof(SgCatchOptionStmt);
57288 :
57289 0 : return memory;
57290 : }
57291 :
57292 : /* #line 57293 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
57293 :
57294 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
57295 : void
57296 5342 : SgNamespaceDefinitionStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
57297 : {
57298 : // This function traverses the memory pool for only a specific IR node
57299 : // and calls the visit function of the input class execute a traversal
57300 : // similar to the style of the attribute based traversals within ROSE.
57301 : // This traversal will visit ALL nodes of the AST where as the other
57302 : // attribute based traversals visit only the embedded tree within the AST.
57303 :
57304 : // Initialize array to the address of the first element of the STL vector
57305 : // (which is guaranteed to be contiguous storage).
57306 : // SgNamespaceDefinitionStatement objectArray [] = *(Memory_Block_List.begin());
57307 5342 : if (SgNamespaceDefinitionStatement::pools.empty() == false)
57308 : {
57309 : // Generate an array of memory pools
57310 208 : SgNamespaceDefinitionStatement** objectArray = (SgNamespaceDefinitionStatement**) &(SgNamespaceDefinitionStatement::pools[0]);
57311 :
57312 : // Build a local variable for better performance
57313 208 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
57314 : #if 0
57315 : // Iterate over the memory pools
57316 : for (unsigned int i=0; i < SgNamespaceDefinitionStatement::pools.size(); i++)
57317 : {
57318 : // objectArray[i] is a single memory pool
57319 : for (int j=0; j < SgNamespaceDefinitionStatement::pool_size; j++)
57320 : {
57321 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
57322 : {
57323 : traversal.visit(&(objectArray[i][j]));
57324 : }
57325 : }
57326 : }
57327 : #else
57328 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
57329 : // compute the list first and then call the visit function on each list element.
57330 :
57331 : // printf ("Inside of SgNamespaceDefinitionStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
57332 :
57333 416 : std::vector<SgNamespaceDefinitionStatement*> nodeList;
57334 :
57335 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
57336 416 : for (unsigned int i=0; i < SgNamespaceDefinitionStatement::pools.size(); i++)
57337 : {
57338 : // objectArray[i] is a single memory pool
57339 416208 : for (unsigned j=0; j < SgNamespaceDefinitionStatement::pool_size; j++)
57340 : {
57341 416000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
57342 : {
57343 17887 : nodeList.push_back(&(objectArray[i][j]));
57344 : }
57345 : }
57346 : }
57347 :
57348 : // Iterate over the saved list
57349 208 : size_t nodeListSize = nodeList.size();
57350 18095 : for (size_t i=0; i < nodeListSize; i++)
57351 : {
57352 17887 : ROSE_ASSERT(nodeList[i] != NULL);
57353 : #if 0
57354 : traversal.visit(nodeList[i]);
57355 : #else
57356 17887 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
57357 : {
57358 17887 : traversal.visit(nodeList[i]);
57359 : }
57360 : #endif
57361 : }
57362 : #endif
57363 : }
57364 :
57365 : // This should not be required since all previously static data members are
57366 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
57367 :
57368 5342 : }
57369 :
57370 :
57371 : void
57372 194 : SgNamespaceDefinitionStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
57373 : {
57374 : // This function traverses the memory pool for an IR node and
57375 : // calls the function to execute the visitor object.
57376 :
57377 : // Initialize array to the address of the first element of the STL vector
57378 : // (which is guarenteed to be contiguous storage).
57379 : // SgNamespaceDefinitionStatement objectArray [] = *(Memory_Block_List.begin());
57380 194 : if (SgNamespaceDefinitionStatement::pools.empty() == false)
57381 : {
57382 : // Generate an array of memory pools
57383 137 : SgNamespaceDefinitionStatement** objectArray = (SgNamespaceDefinitionStatement**) &(SgNamespaceDefinitionStatement::pools[0]);
57384 :
57385 : // Build a local variable for better performance
57386 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
57387 :
57388 : // Iterate over the memory pools
57389 274 : for (unsigned int i=0; i < SgNamespaceDefinitionStatement::pools.size(); i++)
57390 : {
57391 : // objectArray[i] is a single memory pool
57392 274137 : for (unsigned j=0; j < SgNamespaceDefinitionStatement::pool_size; j++)
57393 : {
57394 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
57395 : {
57396 : // printf ("Found a valid SgNamespaceDefinitionStatement object in the memory pool %d at position %d \n",i,j);
57397 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
57398 18639 : objectArray[i][j].executeVisitorMemberFunction(visitor);
57399 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
57400 : }
57401 : else
57402 : {
57403 : // printf ("Found a INVALID SgNamespaceDefinitionStatement object in the memory pool \n");
57404 : }
57405 : }
57406 : }
57407 : }
57408 :
57409 : // This should not be required since all previously static data members are
57410 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
57411 :
57412 194 : }
57413 :
57414 : void
57415 0 : SgNamespaceDefinitionStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
57416 : {
57417 : // This function visits only a single IR node of the memory pool.
57418 : // it is typically called once for each type of IR node within
57419 : // the automatically generated function: traverseRepresentativeNodes().
57420 :
57421 : // Initialize array to the address of the first element of the STL vector
57422 : // (which is guarenteed to be contiguous storage).
57423 : // SgNamespaceDefinitionStatement objectArray [] = *(Memory_Block_List.begin());
57424 0 : if (SgNamespaceDefinitionStatement::pools.empty() == false)
57425 : {
57426 : // Generate an array of memory pools
57427 0 : SgNamespaceDefinitionStatement** objectArray = (SgNamespaceDefinitionStatement**) &(SgNamespaceDefinitionStatement::pools[0]);
57428 :
57429 : // Build a local variable for better performance
57430 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
57431 :
57432 : // Iterate over the memory pools
57433 0 : bool done = false;
57434 0 : unsigned i=0;
57435 :
57436 : // find the first valid IR node, call visit function, and then leave
57437 0 : while ( done == false && i < SgNamespaceDefinitionStatement::pools.size() )
57438 : {
57439 : // objectArray[i] is a single memory pool
57440 : unsigned j=0;
57441 0 : while (done == false && j < SgNamespaceDefinitionStatement::pool_size)
57442 : {
57443 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
57444 : {
57445 0 : traversal.visit(&(objectArray[i][j]));
57446 0 : done = true;
57447 : }
57448 0 : j++;
57449 : }
57450 0 : i++;
57451 : }
57452 :
57453 : #if 0
57454 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
57455 : if (done == false)
57456 : {
57457 : printf ("No representative for SgNamespaceDefinitionStatement found in memory pools \n");
57458 : }
57459 : #endif
57460 : }
57461 0 : }
57462 :
57463 :
57464 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
57465 : // using values that overflow signed values of int.
57466 : size_t
57467 4 : SgNamespaceDefinitionStatement::numberOfNodes()
57468 : {
57469 : // This function traverses the memory pool for an IR node and
57470 : // counts the number of IR nodes of a particular Sage III IR
57471 : // nodes type.
57472 :
57473 4 : size_t count = 0;
57474 4 : if (SgNamespaceDefinitionStatement::pools.empty() == false)
57475 : {
57476 : // Generate an array of memory pools (this is actually a STL vector,
57477 : // but it is contiguious, so OK to treat this way).
57478 1 : SgNamespaceDefinitionStatement** objectArray = (SgNamespaceDefinitionStatement**) &(SgNamespaceDefinitionStatement::pools[0]);
57479 :
57480 : // Build a local variable for better performance (make it a loop invariant variable).
57481 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
57482 :
57483 : // Iterate over all of the memory pools for this IR node.
57484 2 : for (unsigned int i=0; i < SgNamespaceDefinitionStatement::pools.size(); i++)
57485 : {
57486 : // objectArray[i] is a single memory pool, iterate over all the
57487 : // IR nodes and only count those that are valid IR nodes used in
57488 : // the AST (i.e. allocated IR nodes).
57489 2001 : for (unsigned j=0; j < SgNamespaceDefinitionStatement::pool_size; j++)
57490 : {
57491 : // This is indexing the STL vector of C/C++ style arrays as a doubly
57492 : // indexed array access. It is OK since we have leveraged the semantics
57493 : // of STL vector memory as contigous and cast the memory as an array
57494 : // of arrays to use the 2D array indexing. Hope this is not confusing,
57495 : // but it s very fast as an implementation.
57496 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
57497 : {
57498 135 : count++;
57499 : }
57500 : }
57501 : }
57502 : }
57503 :
57504 :
57505 :
57506 4 : return count;
57507 : }
57508 :
57509 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
57510 : // using values that overflow signed values of int.
57511 : size_t
57512 0 : SgNamespaceDefinitionStatement::memoryUsage()
57513 : {
57514 : // This function is required because we need the class name as a type when we call sizeof
57515 : // There might be another way to implement this if we have a traversal that only called a
57516 : // representative object (one call for each type of Sage IIIIR node).
57517 0 : size_t memory = numberOfNodes() * sizeof(SgNamespaceDefinitionStatement);
57518 :
57519 0 : return memory;
57520 : }
57521 :
57522 : /* #line 57523 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
57523 :
57524 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
57525 : void
57526 5342 : SgBlockDataStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
57527 : {
57528 : // This function traverses the memory pool for only a specific IR node
57529 : // and calls the visit function of the input class execute a traversal
57530 : // similar to the style of the attribute based traversals within ROSE.
57531 : // This traversal will visit ALL nodes of the AST where as the other
57532 : // attribute based traversals visit only the embedded tree within the AST.
57533 :
57534 : // Initialize array to the address of the first element of the STL vector
57535 : // (which is guaranteed to be contiguous storage).
57536 : // SgBlockDataStatement objectArray [] = *(Memory_Block_List.begin());
57537 5342 : if (SgBlockDataStatement::pools.empty() == false)
57538 : {
57539 : // Generate an array of memory pools
57540 0 : SgBlockDataStatement** objectArray = (SgBlockDataStatement**) &(SgBlockDataStatement::pools[0]);
57541 :
57542 : // Build a local variable for better performance
57543 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
57544 : #if 0
57545 : // Iterate over the memory pools
57546 : for (unsigned int i=0; i < SgBlockDataStatement::pools.size(); i++)
57547 : {
57548 : // objectArray[i] is a single memory pool
57549 : for (int j=0; j < SgBlockDataStatement::pool_size; j++)
57550 : {
57551 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
57552 : {
57553 : traversal.visit(&(objectArray[i][j]));
57554 : }
57555 : }
57556 : }
57557 : #else
57558 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
57559 : // compute the list first and then call the visit function on each list element.
57560 :
57561 : // printf ("Inside of SgBlockDataStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
57562 :
57563 0 : std::vector<SgBlockDataStatement*> nodeList;
57564 :
57565 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
57566 0 : for (unsigned int i=0; i < SgBlockDataStatement::pools.size(); i++)
57567 : {
57568 : // objectArray[i] is a single memory pool
57569 0 : for (unsigned j=0; j < SgBlockDataStatement::pool_size; j++)
57570 : {
57571 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
57572 : {
57573 0 : nodeList.push_back(&(objectArray[i][j]));
57574 : }
57575 : }
57576 : }
57577 :
57578 : // Iterate over the saved list
57579 0 : size_t nodeListSize = nodeList.size();
57580 0 : for (size_t i=0; i < nodeListSize; i++)
57581 : {
57582 0 : ROSE_ASSERT(nodeList[i] != NULL);
57583 : #if 0
57584 : traversal.visit(nodeList[i]);
57585 : #else
57586 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
57587 : {
57588 0 : traversal.visit(nodeList[i]);
57589 : }
57590 : #endif
57591 : }
57592 : #endif
57593 : }
57594 :
57595 : // This should not be required since all previously static data members are
57596 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
57597 :
57598 5342 : }
57599 :
57600 :
57601 : void
57602 194 : SgBlockDataStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
57603 : {
57604 : // This function traverses the memory pool for an IR node and
57605 : // calls the function to execute the visitor object.
57606 :
57607 : // Initialize array to the address of the first element of the STL vector
57608 : // (which is guarenteed to be contiguous storage).
57609 : // SgBlockDataStatement objectArray [] = *(Memory_Block_List.begin());
57610 194 : if (SgBlockDataStatement::pools.empty() == false)
57611 : {
57612 : // Generate an array of memory pools
57613 0 : SgBlockDataStatement** objectArray = (SgBlockDataStatement**) &(SgBlockDataStatement::pools[0]);
57614 :
57615 : // Build a local variable for better performance
57616 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
57617 :
57618 : // Iterate over the memory pools
57619 0 : for (unsigned int i=0; i < SgBlockDataStatement::pools.size(); i++)
57620 : {
57621 : // objectArray[i] is a single memory pool
57622 0 : for (unsigned j=0; j < SgBlockDataStatement::pool_size; j++)
57623 : {
57624 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
57625 : {
57626 : // printf ("Found a valid SgBlockDataStatement object in the memory pool %d at position %d \n",i,j);
57627 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
57628 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
57629 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
57630 : }
57631 : else
57632 : {
57633 : // printf ("Found a INVALID SgBlockDataStatement object in the memory pool \n");
57634 : }
57635 : }
57636 : }
57637 : }
57638 :
57639 : // This should not be required since all previously static data members are
57640 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
57641 :
57642 194 : }
57643 :
57644 : void
57645 0 : SgBlockDataStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
57646 : {
57647 : // This function visits only a single IR node of the memory pool.
57648 : // it is typically called once for each type of IR node within
57649 : // the automatically generated function: traverseRepresentativeNodes().
57650 :
57651 : // Initialize array to the address of the first element of the STL vector
57652 : // (which is guarenteed to be contiguous storage).
57653 : // SgBlockDataStatement objectArray [] = *(Memory_Block_List.begin());
57654 0 : if (SgBlockDataStatement::pools.empty() == false)
57655 : {
57656 : // Generate an array of memory pools
57657 0 : SgBlockDataStatement** objectArray = (SgBlockDataStatement**) &(SgBlockDataStatement::pools[0]);
57658 :
57659 : // Build a local variable for better performance
57660 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
57661 :
57662 : // Iterate over the memory pools
57663 0 : bool done = false;
57664 0 : unsigned i=0;
57665 :
57666 : // find the first valid IR node, call visit function, and then leave
57667 0 : while ( done == false && i < SgBlockDataStatement::pools.size() )
57668 : {
57669 : // objectArray[i] is a single memory pool
57670 : unsigned j=0;
57671 0 : while (done == false && j < SgBlockDataStatement::pool_size)
57672 : {
57673 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
57674 : {
57675 0 : traversal.visit(&(objectArray[i][j]));
57676 0 : done = true;
57677 : }
57678 0 : j++;
57679 : }
57680 0 : i++;
57681 : }
57682 :
57683 : #if 0
57684 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
57685 : if (done == false)
57686 : {
57687 : printf ("No representative for SgBlockDataStatement found in memory pools \n");
57688 : }
57689 : #endif
57690 : }
57691 0 : }
57692 :
57693 :
57694 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
57695 : // using values that overflow signed values of int.
57696 : size_t
57697 4 : SgBlockDataStatement::numberOfNodes()
57698 : {
57699 : // This function traverses the memory pool for an IR node and
57700 : // counts the number of IR nodes of a particular Sage III IR
57701 : // nodes type.
57702 :
57703 4 : size_t count = 0;
57704 4 : if (SgBlockDataStatement::pools.empty() == false)
57705 : {
57706 : // Generate an array of memory pools (this is actually a STL vector,
57707 : // but it is contiguious, so OK to treat this way).
57708 0 : SgBlockDataStatement** objectArray = (SgBlockDataStatement**) &(SgBlockDataStatement::pools[0]);
57709 :
57710 : // Build a local variable for better performance (make it a loop invariant variable).
57711 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
57712 :
57713 : // Iterate over all of the memory pools for this IR node.
57714 0 : for (unsigned int i=0; i < SgBlockDataStatement::pools.size(); i++)
57715 : {
57716 : // objectArray[i] is a single memory pool, iterate over all the
57717 : // IR nodes and only count those that are valid IR nodes used in
57718 : // the AST (i.e. allocated IR nodes).
57719 0 : for (unsigned j=0; j < SgBlockDataStatement::pool_size; j++)
57720 : {
57721 : // This is indexing the STL vector of C/C++ style arrays as a doubly
57722 : // indexed array access. It is OK since we have leveraged the semantics
57723 : // of STL vector memory as contigous and cast the memory as an array
57724 : // of arrays to use the 2D array indexing. Hope this is not confusing,
57725 : // but it s very fast as an implementation.
57726 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
57727 : {
57728 0 : count++;
57729 : }
57730 : }
57731 : }
57732 : }
57733 :
57734 :
57735 :
57736 4 : return count;
57737 : }
57738 :
57739 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
57740 : // using values that overflow signed values of int.
57741 : size_t
57742 0 : SgBlockDataStatement::memoryUsage()
57743 : {
57744 : // This function is required because we need the class name as a type when we call sizeof
57745 : // There might be another way to implement this if we have a traversal that only called a
57746 : // representative object (one call for each type of Sage IIIIR node).
57747 0 : size_t memory = numberOfNodes() * sizeof(SgBlockDataStatement);
57748 :
57749 0 : return memory;
57750 : }
57751 :
57752 : /* #line 57753 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
57753 :
57754 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
57755 : void
57756 5342 : SgAssociateStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
57757 : {
57758 : // This function traverses the memory pool for only a specific IR node
57759 : // and calls the visit function of the input class execute a traversal
57760 : // similar to the style of the attribute based traversals within ROSE.
57761 : // This traversal will visit ALL nodes of the AST where as the other
57762 : // attribute based traversals visit only the embedded tree within the AST.
57763 :
57764 : // Initialize array to the address of the first element of the STL vector
57765 : // (which is guaranteed to be contiguous storage).
57766 : // SgAssociateStatement objectArray [] = *(Memory_Block_List.begin());
57767 5342 : if (SgAssociateStatement::pools.empty() == false)
57768 : {
57769 : // Generate an array of memory pools
57770 0 : SgAssociateStatement** objectArray = (SgAssociateStatement**) &(SgAssociateStatement::pools[0]);
57771 :
57772 : // Build a local variable for better performance
57773 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
57774 : #if 0
57775 : // Iterate over the memory pools
57776 : for (unsigned int i=0; i < SgAssociateStatement::pools.size(); i++)
57777 : {
57778 : // objectArray[i] is a single memory pool
57779 : for (int j=0; j < SgAssociateStatement::pool_size; j++)
57780 : {
57781 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
57782 : {
57783 : traversal.visit(&(objectArray[i][j]));
57784 : }
57785 : }
57786 : }
57787 : #else
57788 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
57789 : // compute the list first and then call the visit function on each list element.
57790 :
57791 : // printf ("Inside of SgAssociateStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
57792 :
57793 0 : std::vector<SgAssociateStatement*> nodeList;
57794 :
57795 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
57796 0 : for (unsigned int i=0; i < SgAssociateStatement::pools.size(); i++)
57797 : {
57798 : // objectArray[i] is a single memory pool
57799 0 : for (unsigned j=0; j < SgAssociateStatement::pool_size; j++)
57800 : {
57801 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
57802 : {
57803 0 : nodeList.push_back(&(objectArray[i][j]));
57804 : }
57805 : }
57806 : }
57807 :
57808 : // Iterate over the saved list
57809 0 : size_t nodeListSize = nodeList.size();
57810 0 : for (size_t i=0; i < nodeListSize; i++)
57811 : {
57812 0 : ROSE_ASSERT(nodeList[i] != NULL);
57813 : #if 0
57814 : traversal.visit(nodeList[i]);
57815 : #else
57816 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
57817 : {
57818 0 : traversal.visit(nodeList[i]);
57819 : }
57820 : #endif
57821 : }
57822 : #endif
57823 : }
57824 :
57825 : // This should not be required since all previously static data members are
57826 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
57827 :
57828 5342 : }
57829 :
57830 :
57831 : void
57832 194 : SgAssociateStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
57833 : {
57834 : // This function traverses the memory pool for an IR node and
57835 : // calls the function to execute the visitor object.
57836 :
57837 : // Initialize array to the address of the first element of the STL vector
57838 : // (which is guarenteed to be contiguous storage).
57839 : // SgAssociateStatement objectArray [] = *(Memory_Block_List.begin());
57840 194 : if (SgAssociateStatement::pools.empty() == false)
57841 : {
57842 : // Generate an array of memory pools
57843 0 : SgAssociateStatement** objectArray = (SgAssociateStatement**) &(SgAssociateStatement::pools[0]);
57844 :
57845 : // Build a local variable for better performance
57846 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
57847 :
57848 : // Iterate over the memory pools
57849 0 : for (unsigned int i=0; i < SgAssociateStatement::pools.size(); i++)
57850 : {
57851 : // objectArray[i] is a single memory pool
57852 0 : for (unsigned j=0; j < SgAssociateStatement::pool_size; j++)
57853 : {
57854 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
57855 : {
57856 : // printf ("Found a valid SgAssociateStatement object in the memory pool %d at position %d \n",i,j);
57857 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
57858 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
57859 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
57860 : }
57861 : else
57862 : {
57863 : // printf ("Found a INVALID SgAssociateStatement object in the memory pool \n");
57864 : }
57865 : }
57866 : }
57867 : }
57868 :
57869 : // This should not be required since all previously static data members are
57870 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
57871 :
57872 194 : }
57873 :
57874 : void
57875 0 : SgAssociateStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
57876 : {
57877 : // This function visits only a single IR node of the memory pool.
57878 : // it is typically called once for each type of IR node within
57879 : // the automatically generated function: traverseRepresentativeNodes().
57880 :
57881 : // Initialize array to the address of the first element of the STL vector
57882 : // (which is guarenteed to be contiguous storage).
57883 : // SgAssociateStatement objectArray [] = *(Memory_Block_List.begin());
57884 0 : if (SgAssociateStatement::pools.empty() == false)
57885 : {
57886 : // Generate an array of memory pools
57887 0 : SgAssociateStatement** objectArray = (SgAssociateStatement**) &(SgAssociateStatement::pools[0]);
57888 :
57889 : // Build a local variable for better performance
57890 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
57891 :
57892 : // Iterate over the memory pools
57893 0 : bool done = false;
57894 0 : unsigned i=0;
57895 :
57896 : // find the first valid IR node, call visit function, and then leave
57897 0 : while ( done == false && i < SgAssociateStatement::pools.size() )
57898 : {
57899 : // objectArray[i] is a single memory pool
57900 : unsigned j=0;
57901 0 : while (done == false && j < SgAssociateStatement::pool_size)
57902 : {
57903 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
57904 : {
57905 0 : traversal.visit(&(objectArray[i][j]));
57906 0 : done = true;
57907 : }
57908 0 : j++;
57909 : }
57910 0 : i++;
57911 : }
57912 :
57913 : #if 0
57914 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
57915 : if (done == false)
57916 : {
57917 : printf ("No representative for SgAssociateStatement found in memory pools \n");
57918 : }
57919 : #endif
57920 : }
57921 0 : }
57922 :
57923 :
57924 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
57925 : // using values that overflow signed values of int.
57926 : size_t
57927 4 : SgAssociateStatement::numberOfNodes()
57928 : {
57929 : // This function traverses the memory pool for an IR node and
57930 : // counts the number of IR nodes of a particular Sage III IR
57931 : // nodes type.
57932 :
57933 4 : size_t count = 0;
57934 4 : if (SgAssociateStatement::pools.empty() == false)
57935 : {
57936 : // Generate an array of memory pools (this is actually a STL vector,
57937 : // but it is contiguious, so OK to treat this way).
57938 0 : SgAssociateStatement** objectArray = (SgAssociateStatement**) &(SgAssociateStatement::pools[0]);
57939 :
57940 : // Build a local variable for better performance (make it a loop invariant variable).
57941 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
57942 :
57943 : // Iterate over all of the memory pools for this IR node.
57944 0 : for (unsigned int i=0; i < SgAssociateStatement::pools.size(); i++)
57945 : {
57946 : // objectArray[i] is a single memory pool, iterate over all the
57947 : // IR nodes and only count those that are valid IR nodes used in
57948 : // the AST (i.e. allocated IR nodes).
57949 0 : for (unsigned j=0; j < SgAssociateStatement::pool_size; j++)
57950 : {
57951 : // This is indexing the STL vector of C/C++ style arrays as a doubly
57952 : // indexed array access. It is OK since we have leveraged the semantics
57953 : // of STL vector memory as contigous and cast the memory as an array
57954 : // of arrays to use the 2D array indexing. Hope this is not confusing,
57955 : // but it s very fast as an implementation.
57956 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
57957 : {
57958 0 : count++;
57959 : }
57960 : }
57961 : }
57962 : }
57963 :
57964 :
57965 :
57966 4 : return count;
57967 : }
57968 :
57969 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
57970 : // using values that overflow signed values of int.
57971 : size_t
57972 0 : SgAssociateStatement::memoryUsage()
57973 : {
57974 : // This function is required because we need the class name as a type when we call sizeof
57975 : // There might be another way to implement this if we have a traversal that only called a
57976 : // representative object (one call for each type of Sage IIIIR node).
57977 0 : size_t memory = numberOfNodes() * sizeof(SgAssociateStatement);
57978 :
57979 0 : return memory;
57980 : }
57981 :
57982 : /* #line 57983 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
57983 :
57984 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
57985 : void
57986 5342 : SgFortranDo::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
57987 : {
57988 : // This function traverses the memory pool for only a specific IR node
57989 : // and calls the visit function of the input class execute a traversal
57990 : // similar to the style of the attribute based traversals within ROSE.
57991 : // This traversal will visit ALL nodes of the AST where as the other
57992 : // attribute based traversals visit only the embedded tree within the AST.
57993 :
57994 : // Initialize array to the address of the first element of the STL vector
57995 : // (which is guaranteed to be contiguous storage).
57996 : // SgFortranDo objectArray [] = *(Memory_Block_List.begin());
57997 5342 : if (SgFortranDo::pools.empty() == false)
57998 : {
57999 : // Generate an array of memory pools
58000 280 : SgFortranDo** objectArray = (SgFortranDo**) &(SgFortranDo::pools[0]);
58001 :
58002 : // Build a local variable for better performance
58003 280 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
58004 : #if 0
58005 : // Iterate over the memory pools
58006 : for (unsigned int i=0; i < SgFortranDo::pools.size(); i++)
58007 : {
58008 : // objectArray[i] is a single memory pool
58009 : for (int j=0; j < SgFortranDo::pool_size; j++)
58010 : {
58011 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
58012 : {
58013 : traversal.visit(&(objectArray[i][j]));
58014 : }
58015 : }
58016 : }
58017 : #else
58018 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
58019 : // compute the list first and then call the visit function on each list element.
58020 :
58021 : // printf ("Inside of SgFortranDo::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
58022 :
58023 560 : std::vector<SgFortranDo*> nodeList;
58024 :
58025 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
58026 560 : for (unsigned int i=0; i < SgFortranDo::pools.size(); i++)
58027 : {
58028 : // objectArray[i] is a single memory pool
58029 560280 : for (unsigned j=0; j < SgFortranDo::pool_size; j++)
58030 : {
58031 560000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
58032 : {
58033 420 : nodeList.push_back(&(objectArray[i][j]));
58034 : }
58035 : }
58036 : }
58037 :
58038 : // Iterate over the saved list
58039 280 : size_t nodeListSize = nodeList.size();
58040 700 : for (size_t i=0; i < nodeListSize; i++)
58041 : {
58042 420 : ROSE_ASSERT(nodeList[i] != NULL);
58043 : #if 0
58044 : traversal.visit(nodeList[i]);
58045 : #else
58046 420 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
58047 : {
58048 420 : traversal.visit(nodeList[i]);
58049 : }
58050 : #endif
58051 : }
58052 : #endif
58053 : }
58054 :
58055 : // This should not be required since all previously static data members are
58056 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
58057 :
58058 5342 : }
58059 :
58060 :
58061 : void
58062 194 : SgFortranDo::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
58063 : {
58064 : // This function traverses the memory pool for an IR node and
58065 : // calls the function to execute the visitor object.
58066 :
58067 : // Initialize array to the address of the first element of the STL vector
58068 : // (which is guarenteed to be contiguous storage).
58069 : // SgFortranDo objectArray [] = *(Memory_Block_List.begin());
58070 194 : if (SgFortranDo::pools.empty() == false)
58071 : {
58072 : // Generate an array of memory pools
58073 0 : SgFortranDo** objectArray = (SgFortranDo**) &(SgFortranDo::pools[0]);
58074 :
58075 : // Build a local variable for better performance
58076 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
58077 :
58078 : // Iterate over the memory pools
58079 0 : for (unsigned int i=0; i < SgFortranDo::pools.size(); i++)
58080 : {
58081 : // objectArray[i] is a single memory pool
58082 0 : for (unsigned j=0; j < SgFortranDo::pool_size; j++)
58083 : {
58084 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
58085 : {
58086 : // printf ("Found a valid SgFortranDo object in the memory pool %d at position %d \n",i,j);
58087 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
58088 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
58089 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
58090 : }
58091 : else
58092 : {
58093 : // printf ("Found a INVALID SgFortranDo object in the memory pool \n");
58094 : }
58095 : }
58096 : }
58097 : }
58098 :
58099 : // This should not be required since all previously static data members are
58100 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
58101 :
58102 194 : }
58103 :
58104 : void
58105 0 : SgFortranDo::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
58106 : {
58107 : // This function visits only a single IR node of the memory pool.
58108 : // it is typically called once for each type of IR node within
58109 : // the automatically generated function: traverseRepresentativeNodes().
58110 :
58111 : // Initialize array to the address of the first element of the STL vector
58112 : // (which is guarenteed to be contiguous storage).
58113 : // SgFortranDo objectArray [] = *(Memory_Block_List.begin());
58114 0 : if (SgFortranDo::pools.empty() == false)
58115 : {
58116 : // Generate an array of memory pools
58117 0 : SgFortranDo** objectArray = (SgFortranDo**) &(SgFortranDo::pools[0]);
58118 :
58119 : // Build a local variable for better performance
58120 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
58121 :
58122 : // Iterate over the memory pools
58123 0 : bool done = false;
58124 0 : unsigned i=0;
58125 :
58126 : // find the first valid IR node, call visit function, and then leave
58127 0 : while ( done == false && i < SgFortranDo::pools.size() )
58128 : {
58129 : // objectArray[i] is a single memory pool
58130 : unsigned j=0;
58131 0 : while (done == false && j < SgFortranDo::pool_size)
58132 : {
58133 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
58134 : {
58135 0 : traversal.visit(&(objectArray[i][j]));
58136 0 : done = true;
58137 : }
58138 0 : j++;
58139 : }
58140 0 : i++;
58141 : }
58142 :
58143 : #if 0
58144 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
58145 : if (done == false)
58146 : {
58147 : printf ("No representative for SgFortranDo found in memory pools \n");
58148 : }
58149 : #endif
58150 : }
58151 0 : }
58152 :
58153 :
58154 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
58155 : // using values that overflow signed values of int.
58156 : size_t
58157 4 : SgFortranDo::numberOfNodes()
58158 : {
58159 : // This function traverses the memory pool for an IR node and
58160 : // counts the number of IR nodes of a particular Sage III IR
58161 : // nodes type.
58162 :
58163 4 : size_t count = 0;
58164 4 : if (SgFortranDo::pools.empty() == false)
58165 : {
58166 : // Generate an array of memory pools (this is actually a STL vector,
58167 : // but it is contiguious, so OK to treat this way).
58168 0 : SgFortranDo** objectArray = (SgFortranDo**) &(SgFortranDo::pools[0]);
58169 :
58170 : // Build a local variable for better performance (make it a loop invariant variable).
58171 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
58172 :
58173 : // Iterate over all of the memory pools for this IR node.
58174 0 : for (unsigned int i=0; i < SgFortranDo::pools.size(); i++)
58175 : {
58176 : // objectArray[i] is a single memory pool, iterate over all the
58177 : // IR nodes and only count those that are valid IR nodes used in
58178 : // the AST (i.e. allocated IR nodes).
58179 0 : for (unsigned j=0; j < SgFortranDo::pool_size; j++)
58180 : {
58181 : // This is indexing the STL vector of C/C++ style arrays as a doubly
58182 : // indexed array access. It is OK since we have leveraged the semantics
58183 : // of STL vector memory as contigous and cast the memory as an array
58184 : // of arrays to use the 2D array indexing. Hope this is not confusing,
58185 : // but it s very fast as an implementation.
58186 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
58187 : {
58188 0 : count++;
58189 : }
58190 : }
58191 : }
58192 : }
58193 :
58194 :
58195 :
58196 4 : return count;
58197 : }
58198 :
58199 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
58200 : // using values that overflow signed values of int.
58201 : size_t
58202 0 : SgFortranDo::memoryUsage()
58203 : {
58204 : // This function is required because we need the class name as a type when we call sizeof
58205 : // There might be another way to implement this if we have a traversal that only called a
58206 : // representative object (one call for each type of Sage IIIIR node).
58207 0 : size_t memory = numberOfNodes() * sizeof(SgFortranDo);
58208 :
58209 0 : return memory;
58210 : }
58211 :
58212 : /* #line 58213 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
58213 :
58214 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
58215 : void
58216 5342 : SgFortranNonblockedDo::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
58217 : {
58218 : // This function traverses the memory pool for only a specific IR node
58219 : // and calls the visit function of the input class execute a traversal
58220 : // similar to the style of the attribute based traversals within ROSE.
58221 : // This traversal will visit ALL nodes of the AST where as the other
58222 : // attribute based traversals visit only the embedded tree within the AST.
58223 :
58224 : // Initialize array to the address of the first element of the STL vector
58225 : // (which is guaranteed to be contiguous storage).
58226 : // SgFortranNonblockedDo objectArray [] = *(Memory_Block_List.begin());
58227 5342 : if (SgFortranNonblockedDo::pools.empty() == false)
58228 : {
58229 : // Generate an array of memory pools
58230 0 : SgFortranNonblockedDo** objectArray = (SgFortranNonblockedDo**) &(SgFortranNonblockedDo::pools[0]);
58231 :
58232 : // Build a local variable for better performance
58233 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
58234 : #if 0
58235 : // Iterate over the memory pools
58236 : for (unsigned int i=0; i < SgFortranNonblockedDo::pools.size(); i++)
58237 : {
58238 : // objectArray[i] is a single memory pool
58239 : for (int j=0; j < SgFortranNonblockedDo::pool_size; j++)
58240 : {
58241 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
58242 : {
58243 : traversal.visit(&(objectArray[i][j]));
58244 : }
58245 : }
58246 : }
58247 : #else
58248 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
58249 : // compute the list first and then call the visit function on each list element.
58250 :
58251 : // printf ("Inside of SgFortranNonblockedDo::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
58252 :
58253 0 : std::vector<SgFortranNonblockedDo*> nodeList;
58254 :
58255 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
58256 0 : for (unsigned int i=0; i < SgFortranNonblockedDo::pools.size(); i++)
58257 : {
58258 : // objectArray[i] is a single memory pool
58259 0 : for (unsigned j=0; j < SgFortranNonblockedDo::pool_size; j++)
58260 : {
58261 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
58262 : {
58263 0 : nodeList.push_back(&(objectArray[i][j]));
58264 : }
58265 : }
58266 : }
58267 :
58268 : // Iterate over the saved list
58269 0 : size_t nodeListSize = nodeList.size();
58270 0 : for (size_t i=0; i < nodeListSize; i++)
58271 : {
58272 0 : ROSE_ASSERT(nodeList[i] != NULL);
58273 : #if 0
58274 : traversal.visit(nodeList[i]);
58275 : #else
58276 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
58277 : {
58278 0 : traversal.visit(nodeList[i]);
58279 : }
58280 : #endif
58281 : }
58282 : #endif
58283 : }
58284 :
58285 : // This should not be required since all previously static data members are
58286 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
58287 :
58288 5342 : }
58289 :
58290 :
58291 : void
58292 194 : SgFortranNonblockedDo::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
58293 : {
58294 : // This function traverses the memory pool for an IR node and
58295 : // calls the function to execute the visitor object.
58296 :
58297 : // Initialize array to the address of the first element of the STL vector
58298 : // (which is guarenteed to be contiguous storage).
58299 : // SgFortranNonblockedDo objectArray [] = *(Memory_Block_List.begin());
58300 194 : if (SgFortranNonblockedDo::pools.empty() == false)
58301 : {
58302 : // Generate an array of memory pools
58303 0 : SgFortranNonblockedDo** objectArray = (SgFortranNonblockedDo**) &(SgFortranNonblockedDo::pools[0]);
58304 :
58305 : // Build a local variable for better performance
58306 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
58307 :
58308 : // Iterate over the memory pools
58309 0 : for (unsigned int i=0; i < SgFortranNonblockedDo::pools.size(); i++)
58310 : {
58311 : // objectArray[i] is a single memory pool
58312 0 : for (unsigned j=0; j < SgFortranNonblockedDo::pool_size; j++)
58313 : {
58314 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
58315 : {
58316 : // printf ("Found a valid SgFortranNonblockedDo object in the memory pool %d at position %d \n",i,j);
58317 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
58318 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
58319 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
58320 : }
58321 : else
58322 : {
58323 : // printf ("Found a INVALID SgFortranNonblockedDo object in the memory pool \n");
58324 : }
58325 : }
58326 : }
58327 : }
58328 :
58329 : // This should not be required since all previously static data members are
58330 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
58331 :
58332 194 : }
58333 :
58334 : void
58335 0 : SgFortranNonblockedDo::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
58336 : {
58337 : // This function visits only a single IR node of the memory pool.
58338 : // it is typically called once for each type of IR node within
58339 : // the automatically generated function: traverseRepresentativeNodes().
58340 :
58341 : // Initialize array to the address of the first element of the STL vector
58342 : // (which is guarenteed to be contiguous storage).
58343 : // SgFortranNonblockedDo objectArray [] = *(Memory_Block_List.begin());
58344 0 : if (SgFortranNonblockedDo::pools.empty() == false)
58345 : {
58346 : // Generate an array of memory pools
58347 0 : SgFortranNonblockedDo** objectArray = (SgFortranNonblockedDo**) &(SgFortranNonblockedDo::pools[0]);
58348 :
58349 : // Build a local variable for better performance
58350 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
58351 :
58352 : // Iterate over the memory pools
58353 0 : bool done = false;
58354 0 : unsigned i=0;
58355 :
58356 : // find the first valid IR node, call visit function, and then leave
58357 0 : while ( done == false && i < SgFortranNonblockedDo::pools.size() )
58358 : {
58359 : // objectArray[i] is a single memory pool
58360 : unsigned j=0;
58361 0 : while (done == false && j < SgFortranNonblockedDo::pool_size)
58362 : {
58363 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
58364 : {
58365 0 : traversal.visit(&(objectArray[i][j]));
58366 0 : done = true;
58367 : }
58368 0 : j++;
58369 : }
58370 0 : i++;
58371 : }
58372 :
58373 : #if 0
58374 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
58375 : if (done == false)
58376 : {
58377 : printf ("No representative for SgFortranNonblockedDo found in memory pools \n");
58378 : }
58379 : #endif
58380 : }
58381 0 : }
58382 :
58383 :
58384 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
58385 : // using values that overflow signed values of int.
58386 : size_t
58387 4 : SgFortranNonblockedDo::numberOfNodes()
58388 : {
58389 : // This function traverses the memory pool for an IR node and
58390 : // counts the number of IR nodes of a particular Sage III IR
58391 : // nodes type.
58392 :
58393 4 : size_t count = 0;
58394 4 : if (SgFortranNonblockedDo::pools.empty() == false)
58395 : {
58396 : // Generate an array of memory pools (this is actually a STL vector,
58397 : // but it is contiguious, so OK to treat this way).
58398 0 : SgFortranNonblockedDo** objectArray = (SgFortranNonblockedDo**) &(SgFortranNonblockedDo::pools[0]);
58399 :
58400 : // Build a local variable for better performance (make it a loop invariant variable).
58401 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
58402 :
58403 : // Iterate over all of the memory pools for this IR node.
58404 0 : for (unsigned int i=0; i < SgFortranNonblockedDo::pools.size(); i++)
58405 : {
58406 : // objectArray[i] is a single memory pool, iterate over all the
58407 : // IR nodes and only count those that are valid IR nodes used in
58408 : // the AST (i.e. allocated IR nodes).
58409 0 : for (unsigned j=0; j < SgFortranNonblockedDo::pool_size; j++)
58410 : {
58411 : // This is indexing the STL vector of C/C++ style arrays as a doubly
58412 : // indexed array access. It is OK since we have leveraged the semantics
58413 : // of STL vector memory as contigous and cast the memory as an array
58414 : // of arrays to use the 2D array indexing. Hope this is not confusing,
58415 : // but it s very fast as an implementation.
58416 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
58417 : {
58418 0 : count++;
58419 : }
58420 : }
58421 : }
58422 : }
58423 :
58424 :
58425 :
58426 4 : return count;
58427 : }
58428 :
58429 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
58430 : // using values that overflow signed values of int.
58431 : size_t
58432 0 : SgFortranNonblockedDo::memoryUsage()
58433 : {
58434 : // This function is required because we need the class name as a type when we call sizeof
58435 : // There might be another way to implement this if we have a traversal that only called a
58436 : // representative object (one call for each type of Sage IIIIR node).
58437 0 : size_t memory = numberOfNodes() * sizeof(SgFortranNonblockedDo);
58438 :
58439 0 : return memory;
58440 : }
58441 :
58442 : /* #line 58443 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
58443 :
58444 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
58445 : void
58446 5342 : SgForAllStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
58447 : {
58448 : // This function traverses the memory pool for only a specific IR node
58449 : // and calls the visit function of the input class execute a traversal
58450 : // similar to the style of the attribute based traversals within ROSE.
58451 : // This traversal will visit ALL nodes of the AST where as the other
58452 : // attribute based traversals visit only the embedded tree within the AST.
58453 :
58454 : // Initialize array to the address of the first element of the STL vector
58455 : // (which is guaranteed to be contiguous storage).
58456 : // SgForAllStatement objectArray [] = *(Memory_Block_List.begin());
58457 5342 : if (SgForAllStatement::pools.empty() == false)
58458 : {
58459 : // Generate an array of memory pools
58460 0 : SgForAllStatement** objectArray = (SgForAllStatement**) &(SgForAllStatement::pools[0]);
58461 :
58462 : // Build a local variable for better performance
58463 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
58464 : #if 0
58465 : // Iterate over the memory pools
58466 : for (unsigned int i=0; i < SgForAllStatement::pools.size(); i++)
58467 : {
58468 : // objectArray[i] is a single memory pool
58469 : for (int j=0; j < SgForAllStatement::pool_size; j++)
58470 : {
58471 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
58472 : {
58473 : traversal.visit(&(objectArray[i][j]));
58474 : }
58475 : }
58476 : }
58477 : #else
58478 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
58479 : // compute the list first and then call the visit function on each list element.
58480 :
58481 : // printf ("Inside of SgForAllStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
58482 :
58483 0 : std::vector<SgForAllStatement*> nodeList;
58484 :
58485 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
58486 0 : for (unsigned int i=0; i < SgForAllStatement::pools.size(); i++)
58487 : {
58488 : // objectArray[i] is a single memory pool
58489 0 : for (unsigned j=0; j < SgForAllStatement::pool_size; j++)
58490 : {
58491 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
58492 : {
58493 0 : nodeList.push_back(&(objectArray[i][j]));
58494 : }
58495 : }
58496 : }
58497 :
58498 : // Iterate over the saved list
58499 0 : size_t nodeListSize = nodeList.size();
58500 0 : for (size_t i=0; i < nodeListSize; i++)
58501 : {
58502 0 : ROSE_ASSERT(nodeList[i] != NULL);
58503 : #if 0
58504 : traversal.visit(nodeList[i]);
58505 : #else
58506 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
58507 : {
58508 0 : traversal.visit(nodeList[i]);
58509 : }
58510 : #endif
58511 : }
58512 : #endif
58513 : }
58514 :
58515 : // This should not be required since all previously static data members are
58516 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
58517 :
58518 5342 : }
58519 :
58520 :
58521 : void
58522 194 : SgForAllStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
58523 : {
58524 : // This function traverses the memory pool for an IR node and
58525 : // calls the function to execute the visitor object.
58526 :
58527 : // Initialize array to the address of the first element of the STL vector
58528 : // (which is guarenteed to be contiguous storage).
58529 : // SgForAllStatement objectArray [] = *(Memory_Block_List.begin());
58530 194 : if (SgForAllStatement::pools.empty() == false)
58531 : {
58532 : // Generate an array of memory pools
58533 0 : SgForAllStatement** objectArray = (SgForAllStatement**) &(SgForAllStatement::pools[0]);
58534 :
58535 : // Build a local variable for better performance
58536 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
58537 :
58538 : // Iterate over the memory pools
58539 0 : for (unsigned int i=0; i < SgForAllStatement::pools.size(); i++)
58540 : {
58541 : // objectArray[i] is a single memory pool
58542 0 : for (unsigned j=0; j < SgForAllStatement::pool_size; j++)
58543 : {
58544 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
58545 : {
58546 : // printf ("Found a valid SgForAllStatement object in the memory pool %d at position %d \n",i,j);
58547 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
58548 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
58549 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
58550 : }
58551 : else
58552 : {
58553 : // printf ("Found a INVALID SgForAllStatement object in the memory pool \n");
58554 : }
58555 : }
58556 : }
58557 : }
58558 :
58559 : // This should not be required since all previously static data members are
58560 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
58561 :
58562 194 : }
58563 :
58564 : void
58565 0 : SgForAllStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
58566 : {
58567 : // This function visits only a single IR node of the memory pool.
58568 : // it is typically called once for each type of IR node within
58569 : // the automatically generated function: traverseRepresentativeNodes().
58570 :
58571 : // Initialize array to the address of the first element of the STL vector
58572 : // (which is guarenteed to be contiguous storage).
58573 : // SgForAllStatement objectArray [] = *(Memory_Block_List.begin());
58574 0 : if (SgForAllStatement::pools.empty() == false)
58575 : {
58576 : // Generate an array of memory pools
58577 0 : SgForAllStatement** objectArray = (SgForAllStatement**) &(SgForAllStatement::pools[0]);
58578 :
58579 : // Build a local variable for better performance
58580 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
58581 :
58582 : // Iterate over the memory pools
58583 0 : bool done = false;
58584 0 : unsigned i=0;
58585 :
58586 : // find the first valid IR node, call visit function, and then leave
58587 0 : while ( done == false && i < SgForAllStatement::pools.size() )
58588 : {
58589 : // objectArray[i] is a single memory pool
58590 : unsigned j=0;
58591 0 : while (done == false && j < SgForAllStatement::pool_size)
58592 : {
58593 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
58594 : {
58595 0 : traversal.visit(&(objectArray[i][j]));
58596 0 : done = true;
58597 : }
58598 0 : j++;
58599 : }
58600 0 : i++;
58601 : }
58602 :
58603 : #if 0
58604 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
58605 : if (done == false)
58606 : {
58607 : printf ("No representative for SgForAllStatement found in memory pools \n");
58608 : }
58609 : #endif
58610 : }
58611 0 : }
58612 :
58613 :
58614 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
58615 : // using values that overflow signed values of int.
58616 : size_t
58617 4 : SgForAllStatement::numberOfNodes()
58618 : {
58619 : // This function traverses the memory pool for an IR node and
58620 : // counts the number of IR nodes of a particular Sage III IR
58621 : // nodes type.
58622 :
58623 4 : size_t count = 0;
58624 4 : if (SgForAllStatement::pools.empty() == false)
58625 : {
58626 : // Generate an array of memory pools (this is actually a STL vector,
58627 : // but it is contiguious, so OK to treat this way).
58628 0 : SgForAllStatement** objectArray = (SgForAllStatement**) &(SgForAllStatement::pools[0]);
58629 :
58630 : // Build a local variable for better performance (make it a loop invariant variable).
58631 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
58632 :
58633 : // Iterate over all of the memory pools for this IR node.
58634 0 : for (unsigned int i=0; i < SgForAllStatement::pools.size(); i++)
58635 : {
58636 : // objectArray[i] is a single memory pool, iterate over all the
58637 : // IR nodes and only count those that are valid IR nodes used in
58638 : // the AST (i.e. allocated IR nodes).
58639 0 : for (unsigned j=0; j < SgForAllStatement::pool_size; j++)
58640 : {
58641 : // This is indexing the STL vector of C/C++ style arrays as a doubly
58642 : // indexed array access. It is OK since we have leveraged the semantics
58643 : // of STL vector memory as contigous and cast the memory as an array
58644 : // of arrays to use the 2D array indexing. Hope this is not confusing,
58645 : // but it s very fast as an implementation.
58646 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
58647 : {
58648 0 : count++;
58649 : }
58650 : }
58651 : }
58652 : }
58653 :
58654 :
58655 :
58656 4 : return count;
58657 : }
58658 :
58659 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
58660 : // using values that overflow signed values of int.
58661 : size_t
58662 0 : SgForAllStatement::memoryUsage()
58663 : {
58664 : // This function is required because we need the class name as a type when we call sizeof
58665 : // There might be another way to implement this if we have a traversal that only called a
58666 : // representative object (one call for each type of Sage IIIIR node).
58667 0 : size_t memory = numberOfNodes() * sizeof(SgForAllStatement);
58668 :
58669 0 : return memory;
58670 : }
58671 :
58672 : /* #line 58673 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
58673 :
58674 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
58675 : void
58676 5342 : SgUpcForAllStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
58677 : {
58678 : // This function traverses the memory pool for only a specific IR node
58679 : // and calls the visit function of the input class execute a traversal
58680 : // similar to the style of the attribute based traversals within ROSE.
58681 : // This traversal will visit ALL nodes of the AST where as the other
58682 : // attribute based traversals visit only the embedded tree within the AST.
58683 :
58684 : // Initialize array to the address of the first element of the STL vector
58685 : // (which is guaranteed to be contiguous storage).
58686 : // SgUpcForAllStatement objectArray [] = *(Memory_Block_List.begin());
58687 5342 : if (SgUpcForAllStatement::pools.empty() == false)
58688 : {
58689 : // Generate an array of memory pools
58690 0 : SgUpcForAllStatement** objectArray = (SgUpcForAllStatement**) &(SgUpcForAllStatement::pools[0]);
58691 :
58692 : // Build a local variable for better performance
58693 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
58694 : #if 0
58695 : // Iterate over the memory pools
58696 : for (unsigned int i=0; i < SgUpcForAllStatement::pools.size(); i++)
58697 : {
58698 : // objectArray[i] is a single memory pool
58699 : for (int j=0; j < SgUpcForAllStatement::pool_size; j++)
58700 : {
58701 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
58702 : {
58703 : traversal.visit(&(objectArray[i][j]));
58704 : }
58705 : }
58706 : }
58707 : #else
58708 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
58709 : // compute the list first and then call the visit function on each list element.
58710 :
58711 : // printf ("Inside of SgUpcForAllStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
58712 :
58713 0 : std::vector<SgUpcForAllStatement*> nodeList;
58714 :
58715 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
58716 0 : for (unsigned int i=0; i < SgUpcForAllStatement::pools.size(); i++)
58717 : {
58718 : // objectArray[i] is a single memory pool
58719 0 : for (unsigned j=0; j < SgUpcForAllStatement::pool_size; j++)
58720 : {
58721 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
58722 : {
58723 0 : nodeList.push_back(&(objectArray[i][j]));
58724 : }
58725 : }
58726 : }
58727 :
58728 : // Iterate over the saved list
58729 0 : size_t nodeListSize = nodeList.size();
58730 0 : for (size_t i=0; i < nodeListSize; i++)
58731 : {
58732 0 : ROSE_ASSERT(nodeList[i] != NULL);
58733 : #if 0
58734 : traversal.visit(nodeList[i]);
58735 : #else
58736 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
58737 : {
58738 0 : traversal.visit(nodeList[i]);
58739 : }
58740 : #endif
58741 : }
58742 : #endif
58743 : }
58744 :
58745 : // This should not be required since all previously static data members are
58746 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
58747 :
58748 5342 : }
58749 :
58750 :
58751 : void
58752 194 : SgUpcForAllStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
58753 : {
58754 : // This function traverses the memory pool for an IR node and
58755 : // calls the function to execute the visitor object.
58756 :
58757 : // Initialize array to the address of the first element of the STL vector
58758 : // (which is guarenteed to be contiguous storage).
58759 : // SgUpcForAllStatement objectArray [] = *(Memory_Block_List.begin());
58760 194 : if (SgUpcForAllStatement::pools.empty() == false)
58761 : {
58762 : // Generate an array of memory pools
58763 0 : SgUpcForAllStatement** objectArray = (SgUpcForAllStatement**) &(SgUpcForAllStatement::pools[0]);
58764 :
58765 : // Build a local variable for better performance
58766 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
58767 :
58768 : // Iterate over the memory pools
58769 0 : for (unsigned int i=0; i < SgUpcForAllStatement::pools.size(); i++)
58770 : {
58771 : // objectArray[i] is a single memory pool
58772 0 : for (unsigned j=0; j < SgUpcForAllStatement::pool_size; j++)
58773 : {
58774 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
58775 : {
58776 : // printf ("Found a valid SgUpcForAllStatement object in the memory pool %d at position %d \n",i,j);
58777 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
58778 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
58779 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
58780 : }
58781 : else
58782 : {
58783 : // printf ("Found a INVALID SgUpcForAllStatement object in the memory pool \n");
58784 : }
58785 : }
58786 : }
58787 : }
58788 :
58789 : // This should not be required since all previously static data members are
58790 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
58791 :
58792 194 : }
58793 :
58794 : void
58795 0 : SgUpcForAllStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
58796 : {
58797 : // This function visits only a single IR node of the memory pool.
58798 : // it is typically called once for each type of IR node within
58799 : // the automatically generated function: traverseRepresentativeNodes().
58800 :
58801 : // Initialize array to the address of the first element of the STL vector
58802 : // (which is guarenteed to be contiguous storage).
58803 : // SgUpcForAllStatement objectArray [] = *(Memory_Block_List.begin());
58804 0 : if (SgUpcForAllStatement::pools.empty() == false)
58805 : {
58806 : // Generate an array of memory pools
58807 0 : SgUpcForAllStatement** objectArray = (SgUpcForAllStatement**) &(SgUpcForAllStatement::pools[0]);
58808 :
58809 : // Build a local variable for better performance
58810 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
58811 :
58812 : // Iterate over the memory pools
58813 0 : bool done = false;
58814 0 : unsigned i=0;
58815 :
58816 : // find the first valid IR node, call visit function, and then leave
58817 0 : while ( done == false && i < SgUpcForAllStatement::pools.size() )
58818 : {
58819 : // objectArray[i] is a single memory pool
58820 : unsigned j=0;
58821 0 : while (done == false && j < SgUpcForAllStatement::pool_size)
58822 : {
58823 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
58824 : {
58825 0 : traversal.visit(&(objectArray[i][j]));
58826 0 : done = true;
58827 : }
58828 0 : j++;
58829 : }
58830 0 : i++;
58831 : }
58832 :
58833 : #if 0
58834 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
58835 : if (done == false)
58836 : {
58837 : printf ("No representative for SgUpcForAllStatement found in memory pools \n");
58838 : }
58839 : #endif
58840 : }
58841 0 : }
58842 :
58843 :
58844 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
58845 : // using values that overflow signed values of int.
58846 : size_t
58847 4 : SgUpcForAllStatement::numberOfNodes()
58848 : {
58849 : // This function traverses the memory pool for an IR node and
58850 : // counts the number of IR nodes of a particular Sage III IR
58851 : // nodes type.
58852 :
58853 4 : size_t count = 0;
58854 4 : if (SgUpcForAllStatement::pools.empty() == false)
58855 : {
58856 : // Generate an array of memory pools (this is actually a STL vector,
58857 : // but it is contiguious, so OK to treat this way).
58858 0 : SgUpcForAllStatement** objectArray = (SgUpcForAllStatement**) &(SgUpcForAllStatement::pools[0]);
58859 :
58860 : // Build a local variable for better performance (make it a loop invariant variable).
58861 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
58862 :
58863 : // Iterate over all of the memory pools for this IR node.
58864 0 : for (unsigned int i=0; i < SgUpcForAllStatement::pools.size(); i++)
58865 : {
58866 : // objectArray[i] is a single memory pool, iterate over all the
58867 : // IR nodes and only count those that are valid IR nodes used in
58868 : // the AST (i.e. allocated IR nodes).
58869 0 : for (unsigned j=0; j < SgUpcForAllStatement::pool_size; j++)
58870 : {
58871 : // This is indexing the STL vector of C/C++ style arrays as a doubly
58872 : // indexed array access. It is OK since we have leveraged the semantics
58873 : // of STL vector memory as contigous and cast the memory as an array
58874 : // of arrays to use the 2D array indexing. Hope this is not confusing,
58875 : // but it s very fast as an implementation.
58876 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
58877 : {
58878 0 : count++;
58879 : }
58880 : }
58881 : }
58882 : }
58883 :
58884 :
58885 :
58886 4 : return count;
58887 : }
58888 :
58889 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
58890 : // using values that overflow signed values of int.
58891 : size_t
58892 0 : SgUpcForAllStatement::memoryUsage()
58893 : {
58894 : // This function is required because we need the class name as a type when we call sizeof
58895 : // There might be another way to implement this if we have a traversal that only called a
58896 : // representative object (one call for each type of Sage IIIIR node).
58897 0 : size_t memory = numberOfNodes() * sizeof(SgUpcForAllStatement);
58898 :
58899 0 : return memory;
58900 : }
58901 :
58902 : /* #line 58903 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
58903 :
58904 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
58905 : void
58906 5342 : SgCAFWithTeamStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
58907 : {
58908 : // This function traverses the memory pool for only a specific IR node
58909 : // and calls the visit function of the input class execute a traversal
58910 : // similar to the style of the attribute based traversals within ROSE.
58911 : // This traversal will visit ALL nodes of the AST where as the other
58912 : // attribute based traversals visit only the embedded tree within the AST.
58913 :
58914 : // Initialize array to the address of the first element of the STL vector
58915 : // (which is guaranteed to be contiguous storage).
58916 : // SgCAFWithTeamStatement objectArray [] = *(Memory_Block_List.begin());
58917 5342 : if (SgCAFWithTeamStatement::pools.empty() == false)
58918 : {
58919 : // Generate an array of memory pools
58920 0 : SgCAFWithTeamStatement** objectArray = (SgCAFWithTeamStatement**) &(SgCAFWithTeamStatement::pools[0]);
58921 :
58922 : // Build a local variable for better performance
58923 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
58924 : #if 0
58925 : // Iterate over the memory pools
58926 : for (unsigned int i=0; i < SgCAFWithTeamStatement::pools.size(); i++)
58927 : {
58928 : // objectArray[i] is a single memory pool
58929 : for (int j=0; j < SgCAFWithTeamStatement::pool_size; j++)
58930 : {
58931 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
58932 : {
58933 : traversal.visit(&(objectArray[i][j]));
58934 : }
58935 : }
58936 : }
58937 : #else
58938 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
58939 : // compute the list first and then call the visit function on each list element.
58940 :
58941 : // printf ("Inside of SgCAFWithTeamStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
58942 :
58943 0 : std::vector<SgCAFWithTeamStatement*> nodeList;
58944 :
58945 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
58946 0 : for (unsigned int i=0; i < SgCAFWithTeamStatement::pools.size(); i++)
58947 : {
58948 : // objectArray[i] is a single memory pool
58949 0 : for (unsigned j=0; j < SgCAFWithTeamStatement::pool_size; j++)
58950 : {
58951 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
58952 : {
58953 0 : nodeList.push_back(&(objectArray[i][j]));
58954 : }
58955 : }
58956 : }
58957 :
58958 : // Iterate over the saved list
58959 0 : size_t nodeListSize = nodeList.size();
58960 0 : for (size_t i=0; i < nodeListSize; i++)
58961 : {
58962 0 : ROSE_ASSERT(nodeList[i] != NULL);
58963 : #if 0
58964 : traversal.visit(nodeList[i]);
58965 : #else
58966 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
58967 : {
58968 0 : traversal.visit(nodeList[i]);
58969 : }
58970 : #endif
58971 : }
58972 : #endif
58973 : }
58974 :
58975 : // This should not be required since all previously static data members are
58976 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
58977 :
58978 5342 : }
58979 :
58980 :
58981 : void
58982 194 : SgCAFWithTeamStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
58983 : {
58984 : // This function traverses the memory pool for an IR node and
58985 : // calls the function to execute the visitor object.
58986 :
58987 : // Initialize array to the address of the first element of the STL vector
58988 : // (which is guarenteed to be contiguous storage).
58989 : // SgCAFWithTeamStatement objectArray [] = *(Memory_Block_List.begin());
58990 194 : if (SgCAFWithTeamStatement::pools.empty() == false)
58991 : {
58992 : // Generate an array of memory pools
58993 0 : SgCAFWithTeamStatement** objectArray = (SgCAFWithTeamStatement**) &(SgCAFWithTeamStatement::pools[0]);
58994 :
58995 : // Build a local variable for better performance
58996 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
58997 :
58998 : // Iterate over the memory pools
58999 0 : for (unsigned int i=0; i < SgCAFWithTeamStatement::pools.size(); i++)
59000 : {
59001 : // objectArray[i] is a single memory pool
59002 0 : for (unsigned j=0; j < SgCAFWithTeamStatement::pool_size; j++)
59003 : {
59004 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
59005 : {
59006 : // printf ("Found a valid SgCAFWithTeamStatement object in the memory pool %d at position %d \n",i,j);
59007 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
59008 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
59009 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
59010 : }
59011 : else
59012 : {
59013 : // printf ("Found a INVALID SgCAFWithTeamStatement object in the memory pool \n");
59014 : }
59015 : }
59016 : }
59017 : }
59018 :
59019 : // This should not be required since all previously static data members are
59020 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
59021 :
59022 194 : }
59023 :
59024 : void
59025 0 : SgCAFWithTeamStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
59026 : {
59027 : // This function visits only a single IR node of the memory pool.
59028 : // it is typically called once for each type of IR node within
59029 : // the automatically generated function: traverseRepresentativeNodes().
59030 :
59031 : // Initialize array to the address of the first element of the STL vector
59032 : // (which is guarenteed to be contiguous storage).
59033 : // SgCAFWithTeamStatement objectArray [] = *(Memory_Block_List.begin());
59034 0 : if (SgCAFWithTeamStatement::pools.empty() == false)
59035 : {
59036 : // Generate an array of memory pools
59037 0 : SgCAFWithTeamStatement** objectArray = (SgCAFWithTeamStatement**) &(SgCAFWithTeamStatement::pools[0]);
59038 :
59039 : // Build a local variable for better performance
59040 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
59041 :
59042 : // Iterate over the memory pools
59043 0 : bool done = false;
59044 0 : unsigned i=0;
59045 :
59046 : // find the first valid IR node, call visit function, and then leave
59047 0 : while ( done == false && i < SgCAFWithTeamStatement::pools.size() )
59048 : {
59049 : // objectArray[i] is a single memory pool
59050 : unsigned j=0;
59051 0 : while (done == false && j < SgCAFWithTeamStatement::pool_size)
59052 : {
59053 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
59054 : {
59055 0 : traversal.visit(&(objectArray[i][j]));
59056 0 : done = true;
59057 : }
59058 0 : j++;
59059 : }
59060 0 : i++;
59061 : }
59062 :
59063 : #if 0
59064 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
59065 : if (done == false)
59066 : {
59067 : printf ("No representative for SgCAFWithTeamStatement found in memory pools \n");
59068 : }
59069 : #endif
59070 : }
59071 0 : }
59072 :
59073 :
59074 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
59075 : // using values that overflow signed values of int.
59076 : size_t
59077 4 : SgCAFWithTeamStatement::numberOfNodes()
59078 : {
59079 : // This function traverses the memory pool for an IR node and
59080 : // counts the number of IR nodes of a particular Sage III IR
59081 : // nodes type.
59082 :
59083 4 : size_t count = 0;
59084 4 : if (SgCAFWithTeamStatement::pools.empty() == false)
59085 : {
59086 : // Generate an array of memory pools (this is actually a STL vector,
59087 : // but it is contiguious, so OK to treat this way).
59088 0 : SgCAFWithTeamStatement** objectArray = (SgCAFWithTeamStatement**) &(SgCAFWithTeamStatement::pools[0]);
59089 :
59090 : // Build a local variable for better performance (make it a loop invariant variable).
59091 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
59092 :
59093 : // Iterate over all of the memory pools for this IR node.
59094 0 : for (unsigned int i=0; i < SgCAFWithTeamStatement::pools.size(); i++)
59095 : {
59096 : // objectArray[i] is a single memory pool, iterate over all the
59097 : // IR nodes and only count those that are valid IR nodes used in
59098 : // the AST (i.e. allocated IR nodes).
59099 0 : for (unsigned j=0; j < SgCAFWithTeamStatement::pool_size; j++)
59100 : {
59101 : // This is indexing the STL vector of C/C++ style arrays as a doubly
59102 : // indexed array access. It is OK since we have leveraged the semantics
59103 : // of STL vector memory as contigous and cast the memory as an array
59104 : // of arrays to use the 2D array indexing. Hope this is not confusing,
59105 : // but it s very fast as an implementation.
59106 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
59107 : {
59108 0 : count++;
59109 : }
59110 : }
59111 : }
59112 : }
59113 :
59114 :
59115 :
59116 4 : return count;
59117 : }
59118 :
59119 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
59120 : // using values that overflow signed values of int.
59121 : size_t
59122 0 : SgCAFWithTeamStatement::memoryUsage()
59123 : {
59124 : // This function is required because we need the class name as a type when we call sizeof
59125 : // There might be another way to implement this if we have a traversal that only called a
59126 : // representative object (one call for each type of Sage IIIIR node).
59127 0 : size_t memory = numberOfNodes() * sizeof(SgCAFWithTeamStatement);
59128 :
59129 0 : return memory;
59130 : }
59131 :
59132 : /* #line 59133 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
59133 :
59134 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
59135 : void
59136 5342 : SgFunctionParameterScope::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
59137 : {
59138 : // This function traverses the memory pool for only a specific IR node
59139 : // and calls the visit function of the input class execute a traversal
59140 : // similar to the style of the attribute based traversals within ROSE.
59141 : // This traversal will visit ALL nodes of the AST where as the other
59142 : // attribute based traversals visit only the embedded tree within the AST.
59143 :
59144 : // Initialize array to the address of the first element of the STL vector
59145 : // (which is guaranteed to be contiguous storage).
59146 : // SgFunctionParameterScope objectArray [] = *(Memory_Block_List.begin());
59147 5342 : if (SgFunctionParameterScope::pools.empty() == false)
59148 : {
59149 : // Generate an array of memory pools
59150 0 : SgFunctionParameterScope** objectArray = (SgFunctionParameterScope**) &(SgFunctionParameterScope::pools[0]);
59151 :
59152 : // Build a local variable for better performance
59153 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
59154 : #if 0
59155 : // Iterate over the memory pools
59156 : for (unsigned int i=0; i < SgFunctionParameterScope::pools.size(); i++)
59157 : {
59158 : // objectArray[i] is a single memory pool
59159 : for (int j=0; j < SgFunctionParameterScope::pool_size; j++)
59160 : {
59161 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
59162 : {
59163 : traversal.visit(&(objectArray[i][j]));
59164 : }
59165 : }
59166 : }
59167 : #else
59168 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
59169 : // compute the list first and then call the visit function on each list element.
59170 :
59171 : // printf ("Inside of SgFunctionParameterScope::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
59172 :
59173 0 : std::vector<SgFunctionParameterScope*> nodeList;
59174 :
59175 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
59176 0 : for (unsigned int i=0; i < SgFunctionParameterScope::pools.size(); i++)
59177 : {
59178 : // objectArray[i] is a single memory pool
59179 0 : for (unsigned j=0; j < SgFunctionParameterScope::pool_size; j++)
59180 : {
59181 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
59182 : {
59183 0 : nodeList.push_back(&(objectArray[i][j]));
59184 : }
59185 : }
59186 : }
59187 :
59188 : // Iterate over the saved list
59189 0 : size_t nodeListSize = nodeList.size();
59190 0 : for (size_t i=0; i < nodeListSize; i++)
59191 : {
59192 0 : ROSE_ASSERT(nodeList[i] != NULL);
59193 : #if 0
59194 : traversal.visit(nodeList[i]);
59195 : #else
59196 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
59197 : {
59198 0 : traversal.visit(nodeList[i]);
59199 : }
59200 : #endif
59201 : }
59202 : #endif
59203 : }
59204 :
59205 : // This should not be required since all previously static data members are
59206 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
59207 :
59208 5342 : }
59209 :
59210 :
59211 : void
59212 194 : SgFunctionParameterScope::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
59213 : {
59214 : // This function traverses the memory pool for an IR node and
59215 : // calls the function to execute the visitor object.
59216 :
59217 : // Initialize array to the address of the first element of the STL vector
59218 : // (which is guarenteed to be contiguous storage).
59219 : // SgFunctionParameterScope objectArray [] = *(Memory_Block_List.begin());
59220 194 : if (SgFunctionParameterScope::pools.empty() == false)
59221 : {
59222 : // Generate an array of memory pools
59223 0 : SgFunctionParameterScope** objectArray = (SgFunctionParameterScope**) &(SgFunctionParameterScope::pools[0]);
59224 :
59225 : // Build a local variable for better performance
59226 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
59227 :
59228 : // Iterate over the memory pools
59229 0 : for (unsigned int i=0; i < SgFunctionParameterScope::pools.size(); i++)
59230 : {
59231 : // objectArray[i] is a single memory pool
59232 0 : for (unsigned j=0; j < SgFunctionParameterScope::pool_size; j++)
59233 : {
59234 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
59235 : {
59236 : // printf ("Found a valid SgFunctionParameterScope object in the memory pool %d at position %d \n",i,j);
59237 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
59238 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
59239 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
59240 : }
59241 : else
59242 : {
59243 : // printf ("Found a INVALID SgFunctionParameterScope object in the memory pool \n");
59244 : }
59245 : }
59246 : }
59247 : }
59248 :
59249 : // This should not be required since all previously static data members are
59250 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
59251 :
59252 194 : }
59253 :
59254 : void
59255 0 : SgFunctionParameterScope::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
59256 : {
59257 : // This function visits only a single IR node of the memory pool.
59258 : // it is typically called once for each type of IR node within
59259 : // the automatically generated function: traverseRepresentativeNodes().
59260 :
59261 : // Initialize array to the address of the first element of the STL vector
59262 : // (which is guarenteed to be contiguous storage).
59263 : // SgFunctionParameterScope objectArray [] = *(Memory_Block_List.begin());
59264 0 : if (SgFunctionParameterScope::pools.empty() == false)
59265 : {
59266 : // Generate an array of memory pools
59267 0 : SgFunctionParameterScope** objectArray = (SgFunctionParameterScope**) &(SgFunctionParameterScope::pools[0]);
59268 :
59269 : // Build a local variable for better performance
59270 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
59271 :
59272 : // Iterate over the memory pools
59273 0 : bool done = false;
59274 0 : unsigned i=0;
59275 :
59276 : // find the first valid IR node, call visit function, and then leave
59277 0 : while ( done == false && i < SgFunctionParameterScope::pools.size() )
59278 : {
59279 : // objectArray[i] is a single memory pool
59280 : unsigned j=0;
59281 0 : while (done == false && j < SgFunctionParameterScope::pool_size)
59282 : {
59283 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
59284 : {
59285 0 : traversal.visit(&(objectArray[i][j]));
59286 0 : done = true;
59287 : }
59288 0 : j++;
59289 : }
59290 0 : i++;
59291 : }
59292 :
59293 : #if 0
59294 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
59295 : if (done == false)
59296 : {
59297 : printf ("No representative for SgFunctionParameterScope found in memory pools \n");
59298 : }
59299 : #endif
59300 : }
59301 0 : }
59302 :
59303 :
59304 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
59305 : // using values that overflow signed values of int.
59306 : size_t
59307 4 : SgFunctionParameterScope::numberOfNodes()
59308 : {
59309 : // This function traverses the memory pool for an IR node and
59310 : // counts the number of IR nodes of a particular Sage III IR
59311 : // nodes type.
59312 :
59313 4 : size_t count = 0;
59314 4 : if (SgFunctionParameterScope::pools.empty() == false)
59315 : {
59316 : // Generate an array of memory pools (this is actually a STL vector,
59317 : // but it is contiguious, so OK to treat this way).
59318 0 : SgFunctionParameterScope** objectArray = (SgFunctionParameterScope**) &(SgFunctionParameterScope::pools[0]);
59319 :
59320 : // Build a local variable for better performance (make it a loop invariant variable).
59321 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
59322 :
59323 : // Iterate over all of the memory pools for this IR node.
59324 0 : for (unsigned int i=0; i < SgFunctionParameterScope::pools.size(); i++)
59325 : {
59326 : // objectArray[i] is a single memory pool, iterate over all the
59327 : // IR nodes and only count those that are valid IR nodes used in
59328 : // the AST (i.e. allocated IR nodes).
59329 0 : for (unsigned j=0; j < SgFunctionParameterScope::pool_size; j++)
59330 : {
59331 : // This is indexing the STL vector of C/C++ style arrays as a doubly
59332 : // indexed array access. It is OK since we have leveraged the semantics
59333 : // of STL vector memory as contigous and cast the memory as an array
59334 : // of arrays to use the 2D array indexing. Hope this is not confusing,
59335 : // but it s very fast as an implementation.
59336 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
59337 : {
59338 0 : count++;
59339 : }
59340 : }
59341 : }
59342 : }
59343 :
59344 :
59345 :
59346 4 : return count;
59347 : }
59348 :
59349 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
59350 : // using values that overflow signed values of int.
59351 : size_t
59352 0 : SgFunctionParameterScope::memoryUsage()
59353 : {
59354 : // This function is required because we need the class name as a type when we call sizeof
59355 : // There might be another way to implement this if we have a traversal that only called a
59356 : // representative object (one call for each type of Sage IIIIR node).
59357 0 : size_t memory = numberOfNodes() * sizeof(SgFunctionParameterScope);
59358 :
59359 0 : return memory;
59360 : }
59361 :
59362 : /* #line 59363 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
59363 :
59364 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
59365 : void
59366 5342 : SgDeclarationScope::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
59367 : {
59368 : // This function traverses the memory pool for only a specific IR node
59369 : // and calls the visit function of the input class execute a traversal
59370 : // similar to the style of the attribute based traversals within ROSE.
59371 : // This traversal will visit ALL nodes of the AST where as the other
59372 : // attribute based traversals visit only the embedded tree within the AST.
59373 :
59374 : // Initialize array to the address of the first element of the STL vector
59375 : // (which is guaranteed to be contiguous storage).
59376 : // SgDeclarationScope objectArray [] = *(Memory_Block_List.begin());
59377 5342 : if (SgDeclarationScope::pools.empty() == false)
59378 : {
59379 : // Generate an array of memory pools
59380 4595 : SgDeclarationScope** objectArray = (SgDeclarationScope**) &(SgDeclarationScope::pools[0]);
59381 :
59382 : // Build a local variable for better performance
59383 4595 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
59384 : #if 0
59385 : // Iterate over the memory pools
59386 : for (unsigned int i=0; i < SgDeclarationScope::pools.size(); i++)
59387 : {
59388 : // objectArray[i] is a single memory pool
59389 : for (int j=0; j < SgDeclarationScope::pool_size; j++)
59390 : {
59391 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
59392 : {
59393 : traversal.visit(&(objectArray[i][j]));
59394 : }
59395 : }
59396 : }
59397 : #else
59398 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
59399 : // compute the list first and then call the visit function on each list element.
59400 :
59401 : // printf ("Inside of SgDeclarationScope::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
59402 :
59403 9190 : std::vector<SgDeclarationScope*> nodeList;
59404 :
59405 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
59406 9581 : for (unsigned int i=0; i < SgDeclarationScope::pools.size(); i++)
59407 : {
59408 : // objectArray[i] is a single memory pool
59409 9976990 : for (unsigned j=0; j < SgDeclarationScope::pool_size; j++)
59410 : {
59411 9972000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
59412 : {
59413 872680 : nodeList.push_back(&(objectArray[i][j]));
59414 : }
59415 : }
59416 : }
59417 :
59418 : // Iterate over the saved list
59419 4595 : size_t nodeListSize = nodeList.size();
59420 877275 : for (size_t i=0; i < nodeListSize; i++)
59421 : {
59422 872680 : ROSE_ASSERT(nodeList[i] != NULL);
59423 : #if 0
59424 : traversal.visit(nodeList[i]);
59425 : #else
59426 872680 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
59427 : {
59428 872680 : traversal.visit(nodeList[i]);
59429 : }
59430 : #endif
59431 : }
59432 : #endif
59433 : }
59434 :
59435 : // This should not be required since all previously static data members are
59436 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
59437 :
59438 5342 : }
59439 :
59440 :
59441 : void
59442 194 : SgDeclarationScope::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
59443 : {
59444 : // This function traverses the memory pool for an IR node and
59445 : // calls the function to execute the visitor object.
59446 :
59447 : // Initialize array to the address of the first element of the STL vector
59448 : // (which is guarenteed to be contiguous storage).
59449 : // SgDeclarationScope objectArray [] = *(Memory_Block_List.begin());
59450 194 : if (SgDeclarationScope::pools.empty() == false)
59451 : {
59452 : // Generate an array of memory pools
59453 194 : SgDeclarationScope** objectArray = (SgDeclarationScope**) &(SgDeclarationScope::pools[0]);
59454 :
59455 : // Build a local variable for better performance
59456 194 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
59457 :
59458 : // Iterate over the memory pools
59459 799 : for (unsigned int i=0; i < SgDeclarationScope::pools.size(); i++)
59460 : {
59461 : // objectArray[i] is a single memory pool
59462 1210600 : for (unsigned j=0; j < SgDeclarationScope::pool_size; j++)
59463 : {
59464 1210000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
59465 : {
59466 : // printf ("Found a valid SgDeclarationScope object in the memory pool %d at position %d \n",i,j);
59467 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
59468 901454 : objectArray[i][j].executeVisitorMemberFunction(visitor);
59469 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
59470 : }
59471 : else
59472 : {
59473 : // printf ("Found a INVALID SgDeclarationScope object in the memory pool \n");
59474 : }
59475 : }
59476 : }
59477 : }
59478 :
59479 : // This should not be required since all previously static data members are
59480 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
59481 :
59482 194 : }
59483 :
59484 : void
59485 0 : SgDeclarationScope::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
59486 : {
59487 : // This function visits only a single IR node of the memory pool.
59488 : // it is typically called once for each type of IR node within
59489 : // the automatically generated function: traverseRepresentativeNodes().
59490 :
59491 : // Initialize array to the address of the first element of the STL vector
59492 : // (which is guarenteed to be contiguous storage).
59493 : // SgDeclarationScope objectArray [] = *(Memory_Block_List.begin());
59494 0 : if (SgDeclarationScope::pools.empty() == false)
59495 : {
59496 : // Generate an array of memory pools
59497 0 : SgDeclarationScope** objectArray = (SgDeclarationScope**) &(SgDeclarationScope::pools[0]);
59498 :
59499 : // Build a local variable for better performance
59500 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
59501 :
59502 : // Iterate over the memory pools
59503 0 : bool done = false;
59504 0 : unsigned i=0;
59505 :
59506 : // find the first valid IR node, call visit function, and then leave
59507 0 : while ( done == false && i < SgDeclarationScope::pools.size() )
59508 : {
59509 : // objectArray[i] is a single memory pool
59510 : unsigned j=0;
59511 0 : while (done == false && j < SgDeclarationScope::pool_size)
59512 : {
59513 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
59514 : {
59515 0 : traversal.visit(&(objectArray[i][j]));
59516 0 : done = true;
59517 : }
59518 0 : j++;
59519 : }
59520 0 : i++;
59521 : }
59522 :
59523 : #if 0
59524 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
59525 : if (done == false)
59526 : {
59527 : printf ("No representative for SgDeclarationScope found in memory pools \n");
59528 : }
59529 : #endif
59530 : }
59531 0 : }
59532 :
59533 :
59534 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
59535 : // using values that overflow signed values of int.
59536 : size_t
59537 4 : SgDeclarationScope::numberOfNodes()
59538 : {
59539 : // This function traverses the memory pool for an IR node and
59540 : // counts the number of IR nodes of a particular Sage III IR
59541 : // nodes type.
59542 :
59543 4 : size_t count = 0;
59544 4 : if (SgDeclarationScope::pools.empty() == false)
59545 : {
59546 : // Generate an array of memory pools (this is actually a STL vector,
59547 : // but it is contiguious, so OK to treat this way).
59548 1 : SgDeclarationScope** objectArray = (SgDeclarationScope**) &(SgDeclarationScope::pools[0]);
59549 :
59550 : // Build a local variable for better performance (make it a loop invariant variable).
59551 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
59552 :
59553 : // Iterate over all of the memory pools for this IR node.
59554 5 : for (unsigned int i=0; i < SgDeclarationScope::pools.size(); i++)
59555 : {
59556 : // objectArray[i] is a single memory pool, iterate over all the
59557 : // IR nodes and only count those that are valid IR nodes used in
59558 : // the AST (i.e. allocated IR nodes).
59559 8004 : for (unsigned j=0; j < SgDeclarationScope::pool_size; j++)
59560 : {
59561 : // This is indexing the STL vector of C/C++ style arrays as a doubly
59562 : // indexed array access. It is OK since we have leveraged the semantics
59563 : // of STL vector memory as contigous and cast the memory as an array
59564 : // of arrays to use the 2D array indexing. Hope this is not confusing,
59565 : // but it s very fast as an implementation.
59566 8000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
59567 : {
59568 6496 : count++;
59569 : }
59570 : }
59571 : }
59572 : }
59573 :
59574 :
59575 :
59576 4 : return count;
59577 : }
59578 :
59579 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
59580 : // using values that overflow signed values of int.
59581 : size_t
59582 0 : SgDeclarationScope::memoryUsage()
59583 : {
59584 : // This function is required because we need the class name as a type when we call sizeof
59585 : // There might be another way to implement this if we have a traversal that only called a
59586 : // representative object (one call for each type of Sage IIIIR node).
59587 0 : size_t memory = numberOfNodes() * sizeof(SgDeclarationScope);
59588 :
59589 0 : return memory;
59590 : }
59591 :
59592 : /* #line 59593 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
59593 :
59594 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
59595 : void
59596 5342 : SgRangeBasedForStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
59597 : {
59598 : // This function traverses the memory pool for only a specific IR node
59599 : // and calls the visit function of the input class execute a traversal
59600 : // similar to the style of the attribute based traversals within ROSE.
59601 : // This traversal will visit ALL nodes of the AST where as the other
59602 : // attribute based traversals visit only the embedded tree within the AST.
59603 :
59604 : // Initialize array to the address of the first element of the STL vector
59605 : // (which is guaranteed to be contiguous storage).
59606 : // SgRangeBasedForStatement objectArray [] = *(Memory_Block_List.begin());
59607 5342 : if (SgRangeBasedForStatement::pools.empty() == false)
59608 : {
59609 : // Generate an array of memory pools
59610 0 : SgRangeBasedForStatement** objectArray = (SgRangeBasedForStatement**) &(SgRangeBasedForStatement::pools[0]);
59611 :
59612 : // Build a local variable for better performance
59613 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
59614 : #if 0
59615 : // Iterate over the memory pools
59616 : for (unsigned int i=0; i < SgRangeBasedForStatement::pools.size(); i++)
59617 : {
59618 : // objectArray[i] is a single memory pool
59619 : for (int j=0; j < SgRangeBasedForStatement::pool_size; j++)
59620 : {
59621 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
59622 : {
59623 : traversal.visit(&(objectArray[i][j]));
59624 : }
59625 : }
59626 : }
59627 : #else
59628 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
59629 : // compute the list first and then call the visit function on each list element.
59630 :
59631 : // printf ("Inside of SgRangeBasedForStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
59632 :
59633 0 : std::vector<SgRangeBasedForStatement*> nodeList;
59634 :
59635 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
59636 0 : for (unsigned int i=0; i < SgRangeBasedForStatement::pools.size(); i++)
59637 : {
59638 : // objectArray[i] is a single memory pool
59639 0 : for (unsigned j=0; j < SgRangeBasedForStatement::pool_size; j++)
59640 : {
59641 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
59642 : {
59643 0 : nodeList.push_back(&(objectArray[i][j]));
59644 : }
59645 : }
59646 : }
59647 :
59648 : // Iterate over the saved list
59649 0 : size_t nodeListSize = nodeList.size();
59650 0 : for (size_t i=0; i < nodeListSize; i++)
59651 : {
59652 0 : ROSE_ASSERT(nodeList[i] != NULL);
59653 : #if 0
59654 : traversal.visit(nodeList[i]);
59655 : #else
59656 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
59657 : {
59658 0 : traversal.visit(nodeList[i]);
59659 : }
59660 : #endif
59661 : }
59662 : #endif
59663 : }
59664 :
59665 : // This should not be required since all previously static data members are
59666 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
59667 :
59668 5342 : }
59669 :
59670 :
59671 : void
59672 194 : SgRangeBasedForStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
59673 : {
59674 : // This function traverses the memory pool for an IR node and
59675 : // calls the function to execute the visitor object.
59676 :
59677 : // Initialize array to the address of the first element of the STL vector
59678 : // (which is guarenteed to be contiguous storage).
59679 : // SgRangeBasedForStatement objectArray [] = *(Memory_Block_List.begin());
59680 194 : if (SgRangeBasedForStatement::pools.empty() == false)
59681 : {
59682 : // Generate an array of memory pools
59683 0 : SgRangeBasedForStatement** objectArray = (SgRangeBasedForStatement**) &(SgRangeBasedForStatement::pools[0]);
59684 :
59685 : // Build a local variable for better performance
59686 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
59687 :
59688 : // Iterate over the memory pools
59689 0 : for (unsigned int i=0; i < SgRangeBasedForStatement::pools.size(); i++)
59690 : {
59691 : // objectArray[i] is a single memory pool
59692 0 : for (unsigned j=0; j < SgRangeBasedForStatement::pool_size; j++)
59693 : {
59694 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
59695 : {
59696 : // printf ("Found a valid SgRangeBasedForStatement object in the memory pool %d at position %d \n",i,j);
59697 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
59698 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
59699 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
59700 : }
59701 : else
59702 : {
59703 : // printf ("Found a INVALID SgRangeBasedForStatement object in the memory pool \n");
59704 : }
59705 : }
59706 : }
59707 : }
59708 :
59709 : // This should not be required since all previously static data members are
59710 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
59711 :
59712 194 : }
59713 :
59714 : void
59715 0 : SgRangeBasedForStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
59716 : {
59717 : // This function visits only a single IR node of the memory pool.
59718 : // it is typically called once for each type of IR node within
59719 : // the automatically generated function: traverseRepresentativeNodes().
59720 :
59721 : // Initialize array to the address of the first element of the STL vector
59722 : // (which is guarenteed to be contiguous storage).
59723 : // SgRangeBasedForStatement objectArray [] = *(Memory_Block_List.begin());
59724 0 : if (SgRangeBasedForStatement::pools.empty() == false)
59725 : {
59726 : // Generate an array of memory pools
59727 0 : SgRangeBasedForStatement** objectArray = (SgRangeBasedForStatement**) &(SgRangeBasedForStatement::pools[0]);
59728 :
59729 : // Build a local variable for better performance
59730 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
59731 :
59732 : // Iterate over the memory pools
59733 0 : bool done = false;
59734 0 : unsigned i=0;
59735 :
59736 : // find the first valid IR node, call visit function, and then leave
59737 0 : while ( done == false && i < SgRangeBasedForStatement::pools.size() )
59738 : {
59739 : // objectArray[i] is a single memory pool
59740 : unsigned j=0;
59741 0 : while (done == false && j < SgRangeBasedForStatement::pool_size)
59742 : {
59743 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
59744 : {
59745 0 : traversal.visit(&(objectArray[i][j]));
59746 0 : done = true;
59747 : }
59748 0 : j++;
59749 : }
59750 0 : i++;
59751 : }
59752 :
59753 : #if 0
59754 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
59755 : if (done == false)
59756 : {
59757 : printf ("No representative for SgRangeBasedForStatement found in memory pools \n");
59758 : }
59759 : #endif
59760 : }
59761 0 : }
59762 :
59763 :
59764 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
59765 : // using values that overflow signed values of int.
59766 : size_t
59767 4 : SgRangeBasedForStatement::numberOfNodes()
59768 : {
59769 : // This function traverses the memory pool for an IR node and
59770 : // counts the number of IR nodes of a particular Sage III IR
59771 : // nodes type.
59772 :
59773 4 : size_t count = 0;
59774 4 : if (SgRangeBasedForStatement::pools.empty() == false)
59775 : {
59776 : // Generate an array of memory pools (this is actually a STL vector,
59777 : // but it is contiguious, so OK to treat this way).
59778 0 : SgRangeBasedForStatement** objectArray = (SgRangeBasedForStatement**) &(SgRangeBasedForStatement::pools[0]);
59779 :
59780 : // Build a local variable for better performance (make it a loop invariant variable).
59781 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
59782 :
59783 : // Iterate over all of the memory pools for this IR node.
59784 0 : for (unsigned int i=0; i < SgRangeBasedForStatement::pools.size(); i++)
59785 : {
59786 : // objectArray[i] is a single memory pool, iterate over all the
59787 : // IR nodes and only count those that are valid IR nodes used in
59788 : // the AST (i.e. allocated IR nodes).
59789 0 : for (unsigned j=0; j < SgRangeBasedForStatement::pool_size; j++)
59790 : {
59791 : // This is indexing the STL vector of C/C++ style arrays as a doubly
59792 : // indexed array access. It is OK since we have leveraged the semantics
59793 : // of STL vector memory as contigous and cast the memory as an array
59794 : // of arrays to use the 2D array indexing. Hope this is not confusing,
59795 : // but it s very fast as an implementation.
59796 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
59797 : {
59798 0 : count++;
59799 : }
59800 : }
59801 : }
59802 : }
59803 :
59804 :
59805 :
59806 4 : return count;
59807 : }
59808 :
59809 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
59810 : // using values that overflow signed values of int.
59811 : size_t
59812 0 : SgRangeBasedForStatement::memoryUsage()
59813 : {
59814 : // This function is required because we need the class name as a type when we call sizeof
59815 : // There might be another way to implement this if we have a traversal that only called a
59816 : // representative object (one call for each type of Sage IIIIR node).
59817 0 : size_t memory = numberOfNodes() * sizeof(SgRangeBasedForStatement);
59818 :
59819 0 : return memory;
59820 : }
59821 :
59822 : /* #line 59823 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
59823 :
59824 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
59825 : void
59826 5342 : SgFunctionTypeTable::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
59827 : {
59828 : // This function traverses the memory pool for only a specific IR node
59829 : // and calls the visit function of the input class execute a traversal
59830 : // similar to the style of the attribute based traversals within ROSE.
59831 : // This traversal will visit ALL nodes of the AST where as the other
59832 : // attribute based traversals visit only the embedded tree within the AST.
59833 :
59834 : // Initialize array to the address of the first element of the STL vector
59835 : // (which is guaranteed to be contiguous storage).
59836 : // SgFunctionTypeTable objectArray [] = *(Memory_Block_List.begin());
59837 5342 : if (SgFunctionTypeTable::pools.empty() == false)
59838 : {
59839 : // Generate an array of memory pools
59840 5046 : SgFunctionTypeTable** objectArray = (SgFunctionTypeTable**) &(SgFunctionTypeTable::pools[0]);
59841 :
59842 : // Build a local variable for better performance
59843 5046 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
59844 : #if 0
59845 : // Iterate over the memory pools
59846 : for (unsigned int i=0; i < SgFunctionTypeTable::pools.size(); i++)
59847 : {
59848 : // objectArray[i] is a single memory pool
59849 : for (int j=0; j < SgFunctionTypeTable::pool_size; j++)
59850 : {
59851 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
59852 : {
59853 : traversal.visit(&(objectArray[i][j]));
59854 : }
59855 : }
59856 : }
59857 : #else
59858 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
59859 : // compute the list first and then call the visit function on each list element.
59860 :
59861 : // printf ("Inside of SgFunctionTypeTable::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
59862 :
59863 10092 : std::vector<SgFunctionTypeTable*> nodeList;
59864 :
59865 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
59866 10092 : for (unsigned int i=0; i < SgFunctionTypeTable::pools.size(); i++)
59867 : {
59868 : // objectArray[i] is a single memory pool
59869 10097000 : for (unsigned j=0; j < SgFunctionTypeTable::pool_size; j++)
59870 : {
59871 10092000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
59872 : {
59873 5052 : nodeList.push_back(&(objectArray[i][j]));
59874 : }
59875 : }
59876 : }
59877 :
59878 : // Iterate over the saved list
59879 5046 : size_t nodeListSize = nodeList.size();
59880 10098 : for (size_t i=0; i < nodeListSize; i++)
59881 : {
59882 5052 : ROSE_ASSERT(nodeList[i] != NULL);
59883 : #if 0
59884 : traversal.visit(nodeList[i]);
59885 : #else
59886 5052 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
59887 : {
59888 5052 : traversal.visit(nodeList[i]);
59889 : }
59890 : #endif
59891 : }
59892 : #endif
59893 : }
59894 :
59895 : // This should not be required since all previously static data members are
59896 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
59897 :
59898 5342 : }
59899 :
59900 :
59901 : void
59902 194 : SgFunctionTypeTable::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
59903 : {
59904 : // This function traverses the memory pool for an IR node and
59905 : // calls the function to execute the visitor object.
59906 :
59907 : // Initialize array to the address of the first element of the STL vector
59908 : // (which is guarenteed to be contiguous storage).
59909 : // SgFunctionTypeTable objectArray [] = *(Memory_Block_List.begin());
59910 194 : if (SgFunctionTypeTable::pools.empty() == false)
59911 : {
59912 : // Generate an array of memory pools
59913 194 : SgFunctionTypeTable** objectArray = (SgFunctionTypeTable**) &(SgFunctionTypeTable::pools[0]);
59914 :
59915 : // Build a local variable for better performance
59916 194 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
59917 :
59918 : // Iterate over the memory pools
59919 388 : for (unsigned int i=0; i < SgFunctionTypeTable::pools.size(); i++)
59920 : {
59921 : // objectArray[i] is a single memory pool
59922 388194 : for (unsigned j=0; j < SgFunctionTypeTable::pool_size; j++)
59923 : {
59924 388000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
59925 : {
59926 : // printf ("Found a valid SgFunctionTypeTable object in the memory pool %d at position %d \n",i,j);
59927 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
59928 194 : objectArray[i][j].executeVisitorMemberFunction(visitor);
59929 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
59930 : }
59931 : else
59932 : {
59933 : // printf ("Found a INVALID SgFunctionTypeTable object in the memory pool \n");
59934 : }
59935 : }
59936 : }
59937 : }
59938 :
59939 : // This should not be required since all previously static data members are
59940 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
59941 :
59942 194 : }
59943 :
59944 : void
59945 0 : SgFunctionTypeTable::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
59946 : {
59947 : // This function visits only a single IR node of the memory pool.
59948 : // it is typically called once for each type of IR node within
59949 : // the automatically generated function: traverseRepresentativeNodes().
59950 :
59951 : // Initialize array to the address of the first element of the STL vector
59952 : // (which is guarenteed to be contiguous storage).
59953 : // SgFunctionTypeTable objectArray [] = *(Memory_Block_List.begin());
59954 0 : if (SgFunctionTypeTable::pools.empty() == false)
59955 : {
59956 : // Generate an array of memory pools
59957 0 : SgFunctionTypeTable** objectArray = (SgFunctionTypeTable**) &(SgFunctionTypeTable::pools[0]);
59958 :
59959 : // Build a local variable for better performance
59960 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
59961 :
59962 : // Iterate over the memory pools
59963 0 : bool done = false;
59964 0 : unsigned i=0;
59965 :
59966 : // find the first valid IR node, call visit function, and then leave
59967 0 : while ( done == false && i < SgFunctionTypeTable::pools.size() )
59968 : {
59969 : // objectArray[i] is a single memory pool
59970 : unsigned j=0;
59971 0 : while (done == false && j < SgFunctionTypeTable::pool_size)
59972 : {
59973 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
59974 : {
59975 0 : traversal.visit(&(objectArray[i][j]));
59976 0 : done = true;
59977 : }
59978 0 : j++;
59979 : }
59980 0 : i++;
59981 : }
59982 :
59983 : #if 0
59984 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
59985 : if (done == false)
59986 : {
59987 : printf ("No representative for SgFunctionTypeTable found in memory pools \n");
59988 : }
59989 : #endif
59990 : }
59991 0 : }
59992 :
59993 :
59994 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
59995 : // using values that overflow signed values of int.
59996 : size_t
59997 4 : SgFunctionTypeTable::numberOfNodes()
59998 : {
59999 : // This function traverses the memory pool for an IR node and
60000 : // counts the number of IR nodes of a particular Sage III IR
60001 : // nodes type.
60002 :
60003 4 : size_t count = 0;
60004 4 : if (SgFunctionTypeTable::pools.empty() == false)
60005 : {
60006 : // Generate an array of memory pools (this is actually a STL vector,
60007 : // but it is contiguious, so OK to treat this way).
60008 4 : SgFunctionTypeTable** objectArray = (SgFunctionTypeTable**) &(SgFunctionTypeTable::pools[0]);
60009 :
60010 : // Build a local variable for better performance (make it a loop invariant variable).
60011 4 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
60012 :
60013 : // Iterate over all of the memory pools for this IR node.
60014 8 : for (unsigned int i=0; i < SgFunctionTypeTable::pools.size(); i++)
60015 : {
60016 : // objectArray[i] is a single memory pool, iterate over all the
60017 : // IR nodes and only count those that are valid IR nodes used in
60018 : // the AST (i.e. allocated IR nodes).
60019 8004 : for (unsigned j=0; j < SgFunctionTypeTable::pool_size; j++)
60020 : {
60021 : // This is indexing the STL vector of C/C++ style arrays as a doubly
60022 : // indexed array access. It is OK since we have leveraged the semantics
60023 : // of STL vector memory as contigous and cast the memory as an array
60024 : // of arrays to use the 2D array indexing. Hope this is not confusing,
60025 : // but it s very fast as an implementation.
60026 8000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
60027 : {
60028 6 : count++;
60029 : }
60030 : }
60031 : }
60032 : }
60033 :
60034 :
60035 :
60036 4 : return count;
60037 : }
60038 :
60039 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
60040 : // using values that overflow signed values of int.
60041 : size_t
60042 0 : SgFunctionTypeTable::memoryUsage()
60043 : {
60044 : // This function is required because we need the class name as a type when we call sizeof
60045 : // There might be another way to implement this if we have a traversal that only called a
60046 : // representative object (one call for each type of Sage IIIIR node).
60047 0 : size_t memory = numberOfNodes() * sizeof(SgFunctionTypeTable);
60048 :
60049 0 : return memory;
60050 : }
60051 :
60052 : /* #line 60053 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
60053 :
60054 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
60055 : void
60056 5342 : SgDeclarationStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
60057 : {
60058 : // This function traverses the memory pool for only a specific IR node
60059 : // and calls the visit function of the input class execute a traversal
60060 : // similar to the style of the attribute based traversals within ROSE.
60061 : // This traversal will visit ALL nodes of the AST where as the other
60062 : // attribute based traversals visit only the embedded tree within the AST.
60063 :
60064 : // Initialize array to the address of the first element of the STL vector
60065 : // (which is guaranteed to be contiguous storage).
60066 : // SgDeclarationStatement objectArray [] = *(Memory_Block_List.begin());
60067 5342 : if (SgDeclarationStatement::pools.empty() == false)
60068 : {
60069 : // Generate an array of memory pools
60070 0 : SgDeclarationStatement** objectArray = (SgDeclarationStatement**) &(SgDeclarationStatement::pools[0]);
60071 :
60072 : // Build a local variable for better performance
60073 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
60074 : #if 0
60075 : // Iterate over the memory pools
60076 : for (unsigned int i=0; i < SgDeclarationStatement::pools.size(); i++)
60077 : {
60078 : // objectArray[i] is a single memory pool
60079 : for (int j=0; j < SgDeclarationStatement::pool_size; j++)
60080 : {
60081 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
60082 : {
60083 : traversal.visit(&(objectArray[i][j]));
60084 : }
60085 : }
60086 : }
60087 : #else
60088 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
60089 : // compute the list first and then call the visit function on each list element.
60090 :
60091 : // printf ("Inside of SgDeclarationStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
60092 :
60093 0 : std::vector<SgDeclarationStatement*> nodeList;
60094 :
60095 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
60096 0 : for (unsigned int i=0; i < SgDeclarationStatement::pools.size(); i++)
60097 : {
60098 : // objectArray[i] is a single memory pool
60099 0 : for (unsigned j=0; j < SgDeclarationStatement::pool_size; j++)
60100 : {
60101 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
60102 : {
60103 0 : nodeList.push_back(&(objectArray[i][j]));
60104 : }
60105 : }
60106 : }
60107 :
60108 : // Iterate over the saved list
60109 0 : size_t nodeListSize = nodeList.size();
60110 0 : for (size_t i=0; i < nodeListSize; i++)
60111 : {
60112 0 : ROSE_ASSERT(nodeList[i] != NULL);
60113 : #if 0
60114 : traversal.visit(nodeList[i]);
60115 : #else
60116 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
60117 : {
60118 0 : traversal.visit(nodeList[i]);
60119 : }
60120 : #endif
60121 : }
60122 : #endif
60123 : }
60124 :
60125 : // This should not be required since all previously static data members are
60126 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
60127 :
60128 5342 : }
60129 :
60130 :
60131 : void
60132 194 : SgDeclarationStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
60133 : {
60134 : // This function traverses the memory pool for an IR node and
60135 : // calls the function to execute the visitor object.
60136 :
60137 : // Initialize array to the address of the first element of the STL vector
60138 : // (which is guarenteed to be contiguous storage).
60139 : // SgDeclarationStatement objectArray [] = *(Memory_Block_List.begin());
60140 194 : if (SgDeclarationStatement::pools.empty() == false)
60141 : {
60142 : // Generate an array of memory pools
60143 0 : SgDeclarationStatement** objectArray = (SgDeclarationStatement**) &(SgDeclarationStatement::pools[0]);
60144 :
60145 : // Build a local variable for better performance
60146 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
60147 :
60148 : // Iterate over the memory pools
60149 0 : for (unsigned int i=0; i < SgDeclarationStatement::pools.size(); i++)
60150 : {
60151 : // objectArray[i] is a single memory pool
60152 0 : for (unsigned j=0; j < SgDeclarationStatement::pool_size; j++)
60153 : {
60154 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
60155 : {
60156 : // printf ("Found a valid SgDeclarationStatement object in the memory pool %d at position %d \n",i,j);
60157 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
60158 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
60159 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
60160 : }
60161 : else
60162 : {
60163 : // printf ("Found a INVALID SgDeclarationStatement object in the memory pool \n");
60164 : }
60165 : }
60166 : }
60167 : }
60168 :
60169 : // This should not be required since all previously static data members are
60170 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
60171 :
60172 194 : }
60173 :
60174 : void
60175 0 : SgDeclarationStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
60176 : {
60177 : // This function visits only a single IR node of the memory pool.
60178 : // it is typically called once for each type of IR node within
60179 : // the automatically generated function: traverseRepresentativeNodes().
60180 :
60181 : // Initialize array to the address of the first element of the STL vector
60182 : // (which is guarenteed to be contiguous storage).
60183 : // SgDeclarationStatement objectArray [] = *(Memory_Block_List.begin());
60184 0 : if (SgDeclarationStatement::pools.empty() == false)
60185 : {
60186 : // Generate an array of memory pools
60187 0 : SgDeclarationStatement** objectArray = (SgDeclarationStatement**) &(SgDeclarationStatement::pools[0]);
60188 :
60189 : // Build a local variable for better performance
60190 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
60191 :
60192 : // Iterate over the memory pools
60193 0 : bool done = false;
60194 0 : unsigned i=0;
60195 :
60196 : // find the first valid IR node, call visit function, and then leave
60197 0 : while ( done == false && i < SgDeclarationStatement::pools.size() )
60198 : {
60199 : // objectArray[i] is a single memory pool
60200 : unsigned j=0;
60201 0 : while (done == false && j < SgDeclarationStatement::pool_size)
60202 : {
60203 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
60204 : {
60205 0 : traversal.visit(&(objectArray[i][j]));
60206 0 : done = true;
60207 : }
60208 0 : j++;
60209 : }
60210 0 : i++;
60211 : }
60212 :
60213 : #if 0
60214 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
60215 : if (done == false)
60216 : {
60217 : printf ("No representative for SgDeclarationStatement found in memory pools \n");
60218 : }
60219 : #endif
60220 : }
60221 0 : }
60222 :
60223 :
60224 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
60225 : // using values that overflow signed values of int.
60226 : size_t
60227 4 : SgDeclarationStatement::numberOfNodes()
60228 : {
60229 : // This function traverses the memory pool for an IR node and
60230 : // counts the number of IR nodes of a particular Sage III IR
60231 : // nodes type.
60232 :
60233 4 : size_t count = 0;
60234 4 : if (SgDeclarationStatement::pools.empty() == false)
60235 : {
60236 : // Generate an array of memory pools (this is actually a STL vector,
60237 : // but it is contiguious, so OK to treat this way).
60238 0 : SgDeclarationStatement** objectArray = (SgDeclarationStatement**) &(SgDeclarationStatement::pools[0]);
60239 :
60240 : // Build a local variable for better performance (make it a loop invariant variable).
60241 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
60242 :
60243 : // Iterate over all of the memory pools for this IR node.
60244 0 : for (unsigned int i=0; i < SgDeclarationStatement::pools.size(); i++)
60245 : {
60246 : // objectArray[i] is a single memory pool, iterate over all the
60247 : // IR nodes and only count those that are valid IR nodes used in
60248 : // the AST (i.e. allocated IR nodes).
60249 0 : for (unsigned j=0; j < SgDeclarationStatement::pool_size; j++)
60250 : {
60251 : // This is indexing the STL vector of C/C++ style arrays as a doubly
60252 : // indexed array access. It is OK since we have leveraged the semantics
60253 : // of STL vector memory as contigous and cast the memory as an array
60254 : // of arrays to use the 2D array indexing. Hope this is not confusing,
60255 : // but it s very fast as an implementation.
60256 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
60257 : {
60258 0 : count++;
60259 : }
60260 : }
60261 : }
60262 : }
60263 :
60264 :
60265 :
60266 4 : return count;
60267 : }
60268 :
60269 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
60270 : // using values that overflow signed values of int.
60271 : size_t
60272 0 : SgDeclarationStatement::memoryUsage()
60273 : {
60274 : // This function is required because we need the class name as a type when we call sizeof
60275 : // There might be another way to implement this if we have a traversal that only called a
60276 : // representative object (one call for each type of Sage IIIIR node).
60277 0 : size_t memory = numberOfNodes() * sizeof(SgDeclarationStatement);
60278 :
60279 0 : return memory;
60280 : }
60281 :
60282 : /* #line 60283 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
60283 :
60284 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
60285 : void
60286 5342 : SgFunctionParameterList::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
60287 : {
60288 : // This function traverses the memory pool for only a specific IR node
60289 : // and calls the visit function of the input class execute a traversal
60290 : // similar to the style of the attribute based traversals within ROSE.
60291 : // This traversal will visit ALL nodes of the AST where as the other
60292 : // attribute based traversals visit only the embedded tree within the AST.
60293 :
60294 : // Initialize array to the address of the first element of the STL vector
60295 : // (which is guaranteed to be contiguous storage).
60296 : // SgFunctionParameterList objectArray [] = *(Memory_Block_List.begin());
60297 5342 : if (SgFunctionParameterList::pools.empty() == false)
60298 : {
60299 : // Generate an array of memory pools
60300 5303 : SgFunctionParameterList** objectArray = (SgFunctionParameterList**) &(SgFunctionParameterList::pools[0]);
60301 :
60302 : // Build a local variable for better performance
60303 5303 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
60304 : #if 0
60305 : // Iterate over the memory pools
60306 : for (unsigned int i=0; i < SgFunctionParameterList::pools.size(); i++)
60307 : {
60308 : // objectArray[i] is a single memory pool
60309 : for (int j=0; j < SgFunctionParameterList::pool_size; j++)
60310 : {
60311 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
60312 : {
60313 : traversal.visit(&(objectArray[i][j]));
60314 : }
60315 : }
60316 : }
60317 : #else
60318 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
60319 : // compute the list first and then call the visit function on each list element.
60320 :
60321 : // printf ("Inside of SgFunctionParameterList::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
60322 :
60323 10606 : std::vector<SgFunctionParameterList*> nodeList;
60324 :
60325 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
60326 25661 : for (unsigned int i=0; i < SgFunctionParameterList::pools.size(); i++)
60327 : {
60328 : // objectArray[i] is a single memory pool
60329 40736400 : for (unsigned j=0; j < SgFunctionParameterList::pool_size; j++)
60330 : {
60331 40716000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
60332 : {
60333 34320600 : nodeList.push_back(&(objectArray[i][j]));
60334 : }
60335 : }
60336 : }
60337 :
60338 : // Iterate over the saved list
60339 5303 : size_t nodeListSize = nodeList.size();
60340 34325900 : for (size_t i=0; i < nodeListSize; i++)
60341 : {
60342 34320600 : ROSE_ASSERT(nodeList[i] != NULL);
60343 : #if 0
60344 : traversal.visit(nodeList[i]);
60345 : #else
60346 34320600 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
60347 : {
60348 34320600 : traversal.visit(nodeList[i]);
60349 : }
60350 : #endif
60351 : }
60352 : #endif
60353 : }
60354 :
60355 : // This should not be required since all previously static data members are
60356 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
60357 :
60358 5342 : }
60359 :
60360 :
60361 : void
60362 194 : SgFunctionParameterList::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
60363 : {
60364 : // This function traverses the memory pool for an IR node and
60365 : // calls the function to execute the visitor object.
60366 :
60367 : // Initialize array to the address of the first element of the STL vector
60368 : // (which is guarenteed to be contiguous storage).
60369 : // SgFunctionParameterList objectArray [] = *(Memory_Block_List.begin());
60370 194 : if (SgFunctionParameterList::pools.empty() == false)
60371 : {
60372 : // Generate an array of memory pools
60373 194 : SgFunctionParameterList** objectArray = (SgFunctionParameterList**) &(SgFunctionParameterList::pools[0]);
60374 :
60375 : // Build a local variable for better performance
60376 194 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
60377 :
60378 : // Iterate over the memory pools
60379 1655 : for (unsigned int i=0; i < SgFunctionParameterList::pools.size(); i++)
60380 : {
60381 : // objectArray[i] is a single memory pool
60382 2923460 : for (unsigned j=0; j < SgFunctionParameterList::pool_size; j++)
60383 : {
60384 2922000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
60385 : {
60386 : // printf ("Found a valid SgFunctionParameterList object in the memory pool %d at position %d \n",i,j);
60387 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
60388 2614510 : objectArray[i][j].executeVisitorMemberFunction(visitor);
60389 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
60390 : }
60391 : else
60392 : {
60393 : // printf ("Found a INVALID SgFunctionParameterList object in the memory pool \n");
60394 : }
60395 : }
60396 : }
60397 : }
60398 :
60399 : // This should not be required since all previously static data members are
60400 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
60401 :
60402 194 : }
60403 :
60404 : void
60405 0 : SgFunctionParameterList::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
60406 : {
60407 : // This function visits only a single IR node of the memory pool.
60408 : // it is typically called once for each type of IR node within
60409 : // the automatically generated function: traverseRepresentativeNodes().
60410 :
60411 : // Initialize array to the address of the first element of the STL vector
60412 : // (which is guarenteed to be contiguous storage).
60413 : // SgFunctionParameterList objectArray [] = *(Memory_Block_List.begin());
60414 0 : if (SgFunctionParameterList::pools.empty() == false)
60415 : {
60416 : // Generate an array of memory pools
60417 0 : SgFunctionParameterList** objectArray = (SgFunctionParameterList**) &(SgFunctionParameterList::pools[0]);
60418 :
60419 : // Build a local variable for better performance
60420 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
60421 :
60422 : // Iterate over the memory pools
60423 0 : bool done = false;
60424 0 : unsigned i=0;
60425 :
60426 : // find the first valid IR node, call visit function, and then leave
60427 0 : while ( done == false && i < SgFunctionParameterList::pools.size() )
60428 : {
60429 : // objectArray[i] is a single memory pool
60430 : unsigned j=0;
60431 0 : while (done == false && j < SgFunctionParameterList::pool_size)
60432 : {
60433 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
60434 : {
60435 0 : traversal.visit(&(objectArray[i][j]));
60436 0 : done = true;
60437 : }
60438 0 : j++;
60439 : }
60440 0 : i++;
60441 : }
60442 :
60443 : #if 0
60444 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
60445 : if (done == false)
60446 : {
60447 : printf ("No representative for SgFunctionParameterList found in memory pools \n");
60448 : }
60449 : #endif
60450 : }
60451 0 : }
60452 :
60453 :
60454 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
60455 : // using values that overflow signed values of int.
60456 : size_t
60457 4 : SgFunctionParameterList::numberOfNodes()
60458 : {
60459 : // This function traverses the memory pool for an IR node and
60460 : // counts the number of IR nodes of a particular Sage III IR
60461 : // nodes type.
60462 :
60463 4 : size_t count = 0;
60464 4 : if (SgFunctionParameterList::pools.empty() == false)
60465 : {
60466 : // Generate an array of memory pools (this is actually a STL vector,
60467 : // but it is contiguious, so OK to treat this way).
60468 4 : SgFunctionParameterList** objectArray = (SgFunctionParameterList**) &(SgFunctionParameterList::pools[0]);
60469 :
60470 : // Build a local variable for better performance (make it a loop invariant variable).
60471 4 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
60472 :
60473 : // Iterate over all of the memory pools for this IR node.
60474 19 : for (unsigned int i=0; i < SgFunctionParameterList::pools.size(); i++)
60475 : {
60476 : // objectArray[i] is a single memory pool, iterate over all the
60477 : // IR nodes and only count those that are valid IR nodes used in
60478 : // the AST (i.e. allocated IR nodes).
60479 30015 : for (unsigned j=0; j < SgFunctionParameterList::pool_size; j++)
60480 : {
60481 : // This is indexing the STL vector of C/C++ style arrays as a doubly
60482 : // indexed array access. It is OK since we have leveraged the semantics
60483 : // of STL vector memory as contigous and cast the memory as an array
60484 : // of arrays to use the 2D array indexing. Hope this is not confusing,
60485 : // but it s very fast as an implementation.
60486 30000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
60487 : {
60488 22773 : count++;
60489 : }
60490 : }
60491 : }
60492 : }
60493 :
60494 :
60495 :
60496 4 : return count;
60497 : }
60498 :
60499 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
60500 : // using values that overflow signed values of int.
60501 : size_t
60502 0 : SgFunctionParameterList::memoryUsage()
60503 : {
60504 : // This function is required because we need the class name as a type when we call sizeof
60505 : // There might be another way to implement this if we have a traversal that only called a
60506 : // representative object (one call for each type of Sage IIIIR node).
60507 0 : size_t memory = numberOfNodes() * sizeof(SgFunctionParameterList);
60508 :
60509 0 : return memory;
60510 : }
60511 :
60512 : /* #line 60513 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
60513 :
60514 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
60515 : void
60516 5342 : SgVariableDeclaration::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
60517 : {
60518 : // This function traverses the memory pool for only a specific IR node
60519 : // and calls the visit function of the input class execute a traversal
60520 : // similar to the style of the attribute based traversals within ROSE.
60521 : // This traversal will visit ALL nodes of the AST where as the other
60522 : // attribute based traversals visit only the embedded tree within the AST.
60523 :
60524 : // Initialize array to the address of the first element of the STL vector
60525 : // (which is guaranteed to be contiguous storage).
60526 : // SgVariableDeclaration objectArray [] = *(Memory_Block_List.begin());
60527 5342 : if (SgVariableDeclaration::pools.empty() == false)
60528 : {
60529 : // Generate an array of memory pools
60530 4662 : SgVariableDeclaration** objectArray = (SgVariableDeclaration**) &(SgVariableDeclaration::pools[0]);
60531 :
60532 : // Build a local variable for better performance
60533 4662 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
60534 : #if 0
60535 : // Iterate over the memory pools
60536 : for (unsigned int i=0; i < SgVariableDeclaration::pools.size(); i++)
60537 : {
60538 : // objectArray[i] is a single memory pool
60539 : for (int j=0; j < SgVariableDeclaration::pool_size; j++)
60540 : {
60541 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
60542 : {
60543 : traversal.visit(&(objectArray[i][j]));
60544 : }
60545 : }
60546 : }
60547 : #else
60548 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
60549 : // compute the list first and then call the visit function on each list element.
60550 :
60551 : // printf ("Inside of SgVariableDeclaration::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
60552 :
60553 9324 : std::vector<SgVariableDeclaration*> nodeList;
60554 :
60555 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
60556 9325 : for (unsigned int i=0; i < SgVariableDeclaration::pools.size(); i++)
60557 : {
60558 : // objectArray[i] is a single memory pool
60559 9330660 : for (unsigned j=0; j < SgVariableDeclaration::pool_size; j++)
60560 : {
60561 9326000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
60562 : {
60563 481035 : nodeList.push_back(&(objectArray[i][j]));
60564 : }
60565 : }
60566 : }
60567 :
60568 : // Iterate over the saved list
60569 4662 : size_t nodeListSize = nodeList.size();
60570 485697 : for (size_t i=0; i < nodeListSize; i++)
60571 : {
60572 481035 : ROSE_ASSERT(nodeList[i] != NULL);
60573 : #if 0
60574 : traversal.visit(nodeList[i]);
60575 : #else
60576 481035 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
60577 : {
60578 481035 : traversal.visit(nodeList[i]);
60579 : }
60580 : #endif
60581 : }
60582 : #endif
60583 : }
60584 :
60585 : // This should not be required since all previously static data members are
60586 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
60587 :
60588 5342 : }
60589 :
60590 :
60591 : void
60592 194 : SgVariableDeclaration::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
60593 : {
60594 : // This function traverses the memory pool for an IR node and
60595 : // calls the function to execute the visitor object.
60596 :
60597 : // Initialize array to the address of the first element of the STL vector
60598 : // (which is guarenteed to be contiguous storage).
60599 : // SgVariableDeclaration objectArray [] = *(Memory_Block_List.begin());
60600 194 : if (SgVariableDeclaration::pools.empty() == false)
60601 : {
60602 : // Generate an array of memory pools
60603 194 : SgVariableDeclaration** objectArray = (SgVariableDeclaration**) &(SgVariableDeclaration::pools[0]);
60604 :
60605 : // Build a local variable for better performance
60606 194 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
60607 :
60608 : // Iterate over the memory pools
60609 389 : for (unsigned int i=0; i < SgVariableDeclaration::pools.size(); i++)
60610 : {
60611 : // objectArray[i] is a single memory pool
60612 390195 : for (unsigned j=0; j < SgVariableDeclaration::pool_size; j++)
60613 : {
60614 390000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
60615 : {
60616 : // printf ("Found a valid SgVariableDeclaration object in the memory pool %d at position %d \n",i,j);
60617 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
60618 176933 : objectArray[i][j].executeVisitorMemberFunction(visitor);
60619 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
60620 : }
60621 : else
60622 : {
60623 : // printf ("Found a INVALID SgVariableDeclaration object in the memory pool \n");
60624 : }
60625 : }
60626 : }
60627 : }
60628 :
60629 : // This should not be required since all previously static data members are
60630 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
60631 :
60632 194 : }
60633 :
60634 : void
60635 0 : SgVariableDeclaration::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
60636 : {
60637 : // This function visits only a single IR node of the memory pool.
60638 : // it is typically called once for each type of IR node within
60639 : // the automatically generated function: traverseRepresentativeNodes().
60640 :
60641 : // Initialize array to the address of the first element of the STL vector
60642 : // (which is guarenteed to be contiguous storage).
60643 : // SgVariableDeclaration objectArray [] = *(Memory_Block_List.begin());
60644 0 : if (SgVariableDeclaration::pools.empty() == false)
60645 : {
60646 : // Generate an array of memory pools
60647 0 : SgVariableDeclaration** objectArray = (SgVariableDeclaration**) &(SgVariableDeclaration::pools[0]);
60648 :
60649 : // Build a local variable for better performance
60650 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
60651 :
60652 : // Iterate over the memory pools
60653 0 : bool done = false;
60654 0 : unsigned i=0;
60655 :
60656 : // find the first valid IR node, call visit function, and then leave
60657 0 : while ( done == false && i < SgVariableDeclaration::pools.size() )
60658 : {
60659 : // objectArray[i] is a single memory pool
60660 : unsigned j=0;
60661 0 : while (done == false && j < SgVariableDeclaration::pool_size)
60662 : {
60663 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
60664 : {
60665 0 : traversal.visit(&(objectArray[i][j]));
60666 0 : done = true;
60667 : }
60668 0 : j++;
60669 : }
60670 0 : i++;
60671 : }
60672 :
60673 : #if 0
60674 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
60675 : if (done == false)
60676 : {
60677 : printf ("No representative for SgVariableDeclaration found in memory pools \n");
60678 : }
60679 : #endif
60680 : }
60681 0 : }
60682 :
60683 :
60684 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
60685 : // using values that overflow signed values of int.
60686 : size_t
60687 4 : SgVariableDeclaration::numberOfNodes()
60688 : {
60689 : // This function traverses the memory pool for an IR node and
60690 : // counts the number of IR nodes of a particular Sage III IR
60691 : // nodes type.
60692 :
60693 4 : size_t count = 0;
60694 4 : if (SgVariableDeclaration::pools.empty() == false)
60695 : {
60696 : // Generate an array of memory pools (this is actually a STL vector,
60697 : // but it is contiguious, so OK to treat this way).
60698 2 : SgVariableDeclaration** objectArray = (SgVariableDeclaration**) &(SgVariableDeclaration::pools[0]);
60699 :
60700 : // Build a local variable for better performance (make it a loop invariant variable).
60701 2 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
60702 :
60703 : // Iterate over all of the memory pools for this IR node.
60704 4 : for (unsigned int i=0; i < SgVariableDeclaration::pools.size(); i++)
60705 : {
60706 : // objectArray[i] is a single memory pool, iterate over all the
60707 : // IR nodes and only count those that are valid IR nodes used in
60708 : // the AST (i.e. allocated IR nodes).
60709 4002 : for (unsigned j=0; j < SgVariableDeclaration::pool_size; j++)
60710 : {
60711 : // This is indexing the STL vector of C/C++ style arrays as a doubly
60712 : // indexed array access. It is OK since we have leveraged the semantics
60713 : // of STL vector memory as contigous and cast the memory as an array
60714 : // of arrays to use the 2D array indexing. Hope this is not confusing,
60715 : // but it s very fast as an implementation.
60716 4000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
60717 : {
60718 1294 : count++;
60719 : }
60720 : }
60721 : }
60722 : }
60723 :
60724 :
60725 :
60726 4 : return count;
60727 : }
60728 :
60729 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
60730 : // using values that overflow signed values of int.
60731 : size_t
60732 0 : SgVariableDeclaration::memoryUsage()
60733 : {
60734 : // This function is required because we need the class name as a type when we call sizeof
60735 : // There might be another way to implement this if we have a traversal that only called a
60736 : // representative object (one call for each type of Sage IIIIR node).
60737 0 : size_t memory = numberOfNodes() * sizeof(SgVariableDeclaration);
60738 :
60739 0 : return memory;
60740 : }
60741 :
60742 : /* #line 60743 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
60743 :
60744 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
60745 : void
60746 5342 : SgTemplateVariableDeclaration::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
60747 : {
60748 : // This function traverses the memory pool for only a specific IR node
60749 : // and calls the visit function of the input class execute a traversal
60750 : // similar to the style of the attribute based traversals within ROSE.
60751 : // This traversal will visit ALL nodes of the AST where as the other
60752 : // attribute based traversals visit only the embedded tree within the AST.
60753 :
60754 : // Initialize array to the address of the first element of the STL vector
60755 : // (which is guaranteed to be contiguous storage).
60756 : // SgTemplateVariableDeclaration objectArray [] = *(Memory_Block_List.begin());
60757 5342 : if (SgTemplateVariableDeclaration::pools.empty() == false)
60758 : {
60759 : // Generate an array of memory pools
60760 145 : SgTemplateVariableDeclaration** objectArray = (SgTemplateVariableDeclaration**) &(SgTemplateVariableDeclaration::pools[0]);
60761 :
60762 : // Build a local variable for better performance
60763 145 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
60764 : #if 0
60765 : // Iterate over the memory pools
60766 : for (unsigned int i=0; i < SgTemplateVariableDeclaration::pools.size(); i++)
60767 : {
60768 : // objectArray[i] is a single memory pool
60769 : for (int j=0; j < SgTemplateVariableDeclaration::pool_size; j++)
60770 : {
60771 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
60772 : {
60773 : traversal.visit(&(objectArray[i][j]));
60774 : }
60775 : }
60776 : }
60777 : #else
60778 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
60779 : // compute the list first and then call the visit function on each list element.
60780 :
60781 : // printf ("Inside of SgTemplateVariableDeclaration::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
60782 :
60783 290 : std::vector<SgTemplateVariableDeclaration*> nodeList;
60784 :
60785 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
60786 290 : for (unsigned int i=0; i < SgTemplateVariableDeclaration::pools.size(); i++)
60787 : {
60788 : // objectArray[i] is a single memory pool
60789 290145 : for (unsigned j=0; j < SgTemplateVariableDeclaration::pool_size; j++)
60790 : {
60791 290000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
60792 : {
60793 12778 : nodeList.push_back(&(objectArray[i][j]));
60794 : }
60795 : }
60796 : }
60797 :
60798 : // Iterate over the saved list
60799 145 : size_t nodeListSize = nodeList.size();
60800 12923 : for (size_t i=0; i < nodeListSize; i++)
60801 : {
60802 12778 : ROSE_ASSERT(nodeList[i] != NULL);
60803 : #if 0
60804 : traversal.visit(nodeList[i]);
60805 : #else
60806 12778 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
60807 : {
60808 12778 : traversal.visit(nodeList[i]);
60809 : }
60810 : #endif
60811 : }
60812 : #endif
60813 : }
60814 :
60815 : // This should not be required since all previously static data members are
60816 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
60817 :
60818 5342 : }
60819 :
60820 :
60821 : void
60822 194 : SgTemplateVariableDeclaration::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
60823 : {
60824 : // This function traverses the memory pool for an IR node and
60825 : // calls the function to execute the visitor object.
60826 :
60827 : // Initialize array to the address of the first element of the STL vector
60828 : // (which is guarenteed to be contiguous storage).
60829 : // SgTemplateVariableDeclaration objectArray [] = *(Memory_Block_List.begin());
60830 194 : if (SgTemplateVariableDeclaration::pools.empty() == false)
60831 : {
60832 : // Generate an array of memory pools
60833 137 : SgTemplateVariableDeclaration** objectArray = (SgTemplateVariableDeclaration**) &(SgTemplateVariableDeclaration::pools[0]);
60834 :
60835 : // Build a local variable for better performance
60836 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
60837 :
60838 : // Iterate over the memory pools
60839 274 : for (unsigned int i=0; i < SgTemplateVariableDeclaration::pools.size(); i++)
60840 : {
60841 : // objectArray[i] is a single memory pool
60842 274137 : for (unsigned j=0; j < SgTemplateVariableDeclaration::pool_size; j++)
60843 : {
60844 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
60845 : {
60846 : // printf ("Found a valid SgTemplateVariableDeclaration object in the memory pool %d at position %d \n",i,j);
60847 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
60848 13957 : objectArray[i][j].executeVisitorMemberFunction(visitor);
60849 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
60850 : }
60851 : else
60852 : {
60853 : // printf ("Found a INVALID SgTemplateVariableDeclaration object in the memory pool \n");
60854 : }
60855 : }
60856 : }
60857 : }
60858 :
60859 : // This should not be required since all previously static data members are
60860 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
60861 :
60862 194 : }
60863 :
60864 : void
60865 0 : SgTemplateVariableDeclaration::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
60866 : {
60867 : // This function visits only a single IR node of the memory pool.
60868 : // it is typically called once for each type of IR node within
60869 : // the automatically generated function: traverseRepresentativeNodes().
60870 :
60871 : // Initialize array to the address of the first element of the STL vector
60872 : // (which is guarenteed to be contiguous storage).
60873 : // SgTemplateVariableDeclaration objectArray [] = *(Memory_Block_List.begin());
60874 0 : if (SgTemplateVariableDeclaration::pools.empty() == false)
60875 : {
60876 : // Generate an array of memory pools
60877 0 : SgTemplateVariableDeclaration** objectArray = (SgTemplateVariableDeclaration**) &(SgTemplateVariableDeclaration::pools[0]);
60878 :
60879 : // Build a local variable for better performance
60880 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
60881 :
60882 : // Iterate over the memory pools
60883 0 : bool done = false;
60884 0 : unsigned i=0;
60885 :
60886 : // find the first valid IR node, call visit function, and then leave
60887 0 : while ( done == false && i < SgTemplateVariableDeclaration::pools.size() )
60888 : {
60889 : // objectArray[i] is a single memory pool
60890 : unsigned j=0;
60891 0 : while (done == false && j < SgTemplateVariableDeclaration::pool_size)
60892 : {
60893 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
60894 : {
60895 0 : traversal.visit(&(objectArray[i][j]));
60896 0 : done = true;
60897 : }
60898 0 : j++;
60899 : }
60900 0 : i++;
60901 : }
60902 :
60903 : #if 0
60904 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
60905 : if (done == false)
60906 : {
60907 : printf ("No representative for SgTemplateVariableDeclaration found in memory pools \n");
60908 : }
60909 : #endif
60910 : }
60911 0 : }
60912 :
60913 :
60914 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
60915 : // using values that overflow signed values of int.
60916 : size_t
60917 4 : SgTemplateVariableDeclaration::numberOfNodes()
60918 : {
60919 : // This function traverses the memory pool for an IR node and
60920 : // counts the number of IR nodes of a particular Sage III IR
60921 : // nodes type.
60922 :
60923 4 : size_t count = 0;
60924 4 : if (SgTemplateVariableDeclaration::pools.empty() == false)
60925 : {
60926 : // Generate an array of memory pools (this is actually a STL vector,
60927 : // but it is contiguious, so OK to treat this way).
60928 1 : SgTemplateVariableDeclaration** objectArray = (SgTemplateVariableDeclaration**) &(SgTemplateVariableDeclaration::pools[0]);
60929 :
60930 : // Build a local variable for better performance (make it a loop invariant variable).
60931 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
60932 :
60933 : // Iterate over all of the memory pools for this IR node.
60934 2 : for (unsigned int i=0; i < SgTemplateVariableDeclaration::pools.size(); i++)
60935 : {
60936 : // objectArray[i] is a single memory pool, iterate over all the
60937 : // IR nodes and only count those that are valid IR nodes used in
60938 : // the AST (i.e. allocated IR nodes).
60939 2001 : for (unsigned j=0; j < SgTemplateVariableDeclaration::pool_size; j++)
60940 : {
60941 : // This is indexing the STL vector of C/C++ style arrays as a doubly
60942 : // indexed array access. It is OK since we have leveraged the semantics
60943 : // of STL vector memory as contigous and cast the memory as an array
60944 : // of arrays to use the 2D array indexing. Hope this is not confusing,
60945 : // but it s very fast as an implementation.
60946 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
60947 : {
60948 102 : count++;
60949 : }
60950 : }
60951 : }
60952 : }
60953 :
60954 :
60955 :
60956 4 : return count;
60957 : }
60958 :
60959 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
60960 : // using values that overflow signed values of int.
60961 : size_t
60962 0 : SgTemplateVariableDeclaration::memoryUsage()
60963 : {
60964 : // This function is required because we need the class name as a type when we call sizeof
60965 : // There might be another way to implement this if we have a traversal that only called a
60966 : // representative object (one call for each type of Sage IIIIR node).
60967 0 : size_t memory = numberOfNodes() * sizeof(SgTemplateVariableDeclaration);
60968 :
60969 0 : return memory;
60970 : }
60971 :
60972 : /* #line 60973 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
60973 :
60974 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
60975 : void
60976 5342 : SgVariableDefinition::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
60977 : {
60978 : // This function traverses the memory pool for only a specific IR node
60979 : // and calls the visit function of the input class execute a traversal
60980 : // similar to the style of the attribute based traversals within ROSE.
60981 : // This traversal will visit ALL nodes of the AST where as the other
60982 : // attribute based traversals visit only the embedded tree within the AST.
60983 :
60984 : // Initialize array to the address of the first element of the STL vector
60985 : // (which is guaranteed to be contiguous storage).
60986 : // SgVariableDefinition objectArray [] = *(Memory_Block_List.begin());
60987 5342 : if (SgVariableDefinition::pools.empty() == false)
60988 : {
60989 : // Generate an array of memory pools
60990 4669 : SgVariableDefinition** objectArray = (SgVariableDefinition**) &(SgVariableDefinition::pools[0]);
60991 :
60992 : // Build a local variable for better performance
60993 4669 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
60994 : #if 0
60995 : // Iterate over the memory pools
60996 : for (unsigned int i=0; i < SgVariableDefinition::pools.size(); i++)
60997 : {
60998 : // objectArray[i] is a single memory pool
60999 : for (int j=0; j < SgVariableDefinition::pool_size; j++)
61000 : {
61001 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
61002 : {
61003 : traversal.visit(&(objectArray[i][j]));
61004 : }
61005 : }
61006 : }
61007 : #else
61008 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
61009 : // compute the list first and then call the visit function on each list element.
61010 :
61011 : // printf ("Inside of SgVariableDefinition::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
61012 :
61013 9338 : std::vector<SgVariableDefinition*> nodeList;
61014 :
61015 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
61016 9339 : for (unsigned int i=0; i < SgVariableDefinition::pools.size(); i++)
61017 : {
61018 : // objectArray[i] is a single memory pool
61019 9344670 : for (unsigned j=0; j < SgVariableDefinition::pool_size; j++)
61020 : {
61021 9340000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
61022 : {
61023 494349 : nodeList.push_back(&(objectArray[i][j]));
61024 : }
61025 : }
61026 : }
61027 :
61028 : // Iterate over the saved list
61029 4669 : size_t nodeListSize = nodeList.size();
61030 499018 : for (size_t i=0; i < nodeListSize; i++)
61031 : {
61032 494349 : ROSE_ASSERT(nodeList[i] != NULL);
61033 : #if 0
61034 : traversal.visit(nodeList[i]);
61035 : #else
61036 494349 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
61037 : {
61038 494349 : traversal.visit(nodeList[i]);
61039 : }
61040 : #endif
61041 : }
61042 : #endif
61043 : }
61044 :
61045 : // This should not be required since all previously static data members are
61046 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
61047 :
61048 5342 : }
61049 :
61050 :
61051 : void
61052 194 : SgVariableDefinition::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
61053 : {
61054 : // This function traverses the memory pool for an IR node and
61055 : // calls the function to execute the visitor object.
61056 :
61057 : // Initialize array to the address of the first element of the STL vector
61058 : // (which is guarenteed to be contiguous storage).
61059 : // SgVariableDefinition objectArray [] = *(Memory_Block_List.begin());
61060 194 : if (SgVariableDefinition::pools.empty() == false)
61061 : {
61062 : // Generate an array of memory pools
61063 194 : SgVariableDefinition** objectArray = (SgVariableDefinition**) &(SgVariableDefinition::pools[0]);
61064 :
61065 : // Build a local variable for better performance
61066 194 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
61067 :
61068 : // Iterate over the memory pools
61069 389 : for (unsigned int i=0; i < SgVariableDefinition::pools.size(); i++)
61070 : {
61071 : // objectArray[i] is a single memory pool
61072 390195 : for (unsigned j=0; j < SgVariableDefinition::pool_size; j++)
61073 : {
61074 390000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
61075 : {
61076 : // printf ("Found a valid SgVariableDefinition object in the memory pool %d at position %d \n",i,j);
61077 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
61078 190890 : objectArray[i][j].executeVisitorMemberFunction(visitor);
61079 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
61080 : }
61081 : else
61082 : {
61083 : // printf ("Found a INVALID SgVariableDefinition object in the memory pool \n");
61084 : }
61085 : }
61086 : }
61087 : }
61088 :
61089 : // This should not be required since all previously static data members are
61090 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
61091 :
61092 194 : }
61093 :
61094 : void
61095 0 : SgVariableDefinition::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
61096 : {
61097 : // This function visits only a single IR node of the memory pool.
61098 : // it is typically called once for each type of IR node within
61099 : // the automatically generated function: traverseRepresentativeNodes().
61100 :
61101 : // Initialize array to the address of the first element of the STL vector
61102 : // (which is guarenteed to be contiguous storage).
61103 : // SgVariableDefinition objectArray [] = *(Memory_Block_List.begin());
61104 0 : if (SgVariableDefinition::pools.empty() == false)
61105 : {
61106 : // Generate an array of memory pools
61107 0 : SgVariableDefinition** objectArray = (SgVariableDefinition**) &(SgVariableDefinition::pools[0]);
61108 :
61109 : // Build a local variable for better performance
61110 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
61111 :
61112 : // Iterate over the memory pools
61113 0 : bool done = false;
61114 0 : unsigned i=0;
61115 :
61116 : // find the first valid IR node, call visit function, and then leave
61117 0 : while ( done == false && i < SgVariableDefinition::pools.size() )
61118 : {
61119 : // objectArray[i] is a single memory pool
61120 : unsigned j=0;
61121 0 : while (done == false && j < SgVariableDefinition::pool_size)
61122 : {
61123 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
61124 : {
61125 0 : traversal.visit(&(objectArray[i][j]));
61126 0 : done = true;
61127 : }
61128 0 : j++;
61129 : }
61130 0 : i++;
61131 : }
61132 :
61133 : #if 0
61134 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
61135 : if (done == false)
61136 : {
61137 : printf ("No representative for SgVariableDefinition found in memory pools \n");
61138 : }
61139 : #endif
61140 : }
61141 0 : }
61142 :
61143 :
61144 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
61145 : // using values that overflow signed values of int.
61146 : size_t
61147 4 : SgVariableDefinition::numberOfNodes()
61148 : {
61149 : // This function traverses the memory pool for an IR node and
61150 : // counts the number of IR nodes of a particular Sage III IR
61151 : // nodes type.
61152 :
61153 4 : size_t count = 0;
61154 4 : if (SgVariableDefinition::pools.empty() == false)
61155 : {
61156 : // Generate an array of memory pools (this is actually a STL vector,
61157 : // but it is contiguious, so OK to treat this way).
61158 2 : SgVariableDefinition** objectArray = (SgVariableDefinition**) &(SgVariableDefinition::pools[0]);
61159 :
61160 : // Build a local variable for better performance (make it a loop invariant variable).
61161 2 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
61162 :
61163 : // Iterate over all of the memory pools for this IR node.
61164 4 : for (unsigned int i=0; i < SgVariableDefinition::pools.size(); i++)
61165 : {
61166 : // objectArray[i] is a single memory pool, iterate over all the
61167 : // IR nodes and only count those that are valid IR nodes used in
61168 : // the AST (i.e. allocated IR nodes).
61169 4002 : for (unsigned j=0; j < SgVariableDefinition::pool_size; j++)
61170 : {
61171 : // This is indexing the STL vector of C/C++ style arrays as a doubly
61172 : // indexed array access. It is OK since we have leveraged the semantics
61173 : // of STL vector memory as contigous and cast the memory as an array
61174 : // of arrays to use the 2D array indexing. Hope this is not confusing,
61175 : // but it s very fast as an implementation.
61176 4000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
61177 : {
61178 1396 : count++;
61179 : }
61180 : }
61181 : }
61182 : }
61183 :
61184 :
61185 :
61186 4 : return count;
61187 : }
61188 :
61189 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
61190 : // using values that overflow signed values of int.
61191 : size_t
61192 0 : SgVariableDefinition::memoryUsage()
61193 : {
61194 : // This function is required because we need the class name as a type when we call sizeof
61195 : // There might be another way to implement this if we have a traversal that only called a
61196 : // representative object (one call for each type of Sage IIIIR node).
61197 0 : size_t memory = numberOfNodes() * sizeof(SgVariableDefinition);
61198 :
61199 0 : return memory;
61200 : }
61201 :
61202 : /* #line 61203 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
61203 :
61204 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
61205 : void
61206 5342 : SgClinkageDeclarationStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
61207 : {
61208 : // This function traverses the memory pool for only a specific IR node
61209 : // and calls the visit function of the input class execute a traversal
61210 : // similar to the style of the attribute based traversals within ROSE.
61211 : // This traversal will visit ALL nodes of the AST where as the other
61212 : // attribute based traversals visit only the embedded tree within the AST.
61213 :
61214 : // Initialize array to the address of the first element of the STL vector
61215 : // (which is guaranteed to be contiguous storage).
61216 : // SgClinkageDeclarationStatement objectArray [] = *(Memory_Block_List.begin());
61217 5342 : if (SgClinkageDeclarationStatement::pools.empty() == false)
61218 : {
61219 : // Generate an array of memory pools
61220 0 : SgClinkageDeclarationStatement** objectArray = (SgClinkageDeclarationStatement**) &(SgClinkageDeclarationStatement::pools[0]);
61221 :
61222 : // Build a local variable for better performance
61223 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
61224 : #if 0
61225 : // Iterate over the memory pools
61226 : for (unsigned int i=0; i < SgClinkageDeclarationStatement::pools.size(); i++)
61227 : {
61228 : // objectArray[i] is a single memory pool
61229 : for (int j=0; j < SgClinkageDeclarationStatement::pool_size; j++)
61230 : {
61231 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
61232 : {
61233 : traversal.visit(&(objectArray[i][j]));
61234 : }
61235 : }
61236 : }
61237 : #else
61238 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
61239 : // compute the list first and then call the visit function on each list element.
61240 :
61241 : // printf ("Inside of SgClinkageDeclarationStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
61242 :
61243 0 : std::vector<SgClinkageDeclarationStatement*> nodeList;
61244 :
61245 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
61246 0 : for (unsigned int i=0; i < SgClinkageDeclarationStatement::pools.size(); i++)
61247 : {
61248 : // objectArray[i] is a single memory pool
61249 0 : for (unsigned j=0; j < SgClinkageDeclarationStatement::pool_size; j++)
61250 : {
61251 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
61252 : {
61253 0 : nodeList.push_back(&(objectArray[i][j]));
61254 : }
61255 : }
61256 : }
61257 :
61258 : // Iterate over the saved list
61259 0 : size_t nodeListSize = nodeList.size();
61260 0 : for (size_t i=0; i < nodeListSize; i++)
61261 : {
61262 0 : ROSE_ASSERT(nodeList[i] != NULL);
61263 : #if 0
61264 : traversal.visit(nodeList[i]);
61265 : #else
61266 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
61267 : {
61268 0 : traversal.visit(nodeList[i]);
61269 : }
61270 : #endif
61271 : }
61272 : #endif
61273 : }
61274 :
61275 : // This should not be required since all previously static data members are
61276 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
61277 :
61278 5342 : }
61279 :
61280 :
61281 : void
61282 194 : SgClinkageDeclarationStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
61283 : {
61284 : // This function traverses the memory pool for an IR node and
61285 : // calls the function to execute the visitor object.
61286 :
61287 : // Initialize array to the address of the first element of the STL vector
61288 : // (which is guarenteed to be contiguous storage).
61289 : // SgClinkageDeclarationStatement objectArray [] = *(Memory_Block_List.begin());
61290 194 : if (SgClinkageDeclarationStatement::pools.empty() == false)
61291 : {
61292 : // Generate an array of memory pools
61293 0 : SgClinkageDeclarationStatement** objectArray = (SgClinkageDeclarationStatement**) &(SgClinkageDeclarationStatement::pools[0]);
61294 :
61295 : // Build a local variable for better performance
61296 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
61297 :
61298 : // Iterate over the memory pools
61299 0 : for (unsigned int i=0; i < SgClinkageDeclarationStatement::pools.size(); i++)
61300 : {
61301 : // objectArray[i] is a single memory pool
61302 0 : for (unsigned j=0; j < SgClinkageDeclarationStatement::pool_size; j++)
61303 : {
61304 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
61305 : {
61306 : // printf ("Found a valid SgClinkageDeclarationStatement object in the memory pool %d at position %d \n",i,j);
61307 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
61308 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
61309 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
61310 : }
61311 : else
61312 : {
61313 : // printf ("Found a INVALID SgClinkageDeclarationStatement object in the memory pool \n");
61314 : }
61315 : }
61316 : }
61317 : }
61318 :
61319 : // This should not be required since all previously static data members are
61320 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
61321 :
61322 194 : }
61323 :
61324 : void
61325 0 : SgClinkageDeclarationStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
61326 : {
61327 : // This function visits only a single IR node of the memory pool.
61328 : // it is typically called once for each type of IR node within
61329 : // the automatically generated function: traverseRepresentativeNodes().
61330 :
61331 : // Initialize array to the address of the first element of the STL vector
61332 : // (which is guarenteed to be contiguous storage).
61333 : // SgClinkageDeclarationStatement objectArray [] = *(Memory_Block_List.begin());
61334 0 : if (SgClinkageDeclarationStatement::pools.empty() == false)
61335 : {
61336 : // Generate an array of memory pools
61337 0 : SgClinkageDeclarationStatement** objectArray = (SgClinkageDeclarationStatement**) &(SgClinkageDeclarationStatement::pools[0]);
61338 :
61339 : // Build a local variable for better performance
61340 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
61341 :
61342 : // Iterate over the memory pools
61343 0 : bool done = false;
61344 0 : unsigned i=0;
61345 :
61346 : // find the first valid IR node, call visit function, and then leave
61347 0 : while ( done == false && i < SgClinkageDeclarationStatement::pools.size() )
61348 : {
61349 : // objectArray[i] is a single memory pool
61350 : unsigned j=0;
61351 0 : while (done == false && j < SgClinkageDeclarationStatement::pool_size)
61352 : {
61353 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
61354 : {
61355 0 : traversal.visit(&(objectArray[i][j]));
61356 0 : done = true;
61357 : }
61358 0 : j++;
61359 : }
61360 0 : i++;
61361 : }
61362 :
61363 : #if 0
61364 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
61365 : if (done == false)
61366 : {
61367 : printf ("No representative for SgClinkageDeclarationStatement found in memory pools \n");
61368 : }
61369 : #endif
61370 : }
61371 0 : }
61372 :
61373 :
61374 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
61375 : // using values that overflow signed values of int.
61376 : size_t
61377 4 : SgClinkageDeclarationStatement::numberOfNodes()
61378 : {
61379 : // This function traverses the memory pool for an IR node and
61380 : // counts the number of IR nodes of a particular Sage III IR
61381 : // nodes type.
61382 :
61383 4 : size_t count = 0;
61384 4 : if (SgClinkageDeclarationStatement::pools.empty() == false)
61385 : {
61386 : // Generate an array of memory pools (this is actually a STL vector,
61387 : // but it is contiguious, so OK to treat this way).
61388 0 : SgClinkageDeclarationStatement** objectArray = (SgClinkageDeclarationStatement**) &(SgClinkageDeclarationStatement::pools[0]);
61389 :
61390 : // Build a local variable for better performance (make it a loop invariant variable).
61391 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
61392 :
61393 : // Iterate over all of the memory pools for this IR node.
61394 0 : for (unsigned int i=0; i < SgClinkageDeclarationStatement::pools.size(); i++)
61395 : {
61396 : // objectArray[i] is a single memory pool, iterate over all the
61397 : // IR nodes and only count those that are valid IR nodes used in
61398 : // the AST (i.e. allocated IR nodes).
61399 0 : for (unsigned j=0; j < SgClinkageDeclarationStatement::pool_size; j++)
61400 : {
61401 : // This is indexing the STL vector of C/C++ style arrays as a doubly
61402 : // indexed array access. It is OK since we have leveraged the semantics
61403 : // of STL vector memory as contigous and cast the memory as an array
61404 : // of arrays to use the 2D array indexing. Hope this is not confusing,
61405 : // but it s very fast as an implementation.
61406 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
61407 : {
61408 0 : count++;
61409 : }
61410 : }
61411 : }
61412 : }
61413 :
61414 :
61415 :
61416 4 : return count;
61417 : }
61418 :
61419 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
61420 : // using values that overflow signed values of int.
61421 : size_t
61422 0 : SgClinkageDeclarationStatement::memoryUsage()
61423 : {
61424 : // This function is required because we need the class name as a type when we call sizeof
61425 : // There might be another way to implement this if we have a traversal that only called a
61426 : // representative object (one call for each type of Sage IIIIR node).
61427 0 : size_t memory = numberOfNodes() * sizeof(SgClinkageDeclarationStatement);
61428 :
61429 0 : return memory;
61430 : }
61431 :
61432 : /* #line 61433 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
61433 :
61434 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
61435 : void
61436 5342 : SgClinkageStartStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
61437 : {
61438 : // This function traverses the memory pool for only a specific IR node
61439 : // and calls the visit function of the input class execute a traversal
61440 : // similar to the style of the attribute based traversals within ROSE.
61441 : // This traversal will visit ALL nodes of the AST where as the other
61442 : // attribute based traversals visit only the embedded tree within the AST.
61443 :
61444 : // Initialize array to the address of the first element of the STL vector
61445 : // (which is guaranteed to be contiguous storage).
61446 : // SgClinkageStartStatement objectArray [] = *(Memory_Block_List.begin());
61447 5342 : if (SgClinkageStartStatement::pools.empty() == false)
61448 : {
61449 : // Generate an array of memory pools
61450 0 : SgClinkageStartStatement** objectArray = (SgClinkageStartStatement**) &(SgClinkageStartStatement::pools[0]);
61451 :
61452 : // Build a local variable for better performance
61453 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
61454 : #if 0
61455 : // Iterate over the memory pools
61456 : for (unsigned int i=0; i < SgClinkageStartStatement::pools.size(); i++)
61457 : {
61458 : // objectArray[i] is a single memory pool
61459 : for (int j=0; j < SgClinkageStartStatement::pool_size; j++)
61460 : {
61461 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
61462 : {
61463 : traversal.visit(&(objectArray[i][j]));
61464 : }
61465 : }
61466 : }
61467 : #else
61468 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
61469 : // compute the list first and then call the visit function on each list element.
61470 :
61471 : // printf ("Inside of SgClinkageStartStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
61472 :
61473 0 : std::vector<SgClinkageStartStatement*> nodeList;
61474 :
61475 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
61476 0 : for (unsigned int i=0; i < SgClinkageStartStatement::pools.size(); i++)
61477 : {
61478 : // objectArray[i] is a single memory pool
61479 0 : for (unsigned j=0; j < SgClinkageStartStatement::pool_size; j++)
61480 : {
61481 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
61482 : {
61483 0 : nodeList.push_back(&(objectArray[i][j]));
61484 : }
61485 : }
61486 : }
61487 :
61488 : // Iterate over the saved list
61489 0 : size_t nodeListSize = nodeList.size();
61490 0 : for (size_t i=0; i < nodeListSize; i++)
61491 : {
61492 0 : ROSE_ASSERT(nodeList[i] != NULL);
61493 : #if 0
61494 : traversal.visit(nodeList[i]);
61495 : #else
61496 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
61497 : {
61498 0 : traversal.visit(nodeList[i]);
61499 : }
61500 : #endif
61501 : }
61502 : #endif
61503 : }
61504 :
61505 : // This should not be required since all previously static data members are
61506 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
61507 :
61508 5342 : }
61509 :
61510 :
61511 : void
61512 194 : SgClinkageStartStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
61513 : {
61514 : // This function traverses the memory pool for an IR node and
61515 : // calls the function to execute the visitor object.
61516 :
61517 : // Initialize array to the address of the first element of the STL vector
61518 : // (which is guarenteed to be contiguous storage).
61519 : // SgClinkageStartStatement objectArray [] = *(Memory_Block_List.begin());
61520 194 : if (SgClinkageStartStatement::pools.empty() == false)
61521 : {
61522 : // Generate an array of memory pools
61523 0 : SgClinkageStartStatement** objectArray = (SgClinkageStartStatement**) &(SgClinkageStartStatement::pools[0]);
61524 :
61525 : // Build a local variable for better performance
61526 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
61527 :
61528 : // Iterate over the memory pools
61529 0 : for (unsigned int i=0; i < SgClinkageStartStatement::pools.size(); i++)
61530 : {
61531 : // objectArray[i] is a single memory pool
61532 0 : for (unsigned j=0; j < SgClinkageStartStatement::pool_size; j++)
61533 : {
61534 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
61535 : {
61536 : // printf ("Found a valid SgClinkageStartStatement object in the memory pool %d at position %d \n",i,j);
61537 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
61538 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
61539 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
61540 : }
61541 : else
61542 : {
61543 : // printf ("Found a INVALID SgClinkageStartStatement object in the memory pool \n");
61544 : }
61545 : }
61546 : }
61547 : }
61548 :
61549 : // This should not be required since all previously static data members are
61550 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
61551 :
61552 194 : }
61553 :
61554 : void
61555 0 : SgClinkageStartStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
61556 : {
61557 : // This function visits only a single IR node of the memory pool.
61558 : // it is typically called once for each type of IR node within
61559 : // the automatically generated function: traverseRepresentativeNodes().
61560 :
61561 : // Initialize array to the address of the first element of the STL vector
61562 : // (which is guarenteed to be contiguous storage).
61563 : // SgClinkageStartStatement objectArray [] = *(Memory_Block_List.begin());
61564 0 : if (SgClinkageStartStatement::pools.empty() == false)
61565 : {
61566 : // Generate an array of memory pools
61567 0 : SgClinkageStartStatement** objectArray = (SgClinkageStartStatement**) &(SgClinkageStartStatement::pools[0]);
61568 :
61569 : // Build a local variable for better performance
61570 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
61571 :
61572 : // Iterate over the memory pools
61573 0 : bool done = false;
61574 0 : unsigned i=0;
61575 :
61576 : // find the first valid IR node, call visit function, and then leave
61577 0 : while ( done == false && i < SgClinkageStartStatement::pools.size() )
61578 : {
61579 : // objectArray[i] is a single memory pool
61580 : unsigned j=0;
61581 0 : while (done == false && j < SgClinkageStartStatement::pool_size)
61582 : {
61583 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
61584 : {
61585 0 : traversal.visit(&(objectArray[i][j]));
61586 0 : done = true;
61587 : }
61588 0 : j++;
61589 : }
61590 0 : i++;
61591 : }
61592 :
61593 : #if 0
61594 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
61595 : if (done == false)
61596 : {
61597 : printf ("No representative for SgClinkageStartStatement found in memory pools \n");
61598 : }
61599 : #endif
61600 : }
61601 0 : }
61602 :
61603 :
61604 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
61605 : // using values that overflow signed values of int.
61606 : size_t
61607 4 : SgClinkageStartStatement::numberOfNodes()
61608 : {
61609 : // This function traverses the memory pool for an IR node and
61610 : // counts the number of IR nodes of a particular Sage III IR
61611 : // nodes type.
61612 :
61613 4 : size_t count = 0;
61614 4 : if (SgClinkageStartStatement::pools.empty() == false)
61615 : {
61616 : // Generate an array of memory pools (this is actually a STL vector,
61617 : // but it is contiguious, so OK to treat this way).
61618 0 : SgClinkageStartStatement** objectArray = (SgClinkageStartStatement**) &(SgClinkageStartStatement::pools[0]);
61619 :
61620 : // Build a local variable for better performance (make it a loop invariant variable).
61621 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
61622 :
61623 : // Iterate over all of the memory pools for this IR node.
61624 0 : for (unsigned int i=0; i < SgClinkageStartStatement::pools.size(); i++)
61625 : {
61626 : // objectArray[i] is a single memory pool, iterate over all the
61627 : // IR nodes and only count those that are valid IR nodes used in
61628 : // the AST (i.e. allocated IR nodes).
61629 0 : for (unsigned j=0; j < SgClinkageStartStatement::pool_size; j++)
61630 : {
61631 : // This is indexing the STL vector of C/C++ style arrays as a doubly
61632 : // indexed array access. It is OK since we have leveraged the semantics
61633 : // of STL vector memory as contigous and cast the memory as an array
61634 : // of arrays to use the 2D array indexing. Hope this is not confusing,
61635 : // but it s very fast as an implementation.
61636 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
61637 : {
61638 0 : count++;
61639 : }
61640 : }
61641 : }
61642 : }
61643 :
61644 :
61645 :
61646 4 : return count;
61647 : }
61648 :
61649 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
61650 : // using values that overflow signed values of int.
61651 : size_t
61652 0 : SgClinkageStartStatement::memoryUsage()
61653 : {
61654 : // This function is required because we need the class name as a type when we call sizeof
61655 : // There might be another way to implement this if we have a traversal that only called a
61656 : // representative object (one call for each type of Sage IIIIR node).
61657 0 : size_t memory = numberOfNodes() * sizeof(SgClinkageStartStatement);
61658 :
61659 0 : return memory;
61660 : }
61661 :
61662 : /* #line 61663 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
61663 :
61664 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
61665 : void
61666 5342 : SgClinkageEndStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
61667 : {
61668 : // This function traverses the memory pool for only a specific IR node
61669 : // and calls the visit function of the input class execute a traversal
61670 : // similar to the style of the attribute based traversals within ROSE.
61671 : // This traversal will visit ALL nodes of the AST where as the other
61672 : // attribute based traversals visit only the embedded tree within the AST.
61673 :
61674 : // Initialize array to the address of the first element of the STL vector
61675 : // (which is guaranteed to be contiguous storage).
61676 : // SgClinkageEndStatement objectArray [] = *(Memory_Block_List.begin());
61677 5342 : if (SgClinkageEndStatement::pools.empty() == false)
61678 : {
61679 : // Generate an array of memory pools
61680 0 : SgClinkageEndStatement** objectArray = (SgClinkageEndStatement**) &(SgClinkageEndStatement::pools[0]);
61681 :
61682 : // Build a local variable for better performance
61683 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
61684 : #if 0
61685 : // Iterate over the memory pools
61686 : for (unsigned int i=0; i < SgClinkageEndStatement::pools.size(); i++)
61687 : {
61688 : // objectArray[i] is a single memory pool
61689 : for (int j=0; j < SgClinkageEndStatement::pool_size; j++)
61690 : {
61691 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
61692 : {
61693 : traversal.visit(&(objectArray[i][j]));
61694 : }
61695 : }
61696 : }
61697 : #else
61698 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
61699 : // compute the list first and then call the visit function on each list element.
61700 :
61701 : // printf ("Inside of SgClinkageEndStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
61702 :
61703 0 : std::vector<SgClinkageEndStatement*> nodeList;
61704 :
61705 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
61706 0 : for (unsigned int i=0; i < SgClinkageEndStatement::pools.size(); i++)
61707 : {
61708 : // objectArray[i] is a single memory pool
61709 0 : for (unsigned j=0; j < SgClinkageEndStatement::pool_size; j++)
61710 : {
61711 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
61712 : {
61713 0 : nodeList.push_back(&(objectArray[i][j]));
61714 : }
61715 : }
61716 : }
61717 :
61718 : // Iterate over the saved list
61719 0 : size_t nodeListSize = nodeList.size();
61720 0 : for (size_t i=0; i < nodeListSize; i++)
61721 : {
61722 0 : ROSE_ASSERT(nodeList[i] != NULL);
61723 : #if 0
61724 : traversal.visit(nodeList[i]);
61725 : #else
61726 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
61727 : {
61728 0 : traversal.visit(nodeList[i]);
61729 : }
61730 : #endif
61731 : }
61732 : #endif
61733 : }
61734 :
61735 : // This should not be required since all previously static data members are
61736 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
61737 :
61738 5342 : }
61739 :
61740 :
61741 : void
61742 194 : SgClinkageEndStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
61743 : {
61744 : // This function traverses the memory pool for an IR node and
61745 : // calls the function to execute the visitor object.
61746 :
61747 : // Initialize array to the address of the first element of the STL vector
61748 : // (which is guarenteed to be contiguous storage).
61749 : // SgClinkageEndStatement objectArray [] = *(Memory_Block_List.begin());
61750 194 : if (SgClinkageEndStatement::pools.empty() == false)
61751 : {
61752 : // Generate an array of memory pools
61753 0 : SgClinkageEndStatement** objectArray = (SgClinkageEndStatement**) &(SgClinkageEndStatement::pools[0]);
61754 :
61755 : // Build a local variable for better performance
61756 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
61757 :
61758 : // Iterate over the memory pools
61759 0 : for (unsigned int i=0; i < SgClinkageEndStatement::pools.size(); i++)
61760 : {
61761 : // objectArray[i] is a single memory pool
61762 0 : for (unsigned j=0; j < SgClinkageEndStatement::pool_size; j++)
61763 : {
61764 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
61765 : {
61766 : // printf ("Found a valid SgClinkageEndStatement object in the memory pool %d at position %d \n",i,j);
61767 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
61768 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
61769 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
61770 : }
61771 : else
61772 : {
61773 : // printf ("Found a INVALID SgClinkageEndStatement object in the memory pool \n");
61774 : }
61775 : }
61776 : }
61777 : }
61778 :
61779 : // This should not be required since all previously static data members are
61780 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
61781 :
61782 194 : }
61783 :
61784 : void
61785 0 : SgClinkageEndStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
61786 : {
61787 : // This function visits only a single IR node of the memory pool.
61788 : // it is typically called once for each type of IR node within
61789 : // the automatically generated function: traverseRepresentativeNodes().
61790 :
61791 : // Initialize array to the address of the first element of the STL vector
61792 : // (which is guarenteed to be contiguous storage).
61793 : // SgClinkageEndStatement objectArray [] = *(Memory_Block_List.begin());
61794 0 : if (SgClinkageEndStatement::pools.empty() == false)
61795 : {
61796 : // Generate an array of memory pools
61797 0 : SgClinkageEndStatement** objectArray = (SgClinkageEndStatement**) &(SgClinkageEndStatement::pools[0]);
61798 :
61799 : // Build a local variable for better performance
61800 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
61801 :
61802 : // Iterate over the memory pools
61803 0 : bool done = false;
61804 0 : unsigned i=0;
61805 :
61806 : // find the first valid IR node, call visit function, and then leave
61807 0 : while ( done == false && i < SgClinkageEndStatement::pools.size() )
61808 : {
61809 : // objectArray[i] is a single memory pool
61810 : unsigned j=0;
61811 0 : while (done == false && j < SgClinkageEndStatement::pool_size)
61812 : {
61813 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
61814 : {
61815 0 : traversal.visit(&(objectArray[i][j]));
61816 0 : done = true;
61817 : }
61818 0 : j++;
61819 : }
61820 0 : i++;
61821 : }
61822 :
61823 : #if 0
61824 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
61825 : if (done == false)
61826 : {
61827 : printf ("No representative for SgClinkageEndStatement found in memory pools \n");
61828 : }
61829 : #endif
61830 : }
61831 0 : }
61832 :
61833 :
61834 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
61835 : // using values that overflow signed values of int.
61836 : size_t
61837 4 : SgClinkageEndStatement::numberOfNodes()
61838 : {
61839 : // This function traverses the memory pool for an IR node and
61840 : // counts the number of IR nodes of a particular Sage III IR
61841 : // nodes type.
61842 :
61843 4 : size_t count = 0;
61844 4 : if (SgClinkageEndStatement::pools.empty() == false)
61845 : {
61846 : // Generate an array of memory pools (this is actually a STL vector,
61847 : // but it is contiguious, so OK to treat this way).
61848 0 : SgClinkageEndStatement** objectArray = (SgClinkageEndStatement**) &(SgClinkageEndStatement::pools[0]);
61849 :
61850 : // Build a local variable for better performance (make it a loop invariant variable).
61851 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
61852 :
61853 : // Iterate over all of the memory pools for this IR node.
61854 0 : for (unsigned int i=0; i < SgClinkageEndStatement::pools.size(); i++)
61855 : {
61856 : // objectArray[i] is a single memory pool, iterate over all the
61857 : // IR nodes and only count those that are valid IR nodes used in
61858 : // the AST (i.e. allocated IR nodes).
61859 0 : for (unsigned j=0; j < SgClinkageEndStatement::pool_size; j++)
61860 : {
61861 : // This is indexing the STL vector of C/C++ style arrays as a doubly
61862 : // indexed array access. It is OK since we have leveraged the semantics
61863 : // of STL vector memory as contigous and cast the memory as an array
61864 : // of arrays to use the 2D array indexing. Hope this is not confusing,
61865 : // but it s very fast as an implementation.
61866 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
61867 : {
61868 0 : count++;
61869 : }
61870 : }
61871 : }
61872 : }
61873 :
61874 :
61875 :
61876 4 : return count;
61877 : }
61878 :
61879 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
61880 : // using values that overflow signed values of int.
61881 : size_t
61882 0 : SgClinkageEndStatement::memoryUsage()
61883 : {
61884 : // This function is required because we need the class name as a type when we call sizeof
61885 : // There might be another way to implement this if we have a traversal that only called a
61886 : // representative object (one call for each type of Sage IIIIR node).
61887 0 : size_t memory = numberOfNodes() * sizeof(SgClinkageEndStatement);
61888 :
61889 0 : return memory;
61890 : }
61891 :
61892 : /* #line 61893 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
61893 :
61894 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
61895 : void
61896 5342 : SgEnumDeclaration::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
61897 : {
61898 : // This function traverses the memory pool for only a specific IR node
61899 : // and calls the visit function of the input class execute a traversal
61900 : // similar to the style of the attribute based traversals within ROSE.
61901 : // This traversal will visit ALL nodes of the AST where as the other
61902 : // attribute based traversals visit only the embedded tree within the AST.
61903 :
61904 : // Initialize array to the address of the first element of the STL vector
61905 : // (which is guaranteed to be contiguous storage).
61906 : // SgEnumDeclaration objectArray [] = *(Memory_Block_List.begin());
61907 5342 : if (SgEnumDeclaration::pools.empty() == false)
61908 : {
61909 : // Generate an array of memory pools
61910 2726 : SgEnumDeclaration** objectArray = (SgEnumDeclaration**) &(SgEnumDeclaration::pools[0]);
61911 :
61912 : // Build a local variable for better performance
61913 2726 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
61914 : #if 0
61915 : // Iterate over the memory pools
61916 : for (unsigned int i=0; i < SgEnumDeclaration::pools.size(); i++)
61917 : {
61918 : // objectArray[i] is a single memory pool
61919 : for (int j=0; j < SgEnumDeclaration::pool_size; j++)
61920 : {
61921 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
61922 : {
61923 : traversal.visit(&(objectArray[i][j]));
61924 : }
61925 : }
61926 : }
61927 : #else
61928 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
61929 : // compute the list first and then call the visit function on each list element.
61930 :
61931 : // printf ("Inside of SgEnumDeclaration::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
61932 :
61933 5452 : std::vector<SgEnumDeclaration*> nodeList;
61934 :
61935 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
61936 5452 : for (unsigned int i=0; i < SgEnumDeclaration::pools.size(); i++)
61937 : {
61938 : // objectArray[i] is a single memory pool
61939 5454730 : for (unsigned j=0; j < SgEnumDeclaration::pool_size; j++)
61940 : {
61941 5452000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
61942 : {
61943 42866 : nodeList.push_back(&(objectArray[i][j]));
61944 : }
61945 : }
61946 : }
61947 :
61948 : // Iterate over the saved list
61949 2726 : size_t nodeListSize = nodeList.size();
61950 45592 : for (size_t i=0; i < nodeListSize; i++)
61951 : {
61952 42866 : ROSE_ASSERT(nodeList[i] != NULL);
61953 : #if 0
61954 : traversal.visit(nodeList[i]);
61955 : #else
61956 42866 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
61957 : {
61958 42866 : traversal.visit(nodeList[i]);
61959 : }
61960 : #endif
61961 : }
61962 : #endif
61963 : }
61964 :
61965 : // This should not be required since all previously static data members are
61966 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
61967 :
61968 5342 : }
61969 :
61970 :
61971 : void
61972 194 : SgEnumDeclaration::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
61973 : {
61974 : // This function traverses the memory pool for an IR node and
61975 : // calls the function to execute the visitor object.
61976 :
61977 : // Initialize array to the address of the first element of the STL vector
61978 : // (which is guarenteed to be contiguous storage).
61979 : // SgEnumDeclaration objectArray [] = *(Memory_Block_List.begin());
61980 194 : if (SgEnumDeclaration::pools.empty() == false)
61981 : {
61982 : // Generate an array of memory pools
61983 137 : SgEnumDeclaration** objectArray = (SgEnumDeclaration**) &(SgEnumDeclaration::pools[0]);
61984 :
61985 : // Build a local variable for better performance
61986 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
61987 :
61988 : // Iterate over the memory pools
61989 274 : for (unsigned int i=0; i < SgEnumDeclaration::pools.size(); i++)
61990 : {
61991 : // objectArray[i] is a single memory pool
61992 274137 : for (unsigned j=0; j < SgEnumDeclaration::pool_size; j++)
61993 : {
61994 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
61995 : {
61996 : // printf ("Found a valid SgEnumDeclaration object in the memory pool %d at position %d \n",i,j);
61997 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
61998 24284 : objectArray[i][j].executeVisitorMemberFunction(visitor);
61999 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
62000 : }
62001 : else
62002 : {
62003 : // printf ("Found a INVALID SgEnumDeclaration object in the memory pool \n");
62004 : }
62005 : }
62006 : }
62007 : }
62008 :
62009 : // This should not be required since all previously static data members are
62010 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
62011 :
62012 194 : }
62013 :
62014 : void
62015 0 : SgEnumDeclaration::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
62016 : {
62017 : // This function visits only a single IR node of the memory pool.
62018 : // it is typically called once for each type of IR node within
62019 : // the automatically generated function: traverseRepresentativeNodes().
62020 :
62021 : // Initialize array to the address of the first element of the STL vector
62022 : // (which is guarenteed to be contiguous storage).
62023 : // SgEnumDeclaration objectArray [] = *(Memory_Block_List.begin());
62024 0 : if (SgEnumDeclaration::pools.empty() == false)
62025 : {
62026 : // Generate an array of memory pools
62027 0 : SgEnumDeclaration** objectArray = (SgEnumDeclaration**) &(SgEnumDeclaration::pools[0]);
62028 :
62029 : // Build a local variable for better performance
62030 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
62031 :
62032 : // Iterate over the memory pools
62033 0 : bool done = false;
62034 0 : unsigned i=0;
62035 :
62036 : // find the first valid IR node, call visit function, and then leave
62037 0 : while ( done == false && i < SgEnumDeclaration::pools.size() )
62038 : {
62039 : // objectArray[i] is a single memory pool
62040 : unsigned j=0;
62041 0 : while (done == false && j < SgEnumDeclaration::pool_size)
62042 : {
62043 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
62044 : {
62045 0 : traversal.visit(&(objectArray[i][j]));
62046 0 : done = true;
62047 : }
62048 0 : j++;
62049 : }
62050 0 : i++;
62051 : }
62052 :
62053 : #if 0
62054 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
62055 : if (done == false)
62056 : {
62057 : printf ("No representative for SgEnumDeclaration found in memory pools \n");
62058 : }
62059 : #endif
62060 : }
62061 0 : }
62062 :
62063 :
62064 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
62065 : // using values that overflow signed values of int.
62066 : size_t
62067 4 : SgEnumDeclaration::numberOfNodes()
62068 : {
62069 : // This function traverses the memory pool for an IR node and
62070 : // counts the number of IR nodes of a particular Sage III IR
62071 : // nodes type.
62072 :
62073 4 : size_t count = 0;
62074 4 : if (SgEnumDeclaration::pools.empty() == false)
62075 : {
62076 : // Generate an array of memory pools (this is actually a STL vector,
62077 : // but it is contiguious, so OK to treat this way).
62078 1 : SgEnumDeclaration** objectArray = (SgEnumDeclaration**) &(SgEnumDeclaration::pools[0]);
62079 :
62080 : // Build a local variable for better performance (make it a loop invariant variable).
62081 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
62082 :
62083 : // Iterate over all of the memory pools for this IR node.
62084 2 : for (unsigned int i=0; i < SgEnumDeclaration::pools.size(); i++)
62085 : {
62086 : // objectArray[i] is a single memory pool, iterate over all the
62087 : // IR nodes and only count those that are valid IR nodes used in
62088 : // the AST (i.e. allocated IR nodes).
62089 2001 : for (unsigned j=0; j < SgEnumDeclaration::pool_size; j++)
62090 : {
62091 : // This is indexing the STL vector of C/C++ style arrays as a doubly
62092 : // indexed array access. It is OK since we have leveraged the semantics
62093 : // of STL vector memory as contigous and cast the memory as an array
62094 : // of arrays to use the 2D array indexing. Hope this is not confusing,
62095 : // but it s very fast as an implementation.
62096 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
62097 : {
62098 176 : count++;
62099 : }
62100 : }
62101 : }
62102 : }
62103 :
62104 :
62105 :
62106 4 : return count;
62107 : }
62108 :
62109 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
62110 : // using values that overflow signed values of int.
62111 : size_t
62112 0 : SgEnumDeclaration::memoryUsage()
62113 : {
62114 : // This function is required because we need the class name as a type when we call sizeof
62115 : // There might be another way to implement this if we have a traversal that only called a
62116 : // representative object (one call for each type of Sage IIIIR node).
62117 0 : size_t memory = numberOfNodes() * sizeof(SgEnumDeclaration);
62118 :
62119 0 : return memory;
62120 : }
62121 :
62122 : /* #line 62123 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
62123 :
62124 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
62125 : void
62126 5342 : SgAsmStmt::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
62127 : {
62128 : // This function traverses the memory pool for only a specific IR node
62129 : // and calls the visit function of the input class execute a traversal
62130 : // similar to the style of the attribute based traversals within ROSE.
62131 : // This traversal will visit ALL nodes of the AST where as the other
62132 : // attribute based traversals visit only the embedded tree within the AST.
62133 :
62134 : // Initialize array to the address of the first element of the STL vector
62135 : // (which is guaranteed to be contiguous storage).
62136 : // SgAsmStmt objectArray [] = *(Memory_Block_List.begin());
62137 5342 : if (SgAsmStmt::pools.empty() == false)
62138 : {
62139 : // Generate an array of memory pools
62140 0 : SgAsmStmt** objectArray = (SgAsmStmt**) &(SgAsmStmt::pools[0]);
62141 :
62142 : // Build a local variable for better performance
62143 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
62144 : #if 0
62145 : // Iterate over the memory pools
62146 : for (unsigned int i=0; i < SgAsmStmt::pools.size(); i++)
62147 : {
62148 : // objectArray[i] is a single memory pool
62149 : for (int j=0; j < SgAsmStmt::pool_size; j++)
62150 : {
62151 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
62152 : {
62153 : traversal.visit(&(objectArray[i][j]));
62154 : }
62155 : }
62156 : }
62157 : #else
62158 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
62159 : // compute the list first and then call the visit function on each list element.
62160 :
62161 : // printf ("Inside of SgAsmStmt::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
62162 :
62163 0 : std::vector<SgAsmStmt*> nodeList;
62164 :
62165 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
62166 0 : for (unsigned int i=0; i < SgAsmStmt::pools.size(); i++)
62167 : {
62168 : // objectArray[i] is a single memory pool
62169 0 : for (unsigned j=0; j < SgAsmStmt::pool_size; j++)
62170 : {
62171 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
62172 : {
62173 0 : nodeList.push_back(&(objectArray[i][j]));
62174 : }
62175 : }
62176 : }
62177 :
62178 : // Iterate over the saved list
62179 0 : size_t nodeListSize = nodeList.size();
62180 0 : for (size_t i=0; i < nodeListSize; i++)
62181 : {
62182 0 : ROSE_ASSERT(nodeList[i] != NULL);
62183 : #if 0
62184 : traversal.visit(nodeList[i]);
62185 : #else
62186 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
62187 : {
62188 0 : traversal.visit(nodeList[i]);
62189 : }
62190 : #endif
62191 : }
62192 : #endif
62193 : }
62194 :
62195 : // This should not be required since all previously static data members are
62196 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
62197 :
62198 5342 : }
62199 :
62200 :
62201 : void
62202 194 : SgAsmStmt::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
62203 : {
62204 : // This function traverses the memory pool for an IR node and
62205 : // calls the function to execute the visitor object.
62206 :
62207 : // Initialize array to the address of the first element of the STL vector
62208 : // (which is guarenteed to be contiguous storage).
62209 : // SgAsmStmt objectArray [] = *(Memory_Block_List.begin());
62210 194 : if (SgAsmStmt::pools.empty() == false)
62211 : {
62212 : // Generate an array of memory pools
62213 0 : SgAsmStmt** objectArray = (SgAsmStmt**) &(SgAsmStmt::pools[0]);
62214 :
62215 : // Build a local variable for better performance
62216 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
62217 :
62218 : // Iterate over the memory pools
62219 0 : for (unsigned int i=0; i < SgAsmStmt::pools.size(); i++)
62220 : {
62221 : // objectArray[i] is a single memory pool
62222 0 : for (unsigned j=0; j < SgAsmStmt::pool_size; j++)
62223 : {
62224 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
62225 : {
62226 : // printf ("Found a valid SgAsmStmt object in the memory pool %d at position %d \n",i,j);
62227 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
62228 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
62229 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
62230 : }
62231 : else
62232 : {
62233 : // printf ("Found a INVALID SgAsmStmt object in the memory pool \n");
62234 : }
62235 : }
62236 : }
62237 : }
62238 :
62239 : // This should not be required since all previously static data members are
62240 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
62241 :
62242 194 : }
62243 :
62244 : void
62245 0 : SgAsmStmt::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
62246 : {
62247 : // This function visits only a single IR node of the memory pool.
62248 : // it is typically called once for each type of IR node within
62249 : // the automatically generated function: traverseRepresentativeNodes().
62250 :
62251 : // Initialize array to the address of the first element of the STL vector
62252 : // (which is guarenteed to be contiguous storage).
62253 : // SgAsmStmt objectArray [] = *(Memory_Block_List.begin());
62254 0 : if (SgAsmStmt::pools.empty() == false)
62255 : {
62256 : // Generate an array of memory pools
62257 0 : SgAsmStmt** objectArray = (SgAsmStmt**) &(SgAsmStmt::pools[0]);
62258 :
62259 : // Build a local variable for better performance
62260 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
62261 :
62262 : // Iterate over the memory pools
62263 0 : bool done = false;
62264 0 : unsigned i=0;
62265 :
62266 : // find the first valid IR node, call visit function, and then leave
62267 0 : while ( done == false && i < SgAsmStmt::pools.size() )
62268 : {
62269 : // objectArray[i] is a single memory pool
62270 : unsigned j=0;
62271 0 : while (done == false && j < SgAsmStmt::pool_size)
62272 : {
62273 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
62274 : {
62275 0 : traversal.visit(&(objectArray[i][j]));
62276 0 : done = true;
62277 : }
62278 0 : j++;
62279 : }
62280 0 : i++;
62281 : }
62282 :
62283 : #if 0
62284 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
62285 : if (done == false)
62286 : {
62287 : printf ("No representative for SgAsmStmt found in memory pools \n");
62288 : }
62289 : #endif
62290 : }
62291 0 : }
62292 :
62293 :
62294 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
62295 : // using values that overflow signed values of int.
62296 : size_t
62297 4 : SgAsmStmt::numberOfNodes()
62298 : {
62299 : // This function traverses the memory pool for an IR node and
62300 : // counts the number of IR nodes of a particular Sage III IR
62301 : // nodes type.
62302 :
62303 4 : size_t count = 0;
62304 4 : if (SgAsmStmt::pools.empty() == false)
62305 : {
62306 : // Generate an array of memory pools (this is actually a STL vector,
62307 : // but it is contiguious, so OK to treat this way).
62308 0 : SgAsmStmt** objectArray = (SgAsmStmt**) &(SgAsmStmt::pools[0]);
62309 :
62310 : // Build a local variable for better performance (make it a loop invariant variable).
62311 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
62312 :
62313 : // Iterate over all of the memory pools for this IR node.
62314 0 : for (unsigned int i=0; i < SgAsmStmt::pools.size(); i++)
62315 : {
62316 : // objectArray[i] is a single memory pool, iterate over all the
62317 : // IR nodes and only count those that are valid IR nodes used in
62318 : // the AST (i.e. allocated IR nodes).
62319 0 : for (unsigned j=0; j < SgAsmStmt::pool_size; j++)
62320 : {
62321 : // This is indexing the STL vector of C/C++ style arrays as a doubly
62322 : // indexed array access. It is OK since we have leveraged the semantics
62323 : // of STL vector memory as contigous and cast the memory as an array
62324 : // of arrays to use the 2D array indexing. Hope this is not confusing,
62325 : // but it s very fast as an implementation.
62326 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
62327 : {
62328 0 : count++;
62329 : }
62330 : }
62331 : }
62332 : }
62333 :
62334 :
62335 :
62336 4 : return count;
62337 : }
62338 :
62339 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
62340 : // using values that overflow signed values of int.
62341 : size_t
62342 0 : SgAsmStmt::memoryUsage()
62343 : {
62344 : // This function is required because we need the class name as a type when we call sizeof
62345 : // There might be another way to implement this if we have a traversal that only called a
62346 : // representative object (one call for each type of Sage IIIIR node).
62347 0 : size_t memory = numberOfNodes() * sizeof(SgAsmStmt);
62348 :
62349 0 : return memory;
62350 : }
62351 :
62352 : /* #line 62353 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
62353 :
62354 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
62355 : void
62356 5342 : SgAttributeSpecificationStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
62357 : {
62358 : // This function traverses the memory pool for only a specific IR node
62359 : // and calls the visit function of the input class execute a traversal
62360 : // similar to the style of the attribute based traversals within ROSE.
62361 : // This traversal will visit ALL nodes of the AST where as the other
62362 : // attribute based traversals visit only the embedded tree within the AST.
62363 :
62364 : // Initialize array to the address of the first element of the STL vector
62365 : // (which is guaranteed to be contiguous storage).
62366 : // SgAttributeSpecificationStatement objectArray [] = *(Memory_Block_List.begin());
62367 5342 : if (SgAttributeSpecificationStatement::pools.empty() == false)
62368 : {
62369 : // Generate an array of memory pools
62370 250 : SgAttributeSpecificationStatement** objectArray = (SgAttributeSpecificationStatement**) &(SgAttributeSpecificationStatement::pools[0]);
62371 :
62372 : // Build a local variable for better performance
62373 250 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
62374 : #if 0
62375 : // Iterate over the memory pools
62376 : for (unsigned int i=0; i < SgAttributeSpecificationStatement::pools.size(); i++)
62377 : {
62378 : // objectArray[i] is a single memory pool
62379 : for (int j=0; j < SgAttributeSpecificationStatement::pool_size; j++)
62380 : {
62381 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
62382 : {
62383 : traversal.visit(&(objectArray[i][j]));
62384 : }
62385 : }
62386 : }
62387 : #else
62388 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
62389 : // compute the list first and then call the visit function on each list element.
62390 :
62391 : // printf ("Inside of SgAttributeSpecificationStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
62392 :
62393 500 : std::vector<SgAttributeSpecificationStatement*> nodeList;
62394 :
62395 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
62396 500 : for (unsigned int i=0; i < SgAttributeSpecificationStatement::pools.size(); i++)
62397 : {
62398 : // objectArray[i] is a single memory pool
62399 500250 : for (unsigned j=0; j < SgAttributeSpecificationStatement::pool_size; j++)
62400 : {
62401 500000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
62402 : {
62403 11000 : nodeList.push_back(&(objectArray[i][j]));
62404 : }
62405 : }
62406 : }
62407 :
62408 : // Iterate over the saved list
62409 250 : size_t nodeListSize = nodeList.size();
62410 11250 : for (size_t i=0; i < nodeListSize; i++)
62411 : {
62412 11000 : ROSE_ASSERT(nodeList[i] != NULL);
62413 : #if 0
62414 : traversal.visit(nodeList[i]);
62415 : #else
62416 11000 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
62417 : {
62418 11000 : traversal.visit(nodeList[i]);
62419 : }
62420 : #endif
62421 : }
62422 : #endif
62423 : }
62424 :
62425 : // This should not be required since all previously static data members are
62426 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
62427 :
62428 5342 : }
62429 :
62430 :
62431 : void
62432 194 : SgAttributeSpecificationStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
62433 : {
62434 : // This function traverses the memory pool for an IR node and
62435 : // calls the function to execute the visitor object.
62436 :
62437 : // Initialize array to the address of the first element of the STL vector
62438 : // (which is guarenteed to be contiguous storage).
62439 : // SgAttributeSpecificationStatement objectArray [] = *(Memory_Block_List.begin());
62440 194 : if (SgAttributeSpecificationStatement::pools.empty() == false)
62441 : {
62442 : // Generate an array of memory pools
62443 0 : SgAttributeSpecificationStatement** objectArray = (SgAttributeSpecificationStatement**) &(SgAttributeSpecificationStatement::pools[0]);
62444 :
62445 : // Build a local variable for better performance
62446 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
62447 :
62448 : // Iterate over the memory pools
62449 0 : for (unsigned int i=0; i < SgAttributeSpecificationStatement::pools.size(); i++)
62450 : {
62451 : // objectArray[i] is a single memory pool
62452 0 : for (unsigned j=0; j < SgAttributeSpecificationStatement::pool_size; j++)
62453 : {
62454 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
62455 : {
62456 : // printf ("Found a valid SgAttributeSpecificationStatement object in the memory pool %d at position %d \n",i,j);
62457 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
62458 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
62459 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
62460 : }
62461 : else
62462 : {
62463 : // printf ("Found a INVALID SgAttributeSpecificationStatement object in the memory pool \n");
62464 : }
62465 : }
62466 : }
62467 : }
62468 :
62469 : // This should not be required since all previously static data members are
62470 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
62471 :
62472 194 : }
62473 :
62474 : void
62475 0 : SgAttributeSpecificationStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
62476 : {
62477 : // This function visits only a single IR node of the memory pool.
62478 : // it is typically called once for each type of IR node within
62479 : // the automatically generated function: traverseRepresentativeNodes().
62480 :
62481 : // Initialize array to the address of the first element of the STL vector
62482 : // (which is guarenteed to be contiguous storage).
62483 : // SgAttributeSpecificationStatement objectArray [] = *(Memory_Block_List.begin());
62484 0 : if (SgAttributeSpecificationStatement::pools.empty() == false)
62485 : {
62486 : // Generate an array of memory pools
62487 0 : SgAttributeSpecificationStatement** objectArray = (SgAttributeSpecificationStatement**) &(SgAttributeSpecificationStatement::pools[0]);
62488 :
62489 : // Build a local variable for better performance
62490 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
62491 :
62492 : // Iterate over the memory pools
62493 0 : bool done = false;
62494 0 : unsigned i=0;
62495 :
62496 : // find the first valid IR node, call visit function, and then leave
62497 0 : while ( done == false && i < SgAttributeSpecificationStatement::pools.size() )
62498 : {
62499 : // objectArray[i] is a single memory pool
62500 : unsigned j=0;
62501 0 : while (done == false && j < SgAttributeSpecificationStatement::pool_size)
62502 : {
62503 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
62504 : {
62505 0 : traversal.visit(&(objectArray[i][j]));
62506 0 : done = true;
62507 : }
62508 0 : j++;
62509 : }
62510 0 : i++;
62511 : }
62512 :
62513 : #if 0
62514 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
62515 : if (done == false)
62516 : {
62517 : printf ("No representative for SgAttributeSpecificationStatement found in memory pools \n");
62518 : }
62519 : #endif
62520 : }
62521 0 : }
62522 :
62523 :
62524 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
62525 : // using values that overflow signed values of int.
62526 : size_t
62527 4 : SgAttributeSpecificationStatement::numberOfNodes()
62528 : {
62529 : // This function traverses the memory pool for an IR node and
62530 : // counts the number of IR nodes of a particular Sage III IR
62531 : // nodes type.
62532 :
62533 4 : size_t count = 0;
62534 4 : if (SgAttributeSpecificationStatement::pools.empty() == false)
62535 : {
62536 : // Generate an array of memory pools (this is actually a STL vector,
62537 : // but it is contiguious, so OK to treat this way).
62538 1 : SgAttributeSpecificationStatement** objectArray = (SgAttributeSpecificationStatement**) &(SgAttributeSpecificationStatement::pools[0]);
62539 :
62540 : // Build a local variable for better performance (make it a loop invariant variable).
62541 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
62542 :
62543 : // Iterate over all of the memory pools for this IR node.
62544 2 : for (unsigned int i=0; i < SgAttributeSpecificationStatement::pools.size(); i++)
62545 : {
62546 : // objectArray[i] is a single memory pool, iterate over all the
62547 : // IR nodes and only count those that are valid IR nodes used in
62548 : // the AST (i.e. allocated IR nodes).
62549 2001 : for (unsigned j=0; j < SgAttributeSpecificationStatement::pool_size; j++)
62550 : {
62551 : // This is indexing the STL vector of C/C++ style arrays as a doubly
62552 : // indexed array access. It is OK since we have leveraged the semantics
62553 : // of STL vector memory as contigous and cast the memory as an array
62554 : // of arrays to use the 2D array indexing. Hope this is not confusing,
62555 : // but it s very fast as an implementation.
62556 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
62557 : {
62558 2 : count++;
62559 : }
62560 : }
62561 : }
62562 : }
62563 :
62564 :
62565 :
62566 4 : return count;
62567 : }
62568 :
62569 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
62570 : // using values that overflow signed values of int.
62571 : size_t
62572 0 : SgAttributeSpecificationStatement::memoryUsage()
62573 : {
62574 : // This function is required because we need the class name as a type when we call sizeof
62575 : // There might be another way to implement this if we have a traversal that only called a
62576 : // representative object (one call for each type of Sage IIIIR node).
62577 0 : size_t memory = numberOfNodes() * sizeof(SgAttributeSpecificationStatement);
62578 :
62579 0 : return memory;
62580 : }
62581 :
62582 : /* #line 62583 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
62583 :
62584 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
62585 : void
62586 5342 : SgFormatStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
62587 : {
62588 : // This function traverses the memory pool for only a specific IR node
62589 : // and calls the visit function of the input class execute a traversal
62590 : // similar to the style of the attribute based traversals within ROSE.
62591 : // This traversal will visit ALL nodes of the AST where as the other
62592 : // attribute based traversals visit only the embedded tree within the AST.
62593 :
62594 : // Initialize array to the address of the first element of the STL vector
62595 : // (which is guaranteed to be contiguous storage).
62596 : // SgFormatStatement objectArray [] = *(Memory_Block_List.begin());
62597 5342 : if (SgFormatStatement::pools.empty() == false)
62598 : {
62599 : // Generate an array of memory pools
62600 0 : SgFormatStatement** objectArray = (SgFormatStatement**) &(SgFormatStatement::pools[0]);
62601 :
62602 : // Build a local variable for better performance
62603 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
62604 : #if 0
62605 : // Iterate over the memory pools
62606 : for (unsigned int i=0; i < SgFormatStatement::pools.size(); i++)
62607 : {
62608 : // objectArray[i] is a single memory pool
62609 : for (int j=0; j < SgFormatStatement::pool_size; j++)
62610 : {
62611 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
62612 : {
62613 : traversal.visit(&(objectArray[i][j]));
62614 : }
62615 : }
62616 : }
62617 : #else
62618 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
62619 : // compute the list first and then call the visit function on each list element.
62620 :
62621 : // printf ("Inside of SgFormatStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
62622 :
62623 0 : std::vector<SgFormatStatement*> nodeList;
62624 :
62625 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
62626 0 : for (unsigned int i=0; i < SgFormatStatement::pools.size(); i++)
62627 : {
62628 : // objectArray[i] is a single memory pool
62629 0 : for (unsigned j=0; j < SgFormatStatement::pool_size; j++)
62630 : {
62631 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
62632 : {
62633 0 : nodeList.push_back(&(objectArray[i][j]));
62634 : }
62635 : }
62636 : }
62637 :
62638 : // Iterate over the saved list
62639 0 : size_t nodeListSize = nodeList.size();
62640 0 : for (size_t i=0; i < nodeListSize; i++)
62641 : {
62642 0 : ROSE_ASSERT(nodeList[i] != NULL);
62643 : #if 0
62644 : traversal.visit(nodeList[i]);
62645 : #else
62646 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
62647 : {
62648 0 : traversal.visit(nodeList[i]);
62649 : }
62650 : #endif
62651 : }
62652 : #endif
62653 : }
62654 :
62655 : // This should not be required since all previously static data members are
62656 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
62657 :
62658 5342 : }
62659 :
62660 :
62661 : void
62662 194 : SgFormatStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
62663 : {
62664 : // This function traverses the memory pool for an IR node and
62665 : // calls the function to execute the visitor object.
62666 :
62667 : // Initialize array to the address of the first element of the STL vector
62668 : // (which is guarenteed to be contiguous storage).
62669 : // SgFormatStatement objectArray [] = *(Memory_Block_List.begin());
62670 194 : if (SgFormatStatement::pools.empty() == false)
62671 : {
62672 : // Generate an array of memory pools
62673 0 : SgFormatStatement** objectArray = (SgFormatStatement**) &(SgFormatStatement::pools[0]);
62674 :
62675 : // Build a local variable for better performance
62676 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
62677 :
62678 : // Iterate over the memory pools
62679 0 : for (unsigned int i=0; i < SgFormatStatement::pools.size(); i++)
62680 : {
62681 : // objectArray[i] is a single memory pool
62682 0 : for (unsigned j=0; j < SgFormatStatement::pool_size; j++)
62683 : {
62684 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
62685 : {
62686 : // printf ("Found a valid SgFormatStatement object in the memory pool %d at position %d \n",i,j);
62687 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
62688 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
62689 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
62690 : }
62691 : else
62692 : {
62693 : // printf ("Found a INVALID SgFormatStatement object in the memory pool \n");
62694 : }
62695 : }
62696 : }
62697 : }
62698 :
62699 : // This should not be required since all previously static data members are
62700 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
62701 :
62702 194 : }
62703 :
62704 : void
62705 0 : SgFormatStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
62706 : {
62707 : // This function visits only a single IR node of the memory pool.
62708 : // it is typically called once for each type of IR node within
62709 : // the automatically generated function: traverseRepresentativeNodes().
62710 :
62711 : // Initialize array to the address of the first element of the STL vector
62712 : // (which is guarenteed to be contiguous storage).
62713 : // SgFormatStatement objectArray [] = *(Memory_Block_List.begin());
62714 0 : if (SgFormatStatement::pools.empty() == false)
62715 : {
62716 : // Generate an array of memory pools
62717 0 : SgFormatStatement** objectArray = (SgFormatStatement**) &(SgFormatStatement::pools[0]);
62718 :
62719 : // Build a local variable for better performance
62720 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
62721 :
62722 : // Iterate over the memory pools
62723 0 : bool done = false;
62724 0 : unsigned i=0;
62725 :
62726 : // find the first valid IR node, call visit function, and then leave
62727 0 : while ( done == false && i < SgFormatStatement::pools.size() )
62728 : {
62729 : // objectArray[i] is a single memory pool
62730 : unsigned j=0;
62731 0 : while (done == false && j < SgFormatStatement::pool_size)
62732 : {
62733 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
62734 : {
62735 0 : traversal.visit(&(objectArray[i][j]));
62736 0 : done = true;
62737 : }
62738 0 : j++;
62739 : }
62740 0 : i++;
62741 : }
62742 :
62743 : #if 0
62744 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
62745 : if (done == false)
62746 : {
62747 : printf ("No representative for SgFormatStatement found in memory pools \n");
62748 : }
62749 : #endif
62750 : }
62751 0 : }
62752 :
62753 :
62754 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
62755 : // using values that overflow signed values of int.
62756 : size_t
62757 4 : SgFormatStatement::numberOfNodes()
62758 : {
62759 : // This function traverses the memory pool for an IR node and
62760 : // counts the number of IR nodes of a particular Sage III IR
62761 : // nodes type.
62762 :
62763 4 : size_t count = 0;
62764 4 : if (SgFormatStatement::pools.empty() == false)
62765 : {
62766 : // Generate an array of memory pools (this is actually a STL vector,
62767 : // but it is contiguious, so OK to treat this way).
62768 0 : SgFormatStatement** objectArray = (SgFormatStatement**) &(SgFormatStatement::pools[0]);
62769 :
62770 : // Build a local variable for better performance (make it a loop invariant variable).
62771 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
62772 :
62773 : // Iterate over all of the memory pools for this IR node.
62774 0 : for (unsigned int i=0; i < SgFormatStatement::pools.size(); i++)
62775 : {
62776 : // objectArray[i] is a single memory pool, iterate over all the
62777 : // IR nodes and only count those that are valid IR nodes used in
62778 : // the AST (i.e. allocated IR nodes).
62779 0 : for (unsigned j=0; j < SgFormatStatement::pool_size; j++)
62780 : {
62781 : // This is indexing the STL vector of C/C++ style arrays as a doubly
62782 : // indexed array access. It is OK since we have leveraged the semantics
62783 : // of STL vector memory as contigous and cast the memory as an array
62784 : // of arrays to use the 2D array indexing. Hope this is not confusing,
62785 : // but it s very fast as an implementation.
62786 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
62787 : {
62788 0 : count++;
62789 : }
62790 : }
62791 : }
62792 : }
62793 :
62794 :
62795 :
62796 4 : return count;
62797 : }
62798 :
62799 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
62800 : // using values that overflow signed values of int.
62801 : size_t
62802 0 : SgFormatStatement::memoryUsage()
62803 : {
62804 : // This function is required because we need the class name as a type when we call sizeof
62805 : // There might be another way to implement this if we have a traversal that only called a
62806 : // representative object (one call for each type of Sage IIIIR node).
62807 0 : size_t memory = numberOfNodes() * sizeof(SgFormatStatement);
62808 :
62809 0 : return memory;
62810 : }
62811 :
62812 : /* #line 62813 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
62813 :
62814 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
62815 : void
62816 5699 : SgTemplateDeclaration::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
62817 : {
62818 : // This function traverses the memory pool for only a specific IR node
62819 : // and calls the visit function of the input class execute a traversal
62820 : // similar to the style of the attribute based traversals within ROSE.
62821 : // This traversal will visit ALL nodes of the AST where as the other
62822 : // attribute based traversals visit only the embedded tree within the AST.
62823 :
62824 : // Initialize array to the address of the first element of the STL vector
62825 : // (which is guaranteed to be contiguous storage).
62826 : // SgTemplateDeclaration objectArray [] = *(Memory_Block_List.begin());
62827 5699 : if (SgTemplateDeclaration::pools.empty() == false)
62828 : {
62829 : // Generate an array of memory pools
62830 0 : SgTemplateDeclaration** objectArray = (SgTemplateDeclaration**) &(SgTemplateDeclaration::pools[0]);
62831 :
62832 : // Build a local variable for better performance
62833 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
62834 : #if 0
62835 : // Iterate over the memory pools
62836 : for (unsigned int i=0; i < SgTemplateDeclaration::pools.size(); i++)
62837 : {
62838 : // objectArray[i] is a single memory pool
62839 : for (int j=0; j < SgTemplateDeclaration::pool_size; j++)
62840 : {
62841 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
62842 : {
62843 : traversal.visit(&(objectArray[i][j]));
62844 : }
62845 : }
62846 : }
62847 : #else
62848 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
62849 : // compute the list first and then call the visit function on each list element.
62850 :
62851 : // printf ("Inside of SgTemplateDeclaration::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
62852 :
62853 0 : std::vector<SgTemplateDeclaration*> nodeList;
62854 :
62855 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
62856 0 : for (unsigned int i=0; i < SgTemplateDeclaration::pools.size(); i++)
62857 : {
62858 : // objectArray[i] is a single memory pool
62859 0 : for (unsigned j=0; j < SgTemplateDeclaration::pool_size; j++)
62860 : {
62861 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
62862 : {
62863 0 : nodeList.push_back(&(objectArray[i][j]));
62864 : }
62865 : }
62866 : }
62867 :
62868 : // Iterate over the saved list
62869 0 : size_t nodeListSize = nodeList.size();
62870 0 : for (size_t i=0; i < nodeListSize; i++)
62871 : {
62872 0 : ROSE_ASSERT(nodeList[i] != NULL);
62873 : #if 0
62874 : traversal.visit(nodeList[i]);
62875 : #else
62876 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
62877 : {
62878 0 : traversal.visit(nodeList[i]);
62879 : }
62880 : #endif
62881 : }
62882 : #endif
62883 : }
62884 :
62885 : // This should not be required since all previously static data members are
62886 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
62887 :
62888 5699 : }
62889 :
62890 :
62891 : void
62892 194 : SgTemplateDeclaration::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
62893 : {
62894 : // This function traverses the memory pool for an IR node and
62895 : // calls the function to execute the visitor object.
62896 :
62897 : // Initialize array to the address of the first element of the STL vector
62898 : // (which is guarenteed to be contiguous storage).
62899 : // SgTemplateDeclaration objectArray [] = *(Memory_Block_List.begin());
62900 194 : if (SgTemplateDeclaration::pools.empty() == false)
62901 : {
62902 : // Generate an array of memory pools
62903 0 : SgTemplateDeclaration** objectArray = (SgTemplateDeclaration**) &(SgTemplateDeclaration::pools[0]);
62904 :
62905 : // Build a local variable for better performance
62906 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
62907 :
62908 : // Iterate over the memory pools
62909 0 : for (unsigned int i=0; i < SgTemplateDeclaration::pools.size(); i++)
62910 : {
62911 : // objectArray[i] is a single memory pool
62912 0 : for (unsigned j=0; j < SgTemplateDeclaration::pool_size; j++)
62913 : {
62914 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
62915 : {
62916 : // printf ("Found a valid SgTemplateDeclaration object in the memory pool %d at position %d \n",i,j);
62917 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
62918 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
62919 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
62920 : }
62921 : else
62922 : {
62923 : // printf ("Found a INVALID SgTemplateDeclaration object in the memory pool \n");
62924 : }
62925 : }
62926 : }
62927 : }
62928 :
62929 : // This should not be required since all previously static data members are
62930 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
62931 :
62932 194 : }
62933 :
62934 : void
62935 0 : SgTemplateDeclaration::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
62936 : {
62937 : // This function visits only a single IR node of the memory pool.
62938 : // it is typically called once for each type of IR node within
62939 : // the automatically generated function: traverseRepresentativeNodes().
62940 :
62941 : // Initialize array to the address of the first element of the STL vector
62942 : // (which is guarenteed to be contiguous storage).
62943 : // SgTemplateDeclaration objectArray [] = *(Memory_Block_List.begin());
62944 0 : if (SgTemplateDeclaration::pools.empty() == false)
62945 : {
62946 : // Generate an array of memory pools
62947 0 : SgTemplateDeclaration** objectArray = (SgTemplateDeclaration**) &(SgTemplateDeclaration::pools[0]);
62948 :
62949 : // Build a local variable for better performance
62950 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
62951 :
62952 : // Iterate over the memory pools
62953 0 : bool done = false;
62954 0 : unsigned i=0;
62955 :
62956 : // find the first valid IR node, call visit function, and then leave
62957 0 : while ( done == false && i < SgTemplateDeclaration::pools.size() )
62958 : {
62959 : // objectArray[i] is a single memory pool
62960 : unsigned j=0;
62961 0 : while (done == false && j < SgTemplateDeclaration::pool_size)
62962 : {
62963 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
62964 : {
62965 0 : traversal.visit(&(objectArray[i][j]));
62966 0 : done = true;
62967 : }
62968 0 : j++;
62969 : }
62970 0 : i++;
62971 : }
62972 :
62973 : #if 0
62974 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
62975 : if (done == false)
62976 : {
62977 : printf ("No representative for SgTemplateDeclaration found in memory pools \n");
62978 : }
62979 : #endif
62980 : }
62981 0 : }
62982 :
62983 :
62984 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
62985 : // using values that overflow signed values of int.
62986 : size_t
62987 4 : SgTemplateDeclaration::numberOfNodes()
62988 : {
62989 : // This function traverses the memory pool for an IR node and
62990 : // counts the number of IR nodes of a particular Sage III IR
62991 : // nodes type.
62992 :
62993 4 : size_t count = 0;
62994 4 : if (SgTemplateDeclaration::pools.empty() == false)
62995 : {
62996 : // Generate an array of memory pools (this is actually a STL vector,
62997 : // but it is contiguious, so OK to treat this way).
62998 0 : SgTemplateDeclaration** objectArray = (SgTemplateDeclaration**) &(SgTemplateDeclaration::pools[0]);
62999 :
63000 : // Build a local variable for better performance (make it a loop invariant variable).
63001 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
63002 :
63003 : // Iterate over all of the memory pools for this IR node.
63004 0 : for (unsigned int i=0; i < SgTemplateDeclaration::pools.size(); i++)
63005 : {
63006 : // objectArray[i] is a single memory pool, iterate over all the
63007 : // IR nodes and only count those that are valid IR nodes used in
63008 : // the AST (i.e. allocated IR nodes).
63009 0 : for (unsigned j=0; j < SgTemplateDeclaration::pool_size; j++)
63010 : {
63011 : // This is indexing the STL vector of C/C++ style arrays as a doubly
63012 : // indexed array access. It is OK since we have leveraged the semantics
63013 : // of STL vector memory as contigous and cast the memory as an array
63014 : // of arrays to use the 2D array indexing. Hope this is not confusing,
63015 : // but it s very fast as an implementation.
63016 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
63017 : {
63018 0 : count++;
63019 : }
63020 : }
63021 : }
63022 : }
63023 :
63024 :
63025 :
63026 4 : return count;
63027 : }
63028 :
63029 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
63030 : // using values that overflow signed values of int.
63031 : size_t
63032 0 : SgTemplateDeclaration::memoryUsage()
63033 : {
63034 : // This function is required because we need the class name as a type when we call sizeof
63035 : // There might be another way to implement this if we have a traversal that only called a
63036 : // representative object (one call for each type of Sage IIIIR node).
63037 0 : size_t memory = numberOfNodes() * sizeof(SgTemplateDeclaration);
63038 :
63039 0 : return memory;
63040 : }
63041 :
63042 : /* #line 63043 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
63043 :
63044 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
63045 : void
63046 5342 : SgTemplateInstantiationDirectiveStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
63047 : {
63048 : // This function traverses the memory pool for only a specific IR node
63049 : // and calls the visit function of the input class execute a traversal
63050 : // similar to the style of the attribute based traversals within ROSE.
63051 : // This traversal will visit ALL nodes of the AST where as the other
63052 : // attribute based traversals visit only the embedded tree within the AST.
63053 :
63054 : // Initialize array to the address of the first element of the STL vector
63055 : // (which is guaranteed to be contiguous storage).
63056 : // SgTemplateInstantiationDirectiveStatement objectArray [] = *(Memory_Block_List.begin());
63057 5342 : if (SgTemplateInstantiationDirectiveStatement::pools.empty() == false)
63058 : {
63059 : // Generate an array of memory pools
63060 138 : SgTemplateInstantiationDirectiveStatement** objectArray = (SgTemplateInstantiationDirectiveStatement**) &(SgTemplateInstantiationDirectiveStatement::pools[0]);
63061 :
63062 : // Build a local variable for better performance
63063 138 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
63064 : #if 0
63065 : // Iterate over the memory pools
63066 : for (unsigned int i=0; i < SgTemplateInstantiationDirectiveStatement::pools.size(); i++)
63067 : {
63068 : // objectArray[i] is a single memory pool
63069 : for (int j=0; j < SgTemplateInstantiationDirectiveStatement::pool_size; j++)
63070 : {
63071 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
63072 : {
63073 : traversal.visit(&(objectArray[i][j]));
63074 : }
63075 : }
63076 : }
63077 : #else
63078 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
63079 : // compute the list first and then call the visit function on each list element.
63080 :
63081 : // printf ("Inside of SgTemplateInstantiationDirectiveStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
63082 :
63083 276 : std::vector<SgTemplateInstantiationDirectiveStatement*> nodeList;
63084 :
63085 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
63086 276 : for (unsigned int i=0; i < SgTemplateInstantiationDirectiveStatement::pools.size(); i++)
63087 : {
63088 : // objectArray[i] is a single memory pool
63089 276138 : for (unsigned j=0; j < SgTemplateInstantiationDirectiveStatement::pool_size; j++)
63090 : {
63091 276000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
63092 : {
63093 14306 : nodeList.push_back(&(objectArray[i][j]));
63094 : }
63095 : }
63096 : }
63097 :
63098 : // Iterate over the saved list
63099 138 : size_t nodeListSize = nodeList.size();
63100 14444 : for (size_t i=0; i < nodeListSize; i++)
63101 : {
63102 14306 : ROSE_ASSERT(nodeList[i] != NULL);
63103 : #if 0
63104 : traversal.visit(nodeList[i]);
63105 : #else
63106 14306 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
63107 : {
63108 14306 : traversal.visit(nodeList[i]);
63109 : }
63110 : #endif
63111 : }
63112 : #endif
63113 : }
63114 :
63115 : // This should not be required since all previously static data members are
63116 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
63117 :
63118 5342 : }
63119 :
63120 :
63121 : void
63122 194 : SgTemplateInstantiationDirectiveStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
63123 : {
63124 : // This function traverses the memory pool for an IR node and
63125 : // calls the function to execute the visitor object.
63126 :
63127 : // Initialize array to the address of the first element of the STL vector
63128 : // (which is guarenteed to be contiguous storage).
63129 : // SgTemplateInstantiationDirectiveStatement objectArray [] = *(Memory_Block_List.begin());
63130 194 : if (SgTemplateInstantiationDirectiveStatement::pools.empty() == false)
63131 : {
63132 : // Generate an array of memory pools
63133 137 : SgTemplateInstantiationDirectiveStatement** objectArray = (SgTemplateInstantiationDirectiveStatement**) &(SgTemplateInstantiationDirectiveStatement::pools[0]);
63134 :
63135 : // Build a local variable for better performance
63136 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
63137 :
63138 : // Iterate over the memory pools
63139 274 : for (unsigned int i=0; i < SgTemplateInstantiationDirectiveStatement::pools.size(); i++)
63140 : {
63141 : // objectArray[i] is a single memory pool
63142 274137 : for (unsigned j=0; j < SgTemplateInstantiationDirectiveStatement::pool_size; j++)
63143 : {
63144 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
63145 : {
63146 : // printf ("Found a valid SgTemplateInstantiationDirectiveStatement object in the memory pool %d at position %d \n",i,j);
63147 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
63148 16988 : objectArray[i][j].executeVisitorMemberFunction(visitor);
63149 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
63150 : }
63151 : else
63152 : {
63153 : // printf ("Found a INVALID SgTemplateInstantiationDirectiveStatement object in the memory pool \n");
63154 : }
63155 : }
63156 : }
63157 : }
63158 :
63159 : // This should not be required since all previously static data members are
63160 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
63161 :
63162 194 : }
63163 :
63164 : void
63165 0 : SgTemplateInstantiationDirectiveStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
63166 : {
63167 : // This function visits only a single IR node of the memory pool.
63168 : // it is typically called once for each type of IR node within
63169 : // the automatically generated function: traverseRepresentativeNodes().
63170 :
63171 : // Initialize array to the address of the first element of the STL vector
63172 : // (which is guarenteed to be contiguous storage).
63173 : // SgTemplateInstantiationDirectiveStatement objectArray [] = *(Memory_Block_List.begin());
63174 0 : if (SgTemplateInstantiationDirectiveStatement::pools.empty() == false)
63175 : {
63176 : // Generate an array of memory pools
63177 0 : SgTemplateInstantiationDirectiveStatement** objectArray = (SgTemplateInstantiationDirectiveStatement**) &(SgTemplateInstantiationDirectiveStatement::pools[0]);
63178 :
63179 : // Build a local variable for better performance
63180 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
63181 :
63182 : // Iterate over the memory pools
63183 0 : bool done = false;
63184 0 : unsigned i=0;
63185 :
63186 : // find the first valid IR node, call visit function, and then leave
63187 0 : while ( done == false && i < SgTemplateInstantiationDirectiveStatement::pools.size() )
63188 : {
63189 : // objectArray[i] is a single memory pool
63190 : unsigned j=0;
63191 0 : while (done == false && j < SgTemplateInstantiationDirectiveStatement::pool_size)
63192 : {
63193 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
63194 : {
63195 0 : traversal.visit(&(objectArray[i][j]));
63196 0 : done = true;
63197 : }
63198 0 : j++;
63199 : }
63200 0 : i++;
63201 : }
63202 :
63203 : #if 0
63204 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
63205 : if (done == false)
63206 : {
63207 : printf ("No representative for SgTemplateInstantiationDirectiveStatement found in memory pools \n");
63208 : }
63209 : #endif
63210 : }
63211 0 : }
63212 :
63213 :
63214 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
63215 : // using values that overflow signed values of int.
63216 : size_t
63217 4 : SgTemplateInstantiationDirectiveStatement::numberOfNodes()
63218 : {
63219 : // This function traverses the memory pool for an IR node and
63220 : // counts the number of IR nodes of a particular Sage III IR
63221 : // nodes type.
63222 :
63223 4 : size_t count = 0;
63224 4 : if (SgTemplateInstantiationDirectiveStatement::pools.empty() == false)
63225 : {
63226 : // Generate an array of memory pools (this is actually a STL vector,
63227 : // but it is contiguious, so OK to treat this way).
63228 1 : SgTemplateInstantiationDirectiveStatement** objectArray = (SgTemplateInstantiationDirectiveStatement**) &(SgTemplateInstantiationDirectiveStatement::pools[0]);
63229 :
63230 : // Build a local variable for better performance (make it a loop invariant variable).
63231 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
63232 :
63233 : // Iterate over all of the memory pools for this IR node.
63234 2 : for (unsigned int i=0; i < SgTemplateInstantiationDirectiveStatement::pools.size(); i++)
63235 : {
63236 : // objectArray[i] is a single memory pool, iterate over all the
63237 : // IR nodes and only count those that are valid IR nodes used in
63238 : // the AST (i.e. allocated IR nodes).
63239 2001 : for (unsigned j=0; j < SgTemplateInstantiationDirectiveStatement::pool_size; j++)
63240 : {
63241 : // This is indexing the STL vector of C/C++ style arrays as a doubly
63242 : // indexed array access. It is OK since we have leveraged the semantics
63243 : // of STL vector memory as contigous and cast the memory as an array
63244 : // of arrays to use the 2D array indexing. Hope this is not confusing,
63245 : // but it s very fast as an implementation.
63246 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
63247 : {
63248 124 : count++;
63249 : }
63250 : }
63251 : }
63252 : }
63253 :
63254 :
63255 :
63256 4 : return count;
63257 : }
63258 :
63259 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
63260 : // using values that overflow signed values of int.
63261 : size_t
63262 0 : SgTemplateInstantiationDirectiveStatement::memoryUsage()
63263 : {
63264 : // This function is required because we need the class name as a type when we call sizeof
63265 : // There might be another way to implement this if we have a traversal that only called a
63266 : // representative object (one call for each type of Sage IIIIR node).
63267 0 : size_t memory = numberOfNodes() * sizeof(SgTemplateInstantiationDirectiveStatement);
63268 :
63269 0 : return memory;
63270 : }
63271 :
63272 : /* #line 63273 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
63273 :
63274 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
63275 : void
63276 5342 : SgUseStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
63277 : {
63278 : // This function traverses the memory pool for only a specific IR node
63279 : // and calls the visit function of the input class execute a traversal
63280 : // similar to the style of the attribute based traversals within ROSE.
63281 : // This traversal will visit ALL nodes of the AST where as the other
63282 : // attribute based traversals visit only the embedded tree within the AST.
63283 :
63284 : // Initialize array to the address of the first element of the STL vector
63285 : // (which is guaranteed to be contiguous storage).
63286 : // SgUseStatement objectArray [] = *(Memory_Block_List.begin());
63287 5342 : if (SgUseStatement::pools.empty() == false)
63288 : {
63289 : // Generate an array of memory pools
63290 0 : SgUseStatement** objectArray = (SgUseStatement**) &(SgUseStatement::pools[0]);
63291 :
63292 : // Build a local variable for better performance
63293 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
63294 : #if 0
63295 : // Iterate over the memory pools
63296 : for (unsigned int i=0; i < SgUseStatement::pools.size(); i++)
63297 : {
63298 : // objectArray[i] is a single memory pool
63299 : for (int j=0; j < SgUseStatement::pool_size; j++)
63300 : {
63301 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
63302 : {
63303 : traversal.visit(&(objectArray[i][j]));
63304 : }
63305 : }
63306 : }
63307 : #else
63308 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
63309 : // compute the list first and then call the visit function on each list element.
63310 :
63311 : // printf ("Inside of SgUseStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
63312 :
63313 0 : std::vector<SgUseStatement*> nodeList;
63314 :
63315 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
63316 0 : for (unsigned int i=0; i < SgUseStatement::pools.size(); i++)
63317 : {
63318 : // objectArray[i] is a single memory pool
63319 0 : for (unsigned j=0; j < SgUseStatement::pool_size; j++)
63320 : {
63321 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
63322 : {
63323 0 : nodeList.push_back(&(objectArray[i][j]));
63324 : }
63325 : }
63326 : }
63327 :
63328 : // Iterate over the saved list
63329 0 : size_t nodeListSize = nodeList.size();
63330 0 : for (size_t i=0; i < nodeListSize; i++)
63331 : {
63332 0 : ROSE_ASSERT(nodeList[i] != NULL);
63333 : #if 0
63334 : traversal.visit(nodeList[i]);
63335 : #else
63336 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
63337 : {
63338 0 : traversal.visit(nodeList[i]);
63339 : }
63340 : #endif
63341 : }
63342 : #endif
63343 : }
63344 :
63345 : // This should not be required since all previously static data members are
63346 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
63347 :
63348 5342 : }
63349 :
63350 :
63351 : void
63352 194 : SgUseStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
63353 : {
63354 : // This function traverses the memory pool for an IR node and
63355 : // calls the function to execute the visitor object.
63356 :
63357 : // Initialize array to the address of the first element of the STL vector
63358 : // (which is guarenteed to be contiguous storage).
63359 : // SgUseStatement objectArray [] = *(Memory_Block_List.begin());
63360 194 : if (SgUseStatement::pools.empty() == false)
63361 : {
63362 : // Generate an array of memory pools
63363 0 : SgUseStatement** objectArray = (SgUseStatement**) &(SgUseStatement::pools[0]);
63364 :
63365 : // Build a local variable for better performance
63366 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
63367 :
63368 : // Iterate over the memory pools
63369 0 : for (unsigned int i=0; i < SgUseStatement::pools.size(); i++)
63370 : {
63371 : // objectArray[i] is a single memory pool
63372 0 : for (unsigned j=0; j < SgUseStatement::pool_size; j++)
63373 : {
63374 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
63375 : {
63376 : // printf ("Found a valid SgUseStatement object in the memory pool %d at position %d \n",i,j);
63377 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
63378 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
63379 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
63380 : }
63381 : else
63382 : {
63383 : // printf ("Found a INVALID SgUseStatement object in the memory pool \n");
63384 : }
63385 : }
63386 : }
63387 : }
63388 :
63389 : // This should not be required since all previously static data members are
63390 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
63391 :
63392 194 : }
63393 :
63394 : void
63395 0 : SgUseStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
63396 : {
63397 : // This function visits only a single IR node of the memory pool.
63398 : // it is typically called once for each type of IR node within
63399 : // the automatically generated function: traverseRepresentativeNodes().
63400 :
63401 : // Initialize array to the address of the first element of the STL vector
63402 : // (which is guarenteed to be contiguous storage).
63403 : // SgUseStatement objectArray [] = *(Memory_Block_List.begin());
63404 0 : if (SgUseStatement::pools.empty() == false)
63405 : {
63406 : // Generate an array of memory pools
63407 0 : SgUseStatement** objectArray = (SgUseStatement**) &(SgUseStatement::pools[0]);
63408 :
63409 : // Build a local variable for better performance
63410 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
63411 :
63412 : // Iterate over the memory pools
63413 0 : bool done = false;
63414 0 : unsigned i=0;
63415 :
63416 : // find the first valid IR node, call visit function, and then leave
63417 0 : while ( done == false && i < SgUseStatement::pools.size() )
63418 : {
63419 : // objectArray[i] is a single memory pool
63420 : unsigned j=0;
63421 0 : while (done == false && j < SgUseStatement::pool_size)
63422 : {
63423 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
63424 : {
63425 0 : traversal.visit(&(objectArray[i][j]));
63426 0 : done = true;
63427 : }
63428 0 : j++;
63429 : }
63430 0 : i++;
63431 : }
63432 :
63433 : #if 0
63434 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
63435 : if (done == false)
63436 : {
63437 : printf ("No representative for SgUseStatement found in memory pools \n");
63438 : }
63439 : #endif
63440 : }
63441 0 : }
63442 :
63443 :
63444 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
63445 : // using values that overflow signed values of int.
63446 : size_t
63447 4 : SgUseStatement::numberOfNodes()
63448 : {
63449 : // This function traverses the memory pool for an IR node and
63450 : // counts the number of IR nodes of a particular Sage III IR
63451 : // nodes type.
63452 :
63453 4 : size_t count = 0;
63454 4 : if (SgUseStatement::pools.empty() == false)
63455 : {
63456 : // Generate an array of memory pools (this is actually a STL vector,
63457 : // but it is contiguious, so OK to treat this way).
63458 0 : SgUseStatement** objectArray = (SgUseStatement**) &(SgUseStatement::pools[0]);
63459 :
63460 : // Build a local variable for better performance (make it a loop invariant variable).
63461 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
63462 :
63463 : // Iterate over all of the memory pools for this IR node.
63464 0 : for (unsigned int i=0; i < SgUseStatement::pools.size(); i++)
63465 : {
63466 : // objectArray[i] is a single memory pool, iterate over all the
63467 : // IR nodes and only count those that are valid IR nodes used in
63468 : // the AST (i.e. allocated IR nodes).
63469 0 : for (unsigned j=0; j < SgUseStatement::pool_size; j++)
63470 : {
63471 : // This is indexing the STL vector of C/C++ style arrays as a doubly
63472 : // indexed array access. It is OK since we have leveraged the semantics
63473 : // of STL vector memory as contigous and cast the memory as an array
63474 : // of arrays to use the 2D array indexing. Hope this is not confusing,
63475 : // but it s very fast as an implementation.
63476 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
63477 : {
63478 0 : count++;
63479 : }
63480 : }
63481 : }
63482 : }
63483 :
63484 :
63485 :
63486 4 : return count;
63487 : }
63488 :
63489 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
63490 : // using values that overflow signed values of int.
63491 : size_t
63492 0 : SgUseStatement::memoryUsage()
63493 : {
63494 : // This function is required because we need the class name as a type when we call sizeof
63495 : // There might be another way to implement this if we have a traversal that only called a
63496 : // representative object (one call for each type of Sage IIIIR node).
63497 0 : size_t memory = numberOfNodes() * sizeof(SgUseStatement);
63498 :
63499 0 : return memory;
63500 : }
63501 :
63502 : /* #line 63503 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
63503 :
63504 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
63505 : void
63506 5342 : SgParameterStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
63507 : {
63508 : // This function traverses the memory pool for only a specific IR node
63509 : // and calls the visit function of the input class execute a traversal
63510 : // similar to the style of the attribute based traversals within ROSE.
63511 : // This traversal will visit ALL nodes of the AST where as the other
63512 : // attribute based traversals visit only the embedded tree within the AST.
63513 :
63514 : // Initialize array to the address of the first element of the STL vector
63515 : // (which is guaranteed to be contiguous storage).
63516 : // SgParameterStatement objectArray [] = *(Memory_Block_List.begin());
63517 5342 : if (SgParameterStatement::pools.empty() == false)
63518 : {
63519 : // Generate an array of memory pools
63520 0 : SgParameterStatement** objectArray = (SgParameterStatement**) &(SgParameterStatement::pools[0]);
63521 :
63522 : // Build a local variable for better performance
63523 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
63524 : #if 0
63525 : // Iterate over the memory pools
63526 : for (unsigned int i=0; i < SgParameterStatement::pools.size(); i++)
63527 : {
63528 : // objectArray[i] is a single memory pool
63529 : for (int j=0; j < SgParameterStatement::pool_size; j++)
63530 : {
63531 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
63532 : {
63533 : traversal.visit(&(objectArray[i][j]));
63534 : }
63535 : }
63536 : }
63537 : #else
63538 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
63539 : // compute the list first and then call the visit function on each list element.
63540 :
63541 : // printf ("Inside of SgParameterStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
63542 :
63543 0 : std::vector<SgParameterStatement*> nodeList;
63544 :
63545 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
63546 0 : for (unsigned int i=0; i < SgParameterStatement::pools.size(); i++)
63547 : {
63548 : // objectArray[i] is a single memory pool
63549 0 : for (unsigned j=0; j < SgParameterStatement::pool_size; j++)
63550 : {
63551 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
63552 : {
63553 0 : nodeList.push_back(&(objectArray[i][j]));
63554 : }
63555 : }
63556 : }
63557 :
63558 : // Iterate over the saved list
63559 0 : size_t nodeListSize = nodeList.size();
63560 0 : for (size_t i=0; i < nodeListSize; i++)
63561 : {
63562 0 : ROSE_ASSERT(nodeList[i] != NULL);
63563 : #if 0
63564 : traversal.visit(nodeList[i]);
63565 : #else
63566 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
63567 : {
63568 0 : traversal.visit(nodeList[i]);
63569 : }
63570 : #endif
63571 : }
63572 : #endif
63573 : }
63574 :
63575 : // This should not be required since all previously static data members are
63576 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
63577 :
63578 5342 : }
63579 :
63580 :
63581 : void
63582 194 : SgParameterStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
63583 : {
63584 : // This function traverses the memory pool for an IR node and
63585 : // calls the function to execute the visitor object.
63586 :
63587 : // Initialize array to the address of the first element of the STL vector
63588 : // (which is guarenteed to be contiguous storage).
63589 : // SgParameterStatement objectArray [] = *(Memory_Block_List.begin());
63590 194 : if (SgParameterStatement::pools.empty() == false)
63591 : {
63592 : // Generate an array of memory pools
63593 0 : SgParameterStatement** objectArray = (SgParameterStatement**) &(SgParameterStatement::pools[0]);
63594 :
63595 : // Build a local variable for better performance
63596 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
63597 :
63598 : // Iterate over the memory pools
63599 0 : for (unsigned int i=0; i < SgParameterStatement::pools.size(); i++)
63600 : {
63601 : // objectArray[i] is a single memory pool
63602 0 : for (unsigned j=0; j < SgParameterStatement::pool_size; j++)
63603 : {
63604 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
63605 : {
63606 : // printf ("Found a valid SgParameterStatement object in the memory pool %d at position %d \n",i,j);
63607 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
63608 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
63609 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
63610 : }
63611 : else
63612 : {
63613 : // printf ("Found a INVALID SgParameterStatement object in the memory pool \n");
63614 : }
63615 : }
63616 : }
63617 : }
63618 :
63619 : // This should not be required since all previously static data members are
63620 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
63621 :
63622 194 : }
63623 :
63624 : void
63625 0 : SgParameterStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
63626 : {
63627 : // This function visits only a single IR node of the memory pool.
63628 : // it is typically called once for each type of IR node within
63629 : // the automatically generated function: traverseRepresentativeNodes().
63630 :
63631 : // Initialize array to the address of the first element of the STL vector
63632 : // (which is guarenteed to be contiguous storage).
63633 : // SgParameterStatement objectArray [] = *(Memory_Block_List.begin());
63634 0 : if (SgParameterStatement::pools.empty() == false)
63635 : {
63636 : // Generate an array of memory pools
63637 0 : SgParameterStatement** objectArray = (SgParameterStatement**) &(SgParameterStatement::pools[0]);
63638 :
63639 : // Build a local variable for better performance
63640 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
63641 :
63642 : // Iterate over the memory pools
63643 0 : bool done = false;
63644 0 : unsigned i=0;
63645 :
63646 : // find the first valid IR node, call visit function, and then leave
63647 0 : while ( done == false && i < SgParameterStatement::pools.size() )
63648 : {
63649 : // objectArray[i] is a single memory pool
63650 : unsigned j=0;
63651 0 : while (done == false && j < SgParameterStatement::pool_size)
63652 : {
63653 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
63654 : {
63655 0 : traversal.visit(&(objectArray[i][j]));
63656 0 : done = true;
63657 : }
63658 0 : j++;
63659 : }
63660 0 : i++;
63661 : }
63662 :
63663 : #if 0
63664 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
63665 : if (done == false)
63666 : {
63667 : printf ("No representative for SgParameterStatement found in memory pools \n");
63668 : }
63669 : #endif
63670 : }
63671 0 : }
63672 :
63673 :
63674 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
63675 : // using values that overflow signed values of int.
63676 : size_t
63677 4 : SgParameterStatement::numberOfNodes()
63678 : {
63679 : // This function traverses the memory pool for an IR node and
63680 : // counts the number of IR nodes of a particular Sage III IR
63681 : // nodes type.
63682 :
63683 4 : size_t count = 0;
63684 4 : if (SgParameterStatement::pools.empty() == false)
63685 : {
63686 : // Generate an array of memory pools (this is actually a STL vector,
63687 : // but it is contiguious, so OK to treat this way).
63688 0 : SgParameterStatement** objectArray = (SgParameterStatement**) &(SgParameterStatement::pools[0]);
63689 :
63690 : // Build a local variable for better performance (make it a loop invariant variable).
63691 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
63692 :
63693 : // Iterate over all of the memory pools for this IR node.
63694 0 : for (unsigned int i=0; i < SgParameterStatement::pools.size(); i++)
63695 : {
63696 : // objectArray[i] is a single memory pool, iterate over all the
63697 : // IR nodes and only count those that are valid IR nodes used in
63698 : // the AST (i.e. allocated IR nodes).
63699 0 : for (unsigned j=0; j < SgParameterStatement::pool_size; j++)
63700 : {
63701 : // This is indexing the STL vector of C/C++ style arrays as a doubly
63702 : // indexed array access. It is OK since we have leveraged the semantics
63703 : // of STL vector memory as contigous and cast the memory as an array
63704 : // of arrays to use the 2D array indexing. Hope this is not confusing,
63705 : // but it s very fast as an implementation.
63706 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
63707 : {
63708 0 : count++;
63709 : }
63710 : }
63711 : }
63712 : }
63713 :
63714 :
63715 :
63716 4 : return count;
63717 : }
63718 :
63719 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
63720 : // using values that overflow signed values of int.
63721 : size_t
63722 0 : SgParameterStatement::memoryUsage()
63723 : {
63724 : // This function is required because we need the class name as a type when we call sizeof
63725 : // There might be another way to implement this if we have a traversal that only called a
63726 : // representative object (one call for each type of Sage IIIIR node).
63727 0 : size_t memory = numberOfNodes() * sizeof(SgParameterStatement);
63728 :
63729 0 : return memory;
63730 : }
63731 :
63732 : /* #line 63733 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
63733 :
63734 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
63735 : void
63736 5342 : SgNamespaceDeclarationStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
63737 : {
63738 : // This function traverses the memory pool for only a specific IR node
63739 : // and calls the visit function of the input class execute a traversal
63740 : // similar to the style of the attribute based traversals within ROSE.
63741 : // This traversal will visit ALL nodes of the AST where as the other
63742 : // attribute based traversals visit only the embedded tree within the AST.
63743 :
63744 : // Initialize array to the address of the first element of the STL vector
63745 : // (which is guaranteed to be contiguous storage).
63746 : // SgNamespaceDeclarationStatement objectArray [] = *(Memory_Block_List.begin());
63747 5342 : if (SgNamespaceDeclarationStatement::pools.empty() == false)
63748 : {
63749 : // Generate an array of memory pools
63750 208 : SgNamespaceDeclarationStatement** objectArray = (SgNamespaceDeclarationStatement**) &(SgNamespaceDeclarationStatement::pools[0]);
63751 :
63752 : // Build a local variable for better performance
63753 208 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
63754 : #if 0
63755 : // Iterate over the memory pools
63756 : for (unsigned int i=0; i < SgNamespaceDeclarationStatement::pools.size(); i++)
63757 : {
63758 : // objectArray[i] is a single memory pool
63759 : for (int j=0; j < SgNamespaceDeclarationStatement::pool_size; j++)
63760 : {
63761 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
63762 : {
63763 : traversal.visit(&(objectArray[i][j]));
63764 : }
63765 : }
63766 : }
63767 : #else
63768 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
63769 : // compute the list first and then call the visit function on each list element.
63770 :
63771 : // printf ("Inside of SgNamespaceDeclarationStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
63772 :
63773 416 : std::vector<SgNamespaceDeclarationStatement*> nodeList;
63774 :
63775 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
63776 416 : for (unsigned int i=0; i < SgNamespaceDeclarationStatement::pools.size(); i++)
63777 : {
63778 : // objectArray[i] is a single memory pool
63779 416208 : for (unsigned j=0; j < SgNamespaceDeclarationStatement::pool_size; j++)
63780 : {
63781 416000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
63782 : {
63783 15819 : nodeList.push_back(&(objectArray[i][j]));
63784 : }
63785 : }
63786 : }
63787 :
63788 : // Iterate over the saved list
63789 208 : size_t nodeListSize = nodeList.size();
63790 16027 : for (size_t i=0; i < nodeListSize; i++)
63791 : {
63792 15819 : ROSE_ASSERT(nodeList[i] != NULL);
63793 : #if 0
63794 : traversal.visit(nodeList[i]);
63795 : #else
63796 15819 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
63797 : {
63798 15819 : traversal.visit(nodeList[i]);
63799 : }
63800 : #endif
63801 : }
63802 : #endif
63803 : }
63804 :
63805 : // This should not be required since all previously static data members are
63806 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
63807 :
63808 5342 : }
63809 :
63810 :
63811 : void
63812 194 : SgNamespaceDeclarationStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
63813 : {
63814 : // This function traverses the memory pool for an IR node and
63815 : // calls the function to execute the visitor object.
63816 :
63817 : // Initialize array to the address of the first element of the STL vector
63818 : // (which is guarenteed to be contiguous storage).
63819 : // SgNamespaceDeclarationStatement objectArray [] = *(Memory_Block_List.begin());
63820 194 : if (SgNamespaceDeclarationStatement::pools.empty() == false)
63821 : {
63822 : // Generate an array of memory pools
63823 137 : SgNamespaceDeclarationStatement** objectArray = (SgNamespaceDeclarationStatement**) &(SgNamespaceDeclarationStatement::pools[0]);
63824 :
63825 : // Build a local variable for better performance
63826 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
63827 :
63828 : // Iterate over the memory pools
63829 274 : for (unsigned int i=0; i < SgNamespaceDeclarationStatement::pools.size(); i++)
63830 : {
63831 : // objectArray[i] is a single memory pool
63832 274137 : for (unsigned j=0; j < SgNamespaceDeclarationStatement::pool_size; j++)
63833 : {
63834 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
63835 : {
63836 : // printf ("Found a valid SgNamespaceDeclarationStatement object in the memory pool %d at position %d \n",i,j);
63837 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
63838 16721 : objectArray[i][j].executeVisitorMemberFunction(visitor);
63839 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
63840 : }
63841 : else
63842 : {
63843 : // printf ("Found a INVALID SgNamespaceDeclarationStatement object in the memory pool \n");
63844 : }
63845 : }
63846 : }
63847 : }
63848 :
63849 : // This should not be required since all previously static data members are
63850 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
63851 :
63852 194 : }
63853 :
63854 : void
63855 0 : SgNamespaceDeclarationStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
63856 : {
63857 : // This function visits only a single IR node of the memory pool.
63858 : // it is typically called once for each type of IR node within
63859 : // the automatically generated function: traverseRepresentativeNodes().
63860 :
63861 : // Initialize array to the address of the first element of the STL vector
63862 : // (which is guarenteed to be contiguous storage).
63863 : // SgNamespaceDeclarationStatement objectArray [] = *(Memory_Block_List.begin());
63864 0 : if (SgNamespaceDeclarationStatement::pools.empty() == false)
63865 : {
63866 : // Generate an array of memory pools
63867 0 : SgNamespaceDeclarationStatement** objectArray = (SgNamespaceDeclarationStatement**) &(SgNamespaceDeclarationStatement::pools[0]);
63868 :
63869 : // Build a local variable for better performance
63870 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
63871 :
63872 : // Iterate over the memory pools
63873 0 : bool done = false;
63874 0 : unsigned i=0;
63875 :
63876 : // find the first valid IR node, call visit function, and then leave
63877 0 : while ( done == false && i < SgNamespaceDeclarationStatement::pools.size() )
63878 : {
63879 : // objectArray[i] is a single memory pool
63880 : unsigned j=0;
63881 0 : while (done == false && j < SgNamespaceDeclarationStatement::pool_size)
63882 : {
63883 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
63884 : {
63885 0 : traversal.visit(&(objectArray[i][j]));
63886 0 : done = true;
63887 : }
63888 0 : j++;
63889 : }
63890 0 : i++;
63891 : }
63892 :
63893 : #if 0
63894 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
63895 : if (done == false)
63896 : {
63897 : printf ("No representative for SgNamespaceDeclarationStatement found in memory pools \n");
63898 : }
63899 : #endif
63900 : }
63901 0 : }
63902 :
63903 :
63904 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
63905 : // using values that overflow signed values of int.
63906 : size_t
63907 4 : SgNamespaceDeclarationStatement::numberOfNodes()
63908 : {
63909 : // This function traverses the memory pool for an IR node and
63910 : // counts the number of IR nodes of a particular Sage III IR
63911 : // nodes type.
63912 :
63913 4 : size_t count = 0;
63914 4 : if (SgNamespaceDeclarationStatement::pools.empty() == false)
63915 : {
63916 : // Generate an array of memory pools (this is actually a STL vector,
63917 : // but it is contiguious, so OK to treat this way).
63918 1 : SgNamespaceDeclarationStatement** objectArray = (SgNamespaceDeclarationStatement**) &(SgNamespaceDeclarationStatement::pools[0]);
63919 :
63920 : // Build a local variable for better performance (make it a loop invariant variable).
63921 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
63922 :
63923 : // Iterate over all of the memory pools for this IR node.
63924 2 : for (unsigned int i=0; i < SgNamespaceDeclarationStatement::pools.size(); i++)
63925 : {
63926 : // objectArray[i] is a single memory pool, iterate over all the
63927 : // IR nodes and only count those that are valid IR nodes used in
63928 : // the AST (i.e. allocated IR nodes).
63929 2001 : for (unsigned j=0; j < SgNamespaceDeclarationStatement::pool_size; j++)
63930 : {
63931 : // This is indexing the STL vector of C/C++ style arrays as a doubly
63932 : // indexed array access. It is OK since we have leveraged the semantics
63933 : // of STL vector memory as contigous and cast the memory as an array
63934 : // of arrays to use the 2D array indexing. Hope this is not confusing,
63935 : // but it s very fast as an implementation.
63936 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
63937 : {
63938 121 : count++;
63939 : }
63940 : }
63941 : }
63942 : }
63943 :
63944 :
63945 :
63946 4 : return count;
63947 : }
63948 :
63949 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
63950 : // using values that overflow signed values of int.
63951 : size_t
63952 0 : SgNamespaceDeclarationStatement::memoryUsage()
63953 : {
63954 : // This function is required because we need the class name as a type when we call sizeof
63955 : // There might be another way to implement this if we have a traversal that only called a
63956 : // representative object (one call for each type of Sage IIIIR node).
63957 0 : size_t memory = numberOfNodes() * sizeof(SgNamespaceDeclarationStatement);
63958 :
63959 0 : return memory;
63960 : }
63961 :
63962 : /* #line 63963 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
63963 :
63964 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
63965 : void
63966 5342 : SgEquivalenceStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
63967 : {
63968 : // This function traverses the memory pool for only a specific IR node
63969 : // and calls the visit function of the input class execute a traversal
63970 : // similar to the style of the attribute based traversals within ROSE.
63971 : // This traversal will visit ALL nodes of the AST where as the other
63972 : // attribute based traversals visit only the embedded tree within the AST.
63973 :
63974 : // Initialize array to the address of the first element of the STL vector
63975 : // (which is guaranteed to be contiguous storage).
63976 : // SgEquivalenceStatement objectArray [] = *(Memory_Block_List.begin());
63977 5342 : if (SgEquivalenceStatement::pools.empty() == false)
63978 : {
63979 : // Generate an array of memory pools
63980 0 : SgEquivalenceStatement** objectArray = (SgEquivalenceStatement**) &(SgEquivalenceStatement::pools[0]);
63981 :
63982 : // Build a local variable for better performance
63983 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
63984 : #if 0
63985 : // Iterate over the memory pools
63986 : for (unsigned int i=0; i < SgEquivalenceStatement::pools.size(); i++)
63987 : {
63988 : // objectArray[i] is a single memory pool
63989 : for (int j=0; j < SgEquivalenceStatement::pool_size; j++)
63990 : {
63991 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
63992 : {
63993 : traversal.visit(&(objectArray[i][j]));
63994 : }
63995 : }
63996 : }
63997 : #else
63998 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
63999 : // compute the list first and then call the visit function on each list element.
64000 :
64001 : // printf ("Inside of SgEquivalenceStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
64002 :
64003 0 : std::vector<SgEquivalenceStatement*> nodeList;
64004 :
64005 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
64006 0 : for (unsigned int i=0; i < SgEquivalenceStatement::pools.size(); i++)
64007 : {
64008 : // objectArray[i] is a single memory pool
64009 0 : for (unsigned j=0; j < SgEquivalenceStatement::pool_size; j++)
64010 : {
64011 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
64012 : {
64013 0 : nodeList.push_back(&(objectArray[i][j]));
64014 : }
64015 : }
64016 : }
64017 :
64018 : // Iterate over the saved list
64019 0 : size_t nodeListSize = nodeList.size();
64020 0 : for (size_t i=0; i < nodeListSize; i++)
64021 : {
64022 0 : ROSE_ASSERT(nodeList[i] != NULL);
64023 : #if 0
64024 : traversal.visit(nodeList[i]);
64025 : #else
64026 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
64027 : {
64028 0 : traversal.visit(nodeList[i]);
64029 : }
64030 : #endif
64031 : }
64032 : #endif
64033 : }
64034 :
64035 : // This should not be required since all previously static data members are
64036 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
64037 :
64038 5342 : }
64039 :
64040 :
64041 : void
64042 194 : SgEquivalenceStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
64043 : {
64044 : // This function traverses the memory pool for an IR node and
64045 : // calls the function to execute the visitor object.
64046 :
64047 : // Initialize array to the address of the first element of the STL vector
64048 : // (which is guarenteed to be contiguous storage).
64049 : // SgEquivalenceStatement objectArray [] = *(Memory_Block_List.begin());
64050 194 : if (SgEquivalenceStatement::pools.empty() == false)
64051 : {
64052 : // Generate an array of memory pools
64053 0 : SgEquivalenceStatement** objectArray = (SgEquivalenceStatement**) &(SgEquivalenceStatement::pools[0]);
64054 :
64055 : // Build a local variable for better performance
64056 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
64057 :
64058 : // Iterate over the memory pools
64059 0 : for (unsigned int i=0; i < SgEquivalenceStatement::pools.size(); i++)
64060 : {
64061 : // objectArray[i] is a single memory pool
64062 0 : for (unsigned j=0; j < SgEquivalenceStatement::pool_size; j++)
64063 : {
64064 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
64065 : {
64066 : // printf ("Found a valid SgEquivalenceStatement object in the memory pool %d at position %d \n",i,j);
64067 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
64068 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
64069 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
64070 : }
64071 : else
64072 : {
64073 : // printf ("Found a INVALID SgEquivalenceStatement object in the memory pool \n");
64074 : }
64075 : }
64076 : }
64077 : }
64078 :
64079 : // This should not be required since all previously static data members are
64080 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
64081 :
64082 194 : }
64083 :
64084 : void
64085 0 : SgEquivalenceStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
64086 : {
64087 : // This function visits only a single IR node of the memory pool.
64088 : // it is typically called once for each type of IR node within
64089 : // the automatically generated function: traverseRepresentativeNodes().
64090 :
64091 : // Initialize array to the address of the first element of the STL vector
64092 : // (which is guarenteed to be contiguous storage).
64093 : // SgEquivalenceStatement objectArray [] = *(Memory_Block_List.begin());
64094 0 : if (SgEquivalenceStatement::pools.empty() == false)
64095 : {
64096 : // Generate an array of memory pools
64097 0 : SgEquivalenceStatement** objectArray = (SgEquivalenceStatement**) &(SgEquivalenceStatement::pools[0]);
64098 :
64099 : // Build a local variable for better performance
64100 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
64101 :
64102 : // Iterate over the memory pools
64103 0 : bool done = false;
64104 0 : unsigned i=0;
64105 :
64106 : // find the first valid IR node, call visit function, and then leave
64107 0 : while ( done == false && i < SgEquivalenceStatement::pools.size() )
64108 : {
64109 : // objectArray[i] is a single memory pool
64110 : unsigned j=0;
64111 0 : while (done == false && j < SgEquivalenceStatement::pool_size)
64112 : {
64113 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
64114 : {
64115 0 : traversal.visit(&(objectArray[i][j]));
64116 0 : done = true;
64117 : }
64118 0 : j++;
64119 : }
64120 0 : i++;
64121 : }
64122 :
64123 : #if 0
64124 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
64125 : if (done == false)
64126 : {
64127 : printf ("No representative for SgEquivalenceStatement found in memory pools \n");
64128 : }
64129 : #endif
64130 : }
64131 0 : }
64132 :
64133 :
64134 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
64135 : // using values that overflow signed values of int.
64136 : size_t
64137 4 : SgEquivalenceStatement::numberOfNodes()
64138 : {
64139 : // This function traverses the memory pool for an IR node and
64140 : // counts the number of IR nodes of a particular Sage III IR
64141 : // nodes type.
64142 :
64143 4 : size_t count = 0;
64144 4 : if (SgEquivalenceStatement::pools.empty() == false)
64145 : {
64146 : // Generate an array of memory pools (this is actually a STL vector,
64147 : // but it is contiguious, so OK to treat this way).
64148 0 : SgEquivalenceStatement** objectArray = (SgEquivalenceStatement**) &(SgEquivalenceStatement::pools[0]);
64149 :
64150 : // Build a local variable for better performance (make it a loop invariant variable).
64151 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
64152 :
64153 : // Iterate over all of the memory pools for this IR node.
64154 0 : for (unsigned int i=0; i < SgEquivalenceStatement::pools.size(); i++)
64155 : {
64156 : // objectArray[i] is a single memory pool, iterate over all the
64157 : // IR nodes and only count those that are valid IR nodes used in
64158 : // the AST (i.e. allocated IR nodes).
64159 0 : for (unsigned j=0; j < SgEquivalenceStatement::pool_size; j++)
64160 : {
64161 : // This is indexing the STL vector of C/C++ style arrays as a doubly
64162 : // indexed array access. It is OK since we have leveraged the semantics
64163 : // of STL vector memory as contigous and cast the memory as an array
64164 : // of arrays to use the 2D array indexing. Hope this is not confusing,
64165 : // but it s very fast as an implementation.
64166 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
64167 : {
64168 0 : count++;
64169 : }
64170 : }
64171 : }
64172 : }
64173 :
64174 :
64175 :
64176 4 : return count;
64177 : }
64178 :
64179 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
64180 : // using values that overflow signed values of int.
64181 : size_t
64182 0 : SgEquivalenceStatement::memoryUsage()
64183 : {
64184 : // This function is required because we need the class name as a type when we call sizeof
64185 : // There might be another way to implement this if we have a traversal that only called a
64186 : // representative object (one call for each type of Sage IIIIR node).
64187 0 : size_t memory = numberOfNodes() * sizeof(SgEquivalenceStatement);
64188 :
64189 0 : return memory;
64190 : }
64191 :
64192 : /* #line 64193 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
64193 :
64194 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
64195 : void
64196 5342 : SgInterfaceStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
64197 : {
64198 : // This function traverses the memory pool for only a specific IR node
64199 : // and calls the visit function of the input class execute a traversal
64200 : // similar to the style of the attribute based traversals within ROSE.
64201 : // This traversal will visit ALL nodes of the AST where as the other
64202 : // attribute based traversals visit only the embedded tree within the AST.
64203 :
64204 : // Initialize array to the address of the first element of the STL vector
64205 : // (which is guaranteed to be contiguous storage).
64206 : // SgInterfaceStatement objectArray [] = *(Memory_Block_List.begin());
64207 5342 : if (SgInterfaceStatement::pools.empty() == false)
64208 : {
64209 : // Generate an array of memory pools
64210 0 : SgInterfaceStatement** objectArray = (SgInterfaceStatement**) &(SgInterfaceStatement::pools[0]);
64211 :
64212 : // Build a local variable for better performance
64213 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
64214 : #if 0
64215 : // Iterate over the memory pools
64216 : for (unsigned int i=0; i < SgInterfaceStatement::pools.size(); i++)
64217 : {
64218 : // objectArray[i] is a single memory pool
64219 : for (int j=0; j < SgInterfaceStatement::pool_size; j++)
64220 : {
64221 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
64222 : {
64223 : traversal.visit(&(objectArray[i][j]));
64224 : }
64225 : }
64226 : }
64227 : #else
64228 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
64229 : // compute the list first and then call the visit function on each list element.
64230 :
64231 : // printf ("Inside of SgInterfaceStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
64232 :
64233 0 : std::vector<SgInterfaceStatement*> nodeList;
64234 :
64235 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
64236 0 : for (unsigned int i=0; i < SgInterfaceStatement::pools.size(); i++)
64237 : {
64238 : // objectArray[i] is a single memory pool
64239 0 : for (unsigned j=0; j < SgInterfaceStatement::pool_size; j++)
64240 : {
64241 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
64242 : {
64243 0 : nodeList.push_back(&(objectArray[i][j]));
64244 : }
64245 : }
64246 : }
64247 :
64248 : // Iterate over the saved list
64249 0 : size_t nodeListSize = nodeList.size();
64250 0 : for (size_t i=0; i < nodeListSize; i++)
64251 : {
64252 0 : ROSE_ASSERT(nodeList[i] != NULL);
64253 : #if 0
64254 : traversal.visit(nodeList[i]);
64255 : #else
64256 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
64257 : {
64258 0 : traversal.visit(nodeList[i]);
64259 : }
64260 : #endif
64261 : }
64262 : #endif
64263 : }
64264 :
64265 : // This should not be required since all previously static data members are
64266 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
64267 :
64268 5342 : }
64269 :
64270 :
64271 : void
64272 194 : SgInterfaceStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
64273 : {
64274 : // This function traverses the memory pool for an IR node and
64275 : // calls the function to execute the visitor object.
64276 :
64277 : // Initialize array to the address of the first element of the STL vector
64278 : // (which is guarenteed to be contiguous storage).
64279 : // SgInterfaceStatement objectArray [] = *(Memory_Block_List.begin());
64280 194 : if (SgInterfaceStatement::pools.empty() == false)
64281 : {
64282 : // Generate an array of memory pools
64283 0 : SgInterfaceStatement** objectArray = (SgInterfaceStatement**) &(SgInterfaceStatement::pools[0]);
64284 :
64285 : // Build a local variable for better performance
64286 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
64287 :
64288 : // Iterate over the memory pools
64289 0 : for (unsigned int i=0; i < SgInterfaceStatement::pools.size(); i++)
64290 : {
64291 : // objectArray[i] is a single memory pool
64292 0 : for (unsigned j=0; j < SgInterfaceStatement::pool_size; j++)
64293 : {
64294 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
64295 : {
64296 : // printf ("Found a valid SgInterfaceStatement object in the memory pool %d at position %d \n",i,j);
64297 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
64298 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
64299 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
64300 : }
64301 : else
64302 : {
64303 : // printf ("Found a INVALID SgInterfaceStatement object in the memory pool \n");
64304 : }
64305 : }
64306 : }
64307 : }
64308 :
64309 : // This should not be required since all previously static data members are
64310 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
64311 :
64312 194 : }
64313 :
64314 : void
64315 0 : SgInterfaceStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
64316 : {
64317 : // This function visits only a single IR node of the memory pool.
64318 : // it is typically called once for each type of IR node within
64319 : // the automatically generated function: traverseRepresentativeNodes().
64320 :
64321 : // Initialize array to the address of the first element of the STL vector
64322 : // (which is guarenteed to be contiguous storage).
64323 : // SgInterfaceStatement objectArray [] = *(Memory_Block_List.begin());
64324 0 : if (SgInterfaceStatement::pools.empty() == false)
64325 : {
64326 : // Generate an array of memory pools
64327 0 : SgInterfaceStatement** objectArray = (SgInterfaceStatement**) &(SgInterfaceStatement::pools[0]);
64328 :
64329 : // Build a local variable for better performance
64330 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
64331 :
64332 : // Iterate over the memory pools
64333 0 : bool done = false;
64334 0 : unsigned i=0;
64335 :
64336 : // find the first valid IR node, call visit function, and then leave
64337 0 : while ( done == false && i < SgInterfaceStatement::pools.size() )
64338 : {
64339 : // objectArray[i] is a single memory pool
64340 : unsigned j=0;
64341 0 : while (done == false && j < SgInterfaceStatement::pool_size)
64342 : {
64343 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
64344 : {
64345 0 : traversal.visit(&(objectArray[i][j]));
64346 0 : done = true;
64347 : }
64348 0 : j++;
64349 : }
64350 0 : i++;
64351 : }
64352 :
64353 : #if 0
64354 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
64355 : if (done == false)
64356 : {
64357 : printf ("No representative for SgInterfaceStatement found in memory pools \n");
64358 : }
64359 : #endif
64360 : }
64361 0 : }
64362 :
64363 :
64364 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
64365 : // using values that overflow signed values of int.
64366 : size_t
64367 4 : SgInterfaceStatement::numberOfNodes()
64368 : {
64369 : // This function traverses the memory pool for an IR node and
64370 : // counts the number of IR nodes of a particular Sage III IR
64371 : // nodes type.
64372 :
64373 4 : size_t count = 0;
64374 4 : if (SgInterfaceStatement::pools.empty() == false)
64375 : {
64376 : // Generate an array of memory pools (this is actually a STL vector,
64377 : // but it is contiguious, so OK to treat this way).
64378 0 : SgInterfaceStatement** objectArray = (SgInterfaceStatement**) &(SgInterfaceStatement::pools[0]);
64379 :
64380 : // Build a local variable for better performance (make it a loop invariant variable).
64381 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
64382 :
64383 : // Iterate over all of the memory pools for this IR node.
64384 0 : for (unsigned int i=0; i < SgInterfaceStatement::pools.size(); i++)
64385 : {
64386 : // objectArray[i] is a single memory pool, iterate over all the
64387 : // IR nodes and only count those that are valid IR nodes used in
64388 : // the AST (i.e. allocated IR nodes).
64389 0 : for (unsigned j=0; j < SgInterfaceStatement::pool_size; j++)
64390 : {
64391 : // This is indexing the STL vector of C/C++ style arrays as a doubly
64392 : // indexed array access. It is OK since we have leveraged the semantics
64393 : // of STL vector memory as contigous and cast the memory as an array
64394 : // of arrays to use the 2D array indexing. Hope this is not confusing,
64395 : // but it s very fast as an implementation.
64396 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
64397 : {
64398 0 : count++;
64399 : }
64400 : }
64401 : }
64402 : }
64403 :
64404 :
64405 :
64406 4 : return count;
64407 : }
64408 :
64409 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
64410 : // using values that overflow signed values of int.
64411 : size_t
64412 0 : SgInterfaceStatement::memoryUsage()
64413 : {
64414 : // This function is required because we need the class name as a type when we call sizeof
64415 : // There might be another way to implement this if we have a traversal that only called a
64416 : // representative object (one call for each type of Sage IIIIR node).
64417 0 : size_t memory = numberOfNodes() * sizeof(SgInterfaceStatement);
64418 :
64419 0 : return memory;
64420 : }
64421 :
64422 : /* #line 64423 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
64423 :
64424 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
64425 : void
64426 5342 : SgNamespaceAliasDeclarationStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
64427 : {
64428 : // This function traverses the memory pool for only a specific IR node
64429 : // and calls the visit function of the input class execute a traversal
64430 : // similar to the style of the attribute based traversals within ROSE.
64431 : // This traversal will visit ALL nodes of the AST where as the other
64432 : // attribute based traversals visit only the embedded tree within the AST.
64433 :
64434 : // Initialize array to the address of the first element of the STL vector
64435 : // (which is guaranteed to be contiguous storage).
64436 : // SgNamespaceAliasDeclarationStatement objectArray [] = *(Memory_Block_List.begin());
64437 5342 : if (SgNamespaceAliasDeclarationStatement::pools.empty() == false)
64438 : {
64439 : // Generate an array of memory pools
64440 0 : SgNamespaceAliasDeclarationStatement** objectArray = (SgNamespaceAliasDeclarationStatement**) &(SgNamespaceAliasDeclarationStatement::pools[0]);
64441 :
64442 : // Build a local variable for better performance
64443 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
64444 : #if 0
64445 : // Iterate over the memory pools
64446 : for (unsigned int i=0; i < SgNamespaceAliasDeclarationStatement::pools.size(); i++)
64447 : {
64448 : // objectArray[i] is a single memory pool
64449 : for (int j=0; j < SgNamespaceAliasDeclarationStatement::pool_size; j++)
64450 : {
64451 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
64452 : {
64453 : traversal.visit(&(objectArray[i][j]));
64454 : }
64455 : }
64456 : }
64457 : #else
64458 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
64459 : // compute the list first and then call the visit function on each list element.
64460 :
64461 : // printf ("Inside of SgNamespaceAliasDeclarationStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
64462 :
64463 0 : std::vector<SgNamespaceAliasDeclarationStatement*> nodeList;
64464 :
64465 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
64466 0 : for (unsigned int i=0; i < SgNamespaceAliasDeclarationStatement::pools.size(); i++)
64467 : {
64468 : // objectArray[i] is a single memory pool
64469 0 : for (unsigned j=0; j < SgNamespaceAliasDeclarationStatement::pool_size; j++)
64470 : {
64471 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
64472 : {
64473 0 : nodeList.push_back(&(objectArray[i][j]));
64474 : }
64475 : }
64476 : }
64477 :
64478 : // Iterate over the saved list
64479 0 : size_t nodeListSize = nodeList.size();
64480 0 : for (size_t i=0; i < nodeListSize; i++)
64481 : {
64482 0 : ROSE_ASSERT(nodeList[i] != NULL);
64483 : #if 0
64484 : traversal.visit(nodeList[i]);
64485 : #else
64486 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
64487 : {
64488 0 : traversal.visit(nodeList[i]);
64489 : }
64490 : #endif
64491 : }
64492 : #endif
64493 : }
64494 :
64495 : // This should not be required since all previously static data members are
64496 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
64497 :
64498 5342 : }
64499 :
64500 :
64501 : void
64502 194 : SgNamespaceAliasDeclarationStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
64503 : {
64504 : // This function traverses the memory pool for an IR node and
64505 : // calls the function to execute the visitor object.
64506 :
64507 : // Initialize array to the address of the first element of the STL vector
64508 : // (which is guarenteed to be contiguous storage).
64509 : // SgNamespaceAliasDeclarationStatement objectArray [] = *(Memory_Block_List.begin());
64510 194 : if (SgNamespaceAliasDeclarationStatement::pools.empty() == false)
64511 : {
64512 : // Generate an array of memory pools
64513 0 : SgNamespaceAliasDeclarationStatement** objectArray = (SgNamespaceAliasDeclarationStatement**) &(SgNamespaceAliasDeclarationStatement::pools[0]);
64514 :
64515 : // Build a local variable for better performance
64516 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
64517 :
64518 : // Iterate over the memory pools
64519 0 : for (unsigned int i=0; i < SgNamespaceAliasDeclarationStatement::pools.size(); i++)
64520 : {
64521 : // objectArray[i] is a single memory pool
64522 0 : for (unsigned j=0; j < SgNamespaceAliasDeclarationStatement::pool_size; j++)
64523 : {
64524 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
64525 : {
64526 : // printf ("Found a valid SgNamespaceAliasDeclarationStatement object in the memory pool %d at position %d \n",i,j);
64527 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
64528 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
64529 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
64530 : }
64531 : else
64532 : {
64533 : // printf ("Found a INVALID SgNamespaceAliasDeclarationStatement object in the memory pool \n");
64534 : }
64535 : }
64536 : }
64537 : }
64538 :
64539 : // This should not be required since all previously static data members are
64540 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
64541 :
64542 194 : }
64543 :
64544 : void
64545 0 : SgNamespaceAliasDeclarationStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
64546 : {
64547 : // This function visits only a single IR node of the memory pool.
64548 : // it is typically called once for each type of IR node within
64549 : // the automatically generated function: traverseRepresentativeNodes().
64550 :
64551 : // Initialize array to the address of the first element of the STL vector
64552 : // (which is guarenteed to be contiguous storage).
64553 : // SgNamespaceAliasDeclarationStatement objectArray [] = *(Memory_Block_List.begin());
64554 0 : if (SgNamespaceAliasDeclarationStatement::pools.empty() == false)
64555 : {
64556 : // Generate an array of memory pools
64557 0 : SgNamespaceAliasDeclarationStatement** objectArray = (SgNamespaceAliasDeclarationStatement**) &(SgNamespaceAliasDeclarationStatement::pools[0]);
64558 :
64559 : // Build a local variable for better performance
64560 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
64561 :
64562 : // Iterate over the memory pools
64563 0 : bool done = false;
64564 0 : unsigned i=0;
64565 :
64566 : // find the first valid IR node, call visit function, and then leave
64567 0 : while ( done == false && i < SgNamespaceAliasDeclarationStatement::pools.size() )
64568 : {
64569 : // objectArray[i] is a single memory pool
64570 : unsigned j=0;
64571 0 : while (done == false && j < SgNamespaceAliasDeclarationStatement::pool_size)
64572 : {
64573 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
64574 : {
64575 0 : traversal.visit(&(objectArray[i][j]));
64576 0 : done = true;
64577 : }
64578 0 : j++;
64579 : }
64580 0 : i++;
64581 : }
64582 :
64583 : #if 0
64584 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
64585 : if (done == false)
64586 : {
64587 : printf ("No representative for SgNamespaceAliasDeclarationStatement found in memory pools \n");
64588 : }
64589 : #endif
64590 : }
64591 0 : }
64592 :
64593 :
64594 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
64595 : // using values that overflow signed values of int.
64596 : size_t
64597 4 : SgNamespaceAliasDeclarationStatement::numberOfNodes()
64598 : {
64599 : // This function traverses the memory pool for an IR node and
64600 : // counts the number of IR nodes of a particular Sage III IR
64601 : // nodes type.
64602 :
64603 4 : size_t count = 0;
64604 4 : if (SgNamespaceAliasDeclarationStatement::pools.empty() == false)
64605 : {
64606 : // Generate an array of memory pools (this is actually a STL vector,
64607 : // but it is contiguious, so OK to treat this way).
64608 0 : SgNamespaceAliasDeclarationStatement** objectArray = (SgNamespaceAliasDeclarationStatement**) &(SgNamespaceAliasDeclarationStatement::pools[0]);
64609 :
64610 : // Build a local variable for better performance (make it a loop invariant variable).
64611 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
64612 :
64613 : // Iterate over all of the memory pools for this IR node.
64614 0 : for (unsigned int i=0; i < SgNamespaceAliasDeclarationStatement::pools.size(); i++)
64615 : {
64616 : // objectArray[i] is a single memory pool, iterate over all the
64617 : // IR nodes and only count those that are valid IR nodes used in
64618 : // the AST (i.e. allocated IR nodes).
64619 0 : for (unsigned j=0; j < SgNamespaceAliasDeclarationStatement::pool_size; j++)
64620 : {
64621 : // This is indexing the STL vector of C/C++ style arrays as a doubly
64622 : // indexed array access. It is OK since we have leveraged the semantics
64623 : // of STL vector memory as contigous and cast the memory as an array
64624 : // of arrays to use the 2D array indexing. Hope this is not confusing,
64625 : // but it s very fast as an implementation.
64626 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
64627 : {
64628 0 : count++;
64629 : }
64630 : }
64631 : }
64632 : }
64633 :
64634 :
64635 :
64636 4 : return count;
64637 : }
64638 :
64639 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
64640 : // using values that overflow signed values of int.
64641 : size_t
64642 0 : SgNamespaceAliasDeclarationStatement::memoryUsage()
64643 : {
64644 : // This function is required because we need the class name as a type when we call sizeof
64645 : // There might be another way to implement this if we have a traversal that only called a
64646 : // representative object (one call for each type of Sage IIIIR node).
64647 0 : size_t memory = numberOfNodes() * sizeof(SgNamespaceAliasDeclarationStatement);
64648 :
64649 0 : return memory;
64650 : }
64651 :
64652 : /* #line 64653 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
64653 :
64654 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
64655 : void
64656 5343 : SgCommonBlock::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
64657 : {
64658 : // This function traverses the memory pool for only a specific IR node
64659 : // and calls the visit function of the input class execute a traversal
64660 : // similar to the style of the attribute based traversals within ROSE.
64661 : // This traversal will visit ALL nodes of the AST where as the other
64662 : // attribute based traversals visit only the embedded tree within the AST.
64663 :
64664 : // Initialize array to the address of the first element of the STL vector
64665 : // (which is guaranteed to be contiguous storage).
64666 : // SgCommonBlock objectArray [] = *(Memory_Block_List.begin());
64667 5343 : if (SgCommonBlock::pools.empty() == false)
64668 : {
64669 : // Generate an array of memory pools
64670 48 : SgCommonBlock** objectArray = (SgCommonBlock**) &(SgCommonBlock::pools[0]);
64671 :
64672 : // Build a local variable for better performance
64673 48 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
64674 : #if 0
64675 : // Iterate over the memory pools
64676 : for (unsigned int i=0; i < SgCommonBlock::pools.size(); i++)
64677 : {
64678 : // objectArray[i] is a single memory pool
64679 : for (int j=0; j < SgCommonBlock::pool_size; j++)
64680 : {
64681 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
64682 : {
64683 : traversal.visit(&(objectArray[i][j]));
64684 : }
64685 : }
64686 : }
64687 : #else
64688 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
64689 : // compute the list first and then call the visit function on each list element.
64690 :
64691 : // printf ("Inside of SgCommonBlock::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
64692 :
64693 96 : std::vector<SgCommonBlock*> nodeList;
64694 :
64695 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
64696 96 : for (unsigned int i=0; i < SgCommonBlock::pools.size(); i++)
64697 : {
64698 : // objectArray[i] is a single memory pool
64699 96048 : for (unsigned j=0; j < SgCommonBlock::pool_size; j++)
64700 : {
64701 96000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
64702 : {
64703 108 : nodeList.push_back(&(objectArray[i][j]));
64704 : }
64705 : }
64706 : }
64707 :
64708 : // Iterate over the saved list
64709 48 : size_t nodeListSize = nodeList.size();
64710 156 : for (size_t i=0; i < nodeListSize; i++)
64711 : {
64712 108 : ROSE_ASSERT(nodeList[i] != NULL);
64713 : #if 0
64714 : traversal.visit(nodeList[i]);
64715 : #else
64716 108 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
64717 : {
64718 108 : traversal.visit(nodeList[i]);
64719 : }
64720 : #endif
64721 : }
64722 : #endif
64723 : }
64724 :
64725 : // This should not be required since all previously static data members are
64726 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
64727 :
64728 5343 : }
64729 :
64730 :
64731 : void
64732 194 : SgCommonBlock::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
64733 : {
64734 : // This function traverses the memory pool for an IR node and
64735 : // calls the function to execute the visitor object.
64736 :
64737 : // Initialize array to the address of the first element of the STL vector
64738 : // (which is guarenteed to be contiguous storage).
64739 : // SgCommonBlock objectArray [] = *(Memory_Block_List.begin());
64740 194 : if (SgCommonBlock::pools.empty() == false)
64741 : {
64742 : // Generate an array of memory pools
64743 0 : SgCommonBlock** objectArray = (SgCommonBlock**) &(SgCommonBlock::pools[0]);
64744 :
64745 : // Build a local variable for better performance
64746 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
64747 :
64748 : // Iterate over the memory pools
64749 0 : for (unsigned int i=0; i < SgCommonBlock::pools.size(); i++)
64750 : {
64751 : // objectArray[i] is a single memory pool
64752 0 : for (unsigned j=0; j < SgCommonBlock::pool_size; j++)
64753 : {
64754 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
64755 : {
64756 : // printf ("Found a valid SgCommonBlock object in the memory pool %d at position %d \n",i,j);
64757 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
64758 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
64759 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
64760 : }
64761 : else
64762 : {
64763 : // printf ("Found a INVALID SgCommonBlock object in the memory pool \n");
64764 : }
64765 : }
64766 : }
64767 : }
64768 :
64769 : // This should not be required since all previously static data members are
64770 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
64771 :
64772 194 : }
64773 :
64774 : void
64775 0 : SgCommonBlock::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
64776 : {
64777 : // This function visits only a single IR node of the memory pool.
64778 : // it is typically called once for each type of IR node within
64779 : // the automatically generated function: traverseRepresentativeNodes().
64780 :
64781 : // Initialize array to the address of the first element of the STL vector
64782 : // (which is guarenteed to be contiguous storage).
64783 : // SgCommonBlock objectArray [] = *(Memory_Block_List.begin());
64784 0 : if (SgCommonBlock::pools.empty() == false)
64785 : {
64786 : // Generate an array of memory pools
64787 0 : SgCommonBlock** objectArray = (SgCommonBlock**) &(SgCommonBlock::pools[0]);
64788 :
64789 : // Build a local variable for better performance
64790 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
64791 :
64792 : // Iterate over the memory pools
64793 0 : bool done = false;
64794 0 : unsigned i=0;
64795 :
64796 : // find the first valid IR node, call visit function, and then leave
64797 0 : while ( done == false && i < SgCommonBlock::pools.size() )
64798 : {
64799 : // objectArray[i] is a single memory pool
64800 : unsigned j=0;
64801 0 : while (done == false && j < SgCommonBlock::pool_size)
64802 : {
64803 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
64804 : {
64805 0 : traversal.visit(&(objectArray[i][j]));
64806 0 : done = true;
64807 : }
64808 0 : j++;
64809 : }
64810 0 : i++;
64811 : }
64812 :
64813 : #if 0
64814 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
64815 : if (done == false)
64816 : {
64817 : printf ("No representative for SgCommonBlock found in memory pools \n");
64818 : }
64819 : #endif
64820 : }
64821 0 : }
64822 :
64823 :
64824 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
64825 : // using values that overflow signed values of int.
64826 : size_t
64827 4 : SgCommonBlock::numberOfNodes()
64828 : {
64829 : // This function traverses the memory pool for an IR node and
64830 : // counts the number of IR nodes of a particular Sage III IR
64831 : // nodes type.
64832 :
64833 4 : size_t count = 0;
64834 4 : if (SgCommonBlock::pools.empty() == false)
64835 : {
64836 : // Generate an array of memory pools (this is actually a STL vector,
64837 : // but it is contiguious, so OK to treat this way).
64838 0 : SgCommonBlock** objectArray = (SgCommonBlock**) &(SgCommonBlock::pools[0]);
64839 :
64840 : // Build a local variable for better performance (make it a loop invariant variable).
64841 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
64842 :
64843 : // Iterate over all of the memory pools for this IR node.
64844 0 : for (unsigned int i=0; i < SgCommonBlock::pools.size(); i++)
64845 : {
64846 : // objectArray[i] is a single memory pool, iterate over all the
64847 : // IR nodes and only count those that are valid IR nodes used in
64848 : // the AST (i.e. allocated IR nodes).
64849 0 : for (unsigned j=0; j < SgCommonBlock::pool_size; j++)
64850 : {
64851 : // This is indexing the STL vector of C/C++ style arrays as a doubly
64852 : // indexed array access. It is OK since we have leveraged the semantics
64853 : // of STL vector memory as contigous and cast the memory as an array
64854 : // of arrays to use the 2D array indexing. Hope this is not confusing,
64855 : // but it s very fast as an implementation.
64856 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
64857 : {
64858 0 : count++;
64859 : }
64860 : }
64861 : }
64862 : }
64863 :
64864 :
64865 :
64866 4 : return count;
64867 : }
64868 :
64869 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
64870 : // using values that overflow signed values of int.
64871 : size_t
64872 0 : SgCommonBlock::memoryUsage()
64873 : {
64874 : // This function is required because we need the class name as a type when we call sizeof
64875 : // There might be another way to implement this if we have a traversal that only called a
64876 : // representative object (one call for each type of Sage IIIIR node).
64877 0 : size_t memory = numberOfNodes() * sizeof(SgCommonBlock);
64878 :
64879 0 : return memory;
64880 : }
64881 :
64882 : /* #line 64883 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
64883 :
64884 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
64885 : void
64886 5342 : SgTypedefDeclaration::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
64887 : {
64888 : // This function traverses the memory pool for only a specific IR node
64889 : // and calls the visit function of the input class execute a traversal
64890 : // similar to the style of the attribute based traversals within ROSE.
64891 : // This traversal will visit ALL nodes of the AST where as the other
64892 : // attribute based traversals visit only the embedded tree within the AST.
64893 :
64894 : // Initialize array to the address of the first element of the STL vector
64895 : // (which is guaranteed to be contiguous storage).
64896 : // SgTypedefDeclaration objectArray [] = *(Memory_Block_List.begin());
64897 5342 : if (SgTypedefDeclaration::pools.empty() == false)
64898 : {
64899 : // Generate an array of memory pools
64900 4602 : SgTypedefDeclaration** objectArray = (SgTypedefDeclaration**) &(SgTypedefDeclaration::pools[0]);
64901 :
64902 : // Build a local variable for better performance
64903 4602 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
64904 : #if 0
64905 : // Iterate over the memory pools
64906 : for (unsigned int i=0; i < SgTypedefDeclaration::pools.size(); i++)
64907 : {
64908 : // objectArray[i] is a single memory pool
64909 : for (int j=0; j < SgTypedefDeclaration::pool_size; j++)
64910 : {
64911 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
64912 : {
64913 : traversal.visit(&(objectArray[i][j]));
64914 : }
64915 : }
64916 : }
64917 : #else
64918 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
64919 : // compute the list first and then call the visit function on each list element.
64920 :
64921 : // printf ("Inside of SgTypedefDeclaration::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
64922 :
64923 9204 : std::vector<SgTypedefDeclaration*> nodeList;
64924 :
64925 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
64926 9204 : for (unsigned int i=0; i < SgTypedefDeclaration::pools.size(); i++)
64927 : {
64928 : // objectArray[i] is a single memory pool
64929 9208600 : for (unsigned j=0; j < SgTypedefDeclaration::pool_size; j++)
64930 : {
64931 9204000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
64932 : {
64933 808545 : nodeList.push_back(&(objectArray[i][j]));
64934 : }
64935 : }
64936 : }
64937 :
64938 : // Iterate over the saved list
64939 4602 : size_t nodeListSize = nodeList.size();
64940 813147 : for (size_t i=0; i < nodeListSize; i++)
64941 : {
64942 808545 : ROSE_ASSERT(nodeList[i] != NULL);
64943 : #if 0
64944 : traversal.visit(nodeList[i]);
64945 : #else
64946 808545 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
64947 : {
64948 808545 : traversal.visit(nodeList[i]);
64949 : }
64950 : #endif
64951 : }
64952 : #endif
64953 : }
64954 :
64955 : // This should not be required since all previously static data members are
64956 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
64957 :
64958 5342 : }
64959 :
64960 :
64961 : void
64962 194 : SgTypedefDeclaration::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
64963 : {
64964 : // This function traverses the memory pool for an IR node and
64965 : // calls the function to execute the visitor object.
64966 :
64967 : // Initialize array to the address of the first element of the STL vector
64968 : // (which is guarenteed to be contiguous storage).
64969 : // SgTypedefDeclaration objectArray [] = *(Memory_Block_List.begin());
64970 194 : if (SgTypedefDeclaration::pools.empty() == false)
64971 : {
64972 : // Generate an array of memory pools
64973 194 : SgTypedefDeclaration** objectArray = (SgTypedefDeclaration**) &(SgTypedefDeclaration::pools[0]);
64974 :
64975 : // Build a local variable for better performance
64976 194 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
64977 :
64978 : // Iterate over the memory pools
64979 388 : for (unsigned int i=0; i < SgTypedefDeclaration::pools.size(); i++)
64980 : {
64981 : // objectArray[i] is a single memory pool
64982 388194 : for (unsigned j=0; j < SgTypedefDeclaration::pool_size; j++)
64983 : {
64984 388000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
64985 : {
64986 : // printf ("Found a valid SgTypedefDeclaration object in the memory pool %d at position %d \n",i,j);
64987 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
64988 223774 : objectArray[i][j].executeVisitorMemberFunction(visitor);
64989 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
64990 : }
64991 : else
64992 : {
64993 : // printf ("Found a INVALID SgTypedefDeclaration object in the memory pool \n");
64994 : }
64995 : }
64996 : }
64997 : }
64998 :
64999 : // This should not be required since all previously static data members are
65000 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
65001 :
65002 194 : }
65003 :
65004 : void
65005 0 : SgTypedefDeclaration::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
65006 : {
65007 : // This function visits only a single IR node of the memory pool.
65008 : // it is typically called once for each type of IR node within
65009 : // the automatically generated function: traverseRepresentativeNodes().
65010 :
65011 : // Initialize array to the address of the first element of the STL vector
65012 : // (which is guarenteed to be contiguous storage).
65013 : // SgTypedefDeclaration objectArray [] = *(Memory_Block_List.begin());
65014 0 : if (SgTypedefDeclaration::pools.empty() == false)
65015 : {
65016 : // Generate an array of memory pools
65017 0 : SgTypedefDeclaration** objectArray = (SgTypedefDeclaration**) &(SgTypedefDeclaration::pools[0]);
65018 :
65019 : // Build a local variable for better performance
65020 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
65021 :
65022 : // Iterate over the memory pools
65023 0 : bool done = false;
65024 0 : unsigned i=0;
65025 :
65026 : // find the first valid IR node, call visit function, and then leave
65027 0 : while ( done == false && i < SgTypedefDeclaration::pools.size() )
65028 : {
65029 : // objectArray[i] is a single memory pool
65030 : unsigned j=0;
65031 0 : while (done == false && j < SgTypedefDeclaration::pool_size)
65032 : {
65033 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
65034 : {
65035 0 : traversal.visit(&(objectArray[i][j]));
65036 0 : done = true;
65037 : }
65038 0 : j++;
65039 : }
65040 0 : i++;
65041 : }
65042 :
65043 : #if 0
65044 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
65045 : if (done == false)
65046 : {
65047 : printf ("No representative for SgTypedefDeclaration found in memory pools \n");
65048 : }
65049 : #endif
65050 : }
65051 0 : }
65052 :
65053 :
65054 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
65055 : // using values that overflow signed values of int.
65056 : size_t
65057 4 : SgTypedefDeclaration::numberOfNodes()
65058 : {
65059 : // This function traverses the memory pool for an IR node and
65060 : // counts the number of IR nodes of a particular Sage III IR
65061 : // nodes type.
65062 :
65063 4 : size_t count = 0;
65064 4 : if (SgTypedefDeclaration::pools.empty() == false)
65065 : {
65066 : // Generate an array of memory pools (this is actually a STL vector,
65067 : // but it is contiguious, so OK to treat this way).
65068 2 : SgTypedefDeclaration** objectArray = (SgTypedefDeclaration**) &(SgTypedefDeclaration::pools[0]);
65069 :
65070 : // Build a local variable for better performance (make it a loop invariant variable).
65071 2 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
65072 :
65073 : // Iterate over all of the memory pools for this IR node.
65074 4 : for (unsigned int i=0; i < SgTypedefDeclaration::pools.size(); i++)
65075 : {
65076 : // objectArray[i] is a single memory pool, iterate over all the
65077 : // IR nodes and only count those that are valid IR nodes used in
65078 : // the AST (i.e. allocated IR nodes).
65079 4002 : for (unsigned j=0; j < SgTypedefDeclaration::pool_size; j++)
65080 : {
65081 : // This is indexing the STL vector of C/C++ style arrays as a doubly
65082 : // indexed array access. It is OK since we have leveraged the semantics
65083 : // of STL vector memory as contigous and cast the memory as an array
65084 : // of arrays to use the 2D array indexing. Hope this is not confusing,
65085 : // but it s very fast as an implementation.
65086 4000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
65087 : {
65088 1719 : count++;
65089 : }
65090 : }
65091 : }
65092 : }
65093 :
65094 :
65095 :
65096 4 : return count;
65097 : }
65098 :
65099 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
65100 : // using values that overflow signed values of int.
65101 : size_t
65102 0 : SgTypedefDeclaration::memoryUsage()
65103 : {
65104 : // This function is required because we need the class name as a type when we call sizeof
65105 : // There might be another way to implement this if we have a traversal that only called a
65106 : // representative object (one call for each type of Sage IIIIR node).
65107 0 : size_t memory = numberOfNodes() * sizeof(SgTypedefDeclaration);
65108 :
65109 0 : return memory;
65110 : }
65111 :
65112 : /* #line 65113 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
65113 :
65114 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
65115 : void
65116 5342 : SgTemplateTypedefDeclaration::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
65117 : {
65118 : // This function traverses the memory pool for only a specific IR node
65119 : // and calls the visit function of the input class execute a traversal
65120 : // similar to the style of the attribute based traversals within ROSE.
65121 : // This traversal will visit ALL nodes of the AST where as the other
65122 : // attribute based traversals visit only the embedded tree within the AST.
65123 :
65124 : // Initialize array to the address of the first element of the STL vector
65125 : // (which is guaranteed to be contiguous storage).
65126 : // SgTemplateTypedefDeclaration objectArray [] = *(Memory_Block_List.begin());
65127 5342 : if (SgTemplateTypedefDeclaration::pools.empty() == false)
65128 : {
65129 : // Generate an array of memory pools
65130 138 : SgTemplateTypedefDeclaration** objectArray = (SgTemplateTypedefDeclaration**) &(SgTemplateTypedefDeclaration::pools[0]);
65131 :
65132 : // Build a local variable for better performance
65133 138 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
65134 : #if 0
65135 : // Iterate over the memory pools
65136 : for (unsigned int i=0; i < SgTemplateTypedefDeclaration::pools.size(); i++)
65137 : {
65138 : // objectArray[i] is a single memory pool
65139 : for (int j=0; j < SgTemplateTypedefDeclaration::pool_size; j++)
65140 : {
65141 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
65142 : {
65143 : traversal.visit(&(objectArray[i][j]));
65144 : }
65145 : }
65146 : }
65147 : #else
65148 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
65149 : // compute the list first and then call the visit function on each list element.
65150 :
65151 : // printf ("Inside of SgTemplateTypedefDeclaration::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
65152 :
65153 276 : std::vector<SgTemplateTypedefDeclaration*> nodeList;
65154 :
65155 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
65156 276 : for (unsigned int i=0; i < SgTemplateTypedefDeclaration::pools.size(); i++)
65157 : {
65158 : // objectArray[i] is a single memory pool
65159 276138 : for (unsigned j=0; j < SgTemplateTypedefDeclaration::pool_size; j++)
65160 : {
65161 276000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
65162 : {
65163 12443 : nodeList.push_back(&(objectArray[i][j]));
65164 : }
65165 : }
65166 : }
65167 :
65168 : // Iterate over the saved list
65169 138 : size_t nodeListSize = nodeList.size();
65170 12581 : for (size_t i=0; i < nodeListSize; i++)
65171 : {
65172 12443 : ROSE_ASSERT(nodeList[i] != NULL);
65173 : #if 0
65174 : traversal.visit(nodeList[i]);
65175 : #else
65176 12443 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
65177 : {
65178 12443 : traversal.visit(nodeList[i]);
65179 : }
65180 : #endif
65181 : }
65182 : #endif
65183 : }
65184 :
65185 : // This should not be required since all previously static data members are
65186 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
65187 :
65188 5342 : }
65189 :
65190 :
65191 : void
65192 194 : SgTemplateTypedefDeclaration::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
65193 : {
65194 : // This function traverses the memory pool for an IR node and
65195 : // calls the function to execute the visitor object.
65196 :
65197 : // Initialize array to the address of the first element of the STL vector
65198 : // (which is guarenteed to be contiguous storage).
65199 : // SgTemplateTypedefDeclaration objectArray [] = *(Memory_Block_List.begin());
65200 194 : if (SgTemplateTypedefDeclaration::pools.empty() == false)
65201 : {
65202 : // Generate an array of memory pools
65203 137 : SgTemplateTypedefDeclaration** objectArray = (SgTemplateTypedefDeclaration**) &(SgTemplateTypedefDeclaration::pools[0]);
65204 :
65205 : // Build a local variable for better performance
65206 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
65207 :
65208 : // Iterate over the memory pools
65209 274 : for (unsigned int i=0; i < SgTemplateTypedefDeclaration::pools.size(); i++)
65210 : {
65211 : // objectArray[i] is a single memory pool
65212 274137 : for (unsigned j=0; j < SgTemplateTypedefDeclaration::pool_size; j++)
65213 : {
65214 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
65215 : {
65216 : // printf ("Found a valid SgTemplateTypedefDeclaration object in the memory pool %d at position %d \n",i,j);
65217 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
65218 13015 : objectArray[i][j].executeVisitorMemberFunction(visitor);
65219 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
65220 : }
65221 : else
65222 : {
65223 : // printf ("Found a INVALID SgTemplateTypedefDeclaration object in the memory pool \n");
65224 : }
65225 : }
65226 : }
65227 : }
65228 :
65229 : // This should not be required since all previously static data members are
65230 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
65231 :
65232 194 : }
65233 :
65234 : void
65235 0 : SgTemplateTypedefDeclaration::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
65236 : {
65237 : // This function visits only a single IR node of the memory pool.
65238 : // it is typically called once for each type of IR node within
65239 : // the automatically generated function: traverseRepresentativeNodes().
65240 :
65241 : // Initialize array to the address of the first element of the STL vector
65242 : // (which is guarenteed to be contiguous storage).
65243 : // SgTemplateTypedefDeclaration objectArray [] = *(Memory_Block_List.begin());
65244 0 : if (SgTemplateTypedefDeclaration::pools.empty() == false)
65245 : {
65246 : // Generate an array of memory pools
65247 0 : SgTemplateTypedefDeclaration** objectArray = (SgTemplateTypedefDeclaration**) &(SgTemplateTypedefDeclaration::pools[0]);
65248 :
65249 : // Build a local variable for better performance
65250 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
65251 :
65252 : // Iterate over the memory pools
65253 0 : bool done = false;
65254 0 : unsigned i=0;
65255 :
65256 : // find the first valid IR node, call visit function, and then leave
65257 0 : while ( done == false && i < SgTemplateTypedefDeclaration::pools.size() )
65258 : {
65259 : // objectArray[i] is a single memory pool
65260 : unsigned j=0;
65261 0 : while (done == false && j < SgTemplateTypedefDeclaration::pool_size)
65262 : {
65263 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
65264 : {
65265 0 : traversal.visit(&(objectArray[i][j]));
65266 0 : done = true;
65267 : }
65268 0 : j++;
65269 : }
65270 0 : i++;
65271 : }
65272 :
65273 : #if 0
65274 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
65275 : if (done == false)
65276 : {
65277 : printf ("No representative for SgTemplateTypedefDeclaration found in memory pools \n");
65278 : }
65279 : #endif
65280 : }
65281 0 : }
65282 :
65283 :
65284 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
65285 : // using values that overflow signed values of int.
65286 : size_t
65287 4 : SgTemplateTypedefDeclaration::numberOfNodes()
65288 : {
65289 : // This function traverses the memory pool for an IR node and
65290 : // counts the number of IR nodes of a particular Sage III IR
65291 : // nodes type.
65292 :
65293 4 : size_t count = 0;
65294 4 : if (SgTemplateTypedefDeclaration::pools.empty() == false)
65295 : {
65296 : // Generate an array of memory pools (this is actually a STL vector,
65297 : // but it is contiguious, so OK to treat this way).
65298 1 : SgTemplateTypedefDeclaration** objectArray = (SgTemplateTypedefDeclaration**) &(SgTemplateTypedefDeclaration::pools[0]);
65299 :
65300 : // Build a local variable for better performance (make it a loop invariant variable).
65301 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
65302 :
65303 : // Iterate over all of the memory pools for this IR node.
65304 2 : for (unsigned int i=0; i < SgTemplateTypedefDeclaration::pools.size(); i++)
65305 : {
65306 : // objectArray[i] is a single memory pool, iterate over all the
65307 : // IR nodes and only count those that are valid IR nodes used in
65308 : // the AST (i.e. allocated IR nodes).
65309 2001 : for (unsigned j=0; j < SgTemplateTypedefDeclaration::pool_size; j++)
65310 : {
65311 : // This is indexing the STL vector of C/C++ style arrays as a doubly
65312 : // indexed array access. It is OK since we have leveraged the semantics
65313 : // of STL vector memory as contigous and cast the memory as an array
65314 : // of arrays to use the 2D array indexing. Hope this is not confusing,
65315 : // but it s very fast as an implementation.
65316 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
65317 : {
65318 95 : count++;
65319 : }
65320 : }
65321 : }
65322 : }
65323 :
65324 :
65325 :
65326 4 : return count;
65327 : }
65328 :
65329 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
65330 : // using values that overflow signed values of int.
65331 : size_t
65332 0 : SgTemplateTypedefDeclaration::memoryUsage()
65333 : {
65334 : // This function is required because we need the class name as a type when we call sizeof
65335 : // There might be another way to implement this if we have a traversal that only called a
65336 : // representative object (one call for each type of Sage IIIIR node).
65337 0 : size_t memory = numberOfNodes() * sizeof(SgTemplateTypedefDeclaration);
65338 :
65339 0 : return memory;
65340 : }
65341 :
65342 : /* #line 65343 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
65343 :
65344 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
65345 : void
65346 5342 : SgTemplateInstantiationTypedefDeclaration::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
65347 : {
65348 : // This function traverses the memory pool for only a specific IR node
65349 : // and calls the visit function of the input class execute a traversal
65350 : // similar to the style of the attribute based traversals within ROSE.
65351 : // This traversal will visit ALL nodes of the AST where as the other
65352 : // attribute based traversals visit only the embedded tree within the AST.
65353 :
65354 : // Initialize array to the address of the first element of the STL vector
65355 : // (which is guaranteed to be contiguous storage).
65356 : // SgTemplateInstantiationTypedefDeclaration objectArray [] = *(Memory_Block_List.begin());
65357 5342 : if (SgTemplateInstantiationTypedefDeclaration::pools.empty() == false)
65358 : {
65359 : // Generate an array of memory pools
65360 138 : SgTemplateInstantiationTypedefDeclaration** objectArray = (SgTemplateInstantiationTypedefDeclaration**) &(SgTemplateInstantiationTypedefDeclaration::pools[0]);
65361 :
65362 : // Build a local variable for better performance
65363 138 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
65364 : #if 0
65365 : // Iterate over the memory pools
65366 : for (unsigned int i=0; i < SgTemplateInstantiationTypedefDeclaration::pools.size(); i++)
65367 : {
65368 : // objectArray[i] is a single memory pool
65369 : for (int j=0; j < SgTemplateInstantiationTypedefDeclaration::pool_size; j++)
65370 : {
65371 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
65372 : {
65373 : traversal.visit(&(objectArray[i][j]));
65374 : }
65375 : }
65376 : }
65377 : #else
65378 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
65379 : // compute the list first and then call the visit function on each list element.
65380 :
65381 : // printf ("Inside of SgTemplateInstantiationTypedefDeclaration::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
65382 :
65383 276 : std::vector<SgTemplateInstantiationTypedefDeclaration*> nodeList;
65384 :
65385 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
65386 276 : for (unsigned int i=0; i < SgTemplateInstantiationTypedefDeclaration::pools.size(); i++)
65387 : {
65388 : // objectArray[i] is a single memory pool
65389 276138 : for (unsigned j=0; j < SgTemplateInstantiationTypedefDeclaration::pool_size; j++)
65390 : {
65391 276000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
65392 : {
65393 8407 : nodeList.push_back(&(objectArray[i][j]));
65394 : }
65395 : }
65396 : }
65397 :
65398 : // Iterate over the saved list
65399 138 : size_t nodeListSize = nodeList.size();
65400 8545 : for (size_t i=0; i < nodeListSize; i++)
65401 : {
65402 8407 : ROSE_ASSERT(nodeList[i] != NULL);
65403 : #if 0
65404 : traversal.visit(nodeList[i]);
65405 : #else
65406 8407 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
65407 : {
65408 8407 : traversal.visit(nodeList[i]);
65409 : }
65410 : #endif
65411 : }
65412 : #endif
65413 : }
65414 :
65415 : // This should not be required since all previously static data members are
65416 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
65417 :
65418 5342 : }
65419 :
65420 :
65421 : void
65422 194 : SgTemplateInstantiationTypedefDeclaration::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
65423 : {
65424 : // This function traverses the memory pool for an IR node and
65425 : // calls the function to execute the visitor object.
65426 :
65427 : // Initialize array to the address of the first element of the STL vector
65428 : // (which is guarenteed to be contiguous storage).
65429 : // SgTemplateInstantiationTypedefDeclaration objectArray [] = *(Memory_Block_List.begin());
65430 194 : if (SgTemplateInstantiationTypedefDeclaration::pools.empty() == false)
65431 : {
65432 : // Generate an array of memory pools
65433 137 : SgTemplateInstantiationTypedefDeclaration** objectArray = (SgTemplateInstantiationTypedefDeclaration**) &(SgTemplateInstantiationTypedefDeclaration::pools[0]);
65434 :
65435 : // Build a local variable for better performance
65436 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
65437 :
65438 : // Iterate over the memory pools
65439 274 : for (unsigned int i=0; i < SgTemplateInstantiationTypedefDeclaration::pools.size(); i++)
65440 : {
65441 : // objectArray[i] is a single memory pool
65442 274137 : for (unsigned j=0; j < SgTemplateInstantiationTypedefDeclaration::pool_size; j++)
65443 : {
65444 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
65445 : {
65446 : // printf ("Found a valid SgTemplateInstantiationTypedefDeclaration object in the memory pool %d at position %d \n",i,j);
65447 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
65448 8942 : objectArray[i][j].executeVisitorMemberFunction(visitor);
65449 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
65450 : }
65451 : else
65452 : {
65453 : // printf ("Found a INVALID SgTemplateInstantiationTypedefDeclaration object in the memory pool \n");
65454 : }
65455 : }
65456 : }
65457 : }
65458 :
65459 : // This should not be required since all previously static data members are
65460 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
65461 :
65462 194 : }
65463 :
65464 : void
65465 0 : SgTemplateInstantiationTypedefDeclaration::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
65466 : {
65467 : // This function visits only a single IR node of the memory pool.
65468 : // it is typically called once for each type of IR node within
65469 : // the automatically generated function: traverseRepresentativeNodes().
65470 :
65471 : // Initialize array to the address of the first element of the STL vector
65472 : // (which is guarenteed to be contiguous storage).
65473 : // SgTemplateInstantiationTypedefDeclaration objectArray [] = *(Memory_Block_List.begin());
65474 0 : if (SgTemplateInstantiationTypedefDeclaration::pools.empty() == false)
65475 : {
65476 : // Generate an array of memory pools
65477 0 : SgTemplateInstantiationTypedefDeclaration** objectArray = (SgTemplateInstantiationTypedefDeclaration**) &(SgTemplateInstantiationTypedefDeclaration::pools[0]);
65478 :
65479 : // Build a local variable for better performance
65480 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
65481 :
65482 : // Iterate over the memory pools
65483 0 : bool done = false;
65484 0 : unsigned i=0;
65485 :
65486 : // find the first valid IR node, call visit function, and then leave
65487 0 : while ( done == false && i < SgTemplateInstantiationTypedefDeclaration::pools.size() )
65488 : {
65489 : // objectArray[i] is a single memory pool
65490 : unsigned j=0;
65491 0 : while (done == false && j < SgTemplateInstantiationTypedefDeclaration::pool_size)
65492 : {
65493 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
65494 : {
65495 0 : traversal.visit(&(objectArray[i][j]));
65496 0 : done = true;
65497 : }
65498 0 : j++;
65499 : }
65500 0 : i++;
65501 : }
65502 :
65503 : #if 0
65504 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
65505 : if (done == false)
65506 : {
65507 : printf ("No representative for SgTemplateInstantiationTypedefDeclaration found in memory pools \n");
65508 : }
65509 : #endif
65510 : }
65511 0 : }
65512 :
65513 :
65514 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
65515 : // using values that overflow signed values of int.
65516 : size_t
65517 4 : SgTemplateInstantiationTypedefDeclaration::numberOfNodes()
65518 : {
65519 : // This function traverses the memory pool for an IR node and
65520 : // counts the number of IR nodes of a particular Sage III IR
65521 : // nodes type.
65522 :
65523 4 : size_t count = 0;
65524 4 : if (SgTemplateInstantiationTypedefDeclaration::pools.empty() == false)
65525 : {
65526 : // Generate an array of memory pools (this is actually a STL vector,
65527 : // but it is contiguious, so OK to treat this way).
65528 1 : SgTemplateInstantiationTypedefDeclaration** objectArray = (SgTemplateInstantiationTypedefDeclaration**) &(SgTemplateInstantiationTypedefDeclaration::pools[0]);
65529 :
65530 : // Build a local variable for better performance (make it a loop invariant variable).
65531 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
65532 :
65533 : // Iterate over all of the memory pools for this IR node.
65534 2 : for (unsigned int i=0; i < SgTemplateInstantiationTypedefDeclaration::pools.size(); i++)
65535 : {
65536 : // objectArray[i] is a single memory pool, iterate over all the
65537 : // IR nodes and only count those that are valid IR nodes used in
65538 : // the AST (i.e. allocated IR nodes).
65539 2001 : for (unsigned j=0; j < SgTemplateInstantiationTypedefDeclaration::pool_size; j++)
65540 : {
65541 : // This is indexing the STL vector of C/C++ style arrays as a doubly
65542 : // indexed array access. It is OK since we have leveraged the semantics
65543 : // of STL vector memory as contigous and cast the memory as an array
65544 : // of arrays to use the 2D array indexing. Hope this is not confusing,
65545 : // but it s very fast as an implementation.
65546 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
65547 : {
65548 65 : count++;
65549 : }
65550 : }
65551 : }
65552 : }
65553 :
65554 :
65555 :
65556 4 : return count;
65557 : }
65558 :
65559 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
65560 : // using values that overflow signed values of int.
65561 : size_t
65562 0 : SgTemplateInstantiationTypedefDeclaration::memoryUsage()
65563 : {
65564 : // This function is required because we need the class name as a type when we call sizeof
65565 : // There might be another way to implement this if we have a traversal that only called a
65566 : // representative object (one call for each type of Sage IIIIR node).
65567 0 : size_t memory = numberOfNodes() * sizeof(SgTemplateInstantiationTypedefDeclaration);
65568 :
65569 0 : return memory;
65570 : }
65571 :
65572 : /* #line 65573 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
65573 :
65574 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
65575 : void
65576 5342 : SgStatementFunctionStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
65577 : {
65578 : // This function traverses the memory pool for only a specific IR node
65579 : // and calls the visit function of the input class execute a traversal
65580 : // similar to the style of the attribute based traversals within ROSE.
65581 : // This traversal will visit ALL nodes of the AST where as the other
65582 : // attribute based traversals visit only the embedded tree within the AST.
65583 :
65584 : // Initialize array to the address of the first element of the STL vector
65585 : // (which is guaranteed to be contiguous storage).
65586 : // SgStatementFunctionStatement objectArray [] = *(Memory_Block_List.begin());
65587 5342 : if (SgStatementFunctionStatement::pools.empty() == false)
65588 : {
65589 : // Generate an array of memory pools
65590 0 : SgStatementFunctionStatement** objectArray = (SgStatementFunctionStatement**) &(SgStatementFunctionStatement::pools[0]);
65591 :
65592 : // Build a local variable for better performance
65593 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
65594 : #if 0
65595 : // Iterate over the memory pools
65596 : for (unsigned int i=0; i < SgStatementFunctionStatement::pools.size(); i++)
65597 : {
65598 : // objectArray[i] is a single memory pool
65599 : for (int j=0; j < SgStatementFunctionStatement::pool_size; j++)
65600 : {
65601 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
65602 : {
65603 : traversal.visit(&(objectArray[i][j]));
65604 : }
65605 : }
65606 : }
65607 : #else
65608 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
65609 : // compute the list first and then call the visit function on each list element.
65610 :
65611 : // printf ("Inside of SgStatementFunctionStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
65612 :
65613 0 : std::vector<SgStatementFunctionStatement*> nodeList;
65614 :
65615 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
65616 0 : for (unsigned int i=0; i < SgStatementFunctionStatement::pools.size(); i++)
65617 : {
65618 : // objectArray[i] is a single memory pool
65619 0 : for (unsigned j=0; j < SgStatementFunctionStatement::pool_size; j++)
65620 : {
65621 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
65622 : {
65623 0 : nodeList.push_back(&(objectArray[i][j]));
65624 : }
65625 : }
65626 : }
65627 :
65628 : // Iterate over the saved list
65629 0 : size_t nodeListSize = nodeList.size();
65630 0 : for (size_t i=0; i < nodeListSize; i++)
65631 : {
65632 0 : ROSE_ASSERT(nodeList[i] != NULL);
65633 : #if 0
65634 : traversal.visit(nodeList[i]);
65635 : #else
65636 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
65637 : {
65638 0 : traversal.visit(nodeList[i]);
65639 : }
65640 : #endif
65641 : }
65642 : #endif
65643 : }
65644 :
65645 : // This should not be required since all previously static data members are
65646 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
65647 :
65648 5342 : }
65649 :
65650 :
65651 : void
65652 194 : SgStatementFunctionStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
65653 : {
65654 : // This function traverses the memory pool for an IR node and
65655 : // calls the function to execute the visitor object.
65656 :
65657 : // Initialize array to the address of the first element of the STL vector
65658 : // (which is guarenteed to be contiguous storage).
65659 : // SgStatementFunctionStatement objectArray [] = *(Memory_Block_List.begin());
65660 194 : if (SgStatementFunctionStatement::pools.empty() == false)
65661 : {
65662 : // Generate an array of memory pools
65663 0 : SgStatementFunctionStatement** objectArray = (SgStatementFunctionStatement**) &(SgStatementFunctionStatement::pools[0]);
65664 :
65665 : // Build a local variable for better performance
65666 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
65667 :
65668 : // Iterate over the memory pools
65669 0 : for (unsigned int i=0; i < SgStatementFunctionStatement::pools.size(); i++)
65670 : {
65671 : // objectArray[i] is a single memory pool
65672 0 : for (unsigned j=0; j < SgStatementFunctionStatement::pool_size; j++)
65673 : {
65674 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
65675 : {
65676 : // printf ("Found a valid SgStatementFunctionStatement object in the memory pool %d at position %d \n",i,j);
65677 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
65678 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
65679 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
65680 : }
65681 : else
65682 : {
65683 : // printf ("Found a INVALID SgStatementFunctionStatement object in the memory pool \n");
65684 : }
65685 : }
65686 : }
65687 : }
65688 :
65689 : // This should not be required since all previously static data members are
65690 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
65691 :
65692 194 : }
65693 :
65694 : void
65695 0 : SgStatementFunctionStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
65696 : {
65697 : // This function visits only a single IR node of the memory pool.
65698 : // it is typically called once for each type of IR node within
65699 : // the automatically generated function: traverseRepresentativeNodes().
65700 :
65701 : // Initialize array to the address of the first element of the STL vector
65702 : // (which is guarenteed to be contiguous storage).
65703 : // SgStatementFunctionStatement objectArray [] = *(Memory_Block_List.begin());
65704 0 : if (SgStatementFunctionStatement::pools.empty() == false)
65705 : {
65706 : // Generate an array of memory pools
65707 0 : SgStatementFunctionStatement** objectArray = (SgStatementFunctionStatement**) &(SgStatementFunctionStatement::pools[0]);
65708 :
65709 : // Build a local variable for better performance
65710 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
65711 :
65712 : // Iterate over the memory pools
65713 0 : bool done = false;
65714 0 : unsigned i=0;
65715 :
65716 : // find the first valid IR node, call visit function, and then leave
65717 0 : while ( done == false && i < SgStatementFunctionStatement::pools.size() )
65718 : {
65719 : // objectArray[i] is a single memory pool
65720 : unsigned j=0;
65721 0 : while (done == false && j < SgStatementFunctionStatement::pool_size)
65722 : {
65723 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
65724 : {
65725 0 : traversal.visit(&(objectArray[i][j]));
65726 0 : done = true;
65727 : }
65728 0 : j++;
65729 : }
65730 0 : i++;
65731 : }
65732 :
65733 : #if 0
65734 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
65735 : if (done == false)
65736 : {
65737 : printf ("No representative for SgStatementFunctionStatement found in memory pools \n");
65738 : }
65739 : #endif
65740 : }
65741 0 : }
65742 :
65743 :
65744 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
65745 : // using values that overflow signed values of int.
65746 : size_t
65747 4 : SgStatementFunctionStatement::numberOfNodes()
65748 : {
65749 : // This function traverses the memory pool for an IR node and
65750 : // counts the number of IR nodes of a particular Sage III IR
65751 : // nodes type.
65752 :
65753 4 : size_t count = 0;
65754 4 : if (SgStatementFunctionStatement::pools.empty() == false)
65755 : {
65756 : // Generate an array of memory pools (this is actually a STL vector,
65757 : // but it is contiguious, so OK to treat this way).
65758 0 : SgStatementFunctionStatement** objectArray = (SgStatementFunctionStatement**) &(SgStatementFunctionStatement::pools[0]);
65759 :
65760 : // Build a local variable for better performance (make it a loop invariant variable).
65761 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
65762 :
65763 : // Iterate over all of the memory pools for this IR node.
65764 0 : for (unsigned int i=0; i < SgStatementFunctionStatement::pools.size(); i++)
65765 : {
65766 : // objectArray[i] is a single memory pool, iterate over all the
65767 : // IR nodes and only count those that are valid IR nodes used in
65768 : // the AST (i.e. allocated IR nodes).
65769 0 : for (unsigned j=0; j < SgStatementFunctionStatement::pool_size; j++)
65770 : {
65771 : // This is indexing the STL vector of C/C++ style arrays as a doubly
65772 : // indexed array access. It is OK since we have leveraged the semantics
65773 : // of STL vector memory as contigous and cast the memory as an array
65774 : // of arrays to use the 2D array indexing. Hope this is not confusing,
65775 : // but it s very fast as an implementation.
65776 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
65777 : {
65778 0 : count++;
65779 : }
65780 : }
65781 : }
65782 : }
65783 :
65784 :
65785 :
65786 4 : return count;
65787 : }
65788 :
65789 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
65790 : // using values that overflow signed values of int.
65791 : size_t
65792 0 : SgStatementFunctionStatement::memoryUsage()
65793 : {
65794 : // This function is required because we need the class name as a type when we call sizeof
65795 : // There might be another way to implement this if we have a traversal that only called a
65796 : // representative object (one call for each type of Sage IIIIR node).
65797 0 : size_t memory = numberOfNodes() * sizeof(SgStatementFunctionStatement);
65798 :
65799 0 : return memory;
65800 : }
65801 :
65802 : /* #line 65803 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
65803 :
65804 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
65805 : void
65806 5379 : SgCtorInitializerList::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
65807 : {
65808 : // This function traverses the memory pool for only a specific IR node
65809 : // and calls the visit function of the input class execute a traversal
65810 : // similar to the style of the attribute based traversals within ROSE.
65811 : // This traversal will visit ALL nodes of the AST where as the other
65812 : // attribute based traversals visit only the embedded tree within the AST.
65813 :
65814 : // Initialize array to the address of the first element of the STL vector
65815 : // (which is guaranteed to be contiguous storage).
65816 : // SgCtorInitializerList objectArray [] = *(Memory_Block_List.begin());
65817 5379 : if (SgCtorInitializerList::pools.empty() == false)
65818 : {
65819 : // Generate an array of memory pools
65820 234 : SgCtorInitializerList** objectArray = (SgCtorInitializerList**) &(SgCtorInitializerList::pools[0]);
65821 :
65822 : // Build a local variable for better performance
65823 234 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
65824 : #if 0
65825 : // Iterate over the memory pools
65826 : for (unsigned int i=0; i < SgCtorInitializerList::pools.size(); i++)
65827 : {
65828 : // objectArray[i] is a single memory pool
65829 : for (int j=0; j < SgCtorInitializerList::pool_size; j++)
65830 : {
65831 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
65832 : {
65833 : traversal.visit(&(objectArray[i][j]));
65834 : }
65835 : }
65836 : }
65837 : #else
65838 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
65839 : // compute the list first and then call the visit function on each list element.
65840 :
65841 : // printf ("Inside of SgCtorInitializerList::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
65842 :
65843 468 : std::vector<SgCtorInitializerList*> nodeList;
65844 :
65845 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
65846 698 : for (unsigned int i=0; i < SgCtorInitializerList::pools.size(); i++)
65847 : {
65848 : // objectArray[i] is a single memory pool
65849 928464 : for (unsigned j=0; j < SgCtorInitializerList::pool_size; j++)
65850 : {
65851 928000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
65852 : {
65853 551699 : nodeList.push_back(&(objectArray[i][j]));
65854 : }
65855 : }
65856 : }
65857 :
65858 : // Iterate over the saved list
65859 234 : size_t nodeListSize = nodeList.size();
65860 551933 : for (size_t i=0; i < nodeListSize; i++)
65861 : {
65862 551699 : ROSE_ASSERT(nodeList[i] != NULL);
65863 : #if 0
65864 : traversal.visit(nodeList[i]);
65865 : #else
65866 551699 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
65867 : {
65868 551699 : traversal.visit(nodeList[i]);
65869 : }
65870 : #endif
65871 : }
65872 : #endif
65873 : }
65874 :
65875 : // This should not be required since all previously static data members are
65876 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
65877 :
65878 5379 : }
65879 :
65880 :
65881 : void
65882 194 : SgCtorInitializerList::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
65883 : {
65884 : // This function traverses the memory pool for an IR node and
65885 : // calls the function to execute the visitor object.
65886 :
65887 : // Initialize array to the address of the first element of the STL vector
65888 : // (which is guarenteed to be contiguous storage).
65889 : // SgCtorInitializerList objectArray [] = *(Memory_Block_List.begin());
65890 194 : if (SgCtorInitializerList::pools.empty() == false)
65891 : {
65892 : // Generate an array of memory pools
65893 137 : SgCtorInitializerList** objectArray = (SgCtorInitializerList**) &(SgCtorInitializerList::pools[0]);
65894 :
65895 : // Build a local variable for better performance
65896 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
65897 :
65898 : // Iterate over the memory pools
65899 548 : for (unsigned int i=0; i < SgCtorInitializerList::pools.size(); i++)
65900 : {
65901 : // objectArray[i] is a single memory pool
65902 822411 : for (unsigned j=0; j < SgCtorInitializerList::pool_size; j++)
65903 : {
65904 822000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
65905 : {
65906 : // printf ("Found a valid SgCtorInitializerList object in the memory pool %d at position %d \n",i,j);
65907 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
65908 619556 : objectArray[i][j].executeVisitorMemberFunction(visitor);
65909 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
65910 : }
65911 : else
65912 : {
65913 : // printf ("Found a INVALID SgCtorInitializerList object in the memory pool \n");
65914 : }
65915 : }
65916 : }
65917 : }
65918 :
65919 : // This should not be required since all previously static data members are
65920 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
65921 :
65922 194 : }
65923 :
65924 : void
65925 0 : SgCtorInitializerList::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
65926 : {
65927 : // This function visits only a single IR node of the memory pool.
65928 : // it is typically called once for each type of IR node within
65929 : // the automatically generated function: traverseRepresentativeNodes().
65930 :
65931 : // Initialize array to the address of the first element of the STL vector
65932 : // (which is guarenteed to be contiguous storage).
65933 : // SgCtorInitializerList objectArray [] = *(Memory_Block_List.begin());
65934 0 : if (SgCtorInitializerList::pools.empty() == false)
65935 : {
65936 : // Generate an array of memory pools
65937 0 : SgCtorInitializerList** objectArray = (SgCtorInitializerList**) &(SgCtorInitializerList::pools[0]);
65938 :
65939 : // Build a local variable for better performance
65940 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
65941 :
65942 : // Iterate over the memory pools
65943 0 : bool done = false;
65944 0 : unsigned i=0;
65945 :
65946 : // find the first valid IR node, call visit function, and then leave
65947 0 : while ( done == false && i < SgCtorInitializerList::pools.size() )
65948 : {
65949 : // objectArray[i] is a single memory pool
65950 : unsigned j=0;
65951 0 : while (done == false && j < SgCtorInitializerList::pool_size)
65952 : {
65953 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
65954 : {
65955 0 : traversal.visit(&(objectArray[i][j]));
65956 0 : done = true;
65957 : }
65958 0 : j++;
65959 : }
65960 0 : i++;
65961 : }
65962 :
65963 : #if 0
65964 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
65965 : if (done == false)
65966 : {
65967 : printf ("No representative for SgCtorInitializerList found in memory pools \n");
65968 : }
65969 : #endif
65970 : }
65971 0 : }
65972 :
65973 :
65974 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
65975 : // using values that overflow signed values of int.
65976 : size_t
65977 4 : SgCtorInitializerList::numberOfNodes()
65978 : {
65979 : // This function traverses the memory pool for an IR node and
65980 : // counts the number of IR nodes of a particular Sage III IR
65981 : // nodes type.
65982 :
65983 4 : size_t count = 0;
65984 4 : if (SgCtorInitializerList::pools.empty() == false)
65985 : {
65986 : // Generate an array of memory pools (this is actually a STL vector,
65987 : // but it is contiguious, so OK to treat this way).
65988 1 : SgCtorInitializerList** objectArray = (SgCtorInitializerList**) &(SgCtorInitializerList::pools[0]);
65989 :
65990 : // Build a local variable for better performance (make it a loop invariant variable).
65991 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
65992 :
65993 : // Iterate over all of the memory pools for this IR node.
65994 4 : for (unsigned int i=0; i < SgCtorInitializerList::pools.size(); i++)
65995 : {
65996 : // objectArray[i] is a single memory pool, iterate over all the
65997 : // IR nodes and only count those that are valid IR nodes used in
65998 : // the AST (i.e. allocated IR nodes).
65999 6003 : for (unsigned j=0; j < SgCtorInitializerList::pool_size; j++)
66000 : {
66001 : // This is indexing the STL vector of C/C++ style arrays as a doubly
66002 : // indexed array access. It is OK since we have leveraged the semantics
66003 : // of STL vector memory as contigous and cast the memory as an array
66004 : // of arrays to use the 2D array indexing. Hope this is not confusing,
66005 : // but it s very fast as an implementation.
66006 6000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
66007 : {
66008 4428 : count++;
66009 : }
66010 : }
66011 : }
66012 : }
66013 :
66014 :
66015 :
66016 4 : return count;
66017 : }
66018 :
66019 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
66020 : // using values that overflow signed values of int.
66021 : size_t
66022 0 : SgCtorInitializerList::memoryUsage()
66023 : {
66024 : // This function is required because we need the class name as a type when we call sizeof
66025 : // There might be another way to implement this if we have a traversal that only called a
66026 : // representative object (one call for each type of Sage IIIIR node).
66027 0 : size_t memory = numberOfNodes() * sizeof(SgCtorInitializerList);
66028 :
66029 0 : return memory;
66030 : }
66031 :
66032 : /* #line 66033 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
66033 :
66034 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
66035 : void
66036 5342 : SgPragmaDeclaration::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
66037 : {
66038 : // This function traverses the memory pool for only a specific IR node
66039 : // and calls the visit function of the input class execute a traversal
66040 : // similar to the style of the attribute based traversals within ROSE.
66041 : // This traversal will visit ALL nodes of the AST where as the other
66042 : // attribute based traversals visit only the embedded tree within the AST.
66043 :
66044 : // Initialize array to the address of the first element of the STL vector
66045 : // (which is guaranteed to be contiguous storage).
66046 : // SgPragmaDeclaration objectArray [] = *(Memory_Block_List.begin());
66047 5342 : if (SgPragmaDeclaration::pools.empty() == false)
66048 : {
66049 : // Generate an array of memory pools
66050 3872 : SgPragmaDeclaration** objectArray = (SgPragmaDeclaration**) &(SgPragmaDeclaration::pools[0]);
66051 :
66052 : // Build a local variable for better performance
66053 3872 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
66054 : #if 0
66055 : // Iterate over the memory pools
66056 : for (unsigned int i=0; i < SgPragmaDeclaration::pools.size(); i++)
66057 : {
66058 : // objectArray[i] is a single memory pool
66059 : for (int j=0; j < SgPragmaDeclaration::pool_size; j++)
66060 : {
66061 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
66062 : {
66063 : traversal.visit(&(objectArray[i][j]));
66064 : }
66065 : }
66066 : }
66067 : #else
66068 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
66069 : // compute the list first and then call the visit function on each list element.
66070 :
66071 : // printf ("Inside of SgPragmaDeclaration::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
66072 :
66073 7744 : std::vector<SgPragmaDeclaration*> nodeList;
66074 :
66075 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
66076 7744 : for (unsigned int i=0; i < SgPragmaDeclaration::pools.size(); i++)
66077 : {
66078 : // objectArray[i] is a single memory pool
66079 7747870 : for (unsigned j=0; j < SgPragmaDeclaration::pool_size; j++)
66080 : {
66081 7744000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
66082 : {
66083 25667 : nodeList.push_back(&(objectArray[i][j]));
66084 : }
66085 : }
66086 : }
66087 :
66088 : // Iterate over the saved list
66089 3872 : size_t nodeListSize = nodeList.size();
66090 29539 : for (size_t i=0; i < nodeListSize; i++)
66091 : {
66092 25667 : ROSE_ASSERT(nodeList[i] != NULL);
66093 : #if 0
66094 : traversal.visit(nodeList[i]);
66095 : #else
66096 25667 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
66097 : {
66098 25667 : traversal.visit(nodeList[i]);
66099 : }
66100 : #endif
66101 : }
66102 : #endif
66103 : }
66104 :
66105 : // This should not be required since all previously static data members are
66106 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
66107 :
66108 5342 : }
66109 :
66110 :
66111 : void
66112 194 : SgPragmaDeclaration::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
66113 : {
66114 : // This function traverses the memory pool for an IR node and
66115 : // calls the function to execute the visitor object.
66116 :
66117 : // Initialize array to the address of the first element of the STL vector
66118 : // (which is guarenteed to be contiguous storage).
66119 : // SgPragmaDeclaration objectArray [] = *(Memory_Block_List.begin());
66120 194 : if (SgPragmaDeclaration::pools.empty() == false)
66121 : {
66122 : // Generate an array of memory pools
66123 137 : SgPragmaDeclaration** objectArray = (SgPragmaDeclaration**) &(SgPragmaDeclaration::pools[0]);
66124 :
66125 : // Build a local variable for better performance
66126 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
66127 :
66128 : // Iterate over the memory pools
66129 274 : for (unsigned int i=0; i < SgPragmaDeclaration::pools.size(); i++)
66130 : {
66131 : // objectArray[i] is a single memory pool
66132 274137 : for (unsigned j=0; j < SgPragmaDeclaration::pool_size; j++)
66133 : {
66134 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
66135 : {
66136 : // printf ("Found a valid SgPragmaDeclaration object in the memory pool %d at position %d \n",i,j);
66137 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
66138 13512 : objectArray[i][j].executeVisitorMemberFunction(visitor);
66139 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
66140 : }
66141 : else
66142 : {
66143 : // printf ("Found a INVALID SgPragmaDeclaration object in the memory pool \n");
66144 : }
66145 : }
66146 : }
66147 : }
66148 :
66149 : // This should not be required since all previously static data members are
66150 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
66151 :
66152 194 : }
66153 :
66154 : void
66155 0 : SgPragmaDeclaration::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
66156 : {
66157 : // This function visits only a single IR node of the memory pool.
66158 : // it is typically called once for each type of IR node within
66159 : // the automatically generated function: traverseRepresentativeNodes().
66160 :
66161 : // Initialize array to the address of the first element of the STL vector
66162 : // (which is guarenteed to be contiguous storage).
66163 : // SgPragmaDeclaration objectArray [] = *(Memory_Block_List.begin());
66164 0 : if (SgPragmaDeclaration::pools.empty() == false)
66165 : {
66166 : // Generate an array of memory pools
66167 0 : SgPragmaDeclaration** objectArray = (SgPragmaDeclaration**) &(SgPragmaDeclaration::pools[0]);
66168 :
66169 : // Build a local variable for better performance
66170 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
66171 :
66172 : // Iterate over the memory pools
66173 0 : bool done = false;
66174 0 : unsigned i=0;
66175 :
66176 : // find the first valid IR node, call visit function, and then leave
66177 0 : while ( done == false && i < SgPragmaDeclaration::pools.size() )
66178 : {
66179 : // objectArray[i] is a single memory pool
66180 : unsigned j=0;
66181 0 : while (done == false && j < SgPragmaDeclaration::pool_size)
66182 : {
66183 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
66184 : {
66185 0 : traversal.visit(&(objectArray[i][j]));
66186 0 : done = true;
66187 : }
66188 0 : j++;
66189 : }
66190 0 : i++;
66191 : }
66192 :
66193 : #if 0
66194 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
66195 : if (done == false)
66196 : {
66197 : printf ("No representative for SgPragmaDeclaration found in memory pools \n");
66198 : }
66199 : #endif
66200 : }
66201 0 : }
66202 :
66203 :
66204 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
66205 : // using values that overflow signed values of int.
66206 : size_t
66207 4 : SgPragmaDeclaration::numberOfNodes()
66208 : {
66209 : // This function traverses the memory pool for an IR node and
66210 : // counts the number of IR nodes of a particular Sage III IR
66211 : // nodes type.
66212 :
66213 4 : size_t count = 0;
66214 4 : if (SgPragmaDeclaration::pools.empty() == false)
66215 : {
66216 : // Generate an array of memory pools (this is actually a STL vector,
66217 : // but it is contiguious, so OK to treat this way).
66218 1 : SgPragmaDeclaration** objectArray = (SgPragmaDeclaration**) &(SgPragmaDeclaration::pools[0]);
66219 :
66220 : // Build a local variable for better performance (make it a loop invariant variable).
66221 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
66222 :
66223 : // Iterate over all of the memory pools for this IR node.
66224 2 : for (unsigned int i=0; i < SgPragmaDeclaration::pools.size(); i++)
66225 : {
66226 : // objectArray[i] is a single memory pool, iterate over all the
66227 : // IR nodes and only count those that are valid IR nodes used in
66228 : // the AST (i.e. allocated IR nodes).
66229 2001 : for (unsigned j=0; j < SgPragmaDeclaration::pool_size; j++)
66230 : {
66231 : // This is indexing the STL vector of C/C++ style arrays as a doubly
66232 : // indexed array access. It is OK since we have leveraged the semantics
66233 : // of STL vector memory as contigous and cast the memory as an array
66234 : // of arrays to use the 2D array indexing. Hope this is not confusing,
66235 : // but it s very fast as an implementation.
66236 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
66237 : {
66238 97 : count++;
66239 : }
66240 : }
66241 : }
66242 : }
66243 :
66244 :
66245 :
66246 4 : return count;
66247 : }
66248 :
66249 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
66250 : // using values that overflow signed values of int.
66251 : size_t
66252 0 : SgPragmaDeclaration::memoryUsage()
66253 : {
66254 : // This function is required because we need the class name as a type when we call sizeof
66255 : // There might be another way to implement this if we have a traversal that only called a
66256 : // representative object (one call for each type of Sage IIIIR node).
66257 0 : size_t memory = numberOfNodes() * sizeof(SgPragmaDeclaration);
66258 :
66259 0 : return memory;
66260 : }
66261 :
66262 : /* #line 66263 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
66263 :
66264 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
66265 : void
66266 5342 : SgUsingDirectiveStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
66267 : {
66268 : // This function traverses the memory pool for only a specific IR node
66269 : // and calls the visit function of the input class execute a traversal
66270 : // similar to the style of the attribute based traversals within ROSE.
66271 : // This traversal will visit ALL nodes of the AST where as the other
66272 : // attribute based traversals visit only the embedded tree within the AST.
66273 :
66274 : // Initialize array to the address of the first element of the STL vector
66275 : // (which is guaranteed to be contiguous storage).
66276 : // SgUsingDirectiveStatement objectArray [] = *(Memory_Block_List.begin());
66277 5342 : if (SgUsingDirectiveStatement::pools.empty() == false)
66278 : {
66279 : // Generate an array of memory pools
66280 138 : SgUsingDirectiveStatement** objectArray = (SgUsingDirectiveStatement**) &(SgUsingDirectiveStatement::pools[0]);
66281 :
66282 : // Build a local variable for better performance
66283 138 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
66284 : #if 0
66285 : // Iterate over the memory pools
66286 : for (unsigned int i=0; i < SgUsingDirectiveStatement::pools.size(); i++)
66287 : {
66288 : // objectArray[i] is a single memory pool
66289 : for (int j=0; j < SgUsingDirectiveStatement::pool_size; j++)
66290 : {
66291 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
66292 : {
66293 : traversal.visit(&(objectArray[i][j]));
66294 : }
66295 : }
66296 : }
66297 : #else
66298 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
66299 : // compute the list first and then call the visit function on each list element.
66300 :
66301 : // printf ("Inside of SgUsingDirectiveStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
66302 :
66303 276 : std::vector<SgUsingDirectiveStatement*> nodeList;
66304 :
66305 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
66306 276 : for (unsigned int i=0; i < SgUsingDirectiveStatement::pools.size(); i++)
66307 : {
66308 : // objectArray[i] is a single memory pool
66309 276138 : for (unsigned j=0; j < SgUsingDirectiveStatement::pool_size; j++)
66310 : {
66311 276000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
66312 : {
66313 222 : nodeList.push_back(&(objectArray[i][j]));
66314 : }
66315 : }
66316 : }
66317 :
66318 : // Iterate over the saved list
66319 138 : size_t nodeListSize = nodeList.size();
66320 360 : for (size_t i=0; i < nodeListSize; i++)
66321 : {
66322 222 : ROSE_ASSERT(nodeList[i] != NULL);
66323 : #if 0
66324 : traversal.visit(nodeList[i]);
66325 : #else
66326 222 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
66327 : {
66328 222 : traversal.visit(nodeList[i]);
66329 : }
66330 : #endif
66331 : }
66332 : #endif
66333 : }
66334 :
66335 : // This should not be required since all previously static data members are
66336 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
66337 :
66338 5342 : }
66339 :
66340 :
66341 : void
66342 194 : SgUsingDirectiveStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
66343 : {
66344 : // This function traverses the memory pool for an IR node and
66345 : // calls the function to execute the visitor object.
66346 :
66347 : // Initialize array to the address of the first element of the STL vector
66348 : // (which is guarenteed to be contiguous storage).
66349 : // SgUsingDirectiveStatement objectArray [] = *(Memory_Block_List.begin());
66350 194 : if (SgUsingDirectiveStatement::pools.empty() == false)
66351 : {
66352 : // Generate an array of memory pools
66353 137 : SgUsingDirectiveStatement** objectArray = (SgUsingDirectiveStatement**) &(SgUsingDirectiveStatement::pools[0]);
66354 :
66355 : // Build a local variable for better performance
66356 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
66357 :
66358 : // Iterate over the memory pools
66359 274 : for (unsigned int i=0; i < SgUsingDirectiveStatement::pools.size(); i++)
66360 : {
66361 : // objectArray[i] is a single memory pool
66362 274137 : for (unsigned j=0; j < SgUsingDirectiveStatement::pool_size; j++)
66363 : {
66364 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
66365 : {
66366 : // printf ("Found a valid SgUsingDirectiveStatement object in the memory pool %d at position %d \n",i,j);
66367 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
66368 240 : objectArray[i][j].executeVisitorMemberFunction(visitor);
66369 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
66370 : }
66371 : else
66372 : {
66373 : // printf ("Found a INVALID SgUsingDirectiveStatement object in the memory pool \n");
66374 : }
66375 : }
66376 : }
66377 : }
66378 :
66379 : // This should not be required since all previously static data members are
66380 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
66381 :
66382 194 : }
66383 :
66384 : void
66385 0 : SgUsingDirectiveStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
66386 : {
66387 : // This function visits only a single IR node of the memory pool.
66388 : // it is typically called once for each type of IR node within
66389 : // the automatically generated function: traverseRepresentativeNodes().
66390 :
66391 : // Initialize array to the address of the first element of the STL vector
66392 : // (which is guarenteed to be contiguous storage).
66393 : // SgUsingDirectiveStatement objectArray [] = *(Memory_Block_List.begin());
66394 0 : if (SgUsingDirectiveStatement::pools.empty() == false)
66395 : {
66396 : // Generate an array of memory pools
66397 0 : SgUsingDirectiveStatement** objectArray = (SgUsingDirectiveStatement**) &(SgUsingDirectiveStatement::pools[0]);
66398 :
66399 : // Build a local variable for better performance
66400 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
66401 :
66402 : // Iterate over the memory pools
66403 0 : bool done = false;
66404 0 : unsigned i=0;
66405 :
66406 : // find the first valid IR node, call visit function, and then leave
66407 0 : while ( done == false && i < SgUsingDirectiveStatement::pools.size() )
66408 : {
66409 : // objectArray[i] is a single memory pool
66410 : unsigned j=0;
66411 0 : while (done == false && j < SgUsingDirectiveStatement::pool_size)
66412 : {
66413 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
66414 : {
66415 0 : traversal.visit(&(objectArray[i][j]));
66416 0 : done = true;
66417 : }
66418 0 : j++;
66419 : }
66420 0 : i++;
66421 : }
66422 :
66423 : #if 0
66424 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
66425 : if (done == false)
66426 : {
66427 : printf ("No representative for SgUsingDirectiveStatement found in memory pools \n");
66428 : }
66429 : #endif
66430 : }
66431 0 : }
66432 :
66433 :
66434 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
66435 : // using values that overflow signed values of int.
66436 : size_t
66437 4 : SgUsingDirectiveStatement::numberOfNodes()
66438 : {
66439 : // This function traverses the memory pool for an IR node and
66440 : // counts the number of IR nodes of a particular Sage III IR
66441 : // nodes type.
66442 :
66443 4 : size_t count = 0;
66444 4 : if (SgUsingDirectiveStatement::pools.empty() == false)
66445 : {
66446 : // Generate an array of memory pools (this is actually a STL vector,
66447 : // but it is contiguious, so OK to treat this way).
66448 1 : SgUsingDirectiveStatement** objectArray = (SgUsingDirectiveStatement**) &(SgUsingDirectiveStatement::pools[0]);
66449 :
66450 : // Build a local variable for better performance (make it a loop invariant variable).
66451 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
66452 :
66453 : // Iterate over all of the memory pools for this IR node.
66454 2 : for (unsigned int i=0; i < SgUsingDirectiveStatement::pools.size(); i++)
66455 : {
66456 : // objectArray[i] is a single memory pool, iterate over all the
66457 : // IR nodes and only count those that are valid IR nodes used in
66458 : // the AST (i.e. allocated IR nodes).
66459 2001 : for (unsigned j=0; j < SgUsingDirectiveStatement::pool_size; j++)
66460 : {
66461 : // This is indexing the STL vector of C/C++ style arrays as a doubly
66462 : // indexed array access. It is OK since we have leveraged the semantics
66463 : // of STL vector memory as contigous and cast the memory as an array
66464 : // of arrays to use the 2D array indexing. Hope this is not confusing,
66465 : // but it s very fast as an implementation.
66466 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
66467 : {
66468 1 : count++;
66469 : }
66470 : }
66471 : }
66472 : }
66473 :
66474 :
66475 :
66476 4 : return count;
66477 : }
66478 :
66479 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
66480 : // using values that overflow signed values of int.
66481 : size_t
66482 0 : SgUsingDirectiveStatement::memoryUsage()
66483 : {
66484 : // This function is required because we need the class name as a type when we call sizeof
66485 : // There might be another way to implement this if we have a traversal that only called a
66486 : // representative object (one call for each type of Sage IIIIR node).
66487 0 : size_t memory = numberOfNodes() * sizeof(SgUsingDirectiveStatement);
66488 :
66489 0 : return memory;
66490 : }
66491 :
66492 : /* #line 66493 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
66493 :
66494 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
66495 : void
66496 5344 : SgClassDeclaration::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
66497 : {
66498 : // This function traverses the memory pool for only a specific IR node
66499 : // and calls the visit function of the input class execute a traversal
66500 : // similar to the style of the attribute based traversals within ROSE.
66501 : // This traversal will visit ALL nodes of the AST where as the other
66502 : // attribute based traversals visit only the embedded tree within the AST.
66503 :
66504 : // Initialize array to the address of the first element of the STL vector
66505 : // (which is guaranteed to be contiguous storage).
66506 : // SgClassDeclaration objectArray [] = *(Memory_Block_List.begin());
66507 5344 : if (SgClassDeclaration::pools.empty() == false)
66508 : {
66509 : // Generate an array of memory pools
66510 3107 : SgClassDeclaration** objectArray = (SgClassDeclaration**) &(SgClassDeclaration::pools[0]);
66511 :
66512 : // Build a local variable for better performance
66513 3107 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
66514 : #if 0
66515 : // Iterate over the memory pools
66516 : for (unsigned int i=0; i < SgClassDeclaration::pools.size(); i++)
66517 : {
66518 : // objectArray[i] is a single memory pool
66519 : for (int j=0; j < SgClassDeclaration::pool_size; j++)
66520 : {
66521 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
66522 : {
66523 : traversal.visit(&(objectArray[i][j]));
66524 : }
66525 : }
66526 : }
66527 : #else
66528 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
66529 : // compute the list first and then call the visit function on each list element.
66530 :
66531 : // printf ("Inside of SgClassDeclaration::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
66532 :
66533 6214 : std::vector<SgClassDeclaration*> nodeList;
66534 :
66535 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
66536 6214 : for (unsigned int i=0; i < SgClassDeclaration::pools.size(); i++)
66537 : {
66538 : // objectArray[i] is a single memory pool
66539 6217110 : for (unsigned j=0; j < SgClassDeclaration::pool_size; j++)
66540 : {
66541 6214000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
66542 : {
66543 218288 : nodeList.push_back(&(objectArray[i][j]));
66544 : }
66545 : }
66546 : }
66547 :
66548 : // Iterate over the saved list
66549 3107 : size_t nodeListSize = nodeList.size();
66550 221395 : for (size_t i=0; i < nodeListSize; i++)
66551 : {
66552 218288 : ROSE_ASSERT(nodeList[i] != NULL);
66553 : #if 0
66554 : traversal.visit(nodeList[i]);
66555 : #else
66556 218288 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
66557 : {
66558 218288 : traversal.visit(nodeList[i]);
66559 : }
66560 : #endif
66561 : }
66562 : #endif
66563 : }
66564 :
66565 : // This should not be required since all previously static data members are
66566 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
66567 :
66568 5344 : }
66569 :
66570 :
66571 : void
66572 194 : SgClassDeclaration::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
66573 : {
66574 : // This function traverses the memory pool for an IR node and
66575 : // calls the function to execute the visitor object.
66576 :
66577 : // Initialize array to the address of the first element of the STL vector
66578 : // (which is guarenteed to be contiguous storage).
66579 : // SgClassDeclaration objectArray [] = *(Memory_Block_List.begin());
66580 194 : if (SgClassDeclaration::pools.empty() == false)
66581 : {
66582 : // Generate an array of memory pools
66583 137 : SgClassDeclaration** objectArray = (SgClassDeclaration**) &(SgClassDeclaration::pools[0]);
66584 :
66585 : // Build a local variable for better performance
66586 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
66587 :
66588 : // Iterate over the memory pools
66589 274 : for (unsigned int i=0; i < SgClassDeclaration::pools.size(); i++)
66590 : {
66591 : // objectArray[i] is a single memory pool
66592 274137 : for (unsigned j=0; j < SgClassDeclaration::pool_size; j++)
66593 : {
66594 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
66595 : {
66596 : // printf ("Found a valid SgClassDeclaration object in the memory pool %d at position %d \n",i,j);
66597 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
66598 48819 : objectArray[i][j].executeVisitorMemberFunction(visitor);
66599 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
66600 : }
66601 : else
66602 : {
66603 : // printf ("Found a INVALID SgClassDeclaration object in the memory pool \n");
66604 : }
66605 : }
66606 : }
66607 : }
66608 :
66609 : // This should not be required since all previously static data members are
66610 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
66611 :
66612 194 : }
66613 :
66614 : void
66615 0 : SgClassDeclaration::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
66616 : {
66617 : // This function visits only a single IR node of the memory pool.
66618 : // it is typically called once for each type of IR node within
66619 : // the automatically generated function: traverseRepresentativeNodes().
66620 :
66621 : // Initialize array to the address of the first element of the STL vector
66622 : // (which is guarenteed to be contiguous storage).
66623 : // SgClassDeclaration objectArray [] = *(Memory_Block_List.begin());
66624 0 : if (SgClassDeclaration::pools.empty() == false)
66625 : {
66626 : // Generate an array of memory pools
66627 0 : SgClassDeclaration** objectArray = (SgClassDeclaration**) &(SgClassDeclaration::pools[0]);
66628 :
66629 : // Build a local variable for better performance
66630 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
66631 :
66632 : // Iterate over the memory pools
66633 0 : bool done = false;
66634 0 : unsigned i=0;
66635 :
66636 : // find the first valid IR node, call visit function, and then leave
66637 0 : while ( done == false && i < SgClassDeclaration::pools.size() )
66638 : {
66639 : // objectArray[i] is a single memory pool
66640 : unsigned j=0;
66641 0 : while (done == false && j < SgClassDeclaration::pool_size)
66642 : {
66643 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
66644 : {
66645 0 : traversal.visit(&(objectArray[i][j]));
66646 0 : done = true;
66647 : }
66648 0 : j++;
66649 : }
66650 0 : i++;
66651 : }
66652 :
66653 : #if 0
66654 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
66655 : if (done == false)
66656 : {
66657 : printf ("No representative for SgClassDeclaration found in memory pools \n");
66658 : }
66659 : #endif
66660 : }
66661 0 : }
66662 :
66663 :
66664 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
66665 : // using values that overflow signed values of int.
66666 : size_t
66667 4 : SgClassDeclaration::numberOfNodes()
66668 : {
66669 : // This function traverses the memory pool for an IR node and
66670 : // counts the number of IR nodes of a particular Sage III IR
66671 : // nodes type.
66672 :
66673 4 : size_t count = 0;
66674 4 : if (SgClassDeclaration::pools.empty() == false)
66675 : {
66676 : // Generate an array of memory pools (this is actually a STL vector,
66677 : // but it is contiguious, so OK to treat this way).
66678 2 : SgClassDeclaration** objectArray = (SgClassDeclaration**) &(SgClassDeclaration::pools[0]);
66679 :
66680 : // Build a local variable for better performance (make it a loop invariant variable).
66681 2 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
66682 :
66683 : // Iterate over all of the memory pools for this IR node.
66684 4 : for (unsigned int i=0; i < SgClassDeclaration::pools.size(); i++)
66685 : {
66686 : // objectArray[i] is a single memory pool, iterate over all the
66687 : // IR nodes and only count those that are valid IR nodes used in
66688 : // the AST (i.e. allocated IR nodes).
66689 4002 : for (unsigned j=0; j < SgClassDeclaration::pool_size; j++)
66690 : {
66691 : // This is indexing the STL vector of C/C++ style arrays as a doubly
66692 : // indexed array access. It is OK since we have leveraged the semantics
66693 : // of STL vector memory as contigous and cast the memory as an array
66694 : // of arrays to use the 2D array indexing. Hope this is not confusing,
66695 : // but it s very fast as an implementation.
66696 4000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
66697 : {
66698 371 : count++;
66699 : }
66700 : }
66701 : }
66702 : }
66703 :
66704 :
66705 :
66706 4 : return count;
66707 : }
66708 :
66709 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
66710 : // using values that overflow signed values of int.
66711 : size_t
66712 0 : SgClassDeclaration::memoryUsage()
66713 : {
66714 : // This function is required because we need the class name as a type when we call sizeof
66715 : // There might be another way to implement this if we have a traversal that only called a
66716 : // representative object (one call for each type of Sage IIIIR node).
66717 0 : size_t memory = numberOfNodes() * sizeof(SgClassDeclaration);
66718 :
66719 0 : return memory;
66720 : }
66721 :
66722 : /* #line 66723 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
66723 :
66724 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
66725 : void
66726 5342 : SgTemplateClassDeclaration::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
66727 : {
66728 : // This function traverses the memory pool for only a specific IR node
66729 : // and calls the visit function of the input class execute a traversal
66730 : // similar to the style of the attribute based traversals within ROSE.
66731 : // This traversal will visit ALL nodes of the AST where as the other
66732 : // attribute based traversals visit only the embedded tree within the AST.
66733 :
66734 : // Initialize array to the address of the first element of the STL vector
66735 : // (which is guaranteed to be contiguous storage).
66736 : // SgTemplateClassDeclaration objectArray [] = *(Memory_Block_List.begin());
66737 5342 : if (SgTemplateClassDeclaration::pools.empty() == false)
66738 : {
66739 : // Generate an array of memory pools
66740 145 : SgTemplateClassDeclaration** objectArray = (SgTemplateClassDeclaration**) &(SgTemplateClassDeclaration::pools[0]);
66741 :
66742 : // Build a local variable for better performance
66743 145 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
66744 : #if 0
66745 : // Iterate over the memory pools
66746 : for (unsigned int i=0; i < SgTemplateClassDeclaration::pools.size(); i++)
66747 : {
66748 : // objectArray[i] is a single memory pool
66749 : for (int j=0; j < SgTemplateClassDeclaration::pool_size; j++)
66750 : {
66751 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
66752 : {
66753 : traversal.visit(&(objectArray[i][j]));
66754 : }
66755 : }
66756 : }
66757 : #else
66758 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
66759 : // compute the list first and then call the visit function on each list element.
66760 :
66761 : // printf ("Inside of SgTemplateClassDeclaration::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
66762 :
66763 290 : std::vector<SgTemplateClassDeclaration*> nodeList;
66764 :
66765 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
66766 290 : for (unsigned int i=0; i < SgTemplateClassDeclaration::pools.size(); i++)
66767 : {
66768 : // objectArray[i] is a single memory pool
66769 290145 : for (unsigned j=0; j < SgTemplateClassDeclaration::pool_size; j++)
66770 : {
66771 290000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
66772 : {
66773 146373 : nodeList.push_back(&(objectArray[i][j]));
66774 : }
66775 : }
66776 : }
66777 :
66778 : // Iterate over the saved list
66779 145 : size_t nodeListSize = nodeList.size();
66780 146518 : for (size_t i=0; i < nodeListSize; i++)
66781 : {
66782 146373 : ROSE_ASSERT(nodeList[i] != NULL);
66783 : #if 0
66784 : traversal.visit(nodeList[i]);
66785 : #else
66786 146373 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
66787 : {
66788 146373 : traversal.visit(nodeList[i]);
66789 : }
66790 : #endif
66791 : }
66792 : #endif
66793 : }
66794 :
66795 : // This should not be required since all previously static data members are
66796 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
66797 :
66798 5342 : }
66799 :
66800 :
66801 : void
66802 194 : SgTemplateClassDeclaration::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
66803 : {
66804 : // This function traverses the memory pool for an IR node and
66805 : // calls the function to execute the visitor object.
66806 :
66807 : // Initialize array to the address of the first element of the STL vector
66808 : // (which is guarenteed to be contiguous storage).
66809 : // SgTemplateClassDeclaration objectArray [] = *(Memory_Block_List.begin());
66810 194 : if (SgTemplateClassDeclaration::pools.empty() == false)
66811 : {
66812 : // Generate an array of memory pools
66813 137 : SgTemplateClassDeclaration** objectArray = (SgTemplateClassDeclaration**) &(SgTemplateClassDeclaration::pools[0]);
66814 :
66815 : // Build a local variable for better performance
66816 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
66817 :
66818 : // Iterate over the memory pools
66819 274 : for (unsigned int i=0; i < SgTemplateClassDeclaration::pools.size(); i++)
66820 : {
66821 : // objectArray[i] is a single memory pool
66822 274137 : for (unsigned j=0; j < SgTemplateClassDeclaration::pool_size; j++)
66823 : {
66824 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
66825 : {
66826 : // printf ("Found a valid SgTemplateClassDeclaration object in the memory pool %d at position %d \n",i,j);
66827 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
66828 150086 : objectArray[i][j].executeVisitorMemberFunction(visitor);
66829 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
66830 : }
66831 : else
66832 : {
66833 : // printf ("Found a INVALID SgTemplateClassDeclaration object in the memory pool \n");
66834 : }
66835 : }
66836 : }
66837 : }
66838 :
66839 : // This should not be required since all previously static data members are
66840 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
66841 :
66842 194 : }
66843 :
66844 : void
66845 0 : SgTemplateClassDeclaration::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
66846 : {
66847 : // This function visits only a single IR node of the memory pool.
66848 : // it is typically called once for each type of IR node within
66849 : // the automatically generated function: traverseRepresentativeNodes().
66850 :
66851 : // Initialize array to the address of the first element of the STL vector
66852 : // (which is guarenteed to be contiguous storage).
66853 : // SgTemplateClassDeclaration objectArray [] = *(Memory_Block_List.begin());
66854 0 : if (SgTemplateClassDeclaration::pools.empty() == false)
66855 : {
66856 : // Generate an array of memory pools
66857 0 : SgTemplateClassDeclaration** objectArray = (SgTemplateClassDeclaration**) &(SgTemplateClassDeclaration::pools[0]);
66858 :
66859 : // Build a local variable for better performance
66860 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
66861 :
66862 : // Iterate over the memory pools
66863 0 : bool done = false;
66864 0 : unsigned i=0;
66865 :
66866 : // find the first valid IR node, call visit function, and then leave
66867 0 : while ( done == false && i < SgTemplateClassDeclaration::pools.size() )
66868 : {
66869 : // objectArray[i] is a single memory pool
66870 : unsigned j=0;
66871 0 : while (done == false && j < SgTemplateClassDeclaration::pool_size)
66872 : {
66873 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
66874 : {
66875 0 : traversal.visit(&(objectArray[i][j]));
66876 0 : done = true;
66877 : }
66878 0 : j++;
66879 : }
66880 0 : i++;
66881 : }
66882 :
66883 : #if 0
66884 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
66885 : if (done == false)
66886 : {
66887 : printf ("No representative for SgTemplateClassDeclaration found in memory pools \n");
66888 : }
66889 : #endif
66890 : }
66891 0 : }
66892 :
66893 :
66894 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
66895 : // using values that overflow signed values of int.
66896 : size_t
66897 4 : SgTemplateClassDeclaration::numberOfNodes()
66898 : {
66899 : // This function traverses the memory pool for an IR node and
66900 : // counts the number of IR nodes of a particular Sage III IR
66901 : // nodes type.
66902 :
66903 4 : size_t count = 0;
66904 4 : if (SgTemplateClassDeclaration::pools.empty() == false)
66905 : {
66906 : // Generate an array of memory pools (this is actually a STL vector,
66907 : // but it is contiguious, so OK to treat this way).
66908 1 : SgTemplateClassDeclaration** objectArray = (SgTemplateClassDeclaration**) &(SgTemplateClassDeclaration::pools[0]);
66909 :
66910 : // Build a local variable for better performance (make it a loop invariant variable).
66911 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
66912 :
66913 : // Iterate over all of the memory pools for this IR node.
66914 2 : for (unsigned int i=0; i < SgTemplateClassDeclaration::pools.size(); i++)
66915 : {
66916 : // objectArray[i] is a single memory pool, iterate over all the
66917 : // IR nodes and only count those that are valid IR nodes used in
66918 : // the AST (i.e. allocated IR nodes).
66919 2001 : for (unsigned j=0; j < SgTemplateClassDeclaration::pool_size; j++)
66920 : {
66921 : // This is indexing the STL vector of C/C++ style arrays as a doubly
66922 : // indexed array access. It is OK since we have leveraged the semantics
66923 : // of STL vector memory as contigous and cast the memory as an array
66924 : // of arrays to use the 2D array indexing. Hope this is not confusing,
66925 : // but it s very fast as an implementation.
66926 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
66927 : {
66928 1090 : count++;
66929 : }
66930 : }
66931 : }
66932 : }
66933 :
66934 :
66935 :
66936 4 : return count;
66937 : }
66938 :
66939 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
66940 : // using values that overflow signed values of int.
66941 : size_t
66942 0 : SgTemplateClassDeclaration::memoryUsage()
66943 : {
66944 : // This function is required because we need the class name as a type when we call sizeof
66945 : // There might be another way to implement this if we have a traversal that only called a
66946 : // representative object (one call for each type of Sage IIIIR node).
66947 0 : size_t memory = numberOfNodes() * sizeof(SgTemplateClassDeclaration);
66948 :
66949 0 : return memory;
66950 : }
66951 :
66952 : /* #line 66953 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
66953 :
66954 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
66955 : void
66956 5701 : SgTemplateInstantiationDecl::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
66957 : {
66958 : // This function traverses the memory pool for only a specific IR node
66959 : // and calls the visit function of the input class execute a traversal
66960 : // similar to the style of the attribute based traversals within ROSE.
66961 : // This traversal will visit ALL nodes of the AST where as the other
66962 : // attribute based traversals visit only the embedded tree within the AST.
66963 :
66964 : // Initialize array to the address of the first element of the STL vector
66965 : // (which is guaranteed to be contiguous storage).
66966 : // SgTemplateInstantiationDecl objectArray [] = *(Memory_Block_List.begin());
66967 5701 : if (SgTemplateInstantiationDecl::pools.empty() == false)
66968 : {
66969 : // Generate an array of memory pools
66970 149 : SgTemplateInstantiationDecl** objectArray = (SgTemplateInstantiationDecl**) &(SgTemplateInstantiationDecl::pools[0]);
66971 :
66972 : // Build a local variable for better performance
66973 149 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
66974 : #if 0
66975 : // Iterate over the memory pools
66976 : for (unsigned int i=0; i < SgTemplateInstantiationDecl::pools.size(); i++)
66977 : {
66978 : // objectArray[i] is a single memory pool
66979 : for (int j=0; j < SgTemplateInstantiationDecl::pool_size; j++)
66980 : {
66981 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
66982 : {
66983 : traversal.visit(&(objectArray[i][j]));
66984 : }
66985 : }
66986 : }
66987 : #else
66988 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
66989 : // compute the list first and then call the visit function on each list element.
66990 :
66991 : // printf ("Inside of SgTemplateInstantiationDecl::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
66992 :
66993 298 : std::vector<SgTemplateInstantiationDecl*> nodeList;
66994 :
66995 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
66996 298 : for (unsigned int i=0; i < SgTemplateInstantiationDecl::pools.size(); i++)
66997 : {
66998 : // objectArray[i] is a single memory pool
66999 298149 : for (unsigned j=0; j < SgTemplateInstantiationDecl::pool_size; j++)
67000 : {
67001 298000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
67002 : {
67003 179284 : nodeList.push_back(&(objectArray[i][j]));
67004 : }
67005 : }
67006 : }
67007 :
67008 : // Iterate over the saved list
67009 149 : size_t nodeListSize = nodeList.size();
67010 179433 : for (size_t i=0; i < nodeListSize; i++)
67011 : {
67012 179284 : ROSE_ASSERT(nodeList[i] != NULL);
67013 : #if 0
67014 : traversal.visit(nodeList[i]);
67015 : #else
67016 179284 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
67017 : {
67018 179284 : traversal.visit(nodeList[i]);
67019 : }
67020 : #endif
67021 : }
67022 : #endif
67023 : }
67024 :
67025 : // This should not be required since all previously static data members are
67026 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
67027 :
67028 5701 : }
67029 :
67030 :
67031 : void
67032 194 : SgTemplateInstantiationDecl::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
67033 : {
67034 : // This function traverses the memory pool for an IR node and
67035 : // calls the function to execute the visitor object.
67036 :
67037 : // Initialize array to the address of the first element of the STL vector
67038 : // (which is guarenteed to be contiguous storage).
67039 : // SgTemplateInstantiationDecl objectArray [] = *(Memory_Block_List.begin());
67040 194 : if (SgTemplateInstantiationDecl::pools.empty() == false)
67041 : {
67042 : // Generate an array of memory pools
67043 137 : SgTemplateInstantiationDecl** objectArray = (SgTemplateInstantiationDecl**) &(SgTemplateInstantiationDecl::pools[0]);
67044 :
67045 : // Build a local variable for better performance
67046 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
67047 :
67048 : // Iterate over the memory pools
67049 274 : for (unsigned int i=0; i < SgTemplateInstantiationDecl::pools.size(); i++)
67050 : {
67051 : // objectArray[i] is a single memory pool
67052 274137 : for (unsigned j=0; j < SgTemplateInstantiationDecl::pool_size; j++)
67053 : {
67054 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
67055 : {
67056 : // printf ("Found a valid SgTemplateInstantiationDecl object in the memory pool %d at position %d \n",i,j);
67057 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
67058 183029 : objectArray[i][j].executeVisitorMemberFunction(visitor);
67059 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
67060 : }
67061 : else
67062 : {
67063 : // printf ("Found a INVALID SgTemplateInstantiationDecl object in the memory pool \n");
67064 : }
67065 : }
67066 : }
67067 : }
67068 :
67069 : // This should not be required since all previously static data members are
67070 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
67071 :
67072 194 : }
67073 :
67074 : void
67075 0 : SgTemplateInstantiationDecl::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
67076 : {
67077 : // This function visits only a single IR node of the memory pool.
67078 : // it is typically called once for each type of IR node within
67079 : // the automatically generated function: traverseRepresentativeNodes().
67080 :
67081 : // Initialize array to the address of the first element of the STL vector
67082 : // (which is guarenteed to be contiguous storage).
67083 : // SgTemplateInstantiationDecl objectArray [] = *(Memory_Block_List.begin());
67084 0 : if (SgTemplateInstantiationDecl::pools.empty() == false)
67085 : {
67086 : // Generate an array of memory pools
67087 0 : SgTemplateInstantiationDecl** objectArray = (SgTemplateInstantiationDecl**) &(SgTemplateInstantiationDecl::pools[0]);
67088 :
67089 : // Build a local variable for better performance
67090 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
67091 :
67092 : // Iterate over the memory pools
67093 0 : bool done = false;
67094 0 : unsigned i=0;
67095 :
67096 : // find the first valid IR node, call visit function, and then leave
67097 0 : while ( done == false && i < SgTemplateInstantiationDecl::pools.size() )
67098 : {
67099 : // objectArray[i] is a single memory pool
67100 : unsigned j=0;
67101 0 : while (done == false && j < SgTemplateInstantiationDecl::pool_size)
67102 : {
67103 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
67104 : {
67105 0 : traversal.visit(&(objectArray[i][j]));
67106 0 : done = true;
67107 : }
67108 0 : j++;
67109 : }
67110 0 : i++;
67111 : }
67112 :
67113 : #if 0
67114 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
67115 : if (done == false)
67116 : {
67117 : printf ("No representative for SgTemplateInstantiationDecl found in memory pools \n");
67118 : }
67119 : #endif
67120 : }
67121 0 : }
67122 :
67123 :
67124 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
67125 : // using values that overflow signed values of int.
67126 : size_t
67127 4 : SgTemplateInstantiationDecl::numberOfNodes()
67128 : {
67129 : // This function traverses the memory pool for an IR node and
67130 : // counts the number of IR nodes of a particular Sage III IR
67131 : // nodes type.
67132 :
67133 4 : size_t count = 0;
67134 4 : if (SgTemplateInstantiationDecl::pools.empty() == false)
67135 : {
67136 : // Generate an array of memory pools (this is actually a STL vector,
67137 : // but it is contiguious, so OK to treat this way).
67138 1 : SgTemplateInstantiationDecl** objectArray = (SgTemplateInstantiationDecl**) &(SgTemplateInstantiationDecl::pools[0]);
67139 :
67140 : // Build a local variable for better performance (make it a loop invariant variable).
67141 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
67142 :
67143 : // Iterate over all of the memory pools for this IR node.
67144 2 : for (unsigned int i=0; i < SgTemplateInstantiationDecl::pools.size(); i++)
67145 : {
67146 : // objectArray[i] is a single memory pool, iterate over all the
67147 : // IR nodes and only count those that are valid IR nodes used in
67148 : // the AST (i.e. allocated IR nodes).
67149 2001 : for (unsigned j=0; j < SgTemplateInstantiationDecl::pool_size; j++)
67150 : {
67151 : // This is indexing the STL vector of C/C++ style arrays as a doubly
67152 : // indexed array access. It is OK since we have leveraged the semantics
67153 : // of STL vector memory as contigous and cast the memory as an array
67154 : // of arrays to use the 2D array indexing. Hope this is not confusing,
67155 : // but it s very fast as an implementation.
67156 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
67157 : {
67158 1319 : count++;
67159 : }
67160 : }
67161 : }
67162 : }
67163 :
67164 :
67165 :
67166 4 : return count;
67167 : }
67168 :
67169 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
67170 : // using values that overflow signed values of int.
67171 : size_t
67172 0 : SgTemplateInstantiationDecl::memoryUsage()
67173 : {
67174 : // This function is required because we need the class name as a type when we call sizeof
67175 : // There might be another way to implement this if we have a traversal that only called a
67176 : // representative object (one call for each type of Sage IIIIR node).
67177 0 : size_t memory = numberOfNodes() * sizeof(SgTemplateInstantiationDecl);
67178 :
67179 0 : return memory;
67180 : }
67181 :
67182 : /* #line 67183 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
67183 :
67184 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
67185 : void
67186 5342 : SgDerivedTypeStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
67187 : {
67188 : // This function traverses the memory pool for only a specific IR node
67189 : // and calls the visit function of the input class execute a traversal
67190 : // similar to the style of the attribute based traversals within ROSE.
67191 : // This traversal will visit ALL nodes of the AST where as the other
67192 : // attribute based traversals visit only the embedded tree within the AST.
67193 :
67194 : // Initialize array to the address of the first element of the STL vector
67195 : // (which is guaranteed to be contiguous storage).
67196 : // SgDerivedTypeStatement objectArray [] = *(Memory_Block_List.begin());
67197 5342 : if (SgDerivedTypeStatement::pools.empty() == false)
67198 : {
67199 : // Generate an array of memory pools
67200 0 : SgDerivedTypeStatement** objectArray = (SgDerivedTypeStatement**) &(SgDerivedTypeStatement::pools[0]);
67201 :
67202 : // Build a local variable for better performance
67203 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
67204 : #if 0
67205 : // Iterate over the memory pools
67206 : for (unsigned int i=0; i < SgDerivedTypeStatement::pools.size(); i++)
67207 : {
67208 : // objectArray[i] is a single memory pool
67209 : for (int j=0; j < SgDerivedTypeStatement::pool_size; j++)
67210 : {
67211 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
67212 : {
67213 : traversal.visit(&(objectArray[i][j]));
67214 : }
67215 : }
67216 : }
67217 : #else
67218 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
67219 : // compute the list first and then call the visit function on each list element.
67220 :
67221 : // printf ("Inside of SgDerivedTypeStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
67222 :
67223 0 : std::vector<SgDerivedTypeStatement*> nodeList;
67224 :
67225 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
67226 0 : for (unsigned int i=0; i < SgDerivedTypeStatement::pools.size(); i++)
67227 : {
67228 : // objectArray[i] is a single memory pool
67229 0 : for (unsigned j=0; j < SgDerivedTypeStatement::pool_size; j++)
67230 : {
67231 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
67232 : {
67233 0 : nodeList.push_back(&(objectArray[i][j]));
67234 : }
67235 : }
67236 : }
67237 :
67238 : // Iterate over the saved list
67239 0 : size_t nodeListSize = nodeList.size();
67240 0 : for (size_t i=0; i < nodeListSize; i++)
67241 : {
67242 0 : ROSE_ASSERT(nodeList[i] != NULL);
67243 : #if 0
67244 : traversal.visit(nodeList[i]);
67245 : #else
67246 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
67247 : {
67248 0 : traversal.visit(nodeList[i]);
67249 : }
67250 : #endif
67251 : }
67252 : #endif
67253 : }
67254 :
67255 : // This should not be required since all previously static data members are
67256 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
67257 :
67258 5342 : }
67259 :
67260 :
67261 : void
67262 194 : SgDerivedTypeStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
67263 : {
67264 : // This function traverses the memory pool for an IR node and
67265 : // calls the function to execute the visitor object.
67266 :
67267 : // Initialize array to the address of the first element of the STL vector
67268 : // (which is guarenteed to be contiguous storage).
67269 : // SgDerivedTypeStatement objectArray [] = *(Memory_Block_List.begin());
67270 194 : if (SgDerivedTypeStatement::pools.empty() == false)
67271 : {
67272 : // Generate an array of memory pools
67273 0 : SgDerivedTypeStatement** objectArray = (SgDerivedTypeStatement**) &(SgDerivedTypeStatement::pools[0]);
67274 :
67275 : // Build a local variable for better performance
67276 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
67277 :
67278 : // Iterate over the memory pools
67279 0 : for (unsigned int i=0; i < SgDerivedTypeStatement::pools.size(); i++)
67280 : {
67281 : // objectArray[i] is a single memory pool
67282 0 : for (unsigned j=0; j < SgDerivedTypeStatement::pool_size; j++)
67283 : {
67284 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
67285 : {
67286 : // printf ("Found a valid SgDerivedTypeStatement object in the memory pool %d at position %d \n",i,j);
67287 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
67288 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
67289 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
67290 : }
67291 : else
67292 : {
67293 : // printf ("Found a INVALID SgDerivedTypeStatement object in the memory pool \n");
67294 : }
67295 : }
67296 : }
67297 : }
67298 :
67299 : // This should not be required since all previously static data members are
67300 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
67301 :
67302 194 : }
67303 :
67304 : void
67305 0 : SgDerivedTypeStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
67306 : {
67307 : // This function visits only a single IR node of the memory pool.
67308 : // it is typically called once for each type of IR node within
67309 : // the automatically generated function: traverseRepresentativeNodes().
67310 :
67311 : // Initialize array to the address of the first element of the STL vector
67312 : // (which is guarenteed to be contiguous storage).
67313 : // SgDerivedTypeStatement objectArray [] = *(Memory_Block_List.begin());
67314 0 : if (SgDerivedTypeStatement::pools.empty() == false)
67315 : {
67316 : // Generate an array of memory pools
67317 0 : SgDerivedTypeStatement** objectArray = (SgDerivedTypeStatement**) &(SgDerivedTypeStatement::pools[0]);
67318 :
67319 : // Build a local variable for better performance
67320 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
67321 :
67322 : // Iterate over the memory pools
67323 0 : bool done = false;
67324 0 : unsigned i=0;
67325 :
67326 : // find the first valid IR node, call visit function, and then leave
67327 0 : while ( done == false && i < SgDerivedTypeStatement::pools.size() )
67328 : {
67329 : // objectArray[i] is a single memory pool
67330 : unsigned j=0;
67331 0 : while (done == false && j < SgDerivedTypeStatement::pool_size)
67332 : {
67333 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
67334 : {
67335 0 : traversal.visit(&(objectArray[i][j]));
67336 0 : done = true;
67337 : }
67338 0 : j++;
67339 : }
67340 0 : i++;
67341 : }
67342 :
67343 : #if 0
67344 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
67345 : if (done == false)
67346 : {
67347 : printf ("No representative for SgDerivedTypeStatement found in memory pools \n");
67348 : }
67349 : #endif
67350 : }
67351 0 : }
67352 :
67353 :
67354 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
67355 : // using values that overflow signed values of int.
67356 : size_t
67357 4 : SgDerivedTypeStatement::numberOfNodes()
67358 : {
67359 : // This function traverses the memory pool for an IR node and
67360 : // counts the number of IR nodes of a particular Sage III IR
67361 : // nodes type.
67362 :
67363 4 : size_t count = 0;
67364 4 : if (SgDerivedTypeStatement::pools.empty() == false)
67365 : {
67366 : // Generate an array of memory pools (this is actually a STL vector,
67367 : // but it is contiguious, so OK to treat this way).
67368 0 : SgDerivedTypeStatement** objectArray = (SgDerivedTypeStatement**) &(SgDerivedTypeStatement::pools[0]);
67369 :
67370 : // Build a local variable for better performance (make it a loop invariant variable).
67371 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
67372 :
67373 : // Iterate over all of the memory pools for this IR node.
67374 0 : for (unsigned int i=0; i < SgDerivedTypeStatement::pools.size(); i++)
67375 : {
67376 : // objectArray[i] is a single memory pool, iterate over all the
67377 : // IR nodes and only count those that are valid IR nodes used in
67378 : // the AST (i.e. allocated IR nodes).
67379 0 : for (unsigned j=0; j < SgDerivedTypeStatement::pool_size; j++)
67380 : {
67381 : // This is indexing the STL vector of C/C++ style arrays as a doubly
67382 : // indexed array access. It is OK since we have leveraged the semantics
67383 : // of STL vector memory as contigous and cast the memory as an array
67384 : // of arrays to use the 2D array indexing. Hope this is not confusing,
67385 : // but it s very fast as an implementation.
67386 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
67387 : {
67388 0 : count++;
67389 : }
67390 : }
67391 : }
67392 : }
67393 :
67394 :
67395 :
67396 4 : return count;
67397 : }
67398 :
67399 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
67400 : // using values that overflow signed values of int.
67401 : size_t
67402 0 : SgDerivedTypeStatement::memoryUsage()
67403 : {
67404 : // This function is required because we need the class name as a type when we call sizeof
67405 : // There might be another way to implement this if we have a traversal that only called a
67406 : // representative object (one call for each type of Sage IIIIR node).
67407 0 : size_t memory = numberOfNodes() * sizeof(SgDerivedTypeStatement);
67408 :
67409 0 : return memory;
67410 : }
67411 :
67412 : /* #line 67413 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
67413 :
67414 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
67415 : void
67416 5342 : SgModuleStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
67417 : {
67418 : // This function traverses the memory pool for only a specific IR node
67419 : // and calls the visit function of the input class execute a traversal
67420 : // similar to the style of the attribute based traversals within ROSE.
67421 : // This traversal will visit ALL nodes of the AST where as the other
67422 : // attribute based traversals visit only the embedded tree within the AST.
67423 :
67424 : // Initialize array to the address of the first element of the STL vector
67425 : // (which is guaranteed to be contiguous storage).
67426 : // SgModuleStatement objectArray [] = *(Memory_Block_List.begin());
67427 5342 : if (SgModuleStatement::pools.empty() == false)
67428 : {
67429 : // Generate an array of memory pools
67430 0 : SgModuleStatement** objectArray = (SgModuleStatement**) &(SgModuleStatement::pools[0]);
67431 :
67432 : // Build a local variable for better performance
67433 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
67434 : #if 0
67435 : // Iterate over the memory pools
67436 : for (unsigned int i=0; i < SgModuleStatement::pools.size(); i++)
67437 : {
67438 : // objectArray[i] is a single memory pool
67439 : for (int j=0; j < SgModuleStatement::pool_size; j++)
67440 : {
67441 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
67442 : {
67443 : traversal.visit(&(objectArray[i][j]));
67444 : }
67445 : }
67446 : }
67447 : #else
67448 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
67449 : // compute the list first and then call the visit function on each list element.
67450 :
67451 : // printf ("Inside of SgModuleStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
67452 :
67453 0 : std::vector<SgModuleStatement*> nodeList;
67454 :
67455 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
67456 0 : for (unsigned int i=0; i < SgModuleStatement::pools.size(); i++)
67457 : {
67458 : // objectArray[i] is a single memory pool
67459 0 : for (unsigned j=0; j < SgModuleStatement::pool_size; j++)
67460 : {
67461 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
67462 : {
67463 0 : nodeList.push_back(&(objectArray[i][j]));
67464 : }
67465 : }
67466 : }
67467 :
67468 : // Iterate over the saved list
67469 0 : size_t nodeListSize = nodeList.size();
67470 0 : for (size_t i=0; i < nodeListSize; i++)
67471 : {
67472 0 : ROSE_ASSERT(nodeList[i] != NULL);
67473 : #if 0
67474 : traversal.visit(nodeList[i]);
67475 : #else
67476 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
67477 : {
67478 0 : traversal.visit(nodeList[i]);
67479 : }
67480 : #endif
67481 : }
67482 : #endif
67483 : }
67484 :
67485 : // This should not be required since all previously static data members are
67486 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
67487 :
67488 5342 : }
67489 :
67490 :
67491 : void
67492 194 : SgModuleStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
67493 : {
67494 : // This function traverses the memory pool for an IR node and
67495 : // calls the function to execute the visitor object.
67496 :
67497 : // Initialize array to the address of the first element of the STL vector
67498 : // (which is guarenteed to be contiguous storage).
67499 : // SgModuleStatement objectArray [] = *(Memory_Block_List.begin());
67500 194 : if (SgModuleStatement::pools.empty() == false)
67501 : {
67502 : // Generate an array of memory pools
67503 0 : SgModuleStatement** objectArray = (SgModuleStatement**) &(SgModuleStatement::pools[0]);
67504 :
67505 : // Build a local variable for better performance
67506 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
67507 :
67508 : // Iterate over the memory pools
67509 0 : for (unsigned int i=0; i < SgModuleStatement::pools.size(); i++)
67510 : {
67511 : // objectArray[i] is a single memory pool
67512 0 : for (unsigned j=0; j < SgModuleStatement::pool_size; j++)
67513 : {
67514 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
67515 : {
67516 : // printf ("Found a valid SgModuleStatement object in the memory pool %d at position %d \n",i,j);
67517 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
67518 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
67519 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
67520 : }
67521 : else
67522 : {
67523 : // printf ("Found a INVALID SgModuleStatement object in the memory pool \n");
67524 : }
67525 : }
67526 : }
67527 : }
67528 :
67529 : // This should not be required since all previously static data members are
67530 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
67531 :
67532 194 : }
67533 :
67534 : void
67535 0 : SgModuleStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
67536 : {
67537 : // This function visits only a single IR node of the memory pool.
67538 : // it is typically called once for each type of IR node within
67539 : // the automatically generated function: traverseRepresentativeNodes().
67540 :
67541 : // Initialize array to the address of the first element of the STL vector
67542 : // (which is guarenteed to be contiguous storage).
67543 : // SgModuleStatement objectArray [] = *(Memory_Block_List.begin());
67544 0 : if (SgModuleStatement::pools.empty() == false)
67545 : {
67546 : // Generate an array of memory pools
67547 0 : SgModuleStatement** objectArray = (SgModuleStatement**) &(SgModuleStatement::pools[0]);
67548 :
67549 : // Build a local variable for better performance
67550 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
67551 :
67552 : // Iterate over the memory pools
67553 0 : bool done = false;
67554 0 : unsigned i=0;
67555 :
67556 : // find the first valid IR node, call visit function, and then leave
67557 0 : while ( done == false && i < SgModuleStatement::pools.size() )
67558 : {
67559 : // objectArray[i] is a single memory pool
67560 : unsigned j=0;
67561 0 : while (done == false && j < SgModuleStatement::pool_size)
67562 : {
67563 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
67564 : {
67565 0 : traversal.visit(&(objectArray[i][j]));
67566 0 : done = true;
67567 : }
67568 0 : j++;
67569 : }
67570 0 : i++;
67571 : }
67572 :
67573 : #if 0
67574 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
67575 : if (done == false)
67576 : {
67577 : printf ("No representative for SgModuleStatement found in memory pools \n");
67578 : }
67579 : #endif
67580 : }
67581 0 : }
67582 :
67583 :
67584 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
67585 : // using values that overflow signed values of int.
67586 : size_t
67587 4 : SgModuleStatement::numberOfNodes()
67588 : {
67589 : // This function traverses the memory pool for an IR node and
67590 : // counts the number of IR nodes of a particular Sage III IR
67591 : // nodes type.
67592 :
67593 4 : size_t count = 0;
67594 4 : if (SgModuleStatement::pools.empty() == false)
67595 : {
67596 : // Generate an array of memory pools (this is actually a STL vector,
67597 : // but it is contiguious, so OK to treat this way).
67598 0 : SgModuleStatement** objectArray = (SgModuleStatement**) &(SgModuleStatement::pools[0]);
67599 :
67600 : // Build a local variable for better performance (make it a loop invariant variable).
67601 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
67602 :
67603 : // Iterate over all of the memory pools for this IR node.
67604 0 : for (unsigned int i=0; i < SgModuleStatement::pools.size(); i++)
67605 : {
67606 : // objectArray[i] is a single memory pool, iterate over all the
67607 : // IR nodes and only count those that are valid IR nodes used in
67608 : // the AST (i.e. allocated IR nodes).
67609 0 : for (unsigned j=0; j < SgModuleStatement::pool_size; j++)
67610 : {
67611 : // This is indexing the STL vector of C/C++ style arrays as a doubly
67612 : // indexed array access. It is OK since we have leveraged the semantics
67613 : // of STL vector memory as contigous and cast the memory as an array
67614 : // of arrays to use the 2D array indexing. Hope this is not confusing,
67615 : // but it s very fast as an implementation.
67616 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
67617 : {
67618 0 : count++;
67619 : }
67620 : }
67621 : }
67622 : }
67623 :
67624 :
67625 :
67626 4 : return count;
67627 : }
67628 :
67629 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
67630 : // using values that overflow signed values of int.
67631 : size_t
67632 0 : SgModuleStatement::memoryUsage()
67633 : {
67634 : // This function is required because we need the class name as a type when we call sizeof
67635 : // There might be another way to implement this if we have a traversal that only called a
67636 : // representative object (one call for each type of Sage IIIIR node).
67637 0 : size_t memory = numberOfNodes() * sizeof(SgModuleStatement);
67638 :
67639 0 : return memory;
67640 : }
67641 :
67642 : /* #line 67643 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
67643 :
67644 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
67645 : void
67646 5342 : SgImplicitStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
67647 : {
67648 : // This function traverses the memory pool for only a specific IR node
67649 : // and calls the visit function of the input class execute a traversal
67650 : // similar to the style of the attribute based traversals within ROSE.
67651 : // This traversal will visit ALL nodes of the AST where as the other
67652 : // attribute based traversals visit only the embedded tree within the AST.
67653 :
67654 : // Initialize array to the address of the first element of the STL vector
67655 : // (which is guaranteed to be contiguous storage).
67656 : // SgImplicitStatement objectArray [] = *(Memory_Block_List.begin());
67657 5342 : if (SgImplicitStatement::pools.empty() == false)
67658 : {
67659 : // Generate an array of memory pools
67660 120 : SgImplicitStatement** objectArray = (SgImplicitStatement**) &(SgImplicitStatement::pools[0]);
67661 :
67662 : // Build a local variable for better performance
67663 120 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
67664 : #if 0
67665 : // Iterate over the memory pools
67666 : for (unsigned int i=0; i < SgImplicitStatement::pools.size(); i++)
67667 : {
67668 : // objectArray[i] is a single memory pool
67669 : for (int j=0; j < SgImplicitStatement::pool_size; j++)
67670 : {
67671 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
67672 : {
67673 : traversal.visit(&(objectArray[i][j]));
67674 : }
67675 : }
67676 : }
67677 : #else
67678 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
67679 : // compute the list first and then call the visit function on each list element.
67680 :
67681 : // printf ("Inside of SgImplicitStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
67682 :
67683 240 : std::vector<SgImplicitStatement*> nodeList;
67684 :
67685 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
67686 240 : for (unsigned int i=0; i < SgImplicitStatement::pools.size(); i++)
67687 : {
67688 : // objectArray[i] is a single memory pool
67689 240120 : for (unsigned j=0; j < SgImplicitStatement::pool_size; j++)
67690 : {
67691 240000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
67692 : {
67693 120 : nodeList.push_back(&(objectArray[i][j]));
67694 : }
67695 : }
67696 : }
67697 :
67698 : // Iterate over the saved list
67699 120 : size_t nodeListSize = nodeList.size();
67700 240 : for (size_t i=0; i < nodeListSize; i++)
67701 : {
67702 120 : ROSE_ASSERT(nodeList[i] != NULL);
67703 : #if 0
67704 : traversal.visit(nodeList[i]);
67705 : #else
67706 120 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
67707 : {
67708 120 : traversal.visit(nodeList[i]);
67709 : }
67710 : #endif
67711 : }
67712 : #endif
67713 : }
67714 :
67715 : // This should not be required since all previously static data members are
67716 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
67717 :
67718 5342 : }
67719 :
67720 :
67721 : void
67722 194 : SgImplicitStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
67723 : {
67724 : // This function traverses the memory pool for an IR node and
67725 : // calls the function to execute the visitor object.
67726 :
67727 : // Initialize array to the address of the first element of the STL vector
67728 : // (which is guarenteed to be contiguous storage).
67729 : // SgImplicitStatement objectArray [] = *(Memory_Block_List.begin());
67730 194 : if (SgImplicitStatement::pools.empty() == false)
67731 : {
67732 : // Generate an array of memory pools
67733 0 : SgImplicitStatement** objectArray = (SgImplicitStatement**) &(SgImplicitStatement::pools[0]);
67734 :
67735 : // Build a local variable for better performance
67736 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
67737 :
67738 : // Iterate over the memory pools
67739 0 : for (unsigned int i=0; i < SgImplicitStatement::pools.size(); i++)
67740 : {
67741 : // objectArray[i] is a single memory pool
67742 0 : for (unsigned j=0; j < SgImplicitStatement::pool_size; j++)
67743 : {
67744 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
67745 : {
67746 : // printf ("Found a valid SgImplicitStatement object in the memory pool %d at position %d \n",i,j);
67747 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
67748 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
67749 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
67750 : }
67751 : else
67752 : {
67753 : // printf ("Found a INVALID SgImplicitStatement object in the memory pool \n");
67754 : }
67755 : }
67756 : }
67757 : }
67758 :
67759 : // This should not be required since all previously static data members are
67760 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
67761 :
67762 194 : }
67763 :
67764 : void
67765 0 : SgImplicitStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
67766 : {
67767 : // This function visits only a single IR node of the memory pool.
67768 : // it is typically called once for each type of IR node within
67769 : // the automatically generated function: traverseRepresentativeNodes().
67770 :
67771 : // Initialize array to the address of the first element of the STL vector
67772 : // (which is guarenteed to be contiguous storage).
67773 : // SgImplicitStatement objectArray [] = *(Memory_Block_List.begin());
67774 0 : if (SgImplicitStatement::pools.empty() == false)
67775 : {
67776 : // Generate an array of memory pools
67777 0 : SgImplicitStatement** objectArray = (SgImplicitStatement**) &(SgImplicitStatement::pools[0]);
67778 :
67779 : // Build a local variable for better performance
67780 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
67781 :
67782 : // Iterate over the memory pools
67783 0 : bool done = false;
67784 0 : unsigned i=0;
67785 :
67786 : // find the first valid IR node, call visit function, and then leave
67787 0 : while ( done == false && i < SgImplicitStatement::pools.size() )
67788 : {
67789 : // objectArray[i] is a single memory pool
67790 : unsigned j=0;
67791 0 : while (done == false && j < SgImplicitStatement::pool_size)
67792 : {
67793 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
67794 : {
67795 0 : traversal.visit(&(objectArray[i][j]));
67796 0 : done = true;
67797 : }
67798 0 : j++;
67799 : }
67800 0 : i++;
67801 : }
67802 :
67803 : #if 0
67804 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
67805 : if (done == false)
67806 : {
67807 : printf ("No representative for SgImplicitStatement found in memory pools \n");
67808 : }
67809 : #endif
67810 : }
67811 0 : }
67812 :
67813 :
67814 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
67815 : // using values that overflow signed values of int.
67816 : size_t
67817 4 : SgImplicitStatement::numberOfNodes()
67818 : {
67819 : // This function traverses the memory pool for an IR node and
67820 : // counts the number of IR nodes of a particular Sage III IR
67821 : // nodes type.
67822 :
67823 4 : size_t count = 0;
67824 4 : if (SgImplicitStatement::pools.empty() == false)
67825 : {
67826 : // Generate an array of memory pools (this is actually a STL vector,
67827 : // but it is contiguious, so OK to treat this way).
67828 0 : SgImplicitStatement** objectArray = (SgImplicitStatement**) &(SgImplicitStatement::pools[0]);
67829 :
67830 : // Build a local variable for better performance (make it a loop invariant variable).
67831 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
67832 :
67833 : // Iterate over all of the memory pools for this IR node.
67834 0 : for (unsigned int i=0; i < SgImplicitStatement::pools.size(); i++)
67835 : {
67836 : // objectArray[i] is a single memory pool, iterate over all the
67837 : // IR nodes and only count those that are valid IR nodes used in
67838 : // the AST (i.e. allocated IR nodes).
67839 0 : for (unsigned j=0; j < SgImplicitStatement::pool_size; j++)
67840 : {
67841 : // This is indexing the STL vector of C/C++ style arrays as a doubly
67842 : // indexed array access. It is OK since we have leveraged the semantics
67843 : // of STL vector memory as contigous and cast the memory as an array
67844 : // of arrays to use the 2D array indexing. Hope this is not confusing,
67845 : // but it s very fast as an implementation.
67846 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
67847 : {
67848 0 : count++;
67849 : }
67850 : }
67851 : }
67852 : }
67853 :
67854 :
67855 :
67856 4 : return count;
67857 : }
67858 :
67859 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
67860 : // using values that overflow signed values of int.
67861 : size_t
67862 0 : SgImplicitStatement::memoryUsage()
67863 : {
67864 : // This function is required because we need the class name as a type when we call sizeof
67865 : // There might be another way to implement this if we have a traversal that only called a
67866 : // representative object (one call for each type of Sage IIIIR node).
67867 0 : size_t memory = numberOfNodes() * sizeof(SgImplicitStatement);
67868 :
67869 0 : return memory;
67870 : }
67871 :
67872 : /* #line 67873 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
67873 :
67874 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
67875 : void
67876 5342 : SgUsingDeclarationStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
67877 : {
67878 : // This function traverses the memory pool for only a specific IR node
67879 : // and calls the visit function of the input class execute a traversal
67880 : // similar to the style of the attribute based traversals within ROSE.
67881 : // This traversal will visit ALL nodes of the AST where as the other
67882 : // attribute based traversals visit only the embedded tree within the AST.
67883 :
67884 : // Initialize array to the address of the first element of the STL vector
67885 : // (which is guaranteed to be contiguous storage).
67886 : // SgUsingDeclarationStatement objectArray [] = *(Memory_Block_List.begin());
67887 5342 : if (SgUsingDeclarationStatement::pools.empty() == false)
67888 : {
67889 : // Generate an array of memory pools
67890 183 : SgUsingDeclarationStatement** objectArray = (SgUsingDeclarationStatement**) &(SgUsingDeclarationStatement::pools[0]);
67891 :
67892 : // Build a local variable for better performance
67893 183 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
67894 : #if 0
67895 : // Iterate over the memory pools
67896 : for (unsigned int i=0; i < SgUsingDeclarationStatement::pools.size(); i++)
67897 : {
67898 : // objectArray[i] is a single memory pool
67899 : for (int j=0; j < SgUsingDeclarationStatement::pool_size; j++)
67900 : {
67901 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
67902 : {
67903 : traversal.visit(&(objectArray[i][j]));
67904 : }
67905 : }
67906 : }
67907 : #else
67908 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
67909 : // compute the list first and then call the visit function on each list element.
67910 :
67911 : // printf ("Inside of SgUsingDeclarationStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
67912 :
67913 366 : std::vector<SgUsingDeclarationStatement*> nodeList;
67914 :
67915 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
67916 366 : for (unsigned int i=0; i < SgUsingDeclarationStatement::pools.size(); i++)
67917 : {
67918 : // objectArray[i] is a single memory pool
67919 366183 : for (unsigned j=0; j < SgUsingDeclarationStatement::pool_size; j++)
67920 : {
67921 366000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
67922 : {
67923 42470 : nodeList.push_back(&(objectArray[i][j]));
67924 : }
67925 : }
67926 : }
67927 :
67928 : // Iterate over the saved list
67929 183 : size_t nodeListSize = nodeList.size();
67930 42653 : for (size_t i=0; i < nodeListSize; i++)
67931 : {
67932 42470 : ROSE_ASSERT(nodeList[i] != NULL);
67933 : #if 0
67934 : traversal.visit(nodeList[i]);
67935 : #else
67936 42470 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
67937 : {
67938 42470 : traversal.visit(nodeList[i]);
67939 : }
67940 : #endif
67941 : }
67942 : #endif
67943 : }
67944 :
67945 : // This should not be required since all previously static data members are
67946 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
67947 :
67948 5342 : }
67949 :
67950 :
67951 : void
67952 194 : SgUsingDeclarationStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
67953 : {
67954 : // This function traverses the memory pool for an IR node and
67955 : // calls the function to execute the visitor object.
67956 :
67957 : // Initialize array to the address of the first element of the STL vector
67958 : // (which is guarenteed to be contiguous storage).
67959 : // SgUsingDeclarationStatement objectArray [] = *(Memory_Block_List.begin());
67960 194 : if (SgUsingDeclarationStatement::pools.empty() == false)
67961 : {
67962 : // Generate an array of memory pools
67963 137 : SgUsingDeclarationStatement** objectArray = (SgUsingDeclarationStatement**) &(SgUsingDeclarationStatement::pools[0]);
67964 :
67965 : // Build a local variable for better performance
67966 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
67967 :
67968 : // Iterate over the memory pools
67969 274 : for (unsigned int i=0; i < SgUsingDeclarationStatement::pools.size(); i++)
67970 : {
67971 : // objectArray[i] is a single memory pool
67972 274137 : for (unsigned j=0; j < SgUsingDeclarationStatement::pool_size; j++)
67973 : {
67974 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
67975 : {
67976 : // printf ("Found a valid SgUsingDeclarationStatement object in the memory pool %d at position %d \n",i,j);
67977 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
67978 38383 : objectArray[i][j].executeVisitorMemberFunction(visitor);
67979 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
67980 : }
67981 : else
67982 : {
67983 : // printf ("Found a INVALID SgUsingDeclarationStatement object in the memory pool \n");
67984 : }
67985 : }
67986 : }
67987 : }
67988 :
67989 : // This should not be required since all previously static data members are
67990 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
67991 :
67992 194 : }
67993 :
67994 : void
67995 0 : SgUsingDeclarationStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
67996 : {
67997 : // This function visits only a single IR node of the memory pool.
67998 : // it is typically called once for each type of IR node within
67999 : // the automatically generated function: traverseRepresentativeNodes().
68000 :
68001 : // Initialize array to the address of the first element of the STL vector
68002 : // (which is guarenteed to be contiguous storage).
68003 : // SgUsingDeclarationStatement objectArray [] = *(Memory_Block_List.begin());
68004 0 : if (SgUsingDeclarationStatement::pools.empty() == false)
68005 : {
68006 : // Generate an array of memory pools
68007 0 : SgUsingDeclarationStatement** objectArray = (SgUsingDeclarationStatement**) &(SgUsingDeclarationStatement::pools[0]);
68008 :
68009 : // Build a local variable for better performance
68010 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
68011 :
68012 : // Iterate over the memory pools
68013 0 : bool done = false;
68014 0 : unsigned i=0;
68015 :
68016 : // find the first valid IR node, call visit function, and then leave
68017 0 : while ( done == false && i < SgUsingDeclarationStatement::pools.size() )
68018 : {
68019 : // objectArray[i] is a single memory pool
68020 : unsigned j=0;
68021 0 : while (done == false && j < SgUsingDeclarationStatement::pool_size)
68022 : {
68023 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
68024 : {
68025 0 : traversal.visit(&(objectArray[i][j]));
68026 0 : done = true;
68027 : }
68028 0 : j++;
68029 : }
68030 0 : i++;
68031 : }
68032 :
68033 : #if 0
68034 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
68035 : if (done == false)
68036 : {
68037 : printf ("No representative for SgUsingDeclarationStatement found in memory pools \n");
68038 : }
68039 : #endif
68040 : }
68041 0 : }
68042 :
68043 :
68044 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
68045 : // using values that overflow signed values of int.
68046 : size_t
68047 4 : SgUsingDeclarationStatement::numberOfNodes()
68048 : {
68049 : // This function traverses the memory pool for an IR node and
68050 : // counts the number of IR nodes of a particular Sage III IR
68051 : // nodes type.
68052 :
68053 4 : size_t count = 0;
68054 4 : if (SgUsingDeclarationStatement::pools.empty() == false)
68055 : {
68056 : // Generate an array of memory pools (this is actually a STL vector,
68057 : // but it is contiguious, so OK to treat this way).
68058 1 : SgUsingDeclarationStatement** objectArray = (SgUsingDeclarationStatement**) &(SgUsingDeclarationStatement::pools[0]);
68059 :
68060 : // Build a local variable for better performance (make it a loop invariant variable).
68061 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
68062 :
68063 : // Iterate over all of the memory pools for this IR node.
68064 2 : for (unsigned int i=0; i < SgUsingDeclarationStatement::pools.size(); i++)
68065 : {
68066 : // objectArray[i] is a single memory pool, iterate over all the
68067 : // IR nodes and only count those that are valid IR nodes used in
68068 : // the AST (i.e. allocated IR nodes).
68069 2001 : for (unsigned j=0; j < SgUsingDeclarationStatement::pool_size; j++)
68070 : {
68071 : // This is indexing the STL vector of C/C++ style arrays as a doubly
68072 : // indexed array access. It is OK since we have leveraged the semantics
68073 : // of STL vector memory as contigous and cast the memory as an array
68074 : // of arrays to use the 2D array indexing. Hope this is not confusing,
68075 : // but it s very fast as an implementation.
68076 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
68077 : {
68078 275 : count++;
68079 : }
68080 : }
68081 : }
68082 : }
68083 :
68084 :
68085 :
68086 4 : return count;
68087 : }
68088 :
68089 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
68090 : // using values that overflow signed values of int.
68091 : size_t
68092 0 : SgUsingDeclarationStatement::memoryUsage()
68093 : {
68094 : // This function is required because we need the class name as a type when we call sizeof
68095 : // There might be another way to implement this if we have a traversal that only called a
68096 : // representative object (one call for each type of Sage IIIIR node).
68097 0 : size_t memory = numberOfNodes() * sizeof(SgUsingDeclarationStatement);
68098 :
68099 0 : return memory;
68100 : }
68101 :
68102 : /* #line 68103 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
68103 :
68104 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
68105 : void
68106 5342 : SgNamelistStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
68107 : {
68108 : // This function traverses the memory pool for only a specific IR node
68109 : // and calls the visit function of the input class execute a traversal
68110 : // similar to the style of the attribute based traversals within ROSE.
68111 : // This traversal will visit ALL nodes of the AST where as the other
68112 : // attribute based traversals visit only the embedded tree within the AST.
68113 :
68114 : // Initialize array to the address of the first element of the STL vector
68115 : // (which is guaranteed to be contiguous storage).
68116 : // SgNamelistStatement objectArray [] = *(Memory_Block_List.begin());
68117 5342 : if (SgNamelistStatement::pools.empty() == false)
68118 : {
68119 : // Generate an array of memory pools
68120 0 : SgNamelistStatement** objectArray = (SgNamelistStatement**) &(SgNamelistStatement::pools[0]);
68121 :
68122 : // Build a local variable for better performance
68123 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
68124 : #if 0
68125 : // Iterate over the memory pools
68126 : for (unsigned int i=0; i < SgNamelistStatement::pools.size(); i++)
68127 : {
68128 : // objectArray[i] is a single memory pool
68129 : for (int j=0; j < SgNamelistStatement::pool_size; j++)
68130 : {
68131 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
68132 : {
68133 : traversal.visit(&(objectArray[i][j]));
68134 : }
68135 : }
68136 : }
68137 : #else
68138 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
68139 : // compute the list first and then call the visit function on each list element.
68140 :
68141 : // printf ("Inside of SgNamelistStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
68142 :
68143 0 : std::vector<SgNamelistStatement*> nodeList;
68144 :
68145 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
68146 0 : for (unsigned int i=0; i < SgNamelistStatement::pools.size(); i++)
68147 : {
68148 : // objectArray[i] is a single memory pool
68149 0 : for (unsigned j=0; j < SgNamelistStatement::pool_size; j++)
68150 : {
68151 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
68152 : {
68153 0 : nodeList.push_back(&(objectArray[i][j]));
68154 : }
68155 : }
68156 : }
68157 :
68158 : // Iterate over the saved list
68159 0 : size_t nodeListSize = nodeList.size();
68160 0 : for (size_t i=0; i < nodeListSize; i++)
68161 : {
68162 0 : ROSE_ASSERT(nodeList[i] != NULL);
68163 : #if 0
68164 : traversal.visit(nodeList[i]);
68165 : #else
68166 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
68167 : {
68168 0 : traversal.visit(nodeList[i]);
68169 : }
68170 : #endif
68171 : }
68172 : #endif
68173 : }
68174 :
68175 : // This should not be required since all previously static data members are
68176 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
68177 :
68178 5342 : }
68179 :
68180 :
68181 : void
68182 194 : SgNamelistStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
68183 : {
68184 : // This function traverses the memory pool for an IR node and
68185 : // calls the function to execute the visitor object.
68186 :
68187 : // Initialize array to the address of the first element of the STL vector
68188 : // (which is guarenteed to be contiguous storage).
68189 : // SgNamelistStatement objectArray [] = *(Memory_Block_List.begin());
68190 194 : if (SgNamelistStatement::pools.empty() == false)
68191 : {
68192 : // Generate an array of memory pools
68193 0 : SgNamelistStatement** objectArray = (SgNamelistStatement**) &(SgNamelistStatement::pools[0]);
68194 :
68195 : // Build a local variable for better performance
68196 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
68197 :
68198 : // Iterate over the memory pools
68199 0 : for (unsigned int i=0; i < SgNamelistStatement::pools.size(); i++)
68200 : {
68201 : // objectArray[i] is a single memory pool
68202 0 : for (unsigned j=0; j < SgNamelistStatement::pool_size; j++)
68203 : {
68204 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
68205 : {
68206 : // printf ("Found a valid SgNamelistStatement object in the memory pool %d at position %d \n",i,j);
68207 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
68208 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
68209 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
68210 : }
68211 : else
68212 : {
68213 : // printf ("Found a INVALID SgNamelistStatement object in the memory pool \n");
68214 : }
68215 : }
68216 : }
68217 : }
68218 :
68219 : // This should not be required since all previously static data members are
68220 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
68221 :
68222 194 : }
68223 :
68224 : void
68225 0 : SgNamelistStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
68226 : {
68227 : // This function visits only a single IR node of the memory pool.
68228 : // it is typically called once for each type of IR node within
68229 : // the automatically generated function: traverseRepresentativeNodes().
68230 :
68231 : // Initialize array to the address of the first element of the STL vector
68232 : // (which is guarenteed to be contiguous storage).
68233 : // SgNamelistStatement objectArray [] = *(Memory_Block_List.begin());
68234 0 : if (SgNamelistStatement::pools.empty() == false)
68235 : {
68236 : // Generate an array of memory pools
68237 0 : SgNamelistStatement** objectArray = (SgNamelistStatement**) &(SgNamelistStatement::pools[0]);
68238 :
68239 : // Build a local variable for better performance
68240 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
68241 :
68242 : // Iterate over the memory pools
68243 0 : bool done = false;
68244 0 : unsigned i=0;
68245 :
68246 : // find the first valid IR node, call visit function, and then leave
68247 0 : while ( done == false && i < SgNamelistStatement::pools.size() )
68248 : {
68249 : // objectArray[i] is a single memory pool
68250 : unsigned j=0;
68251 0 : while (done == false && j < SgNamelistStatement::pool_size)
68252 : {
68253 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
68254 : {
68255 0 : traversal.visit(&(objectArray[i][j]));
68256 0 : done = true;
68257 : }
68258 0 : j++;
68259 : }
68260 0 : i++;
68261 : }
68262 :
68263 : #if 0
68264 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
68265 : if (done == false)
68266 : {
68267 : printf ("No representative for SgNamelistStatement found in memory pools \n");
68268 : }
68269 : #endif
68270 : }
68271 0 : }
68272 :
68273 :
68274 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
68275 : // using values that overflow signed values of int.
68276 : size_t
68277 4 : SgNamelistStatement::numberOfNodes()
68278 : {
68279 : // This function traverses the memory pool for an IR node and
68280 : // counts the number of IR nodes of a particular Sage III IR
68281 : // nodes type.
68282 :
68283 4 : size_t count = 0;
68284 4 : if (SgNamelistStatement::pools.empty() == false)
68285 : {
68286 : // Generate an array of memory pools (this is actually a STL vector,
68287 : // but it is contiguious, so OK to treat this way).
68288 0 : SgNamelistStatement** objectArray = (SgNamelistStatement**) &(SgNamelistStatement::pools[0]);
68289 :
68290 : // Build a local variable for better performance (make it a loop invariant variable).
68291 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
68292 :
68293 : // Iterate over all of the memory pools for this IR node.
68294 0 : for (unsigned int i=0; i < SgNamelistStatement::pools.size(); i++)
68295 : {
68296 : // objectArray[i] is a single memory pool, iterate over all the
68297 : // IR nodes and only count those that are valid IR nodes used in
68298 : // the AST (i.e. allocated IR nodes).
68299 0 : for (unsigned j=0; j < SgNamelistStatement::pool_size; j++)
68300 : {
68301 : // This is indexing the STL vector of C/C++ style arrays as a doubly
68302 : // indexed array access. It is OK since we have leveraged the semantics
68303 : // of STL vector memory as contigous and cast the memory as an array
68304 : // of arrays to use the 2D array indexing. Hope this is not confusing,
68305 : // but it s very fast as an implementation.
68306 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
68307 : {
68308 0 : count++;
68309 : }
68310 : }
68311 : }
68312 : }
68313 :
68314 :
68315 :
68316 4 : return count;
68317 : }
68318 :
68319 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
68320 : // using values that overflow signed values of int.
68321 : size_t
68322 0 : SgNamelistStatement::memoryUsage()
68323 : {
68324 : // This function is required because we need the class name as a type when we call sizeof
68325 : // There might be another way to implement this if we have a traversal that only called a
68326 : // representative object (one call for each type of Sage IIIIR node).
68327 0 : size_t memory = numberOfNodes() * sizeof(SgNamelistStatement);
68328 :
68329 0 : return memory;
68330 : }
68331 :
68332 : /* #line 68333 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
68333 :
68334 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
68335 : void
68336 5342 : SgImportStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
68337 : {
68338 : // This function traverses the memory pool for only a specific IR node
68339 : // and calls the visit function of the input class execute a traversal
68340 : // similar to the style of the attribute based traversals within ROSE.
68341 : // This traversal will visit ALL nodes of the AST where as the other
68342 : // attribute based traversals visit only the embedded tree within the AST.
68343 :
68344 : // Initialize array to the address of the first element of the STL vector
68345 : // (which is guaranteed to be contiguous storage).
68346 : // SgImportStatement objectArray [] = *(Memory_Block_List.begin());
68347 5342 : if (SgImportStatement::pools.empty() == false)
68348 : {
68349 : // Generate an array of memory pools
68350 0 : SgImportStatement** objectArray = (SgImportStatement**) &(SgImportStatement::pools[0]);
68351 :
68352 : // Build a local variable for better performance
68353 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
68354 : #if 0
68355 : // Iterate over the memory pools
68356 : for (unsigned int i=0; i < SgImportStatement::pools.size(); i++)
68357 : {
68358 : // objectArray[i] is a single memory pool
68359 : for (int j=0; j < SgImportStatement::pool_size; j++)
68360 : {
68361 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
68362 : {
68363 : traversal.visit(&(objectArray[i][j]));
68364 : }
68365 : }
68366 : }
68367 : #else
68368 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
68369 : // compute the list first and then call the visit function on each list element.
68370 :
68371 : // printf ("Inside of SgImportStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
68372 :
68373 0 : std::vector<SgImportStatement*> nodeList;
68374 :
68375 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
68376 0 : for (unsigned int i=0; i < SgImportStatement::pools.size(); i++)
68377 : {
68378 : // objectArray[i] is a single memory pool
68379 0 : for (unsigned j=0; j < SgImportStatement::pool_size; j++)
68380 : {
68381 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
68382 : {
68383 0 : nodeList.push_back(&(objectArray[i][j]));
68384 : }
68385 : }
68386 : }
68387 :
68388 : // Iterate over the saved list
68389 0 : size_t nodeListSize = nodeList.size();
68390 0 : for (size_t i=0; i < nodeListSize; i++)
68391 : {
68392 0 : ROSE_ASSERT(nodeList[i] != NULL);
68393 : #if 0
68394 : traversal.visit(nodeList[i]);
68395 : #else
68396 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
68397 : {
68398 0 : traversal.visit(nodeList[i]);
68399 : }
68400 : #endif
68401 : }
68402 : #endif
68403 : }
68404 :
68405 : // This should not be required since all previously static data members are
68406 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
68407 :
68408 5342 : }
68409 :
68410 :
68411 : void
68412 194 : SgImportStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
68413 : {
68414 : // This function traverses the memory pool for an IR node and
68415 : // calls the function to execute the visitor object.
68416 :
68417 : // Initialize array to the address of the first element of the STL vector
68418 : // (which is guarenteed to be contiguous storage).
68419 : // SgImportStatement objectArray [] = *(Memory_Block_List.begin());
68420 194 : if (SgImportStatement::pools.empty() == false)
68421 : {
68422 : // Generate an array of memory pools
68423 0 : SgImportStatement** objectArray = (SgImportStatement**) &(SgImportStatement::pools[0]);
68424 :
68425 : // Build a local variable for better performance
68426 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
68427 :
68428 : // Iterate over the memory pools
68429 0 : for (unsigned int i=0; i < SgImportStatement::pools.size(); i++)
68430 : {
68431 : // objectArray[i] is a single memory pool
68432 0 : for (unsigned j=0; j < SgImportStatement::pool_size; j++)
68433 : {
68434 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
68435 : {
68436 : // printf ("Found a valid SgImportStatement object in the memory pool %d at position %d \n",i,j);
68437 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
68438 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
68439 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
68440 : }
68441 : else
68442 : {
68443 : // printf ("Found a INVALID SgImportStatement object in the memory pool \n");
68444 : }
68445 : }
68446 : }
68447 : }
68448 :
68449 : // This should not be required since all previously static data members are
68450 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
68451 :
68452 194 : }
68453 :
68454 : void
68455 0 : SgImportStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
68456 : {
68457 : // This function visits only a single IR node of the memory pool.
68458 : // it is typically called once for each type of IR node within
68459 : // the automatically generated function: traverseRepresentativeNodes().
68460 :
68461 : // Initialize array to the address of the first element of the STL vector
68462 : // (which is guarenteed to be contiguous storage).
68463 : // SgImportStatement objectArray [] = *(Memory_Block_List.begin());
68464 0 : if (SgImportStatement::pools.empty() == false)
68465 : {
68466 : // Generate an array of memory pools
68467 0 : SgImportStatement** objectArray = (SgImportStatement**) &(SgImportStatement::pools[0]);
68468 :
68469 : // Build a local variable for better performance
68470 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
68471 :
68472 : // Iterate over the memory pools
68473 0 : bool done = false;
68474 0 : unsigned i=0;
68475 :
68476 : // find the first valid IR node, call visit function, and then leave
68477 0 : while ( done == false && i < SgImportStatement::pools.size() )
68478 : {
68479 : // objectArray[i] is a single memory pool
68480 : unsigned j=0;
68481 0 : while (done == false && j < SgImportStatement::pool_size)
68482 : {
68483 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
68484 : {
68485 0 : traversal.visit(&(objectArray[i][j]));
68486 0 : done = true;
68487 : }
68488 0 : j++;
68489 : }
68490 0 : i++;
68491 : }
68492 :
68493 : #if 0
68494 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
68495 : if (done == false)
68496 : {
68497 : printf ("No representative for SgImportStatement found in memory pools \n");
68498 : }
68499 : #endif
68500 : }
68501 0 : }
68502 :
68503 :
68504 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
68505 : // using values that overflow signed values of int.
68506 : size_t
68507 4 : SgImportStatement::numberOfNodes()
68508 : {
68509 : // This function traverses the memory pool for an IR node and
68510 : // counts the number of IR nodes of a particular Sage III IR
68511 : // nodes type.
68512 :
68513 4 : size_t count = 0;
68514 4 : if (SgImportStatement::pools.empty() == false)
68515 : {
68516 : // Generate an array of memory pools (this is actually a STL vector,
68517 : // but it is contiguious, so OK to treat this way).
68518 0 : SgImportStatement** objectArray = (SgImportStatement**) &(SgImportStatement::pools[0]);
68519 :
68520 : // Build a local variable for better performance (make it a loop invariant variable).
68521 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
68522 :
68523 : // Iterate over all of the memory pools for this IR node.
68524 0 : for (unsigned int i=0; i < SgImportStatement::pools.size(); i++)
68525 : {
68526 : // objectArray[i] is a single memory pool, iterate over all the
68527 : // IR nodes and only count those that are valid IR nodes used in
68528 : // the AST (i.e. allocated IR nodes).
68529 0 : for (unsigned j=0; j < SgImportStatement::pool_size; j++)
68530 : {
68531 : // This is indexing the STL vector of C/C++ style arrays as a doubly
68532 : // indexed array access. It is OK since we have leveraged the semantics
68533 : // of STL vector memory as contigous and cast the memory as an array
68534 : // of arrays to use the 2D array indexing. Hope this is not confusing,
68535 : // but it s very fast as an implementation.
68536 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
68537 : {
68538 0 : count++;
68539 : }
68540 : }
68541 : }
68542 : }
68543 :
68544 :
68545 :
68546 4 : return count;
68547 : }
68548 :
68549 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
68550 : // using values that overflow signed values of int.
68551 : size_t
68552 0 : SgImportStatement::memoryUsage()
68553 : {
68554 : // This function is required because we need the class name as a type when we call sizeof
68555 : // There might be another way to implement this if we have a traversal that only called a
68556 : // representative object (one call for each type of Sage IIIIR node).
68557 0 : size_t memory = numberOfNodes() * sizeof(SgImportStatement);
68558 :
68559 0 : return memory;
68560 : }
68561 :
68562 : /* #line 68563 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
68563 :
68564 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
68565 : void
68566 5344 : SgFunctionDeclaration::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
68567 : {
68568 : // This function traverses the memory pool for only a specific IR node
68569 : // and calls the visit function of the input class execute a traversal
68570 : // similar to the style of the attribute based traversals within ROSE.
68571 : // This traversal will visit ALL nodes of the AST where as the other
68572 : // attribute based traversals visit only the embedded tree within the AST.
68573 :
68574 : // Initialize array to the address of the first element of the STL vector
68575 : // (which is guaranteed to be contiguous storage).
68576 : // SgFunctionDeclaration objectArray [] = *(Memory_Block_List.begin());
68577 5344 : if (SgFunctionDeclaration::pools.empty() == false)
68578 : {
68579 : // Generate an array of memory pools
68580 4604 : SgFunctionDeclaration** objectArray = (SgFunctionDeclaration**) &(SgFunctionDeclaration::pools[0]);
68581 :
68582 : // Build a local variable for better performance
68583 4604 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
68584 : #if 0
68585 : // Iterate over the memory pools
68586 : for (unsigned int i=0; i < SgFunctionDeclaration::pools.size(); i++)
68587 : {
68588 : // objectArray[i] is a single memory pool
68589 : for (int j=0; j < SgFunctionDeclaration::pool_size; j++)
68590 : {
68591 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
68592 : {
68593 : traversal.visit(&(objectArray[i][j]));
68594 : }
68595 : }
68596 : }
68597 : #else
68598 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
68599 : // compute the list first and then call the visit function on each list element.
68600 :
68601 : // printf ("Inside of SgFunctionDeclaration::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
68602 :
68603 9208 : std::vector<SgFunctionDeclaration*> nodeList;
68604 :
68605 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
68606 14364 : for (unsigned int i=0; i < SgFunctionDeclaration::pools.size(); i++)
68607 : {
68608 : // objectArray[i] is a single memory pool
68609 19529800 : for (unsigned j=0; j < SgFunctionDeclaration::pool_size; j++)
68610 : {
68611 19520000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
68612 : {
68613 16752900 : nodeList.push_back(&(objectArray[i][j]));
68614 : }
68615 : }
68616 : }
68617 :
68618 : // Iterate over the saved list
68619 4604 : size_t nodeListSize = nodeList.size();
68620 16757500 : for (size_t i=0; i < nodeListSize; i++)
68621 : {
68622 16752900 : ROSE_ASSERT(nodeList[i] != NULL);
68623 : #if 0
68624 : traversal.visit(nodeList[i]);
68625 : #else
68626 16752900 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
68627 : {
68628 16752900 : traversal.visit(nodeList[i]);
68629 : }
68630 : #endif
68631 : }
68632 : #endif
68633 : }
68634 :
68635 : // This should not be required since all previously static data members are
68636 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
68637 :
68638 5344 : }
68639 :
68640 :
68641 : void
68642 194 : SgFunctionDeclaration::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
68643 : {
68644 : // This function traverses the memory pool for an IR node and
68645 : // calls the function to execute the visitor object.
68646 :
68647 : // Initialize array to the address of the first element of the STL vector
68648 : // (which is guarenteed to be contiguous storage).
68649 : // SgFunctionDeclaration objectArray [] = *(Memory_Block_List.begin());
68650 194 : if (SgFunctionDeclaration::pools.empty() == false)
68651 : {
68652 : // Generate an array of memory pools
68653 194 : SgFunctionDeclaration** objectArray = (SgFunctionDeclaration**) &(SgFunctionDeclaration::pools[0]);
68654 :
68655 : // Build a local variable for better performance
68656 194 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
68657 :
68658 : // Iterate over the memory pools
68659 719 : for (unsigned int i=0; i < SgFunctionDeclaration::pools.size(); i++)
68660 : {
68661 : // objectArray[i] is a single memory pool
68662 1050520 : for (unsigned j=0; j < SgFunctionDeclaration::pool_size; j++)
68663 : {
68664 1050000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
68665 : {
68666 : // printf ("Found a valid SgFunctionDeclaration object in the memory pool %d at position %d \n",i,j);
68667 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
68668 824638 : objectArray[i][j].executeVisitorMemberFunction(visitor);
68669 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
68670 : }
68671 : else
68672 : {
68673 : // printf ("Found a INVALID SgFunctionDeclaration object in the memory pool \n");
68674 : }
68675 : }
68676 : }
68677 : }
68678 :
68679 : // This should not be required since all previously static data members are
68680 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
68681 :
68682 194 : }
68683 :
68684 : void
68685 0 : SgFunctionDeclaration::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
68686 : {
68687 : // This function visits only a single IR node of the memory pool.
68688 : // it is typically called once for each type of IR node within
68689 : // the automatically generated function: traverseRepresentativeNodes().
68690 :
68691 : // Initialize array to the address of the first element of the STL vector
68692 : // (which is guarenteed to be contiguous storage).
68693 : // SgFunctionDeclaration objectArray [] = *(Memory_Block_List.begin());
68694 0 : if (SgFunctionDeclaration::pools.empty() == false)
68695 : {
68696 : // Generate an array of memory pools
68697 0 : SgFunctionDeclaration** objectArray = (SgFunctionDeclaration**) &(SgFunctionDeclaration::pools[0]);
68698 :
68699 : // Build a local variable for better performance
68700 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
68701 :
68702 : // Iterate over the memory pools
68703 0 : bool done = false;
68704 0 : unsigned i=0;
68705 :
68706 : // find the first valid IR node, call visit function, and then leave
68707 0 : while ( done == false && i < SgFunctionDeclaration::pools.size() )
68708 : {
68709 : // objectArray[i] is a single memory pool
68710 : unsigned j=0;
68711 0 : while (done == false && j < SgFunctionDeclaration::pool_size)
68712 : {
68713 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
68714 : {
68715 0 : traversal.visit(&(objectArray[i][j]));
68716 0 : done = true;
68717 : }
68718 0 : j++;
68719 : }
68720 0 : i++;
68721 : }
68722 :
68723 : #if 0
68724 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
68725 : if (done == false)
68726 : {
68727 : printf ("No representative for SgFunctionDeclaration found in memory pools \n");
68728 : }
68729 : #endif
68730 : }
68731 0 : }
68732 :
68733 :
68734 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
68735 : // using values that overflow signed values of int.
68736 : size_t
68737 4 : SgFunctionDeclaration::numberOfNodes()
68738 : {
68739 : // This function traverses the memory pool for an IR node and
68740 : // counts the number of IR nodes of a particular Sage III IR
68741 : // nodes type.
68742 :
68743 4 : size_t count = 0;
68744 4 : if (SgFunctionDeclaration::pools.empty() == false)
68745 : {
68746 : // Generate an array of memory pools (this is actually a STL vector,
68747 : // but it is contiguious, so OK to treat this way).
68748 2 : SgFunctionDeclaration** objectArray = (SgFunctionDeclaration**) &(SgFunctionDeclaration::pools[0]);
68749 :
68750 : // Build a local variable for better performance (make it a loop invariant variable).
68751 2 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
68752 :
68753 : // Iterate over all of the memory pools for this IR node.
68754 7 : for (unsigned int i=0; i < SgFunctionDeclaration::pools.size(); i++)
68755 : {
68756 : // objectArray[i] is a single memory pool, iterate over all the
68757 : // IR nodes and only count those that are valid IR nodes used in
68758 : // the AST (i.e. allocated IR nodes).
68759 10005 : for (unsigned j=0; j < SgFunctionDeclaration::pool_size; j++)
68760 : {
68761 : // This is indexing the STL vector of C/C++ style arrays as a doubly
68762 : // indexed array access. It is OK since we have leveraged the semantics
68763 : // of STL vector memory as contigous and cast the memory as an array
68764 : // of arrays to use the 2D array indexing. Hope this is not confusing,
68765 : // but it s very fast as an implementation.
68766 10000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
68767 : {
68768 7916 : count++;
68769 : }
68770 : }
68771 : }
68772 : }
68773 :
68774 :
68775 :
68776 4 : return count;
68777 : }
68778 :
68779 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
68780 : // using values that overflow signed values of int.
68781 : size_t
68782 0 : SgFunctionDeclaration::memoryUsage()
68783 : {
68784 : // This function is required because we need the class name as a type when we call sizeof
68785 : // There might be another way to implement this if we have a traversal that only called a
68786 : // representative object (one call for each type of Sage IIIIR node).
68787 0 : size_t memory = numberOfNodes() * sizeof(SgFunctionDeclaration);
68788 :
68789 0 : return memory;
68790 : }
68791 :
68792 : /* #line 68793 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
68793 :
68794 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
68795 : void
68796 5342 : SgTemplateFunctionDeclaration::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
68797 : {
68798 : // This function traverses the memory pool for only a specific IR node
68799 : // and calls the visit function of the input class execute a traversal
68800 : // similar to the style of the attribute based traversals within ROSE.
68801 : // This traversal will visit ALL nodes of the AST where as the other
68802 : // attribute based traversals visit only the embedded tree within the AST.
68803 :
68804 : // Initialize array to the address of the first element of the STL vector
68805 : // (which is guaranteed to be contiguous storage).
68806 : // SgTemplateFunctionDeclaration objectArray [] = *(Memory_Block_List.begin());
68807 5342 : if (SgTemplateFunctionDeclaration::pools.empty() == false)
68808 : {
68809 : // Generate an array of memory pools
68810 138 : SgTemplateFunctionDeclaration** objectArray = (SgTemplateFunctionDeclaration**) &(SgTemplateFunctionDeclaration::pools[0]);
68811 :
68812 : // Build a local variable for better performance
68813 138 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
68814 : #if 0
68815 : // Iterate over the memory pools
68816 : for (unsigned int i=0; i < SgTemplateFunctionDeclaration::pools.size(); i++)
68817 : {
68818 : // objectArray[i] is a single memory pool
68819 : for (int j=0; j < SgTemplateFunctionDeclaration::pool_size; j++)
68820 : {
68821 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
68822 : {
68823 : traversal.visit(&(objectArray[i][j]));
68824 : }
68825 : }
68826 : }
68827 : #else
68828 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
68829 : // compute the list first and then call the visit function on each list element.
68830 :
68831 : // printf ("Inside of SgTemplateFunctionDeclaration::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
68832 :
68833 276 : std::vector<SgTemplateFunctionDeclaration*> nodeList;
68834 :
68835 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
68836 276 : for (unsigned int i=0; i < SgTemplateFunctionDeclaration::pools.size(); i++)
68837 : {
68838 : // objectArray[i] is a single memory pool
68839 276138 : for (unsigned j=0; j < SgTemplateFunctionDeclaration::pool_size; j++)
68840 : {
68841 276000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
68842 : {
68843 95054 : nodeList.push_back(&(objectArray[i][j]));
68844 : }
68845 : }
68846 : }
68847 :
68848 : // Iterate over the saved list
68849 138 : size_t nodeListSize = nodeList.size();
68850 95192 : for (size_t i=0; i < nodeListSize; i++)
68851 : {
68852 95054 : ROSE_ASSERT(nodeList[i] != NULL);
68853 : #if 0
68854 : traversal.visit(nodeList[i]);
68855 : #else
68856 95054 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
68857 : {
68858 95054 : traversal.visit(nodeList[i]);
68859 : }
68860 : #endif
68861 : }
68862 : #endif
68863 : }
68864 :
68865 : // This should not be required since all previously static data members are
68866 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
68867 :
68868 5342 : }
68869 :
68870 :
68871 : void
68872 194 : SgTemplateFunctionDeclaration::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
68873 : {
68874 : // This function traverses the memory pool for an IR node and
68875 : // calls the function to execute the visitor object.
68876 :
68877 : // Initialize array to the address of the first element of the STL vector
68878 : // (which is guarenteed to be contiguous storage).
68879 : // SgTemplateFunctionDeclaration objectArray [] = *(Memory_Block_List.begin());
68880 194 : if (SgTemplateFunctionDeclaration::pools.empty() == false)
68881 : {
68882 : // Generate an array of memory pools
68883 137 : SgTemplateFunctionDeclaration** objectArray = (SgTemplateFunctionDeclaration**) &(SgTemplateFunctionDeclaration::pools[0]);
68884 :
68885 : // Build a local variable for better performance
68886 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
68887 :
68888 : // Iterate over the memory pools
68889 274 : for (unsigned int i=0; i < SgTemplateFunctionDeclaration::pools.size(); i++)
68890 : {
68891 : // objectArray[i] is a single memory pool
68892 274137 : for (unsigned j=0; j < SgTemplateFunctionDeclaration::pool_size; j++)
68893 : {
68894 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
68895 : {
68896 : // printf ("Found a valid SgTemplateFunctionDeclaration object in the memory pool %d at position %d \n",i,j);
68897 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
68898 94304 : objectArray[i][j].executeVisitorMemberFunction(visitor);
68899 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
68900 : }
68901 : else
68902 : {
68903 : // printf ("Found a INVALID SgTemplateFunctionDeclaration object in the memory pool \n");
68904 : }
68905 : }
68906 : }
68907 : }
68908 :
68909 : // This should not be required since all previously static data members are
68910 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
68911 :
68912 194 : }
68913 :
68914 : void
68915 0 : SgTemplateFunctionDeclaration::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
68916 : {
68917 : // This function visits only a single IR node of the memory pool.
68918 : // it is typically called once for each type of IR node within
68919 : // the automatically generated function: traverseRepresentativeNodes().
68920 :
68921 : // Initialize array to the address of the first element of the STL vector
68922 : // (which is guarenteed to be contiguous storage).
68923 : // SgTemplateFunctionDeclaration objectArray [] = *(Memory_Block_List.begin());
68924 0 : if (SgTemplateFunctionDeclaration::pools.empty() == false)
68925 : {
68926 : // Generate an array of memory pools
68927 0 : SgTemplateFunctionDeclaration** objectArray = (SgTemplateFunctionDeclaration**) &(SgTemplateFunctionDeclaration::pools[0]);
68928 :
68929 : // Build a local variable for better performance
68930 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
68931 :
68932 : // Iterate over the memory pools
68933 0 : bool done = false;
68934 0 : unsigned i=0;
68935 :
68936 : // find the first valid IR node, call visit function, and then leave
68937 0 : while ( done == false && i < SgTemplateFunctionDeclaration::pools.size() )
68938 : {
68939 : // objectArray[i] is a single memory pool
68940 : unsigned j=0;
68941 0 : while (done == false && j < SgTemplateFunctionDeclaration::pool_size)
68942 : {
68943 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
68944 : {
68945 0 : traversal.visit(&(objectArray[i][j]));
68946 0 : done = true;
68947 : }
68948 0 : j++;
68949 : }
68950 0 : i++;
68951 : }
68952 :
68953 : #if 0
68954 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
68955 : if (done == false)
68956 : {
68957 : printf ("No representative for SgTemplateFunctionDeclaration found in memory pools \n");
68958 : }
68959 : #endif
68960 : }
68961 0 : }
68962 :
68963 :
68964 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
68965 : // using values that overflow signed values of int.
68966 : size_t
68967 4 : SgTemplateFunctionDeclaration::numberOfNodes()
68968 : {
68969 : // This function traverses the memory pool for an IR node and
68970 : // counts the number of IR nodes of a particular Sage III IR
68971 : // nodes type.
68972 :
68973 4 : size_t count = 0;
68974 4 : if (SgTemplateFunctionDeclaration::pools.empty() == false)
68975 : {
68976 : // Generate an array of memory pools (this is actually a STL vector,
68977 : // but it is contiguious, so OK to treat this way).
68978 1 : SgTemplateFunctionDeclaration** objectArray = (SgTemplateFunctionDeclaration**) &(SgTemplateFunctionDeclaration::pools[0]);
68979 :
68980 : // Build a local variable for better performance (make it a loop invariant variable).
68981 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
68982 :
68983 : // Iterate over all of the memory pools for this IR node.
68984 2 : for (unsigned int i=0; i < SgTemplateFunctionDeclaration::pools.size(); i++)
68985 : {
68986 : // objectArray[i] is a single memory pool, iterate over all the
68987 : // IR nodes and only count those that are valid IR nodes used in
68988 : // the AST (i.e. allocated IR nodes).
68989 2001 : for (unsigned j=0; j < SgTemplateFunctionDeclaration::pool_size; j++)
68990 : {
68991 : // This is indexing the STL vector of C/C++ style arrays as a doubly
68992 : // indexed array access. It is OK since we have leveraged the semantics
68993 : // of STL vector memory as contigous and cast the memory as an array
68994 : // of arrays to use the 2D array indexing. Hope this is not confusing,
68995 : // but it s very fast as an implementation.
68996 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
68997 : {
68998 676 : count++;
68999 : }
69000 : }
69001 : }
69002 : }
69003 :
69004 :
69005 :
69006 4 : return count;
69007 : }
69008 :
69009 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
69010 : // using values that overflow signed values of int.
69011 : size_t
69012 0 : SgTemplateFunctionDeclaration::memoryUsage()
69013 : {
69014 : // This function is required because we need the class name as a type when we call sizeof
69015 : // There might be another way to implement this if we have a traversal that only called a
69016 : // representative object (one call for each type of Sage IIIIR node).
69017 0 : size_t memory = numberOfNodes() * sizeof(SgTemplateFunctionDeclaration);
69018 :
69019 0 : return memory;
69020 : }
69021 :
69022 : /* #line 69023 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
69023 :
69024 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
69025 : void
69026 5344 : SgMemberFunctionDeclaration::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
69027 : {
69028 : // This function traverses the memory pool for only a specific IR node
69029 : // and calls the visit function of the input class execute a traversal
69030 : // similar to the style of the attribute based traversals within ROSE.
69031 : // This traversal will visit ALL nodes of the AST where as the other
69032 : // attribute based traversals visit only the embedded tree within the AST.
69033 :
69034 : // Initialize array to the address of the first element of the STL vector
69035 : // (which is guaranteed to be contiguous storage).
69036 : // SgMemberFunctionDeclaration objectArray [] = *(Memory_Block_List.begin());
69037 5344 : if (SgMemberFunctionDeclaration::pools.empty() == false)
69038 : {
69039 : // Generate an array of memory pools
69040 228 : SgMemberFunctionDeclaration** objectArray = (SgMemberFunctionDeclaration**) &(SgMemberFunctionDeclaration::pools[0]);
69041 :
69042 : // Build a local variable for better performance
69043 228 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
69044 : #if 0
69045 : // Iterate over the memory pools
69046 : for (unsigned int i=0; i < SgMemberFunctionDeclaration::pools.size(); i++)
69047 : {
69048 : // objectArray[i] is a single memory pool
69049 : for (int j=0; j < SgMemberFunctionDeclaration::pool_size; j++)
69050 : {
69051 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
69052 : {
69053 : traversal.visit(&(objectArray[i][j]));
69054 : }
69055 : }
69056 : }
69057 : #else
69058 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
69059 : // compute the list first and then call the visit function on each list element.
69060 :
69061 : // printf ("Inside of SgMemberFunctionDeclaration::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
69062 :
69063 456 : std::vector<SgMemberFunctionDeclaration*> nodeList;
69064 :
69065 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
69066 456 : for (unsigned int i=0; i < SgMemberFunctionDeclaration::pools.size(); i++)
69067 : {
69068 : // objectArray[i] is a single memory pool
69069 456228 : for (unsigned j=0; j < SgMemberFunctionDeclaration::pool_size; j++)
69070 : {
69071 456000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
69072 : {
69073 98710 : nodeList.push_back(&(objectArray[i][j]));
69074 : }
69075 : }
69076 : }
69077 :
69078 : // Iterate over the saved list
69079 228 : size_t nodeListSize = nodeList.size();
69080 98938 : for (size_t i=0; i < nodeListSize; i++)
69081 : {
69082 98710 : ROSE_ASSERT(nodeList[i] != NULL);
69083 : #if 0
69084 : traversal.visit(nodeList[i]);
69085 : #else
69086 98710 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
69087 : {
69088 98710 : traversal.visit(nodeList[i]);
69089 : }
69090 : #endif
69091 : }
69092 : #endif
69093 : }
69094 :
69095 : // This should not be required since all previously static data members are
69096 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
69097 :
69098 5344 : }
69099 :
69100 :
69101 : void
69102 194 : SgMemberFunctionDeclaration::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
69103 : {
69104 : // This function traverses the memory pool for an IR node and
69105 : // calls the function to execute the visitor object.
69106 :
69107 : // Initialize array to the address of the first element of the STL vector
69108 : // (which is guarenteed to be contiguous storage).
69109 : // SgMemberFunctionDeclaration objectArray [] = *(Memory_Block_List.begin());
69110 194 : if (SgMemberFunctionDeclaration::pools.empty() == false)
69111 : {
69112 : // Generate an array of memory pools
69113 137 : SgMemberFunctionDeclaration** objectArray = (SgMemberFunctionDeclaration**) &(SgMemberFunctionDeclaration::pools[0]);
69114 :
69115 : // Build a local variable for better performance
69116 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
69117 :
69118 : // Iterate over the memory pools
69119 274 : for (unsigned int i=0; i < SgMemberFunctionDeclaration::pools.size(); i++)
69120 : {
69121 : // objectArray[i] is a single memory pool
69122 274137 : for (unsigned j=0; j < SgMemberFunctionDeclaration::pool_size; j++)
69123 : {
69124 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
69125 : {
69126 : // printf ("Found a valid SgMemberFunctionDeclaration object in the memory pool %d at position %d \n",i,j);
69127 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
69128 109848 : objectArray[i][j].executeVisitorMemberFunction(visitor);
69129 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
69130 : }
69131 : else
69132 : {
69133 : // printf ("Found a INVALID SgMemberFunctionDeclaration object in the memory pool \n");
69134 : }
69135 : }
69136 : }
69137 : }
69138 :
69139 : // This should not be required since all previously static data members are
69140 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
69141 :
69142 194 : }
69143 :
69144 : void
69145 0 : SgMemberFunctionDeclaration::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
69146 : {
69147 : // This function visits only a single IR node of the memory pool.
69148 : // it is typically called once for each type of IR node within
69149 : // the automatically generated function: traverseRepresentativeNodes().
69150 :
69151 : // Initialize array to the address of the first element of the STL vector
69152 : // (which is guarenteed to be contiguous storage).
69153 : // SgMemberFunctionDeclaration objectArray [] = *(Memory_Block_List.begin());
69154 0 : if (SgMemberFunctionDeclaration::pools.empty() == false)
69155 : {
69156 : // Generate an array of memory pools
69157 0 : SgMemberFunctionDeclaration** objectArray = (SgMemberFunctionDeclaration**) &(SgMemberFunctionDeclaration::pools[0]);
69158 :
69159 : // Build a local variable for better performance
69160 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
69161 :
69162 : // Iterate over the memory pools
69163 0 : bool done = false;
69164 0 : unsigned i=0;
69165 :
69166 : // find the first valid IR node, call visit function, and then leave
69167 0 : while ( done == false && i < SgMemberFunctionDeclaration::pools.size() )
69168 : {
69169 : // objectArray[i] is a single memory pool
69170 : unsigned j=0;
69171 0 : while (done == false && j < SgMemberFunctionDeclaration::pool_size)
69172 : {
69173 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
69174 : {
69175 0 : traversal.visit(&(objectArray[i][j]));
69176 0 : done = true;
69177 : }
69178 0 : j++;
69179 : }
69180 0 : i++;
69181 : }
69182 :
69183 : #if 0
69184 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
69185 : if (done == false)
69186 : {
69187 : printf ("No representative for SgMemberFunctionDeclaration found in memory pools \n");
69188 : }
69189 : #endif
69190 : }
69191 0 : }
69192 :
69193 :
69194 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
69195 : // using values that overflow signed values of int.
69196 : size_t
69197 4 : SgMemberFunctionDeclaration::numberOfNodes()
69198 : {
69199 : // This function traverses the memory pool for an IR node and
69200 : // counts the number of IR nodes of a particular Sage III IR
69201 : // nodes type.
69202 :
69203 4 : size_t count = 0;
69204 4 : if (SgMemberFunctionDeclaration::pools.empty() == false)
69205 : {
69206 : // Generate an array of memory pools (this is actually a STL vector,
69207 : // but it is contiguious, so OK to treat this way).
69208 1 : SgMemberFunctionDeclaration** objectArray = (SgMemberFunctionDeclaration**) &(SgMemberFunctionDeclaration::pools[0]);
69209 :
69210 : // Build a local variable for better performance (make it a loop invariant variable).
69211 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
69212 :
69213 : // Iterate over all of the memory pools for this IR node.
69214 2 : for (unsigned int i=0; i < SgMemberFunctionDeclaration::pools.size(); i++)
69215 : {
69216 : // objectArray[i] is a single memory pool, iterate over all the
69217 : // IR nodes and only count those that are valid IR nodes used in
69218 : // the AST (i.e. allocated IR nodes).
69219 2001 : for (unsigned j=0; j < SgMemberFunctionDeclaration::pool_size; j++)
69220 : {
69221 : // This is indexing the STL vector of C/C++ style arrays as a doubly
69222 : // indexed array access. It is OK since we have leveraged the semantics
69223 : // of STL vector memory as contigous and cast the memory as an array
69224 : // of arrays to use the 2D array indexing. Hope this is not confusing,
69225 : // but it s very fast as an implementation.
69226 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
69227 : {
69228 784 : count++;
69229 : }
69230 : }
69231 : }
69232 : }
69233 :
69234 :
69235 :
69236 4 : return count;
69237 : }
69238 :
69239 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
69240 : // using values that overflow signed values of int.
69241 : size_t
69242 0 : SgMemberFunctionDeclaration::memoryUsage()
69243 : {
69244 : // This function is required because we need the class name as a type when we call sizeof
69245 : // There might be another way to implement this if we have a traversal that only called a
69246 : // representative object (one call for each type of Sage IIIIR node).
69247 0 : size_t memory = numberOfNodes() * sizeof(SgMemberFunctionDeclaration);
69248 :
69249 0 : return memory;
69250 : }
69251 :
69252 : /* #line 69253 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
69253 :
69254 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
69255 : void
69256 5342 : SgTemplateMemberFunctionDeclaration::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
69257 : {
69258 : // This function traverses the memory pool for only a specific IR node
69259 : // and calls the visit function of the input class execute a traversal
69260 : // similar to the style of the attribute based traversals within ROSE.
69261 : // This traversal will visit ALL nodes of the AST where as the other
69262 : // attribute based traversals visit only the embedded tree within the AST.
69263 :
69264 : // Initialize array to the address of the first element of the STL vector
69265 : // (which is guaranteed to be contiguous storage).
69266 : // SgTemplateMemberFunctionDeclaration objectArray [] = *(Memory_Block_List.begin());
69267 5342 : if (SgTemplateMemberFunctionDeclaration::pools.empty() == false)
69268 : {
69269 : // Generate an array of memory pools
69270 145 : SgTemplateMemberFunctionDeclaration** objectArray = (SgTemplateMemberFunctionDeclaration**) &(SgTemplateMemberFunctionDeclaration::pools[0]);
69271 :
69272 : // Build a local variable for better performance
69273 145 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
69274 : #if 0
69275 : // Iterate over the memory pools
69276 : for (unsigned int i=0; i < SgTemplateMemberFunctionDeclaration::pools.size(); i++)
69277 : {
69278 : // objectArray[i] is a single memory pool
69279 : for (int j=0; j < SgTemplateMemberFunctionDeclaration::pool_size; j++)
69280 : {
69281 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
69282 : {
69283 : traversal.visit(&(objectArray[i][j]));
69284 : }
69285 : }
69286 : }
69287 : #else
69288 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
69289 : // compute the list first and then call the visit function on each list element.
69290 :
69291 : // printf ("Inside of SgTemplateMemberFunctionDeclaration::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
69292 :
69293 290 : std::vector<SgTemplateMemberFunctionDeclaration*> nodeList;
69294 :
69295 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
69296 299 : for (unsigned int i=0; i < SgTemplateMemberFunctionDeclaration::pools.size(); i++)
69297 : {
69298 : // objectArray[i] is a single memory pool
69299 308154 : for (unsigned j=0; j < SgTemplateMemberFunctionDeclaration::pool_size; j++)
69300 : {
69301 308000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
69302 : {
69303 248706 : nodeList.push_back(&(objectArray[i][j]));
69304 : }
69305 : }
69306 : }
69307 :
69308 : // Iterate over the saved list
69309 145 : size_t nodeListSize = nodeList.size();
69310 248851 : for (size_t i=0; i < nodeListSize; i++)
69311 : {
69312 248706 : ROSE_ASSERT(nodeList[i] != NULL);
69313 : #if 0
69314 : traversal.visit(nodeList[i]);
69315 : #else
69316 248706 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
69317 : {
69318 248706 : traversal.visit(nodeList[i]);
69319 : }
69320 : #endif
69321 : }
69322 : #endif
69323 : }
69324 :
69325 : // This should not be required since all previously static data members are
69326 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
69327 :
69328 5342 : }
69329 :
69330 :
69331 : void
69332 194 : SgTemplateMemberFunctionDeclaration::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
69333 : {
69334 : // This function traverses the memory pool for an IR node and
69335 : // calls the function to execute the visitor object.
69336 :
69337 : // Initialize array to the address of the first element of the STL vector
69338 : // (which is guarenteed to be contiguous storage).
69339 : // SgTemplateMemberFunctionDeclaration objectArray [] = *(Memory_Block_List.begin());
69340 194 : if (SgTemplateMemberFunctionDeclaration::pools.empty() == false)
69341 : {
69342 : // Generate an array of memory pools
69343 137 : SgTemplateMemberFunctionDeclaration** objectArray = (SgTemplateMemberFunctionDeclaration**) &(SgTemplateMemberFunctionDeclaration::pools[0]);
69344 :
69345 : // Build a local variable for better performance
69346 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
69347 :
69348 : // Iterate over the memory pools
69349 292 : for (unsigned int i=0; i < SgTemplateMemberFunctionDeclaration::pools.size(); i++)
69350 : {
69351 : // objectArray[i] is a single memory pool
69352 310155 : for (unsigned j=0; j < SgTemplateMemberFunctionDeclaration::pool_size; j++)
69353 : {
69354 310000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
69355 : {
69356 : // printf ("Found a valid SgTemplateMemberFunctionDeclaration object in the memory pool %d at position %d \n",i,j);
69357 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
69358 270741 : objectArray[i][j].executeVisitorMemberFunction(visitor);
69359 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
69360 : }
69361 : else
69362 : {
69363 : // printf ("Found a INVALID SgTemplateMemberFunctionDeclaration object in the memory pool \n");
69364 : }
69365 : }
69366 : }
69367 : }
69368 :
69369 : // This should not be required since all previously static data members are
69370 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
69371 :
69372 194 : }
69373 :
69374 : void
69375 0 : SgTemplateMemberFunctionDeclaration::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
69376 : {
69377 : // This function visits only a single IR node of the memory pool.
69378 : // it is typically called once for each type of IR node within
69379 : // the automatically generated function: traverseRepresentativeNodes().
69380 :
69381 : // Initialize array to the address of the first element of the STL vector
69382 : // (which is guarenteed to be contiguous storage).
69383 : // SgTemplateMemberFunctionDeclaration objectArray [] = *(Memory_Block_List.begin());
69384 0 : if (SgTemplateMemberFunctionDeclaration::pools.empty() == false)
69385 : {
69386 : // Generate an array of memory pools
69387 0 : SgTemplateMemberFunctionDeclaration** objectArray = (SgTemplateMemberFunctionDeclaration**) &(SgTemplateMemberFunctionDeclaration::pools[0]);
69388 :
69389 : // Build a local variable for better performance
69390 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
69391 :
69392 : // Iterate over the memory pools
69393 0 : bool done = false;
69394 0 : unsigned i=0;
69395 :
69396 : // find the first valid IR node, call visit function, and then leave
69397 0 : while ( done == false && i < SgTemplateMemberFunctionDeclaration::pools.size() )
69398 : {
69399 : // objectArray[i] is a single memory pool
69400 : unsigned j=0;
69401 0 : while (done == false && j < SgTemplateMemberFunctionDeclaration::pool_size)
69402 : {
69403 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
69404 : {
69405 0 : traversal.visit(&(objectArray[i][j]));
69406 0 : done = true;
69407 : }
69408 0 : j++;
69409 : }
69410 0 : i++;
69411 : }
69412 :
69413 : #if 0
69414 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
69415 : if (done == false)
69416 : {
69417 : printf ("No representative for SgTemplateMemberFunctionDeclaration found in memory pools \n");
69418 : }
69419 : #endif
69420 : }
69421 0 : }
69422 :
69423 :
69424 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
69425 : // using values that overflow signed values of int.
69426 : size_t
69427 4 : SgTemplateMemberFunctionDeclaration::numberOfNodes()
69428 : {
69429 : // This function traverses the memory pool for an IR node and
69430 : // counts the number of IR nodes of a particular Sage III IR
69431 : // nodes type.
69432 :
69433 4 : size_t count = 0;
69434 4 : if (SgTemplateMemberFunctionDeclaration::pools.empty() == false)
69435 : {
69436 : // Generate an array of memory pools (this is actually a STL vector,
69437 : // but it is contiguious, so OK to treat this way).
69438 1 : SgTemplateMemberFunctionDeclaration** objectArray = (SgTemplateMemberFunctionDeclaration**) &(SgTemplateMemberFunctionDeclaration::pools[0]);
69439 :
69440 : // Build a local variable for better performance (make it a loop invariant variable).
69441 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
69442 :
69443 : // Iterate over all of the memory pools for this IR node.
69444 2 : for (unsigned int i=0; i < SgTemplateMemberFunctionDeclaration::pools.size(); i++)
69445 : {
69446 : // objectArray[i] is a single memory pool, iterate over all the
69447 : // IR nodes and only count those that are valid IR nodes used in
69448 : // the AST (i.e. allocated IR nodes).
69449 2001 : for (unsigned j=0; j < SgTemplateMemberFunctionDeclaration::pool_size; j++)
69450 : {
69451 : // This is indexing the STL vector of C/C++ style arrays as a doubly
69452 : // indexed array access. It is OK since we have leveraged the semantics
69453 : // of STL vector memory as contigous and cast the memory as an array
69454 : // of arrays to use the 2D array indexing. Hope this is not confusing,
69455 : // but it s very fast as an implementation.
69456 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
69457 : {
69458 1905 : count++;
69459 : }
69460 : }
69461 : }
69462 : }
69463 :
69464 :
69465 :
69466 4 : return count;
69467 : }
69468 :
69469 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
69470 : // using values that overflow signed values of int.
69471 : size_t
69472 0 : SgTemplateMemberFunctionDeclaration::memoryUsage()
69473 : {
69474 : // This function is required because we need the class name as a type when we call sizeof
69475 : // There might be another way to implement this if we have a traversal that only called a
69476 : // representative object (one call for each type of Sage IIIIR node).
69477 0 : size_t memory = numberOfNodes() * sizeof(SgTemplateMemberFunctionDeclaration);
69478 :
69479 0 : return memory;
69480 : }
69481 :
69482 : /* #line 69483 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
69483 :
69484 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
69485 : void
69486 5701 : SgTemplateInstantiationMemberFunctionDecl::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
69487 : {
69488 : // This function traverses the memory pool for only a specific IR node
69489 : // and calls the visit function of the input class execute a traversal
69490 : // similar to the style of the attribute based traversals within ROSE.
69491 : // This traversal will visit ALL nodes of the AST where as the other
69492 : // attribute based traversals visit only the embedded tree within the AST.
69493 :
69494 : // Initialize array to the address of the first element of the STL vector
69495 : // (which is guaranteed to be contiguous storage).
69496 : // SgTemplateInstantiationMemberFunctionDecl objectArray [] = *(Memory_Block_List.begin());
69497 5701 : if (SgTemplateInstantiationMemberFunctionDecl::pools.empty() == false)
69498 : {
69499 : // Generate an array of memory pools
69500 149 : SgTemplateInstantiationMemberFunctionDecl** objectArray = (SgTemplateInstantiationMemberFunctionDecl**) &(SgTemplateInstantiationMemberFunctionDecl::pools[0]);
69501 :
69502 : // Build a local variable for better performance
69503 149 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
69504 : #if 0
69505 : // Iterate over the memory pools
69506 : for (unsigned int i=0; i < SgTemplateInstantiationMemberFunctionDecl::pools.size(); i++)
69507 : {
69508 : // objectArray[i] is a single memory pool
69509 : for (int j=0; j < SgTemplateInstantiationMemberFunctionDecl::pool_size; j++)
69510 : {
69511 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
69512 : {
69513 : traversal.visit(&(objectArray[i][j]));
69514 : }
69515 : }
69516 : }
69517 : #else
69518 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
69519 : // compute the list first and then call the visit function on each list element.
69520 :
69521 : // printf ("Inside of SgTemplateInstantiationMemberFunctionDecl::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
69522 :
69523 298 : std::vector<SgTemplateInstantiationMemberFunctionDecl*> nodeList;
69524 :
69525 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
69526 298 : for (unsigned int i=0; i < SgTemplateInstantiationMemberFunctionDecl::pools.size(); i++)
69527 : {
69528 : // objectArray[i] is a single memory pool
69529 298149 : for (unsigned j=0; j < SgTemplateInstantiationMemberFunctionDecl::pool_size; j++)
69530 : {
69531 298000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
69532 : {
69533 221135 : nodeList.push_back(&(objectArray[i][j]));
69534 : }
69535 : }
69536 : }
69537 :
69538 : // Iterate over the saved list
69539 149 : size_t nodeListSize = nodeList.size();
69540 221284 : for (size_t i=0; i < nodeListSize; i++)
69541 : {
69542 221135 : ROSE_ASSERT(nodeList[i] != NULL);
69543 : #if 0
69544 : traversal.visit(nodeList[i]);
69545 : #else
69546 221135 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
69547 : {
69548 221135 : traversal.visit(nodeList[i]);
69549 : }
69550 : #endif
69551 : }
69552 : #endif
69553 : }
69554 :
69555 : // This should not be required since all previously static data members are
69556 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
69557 :
69558 5701 : }
69559 :
69560 :
69561 : void
69562 194 : SgTemplateInstantiationMemberFunctionDecl::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
69563 : {
69564 : // This function traverses the memory pool for an IR node and
69565 : // calls the function to execute the visitor object.
69566 :
69567 : // Initialize array to the address of the first element of the STL vector
69568 : // (which is guarenteed to be contiguous storage).
69569 : // SgTemplateInstantiationMemberFunctionDecl objectArray [] = *(Memory_Block_List.begin());
69570 194 : if (SgTemplateInstantiationMemberFunctionDecl::pools.empty() == false)
69571 : {
69572 : // Generate an array of memory pools
69573 137 : SgTemplateInstantiationMemberFunctionDecl** objectArray = (SgTemplateInstantiationMemberFunctionDecl**) &(SgTemplateInstantiationMemberFunctionDecl::pools[0]);
69574 :
69575 : // Build a local variable for better performance
69576 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
69577 :
69578 : // Iterate over the memory pools
69579 274 : for (unsigned int i=0; i < SgTemplateInstantiationMemberFunctionDecl::pools.size(); i++)
69580 : {
69581 : // objectArray[i] is a single memory pool
69582 274137 : for (unsigned j=0; j < SgTemplateInstantiationMemberFunctionDecl::pool_size; j++)
69583 : {
69584 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
69585 : {
69586 : // printf ("Found a valid SgTemplateInstantiationMemberFunctionDecl object in the memory pool %d at position %d \n",i,j);
69587 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
69588 238967 : objectArray[i][j].executeVisitorMemberFunction(visitor);
69589 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
69590 : }
69591 : else
69592 : {
69593 : // printf ("Found a INVALID SgTemplateInstantiationMemberFunctionDecl object in the memory pool \n");
69594 : }
69595 : }
69596 : }
69597 : }
69598 :
69599 : // This should not be required since all previously static data members are
69600 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
69601 :
69602 194 : }
69603 :
69604 : void
69605 0 : SgTemplateInstantiationMemberFunctionDecl::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
69606 : {
69607 : // This function visits only a single IR node of the memory pool.
69608 : // it is typically called once for each type of IR node within
69609 : // the automatically generated function: traverseRepresentativeNodes().
69610 :
69611 : // Initialize array to the address of the first element of the STL vector
69612 : // (which is guarenteed to be contiguous storage).
69613 : // SgTemplateInstantiationMemberFunctionDecl objectArray [] = *(Memory_Block_List.begin());
69614 0 : if (SgTemplateInstantiationMemberFunctionDecl::pools.empty() == false)
69615 : {
69616 : // Generate an array of memory pools
69617 0 : SgTemplateInstantiationMemberFunctionDecl** objectArray = (SgTemplateInstantiationMemberFunctionDecl**) &(SgTemplateInstantiationMemberFunctionDecl::pools[0]);
69618 :
69619 : // Build a local variable for better performance
69620 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
69621 :
69622 : // Iterate over the memory pools
69623 0 : bool done = false;
69624 0 : unsigned i=0;
69625 :
69626 : // find the first valid IR node, call visit function, and then leave
69627 0 : while ( done == false && i < SgTemplateInstantiationMemberFunctionDecl::pools.size() )
69628 : {
69629 : // objectArray[i] is a single memory pool
69630 : unsigned j=0;
69631 0 : while (done == false && j < SgTemplateInstantiationMemberFunctionDecl::pool_size)
69632 : {
69633 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
69634 : {
69635 0 : traversal.visit(&(objectArray[i][j]));
69636 0 : done = true;
69637 : }
69638 0 : j++;
69639 : }
69640 0 : i++;
69641 : }
69642 :
69643 : #if 0
69644 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
69645 : if (done == false)
69646 : {
69647 : printf ("No representative for SgTemplateInstantiationMemberFunctionDecl found in memory pools \n");
69648 : }
69649 : #endif
69650 : }
69651 0 : }
69652 :
69653 :
69654 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
69655 : // using values that overflow signed values of int.
69656 : size_t
69657 4 : SgTemplateInstantiationMemberFunctionDecl::numberOfNodes()
69658 : {
69659 : // This function traverses the memory pool for an IR node and
69660 : // counts the number of IR nodes of a particular Sage III IR
69661 : // nodes type.
69662 :
69663 4 : size_t count = 0;
69664 4 : if (SgTemplateInstantiationMemberFunctionDecl::pools.empty() == false)
69665 : {
69666 : // Generate an array of memory pools (this is actually a STL vector,
69667 : // but it is contiguious, so OK to treat this way).
69668 1 : SgTemplateInstantiationMemberFunctionDecl** objectArray = (SgTemplateInstantiationMemberFunctionDecl**) &(SgTemplateInstantiationMemberFunctionDecl::pools[0]);
69669 :
69670 : // Build a local variable for better performance (make it a loop invariant variable).
69671 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
69672 :
69673 : // Iterate over all of the memory pools for this IR node.
69674 2 : for (unsigned int i=0; i < SgTemplateInstantiationMemberFunctionDecl::pools.size(); i++)
69675 : {
69676 : // objectArray[i] is a single memory pool, iterate over all the
69677 : // IR nodes and only count those that are valid IR nodes used in
69678 : // the AST (i.e. allocated IR nodes).
69679 2001 : for (unsigned j=0; j < SgTemplateInstantiationMemberFunctionDecl::pool_size; j++)
69680 : {
69681 : // This is indexing the STL vector of C/C++ style arrays as a doubly
69682 : // indexed array access. It is OK since we have leveraged the semantics
69683 : // of STL vector memory as contigous and cast the memory as an array
69684 : // of arrays to use the 2D array indexing. Hope this is not confusing,
69685 : // but it s very fast as an implementation.
69686 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
69687 : {
69688 1739 : count++;
69689 : }
69690 : }
69691 : }
69692 : }
69693 :
69694 :
69695 :
69696 4 : return count;
69697 : }
69698 :
69699 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
69700 : // using values that overflow signed values of int.
69701 : size_t
69702 0 : SgTemplateInstantiationMemberFunctionDecl::memoryUsage()
69703 : {
69704 : // This function is required because we need the class name as a type when we call sizeof
69705 : // There might be another way to implement this if we have a traversal that only called a
69706 : // representative object (one call for each type of Sage IIIIR node).
69707 0 : size_t memory = numberOfNodes() * sizeof(SgTemplateInstantiationMemberFunctionDecl);
69708 :
69709 0 : return memory;
69710 : }
69711 :
69712 : /* #line 69713 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
69713 :
69714 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
69715 : void
69716 5701 : SgTemplateInstantiationFunctionDecl::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
69717 : {
69718 : // This function traverses the memory pool for only a specific IR node
69719 : // and calls the visit function of the input class execute a traversal
69720 : // similar to the style of the attribute based traversals within ROSE.
69721 : // This traversal will visit ALL nodes of the AST where as the other
69722 : // attribute based traversals visit only the embedded tree within the AST.
69723 :
69724 : // Initialize array to the address of the first element of the STL vector
69725 : // (which is guaranteed to be contiguous storage).
69726 : // SgTemplateInstantiationFunctionDecl objectArray [] = *(Memory_Block_List.begin());
69727 5701 : if (SgTemplateInstantiationFunctionDecl::pools.empty() == false)
69728 : {
69729 : // Generate an array of memory pools
69730 149 : SgTemplateInstantiationFunctionDecl** objectArray = (SgTemplateInstantiationFunctionDecl**) &(SgTemplateInstantiationFunctionDecl::pools[0]);
69731 :
69732 : // Build a local variable for better performance
69733 149 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
69734 : #if 0
69735 : // Iterate over the memory pools
69736 : for (unsigned int i=0; i < SgTemplateInstantiationFunctionDecl::pools.size(); i++)
69737 : {
69738 : // objectArray[i] is a single memory pool
69739 : for (int j=0; j < SgTemplateInstantiationFunctionDecl::pool_size; j++)
69740 : {
69741 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
69742 : {
69743 : traversal.visit(&(objectArray[i][j]));
69744 : }
69745 : }
69746 : }
69747 : #else
69748 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
69749 : // compute the list first and then call the visit function on each list element.
69750 :
69751 : // printf ("Inside of SgTemplateInstantiationFunctionDecl::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
69752 :
69753 298 : std::vector<SgTemplateInstantiationFunctionDecl*> nodeList;
69754 :
69755 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
69756 298 : for (unsigned int i=0; i < SgTemplateInstantiationFunctionDecl::pools.size(); i++)
69757 : {
69758 : // objectArray[i] is a single memory pool
69759 298149 : for (unsigned j=0; j < SgTemplateInstantiationFunctionDecl::pool_size; j++)
69760 : {
69761 298000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
69762 : {
69763 34823 : nodeList.push_back(&(objectArray[i][j]));
69764 : }
69765 : }
69766 : }
69767 :
69768 : // Iterate over the saved list
69769 149 : size_t nodeListSize = nodeList.size();
69770 34972 : for (size_t i=0; i < nodeListSize; i++)
69771 : {
69772 34823 : ROSE_ASSERT(nodeList[i] != NULL);
69773 : #if 0
69774 : traversal.visit(nodeList[i]);
69775 : #else
69776 34823 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
69777 : {
69778 34823 : traversal.visit(nodeList[i]);
69779 : }
69780 : #endif
69781 : }
69782 : #endif
69783 : }
69784 :
69785 : // This should not be required since all previously static data members are
69786 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
69787 :
69788 5701 : }
69789 :
69790 :
69791 : void
69792 194 : SgTemplateInstantiationFunctionDecl::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
69793 : {
69794 : // This function traverses the memory pool for an IR node and
69795 : // calls the function to execute the visitor object.
69796 :
69797 : // Initialize array to the address of the first element of the STL vector
69798 : // (which is guarenteed to be contiguous storage).
69799 : // SgTemplateInstantiationFunctionDecl objectArray [] = *(Memory_Block_List.begin());
69800 194 : if (SgTemplateInstantiationFunctionDecl::pools.empty() == false)
69801 : {
69802 : // Generate an array of memory pools
69803 137 : SgTemplateInstantiationFunctionDecl** objectArray = (SgTemplateInstantiationFunctionDecl**) &(SgTemplateInstantiationFunctionDecl::pools[0]);
69804 :
69805 : // Build a local variable for better performance
69806 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
69807 :
69808 : // Iterate over the memory pools
69809 274 : for (unsigned int i=0; i < SgTemplateInstantiationFunctionDecl::pools.size(); i++)
69810 : {
69811 : // objectArray[i] is a single memory pool
69812 274137 : for (unsigned j=0; j < SgTemplateInstantiationFunctionDecl::pool_size; j++)
69813 : {
69814 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
69815 : {
69816 : // printf ("Found a valid SgTemplateInstantiationFunctionDecl object in the memory pool %d at position %d \n",i,j);
69817 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
69818 38671 : objectArray[i][j].executeVisitorMemberFunction(visitor);
69819 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
69820 : }
69821 : else
69822 : {
69823 : // printf ("Found a INVALID SgTemplateInstantiationFunctionDecl object in the memory pool \n");
69824 : }
69825 : }
69826 : }
69827 : }
69828 :
69829 : // This should not be required since all previously static data members are
69830 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
69831 :
69832 194 : }
69833 :
69834 : void
69835 0 : SgTemplateInstantiationFunctionDecl::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
69836 : {
69837 : // This function visits only a single IR node of the memory pool.
69838 : // it is typically called once for each type of IR node within
69839 : // the automatically generated function: traverseRepresentativeNodes().
69840 :
69841 : // Initialize array to the address of the first element of the STL vector
69842 : // (which is guarenteed to be contiguous storage).
69843 : // SgTemplateInstantiationFunctionDecl objectArray [] = *(Memory_Block_List.begin());
69844 0 : if (SgTemplateInstantiationFunctionDecl::pools.empty() == false)
69845 : {
69846 : // Generate an array of memory pools
69847 0 : SgTemplateInstantiationFunctionDecl** objectArray = (SgTemplateInstantiationFunctionDecl**) &(SgTemplateInstantiationFunctionDecl::pools[0]);
69848 :
69849 : // Build a local variable for better performance
69850 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
69851 :
69852 : // Iterate over the memory pools
69853 0 : bool done = false;
69854 0 : unsigned i=0;
69855 :
69856 : // find the first valid IR node, call visit function, and then leave
69857 0 : while ( done == false && i < SgTemplateInstantiationFunctionDecl::pools.size() )
69858 : {
69859 : // objectArray[i] is a single memory pool
69860 : unsigned j=0;
69861 0 : while (done == false && j < SgTemplateInstantiationFunctionDecl::pool_size)
69862 : {
69863 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
69864 : {
69865 0 : traversal.visit(&(objectArray[i][j]));
69866 0 : done = true;
69867 : }
69868 0 : j++;
69869 : }
69870 0 : i++;
69871 : }
69872 :
69873 : #if 0
69874 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
69875 : if (done == false)
69876 : {
69877 : printf ("No representative for SgTemplateInstantiationFunctionDecl found in memory pools \n");
69878 : }
69879 : #endif
69880 : }
69881 0 : }
69882 :
69883 :
69884 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
69885 : // using values that overflow signed values of int.
69886 : size_t
69887 4 : SgTemplateInstantiationFunctionDecl::numberOfNodes()
69888 : {
69889 : // This function traverses the memory pool for an IR node and
69890 : // counts the number of IR nodes of a particular Sage III IR
69891 : // nodes type.
69892 :
69893 4 : size_t count = 0;
69894 4 : if (SgTemplateInstantiationFunctionDecl::pools.empty() == false)
69895 : {
69896 : // Generate an array of memory pools (this is actually a STL vector,
69897 : // but it is contiguious, so OK to treat this way).
69898 1 : SgTemplateInstantiationFunctionDecl** objectArray = (SgTemplateInstantiationFunctionDecl**) &(SgTemplateInstantiationFunctionDecl::pools[0]);
69899 :
69900 : // Build a local variable for better performance (make it a loop invariant variable).
69901 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
69902 :
69903 : // Iterate over all of the memory pools for this IR node.
69904 2 : for (unsigned int i=0; i < SgTemplateInstantiationFunctionDecl::pools.size(); i++)
69905 : {
69906 : // objectArray[i] is a single memory pool, iterate over all the
69907 : // IR nodes and only count those that are valid IR nodes used in
69908 : // the AST (i.e. allocated IR nodes).
69909 2001 : for (unsigned j=0; j < SgTemplateInstantiationFunctionDecl::pool_size; j++)
69910 : {
69911 : // This is indexing the STL vector of C/C++ style arrays as a doubly
69912 : // indexed array access. It is OK since we have leveraged the semantics
69913 : // of STL vector memory as contigous and cast the memory as an array
69914 : // of arrays to use the 2D array indexing. Hope this is not confusing,
69915 : // but it s very fast as an implementation.
69916 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
69917 : {
69918 283 : count++;
69919 : }
69920 : }
69921 : }
69922 : }
69923 :
69924 :
69925 :
69926 4 : return count;
69927 : }
69928 :
69929 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
69930 : // using values that overflow signed values of int.
69931 : size_t
69932 0 : SgTemplateInstantiationFunctionDecl::memoryUsage()
69933 : {
69934 : // This function is required because we need the class name as a type when we call sizeof
69935 : // There might be another way to implement this if we have a traversal that only called a
69936 : // representative object (one call for each type of Sage IIIIR node).
69937 0 : size_t memory = numberOfNodes() * sizeof(SgTemplateInstantiationFunctionDecl);
69938 :
69939 0 : return memory;
69940 : }
69941 :
69942 : /* #line 69943 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
69943 :
69944 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
69945 : void
69946 5342 : SgProgramHeaderStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
69947 : {
69948 : // This function traverses the memory pool for only a specific IR node
69949 : // and calls the visit function of the input class execute a traversal
69950 : // similar to the style of the attribute based traversals within ROSE.
69951 : // This traversal will visit ALL nodes of the AST where as the other
69952 : // attribute based traversals visit only the embedded tree within the AST.
69953 :
69954 : // Initialize array to the address of the first element of the STL vector
69955 : // (which is guaranteed to be contiguous storage).
69956 : // SgProgramHeaderStatement objectArray [] = *(Memory_Block_List.begin());
69957 5342 : if (SgProgramHeaderStatement::pools.empty() == false)
69958 : {
69959 : // Generate an array of memory pools
69960 534 : SgProgramHeaderStatement** objectArray = (SgProgramHeaderStatement**) &(SgProgramHeaderStatement::pools[0]);
69961 :
69962 : // Build a local variable for better performance
69963 534 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
69964 : #if 0
69965 : // Iterate over the memory pools
69966 : for (unsigned int i=0; i < SgProgramHeaderStatement::pools.size(); i++)
69967 : {
69968 : // objectArray[i] is a single memory pool
69969 : for (int j=0; j < SgProgramHeaderStatement::pool_size; j++)
69970 : {
69971 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
69972 : {
69973 : traversal.visit(&(objectArray[i][j]));
69974 : }
69975 : }
69976 : }
69977 : #else
69978 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
69979 : // compute the list first and then call the visit function on each list element.
69980 :
69981 : // printf ("Inside of SgProgramHeaderStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
69982 :
69983 1068 : std::vector<SgProgramHeaderStatement*> nodeList;
69984 :
69985 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
69986 1068 : for (unsigned int i=0; i < SgProgramHeaderStatement::pools.size(); i++)
69987 : {
69988 : // objectArray[i] is a single memory pool
69989 1068530 : for (unsigned j=0; j < SgProgramHeaderStatement::pool_size; j++)
69990 : {
69991 1068000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
69992 : {
69993 534 : nodeList.push_back(&(objectArray[i][j]));
69994 : }
69995 : }
69996 : }
69997 :
69998 : // Iterate over the saved list
69999 534 : size_t nodeListSize = nodeList.size();
70000 1068 : for (size_t i=0; i < nodeListSize; i++)
70001 : {
70002 534 : ROSE_ASSERT(nodeList[i] != NULL);
70003 : #if 0
70004 : traversal.visit(nodeList[i]);
70005 : #else
70006 534 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
70007 : {
70008 534 : traversal.visit(nodeList[i]);
70009 : }
70010 : #endif
70011 : }
70012 : #endif
70013 : }
70014 :
70015 : // This should not be required since all previously static data members are
70016 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
70017 :
70018 5342 : }
70019 :
70020 :
70021 : void
70022 194 : SgProgramHeaderStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
70023 : {
70024 : // This function traverses the memory pool for an IR node and
70025 : // calls the function to execute the visitor object.
70026 :
70027 : // Initialize array to the address of the first element of the STL vector
70028 : // (which is guarenteed to be contiguous storage).
70029 : // SgProgramHeaderStatement objectArray [] = *(Memory_Block_List.begin());
70030 194 : if (SgProgramHeaderStatement::pools.empty() == false)
70031 : {
70032 : // Generate an array of memory pools
70033 0 : SgProgramHeaderStatement** objectArray = (SgProgramHeaderStatement**) &(SgProgramHeaderStatement::pools[0]);
70034 :
70035 : // Build a local variable for better performance
70036 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
70037 :
70038 : // Iterate over the memory pools
70039 0 : for (unsigned int i=0; i < SgProgramHeaderStatement::pools.size(); i++)
70040 : {
70041 : // objectArray[i] is a single memory pool
70042 0 : for (unsigned j=0; j < SgProgramHeaderStatement::pool_size; j++)
70043 : {
70044 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
70045 : {
70046 : // printf ("Found a valid SgProgramHeaderStatement object in the memory pool %d at position %d \n",i,j);
70047 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
70048 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
70049 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
70050 : }
70051 : else
70052 : {
70053 : // printf ("Found a INVALID SgProgramHeaderStatement object in the memory pool \n");
70054 : }
70055 : }
70056 : }
70057 : }
70058 :
70059 : // This should not be required since all previously static data members are
70060 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
70061 :
70062 194 : }
70063 :
70064 : void
70065 0 : SgProgramHeaderStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
70066 : {
70067 : // This function visits only a single IR node of the memory pool.
70068 : // it is typically called once for each type of IR node within
70069 : // the automatically generated function: traverseRepresentativeNodes().
70070 :
70071 : // Initialize array to the address of the first element of the STL vector
70072 : // (which is guarenteed to be contiguous storage).
70073 : // SgProgramHeaderStatement objectArray [] = *(Memory_Block_List.begin());
70074 0 : if (SgProgramHeaderStatement::pools.empty() == false)
70075 : {
70076 : // Generate an array of memory pools
70077 0 : SgProgramHeaderStatement** objectArray = (SgProgramHeaderStatement**) &(SgProgramHeaderStatement::pools[0]);
70078 :
70079 : // Build a local variable for better performance
70080 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
70081 :
70082 : // Iterate over the memory pools
70083 0 : bool done = false;
70084 0 : unsigned i=0;
70085 :
70086 : // find the first valid IR node, call visit function, and then leave
70087 0 : while ( done == false && i < SgProgramHeaderStatement::pools.size() )
70088 : {
70089 : // objectArray[i] is a single memory pool
70090 : unsigned j=0;
70091 0 : while (done == false && j < SgProgramHeaderStatement::pool_size)
70092 : {
70093 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
70094 : {
70095 0 : traversal.visit(&(objectArray[i][j]));
70096 0 : done = true;
70097 : }
70098 0 : j++;
70099 : }
70100 0 : i++;
70101 : }
70102 :
70103 : #if 0
70104 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
70105 : if (done == false)
70106 : {
70107 : printf ("No representative for SgProgramHeaderStatement found in memory pools \n");
70108 : }
70109 : #endif
70110 : }
70111 0 : }
70112 :
70113 :
70114 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
70115 : // using values that overflow signed values of int.
70116 : size_t
70117 4 : SgProgramHeaderStatement::numberOfNodes()
70118 : {
70119 : // This function traverses the memory pool for an IR node and
70120 : // counts the number of IR nodes of a particular Sage III IR
70121 : // nodes type.
70122 :
70123 4 : size_t count = 0;
70124 4 : if (SgProgramHeaderStatement::pools.empty() == false)
70125 : {
70126 : // Generate an array of memory pools (this is actually a STL vector,
70127 : // but it is contiguious, so OK to treat this way).
70128 0 : SgProgramHeaderStatement** objectArray = (SgProgramHeaderStatement**) &(SgProgramHeaderStatement::pools[0]);
70129 :
70130 : // Build a local variable for better performance (make it a loop invariant variable).
70131 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
70132 :
70133 : // Iterate over all of the memory pools for this IR node.
70134 0 : for (unsigned int i=0; i < SgProgramHeaderStatement::pools.size(); i++)
70135 : {
70136 : // objectArray[i] is a single memory pool, iterate over all the
70137 : // IR nodes and only count those that are valid IR nodes used in
70138 : // the AST (i.e. allocated IR nodes).
70139 0 : for (unsigned j=0; j < SgProgramHeaderStatement::pool_size; j++)
70140 : {
70141 : // This is indexing the STL vector of C/C++ style arrays as a doubly
70142 : // indexed array access. It is OK since we have leveraged the semantics
70143 : // of STL vector memory as contigous and cast the memory as an array
70144 : // of arrays to use the 2D array indexing. Hope this is not confusing,
70145 : // but it s very fast as an implementation.
70146 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
70147 : {
70148 0 : count++;
70149 : }
70150 : }
70151 : }
70152 : }
70153 :
70154 :
70155 :
70156 4 : return count;
70157 : }
70158 :
70159 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
70160 : // using values that overflow signed values of int.
70161 : size_t
70162 0 : SgProgramHeaderStatement::memoryUsage()
70163 : {
70164 : // This function is required because we need the class name as a type when we call sizeof
70165 : // There might be another way to implement this if we have a traversal that only called a
70166 : // representative object (one call for each type of Sage IIIIR node).
70167 0 : size_t memory = numberOfNodes() * sizeof(SgProgramHeaderStatement);
70168 :
70169 0 : return memory;
70170 : }
70171 :
70172 : /* #line 70173 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
70173 :
70174 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
70175 : void
70176 5342 : SgProcedureHeaderStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
70177 : {
70178 : // This function traverses the memory pool for only a specific IR node
70179 : // and calls the visit function of the input class execute a traversal
70180 : // similar to the style of the attribute based traversals within ROSE.
70181 : // This traversal will visit ALL nodes of the AST where as the other
70182 : // attribute based traversals visit only the embedded tree within the AST.
70183 :
70184 : // Initialize array to the address of the first element of the STL vector
70185 : // (which is guaranteed to be contiguous storage).
70186 : // SgProcedureHeaderStatement objectArray [] = *(Memory_Block_List.begin());
70187 5342 : if (SgProcedureHeaderStatement::pools.empty() == false)
70188 : {
70189 : // Generate an array of memory pools
70190 427 : SgProcedureHeaderStatement** objectArray = (SgProcedureHeaderStatement**) &(SgProcedureHeaderStatement::pools[0]);
70191 :
70192 : // Build a local variable for better performance
70193 427 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
70194 : #if 0
70195 : // Iterate over the memory pools
70196 : for (unsigned int i=0; i < SgProcedureHeaderStatement::pools.size(); i++)
70197 : {
70198 : // objectArray[i] is a single memory pool
70199 : for (int j=0; j < SgProcedureHeaderStatement::pool_size; j++)
70200 : {
70201 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
70202 : {
70203 : traversal.visit(&(objectArray[i][j]));
70204 : }
70205 : }
70206 : }
70207 : #else
70208 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
70209 : // compute the list first and then call the visit function on each list element.
70210 :
70211 : // printf ("Inside of SgProcedureHeaderStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
70212 :
70213 854 : std::vector<SgProcedureHeaderStatement*> nodeList;
70214 :
70215 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
70216 854 : for (unsigned int i=0; i < SgProcedureHeaderStatement::pools.size(); i++)
70217 : {
70218 : // objectArray[i] is a single memory pool
70219 854427 : for (unsigned j=0; j < SgProcedureHeaderStatement::pool_size; j++)
70220 : {
70221 854000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
70222 : {
70223 7924 : nodeList.push_back(&(objectArray[i][j]));
70224 : }
70225 : }
70226 : }
70227 :
70228 : // Iterate over the saved list
70229 427 : size_t nodeListSize = nodeList.size();
70230 8351 : for (size_t i=0; i < nodeListSize; i++)
70231 : {
70232 7924 : ROSE_ASSERT(nodeList[i] != NULL);
70233 : #if 0
70234 : traversal.visit(nodeList[i]);
70235 : #else
70236 7924 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
70237 : {
70238 7924 : traversal.visit(nodeList[i]);
70239 : }
70240 : #endif
70241 : }
70242 : #endif
70243 : }
70244 :
70245 : // This should not be required since all previously static data members are
70246 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
70247 :
70248 5342 : }
70249 :
70250 :
70251 : void
70252 194 : SgProcedureHeaderStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
70253 : {
70254 : // This function traverses the memory pool for an IR node and
70255 : // calls the function to execute the visitor object.
70256 :
70257 : // Initialize array to the address of the first element of the STL vector
70258 : // (which is guarenteed to be contiguous storage).
70259 : // SgProcedureHeaderStatement objectArray [] = *(Memory_Block_List.begin());
70260 194 : if (SgProcedureHeaderStatement::pools.empty() == false)
70261 : {
70262 : // Generate an array of memory pools
70263 0 : SgProcedureHeaderStatement** objectArray = (SgProcedureHeaderStatement**) &(SgProcedureHeaderStatement::pools[0]);
70264 :
70265 : // Build a local variable for better performance
70266 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
70267 :
70268 : // Iterate over the memory pools
70269 0 : for (unsigned int i=0; i < SgProcedureHeaderStatement::pools.size(); i++)
70270 : {
70271 : // objectArray[i] is a single memory pool
70272 0 : for (unsigned j=0; j < SgProcedureHeaderStatement::pool_size; j++)
70273 : {
70274 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
70275 : {
70276 : // printf ("Found a valid SgProcedureHeaderStatement object in the memory pool %d at position %d \n",i,j);
70277 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
70278 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
70279 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
70280 : }
70281 : else
70282 : {
70283 : // printf ("Found a INVALID SgProcedureHeaderStatement object in the memory pool \n");
70284 : }
70285 : }
70286 : }
70287 : }
70288 :
70289 : // This should not be required since all previously static data members are
70290 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
70291 :
70292 194 : }
70293 :
70294 : void
70295 0 : SgProcedureHeaderStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
70296 : {
70297 : // This function visits only a single IR node of the memory pool.
70298 : // it is typically called once for each type of IR node within
70299 : // the automatically generated function: traverseRepresentativeNodes().
70300 :
70301 : // Initialize array to the address of the first element of the STL vector
70302 : // (which is guarenteed to be contiguous storage).
70303 : // SgProcedureHeaderStatement objectArray [] = *(Memory_Block_List.begin());
70304 0 : if (SgProcedureHeaderStatement::pools.empty() == false)
70305 : {
70306 : // Generate an array of memory pools
70307 0 : SgProcedureHeaderStatement** objectArray = (SgProcedureHeaderStatement**) &(SgProcedureHeaderStatement::pools[0]);
70308 :
70309 : // Build a local variable for better performance
70310 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
70311 :
70312 : // Iterate over the memory pools
70313 0 : bool done = false;
70314 0 : unsigned i=0;
70315 :
70316 : // find the first valid IR node, call visit function, and then leave
70317 0 : while ( done == false && i < SgProcedureHeaderStatement::pools.size() )
70318 : {
70319 : // objectArray[i] is a single memory pool
70320 : unsigned j=0;
70321 0 : while (done == false && j < SgProcedureHeaderStatement::pool_size)
70322 : {
70323 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
70324 : {
70325 0 : traversal.visit(&(objectArray[i][j]));
70326 0 : done = true;
70327 : }
70328 0 : j++;
70329 : }
70330 0 : i++;
70331 : }
70332 :
70333 : #if 0
70334 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
70335 : if (done == false)
70336 : {
70337 : printf ("No representative for SgProcedureHeaderStatement found in memory pools \n");
70338 : }
70339 : #endif
70340 : }
70341 0 : }
70342 :
70343 :
70344 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
70345 : // using values that overflow signed values of int.
70346 : size_t
70347 4 : SgProcedureHeaderStatement::numberOfNodes()
70348 : {
70349 : // This function traverses the memory pool for an IR node and
70350 : // counts the number of IR nodes of a particular Sage III IR
70351 : // nodes type.
70352 :
70353 4 : size_t count = 0;
70354 4 : if (SgProcedureHeaderStatement::pools.empty() == false)
70355 : {
70356 : // Generate an array of memory pools (this is actually a STL vector,
70357 : // but it is contiguious, so OK to treat this way).
70358 2 : SgProcedureHeaderStatement** objectArray = (SgProcedureHeaderStatement**) &(SgProcedureHeaderStatement::pools[0]);
70359 :
70360 : // Build a local variable for better performance (make it a loop invariant variable).
70361 2 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
70362 :
70363 : // Iterate over all of the memory pools for this IR node.
70364 4 : for (unsigned int i=0; i < SgProcedureHeaderStatement::pools.size(); i++)
70365 : {
70366 : // objectArray[i] is a single memory pool, iterate over all the
70367 : // IR nodes and only count those that are valid IR nodes used in
70368 : // the AST (i.e. allocated IR nodes).
70369 4002 : for (unsigned j=0; j < SgProcedureHeaderStatement::pool_size; j++)
70370 : {
70371 : // This is indexing the STL vector of C/C++ style arrays as a doubly
70372 : // indexed array access. It is OK since we have leveraged the semantics
70373 : // of STL vector memory as contigous and cast the memory as an array
70374 : // of arrays to use the 2D array indexing. Hope this is not confusing,
70375 : // but it s very fast as an implementation.
70376 4000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
70377 : {
70378 9 : count++;
70379 : }
70380 : }
70381 : }
70382 : }
70383 :
70384 :
70385 :
70386 4 : return count;
70387 : }
70388 :
70389 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
70390 : // using values that overflow signed values of int.
70391 : size_t
70392 0 : SgProcedureHeaderStatement::memoryUsage()
70393 : {
70394 : // This function is required because we need the class name as a type when we call sizeof
70395 : // There might be another way to implement this if we have a traversal that only called a
70396 : // representative object (one call for each type of Sage IIIIR node).
70397 0 : size_t memory = numberOfNodes() * sizeof(SgProcedureHeaderStatement);
70398 :
70399 0 : return memory;
70400 : }
70401 :
70402 : /* #line 70403 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
70403 :
70404 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
70405 : void
70406 5342 : SgEntryStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
70407 : {
70408 : // This function traverses the memory pool for only a specific IR node
70409 : // and calls the visit function of the input class execute a traversal
70410 : // similar to the style of the attribute based traversals within ROSE.
70411 : // This traversal will visit ALL nodes of the AST where as the other
70412 : // attribute based traversals visit only the embedded tree within the AST.
70413 :
70414 : // Initialize array to the address of the first element of the STL vector
70415 : // (which is guaranteed to be contiguous storage).
70416 : // SgEntryStatement objectArray [] = *(Memory_Block_List.begin());
70417 5342 : if (SgEntryStatement::pools.empty() == false)
70418 : {
70419 : // Generate an array of memory pools
70420 0 : SgEntryStatement** objectArray = (SgEntryStatement**) &(SgEntryStatement::pools[0]);
70421 :
70422 : // Build a local variable for better performance
70423 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
70424 : #if 0
70425 : // Iterate over the memory pools
70426 : for (unsigned int i=0; i < SgEntryStatement::pools.size(); i++)
70427 : {
70428 : // objectArray[i] is a single memory pool
70429 : for (int j=0; j < SgEntryStatement::pool_size; j++)
70430 : {
70431 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
70432 : {
70433 : traversal.visit(&(objectArray[i][j]));
70434 : }
70435 : }
70436 : }
70437 : #else
70438 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
70439 : // compute the list first and then call the visit function on each list element.
70440 :
70441 : // printf ("Inside of SgEntryStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
70442 :
70443 0 : std::vector<SgEntryStatement*> nodeList;
70444 :
70445 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
70446 0 : for (unsigned int i=0; i < SgEntryStatement::pools.size(); i++)
70447 : {
70448 : // objectArray[i] is a single memory pool
70449 0 : for (unsigned j=0; j < SgEntryStatement::pool_size; j++)
70450 : {
70451 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
70452 : {
70453 0 : nodeList.push_back(&(objectArray[i][j]));
70454 : }
70455 : }
70456 : }
70457 :
70458 : // Iterate over the saved list
70459 0 : size_t nodeListSize = nodeList.size();
70460 0 : for (size_t i=0; i < nodeListSize; i++)
70461 : {
70462 0 : ROSE_ASSERT(nodeList[i] != NULL);
70463 : #if 0
70464 : traversal.visit(nodeList[i]);
70465 : #else
70466 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
70467 : {
70468 0 : traversal.visit(nodeList[i]);
70469 : }
70470 : #endif
70471 : }
70472 : #endif
70473 : }
70474 :
70475 : // This should not be required since all previously static data members are
70476 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
70477 :
70478 5342 : }
70479 :
70480 :
70481 : void
70482 194 : SgEntryStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
70483 : {
70484 : // This function traverses the memory pool for an IR node and
70485 : // calls the function to execute the visitor object.
70486 :
70487 : // Initialize array to the address of the first element of the STL vector
70488 : // (which is guarenteed to be contiguous storage).
70489 : // SgEntryStatement objectArray [] = *(Memory_Block_List.begin());
70490 194 : if (SgEntryStatement::pools.empty() == false)
70491 : {
70492 : // Generate an array of memory pools
70493 0 : SgEntryStatement** objectArray = (SgEntryStatement**) &(SgEntryStatement::pools[0]);
70494 :
70495 : // Build a local variable for better performance
70496 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
70497 :
70498 : // Iterate over the memory pools
70499 0 : for (unsigned int i=0; i < SgEntryStatement::pools.size(); i++)
70500 : {
70501 : // objectArray[i] is a single memory pool
70502 0 : for (unsigned j=0; j < SgEntryStatement::pool_size; j++)
70503 : {
70504 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
70505 : {
70506 : // printf ("Found a valid SgEntryStatement object in the memory pool %d at position %d \n",i,j);
70507 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
70508 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
70509 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
70510 : }
70511 : else
70512 : {
70513 : // printf ("Found a INVALID SgEntryStatement object in the memory pool \n");
70514 : }
70515 : }
70516 : }
70517 : }
70518 :
70519 : // This should not be required since all previously static data members are
70520 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
70521 :
70522 194 : }
70523 :
70524 : void
70525 0 : SgEntryStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
70526 : {
70527 : // This function visits only a single IR node of the memory pool.
70528 : // it is typically called once for each type of IR node within
70529 : // the automatically generated function: traverseRepresentativeNodes().
70530 :
70531 : // Initialize array to the address of the first element of the STL vector
70532 : // (which is guarenteed to be contiguous storage).
70533 : // SgEntryStatement objectArray [] = *(Memory_Block_List.begin());
70534 0 : if (SgEntryStatement::pools.empty() == false)
70535 : {
70536 : // Generate an array of memory pools
70537 0 : SgEntryStatement** objectArray = (SgEntryStatement**) &(SgEntryStatement::pools[0]);
70538 :
70539 : // Build a local variable for better performance
70540 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
70541 :
70542 : // Iterate over the memory pools
70543 0 : bool done = false;
70544 0 : unsigned i=0;
70545 :
70546 : // find the first valid IR node, call visit function, and then leave
70547 0 : while ( done == false && i < SgEntryStatement::pools.size() )
70548 : {
70549 : // objectArray[i] is a single memory pool
70550 : unsigned j=0;
70551 0 : while (done == false && j < SgEntryStatement::pool_size)
70552 : {
70553 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
70554 : {
70555 0 : traversal.visit(&(objectArray[i][j]));
70556 0 : done = true;
70557 : }
70558 0 : j++;
70559 : }
70560 0 : i++;
70561 : }
70562 :
70563 : #if 0
70564 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
70565 : if (done == false)
70566 : {
70567 : printf ("No representative for SgEntryStatement found in memory pools \n");
70568 : }
70569 : #endif
70570 : }
70571 0 : }
70572 :
70573 :
70574 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
70575 : // using values that overflow signed values of int.
70576 : size_t
70577 4 : SgEntryStatement::numberOfNodes()
70578 : {
70579 : // This function traverses the memory pool for an IR node and
70580 : // counts the number of IR nodes of a particular Sage III IR
70581 : // nodes type.
70582 :
70583 4 : size_t count = 0;
70584 4 : if (SgEntryStatement::pools.empty() == false)
70585 : {
70586 : // Generate an array of memory pools (this is actually a STL vector,
70587 : // but it is contiguious, so OK to treat this way).
70588 0 : SgEntryStatement** objectArray = (SgEntryStatement**) &(SgEntryStatement::pools[0]);
70589 :
70590 : // Build a local variable for better performance (make it a loop invariant variable).
70591 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
70592 :
70593 : // Iterate over all of the memory pools for this IR node.
70594 0 : for (unsigned int i=0; i < SgEntryStatement::pools.size(); i++)
70595 : {
70596 : // objectArray[i] is a single memory pool, iterate over all the
70597 : // IR nodes and only count those that are valid IR nodes used in
70598 : // the AST (i.e. allocated IR nodes).
70599 0 : for (unsigned j=0; j < SgEntryStatement::pool_size; j++)
70600 : {
70601 : // This is indexing the STL vector of C/C++ style arrays as a doubly
70602 : // indexed array access. It is OK since we have leveraged the semantics
70603 : // of STL vector memory as contigous and cast the memory as an array
70604 : // of arrays to use the 2D array indexing. Hope this is not confusing,
70605 : // but it s very fast as an implementation.
70606 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
70607 : {
70608 0 : count++;
70609 : }
70610 : }
70611 : }
70612 : }
70613 :
70614 :
70615 :
70616 4 : return count;
70617 : }
70618 :
70619 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
70620 : // using values that overflow signed values of int.
70621 : size_t
70622 0 : SgEntryStatement::memoryUsage()
70623 : {
70624 : // This function is required because we need the class name as a type when we call sizeof
70625 : // There might be another way to implement this if we have a traversal that only called a
70626 : // representative object (one call for each type of Sage IIIIR node).
70627 0 : size_t memory = numberOfNodes() * sizeof(SgEntryStatement);
70628 :
70629 0 : return memory;
70630 : }
70631 :
70632 : /* #line 70633 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
70633 :
70634 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
70635 : void
70636 5342 : SgContainsStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
70637 : {
70638 : // This function traverses the memory pool for only a specific IR node
70639 : // and calls the visit function of the input class execute a traversal
70640 : // similar to the style of the attribute based traversals within ROSE.
70641 : // This traversal will visit ALL nodes of the AST where as the other
70642 : // attribute based traversals visit only the embedded tree within the AST.
70643 :
70644 : // Initialize array to the address of the first element of the STL vector
70645 : // (which is guaranteed to be contiguous storage).
70646 : // SgContainsStatement objectArray [] = *(Memory_Block_List.begin());
70647 5342 : if (SgContainsStatement::pools.empty() == false)
70648 : {
70649 : // Generate an array of memory pools
70650 0 : SgContainsStatement** objectArray = (SgContainsStatement**) &(SgContainsStatement::pools[0]);
70651 :
70652 : // Build a local variable for better performance
70653 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
70654 : #if 0
70655 : // Iterate over the memory pools
70656 : for (unsigned int i=0; i < SgContainsStatement::pools.size(); i++)
70657 : {
70658 : // objectArray[i] is a single memory pool
70659 : for (int j=0; j < SgContainsStatement::pool_size; j++)
70660 : {
70661 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
70662 : {
70663 : traversal.visit(&(objectArray[i][j]));
70664 : }
70665 : }
70666 : }
70667 : #else
70668 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
70669 : // compute the list first and then call the visit function on each list element.
70670 :
70671 : // printf ("Inside of SgContainsStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
70672 :
70673 0 : std::vector<SgContainsStatement*> nodeList;
70674 :
70675 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
70676 0 : for (unsigned int i=0; i < SgContainsStatement::pools.size(); i++)
70677 : {
70678 : // objectArray[i] is a single memory pool
70679 0 : for (unsigned j=0; j < SgContainsStatement::pool_size; j++)
70680 : {
70681 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
70682 : {
70683 0 : nodeList.push_back(&(objectArray[i][j]));
70684 : }
70685 : }
70686 : }
70687 :
70688 : // Iterate over the saved list
70689 0 : size_t nodeListSize = nodeList.size();
70690 0 : for (size_t i=0; i < nodeListSize; i++)
70691 : {
70692 0 : ROSE_ASSERT(nodeList[i] != NULL);
70693 : #if 0
70694 : traversal.visit(nodeList[i]);
70695 : #else
70696 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
70697 : {
70698 0 : traversal.visit(nodeList[i]);
70699 : }
70700 : #endif
70701 : }
70702 : #endif
70703 : }
70704 :
70705 : // This should not be required since all previously static data members are
70706 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
70707 :
70708 5342 : }
70709 :
70710 :
70711 : void
70712 194 : SgContainsStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
70713 : {
70714 : // This function traverses the memory pool for an IR node and
70715 : // calls the function to execute the visitor object.
70716 :
70717 : // Initialize array to the address of the first element of the STL vector
70718 : // (which is guarenteed to be contiguous storage).
70719 : // SgContainsStatement objectArray [] = *(Memory_Block_List.begin());
70720 194 : if (SgContainsStatement::pools.empty() == false)
70721 : {
70722 : // Generate an array of memory pools
70723 0 : SgContainsStatement** objectArray = (SgContainsStatement**) &(SgContainsStatement::pools[0]);
70724 :
70725 : // Build a local variable for better performance
70726 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
70727 :
70728 : // Iterate over the memory pools
70729 0 : for (unsigned int i=0; i < SgContainsStatement::pools.size(); i++)
70730 : {
70731 : // objectArray[i] is a single memory pool
70732 0 : for (unsigned j=0; j < SgContainsStatement::pool_size; j++)
70733 : {
70734 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
70735 : {
70736 : // printf ("Found a valid SgContainsStatement object in the memory pool %d at position %d \n",i,j);
70737 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
70738 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
70739 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
70740 : }
70741 : else
70742 : {
70743 : // printf ("Found a INVALID SgContainsStatement object in the memory pool \n");
70744 : }
70745 : }
70746 : }
70747 : }
70748 :
70749 : // This should not be required since all previously static data members are
70750 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
70751 :
70752 194 : }
70753 :
70754 : void
70755 0 : SgContainsStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
70756 : {
70757 : // This function visits only a single IR node of the memory pool.
70758 : // it is typically called once for each type of IR node within
70759 : // the automatically generated function: traverseRepresentativeNodes().
70760 :
70761 : // Initialize array to the address of the first element of the STL vector
70762 : // (which is guarenteed to be contiguous storage).
70763 : // SgContainsStatement objectArray [] = *(Memory_Block_List.begin());
70764 0 : if (SgContainsStatement::pools.empty() == false)
70765 : {
70766 : // Generate an array of memory pools
70767 0 : SgContainsStatement** objectArray = (SgContainsStatement**) &(SgContainsStatement::pools[0]);
70768 :
70769 : // Build a local variable for better performance
70770 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
70771 :
70772 : // Iterate over the memory pools
70773 0 : bool done = false;
70774 0 : unsigned i=0;
70775 :
70776 : // find the first valid IR node, call visit function, and then leave
70777 0 : while ( done == false && i < SgContainsStatement::pools.size() )
70778 : {
70779 : // objectArray[i] is a single memory pool
70780 : unsigned j=0;
70781 0 : while (done == false && j < SgContainsStatement::pool_size)
70782 : {
70783 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
70784 : {
70785 0 : traversal.visit(&(objectArray[i][j]));
70786 0 : done = true;
70787 : }
70788 0 : j++;
70789 : }
70790 0 : i++;
70791 : }
70792 :
70793 : #if 0
70794 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
70795 : if (done == false)
70796 : {
70797 : printf ("No representative for SgContainsStatement found in memory pools \n");
70798 : }
70799 : #endif
70800 : }
70801 0 : }
70802 :
70803 :
70804 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
70805 : // using values that overflow signed values of int.
70806 : size_t
70807 4 : SgContainsStatement::numberOfNodes()
70808 : {
70809 : // This function traverses the memory pool for an IR node and
70810 : // counts the number of IR nodes of a particular Sage III IR
70811 : // nodes type.
70812 :
70813 4 : size_t count = 0;
70814 4 : if (SgContainsStatement::pools.empty() == false)
70815 : {
70816 : // Generate an array of memory pools (this is actually a STL vector,
70817 : // but it is contiguious, so OK to treat this way).
70818 0 : SgContainsStatement** objectArray = (SgContainsStatement**) &(SgContainsStatement::pools[0]);
70819 :
70820 : // Build a local variable for better performance (make it a loop invariant variable).
70821 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
70822 :
70823 : // Iterate over all of the memory pools for this IR node.
70824 0 : for (unsigned int i=0; i < SgContainsStatement::pools.size(); i++)
70825 : {
70826 : // objectArray[i] is a single memory pool, iterate over all the
70827 : // IR nodes and only count those that are valid IR nodes used in
70828 : // the AST (i.e. allocated IR nodes).
70829 0 : for (unsigned j=0; j < SgContainsStatement::pool_size; j++)
70830 : {
70831 : // This is indexing the STL vector of C/C++ style arrays as a doubly
70832 : // indexed array access. It is OK since we have leveraged the semantics
70833 : // of STL vector memory as contigous and cast the memory as an array
70834 : // of arrays to use the 2D array indexing. Hope this is not confusing,
70835 : // but it s very fast as an implementation.
70836 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
70837 : {
70838 0 : count++;
70839 : }
70840 : }
70841 : }
70842 : }
70843 :
70844 :
70845 :
70846 4 : return count;
70847 : }
70848 :
70849 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
70850 : // using values that overflow signed values of int.
70851 : size_t
70852 0 : SgContainsStatement::memoryUsage()
70853 : {
70854 : // This function is required because we need the class name as a type when we call sizeof
70855 : // There might be another way to implement this if we have a traversal that only called a
70856 : // representative object (one call for each type of Sage IIIIR node).
70857 0 : size_t memory = numberOfNodes() * sizeof(SgContainsStatement);
70858 :
70859 0 : return memory;
70860 : }
70861 :
70862 : /* #line 70863 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
70863 :
70864 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
70865 : void
70866 5342 : SgC_PreprocessorDirectiveStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
70867 : {
70868 : // This function traverses the memory pool for only a specific IR node
70869 : // and calls the visit function of the input class execute a traversal
70870 : // similar to the style of the attribute based traversals within ROSE.
70871 : // This traversal will visit ALL nodes of the AST where as the other
70872 : // attribute based traversals visit only the embedded tree within the AST.
70873 :
70874 : // Initialize array to the address of the first element of the STL vector
70875 : // (which is guaranteed to be contiguous storage).
70876 : // SgC_PreprocessorDirectiveStatement objectArray [] = *(Memory_Block_List.begin());
70877 5342 : if (SgC_PreprocessorDirectiveStatement::pools.empty() == false)
70878 : {
70879 : // Generate an array of memory pools
70880 0 : SgC_PreprocessorDirectiveStatement** objectArray = (SgC_PreprocessorDirectiveStatement**) &(SgC_PreprocessorDirectiveStatement::pools[0]);
70881 :
70882 : // Build a local variable for better performance
70883 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
70884 : #if 0
70885 : // Iterate over the memory pools
70886 : for (unsigned int i=0; i < SgC_PreprocessorDirectiveStatement::pools.size(); i++)
70887 : {
70888 : // objectArray[i] is a single memory pool
70889 : for (int j=0; j < SgC_PreprocessorDirectiveStatement::pool_size; j++)
70890 : {
70891 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
70892 : {
70893 : traversal.visit(&(objectArray[i][j]));
70894 : }
70895 : }
70896 : }
70897 : #else
70898 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
70899 : // compute the list first and then call the visit function on each list element.
70900 :
70901 : // printf ("Inside of SgC_PreprocessorDirectiveStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
70902 :
70903 0 : std::vector<SgC_PreprocessorDirectiveStatement*> nodeList;
70904 :
70905 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
70906 0 : for (unsigned int i=0; i < SgC_PreprocessorDirectiveStatement::pools.size(); i++)
70907 : {
70908 : // objectArray[i] is a single memory pool
70909 0 : for (unsigned j=0; j < SgC_PreprocessorDirectiveStatement::pool_size; j++)
70910 : {
70911 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
70912 : {
70913 0 : nodeList.push_back(&(objectArray[i][j]));
70914 : }
70915 : }
70916 : }
70917 :
70918 : // Iterate over the saved list
70919 0 : size_t nodeListSize = nodeList.size();
70920 0 : for (size_t i=0; i < nodeListSize; i++)
70921 : {
70922 0 : ROSE_ASSERT(nodeList[i] != NULL);
70923 : #if 0
70924 : traversal.visit(nodeList[i]);
70925 : #else
70926 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
70927 : {
70928 0 : traversal.visit(nodeList[i]);
70929 : }
70930 : #endif
70931 : }
70932 : #endif
70933 : }
70934 :
70935 : // This should not be required since all previously static data members are
70936 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
70937 :
70938 5342 : }
70939 :
70940 :
70941 : void
70942 194 : SgC_PreprocessorDirectiveStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
70943 : {
70944 : // This function traverses the memory pool for an IR node and
70945 : // calls the function to execute the visitor object.
70946 :
70947 : // Initialize array to the address of the first element of the STL vector
70948 : // (which is guarenteed to be contiguous storage).
70949 : // SgC_PreprocessorDirectiveStatement objectArray [] = *(Memory_Block_List.begin());
70950 194 : if (SgC_PreprocessorDirectiveStatement::pools.empty() == false)
70951 : {
70952 : // Generate an array of memory pools
70953 0 : SgC_PreprocessorDirectiveStatement** objectArray = (SgC_PreprocessorDirectiveStatement**) &(SgC_PreprocessorDirectiveStatement::pools[0]);
70954 :
70955 : // Build a local variable for better performance
70956 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
70957 :
70958 : // Iterate over the memory pools
70959 0 : for (unsigned int i=0; i < SgC_PreprocessorDirectiveStatement::pools.size(); i++)
70960 : {
70961 : // objectArray[i] is a single memory pool
70962 0 : for (unsigned j=0; j < SgC_PreprocessorDirectiveStatement::pool_size; j++)
70963 : {
70964 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
70965 : {
70966 : // printf ("Found a valid SgC_PreprocessorDirectiveStatement object in the memory pool %d at position %d \n",i,j);
70967 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
70968 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
70969 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
70970 : }
70971 : else
70972 : {
70973 : // printf ("Found a INVALID SgC_PreprocessorDirectiveStatement object in the memory pool \n");
70974 : }
70975 : }
70976 : }
70977 : }
70978 :
70979 : // This should not be required since all previously static data members are
70980 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
70981 :
70982 194 : }
70983 :
70984 : void
70985 0 : SgC_PreprocessorDirectiveStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
70986 : {
70987 : // This function visits only a single IR node of the memory pool.
70988 : // it is typically called once for each type of IR node within
70989 : // the automatically generated function: traverseRepresentativeNodes().
70990 :
70991 : // Initialize array to the address of the first element of the STL vector
70992 : // (which is guarenteed to be contiguous storage).
70993 : // SgC_PreprocessorDirectiveStatement objectArray [] = *(Memory_Block_List.begin());
70994 0 : if (SgC_PreprocessorDirectiveStatement::pools.empty() == false)
70995 : {
70996 : // Generate an array of memory pools
70997 0 : SgC_PreprocessorDirectiveStatement** objectArray = (SgC_PreprocessorDirectiveStatement**) &(SgC_PreprocessorDirectiveStatement::pools[0]);
70998 :
70999 : // Build a local variable for better performance
71000 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
71001 :
71002 : // Iterate over the memory pools
71003 0 : bool done = false;
71004 0 : unsigned i=0;
71005 :
71006 : // find the first valid IR node, call visit function, and then leave
71007 0 : while ( done == false && i < SgC_PreprocessorDirectiveStatement::pools.size() )
71008 : {
71009 : // objectArray[i] is a single memory pool
71010 : unsigned j=0;
71011 0 : while (done == false && j < SgC_PreprocessorDirectiveStatement::pool_size)
71012 : {
71013 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
71014 : {
71015 0 : traversal.visit(&(objectArray[i][j]));
71016 0 : done = true;
71017 : }
71018 0 : j++;
71019 : }
71020 0 : i++;
71021 : }
71022 :
71023 : #if 0
71024 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
71025 : if (done == false)
71026 : {
71027 : printf ("No representative for SgC_PreprocessorDirectiveStatement found in memory pools \n");
71028 : }
71029 : #endif
71030 : }
71031 0 : }
71032 :
71033 :
71034 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
71035 : // using values that overflow signed values of int.
71036 : size_t
71037 4 : SgC_PreprocessorDirectiveStatement::numberOfNodes()
71038 : {
71039 : // This function traverses the memory pool for an IR node and
71040 : // counts the number of IR nodes of a particular Sage III IR
71041 : // nodes type.
71042 :
71043 4 : size_t count = 0;
71044 4 : if (SgC_PreprocessorDirectiveStatement::pools.empty() == false)
71045 : {
71046 : // Generate an array of memory pools (this is actually a STL vector,
71047 : // but it is contiguious, so OK to treat this way).
71048 0 : SgC_PreprocessorDirectiveStatement** objectArray = (SgC_PreprocessorDirectiveStatement**) &(SgC_PreprocessorDirectiveStatement::pools[0]);
71049 :
71050 : // Build a local variable for better performance (make it a loop invariant variable).
71051 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
71052 :
71053 : // Iterate over all of the memory pools for this IR node.
71054 0 : for (unsigned int i=0; i < SgC_PreprocessorDirectiveStatement::pools.size(); i++)
71055 : {
71056 : // objectArray[i] is a single memory pool, iterate over all the
71057 : // IR nodes and only count those that are valid IR nodes used in
71058 : // the AST (i.e. allocated IR nodes).
71059 0 : for (unsigned j=0; j < SgC_PreprocessorDirectiveStatement::pool_size; j++)
71060 : {
71061 : // This is indexing the STL vector of C/C++ style arrays as a doubly
71062 : // indexed array access. It is OK since we have leveraged the semantics
71063 : // of STL vector memory as contigous and cast the memory as an array
71064 : // of arrays to use the 2D array indexing. Hope this is not confusing,
71065 : // but it s very fast as an implementation.
71066 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
71067 : {
71068 0 : count++;
71069 : }
71070 : }
71071 : }
71072 : }
71073 :
71074 :
71075 :
71076 4 : return count;
71077 : }
71078 :
71079 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
71080 : // using values that overflow signed values of int.
71081 : size_t
71082 0 : SgC_PreprocessorDirectiveStatement::memoryUsage()
71083 : {
71084 : // This function is required because we need the class name as a type when we call sizeof
71085 : // There might be another way to implement this if we have a traversal that only called a
71086 : // representative object (one call for each type of Sage IIIIR node).
71087 0 : size_t memory = numberOfNodes() * sizeof(SgC_PreprocessorDirectiveStatement);
71088 :
71089 0 : return memory;
71090 : }
71091 :
71092 : /* #line 71093 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
71093 :
71094 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
71095 : void
71096 5342 : SgIncludeDirectiveStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
71097 : {
71098 : // This function traverses the memory pool for only a specific IR node
71099 : // and calls the visit function of the input class execute a traversal
71100 : // similar to the style of the attribute based traversals within ROSE.
71101 : // This traversal will visit ALL nodes of the AST where as the other
71102 : // attribute based traversals visit only the embedded tree within the AST.
71103 :
71104 : // Initialize array to the address of the first element of the STL vector
71105 : // (which is guaranteed to be contiguous storage).
71106 : // SgIncludeDirectiveStatement objectArray [] = *(Memory_Block_List.begin());
71107 5342 : if (SgIncludeDirectiveStatement::pools.empty() == false)
71108 : {
71109 : // Generate an array of memory pools
71110 0 : SgIncludeDirectiveStatement** objectArray = (SgIncludeDirectiveStatement**) &(SgIncludeDirectiveStatement::pools[0]);
71111 :
71112 : // Build a local variable for better performance
71113 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
71114 : #if 0
71115 : // Iterate over the memory pools
71116 : for (unsigned int i=0; i < SgIncludeDirectiveStatement::pools.size(); i++)
71117 : {
71118 : // objectArray[i] is a single memory pool
71119 : for (int j=0; j < SgIncludeDirectiveStatement::pool_size; j++)
71120 : {
71121 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
71122 : {
71123 : traversal.visit(&(objectArray[i][j]));
71124 : }
71125 : }
71126 : }
71127 : #else
71128 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
71129 : // compute the list first and then call the visit function on each list element.
71130 :
71131 : // printf ("Inside of SgIncludeDirectiveStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
71132 :
71133 0 : std::vector<SgIncludeDirectiveStatement*> nodeList;
71134 :
71135 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
71136 0 : for (unsigned int i=0; i < SgIncludeDirectiveStatement::pools.size(); i++)
71137 : {
71138 : // objectArray[i] is a single memory pool
71139 0 : for (unsigned j=0; j < SgIncludeDirectiveStatement::pool_size; j++)
71140 : {
71141 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
71142 : {
71143 0 : nodeList.push_back(&(objectArray[i][j]));
71144 : }
71145 : }
71146 : }
71147 :
71148 : // Iterate over the saved list
71149 0 : size_t nodeListSize = nodeList.size();
71150 0 : for (size_t i=0; i < nodeListSize; i++)
71151 : {
71152 0 : ROSE_ASSERT(nodeList[i] != NULL);
71153 : #if 0
71154 : traversal.visit(nodeList[i]);
71155 : #else
71156 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
71157 : {
71158 0 : traversal.visit(nodeList[i]);
71159 : }
71160 : #endif
71161 : }
71162 : #endif
71163 : }
71164 :
71165 : // This should not be required since all previously static data members are
71166 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
71167 :
71168 5342 : }
71169 :
71170 :
71171 : void
71172 194 : SgIncludeDirectiveStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
71173 : {
71174 : // This function traverses the memory pool for an IR node and
71175 : // calls the function to execute the visitor object.
71176 :
71177 : // Initialize array to the address of the first element of the STL vector
71178 : // (which is guarenteed to be contiguous storage).
71179 : // SgIncludeDirectiveStatement objectArray [] = *(Memory_Block_List.begin());
71180 194 : if (SgIncludeDirectiveStatement::pools.empty() == false)
71181 : {
71182 : // Generate an array of memory pools
71183 0 : SgIncludeDirectiveStatement** objectArray = (SgIncludeDirectiveStatement**) &(SgIncludeDirectiveStatement::pools[0]);
71184 :
71185 : // Build a local variable for better performance
71186 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
71187 :
71188 : // Iterate over the memory pools
71189 0 : for (unsigned int i=0; i < SgIncludeDirectiveStatement::pools.size(); i++)
71190 : {
71191 : // objectArray[i] is a single memory pool
71192 0 : for (unsigned j=0; j < SgIncludeDirectiveStatement::pool_size; j++)
71193 : {
71194 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
71195 : {
71196 : // printf ("Found a valid SgIncludeDirectiveStatement object in the memory pool %d at position %d \n",i,j);
71197 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
71198 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
71199 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
71200 : }
71201 : else
71202 : {
71203 : // printf ("Found a INVALID SgIncludeDirectiveStatement object in the memory pool \n");
71204 : }
71205 : }
71206 : }
71207 : }
71208 :
71209 : // This should not be required since all previously static data members are
71210 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
71211 :
71212 194 : }
71213 :
71214 : void
71215 0 : SgIncludeDirectiveStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
71216 : {
71217 : // This function visits only a single IR node of the memory pool.
71218 : // it is typically called once for each type of IR node within
71219 : // the automatically generated function: traverseRepresentativeNodes().
71220 :
71221 : // Initialize array to the address of the first element of the STL vector
71222 : // (which is guarenteed to be contiguous storage).
71223 : // SgIncludeDirectiveStatement objectArray [] = *(Memory_Block_List.begin());
71224 0 : if (SgIncludeDirectiveStatement::pools.empty() == false)
71225 : {
71226 : // Generate an array of memory pools
71227 0 : SgIncludeDirectiveStatement** objectArray = (SgIncludeDirectiveStatement**) &(SgIncludeDirectiveStatement::pools[0]);
71228 :
71229 : // Build a local variable for better performance
71230 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
71231 :
71232 : // Iterate over the memory pools
71233 0 : bool done = false;
71234 0 : unsigned i=0;
71235 :
71236 : // find the first valid IR node, call visit function, and then leave
71237 0 : while ( done == false && i < SgIncludeDirectiveStatement::pools.size() )
71238 : {
71239 : // objectArray[i] is a single memory pool
71240 : unsigned j=0;
71241 0 : while (done == false && j < SgIncludeDirectiveStatement::pool_size)
71242 : {
71243 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
71244 : {
71245 0 : traversal.visit(&(objectArray[i][j]));
71246 0 : done = true;
71247 : }
71248 0 : j++;
71249 : }
71250 0 : i++;
71251 : }
71252 :
71253 : #if 0
71254 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
71255 : if (done == false)
71256 : {
71257 : printf ("No representative for SgIncludeDirectiveStatement found in memory pools \n");
71258 : }
71259 : #endif
71260 : }
71261 0 : }
71262 :
71263 :
71264 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
71265 : // using values that overflow signed values of int.
71266 : size_t
71267 4 : SgIncludeDirectiveStatement::numberOfNodes()
71268 : {
71269 : // This function traverses the memory pool for an IR node and
71270 : // counts the number of IR nodes of a particular Sage III IR
71271 : // nodes type.
71272 :
71273 4 : size_t count = 0;
71274 4 : if (SgIncludeDirectiveStatement::pools.empty() == false)
71275 : {
71276 : // Generate an array of memory pools (this is actually a STL vector,
71277 : // but it is contiguious, so OK to treat this way).
71278 0 : SgIncludeDirectiveStatement** objectArray = (SgIncludeDirectiveStatement**) &(SgIncludeDirectiveStatement::pools[0]);
71279 :
71280 : // Build a local variable for better performance (make it a loop invariant variable).
71281 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
71282 :
71283 : // Iterate over all of the memory pools for this IR node.
71284 0 : for (unsigned int i=0; i < SgIncludeDirectiveStatement::pools.size(); i++)
71285 : {
71286 : // objectArray[i] is a single memory pool, iterate over all the
71287 : // IR nodes and only count those that are valid IR nodes used in
71288 : // the AST (i.e. allocated IR nodes).
71289 0 : for (unsigned j=0; j < SgIncludeDirectiveStatement::pool_size; j++)
71290 : {
71291 : // This is indexing the STL vector of C/C++ style arrays as a doubly
71292 : // indexed array access. It is OK since we have leveraged the semantics
71293 : // of STL vector memory as contigous and cast the memory as an array
71294 : // of arrays to use the 2D array indexing. Hope this is not confusing,
71295 : // but it s very fast as an implementation.
71296 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
71297 : {
71298 0 : count++;
71299 : }
71300 : }
71301 : }
71302 : }
71303 :
71304 :
71305 :
71306 4 : return count;
71307 : }
71308 :
71309 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
71310 : // using values that overflow signed values of int.
71311 : size_t
71312 0 : SgIncludeDirectiveStatement::memoryUsage()
71313 : {
71314 : // This function is required because we need the class name as a type when we call sizeof
71315 : // There might be another way to implement this if we have a traversal that only called a
71316 : // representative object (one call for each type of Sage IIIIR node).
71317 0 : size_t memory = numberOfNodes() * sizeof(SgIncludeDirectiveStatement);
71318 :
71319 0 : return memory;
71320 : }
71321 :
71322 : /* #line 71323 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
71323 :
71324 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
71325 : void
71326 5342 : SgDefineDirectiveStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
71327 : {
71328 : // This function traverses the memory pool for only a specific IR node
71329 : // and calls the visit function of the input class execute a traversal
71330 : // similar to the style of the attribute based traversals within ROSE.
71331 : // This traversal will visit ALL nodes of the AST where as the other
71332 : // attribute based traversals visit only the embedded tree within the AST.
71333 :
71334 : // Initialize array to the address of the first element of the STL vector
71335 : // (which is guaranteed to be contiguous storage).
71336 : // SgDefineDirectiveStatement objectArray [] = *(Memory_Block_List.begin());
71337 5342 : if (SgDefineDirectiveStatement::pools.empty() == false)
71338 : {
71339 : // Generate an array of memory pools
71340 0 : SgDefineDirectiveStatement** objectArray = (SgDefineDirectiveStatement**) &(SgDefineDirectiveStatement::pools[0]);
71341 :
71342 : // Build a local variable for better performance
71343 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
71344 : #if 0
71345 : // Iterate over the memory pools
71346 : for (unsigned int i=0; i < SgDefineDirectiveStatement::pools.size(); i++)
71347 : {
71348 : // objectArray[i] is a single memory pool
71349 : for (int j=0; j < SgDefineDirectiveStatement::pool_size; j++)
71350 : {
71351 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
71352 : {
71353 : traversal.visit(&(objectArray[i][j]));
71354 : }
71355 : }
71356 : }
71357 : #else
71358 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
71359 : // compute the list first and then call the visit function on each list element.
71360 :
71361 : // printf ("Inside of SgDefineDirectiveStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
71362 :
71363 0 : std::vector<SgDefineDirectiveStatement*> nodeList;
71364 :
71365 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
71366 0 : for (unsigned int i=0; i < SgDefineDirectiveStatement::pools.size(); i++)
71367 : {
71368 : // objectArray[i] is a single memory pool
71369 0 : for (unsigned j=0; j < SgDefineDirectiveStatement::pool_size; j++)
71370 : {
71371 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
71372 : {
71373 0 : nodeList.push_back(&(objectArray[i][j]));
71374 : }
71375 : }
71376 : }
71377 :
71378 : // Iterate over the saved list
71379 0 : size_t nodeListSize = nodeList.size();
71380 0 : for (size_t i=0; i < nodeListSize; i++)
71381 : {
71382 0 : ROSE_ASSERT(nodeList[i] != NULL);
71383 : #if 0
71384 : traversal.visit(nodeList[i]);
71385 : #else
71386 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
71387 : {
71388 0 : traversal.visit(nodeList[i]);
71389 : }
71390 : #endif
71391 : }
71392 : #endif
71393 : }
71394 :
71395 : // This should not be required since all previously static data members are
71396 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
71397 :
71398 5342 : }
71399 :
71400 :
71401 : void
71402 194 : SgDefineDirectiveStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
71403 : {
71404 : // This function traverses the memory pool for an IR node and
71405 : // calls the function to execute the visitor object.
71406 :
71407 : // Initialize array to the address of the first element of the STL vector
71408 : // (which is guarenteed to be contiguous storage).
71409 : // SgDefineDirectiveStatement objectArray [] = *(Memory_Block_List.begin());
71410 194 : if (SgDefineDirectiveStatement::pools.empty() == false)
71411 : {
71412 : // Generate an array of memory pools
71413 0 : SgDefineDirectiveStatement** objectArray = (SgDefineDirectiveStatement**) &(SgDefineDirectiveStatement::pools[0]);
71414 :
71415 : // Build a local variable for better performance
71416 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
71417 :
71418 : // Iterate over the memory pools
71419 0 : for (unsigned int i=0; i < SgDefineDirectiveStatement::pools.size(); i++)
71420 : {
71421 : // objectArray[i] is a single memory pool
71422 0 : for (unsigned j=0; j < SgDefineDirectiveStatement::pool_size; j++)
71423 : {
71424 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
71425 : {
71426 : // printf ("Found a valid SgDefineDirectiveStatement object in the memory pool %d at position %d \n",i,j);
71427 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
71428 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
71429 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
71430 : }
71431 : else
71432 : {
71433 : // printf ("Found a INVALID SgDefineDirectiveStatement object in the memory pool \n");
71434 : }
71435 : }
71436 : }
71437 : }
71438 :
71439 : // This should not be required since all previously static data members are
71440 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
71441 :
71442 194 : }
71443 :
71444 : void
71445 0 : SgDefineDirectiveStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
71446 : {
71447 : // This function visits only a single IR node of the memory pool.
71448 : // it is typically called once for each type of IR node within
71449 : // the automatically generated function: traverseRepresentativeNodes().
71450 :
71451 : // Initialize array to the address of the first element of the STL vector
71452 : // (which is guarenteed to be contiguous storage).
71453 : // SgDefineDirectiveStatement objectArray [] = *(Memory_Block_List.begin());
71454 0 : if (SgDefineDirectiveStatement::pools.empty() == false)
71455 : {
71456 : // Generate an array of memory pools
71457 0 : SgDefineDirectiveStatement** objectArray = (SgDefineDirectiveStatement**) &(SgDefineDirectiveStatement::pools[0]);
71458 :
71459 : // Build a local variable for better performance
71460 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
71461 :
71462 : // Iterate over the memory pools
71463 0 : bool done = false;
71464 0 : unsigned i=0;
71465 :
71466 : // find the first valid IR node, call visit function, and then leave
71467 0 : while ( done == false && i < SgDefineDirectiveStatement::pools.size() )
71468 : {
71469 : // objectArray[i] is a single memory pool
71470 : unsigned j=0;
71471 0 : while (done == false && j < SgDefineDirectiveStatement::pool_size)
71472 : {
71473 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
71474 : {
71475 0 : traversal.visit(&(objectArray[i][j]));
71476 0 : done = true;
71477 : }
71478 0 : j++;
71479 : }
71480 0 : i++;
71481 : }
71482 :
71483 : #if 0
71484 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
71485 : if (done == false)
71486 : {
71487 : printf ("No representative for SgDefineDirectiveStatement found in memory pools \n");
71488 : }
71489 : #endif
71490 : }
71491 0 : }
71492 :
71493 :
71494 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
71495 : // using values that overflow signed values of int.
71496 : size_t
71497 4 : SgDefineDirectiveStatement::numberOfNodes()
71498 : {
71499 : // This function traverses the memory pool for an IR node and
71500 : // counts the number of IR nodes of a particular Sage III IR
71501 : // nodes type.
71502 :
71503 4 : size_t count = 0;
71504 4 : if (SgDefineDirectiveStatement::pools.empty() == false)
71505 : {
71506 : // Generate an array of memory pools (this is actually a STL vector,
71507 : // but it is contiguious, so OK to treat this way).
71508 0 : SgDefineDirectiveStatement** objectArray = (SgDefineDirectiveStatement**) &(SgDefineDirectiveStatement::pools[0]);
71509 :
71510 : // Build a local variable for better performance (make it a loop invariant variable).
71511 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
71512 :
71513 : // Iterate over all of the memory pools for this IR node.
71514 0 : for (unsigned int i=0; i < SgDefineDirectiveStatement::pools.size(); i++)
71515 : {
71516 : // objectArray[i] is a single memory pool, iterate over all the
71517 : // IR nodes and only count those that are valid IR nodes used in
71518 : // the AST (i.e. allocated IR nodes).
71519 0 : for (unsigned j=0; j < SgDefineDirectiveStatement::pool_size; j++)
71520 : {
71521 : // This is indexing the STL vector of C/C++ style arrays as a doubly
71522 : // indexed array access. It is OK since we have leveraged the semantics
71523 : // of STL vector memory as contigous and cast the memory as an array
71524 : // of arrays to use the 2D array indexing. Hope this is not confusing,
71525 : // but it s very fast as an implementation.
71526 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
71527 : {
71528 0 : count++;
71529 : }
71530 : }
71531 : }
71532 : }
71533 :
71534 :
71535 :
71536 4 : return count;
71537 : }
71538 :
71539 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
71540 : // using values that overflow signed values of int.
71541 : size_t
71542 0 : SgDefineDirectiveStatement::memoryUsage()
71543 : {
71544 : // This function is required because we need the class name as a type when we call sizeof
71545 : // There might be another way to implement this if we have a traversal that only called a
71546 : // representative object (one call for each type of Sage IIIIR node).
71547 0 : size_t memory = numberOfNodes() * sizeof(SgDefineDirectiveStatement);
71548 :
71549 0 : return memory;
71550 : }
71551 :
71552 : /* #line 71553 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
71553 :
71554 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
71555 : void
71556 5342 : SgUndefDirectiveStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
71557 : {
71558 : // This function traverses the memory pool for only a specific IR node
71559 : // and calls the visit function of the input class execute a traversal
71560 : // similar to the style of the attribute based traversals within ROSE.
71561 : // This traversal will visit ALL nodes of the AST where as the other
71562 : // attribute based traversals visit only the embedded tree within the AST.
71563 :
71564 : // Initialize array to the address of the first element of the STL vector
71565 : // (which is guaranteed to be contiguous storage).
71566 : // SgUndefDirectiveStatement objectArray [] = *(Memory_Block_List.begin());
71567 5342 : if (SgUndefDirectiveStatement::pools.empty() == false)
71568 : {
71569 : // Generate an array of memory pools
71570 0 : SgUndefDirectiveStatement** objectArray = (SgUndefDirectiveStatement**) &(SgUndefDirectiveStatement::pools[0]);
71571 :
71572 : // Build a local variable for better performance
71573 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
71574 : #if 0
71575 : // Iterate over the memory pools
71576 : for (unsigned int i=0; i < SgUndefDirectiveStatement::pools.size(); i++)
71577 : {
71578 : // objectArray[i] is a single memory pool
71579 : for (int j=0; j < SgUndefDirectiveStatement::pool_size; j++)
71580 : {
71581 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
71582 : {
71583 : traversal.visit(&(objectArray[i][j]));
71584 : }
71585 : }
71586 : }
71587 : #else
71588 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
71589 : // compute the list first and then call the visit function on each list element.
71590 :
71591 : // printf ("Inside of SgUndefDirectiveStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
71592 :
71593 0 : std::vector<SgUndefDirectiveStatement*> nodeList;
71594 :
71595 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
71596 0 : for (unsigned int i=0; i < SgUndefDirectiveStatement::pools.size(); i++)
71597 : {
71598 : // objectArray[i] is a single memory pool
71599 0 : for (unsigned j=0; j < SgUndefDirectiveStatement::pool_size; j++)
71600 : {
71601 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
71602 : {
71603 0 : nodeList.push_back(&(objectArray[i][j]));
71604 : }
71605 : }
71606 : }
71607 :
71608 : // Iterate over the saved list
71609 0 : size_t nodeListSize = nodeList.size();
71610 0 : for (size_t i=0; i < nodeListSize; i++)
71611 : {
71612 0 : ROSE_ASSERT(nodeList[i] != NULL);
71613 : #if 0
71614 : traversal.visit(nodeList[i]);
71615 : #else
71616 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
71617 : {
71618 0 : traversal.visit(nodeList[i]);
71619 : }
71620 : #endif
71621 : }
71622 : #endif
71623 : }
71624 :
71625 : // This should not be required since all previously static data members are
71626 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
71627 :
71628 5342 : }
71629 :
71630 :
71631 : void
71632 194 : SgUndefDirectiveStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
71633 : {
71634 : // This function traverses the memory pool for an IR node and
71635 : // calls the function to execute the visitor object.
71636 :
71637 : // Initialize array to the address of the first element of the STL vector
71638 : // (which is guarenteed to be contiguous storage).
71639 : // SgUndefDirectiveStatement objectArray [] = *(Memory_Block_List.begin());
71640 194 : if (SgUndefDirectiveStatement::pools.empty() == false)
71641 : {
71642 : // Generate an array of memory pools
71643 0 : SgUndefDirectiveStatement** objectArray = (SgUndefDirectiveStatement**) &(SgUndefDirectiveStatement::pools[0]);
71644 :
71645 : // Build a local variable for better performance
71646 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
71647 :
71648 : // Iterate over the memory pools
71649 0 : for (unsigned int i=0; i < SgUndefDirectiveStatement::pools.size(); i++)
71650 : {
71651 : // objectArray[i] is a single memory pool
71652 0 : for (unsigned j=0; j < SgUndefDirectiveStatement::pool_size; j++)
71653 : {
71654 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
71655 : {
71656 : // printf ("Found a valid SgUndefDirectiveStatement object in the memory pool %d at position %d \n",i,j);
71657 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
71658 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
71659 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
71660 : }
71661 : else
71662 : {
71663 : // printf ("Found a INVALID SgUndefDirectiveStatement object in the memory pool \n");
71664 : }
71665 : }
71666 : }
71667 : }
71668 :
71669 : // This should not be required since all previously static data members are
71670 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
71671 :
71672 194 : }
71673 :
71674 : void
71675 0 : SgUndefDirectiveStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
71676 : {
71677 : // This function visits only a single IR node of the memory pool.
71678 : // it is typically called once for each type of IR node within
71679 : // the automatically generated function: traverseRepresentativeNodes().
71680 :
71681 : // Initialize array to the address of the first element of the STL vector
71682 : // (which is guarenteed to be contiguous storage).
71683 : // SgUndefDirectiveStatement objectArray [] = *(Memory_Block_List.begin());
71684 0 : if (SgUndefDirectiveStatement::pools.empty() == false)
71685 : {
71686 : // Generate an array of memory pools
71687 0 : SgUndefDirectiveStatement** objectArray = (SgUndefDirectiveStatement**) &(SgUndefDirectiveStatement::pools[0]);
71688 :
71689 : // Build a local variable for better performance
71690 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
71691 :
71692 : // Iterate over the memory pools
71693 0 : bool done = false;
71694 0 : unsigned i=0;
71695 :
71696 : // find the first valid IR node, call visit function, and then leave
71697 0 : while ( done == false && i < SgUndefDirectiveStatement::pools.size() )
71698 : {
71699 : // objectArray[i] is a single memory pool
71700 : unsigned j=0;
71701 0 : while (done == false && j < SgUndefDirectiveStatement::pool_size)
71702 : {
71703 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
71704 : {
71705 0 : traversal.visit(&(objectArray[i][j]));
71706 0 : done = true;
71707 : }
71708 0 : j++;
71709 : }
71710 0 : i++;
71711 : }
71712 :
71713 : #if 0
71714 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
71715 : if (done == false)
71716 : {
71717 : printf ("No representative for SgUndefDirectiveStatement found in memory pools \n");
71718 : }
71719 : #endif
71720 : }
71721 0 : }
71722 :
71723 :
71724 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
71725 : // using values that overflow signed values of int.
71726 : size_t
71727 4 : SgUndefDirectiveStatement::numberOfNodes()
71728 : {
71729 : // This function traverses the memory pool for an IR node and
71730 : // counts the number of IR nodes of a particular Sage III IR
71731 : // nodes type.
71732 :
71733 4 : size_t count = 0;
71734 4 : if (SgUndefDirectiveStatement::pools.empty() == false)
71735 : {
71736 : // Generate an array of memory pools (this is actually a STL vector,
71737 : // but it is contiguious, so OK to treat this way).
71738 0 : SgUndefDirectiveStatement** objectArray = (SgUndefDirectiveStatement**) &(SgUndefDirectiveStatement::pools[0]);
71739 :
71740 : // Build a local variable for better performance (make it a loop invariant variable).
71741 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
71742 :
71743 : // Iterate over all of the memory pools for this IR node.
71744 0 : for (unsigned int i=0; i < SgUndefDirectiveStatement::pools.size(); i++)
71745 : {
71746 : // objectArray[i] is a single memory pool, iterate over all the
71747 : // IR nodes and only count those that are valid IR nodes used in
71748 : // the AST (i.e. allocated IR nodes).
71749 0 : for (unsigned j=0; j < SgUndefDirectiveStatement::pool_size; j++)
71750 : {
71751 : // This is indexing the STL vector of C/C++ style arrays as a doubly
71752 : // indexed array access. It is OK since we have leveraged the semantics
71753 : // of STL vector memory as contigous and cast the memory as an array
71754 : // of arrays to use the 2D array indexing. Hope this is not confusing,
71755 : // but it s very fast as an implementation.
71756 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
71757 : {
71758 0 : count++;
71759 : }
71760 : }
71761 : }
71762 : }
71763 :
71764 :
71765 :
71766 4 : return count;
71767 : }
71768 :
71769 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
71770 : // using values that overflow signed values of int.
71771 : size_t
71772 0 : SgUndefDirectiveStatement::memoryUsage()
71773 : {
71774 : // This function is required because we need the class name as a type when we call sizeof
71775 : // There might be another way to implement this if we have a traversal that only called a
71776 : // representative object (one call for each type of Sage IIIIR node).
71777 0 : size_t memory = numberOfNodes() * sizeof(SgUndefDirectiveStatement);
71778 :
71779 0 : return memory;
71780 : }
71781 :
71782 : /* #line 71783 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
71783 :
71784 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
71785 : void
71786 5342 : SgIfdefDirectiveStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
71787 : {
71788 : // This function traverses the memory pool for only a specific IR node
71789 : // and calls the visit function of the input class execute a traversal
71790 : // similar to the style of the attribute based traversals within ROSE.
71791 : // This traversal will visit ALL nodes of the AST where as the other
71792 : // attribute based traversals visit only the embedded tree within the AST.
71793 :
71794 : // Initialize array to the address of the first element of the STL vector
71795 : // (which is guaranteed to be contiguous storage).
71796 : // SgIfdefDirectiveStatement objectArray [] = *(Memory_Block_List.begin());
71797 5342 : if (SgIfdefDirectiveStatement::pools.empty() == false)
71798 : {
71799 : // Generate an array of memory pools
71800 0 : SgIfdefDirectiveStatement** objectArray = (SgIfdefDirectiveStatement**) &(SgIfdefDirectiveStatement::pools[0]);
71801 :
71802 : // Build a local variable for better performance
71803 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
71804 : #if 0
71805 : // Iterate over the memory pools
71806 : for (unsigned int i=0; i < SgIfdefDirectiveStatement::pools.size(); i++)
71807 : {
71808 : // objectArray[i] is a single memory pool
71809 : for (int j=0; j < SgIfdefDirectiveStatement::pool_size; j++)
71810 : {
71811 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
71812 : {
71813 : traversal.visit(&(objectArray[i][j]));
71814 : }
71815 : }
71816 : }
71817 : #else
71818 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
71819 : // compute the list first and then call the visit function on each list element.
71820 :
71821 : // printf ("Inside of SgIfdefDirectiveStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
71822 :
71823 0 : std::vector<SgIfdefDirectiveStatement*> nodeList;
71824 :
71825 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
71826 0 : for (unsigned int i=0; i < SgIfdefDirectiveStatement::pools.size(); i++)
71827 : {
71828 : // objectArray[i] is a single memory pool
71829 0 : for (unsigned j=0; j < SgIfdefDirectiveStatement::pool_size; j++)
71830 : {
71831 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
71832 : {
71833 0 : nodeList.push_back(&(objectArray[i][j]));
71834 : }
71835 : }
71836 : }
71837 :
71838 : // Iterate over the saved list
71839 0 : size_t nodeListSize = nodeList.size();
71840 0 : for (size_t i=0; i < nodeListSize; i++)
71841 : {
71842 0 : ROSE_ASSERT(nodeList[i] != NULL);
71843 : #if 0
71844 : traversal.visit(nodeList[i]);
71845 : #else
71846 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
71847 : {
71848 0 : traversal.visit(nodeList[i]);
71849 : }
71850 : #endif
71851 : }
71852 : #endif
71853 : }
71854 :
71855 : // This should not be required since all previously static data members are
71856 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
71857 :
71858 5342 : }
71859 :
71860 :
71861 : void
71862 194 : SgIfdefDirectiveStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
71863 : {
71864 : // This function traverses the memory pool for an IR node and
71865 : // calls the function to execute the visitor object.
71866 :
71867 : // Initialize array to the address of the first element of the STL vector
71868 : // (which is guarenteed to be contiguous storage).
71869 : // SgIfdefDirectiveStatement objectArray [] = *(Memory_Block_List.begin());
71870 194 : if (SgIfdefDirectiveStatement::pools.empty() == false)
71871 : {
71872 : // Generate an array of memory pools
71873 0 : SgIfdefDirectiveStatement** objectArray = (SgIfdefDirectiveStatement**) &(SgIfdefDirectiveStatement::pools[0]);
71874 :
71875 : // Build a local variable for better performance
71876 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
71877 :
71878 : // Iterate over the memory pools
71879 0 : for (unsigned int i=0; i < SgIfdefDirectiveStatement::pools.size(); i++)
71880 : {
71881 : // objectArray[i] is a single memory pool
71882 0 : for (unsigned j=0; j < SgIfdefDirectiveStatement::pool_size; j++)
71883 : {
71884 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
71885 : {
71886 : // printf ("Found a valid SgIfdefDirectiveStatement object in the memory pool %d at position %d \n",i,j);
71887 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
71888 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
71889 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
71890 : }
71891 : else
71892 : {
71893 : // printf ("Found a INVALID SgIfdefDirectiveStatement object in the memory pool \n");
71894 : }
71895 : }
71896 : }
71897 : }
71898 :
71899 : // This should not be required since all previously static data members are
71900 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
71901 :
71902 194 : }
71903 :
71904 : void
71905 0 : SgIfdefDirectiveStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
71906 : {
71907 : // This function visits only a single IR node of the memory pool.
71908 : // it is typically called once for each type of IR node within
71909 : // the automatically generated function: traverseRepresentativeNodes().
71910 :
71911 : // Initialize array to the address of the first element of the STL vector
71912 : // (which is guarenteed to be contiguous storage).
71913 : // SgIfdefDirectiveStatement objectArray [] = *(Memory_Block_List.begin());
71914 0 : if (SgIfdefDirectiveStatement::pools.empty() == false)
71915 : {
71916 : // Generate an array of memory pools
71917 0 : SgIfdefDirectiveStatement** objectArray = (SgIfdefDirectiveStatement**) &(SgIfdefDirectiveStatement::pools[0]);
71918 :
71919 : // Build a local variable for better performance
71920 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
71921 :
71922 : // Iterate over the memory pools
71923 0 : bool done = false;
71924 0 : unsigned i=0;
71925 :
71926 : // find the first valid IR node, call visit function, and then leave
71927 0 : while ( done == false && i < SgIfdefDirectiveStatement::pools.size() )
71928 : {
71929 : // objectArray[i] is a single memory pool
71930 : unsigned j=0;
71931 0 : while (done == false && j < SgIfdefDirectiveStatement::pool_size)
71932 : {
71933 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
71934 : {
71935 0 : traversal.visit(&(objectArray[i][j]));
71936 0 : done = true;
71937 : }
71938 0 : j++;
71939 : }
71940 0 : i++;
71941 : }
71942 :
71943 : #if 0
71944 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
71945 : if (done == false)
71946 : {
71947 : printf ("No representative for SgIfdefDirectiveStatement found in memory pools \n");
71948 : }
71949 : #endif
71950 : }
71951 0 : }
71952 :
71953 :
71954 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
71955 : // using values that overflow signed values of int.
71956 : size_t
71957 4 : SgIfdefDirectiveStatement::numberOfNodes()
71958 : {
71959 : // This function traverses the memory pool for an IR node and
71960 : // counts the number of IR nodes of a particular Sage III IR
71961 : // nodes type.
71962 :
71963 4 : size_t count = 0;
71964 4 : if (SgIfdefDirectiveStatement::pools.empty() == false)
71965 : {
71966 : // Generate an array of memory pools (this is actually a STL vector,
71967 : // but it is contiguious, so OK to treat this way).
71968 0 : SgIfdefDirectiveStatement** objectArray = (SgIfdefDirectiveStatement**) &(SgIfdefDirectiveStatement::pools[0]);
71969 :
71970 : // Build a local variable for better performance (make it a loop invariant variable).
71971 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
71972 :
71973 : // Iterate over all of the memory pools for this IR node.
71974 0 : for (unsigned int i=0; i < SgIfdefDirectiveStatement::pools.size(); i++)
71975 : {
71976 : // objectArray[i] is a single memory pool, iterate over all the
71977 : // IR nodes and only count those that are valid IR nodes used in
71978 : // the AST (i.e. allocated IR nodes).
71979 0 : for (unsigned j=0; j < SgIfdefDirectiveStatement::pool_size; j++)
71980 : {
71981 : // This is indexing the STL vector of C/C++ style arrays as a doubly
71982 : // indexed array access. It is OK since we have leveraged the semantics
71983 : // of STL vector memory as contigous and cast the memory as an array
71984 : // of arrays to use the 2D array indexing. Hope this is not confusing,
71985 : // but it s very fast as an implementation.
71986 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
71987 : {
71988 0 : count++;
71989 : }
71990 : }
71991 : }
71992 : }
71993 :
71994 :
71995 :
71996 4 : return count;
71997 : }
71998 :
71999 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
72000 : // using values that overflow signed values of int.
72001 : size_t
72002 0 : SgIfdefDirectiveStatement::memoryUsage()
72003 : {
72004 : // This function is required because we need the class name as a type when we call sizeof
72005 : // There might be another way to implement this if we have a traversal that only called a
72006 : // representative object (one call for each type of Sage IIIIR node).
72007 0 : size_t memory = numberOfNodes() * sizeof(SgIfdefDirectiveStatement);
72008 :
72009 0 : return memory;
72010 : }
72011 :
72012 : /* #line 72013 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
72013 :
72014 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
72015 : void
72016 5342 : SgIfndefDirectiveStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
72017 : {
72018 : // This function traverses the memory pool for only a specific IR node
72019 : // and calls the visit function of the input class execute a traversal
72020 : // similar to the style of the attribute based traversals within ROSE.
72021 : // This traversal will visit ALL nodes of the AST where as the other
72022 : // attribute based traversals visit only the embedded tree within the AST.
72023 :
72024 : // Initialize array to the address of the first element of the STL vector
72025 : // (which is guaranteed to be contiguous storage).
72026 : // SgIfndefDirectiveStatement objectArray [] = *(Memory_Block_List.begin());
72027 5342 : if (SgIfndefDirectiveStatement::pools.empty() == false)
72028 : {
72029 : // Generate an array of memory pools
72030 0 : SgIfndefDirectiveStatement** objectArray = (SgIfndefDirectiveStatement**) &(SgIfndefDirectiveStatement::pools[0]);
72031 :
72032 : // Build a local variable for better performance
72033 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
72034 : #if 0
72035 : // Iterate over the memory pools
72036 : for (unsigned int i=0; i < SgIfndefDirectiveStatement::pools.size(); i++)
72037 : {
72038 : // objectArray[i] is a single memory pool
72039 : for (int j=0; j < SgIfndefDirectiveStatement::pool_size; j++)
72040 : {
72041 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
72042 : {
72043 : traversal.visit(&(objectArray[i][j]));
72044 : }
72045 : }
72046 : }
72047 : #else
72048 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
72049 : // compute the list first and then call the visit function on each list element.
72050 :
72051 : // printf ("Inside of SgIfndefDirectiveStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
72052 :
72053 0 : std::vector<SgIfndefDirectiveStatement*> nodeList;
72054 :
72055 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
72056 0 : for (unsigned int i=0; i < SgIfndefDirectiveStatement::pools.size(); i++)
72057 : {
72058 : // objectArray[i] is a single memory pool
72059 0 : for (unsigned j=0; j < SgIfndefDirectiveStatement::pool_size; j++)
72060 : {
72061 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
72062 : {
72063 0 : nodeList.push_back(&(objectArray[i][j]));
72064 : }
72065 : }
72066 : }
72067 :
72068 : // Iterate over the saved list
72069 0 : size_t nodeListSize = nodeList.size();
72070 0 : for (size_t i=0; i < nodeListSize; i++)
72071 : {
72072 0 : ROSE_ASSERT(nodeList[i] != NULL);
72073 : #if 0
72074 : traversal.visit(nodeList[i]);
72075 : #else
72076 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
72077 : {
72078 0 : traversal.visit(nodeList[i]);
72079 : }
72080 : #endif
72081 : }
72082 : #endif
72083 : }
72084 :
72085 : // This should not be required since all previously static data members are
72086 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
72087 :
72088 5342 : }
72089 :
72090 :
72091 : void
72092 194 : SgIfndefDirectiveStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
72093 : {
72094 : // This function traverses the memory pool for an IR node and
72095 : // calls the function to execute the visitor object.
72096 :
72097 : // Initialize array to the address of the first element of the STL vector
72098 : // (which is guarenteed to be contiguous storage).
72099 : // SgIfndefDirectiveStatement objectArray [] = *(Memory_Block_List.begin());
72100 194 : if (SgIfndefDirectiveStatement::pools.empty() == false)
72101 : {
72102 : // Generate an array of memory pools
72103 0 : SgIfndefDirectiveStatement** objectArray = (SgIfndefDirectiveStatement**) &(SgIfndefDirectiveStatement::pools[0]);
72104 :
72105 : // Build a local variable for better performance
72106 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
72107 :
72108 : // Iterate over the memory pools
72109 0 : for (unsigned int i=0; i < SgIfndefDirectiveStatement::pools.size(); i++)
72110 : {
72111 : // objectArray[i] is a single memory pool
72112 0 : for (unsigned j=0; j < SgIfndefDirectiveStatement::pool_size; j++)
72113 : {
72114 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
72115 : {
72116 : // printf ("Found a valid SgIfndefDirectiveStatement object in the memory pool %d at position %d \n",i,j);
72117 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
72118 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
72119 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
72120 : }
72121 : else
72122 : {
72123 : // printf ("Found a INVALID SgIfndefDirectiveStatement object in the memory pool \n");
72124 : }
72125 : }
72126 : }
72127 : }
72128 :
72129 : // This should not be required since all previously static data members are
72130 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
72131 :
72132 194 : }
72133 :
72134 : void
72135 0 : SgIfndefDirectiveStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
72136 : {
72137 : // This function visits only a single IR node of the memory pool.
72138 : // it is typically called once for each type of IR node within
72139 : // the automatically generated function: traverseRepresentativeNodes().
72140 :
72141 : // Initialize array to the address of the first element of the STL vector
72142 : // (which is guarenteed to be contiguous storage).
72143 : // SgIfndefDirectiveStatement objectArray [] = *(Memory_Block_List.begin());
72144 0 : if (SgIfndefDirectiveStatement::pools.empty() == false)
72145 : {
72146 : // Generate an array of memory pools
72147 0 : SgIfndefDirectiveStatement** objectArray = (SgIfndefDirectiveStatement**) &(SgIfndefDirectiveStatement::pools[0]);
72148 :
72149 : // Build a local variable for better performance
72150 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
72151 :
72152 : // Iterate over the memory pools
72153 0 : bool done = false;
72154 0 : unsigned i=0;
72155 :
72156 : // find the first valid IR node, call visit function, and then leave
72157 0 : while ( done == false && i < SgIfndefDirectiveStatement::pools.size() )
72158 : {
72159 : // objectArray[i] is a single memory pool
72160 : unsigned j=0;
72161 0 : while (done == false && j < SgIfndefDirectiveStatement::pool_size)
72162 : {
72163 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
72164 : {
72165 0 : traversal.visit(&(objectArray[i][j]));
72166 0 : done = true;
72167 : }
72168 0 : j++;
72169 : }
72170 0 : i++;
72171 : }
72172 :
72173 : #if 0
72174 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
72175 : if (done == false)
72176 : {
72177 : printf ("No representative for SgIfndefDirectiveStatement found in memory pools \n");
72178 : }
72179 : #endif
72180 : }
72181 0 : }
72182 :
72183 :
72184 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
72185 : // using values that overflow signed values of int.
72186 : size_t
72187 4 : SgIfndefDirectiveStatement::numberOfNodes()
72188 : {
72189 : // This function traverses the memory pool for an IR node and
72190 : // counts the number of IR nodes of a particular Sage III IR
72191 : // nodes type.
72192 :
72193 4 : size_t count = 0;
72194 4 : if (SgIfndefDirectiveStatement::pools.empty() == false)
72195 : {
72196 : // Generate an array of memory pools (this is actually a STL vector,
72197 : // but it is contiguious, so OK to treat this way).
72198 0 : SgIfndefDirectiveStatement** objectArray = (SgIfndefDirectiveStatement**) &(SgIfndefDirectiveStatement::pools[0]);
72199 :
72200 : // Build a local variable for better performance (make it a loop invariant variable).
72201 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
72202 :
72203 : // Iterate over all of the memory pools for this IR node.
72204 0 : for (unsigned int i=0; i < SgIfndefDirectiveStatement::pools.size(); i++)
72205 : {
72206 : // objectArray[i] is a single memory pool, iterate over all the
72207 : // IR nodes and only count those that are valid IR nodes used in
72208 : // the AST (i.e. allocated IR nodes).
72209 0 : for (unsigned j=0; j < SgIfndefDirectiveStatement::pool_size; j++)
72210 : {
72211 : // This is indexing the STL vector of C/C++ style arrays as a doubly
72212 : // indexed array access. It is OK since we have leveraged the semantics
72213 : // of STL vector memory as contigous and cast the memory as an array
72214 : // of arrays to use the 2D array indexing. Hope this is not confusing,
72215 : // but it s very fast as an implementation.
72216 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
72217 : {
72218 0 : count++;
72219 : }
72220 : }
72221 : }
72222 : }
72223 :
72224 :
72225 :
72226 4 : return count;
72227 : }
72228 :
72229 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
72230 : // using values that overflow signed values of int.
72231 : size_t
72232 0 : SgIfndefDirectiveStatement::memoryUsage()
72233 : {
72234 : // This function is required because we need the class name as a type when we call sizeof
72235 : // There might be another way to implement this if we have a traversal that only called a
72236 : // representative object (one call for each type of Sage IIIIR node).
72237 0 : size_t memory = numberOfNodes() * sizeof(SgIfndefDirectiveStatement);
72238 :
72239 0 : return memory;
72240 : }
72241 :
72242 : /* #line 72243 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
72243 :
72244 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
72245 : void
72246 5342 : SgIfDirectiveStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
72247 : {
72248 : // This function traverses the memory pool for only a specific IR node
72249 : // and calls the visit function of the input class execute a traversal
72250 : // similar to the style of the attribute based traversals within ROSE.
72251 : // This traversal will visit ALL nodes of the AST where as the other
72252 : // attribute based traversals visit only the embedded tree within the AST.
72253 :
72254 : // Initialize array to the address of the first element of the STL vector
72255 : // (which is guaranteed to be contiguous storage).
72256 : // SgIfDirectiveStatement objectArray [] = *(Memory_Block_List.begin());
72257 5342 : if (SgIfDirectiveStatement::pools.empty() == false)
72258 : {
72259 : // Generate an array of memory pools
72260 0 : SgIfDirectiveStatement** objectArray = (SgIfDirectiveStatement**) &(SgIfDirectiveStatement::pools[0]);
72261 :
72262 : // Build a local variable for better performance
72263 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
72264 : #if 0
72265 : // Iterate over the memory pools
72266 : for (unsigned int i=0; i < SgIfDirectiveStatement::pools.size(); i++)
72267 : {
72268 : // objectArray[i] is a single memory pool
72269 : for (int j=0; j < SgIfDirectiveStatement::pool_size; j++)
72270 : {
72271 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
72272 : {
72273 : traversal.visit(&(objectArray[i][j]));
72274 : }
72275 : }
72276 : }
72277 : #else
72278 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
72279 : // compute the list first and then call the visit function on each list element.
72280 :
72281 : // printf ("Inside of SgIfDirectiveStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
72282 :
72283 0 : std::vector<SgIfDirectiveStatement*> nodeList;
72284 :
72285 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
72286 0 : for (unsigned int i=0; i < SgIfDirectiveStatement::pools.size(); i++)
72287 : {
72288 : // objectArray[i] is a single memory pool
72289 0 : for (unsigned j=0; j < SgIfDirectiveStatement::pool_size; j++)
72290 : {
72291 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
72292 : {
72293 0 : nodeList.push_back(&(objectArray[i][j]));
72294 : }
72295 : }
72296 : }
72297 :
72298 : // Iterate over the saved list
72299 0 : size_t nodeListSize = nodeList.size();
72300 0 : for (size_t i=0; i < nodeListSize; i++)
72301 : {
72302 0 : ROSE_ASSERT(nodeList[i] != NULL);
72303 : #if 0
72304 : traversal.visit(nodeList[i]);
72305 : #else
72306 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
72307 : {
72308 0 : traversal.visit(nodeList[i]);
72309 : }
72310 : #endif
72311 : }
72312 : #endif
72313 : }
72314 :
72315 : // This should not be required since all previously static data members are
72316 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
72317 :
72318 5342 : }
72319 :
72320 :
72321 : void
72322 194 : SgIfDirectiveStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
72323 : {
72324 : // This function traverses the memory pool for an IR node and
72325 : // calls the function to execute the visitor object.
72326 :
72327 : // Initialize array to the address of the first element of the STL vector
72328 : // (which is guarenteed to be contiguous storage).
72329 : // SgIfDirectiveStatement objectArray [] = *(Memory_Block_List.begin());
72330 194 : if (SgIfDirectiveStatement::pools.empty() == false)
72331 : {
72332 : // Generate an array of memory pools
72333 0 : SgIfDirectiveStatement** objectArray = (SgIfDirectiveStatement**) &(SgIfDirectiveStatement::pools[0]);
72334 :
72335 : // Build a local variable for better performance
72336 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
72337 :
72338 : // Iterate over the memory pools
72339 0 : for (unsigned int i=0; i < SgIfDirectiveStatement::pools.size(); i++)
72340 : {
72341 : // objectArray[i] is a single memory pool
72342 0 : for (unsigned j=0; j < SgIfDirectiveStatement::pool_size; j++)
72343 : {
72344 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
72345 : {
72346 : // printf ("Found a valid SgIfDirectiveStatement object in the memory pool %d at position %d \n",i,j);
72347 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
72348 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
72349 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
72350 : }
72351 : else
72352 : {
72353 : // printf ("Found a INVALID SgIfDirectiveStatement object in the memory pool \n");
72354 : }
72355 : }
72356 : }
72357 : }
72358 :
72359 : // This should not be required since all previously static data members are
72360 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
72361 :
72362 194 : }
72363 :
72364 : void
72365 0 : SgIfDirectiveStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
72366 : {
72367 : // This function visits only a single IR node of the memory pool.
72368 : // it is typically called once for each type of IR node within
72369 : // the automatically generated function: traverseRepresentativeNodes().
72370 :
72371 : // Initialize array to the address of the first element of the STL vector
72372 : // (which is guarenteed to be contiguous storage).
72373 : // SgIfDirectiveStatement objectArray [] = *(Memory_Block_List.begin());
72374 0 : if (SgIfDirectiveStatement::pools.empty() == false)
72375 : {
72376 : // Generate an array of memory pools
72377 0 : SgIfDirectiveStatement** objectArray = (SgIfDirectiveStatement**) &(SgIfDirectiveStatement::pools[0]);
72378 :
72379 : // Build a local variable for better performance
72380 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
72381 :
72382 : // Iterate over the memory pools
72383 0 : bool done = false;
72384 0 : unsigned i=0;
72385 :
72386 : // find the first valid IR node, call visit function, and then leave
72387 0 : while ( done == false && i < SgIfDirectiveStatement::pools.size() )
72388 : {
72389 : // objectArray[i] is a single memory pool
72390 : unsigned j=0;
72391 0 : while (done == false && j < SgIfDirectiveStatement::pool_size)
72392 : {
72393 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
72394 : {
72395 0 : traversal.visit(&(objectArray[i][j]));
72396 0 : done = true;
72397 : }
72398 0 : j++;
72399 : }
72400 0 : i++;
72401 : }
72402 :
72403 : #if 0
72404 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
72405 : if (done == false)
72406 : {
72407 : printf ("No representative for SgIfDirectiveStatement found in memory pools \n");
72408 : }
72409 : #endif
72410 : }
72411 0 : }
72412 :
72413 :
72414 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
72415 : // using values that overflow signed values of int.
72416 : size_t
72417 4 : SgIfDirectiveStatement::numberOfNodes()
72418 : {
72419 : // This function traverses the memory pool for an IR node and
72420 : // counts the number of IR nodes of a particular Sage III IR
72421 : // nodes type.
72422 :
72423 4 : size_t count = 0;
72424 4 : if (SgIfDirectiveStatement::pools.empty() == false)
72425 : {
72426 : // Generate an array of memory pools (this is actually a STL vector,
72427 : // but it is contiguious, so OK to treat this way).
72428 0 : SgIfDirectiveStatement** objectArray = (SgIfDirectiveStatement**) &(SgIfDirectiveStatement::pools[0]);
72429 :
72430 : // Build a local variable for better performance (make it a loop invariant variable).
72431 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
72432 :
72433 : // Iterate over all of the memory pools for this IR node.
72434 0 : for (unsigned int i=0; i < SgIfDirectiveStatement::pools.size(); i++)
72435 : {
72436 : // objectArray[i] is a single memory pool, iterate over all the
72437 : // IR nodes and only count those that are valid IR nodes used in
72438 : // the AST (i.e. allocated IR nodes).
72439 0 : for (unsigned j=0; j < SgIfDirectiveStatement::pool_size; j++)
72440 : {
72441 : // This is indexing the STL vector of C/C++ style arrays as a doubly
72442 : // indexed array access. It is OK since we have leveraged the semantics
72443 : // of STL vector memory as contigous and cast the memory as an array
72444 : // of arrays to use the 2D array indexing. Hope this is not confusing,
72445 : // but it s very fast as an implementation.
72446 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
72447 : {
72448 0 : count++;
72449 : }
72450 : }
72451 : }
72452 : }
72453 :
72454 :
72455 :
72456 4 : return count;
72457 : }
72458 :
72459 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
72460 : // using values that overflow signed values of int.
72461 : size_t
72462 0 : SgIfDirectiveStatement::memoryUsage()
72463 : {
72464 : // This function is required because we need the class name as a type when we call sizeof
72465 : // There might be another way to implement this if we have a traversal that only called a
72466 : // representative object (one call for each type of Sage IIIIR node).
72467 0 : size_t memory = numberOfNodes() * sizeof(SgIfDirectiveStatement);
72468 :
72469 0 : return memory;
72470 : }
72471 :
72472 : /* #line 72473 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
72473 :
72474 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
72475 : void
72476 5342 : SgDeadIfDirectiveStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
72477 : {
72478 : // This function traverses the memory pool for only a specific IR node
72479 : // and calls the visit function of the input class execute a traversal
72480 : // similar to the style of the attribute based traversals within ROSE.
72481 : // This traversal will visit ALL nodes of the AST where as the other
72482 : // attribute based traversals visit only the embedded tree within the AST.
72483 :
72484 : // Initialize array to the address of the first element of the STL vector
72485 : // (which is guaranteed to be contiguous storage).
72486 : // SgDeadIfDirectiveStatement objectArray [] = *(Memory_Block_List.begin());
72487 5342 : if (SgDeadIfDirectiveStatement::pools.empty() == false)
72488 : {
72489 : // Generate an array of memory pools
72490 0 : SgDeadIfDirectiveStatement** objectArray = (SgDeadIfDirectiveStatement**) &(SgDeadIfDirectiveStatement::pools[0]);
72491 :
72492 : // Build a local variable for better performance
72493 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
72494 : #if 0
72495 : // Iterate over the memory pools
72496 : for (unsigned int i=0; i < SgDeadIfDirectiveStatement::pools.size(); i++)
72497 : {
72498 : // objectArray[i] is a single memory pool
72499 : for (int j=0; j < SgDeadIfDirectiveStatement::pool_size; j++)
72500 : {
72501 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
72502 : {
72503 : traversal.visit(&(objectArray[i][j]));
72504 : }
72505 : }
72506 : }
72507 : #else
72508 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
72509 : // compute the list first and then call the visit function on each list element.
72510 :
72511 : // printf ("Inside of SgDeadIfDirectiveStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
72512 :
72513 0 : std::vector<SgDeadIfDirectiveStatement*> nodeList;
72514 :
72515 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
72516 0 : for (unsigned int i=0; i < SgDeadIfDirectiveStatement::pools.size(); i++)
72517 : {
72518 : // objectArray[i] is a single memory pool
72519 0 : for (unsigned j=0; j < SgDeadIfDirectiveStatement::pool_size; j++)
72520 : {
72521 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
72522 : {
72523 0 : nodeList.push_back(&(objectArray[i][j]));
72524 : }
72525 : }
72526 : }
72527 :
72528 : // Iterate over the saved list
72529 0 : size_t nodeListSize = nodeList.size();
72530 0 : for (size_t i=0; i < nodeListSize; i++)
72531 : {
72532 0 : ROSE_ASSERT(nodeList[i] != NULL);
72533 : #if 0
72534 : traversal.visit(nodeList[i]);
72535 : #else
72536 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
72537 : {
72538 0 : traversal.visit(nodeList[i]);
72539 : }
72540 : #endif
72541 : }
72542 : #endif
72543 : }
72544 :
72545 : // This should not be required since all previously static data members are
72546 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
72547 :
72548 5342 : }
72549 :
72550 :
72551 : void
72552 194 : SgDeadIfDirectiveStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
72553 : {
72554 : // This function traverses the memory pool for an IR node and
72555 : // calls the function to execute the visitor object.
72556 :
72557 : // Initialize array to the address of the first element of the STL vector
72558 : // (which is guarenteed to be contiguous storage).
72559 : // SgDeadIfDirectiveStatement objectArray [] = *(Memory_Block_List.begin());
72560 194 : if (SgDeadIfDirectiveStatement::pools.empty() == false)
72561 : {
72562 : // Generate an array of memory pools
72563 0 : SgDeadIfDirectiveStatement** objectArray = (SgDeadIfDirectiveStatement**) &(SgDeadIfDirectiveStatement::pools[0]);
72564 :
72565 : // Build a local variable for better performance
72566 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
72567 :
72568 : // Iterate over the memory pools
72569 0 : for (unsigned int i=0; i < SgDeadIfDirectiveStatement::pools.size(); i++)
72570 : {
72571 : // objectArray[i] is a single memory pool
72572 0 : for (unsigned j=0; j < SgDeadIfDirectiveStatement::pool_size; j++)
72573 : {
72574 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
72575 : {
72576 : // printf ("Found a valid SgDeadIfDirectiveStatement object in the memory pool %d at position %d \n",i,j);
72577 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
72578 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
72579 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
72580 : }
72581 : else
72582 : {
72583 : // printf ("Found a INVALID SgDeadIfDirectiveStatement object in the memory pool \n");
72584 : }
72585 : }
72586 : }
72587 : }
72588 :
72589 : // This should not be required since all previously static data members are
72590 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
72591 :
72592 194 : }
72593 :
72594 : void
72595 0 : SgDeadIfDirectiveStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
72596 : {
72597 : // This function visits only a single IR node of the memory pool.
72598 : // it is typically called once for each type of IR node within
72599 : // the automatically generated function: traverseRepresentativeNodes().
72600 :
72601 : // Initialize array to the address of the first element of the STL vector
72602 : // (which is guarenteed to be contiguous storage).
72603 : // SgDeadIfDirectiveStatement objectArray [] = *(Memory_Block_List.begin());
72604 0 : if (SgDeadIfDirectiveStatement::pools.empty() == false)
72605 : {
72606 : // Generate an array of memory pools
72607 0 : SgDeadIfDirectiveStatement** objectArray = (SgDeadIfDirectiveStatement**) &(SgDeadIfDirectiveStatement::pools[0]);
72608 :
72609 : // Build a local variable for better performance
72610 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
72611 :
72612 : // Iterate over the memory pools
72613 0 : bool done = false;
72614 0 : unsigned i=0;
72615 :
72616 : // find the first valid IR node, call visit function, and then leave
72617 0 : while ( done == false && i < SgDeadIfDirectiveStatement::pools.size() )
72618 : {
72619 : // objectArray[i] is a single memory pool
72620 : unsigned j=0;
72621 0 : while (done == false && j < SgDeadIfDirectiveStatement::pool_size)
72622 : {
72623 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
72624 : {
72625 0 : traversal.visit(&(objectArray[i][j]));
72626 0 : done = true;
72627 : }
72628 0 : j++;
72629 : }
72630 0 : i++;
72631 : }
72632 :
72633 : #if 0
72634 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
72635 : if (done == false)
72636 : {
72637 : printf ("No representative for SgDeadIfDirectiveStatement found in memory pools \n");
72638 : }
72639 : #endif
72640 : }
72641 0 : }
72642 :
72643 :
72644 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
72645 : // using values that overflow signed values of int.
72646 : size_t
72647 4 : SgDeadIfDirectiveStatement::numberOfNodes()
72648 : {
72649 : // This function traverses the memory pool for an IR node and
72650 : // counts the number of IR nodes of a particular Sage III IR
72651 : // nodes type.
72652 :
72653 4 : size_t count = 0;
72654 4 : if (SgDeadIfDirectiveStatement::pools.empty() == false)
72655 : {
72656 : // Generate an array of memory pools (this is actually a STL vector,
72657 : // but it is contiguious, so OK to treat this way).
72658 0 : SgDeadIfDirectiveStatement** objectArray = (SgDeadIfDirectiveStatement**) &(SgDeadIfDirectiveStatement::pools[0]);
72659 :
72660 : // Build a local variable for better performance (make it a loop invariant variable).
72661 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
72662 :
72663 : // Iterate over all of the memory pools for this IR node.
72664 0 : for (unsigned int i=0; i < SgDeadIfDirectiveStatement::pools.size(); i++)
72665 : {
72666 : // objectArray[i] is a single memory pool, iterate over all the
72667 : // IR nodes and only count those that are valid IR nodes used in
72668 : // the AST (i.e. allocated IR nodes).
72669 0 : for (unsigned j=0; j < SgDeadIfDirectiveStatement::pool_size; j++)
72670 : {
72671 : // This is indexing the STL vector of C/C++ style arrays as a doubly
72672 : // indexed array access. It is OK since we have leveraged the semantics
72673 : // of STL vector memory as contigous and cast the memory as an array
72674 : // of arrays to use the 2D array indexing. Hope this is not confusing,
72675 : // but it s very fast as an implementation.
72676 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
72677 : {
72678 0 : count++;
72679 : }
72680 : }
72681 : }
72682 : }
72683 :
72684 :
72685 :
72686 4 : return count;
72687 : }
72688 :
72689 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
72690 : // using values that overflow signed values of int.
72691 : size_t
72692 0 : SgDeadIfDirectiveStatement::memoryUsage()
72693 : {
72694 : // This function is required because we need the class name as a type when we call sizeof
72695 : // There might be another way to implement this if we have a traversal that only called a
72696 : // representative object (one call for each type of Sage IIIIR node).
72697 0 : size_t memory = numberOfNodes() * sizeof(SgDeadIfDirectiveStatement);
72698 :
72699 0 : return memory;
72700 : }
72701 :
72702 : /* #line 72703 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
72703 :
72704 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
72705 : void
72706 5342 : SgElseDirectiveStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
72707 : {
72708 : // This function traverses the memory pool for only a specific IR node
72709 : // and calls the visit function of the input class execute a traversal
72710 : // similar to the style of the attribute based traversals within ROSE.
72711 : // This traversal will visit ALL nodes of the AST where as the other
72712 : // attribute based traversals visit only the embedded tree within the AST.
72713 :
72714 : // Initialize array to the address of the first element of the STL vector
72715 : // (which is guaranteed to be contiguous storage).
72716 : // SgElseDirectiveStatement objectArray [] = *(Memory_Block_List.begin());
72717 5342 : if (SgElseDirectiveStatement::pools.empty() == false)
72718 : {
72719 : // Generate an array of memory pools
72720 0 : SgElseDirectiveStatement** objectArray = (SgElseDirectiveStatement**) &(SgElseDirectiveStatement::pools[0]);
72721 :
72722 : // Build a local variable for better performance
72723 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
72724 : #if 0
72725 : // Iterate over the memory pools
72726 : for (unsigned int i=0; i < SgElseDirectiveStatement::pools.size(); i++)
72727 : {
72728 : // objectArray[i] is a single memory pool
72729 : for (int j=0; j < SgElseDirectiveStatement::pool_size; j++)
72730 : {
72731 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
72732 : {
72733 : traversal.visit(&(objectArray[i][j]));
72734 : }
72735 : }
72736 : }
72737 : #else
72738 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
72739 : // compute the list first and then call the visit function on each list element.
72740 :
72741 : // printf ("Inside of SgElseDirectiveStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
72742 :
72743 0 : std::vector<SgElseDirectiveStatement*> nodeList;
72744 :
72745 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
72746 0 : for (unsigned int i=0; i < SgElseDirectiveStatement::pools.size(); i++)
72747 : {
72748 : // objectArray[i] is a single memory pool
72749 0 : for (unsigned j=0; j < SgElseDirectiveStatement::pool_size; j++)
72750 : {
72751 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
72752 : {
72753 0 : nodeList.push_back(&(objectArray[i][j]));
72754 : }
72755 : }
72756 : }
72757 :
72758 : // Iterate over the saved list
72759 0 : size_t nodeListSize = nodeList.size();
72760 0 : for (size_t i=0; i < nodeListSize; i++)
72761 : {
72762 0 : ROSE_ASSERT(nodeList[i] != NULL);
72763 : #if 0
72764 : traversal.visit(nodeList[i]);
72765 : #else
72766 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
72767 : {
72768 0 : traversal.visit(nodeList[i]);
72769 : }
72770 : #endif
72771 : }
72772 : #endif
72773 : }
72774 :
72775 : // This should not be required since all previously static data members are
72776 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
72777 :
72778 5342 : }
72779 :
72780 :
72781 : void
72782 194 : SgElseDirectiveStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
72783 : {
72784 : // This function traverses the memory pool for an IR node and
72785 : // calls the function to execute the visitor object.
72786 :
72787 : // Initialize array to the address of the first element of the STL vector
72788 : // (which is guarenteed to be contiguous storage).
72789 : // SgElseDirectiveStatement objectArray [] = *(Memory_Block_List.begin());
72790 194 : if (SgElseDirectiveStatement::pools.empty() == false)
72791 : {
72792 : // Generate an array of memory pools
72793 0 : SgElseDirectiveStatement** objectArray = (SgElseDirectiveStatement**) &(SgElseDirectiveStatement::pools[0]);
72794 :
72795 : // Build a local variable for better performance
72796 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
72797 :
72798 : // Iterate over the memory pools
72799 0 : for (unsigned int i=0; i < SgElseDirectiveStatement::pools.size(); i++)
72800 : {
72801 : // objectArray[i] is a single memory pool
72802 0 : for (unsigned j=0; j < SgElseDirectiveStatement::pool_size; j++)
72803 : {
72804 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
72805 : {
72806 : // printf ("Found a valid SgElseDirectiveStatement object in the memory pool %d at position %d \n",i,j);
72807 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
72808 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
72809 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
72810 : }
72811 : else
72812 : {
72813 : // printf ("Found a INVALID SgElseDirectiveStatement object in the memory pool \n");
72814 : }
72815 : }
72816 : }
72817 : }
72818 :
72819 : // This should not be required since all previously static data members are
72820 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
72821 :
72822 194 : }
72823 :
72824 : void
72825 0 : SgElseDirectiveStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
72826 : {
72827 : // This function visits only a single IR node of the memory pool.
72828 : // it is typically called once for each type of IR node within
72829 : // the automatically generated function: traverseRepresentativeNodes().
72830 :
72831 : // Initialize array to the address of the first element of the STL vector
72832 : // (which is guarenteed to be contiguous storage).
72833 : // SgElseDirectiveStatement objectArray [] = *(Memory_Block_List.begin());
72834 0 : if (SgElseDirectiveStatement::pools.empty() == false)
72835 : {
72836 : // Generate an array of memory pools
72837 0 : SgElseDirectiveStatement** objectArray = (SgElseDirectiveStatement**) &(SgElseDirectiveStatement::pools[0]);
72838 :
72839 : // Build a local variable for better performance
72840 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
72841 :
72842 : // Iterate over the memory pools
72843 0 : bool done = false;
72844 0 : unsigned i=0;
72845 :
72846 : // find the first valid IR node, call visit function, and then leave
72847 0 : while ( done == false && i < SgElseDirectiveStatement::pools.size() )
72848 : {
72849 : // objectArray[i] is a single memory pool
72850 : unsigned j=0;
72851 0 : while (done == false && j < SgElseDirectiveStatement::pool_size)
72852 : {
72853 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
72854 : {
72855 0 : traversal.visit(&(objectArray[i][j]));
72856 0 : done = true;
72857 : }
72858 0 : j++;
72859 : }
72860 0 : i++;
72861 : }
72862 :
72863 : #if 0
72864 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
72865 : if (done == false)
72866 : {
72867 : printf ("No representative for SgElseDirectiveStatement found in memory pools \n");
72868 : }
72869 : #endif
72870 : }
72871 0 : }
72872 :
72873 :
72874 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
72875 : // using values that overflow signed values of int.
72876 : size_t
72877 4 : SgElseDirectiveStatement::numberOfNodes()
72878 : {
72879 : // This function traverses the memory pool for an IR node and
72880 : // counts the number of IR nodes of a particular Sage III IR
72881 : // nodes type.
72882 :
72883 4 : size_t count = 0;
72884 4 : if (SgElseDirectiveStatement::pools.empty() == false)
72885 : {
72886 : // Generate an array of memory pools (this is actually a STL vector,
72887 : // but it is contiguious, so OK to treat this way).
72888 0 : SgElseDirectiveStatement** objectArray = (SgElseDirectiveStatement**) &(SgElseDirectiveStatement::pools[0]);
72889 :
72890 : // Build a local variable for better performance (make it a loop invariant variable).
72891 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
72892 :
72893 : // Iterate over all of the memory pools for this IR node.
72894 0 : for (unsigned int i=0; i < SgElseDirectiveStatement::pools.size(); i++)
72895 : {
72896 : // objectArray[i] is a single memory pool, iterate over all the
72897 : // IR nodes and only count those that are valid IR nodes used in
72898 : // the AST (i.e. allocated IR nodes).
72899 0 : for (unsigned j=0; j < SgElseDirectiveStatement::pool_size; j++)
72900 : {
72901 : // This is indexing the STL vector of C/C++ style arrays as a doubly
72902 : // indexed array access. It is OK since we have leveraged the semantics
72903 : // of STL vector memory as contigous and cast the memory as an array
72904 : // of arrays to use the 2D array indexing. Hope this is not confusing,
72905 : // but it s very fast as an implementation.
72906 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
72907 : {
72908 0 : count++;
72909 : }
72910 : }
72911 : }
72912 : }
72913 :
72914 :
72915 :
72916 4 : return count;
72917 : }
72918 :
72919 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
72920 : // using values that overflow signed values of int.
72921 : size_t
72922 0 : SgElseDirectiveStatement::memoryUsage()
72923 : {
72924 : // This function is required because we need the class name as a type when we call sizeof
72925 : // There might be another way to implement this if we have a traversal that only called a
72926 : // representative object (one call for each type of Sage IIIIR node).
72927 0 : size_t memory = numberOfNodes() * sizeof(SgElseDirectiveStatement);
72928 :
72929 0 : return memory;
72930 : }
72931 :
72932 : /* #line 72933 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
72933 :
72934 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
72935 : void
72936 5342 : SgElseifDirectiveStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
72937 : {
72938 : // This function traverses the memory pool for only a specific IR node
72939 : // and calls the visit function of the input class execute a traversal
72940 : // similar to the style of the attribute based traversals within ROSE.
72941 : // This traversal will visit ALL nodes of the AST where as the other
72942 : // attribute based traversals visit only the embedded tree within the AST.
72943 :
72944 : // Initialize array to the address of the first element of the STL vector
72945 : // (which is guaranteed to be contiguous storage).
72946 : // SgElseifDirectiveStatement objectArray [] = *(Memory_Block_List.begin());
72947 5342 : if (SgElseifDirectiveStatement::pools.empty() == false)
72948 : {
72949 : // Generate an array of memory pools
72950 0 : SgElseifDirectiveStatement** objectArray = (SgElseifDirectiveStatement**) &(SgElseifDirectiveStatement::pools[0]);
72951 :
72952 : // Build a local variable for better performance
72953 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
72954 : #if 0
72955 : // Iterate over the memory pools
72956 : for (unsigned int i=0; i < SgElseifDirectiveStatement::pools.size(); i++)
72957 : {
72958 : // objectArray[i] is a single memory pool
72959 : for (int j=0; j < SgElseifDirectiveStatement::pool_size; j++)
72960 : {
72961 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
72962 : {
72963 : traversal.visit(&(objectArray[i][j]));
72964 : }
72965 : }
72966 : }
72967 : #else
72968 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
72969 : // compute the list first and then call the visit function on each list element.
72970 :
72971 : // printf ("Inside of SgElseifDirectiveStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
72972 :
72973 0 : std::vector<SgElseifDirectiveStatement*> nodeList;
72974 :
72975 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
72976 0 : for (unsigned int i=0; i < SgElseifDirectiveStatement::pools.size(); i++)
72977 : {
72978 : // objectArray[i] is a single memory pool
72979 0 : for (unsigned j=0; j < SgElseifDirectiveStatement::pool_size; j++)
72980 : {
72981 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
72982 : {
72983 0 : nodeList.push_back(&(objectArray[i][j]));
72984 : }
72985 : }
72986 : }
72987 :
72988 : // Iterate over the saved list
72989 0 : size_t nodeListSize = nodeList.size();
72990 0 : for (size_t i=0; i < nodeListSize; i++)
72991 : {
72992 0 : ROSE_ASSERT(nodeList[i] != NULL);
72993 : #if 0
72994 : traversal.visit(nodeList[i]);
72995 : #else
72996 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
72997 : {
72998 0 : traversal.visit(nodeList[i]);
72999 : }
73000 : #endif
73001 : }
73002 : #endif
73003 : }
73004 :
73005 : // This should not be required since all previously static data members are
73006 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
73007 :
73008 5342 : }
73009 :
73010 :
73011 : void
73012 194 : SgElseifDirectiveStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
73013 : {
73014 : // This function traverses the memory pool for an IR node and
73015 : // calls the function to execute the visitor object.
73016 :
73017 : // Initialize array to the address of the first element of the STL vector
73018 : // (which is guarenteed to be contiguous storage).
73019 : // SgElseifDirectiveStatement objectArray [] = *(Memory_Block_List.begin());
73020 194 : if (SgElseifDirectiveStatement::pools.empty() == false)
73021 : {
73022 : // Generate an array of memory pools
73023 0 : SgElseifDirectiveStatement** objectArray = (SgElseifDirectiveStatement**) &(SgElseifDirectiveStatement::pools[0]);
73024 :
73025 : // Build a local variable for better performance
73026 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
73027 :
73028 : // Iterate over the memory pools
73029 0 : for (unsigned int i=0; i < SgElseifDirectiveStatement::pools.size(); i++)
73030 : {
73031 : // objectArray[i] is a single memory pool
73032 0 : for (unsigned j=0; j < SgElseifDirectiveStatement::pool_size; j++)
73033 : {
73034 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
73035 : {
73036 : // printf ("Found a valid SgElseifDirectiveStatement object in the memory pool %d at position %d \n",i,j);
73037 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
73038 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
73039 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
73040 : }
73041 : else
73042 : {
73043 : // printf ("Found a INVALID SgElseifDirectiveStatement object in the memory pool \n");
73044 : }
73045 : }
73046 : }
73047 : }
73048 :
73049 : // This should not be required since all previously static data members are
73050 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
73051 :
73052 194 : }
73053 :
73054 : void
73055 0 : SgElseifDirectiveStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
73056 : {
73057 : // This function visits only a single IR node of the memory pool.
73058 : // it is typically called once for each type of IR node within
73059 : // the automatically generated function: traverseRepresentativeNodes().
73060 :
73061 : // Initialize array to the address of the first element of the STL vector
73062 : // (which is guarenteed to be contiguous storage).
73063 : // SgElseifDirectiveStatement objectArray [] = *(Memory_Block_List.begin());
73064 0 : if (SgElseifDirectiveStatement::pools.empty() == false)
73065 : {
73066 : // Generate an array of memory pools
73067 0 : SgElseifDirectiveStatement** objectArray = (SgElseifDirectiveStatement**) &(SgElseifDirectiveStatement::pools[0]);
73068 :
73069 : // Build a local variable for better performance
73070 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
73071 :
73072 : // Iterate over the memory pools
73073 0 : bool done = false;
73074 0 : unsigned i=0;
73075 :
73076 : // find the first valid IR node, call visit function, and then leave
73077 0 : while ( done == false && i < SgElseifDirectiveStatement::pools.size() )
73078 : {
73079 : // objectArray[i] is a single memory pool
73080 : unsigned j=0;
73081 0 : while (done == false && j < SgElseifDirectiveStatement::pool_size)
73082 : {
73083 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
73084 : {
73085 0 : traversal.visit(&(objectArray[i][j]));
73086 0 : done = true;
73087 : }
73088 0 : j++;
73089 : }
73090 0 : i++;
73091 : }
73092 :
73093 : #if 0
73094 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
73095 : if (done == false)
73096 : {
73097 : printf ("No representative for SgElseifDirectiveStatement found in memory pools \n");
73098 : }
73099 : #endif
73100 : }
73101 0 : }
73102 :
73103 :
73104 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
73105 : // using values that overflow signed values of int.
73106 : size_t
73107 4 : SgElseifDirectiveStatement::numberOfNodes()
73108 : {
73109 : // This function traverses the memory pool for an IR node and
73110 : // counts the number of IR nodes of a particular Sage III IR
73111 : // nodes type.
73112 :
73113 4 : size_t count = 0;
73114 4 : if (SgElseifDirectiveStatement::pools.empty() == false)
73115 : {
73116 : // Generate an array of memory pools (this is actually a STL vector,
73117 : // but it is contiguious, so OK to treat this way).
73118 0 : SgElseifDirectiveStatement** objectArray = (SgElseifDirectiveStatement**) &(SgElseifDirectiveStatement::pools[0]);
73119 :
73120 : // Build a local variable for better performance (make it a loop invariant variable).
73121 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
73122 :
73123 : // Iterate over all of the memory pools for this IR node.
73124 0 : for (unsigned int i=0; i < SgElseifDirectiveStatement::pools.size(); i++)
73125 : {
73126 : // objectArray[i] is a single memory pool, iterate over all the
73127 : // IR nodes and only count those that are valid IR nodes used in
73128 : // the AST (i.e. allocated IR nodes).
73129 0 : for (unsigned j=0; j < SgElseifDirectiveStatement::pool_size; j++)
73130 : {
73131 : // This is indexing the STL vector of C/C++ style arrays as a doubly
73132 : // indexed array access. It is OK since we have leveraged the semantics
73133 : // of STL vector memory as contigous and cast the memory as an array
73134 : // of arrays to use the 2D array indexing. Hope this is not confusing,
73135 : // but it s very fast as an implementation.
73136 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
73137 : {
73138 0 : count++;
73139 : }
73140 : }
73141 : }
73142 : }
73143 :
73144 :
73145 :
73146 4 : return count;
73147 : }
73148 :
73149 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
73150 : // using values that overflow signed values of int.
73151 : size_t
73152 0 : SgElseifDirectiveStatement::memoryUsage()
73153 : {
73154 : // This function is required because we need the class name as a type when we call sizeof
73155 : // There might be another way to implement this if we have a traversal that only called a
73156 : // representative object (one call for each type of Sage IIIIR node).
73157 0 : size_t memory = numberOfNodes() * sizeof(SgElseifDirectiveStatement);
73158 :
73159 0 : return memory;
73160 : }
73161 :
73162 : /* #line 73163 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
73163 :
73164 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
73165 : void
73166 5342 : SgEndifDirectiveStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
73167 : {
73168 : // This function traverses the memory pool for only a specific IR node
73169 : // and calls the visit function of the input class execute a traversal
73170 : // similar to the style of the attribute based traversals within ROSE.
73171 : // This traversal will visit ALL nodes of the AST where as the other
73172 : // attribute based traversals visit only the embedded tree within the AST.
73173 :
73174 : // Initialize array to the address of the first element of the STL vector
73175 : // (which is guaranteed to be contiguous storage).
73176 : // SgEndifDirectiveStatement objectArray [] = *(Memory_Block_List.begin());
73177 5342 : if (SgEndifDirectiveStatement::pools.empty() == false)
73178 : {
73179 : // Generate an array of memory pools
73180 0 : SgEndifDirectiveStatement** objectArray = (SgEndifDirectiveStatement**) &(SgEndifDirectiveStatement::pools[0]);
73181 :
73182 : // Build a local variable for better performance
73183 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
73184 : #if 0
73185 : // Iterate over the memory pools
73186 : for (unsigned int i=0; i < SgEndifDirectiveStatement::pools.size(); i++)
73187 : {
73188 : // objectArray[i] is a single memory pool
73189 : for (int j=0; j < SgEndifDirectiveStatement::pool_size; j++)
73190 : {
73191 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
73192 : {
73193 : traversal.visit(&(objectArray[i][j]));
73194 : }
73195 : }
73196 : }
73197 : #else
73198 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
73199 : // compute the list first and then call the visit function on each list element.
73200 :
73201 : // printf ("Inside of SgEndifDirectiveStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
73202 :
73203 0 : std::vector<SgEndifDirectiveStatement*> nodeList;
73204 :
73205 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
73206 0 : for (unsigned int i=0; i < SgEndifDirectiveStatement::pools.size(); i++)
73207 : {
73208 : // objectArray[i] is a single memory pool
73209 0 : for (unsigned j=0; j < SgEndifDirectiveStatement::pool_size; j++)
73210 : {
73211 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
73212 : {
73213 0 : nodeList.push_back(&(objectArray[i][j]));
73214 : }
73215 : }
73216 : }
73217 :
73218 : // Iterate over the saved list
73219 0 : size_t nodeListSize = nodeList.size();
73220 0 : for (size_t i=0; i < nodeListSize; i++)
73221 : {
73222 0 : ROSE_ASSERT(nodeList[i] != NULL);
73223 : #if 0
73224 : traversal.visit(nodeList[i]);
73225 : #else
73226 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
73227 : {
73228 0 : traversal.visit(nodeList[i]);
73229 : }
73230 : #endif
73231 : }
73232 : #endif
73233 : }
73234 :
73235 : // This should not be required since all previously static data members are
73236 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
73237 :
73238 5342 : }
73239 :
73240 :
73241 : void
73242 194 : SgEndifDirectiveStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
73243 : {
73244 : // This function traverses the memory pool for an IR node and
73245 : // calls the function to execute the visitor object.
73246 :
73247 : // Initialize array to the address of the first element of the STL vector
73248 : // (which is guarenteed to be contiguous storage).
73249 : // SgEndifDirectiveStatement objectArray [] = *(Memory_Block_List.begin());
73250 194 : if (SgEndifDirectiveStatement::pools.empty() == false)
73251 : {
73252 : // Generate an array of memory pools
73253 0 : SgEndifDirectiveStatement** objectArray = (SgEndifDirectiveStatement**) &(SgEndifDirectiveStatement::pools[0]);
73254 :
73255 : // Build a local variable for better performance
73256 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
73257 :
73258 : // Iterate over the memory pools
73259 0 : for (unsigned int i=0; i < SgEndifDirectiveStatement::pools.size(); i++)
73260 : {
73261 : // objectArray[i] is a single memory pool
73262 0 : for (unsigned j=0; j < SgEndifDirectiveStatement::pool_size; j++)
73263 : {
73264 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
73265 : {
73266 : // printf ("Found a valid SgEndifDirectiveStatement object in the memory pool %d at position %d \n",i,j);
73267 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
73268 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
73269 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
73270 : }
73271 : else
73272 : {
73273 : // printf ("Found a INVALID SgEndifDirectiveStatement object in the memory pool \n");
73274 : }
73275 : }
73276 : }
73277 : }
73278 :
73279 : // This should not be required since all previously static data members are
73280 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
73281 :
73282 194 : }
73283 :
73284 : void
73285 0 : SgEndifDirectiveStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
73286 : {
73287 : // This function visits only a single IR node of the memory pool.
73288 : // it is typically called once for each type of IR node within
73289 : // the automatically generated function: traverseRepresentativeNodes().
73290 :
73291 : // Initialize array to the address of the first element of the STL vector
73292 : // (which is guarenteed to be contiguous storage).
73293 : // SgEndifDirectiveStatement objectArray [] = *(Memory_Block_List.begin());
73294 0 : if (SgEndifDirectiveStatement::pools.empty() == false)
73295 : {
73296 : // Generate an array of memory pools
73297 0 : SgEndifDirectiveStatement** objectArray = (SgEndifDirectiveStatement**) &(SgEndifDirectiveStatement::pools[0]);
73298 :
73299 : // Build a local variable for better performance
73300 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
73301 :
73302 : // Iterate over the memory pools
73303 0 : bool done = false;
73304 0 : unsigned i=0;
73305 :
73306 : // find the first valid IR node, call visit function, and then leave
73307 0 : while ( done == false && i < SgEndifDirectiveStatement::pools.size() )
73308 : {
73309 : // objectArray[i] is a single memory pool
73310 : unsigned j=0;
73311 0 : while (done == false && j < SgEndifDirectiveStatement::pool_size)
73312 : {
73313 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
73314 : {
73315 0 : traversal.visit(&(objectArray[i][j]));
73316 0 : done = true;
73317 : }
73318 0 : j++;
73319 : }
73320 0 : i++;
73321 : }
73322 :
73323 : #if 0
73324 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
73325 : if (done == false)
73326 : {
73327 : printf ("No representative for SgEndifDirectiveStatement found in memory pools \n");
73328 : }
73329 : #endif
73330 : }
73331 0 : }
73332 :
73333 :
73334 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
73335 : // using values that overflow signed values of int.
73336 : size_t
73337 4 : SgEndifDirectiveStatement::numberOfNodes()
73338 : {
73339 : // This function traverses the memory pool for an IR node and
73340 : // counts the number of IR nodes of a particular Sage III IR
73341 : // nodes type.
73342 :
73343 4 : size_t count = 0;
73344 4 : if (SgEndifDirectiveStatement::pools.empty() == false)
73345 : {
73346 : // Generate an array of memory pools (this is actually a STL vector,
73347 : // but it is contiguious, so OK to treat this way).
73348 0 : SgEndifDirectiveStatement** objectArray = (SgEndifDirectiveStatement**) &(SgEndifDirectiveStatement::pools[0]);
73349 :
73350 : // Build a local variable for better performance (make it a loop invariant variable).
73351 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
73352 :
73353 : // Iterate over all of the memory pools for this IR node.
73354 0 : for (unsigned int i=0; i < SgEndifDirectiveStatement::pools.size(); i++)
73355 : {
73356 : // objectArray[i] is a single memory pool, iterate over all the
73357 : // IR nodes and only count those that are valid IR nodes used in
73358 : // the AST (i.e. allocated IR nodes).
73359 0 : for (unsigned j=0; j < SgEndifDirectiveStatement::pool_size; j++)
73360 : {
73361 : // This is indexing the STL vector of C/C++ style arrays as a doubly
73362 : // indexed array access. It is OK since we have leveraged the semantics
73363 : // of STL vector memory as contigous and cast the memory as an array
73364 : // of arrays to use the 2D array indexing. Hope this is not confusing,
73365 : // but it s very fast as an implementation.
73366 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
73367 : {
73368 0 : count++;
73369 : }
73370 : }
73371 : }
73372 : }
73373 :
73374 :
73375 :
73376 4 : return count;
73377 : }
73378 :
73379 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
73380 : // using values that overflow signed values of int.
73381 : size_t
73382 0 : SgEndifDirectiveStatement::memoryUsage()
73383 : {
73384 : // This function is required because we need the class name as a type when we call sizeof
73385 : // There might be another way to implement this if we have a traversal that only called a
73386 : // representative object (one call for each type of Sage IIIIR node).
73387 0 : size_t memory = numberOfNodes() * sizeof(SgEndifDirectiveStatement);
73388 :
73389 0 : return memory;
73390 : }
73391 :
73392 : /* #line 73393 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
73393 :
73394 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
73395 : void
73396 5342 : SgLineDirectiveStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
73397 : {
73398 : // This function traverses the memory pool for only a specific IR node
73399 : // and calls the visit function of the input class execute a traversal
73400 : // similar to the style of the attribute based traversals within ROSE.
73401 : // This traversal will visit ALL nodes of the AST where as the other
73402 : // attribute based traversals visit only the embedded tree within the AST.
73403 :
73404 : // Initialize array to the address of the first element of the STL vector
73405 : // (which is guaranteed to be contiguous storage).
73406 : // SgLineDirectiveStatement objectArray [] = *(Memory_Block_List.begin());
73407 5342 : if (SgLineDirectiveStatement::pools.empty() == false)
73408 : {
73409 : // Generate an array of memory pools
73410 0 : SgLineDirectiveStatement** objectArray = (SgLineDirectiveStatement**) &(SgLineDirectiveStatement::pools[0]);
73411 :
73412 : // Build a local variable for better performance
73413 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
73414 : #if 0
73415 : // Iterate over the memory pools
73416 : for (unsigned int i=0; i < SgLineDirectiveStatement::pools.size(); i++)
73417 : {
73418 : // objectArray[i] is a single memory pool
73419 : for (int j=0; j < SgLineDirectiveStatement::pool_size; j++)
73420 : {
73421 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
73422 : {
73423 : traversal.visit(&(objectArray[i][j]));
73424 : }
73425 : }
73426 : }
73427 : #else
73428 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
73429 : // compute the list first and then call the visit function on each list element.
73430 :
73431 : // printf ("Inside of SgLineDirectiveStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
73432 :
73433 0 : std::vector<SgLineDirectiveStatement*> nodeList;
73434 :
73435 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
73436 0 : for (unsigned int i=0; i < SgLineDirectiveStatement::pools.size(); i++)
73437 : {
73438 : // objectArray[i] is a single memory pool
73439 0 : for (unsigned j=0; j < SgLineDirectiveStatement::pool_size; j++)
73440 : {
73441 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
73442 : {
73443 0 : nodeList.push_back(&(objectArray[i][j]));
73444 : }
73445 : }
73446 : }
73447 :
73448 : // Iterate over the saved list
73449 0 : size_t nodeListSize = nodeList.size();
73450 0 : for (size_t i=0; i < nodeListSize; i++)
73451 : {
73452 0 : ROSE_ASSERT(nodeList[i] != NULL);
73453 : #if 0
73454 : traversal.visit(nodeList[i]);
73455 : #else
73456 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
73457 : {
73458 0 : traversal.visit(nodeList[i]);
73459 : }
73460 : #endif
73461 : }
73462 : #endif
73463 : }
73464 :
73465 : // This should not be required since all previously static data members are
73466 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
73467 :
73468 5342 : }
73469 :
73470 :
73471 : void
73472 194 : SgLineDirectiveStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
73473 : {
73474 : // This function traverses the memory pool for an IR node and
73475 : // calls the function to execute the visitor object.
73476 :
73477 : // Initialize array to the address of the first element of the STL vector
73478 : // (which is guarenteed to be contiguous storage).
73479 : // SgLineDirectiveStatement objectArray [] = *(Memory_Block_List.begin());
73480 194 : if (SgLineDirectiveStatement::pools.empty() == false)
73481 : {
73482 : // Generate an array of memory pools
73483 0 : SgLineDirectiveStatement** objectArray = (SgLineDirectiveStatement**) &(SgLineDirectiveStatement::pools[0]);
73484 :
73485 : // Build a local variable for better performance
73486 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
73487 :
73488 : // Iterate over the memory pools
73489 0 : for (unsigned int i=0; i < SgLineDirectiveStatement::pools.size(); i++)
73490 : {
73491 : // objectArray[i] is a single memory pool
73492 0 : for (unsigned j=0; j < SgLineDirectiveStatement::pool_size; j++)
73493 : {
73494 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
73495 : {
73496 : // printf ("Found a valid SgLineDirectiveStatement object in the memory pool %d at position %d \n",i,j);
73497 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
73498 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
73499 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
73500 : }
73501 : else
73502 : {
73503 : // printf ("Found a INVALID SgLineDirectiveStatement object in the memory pool \n");
73504 : }
73505 : }
73506 : }
73507 : }
73508 :
73509 : // This should not be required since all previously static data members are
73510 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
73511 :
73512 194 : }
73513 :
73514 : void
73515 0 : SgLineDirectiveStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
73516 : {
73517 : // This function visits only a single IR node of the memory pool.
73518 : // it is typically called once for each type of IR node within
73519 : // the automatically generated function: traverseRepresentativeNodes().
73520 :
73521 : // Initialize array to the address of the first element of the STL vector
73522 : // (which is guarenteed to be contiguous storage).
73523 : // SgLineDirectiveStatement objectArray [] = *(Memory_Block_List.begin());
73524 0 : if (SgLineDirectiveStatement::pools.empty() == false)
73525 : {
73526 : // Generate an array of memory pools
73527 0 : SgLineDirectiveStatement** objectArray = (SgLineDirectiveStatement**) &(SgLineDirectiveStatement::pools[0]);
73528 :
73529 : // Build a local variable for better performance
73530 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
73531 :
73532 : // Iterate over the memory pools
73533 0 : bool done = false;
73534 0 : unsigned i=0;
73535 :
73536 : // find the first valid IR node, call visit function, and then leave
73537 0 : while ( done == false && i < SgLineDirectiveStatement::pools.size() )
73538 : {
73539 : // objectArray[i] is a single memory pool
73540 : unsigned j=0;
73541 0 : while (done == false && j < SgLineDirectiveStatement::pool_size)
73542 : {
73543 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
73544 : {
73545 0 : traversal.visit(&(objectArray[i][j]));
73546 0 : done = true;
73547 : }
73548 0 : j++;
73549 : }
73550 0 : i++;
73551 : }
73552 :
73553 : #if 0
73554 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
73555 : if (done == false)
73556 : {
73557 : printf ("No representative for SgLineDirectiveStatement found in memory pools \n");
73558 : }
73559 : #endif
73560 : }
73561 0 : }
73562 :
73563 :
73564 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
73565 : // using values that overflow signed values of int.
73566 : size_t
73567 4 : SgLineDirectiveStatement::numberOfNodes()
73568 : {
73569 : // This function traverses the memory pool for an IR node and
73570 : // counts the number of IR nodes of a particular Sage III IR
73571 : // nodes type.
73572 :
73573 4 : size_t count = 0;
73574 4 : if (SgLineDirectiveStatement::pools.empty() == false)
73575 : {
73576 : // Generate an array of memory pools (this is actually a STL vector,
73577 : // but it is contiguious, so OK to treat this way).
73578 0 : SgLineDirectiveStatement** objectArray = (SgLineDirectiveStatement**) &(SgLineDirectiveStatement::pools[0]);
73579 :
73580 : // Build a local variable for better performance (make it a loop invariant variable).
73581 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
73582 :
73583 : // Iterate over all of the memory pools for this IR node.
73584 0 : for (unsigned int i=0; i < SgLineDirectiveStatement::pools.size(); i++)
73585 : {
73586 : // objectArray[i] is a single memory pool, iterate over all the
73587 : // IR nodes and only count those that are valid IR nodes used in
73588 : // the AST (i.e. allocated IR nodes).
73589 0 : for (unsigned j=0; j < SgLineDirectiveStatement::pool_size; j++)
73590 : {
73591 : // This is indexing the STL vector of C/C++ style arrays as a doubly
73592 : // indexed array access. It is OK since we have leveraged the semantics
73593 : // of STL vector memory as contigous and cast the memory as an array
73594 : // of arrays to use the 2D array indexing. Hope this is not confusing,
73595 : // but it s very fast as an implementation.
73596 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
73597 : {
73598 0 : count++;
73599 : }
73600 : }
73601 : }
73602 : }
73603 :
73604 :
73605 :
73606 4 : return count;
73607 : }
73608 :
73609 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
73610 : // using values that overflow signed values of int.
73611 : size_t
73612 0 : SgLineDirectiveStatement::memoryUsage()
73613 : {
73614 : // This function is required because we need the class name as a type when we call sizeof
73615 : // There might be another way to implement this if we have a traversal that only called a
73616 : // representative object (one call for each type of Sage IIIIR node).
73617 0 : size_t memory = numberOfNodes() * sizeof(SgLineDirectiveStatement);
73618 :
73619 0 : return memory;
73620 : }
73621 :
73622 : /* #line 73623 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
73623 :
73624 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
73625 : void
73626 5342 : SgWarningDirectiveStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
73627 : {
73628 : // This function traverses the memory pool for only a specific IR node
73629 : // and calls the visit function of the input class execute a traversal
73630 : // similar to the style of the attribute based traversals within ROSE.
73631 : // This traversal will visit ALL nodes of the AST where as the other
73632 : // attribute based traversals visit only the embedded tree within the AST.
73633 :
73634 : // Initialize array to the address of the first element of the STL vector
73635 : // (which is guaranteed to be contiguous storage).
73636 : // SgWarningDirectiveStatement objectArray [] = *(Memory_Block_List.begin());
73637 5342 : if (SgWarningDirectiveStatement::pools.empty() == false)
73638 : {
73639 : // Generate an array of memory pools
73640 0 : SgWarningDirectiveStatement** objectArray = (SgWarningDirectiveStatement**) &(SgWarningDirectiveStatement::pools[0]);
73641 :
73642 : // Build a local variable for better performance
73643 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
73644 : #if 0
73645 : // Iterate over the memory pools
73646 : for (unsigned int i=0; i < SgWarningDirectiveStatement::pools.size(); i++)
73647 : {
73648 : // objectArray[i] is a single memory pool
73649 : for (int j=0; j < SgWarningDirectiveStatement::pool_size; j++)
73650 : {
73651 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
73652 : {
73653 : traversal.visit(&(objectArray[i][j]));
73654 : }
73655 : }
73656 : }
73657 : #else
73658 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
73659 : // compute the list first and then call the visit function on each list element.
73660 :
73661 : // printf ("Inside of SgWarningDirectiveStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
73662 :
73663 0 : std::vector<SgWarningDirectiveStatement*> nodeList;
73664 :
73665 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
73666 0 : for (unsigned int i=0; i < SgWarningDirectiveStatement::pools.size(); i++)
73667 : {
73668 : // objectArray[i] is a single memory pool
73669 0 : for (unsigned j=0; j < SgWarningDirectiveStatement::pool_size; j++)
73670 : {
73671 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
73672 : {
73673 0 : nodeList.push_back(&(objectArray[i][j]));
73674 : }
73675 : }
73676 : }
73677 :
73678 : // Iterate over the saved list
73679 0 : size_t nodeListSize = nodeList.size();
73680 0 : for (size_t i=0; i < nodeListSize; i++)
73681 : {
73682 0 : ROSE_ASSERT(nodeList[i] != NULL);
73683 : #if 0
73684 : traversal.visit(nodeList[i]);
73685 : #else
73686 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
73687 : {
73688 0 : traversal.visit(nodeList[i]);
73689 : }
73690 : #endif
73691 : }
73692 : #endif
73693 : }
73694 :
73695 : // This should not be required since all previously static data members are
73696 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
73697 :
73698 5342 : }
73699 :
73700 :
73701 : void
73702 194 : SgWarningDirectiveStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
73703 : {
73704 : // This function traverses the memory pool for an IR node and
73705 : // calls the function to execute the visitor object.
73706 :
73707 : // Initialize array to the address of the first element of the STL vector
73708 : // (which is guarenteed to be contiguous storage).
73709 : // SgWarningDirectiveStatement objectArray [] = *(Memory_Block_List.begin());
73710 194 : if (SgWarningDirectiveStatement::pools.empty() == false)
73711 : {
73712 : // Generate an array of memory pools
73713 0 : SgWarningDirectiveStatement** objectArray = (SgWarningDirectiveStatement**) &(SgWarningDirectiveStatement::pools[0]);
73714 :
73715 : // Build a local variable for better performance
73716 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
73717 :
73718 : // Iterate over the memory pools
73719 0 : for (unsigned int i=0; i < SgWarningDirectiveStatement::pools.size(); i++)
73720 : {
73721 : // objectArray[i] is a single memory pool
73722 0 : for (unsigned j=0; j < SgWarningDirectiveStatement::pool_size; j++)
73723 : {
73724 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
73725 : {
73726 : // printf ("Found a valid SgWarningDirectiveStatement object in the memory pool %d at position %d \n",i,j);
73727 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
73728 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
73729 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
73730 : }
73731 : else
73732 : {
73733 : // printf ("Found a INVALID SgWarningDirectiveStatement object in the memory pool \n");
73734 : }
73735 : }
73736 : }
73737 : }
73738 :
73739 : // This should not be required since all previously static data members are
73740 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
73741 :
73742 194 : }
73743 :
73744 : void
73745 0 : SgWarningDirectiveStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
73746 : {
73747 : // This function visits only a single IR node of the memory pool.
73748 : // it is typically called once for each type of IR node within
73749 : // the automatically generated function: traverseRepresentativeNodes().
73750 :
73751 : // Initialize array to the address of the first element of the STL vector
73752 : // (which is guarenteed to be contiguous storage).
73753 : // SgWarningDirectiveStatement objectArray [] = *(Memory_Block_List.begin());
73754 0 : if (SgWarningDirectiveStatement::pools.empty() == false)
73755 : {
73756 : // Generate an array of memory pools
73757 0 : SgWarningDirectiveStatement** objectArray = (SgWarningDirectiveStatement**) &(SgWarningDirectiveStatement::pools[0]);
73758 :
73759 : // Build a local variable for better performance
73760 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
73761 :
73762 : // Iterate over the memory pools
73763 0 : bool done = false;
73764 0 : unsigned i=0;
73765 :
73766 : // find the first valid IR node, call visit function, and then leave
73767 0 : while ( done == false && i < SgWarningDirectiveStatement::pools.size() )
73768 : {
73769 : // objectArray[i] is a single memory pool
73770 : unsigned j=0;
73771 0 : while (done == false && j < SgWarningDirectiveStatement::pool_size)
73772 : {
73773 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
73774 : {
73775 0 : traversal.visit(&(objectArray[i][j]));
73776 0 : done = true;
73777 : }
73778 0 : j++;
73779 : }
73780 0 : i++;
73781 : }
73782 :
73783 : #if 0
73784 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
73785 : if (done == false)
73786 : {
73787 : printf ("No representative for SgWarningDirectiveStatement found in memory pools \n");
73788 : }
73789 : #endif
73790 : }
73791 0 : }
73792 :
73793 :
73794 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
73795 : // using values that overflow signed values of int.
73796 : size_t
73797 4 : SgWarningDirectiveStatement::numberOfNodes()
73798 : {
73799 : // This function traverses the memory pool for an IR node and
73800 : // counts the number of IR nodes of a particular Sage III IR
73801 : // nodes type.
73802 :
73803 4 : size_t count = 0;
73804 4 : if (SgWarningDirectiveStatement::pools.empty() == false)
73805 : {
73806 : // Generate an array of memory pools (this is actually a STL vector,
73807 : // but it is contiguious, so OK to treat this way).
73808 0 : SgWarningDirectiveStatement** objectArray = (SgWarningDirectiveStatement**) &(SgWarningDirectiveStatement::pools[0]);
73809 :
73810 : // Build a local variable for better performance (make it a loop invariant variable).
73811 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
73812 :
73813 : // Iterate over all of the memory pools for this IR node.
73814 0 : for (unsigned int i=0; i < SgWarningDirectiveStatement::pools.size(); i++)
73815 : {
73816 : // objectArray[i] is a single memory pool, iterate over all the
73817 : // IR nodes and only count those that are valid IR nodes used in
73818 : // the AST (i.e. allocated IR nodes).
73819 0 : for (unsigned j=0; j < SgWarningDirectiveStatement::pool_size; j++)
73820 : {
73821 : // This is indexing the STL vector of C/C++ style arrays as a doubly
73822 : // indexed array access. It is OK since we have leveraged the semantics
73823 : // of STL vector memory as contigous and cast the memory as an array
73824 : // of arrays to use the 2D array indexing. Hope this is not confusing,
73825 : // but it s very fast as an implementation.
73826 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
73827 : {
73828 0 : count++;
73829 : }
73830 : }
73831 : }
73832 : }
73833 :
73834 :
73835 :
73836 4 : return count;
73837 : }
73838 :
73839 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
73840 : // using values that overflow signed values of int.
73841 : size_t
73842 0 : SgWarningDirectiveStatement::memoryUsage()
73843 : {
73844 : // This function is required because we need the class name as a type when we call sizeof
73845 : // There might be another way to implement this if we have a traversal that only called a
73846 : // representative object (one call for each type of Sage IIIIR node).
73847 0 : size_t memory = numberOfNodes() * sizeof(SgWarningDirectiveStatement);
73848 :
73849 0 : return memory;
73850 : }
73851 :
73852 : /* #line 73853 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
73853 :
73854 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
73855 : void
73856 5342 : SgErrorDirectiveStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
73857 : {
73858 : // This function traverses the memory pool for only a specific IR node
73859 : // and calls the visit function of the input class execute a traversal
73860 : // similar to the style of the attribute based traversals within ROSE.
73861 : // This traversal will visit ALL nodes of the AST where as the other
73862 : // attribute based traversals visit only the embedded tree within the AST.
73863 :
73864 : // Initialize array to the address of the first element of the STL vector
73865 : // (which is guaranteed to be contiguous storage).
73866 : // SgErrorDirectiveStatement objectArray [] = *(Memory_Block_List.begin());
73867 5342 : if (SgErrorDirectiveStatement::pools.empty() == false)
73868 : {
73869 : // Generate an array of memory pools
73870 0 : SgErrorDirectiveStatement** objectArray = (SgErrorDirectiveStatement**) &(SgErrorDirectiveStatement::pools[0]);
73871 :
73872 : // Build a local variable for better performance
73873 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
73874 : #if 0
73875 : // Iterate over the memory pools
73876 : for (unsigned int i=0; i < SgErrorDirectiveStatement::pools.size(); i++)
73877 : {
73878 : // objectArray[i] is a single memory pool
73879 : for (int j=0; j < SgErrorDirectiveStatement::pool_size; j++)
73880 : {
73881 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
73882 : {
73883 : traversal.visit(&(objectArray[i][j]));
73884 : }
73885 : }
73886 : }
73887 : #else
73888 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
73889 : // compute the list first and then call the visit function on each list element.
73890 :
73891 : // printf ("Inside of SgErrorDirectiveStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
73892 :
73893 0 : std::vector<SgErrorDirectiveStatement*> nodeList;
73894 :
73895 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
73896 0 : for (unsigned int i=0; i < SgErrorDirectiveStatement::pools.size(); i++)
73897 : {
73898 : // objectArray[i] is a single memory pool
73899 0 : for (unsigned j=0; j < SgErrorDirectiveStatement::pool_size; j++)
73900 : {
73901 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
73902 : {
73903 0 : nodeList.push_back(&(objectArray[i][j]));
73904 : }
73905 : }
73906 : }
73907 :
73908 : // Iterate over the saved list
73909 0 : size_t nodeListSize = nodeList.size();
73910 0 : for (size_t i=0; i < nodeListSize; i++)
73911 : {
73912 0 : ROSE_ASSERT(nodeList[i] != NULL);
73913 : #if 0
73914 : traversal.visit(nodeList[i]);
73915 : #else
73916 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
73917 : {
73918 0 : traversal.visit(nodeList[i]);
73919 : }
73920 : #endif
73921 : }
73922 : #endif
73923 : }
73924 :
73925 : // This should not be required since all previously static data members are
73926 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
73927 :
73928 5342 : }
73929 :
73930 :
73931 : void
73932 194 : SgErrorDirectiveStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
73933 : {
73934 : // This function traverses the memory pool for an IR node and
73935 : // calls the function to execute the visitor object.
73936 :
73937 : // Initialize array to the address of the first element of the STL vector
73938 : // (which is guarenteed to be contiguous storage).
73939 : // SgErrorDirectiveStatement objectArray [] = *(Memory_Block_List.begin());
73940 194 : if (SgErrorDirectiveStatement::pools.empty() == false)
73941 : {
73942 : // Generate an array of memory pools
73943 0 : SgErrorDirectiveStatement** objectArray = (SgErrorDirectiveStatement**) &(SgErrorDirectiveStatement::pools[0]);
73944 :
73945 : // Build a local variable for better performance
73946 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
73947 :
73948 : // Iterate over the memory pools
73949 0 : for (unsigned int i=0; i < SgErrorDirectiveStatement::pools.size(); i++)
73950 : {
73951 : // objectArray[i] is a single memory pool
73952 0 : for (unsigned j=0; j < SgErrorDirectiveStatement::pool_size; j++)
73953 : {
73954 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
73955 : {
73956 : // printf ("Found a valid SgErrorDirectiveStatement object in the memory pool %d at position %d \n",i,j);
73957 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
73958 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
73959 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
73960 : }
73961 : else
73962 : {
73963 : // printf ("Found a INVALID SgErrorDirectiveStatement object in the memory pool \n");
73964 : }
73965 : }
73966 : }
73967 : }
73968 :
73969 : // This should not be required since all previously static data members are
73970 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
73971 :
73972 194 : }
73973 :
73974 : void
73975 0 : SgErrorDirectiveStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
73976 : {
73977 : // This function visits only a single IR node of the memory pool.
73978 : // it is typically called once for each type of IR node within
73979 : // the automatically generated function: traverseRepresentativeNodes().
73980 :
73981 : // Initialize array to the address of the first element of the STL vector
73982 : // (which is guarenteed to be contiguous storage).
73983 : // SgErrorDirectiveStatement objectArray [] = *(Memory_Block_List.begin());
73984 0 : if (SgErrorDirectiveStatement::pools.empty() == false)
73985 : {
73986 : // Generate an array of memory pools
73987 0 : SgErrorDirectiveStatement** objectArray = (SgErrorDirectiveStatement**) &(SgErrorDirectiveStatement::pools[0]);
73988 :
73989 : // Build a local variable for better performance
73990 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
73991 :
73992 : // Iterate over the memory pools
73993 0 : bool done = false;
73994 0 : unsigned i=0;
73995 :
73996 : // find the first valid IR node, call visit function, and then leave
73997 0 : while ( done == false && i < SgErrorDirectiveStatement::pools.size() )
73998 : {
73999 : // objectArray[i] is a single memory pool
74000 : unsigned j=0;
74001 0 : while (done == false && j < SgErrorDirectiveStatement::pool_size)
74002 : {
74003 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
74004 : {
74005 0 : traversal.visit(&(objectArray[i][j]));
74006 0 : done = true;
74007 : }
74008 0 : j++;
74009 : }
74010 0 : i++;
74011 : }
74012 :
74013 : #if 0
74014 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
74015 : if (done == false)
74016 : {
74017 : printf ("No representative for SgErrorDirectiveStatement found in memory pools \n");
74018 : }
74019 : #endif
74020 : }
74021 0 : }
74022 :
74023 :
74024 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
74025 : // using values that overflow signed values of int.
74026 : size_t
74027 4 : SgErrorDirectiveStatement::numberOfNodes()
74028 : {
74029 : // This function traverses the memory pool for an IR node and
74030 : // counts the number of IR nodes of a particular Sage III IR
74031 : // nodes type.
74032 :
74033 4 : size_t count = 0;
74034 4 : if (SgErrorDirectiveStatement::pools.empty() == false)
74035 : {
74036 : // Generate an array of memory pools (this is actually a STL vector,
74037 : // but it is contiguious, so OK to treat this way).
74038 0 : SgErrorDirectiveStatement** objectArray = (SgErrorDirectiveStatement**) &(SgErrorDirectiveStatement::pools[0]);
74039 :
74040 : // Build a local variable for better performance (make it a loop invariant variable).
74041 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
74042 :
74043 : // Iterate over all of the memory pools for this IR node.
74044 0 : for (unsigned int i=0; i < SgErrorDirectiveStatement::pools.size(); i++)
74045 : {
74046 : // objectArray[i] is a single memory pool, iterate over all the
74047 : // IR nodes and only count those that are valid IR nodes used in
74048 : // the AST (i.e. allocated IR nodes).
74049 0 : for (unsigned j=0; j < SgErrorDirectiveStatement::pool_size; j++)
74050 : {
74051 : // This is indexing the STL vector of C/C++ style arrays as a doubly
74052 : // indexed array access. It is OK since we have leveraged the semantics
74053 : // of STL vector memory as contigous and cast the memory as an array
74054 : // of arrays to use the 2D array indexing. Hope this is not confusing,
74055 : // but it s very fast as an implementation.
74056 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
74057 : {
74058 0 : count++;
74059 : }
74060 : }
74061 : }
74062 : }
74063 :
74064 :
74065 :
74066 4 : return count;
74067 : }
74068 :
74069 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
74070 : // using values that overflow signed values of int.
74071 : size_t
74072 0 : SgErrorDirectiveStatement::memoryUsage()
74073 : {
74074 : // This function is required because we need the class name as a type when we call sizeof
74075 : // There might be another way to implement this if we have a traversal that only called a
74076 : // representative object (one call for each type of Sage IIIIR node).
74077 0 : size_t memory = numberOfNodes() * sizeof(SgErrorDirectiveStatement);
74078 :
74079 0 : return memory;
74080 : }
74081 :
74082 : /* #line 74083 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
74083 :
74084 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
74085 : void
74086 5342 : SgEmptyDirectiveStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
74087 : {
74088 : // This function traverses the memory pool for only a specific IR node
74089 : // and calls the visit function of the input class execute a traversal
74090 : // similar to the style of the attribute based traversals within ROSE.
74091 : // This traversal will visit ALL nodes of the AST where as the other
74092 : // attribute based traversals visit only the embedded tree within the AST.
74093 :
74094 : // Initialize array to the address of the first element of the STL vector
74095 : // (which is guaranteed to be contiguous storage).
74096 : // SgEmptyDirectiveStatement objectArray [] = *(Memory_Block_List.begin());
74097 5342 : if (SgEmptyDirectiveStatement::pools.empty() == false)
74098 : {
74099 : // Generate an array of memory pools
74100 0 : SgEmptyDirectiveStatement** objectArray = (SgEmptyDirectiveStatement**) &(SgEmptyDirectiveStatement::pools[0]);
74101 :
74102 : // Build a local variable for better performance
74103 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
74104 : #if 0
74105 : // Iterate over the memory pools
74106 : for (unsigned int i=0; i < SgEmptyDirectiveStatement::pools.size(); i++)
74107 : {
74108 : // objectArray[i] is a single memory pool
74109 : for (int j=0; j < SgEmptyDirectiveStatement::pool_size; j++)
74110 : {
74111 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
74112 : {
74113 : traversal.visit(&(objectArray[i][j]));
74114 : }
74115 : }
74116 : }
74117 : #else
74118 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
74119 : // compute the list first and then call the visit function on each list element.
74120 :
74121 : // printf ("Inside of SgEmptyDirectiveStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
74122 :
74123 0 : std::vector<SgEmptyDirectiveStatement*> nodeList;
74124 :
74125 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
74126 0 : for (unsigned int i=0; i < SgEmptyDirectiveStatement::pools.size(); i++)
74127 : {
74128 : // objectArray[i] is a single memory pool
74129 0 : for (unsigned j=0; j < SgEmptyDirectiveStatement::pool_size; j++)
74130 : {
74131 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
74132 : {
74133 0 : nodeList.push_back(&(objectArray[i][j]));
74134 : }
74135 : }
74136 : }
74137 :
74138 : // Iterate over the saved list
74139 0 : size_t nodeListSize = nodeList.size();
74140 0 : for (size_t i=0; i < nodeListSize; i++)
74141 : {
74142 0 : ROSE_ASSERT(nodeList[i] != NULL);
74143 : #if 0
74144 : traversal.visit(nodeList[i]);
74145 : #else
74146 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
74147 : {
74148 0 : traversal.visit(nodeList[i]);
74149 : }
74150 : #endif
74151 : }
74152 : #endif
74153 : }
74154 :
74155 : // This should not be required since all previously static data members are
74156 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
74157 :
74158 5342 : }
74159 :
74160 :
74161 : void
74162 194 : SgEmptyDirectiveStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
74163 : {
74164 : // This function traverses the memory pool for an IR node and
74165 : // calls the function to execute the visitor object.
74166 :
74167 : // Initialize array to the address of the first element of the STL vector
74168 : // (which is guarenteed to be contiguous storage).
74169 : // SgEmptyDirectiveStatement objectArray [] = *(Memory_Block_List.begin());
74170 194 : if (SgEmptyDirectiveStatement::pools.empty() == false)
74171 : {
74172 : // Generate an array of memory pools
74173 0 : SgEmptyDirectiveStatement** objectArray = (SgEmptyDirectiveStatement**) &(SgEmptyDirectiveStatement::pools[0]);
74174 :
74175 : // Build a local variable for better performance
74176 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
74177 :
74178 : // Iterate over the memory pools
74179 0 : for (unsigned int i=0; i < SgEmptyDirectiveStatement::pools.size(); i++)
74180 : {
74181 : // objectArray[i] is a single memory pool
74182 0 : for (unsigned j=0; j < SgEmptyDirectiveStatement::pool_size; j++)
74183 : {
74184 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
74185 : {
74186 : // printf ("Found a valid SgEmptyDirectiveStatement object in the memory pool %d at position %d \n",i,j);
74187 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
74188 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
74189 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
74190 : }
74191 : else
74192 : {
74193 : // printf ("Found a INVALID SgEmptyDirectiveStatement object in the memory pool \n");
74194 : }
74195 : }
74196 : }
74197 : }
74198 :
74199 : // This should not be required since all previously static data members are
74200 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
74201 :
74202 194 : }
74203 :
74204 : void
74205 0 : SgEmptyDirectiveStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
74206 : {
74207 : // This function visits only a single IR node of the memory pool.
74208 : // it is typically called once for each type of IR node within
74209 : // the automatically generated function: traverseRepresentativeNodes().
74210 :
74211 : // Initialize array to the address of the first element of the STL vector
74212 : // (which is guarenteed to be contiguous storage).
74213 : // SgEmptyDirectiveStatement objectArray [] = *(Memory_Block_List.begin());
74214 0 : if (SgEmptyDirectiveStatement::pools.empty() == false)
74215 : {
74216 : // Generate an array of memory pools
74217 0 : SgEmptyDirectiveStatement** objectArray = (SgEmptyDirectiveStatement**) &(SgEmptyDirectiveStatement::pools[0]);
74218 :
74219 : // Build a local variable for better performance
74220 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
74221 :
74222 : // Iterate over the memory pools
74223 0 : bool done = false;
74224 0 : unsigned i=0;
74225 :
74226 : // find the first valid IR node, call visit function, and then leave
74227 0 : while ( done == false && i < SgEmptyDirectiveStatement::pools.size() )
74228 : {
74229 : // objectArray[i] is a single memory pool
74230 : unsigned j=0;
74231 0 : while (done == false && j < SgEmptyDirectiveStatement::pool_size)
74232 : {
74233 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
74234 : {
74235 0 : traversal.visit(&(objectArray[i][j]));
74236 0 : done = true;
74237 : }
74238 0 : j++;
74239 : }
74240 0 : i++;
74241 : }
74242 :
74243 : #if 0
74244 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
74245 : if (done == false)
74246 : {
74247 : printf ("No representative for SgEmptyDirectiveStatement found in memory pools \n");
74248 : }
74249 : #endif
74250 : }
74251 0 : }
74252 :
74253 :
74254 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
74255 : // using values that overflow signed values of int.
74256 : size_t
74257 4 : SgEmptyDirectiveStatement::numberOfNodes()
74258 : {
74259 : // This function traverses the memory pool for an IR node and
74260 : // counts the number of IR nodes of a particular Sage III IR
74261 : // nodes type.
74262 :
74263 4 : size_t count = 0;
74264 4 : if (SgEmptyDirectiveStatement::pools.empty() == false)
74265 : {
74266 : // Generate an array of memory pools (this is actually a STL vector,
74267 : // but it is contiguious, so OK to treat this way).
74268 0 : SgEmptyDirectiveStatement** objectArray = (SgEmptyDirectiveStatement**) &(SgEmptyDirectiveStatement::pools[0]);
74269 :
74270 : // Build a local variable for better performance (make it a loop invariant variable).
74271 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
74272 :
74273 : // Iterate over all of the memory pools for this IR node.
74274 0 : for (unsigned int i=0; i < SgEmptyDirectiveStatement::pools.size(); i++)
74275 : {
74276 : // objectArray[i] is a single memory pool, iterate over all the
74277 : // IR nodes and only count those that are valid IR nodes used in
74278 : // the AST (i.e. allocated IR nodes).
74279 0 : for (unsigned j=0; j < SgEmptyDirectiveStatement::pool_size; j++)
74280 : {
74281 : // This is indexing the STL vector of C/C++ style arrays as a doubly
74282 : // indexed array access. It is OK since we have leveraged the semantics
74283 : // of STL vector memory as contigous and cast the memory as an array
74284 : // of arrays to use the 2D array indexing. Hope this is not confusing,
74285 : // but it s very fast as an implementation.
74286 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
74287 : {
74288 0 : count++;
74289 : }
74290 : }
74291 : }
74292 : }
74293 :
74294 :
74295 :
74296 4 : return count;
74297 : }
74298 :
74299 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
74300 : // using values that overflow signed values of int.
74301 : size_t
74302 0 : SgEmptyDirectiveStatement::memoryUsage()
74303 : {
74304 : // This function is required because we need the class name as a type when we call sizeof
74305 : // There might be another way to implement this if we have a traversal that only called a
74306 : // representative object (one call for each type of Sage IIIIR node).
74307 0 : size_t memory = numberOfNodes() * sizeof(SgEmptyDirectiveStatement);
74308 :
74309 0 : return memory;
74310 : }
74311 :
74312 : /* #line 74313 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
74313 :
74314 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
74315 : void
74316 5342 : SgIncludeNextDirectiveStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
74317 : {
74318 : // This function traverses the memory pool for only a specific IR node
74319 : // and calls the visit function of the input class execute a traversal
74320 : // similar to the style of the attribute based traversals within ROSE.
74321 : // This traversal will visit ALL nodes of the AST where as the other
74322 : // attribute based traversals visit only the embedded tree within the AST.
74323 :
74324 : // Initialize array to the address of the first element of the STL vector
74325 : // (which is guaranteed to be contiguous storage).
74326 : // SgIncludeNextDirectiveStatement objectArray [] = *(Memory_Block_List.begin());
74327 5342 : if (SgIncludeNextDirectiveStatement::pools.empty() == false)
74328 : {
74329 : // Generate an array of memory pools
74330 0 : SgIncludeNextDirectiveStatement** objectArray = (SgIncludeNextDirectiveStatement**) &(SgIncludeNextDirectiveStatement::pools[0]);
74331 :
74332 : // Build a local variable for better performance
74333 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
74334 : #if 0
74335 : // Iterate over the memory pools
74336 : for (unsigned int i=0; i < SgIncludeNextDirectiveStatement::pools.size(); i++)
74337 : {
74338 : // objectArray[i] is a single memory pool
74339 : for (int j=0; j < SgIncludeNextDirectiveStatement::pool_size; j++)
74340 : {
74341 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
74342 : {
74343 : traversal.visit(&(objectArray[i][j]));
74344 : }
74345 : }
74346 : }
74347 : #else
74348 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
74349 : // compute the list first and then call the visit function on each list element.
74350 :
74351 : // printf ("Inside of SgIncludeNextDirectiveStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
74352 :
74353 0 : std::vector<SgIncludeNextDirectiveStatement*> nodeList;
74354 :
74355 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
74356 0 : for (unsigned int i=0; i < SgIncludeNextDirectiveStatement::pools.size(); i++)
74357 : {
74358 : // objectArray[i] is a single memory pool
74359 0 : for (unsigned j=0; j < SgIncludeNextDirectiveStatement::pool_size; j++)
74360 : {
74361 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
74362 : {
74363 0 : nodeList.push_back(&(objectArray[i][j]));
74364 : }
74365 : }
74366 : }
74367 :
74368 : // Iterate over the saved list
74369 0 : size_t nodeListSize = nodeList.size();
74370 0 : for (size_t i=0; i < nodeListSize; i++)
74371 : {
74372 0 : ROSE_ASSERT(nodeList[i] != NULL);
74373 : #if 0
74374 : traversal.visit(nodeList[i]);
74375 : #else
74376 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
74377 : {
74378 0 : traversal.visit(nodeList[i]);
74379 : }
74380 : #endif
74381 : }
74382 : #endif
74383 : }
74384 :
74385 : // This should not be required since all previously static data members are
74386 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
74387 :
74388 5342 : }
74389 :
74390 :
74391 : void
74392 194 : SgIncludeNextDirectiveStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
74393 : {
74394 : // This function traverses the memory pool for an IR node and
74395 : // calls the function to execute the visitor object.
74396 :
74397 : // Initialize array to the address of the first element of the STL vector
74398 : // (which is guarenteed to be contiguous storage).
74399 : // SgIncludeNextDirectiveStatement objectArray [] = *(Memory_Block_List.begin());
74400 194 : if (SgIncludeNextDirectiveStatement::pools.empty() == false)
74401 : {
74402 : // Generate an array of memory pools
74403 0 : SgIncludeNextDirectiveStatement** objectArray = (SgIncludeNextDirectiveStatement**) &(SgIncludeNextDirectiveStatement::pools[0]);
74404 :
74405 : // Build a local variable for better performance
74406 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
74407 :
74408 : // Iterate over the memory pools
74409 0 : for (unsigned int i=0; i < SgIncludeNextDirectiveStatement::pools.size(); i++)
74410 : {
74411 : // objectArray[i] is a single memory pool
74412 0 : for (unsigned j=0; j < SgIncludeNextDirectiveStatement::pool_size; j++)
74413 : {
74414 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
74415 : {
74416 : // printf ("Found a valid SgIncludeNextDirectiveStatement object in the memory pool %d at position %d \n",i,j);
74417 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
74418 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
74419 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
74420 : }
74421 : else
74422 : {
74423 : // printf ("Found a INVALID SgIncludeNextDirectiveStatement object in the memory pool \n");
74424 : }
74425 : }
74426 : }
74427 : }
74428 :
74429 : // This should not be required since all previously static data members are
74430 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
74431 :
74432 194 : }
74433 :
74434 : void
74435 0 : SgIncludeNextDirectiveStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
74436 : {
74437 : // This function visits only a single IR node of the memory pool.
74438 : // it is typically called once for each type of IR node within
74439 : // the automatically generated function: traverseRepresentativeNodes().
74440 :
74441 : // Initialize array to the address of the first element of the STL vector
74442 : // (which is guarenteed to be contiguous storage).
74443 : // SgIncludeNextDirectiveStatement objectArray [] = *(Memory_Block_List.begin());
74444 0 : if (SgIncludeNextDirectiveStatement::pools.empty() == false)
74445 : {
74446 : // Generate an array of memory pools
74447 0 : SgIncludeNextDirectiveStatement** objectArray = (SgIncludeNextDirectiveStatement**) &(SgIncludeNextDirectiveStatement::pools[0]);
74448 :
74449 : // Build a local variable for better performance
74450 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
74451 :
74452 : // Iterate over the memory pools
74453 0 : bool done = false;
74454 0 : unsigned i=0;
74455 :
74456 : // find the first valid IR node, call visit function, and then leave
74457 0 : while ( done == false && i < SgIncludeNextDirectiveStatement::pools.size() )
74458 : {
74459 : // objectArray[i] is a single memory pool
74460 : unsigned j=0;
74461 0 : while (done == false && j < SgIncludeNextDirectiveStatement::pool_size)
74462 : {
74463 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
74464 : {
74465 0 : traversal.visit(&(objectArray[i][j]));
74466 0 : done = true;
74467 : }
74468 0 : j++;
74469 : }
74470 0 : i++;
74471 : }
74472 :
74473 : #if 0
74474 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
74475 : if (done == false)
74476 : {
74477 : printf ("No representative for SgIncludeNextDirectiveStatement found in memory pools \n");
74478 : }
74479 : #endif
74480 : }
74481 0 : }
74482 :
74483 :
74484 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
74485 : // using values that overflow signed values of int.
74486 : size_t
74487 4 : SgIncludeNextDirectiveStatement::numberOfNodes()
74488 : {
74489 : // This function traverses the memory pool for an IR node and
74490 : // counts the number of IR nodes of a particular Sage III IR
74491 : // nodes type.
74492 :
74493 4 : size_t count = 0;
74494 4 : if (SgIncludeNextDirectiveStatement::pools.empty() == false)
74495 : {
74496 : // Generate an array of memory pools (this is actually a STL vector,
74497 : // but it is contiguious, so OK to treat this way).
74498 0 : SgIncludeNextDirectiveStatement** objectArray = (SgIncludeNextDirectiveStatement**) &(SgIncludeNextDirectiveStatement::pools[0]);
74499 :
74500 : // Build a local variable for better performance (make it a loop invariant variable).
74501 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
74502 :
74503 : // Iterate over all of the memory pools for this IR node.
74504 0 : for (unsigned int i=0; i < SgIncludeNextDirectiveStatement::pools.size(); i++)
74505 : {
74506 : // objectArray[i] is a single memory pool, iterate over all the
74507 : // IR nodes and only count those that are valid IR nodes used in
74508 : // the AST (i.e. allocated IR nodes).
74509 0 : for (unsigned j=0; j < SgIncludeNextDirectiveStatement::pool_size; j++)
74510 : {
74511 : // This is indexing the STL vector of C/C++ style arrays as a doubly
74512 : // indexed array access. It is OK since we have leveraged the semantics
74513 : // of STL vector memory as contigous and cast the memory as an array
74514 : // of arrays to use the 2D array indexing. Hope this is not confusing,
74515 : // but it s very fast as an implementation.
74516 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
74517 : {
74518 0 : count++;
74519 : }
74520 : }
74521 : }
74522 : }
74523 :
74524 :
74525 :
74526 4 : return count;
74527 : }
74528 :
74529 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
74530 : // using values that overflow signed values of int.
74531 : size_t
74532 0 : SgIncludeNextDirectiveStatement::memoryUsage()
74533 : {
74534 : // This function is required because we need the class name as a type when we call sizeof
74535 : // There might be another way to implement this if we have a traversal that only called a
74536 : // representative object (one call for each type of Sage IIIIR node).
74537 0 : size_t memory = numberOfNodes() * sizeof(SgIncludeNextDirectiveStatement);
74538 :
74539 0 : return memory;
74540 : }
74541 :
74542 : /* #line 74543 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
74543 :
74544 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
74545 : void
74546 5342 : SgIdentDirectiveStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
74547 : {
74548 : // This function traverses the memory pool for only a specific IR node
74549 : // and calls the visit function of the input class execute a traversal
74550 : // similar to the style of the attribute based traversals within ROSE.
74551 : // This traversal will visit ALL nodes of the AST where as the other
74552 : // attribute based traversals visit only the embedded tree within the AST.
74553 :
74554 : // Initialize array to the address of the first element of the STL vector
74555 : // (which is guaranteed to be contiguous storage).
74556 : // SgIdentDirectiveStatement objectArray [] = *(Memory_Block_List.begin());
74557 5342 : if (SgIdentDirectiveStatement::pools.empty() == false)
74558 : {
74559 : // Generate an array of memory pools
74560 0 : SgIdentDirectiveStatement** objectArray = (SgIdentDirectiveStatement**) &(SgIdentDirectiveStatement::pools[0]);
74561 :
74562 : // Build a local variable for better performance
74563 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
74564 : #if 0
74565 : // Iterate over the memory pools
74566 : for (unsigned int i=0; i < SgIdentDirectiveStatement::pools.size(); i++)
74567 : {
74568 : // objectArray[i] is a single memory pool
74569 : for (int j=0; j < SgIdentDirectiveStatement::pool_size; j++)
74570 : {
74571 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
74572 : {
74573 : traversal.visit(&(objectArray[i][j]));
74574 : }
74575 : }
74576 : }
74577 : #else
74578 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
74579 : // compute the list first and then call the visit function on each list element.
74580 :
74581 : // printf ("Inside of SgIdentDirectiveStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
74582 :
74583 0 : std::vector<SgIdentDirectiveStatement*> nodeList;
74584 :
74585 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
74586 0 : for (unsigned int i=0; i < SgIdentDirectiveStatement::pools.size(); i++)
74587 : {
74588 : // objectArray[i] is a single memory pool
74589 0 : for (unsigned j=0; j < SgIdentDirectiveStatement::pool_size; j++)
74590 : {
74591 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
74592 : {
74593 0 : nodeList.push_back(&(objectArray[i][j]));
74594 : }
74595 : }
74596 : }
74597 :
74598 : // Iterate over the saved list
74599 0 : size_t nodeListSize = nodeList.size();
74600 0 : for (size_t i=0; i < nodeListSize; i++)
74601 : {
74602 0 : ROSE_ASSERT(nodeList[i] != NULL);
74603 : #if 0
74604 : traversal.visit(nodeList[i]);
74605 : #else
74606 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
74607 : {
74608 0 : traversal.visit(nodeList[i]);
74609 : }
74610 : #endif
74611 : }
74612 : #endif
74613 : }
74614 :
74615 : // This should not be required since all previously static data members are
74616 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
74617 :
74618 5342 : }
74619 :
74620 :
74621 : void
74622 194 : SgIdentDirectiveStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
74623 : {
74624 : // This function traverses the memory pool for an IR node and
74625 : // calls the function to execute the visitor object.
74626 :
74627 : // Initialize array to the address of the first element of the STL vector
74628 : // (which is guarenteed to be contiguous storage).
74629 : // SgIdentDirectiveStatement objectArray [] = *(Memory_Block_List.begin());
74630 194 : if (SgIdentDirectiveStatement::pools.empty() == false)
74631 : {
74632 : // Generate an array of memory pools
74633 0 : SgIdentDirectiveStatement** objectArray = (SgIdentDirectiveStatement**) &(SgIdentDirectiveStatement::pools[0]);
74634 :
74635 : // Build a local variable for better performance
74636 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
74637 :
74638 : // Iterate over the memory pools
74639 0 : for (unsigned int i=0; i < SgIdentDirectiveStatement::pools.size(); i++)
74640 : {
74641 : // objectArray[i] is a single memory pool
74642 0 : for (unsigned j=0; j < SgIdentDirectiveStatement::pool_size; j++)
74643 : {
74644 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
74645 : {
74646 : // printf ("Found a valid SgIdentDirectiveStatement object in the memory pool %d at position %d \n",i,j);
74647 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
74648 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
74649 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
74650 : }
74651 : else
74652 : {
74653 : // printf ("Found a INVALID SgIdentDirectiveStatement object in the memory pool \n");
74654 : }
74655 : }
74656 : }
74657 : }
74658 :
74659 : // This should not be required since all previously static data members are
74660 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
74661 :
74662 194 : }
74663 :
74664 : void
74665 0 : SgIdentDirectiveStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
74666 : {
74667 : // This function visits only a single IR node of the memory pool.
74668 : // it is typically called once for each type of IR node within
74669 : // the automatically generated function: traverseRepresentativeNodes().
74670 :
74671 : // Initialize array to the address of the first element of the STL vector
74672 : // (which is guarenteed to be contiguous storage).
74673 : // SgIdentDirectiveStatement objectArray [] = *(Memory_Block_List.begin());
74674 0 : if (SgIdentDirectiveStatement::pools.empty() == false)
74675 : {
74676 : // Generate an array of memory pools
74677 0 : SgIdentDirectiveStatement** objectArray = (SgIdentDirectiveStatement**) &(SgIdentDirectiveStatement::pools[0]);
74678 :
74679 : // Build a local variable for better performance
74680 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
74681 :
74682 : // Iterate over the memory pools
74683 0 : bool done = false;
74684 0 : unsigned i=0;
74685 :
74686 : // find the first valid IR node, call visit function, and then leave
74687 0 : while ( done == false && i < SgIdentDirectiveStatement::pools.size() )
74688 : {
74689 : // objectArray[i] is a single memory pool
74690 : unsigned j=0;
74691 0 : while (done == false && j < SgIdentDirectiveStatement::pool_size)
74692 : {
74693 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
74694 : {
74695 0 : traversal.visit(&(objectArray[i][j]));
74696 0 : done = true;
74697 : }
74698 0 : j++;
74699 : }
74700 0 : i++;
74701 : }
74702 :
74703 : #if 0
74704 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
74705 : if (done == false)
74706 : {
74707 : printf ("No representative for SgIdentDirectiveStatement found in memory pools \n");
74708 : }
74709 : #endif
74710 : }
74711 0 : }
74712 :
74713 :
74714 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
74715 : // using values that overflow signed values of int.
74716 : size_t
74717 4 : SgIdentDirectiveStatement::numberOfNodes()
74718 : {
74719 : // This function traverses the memory pool for an IR node and
74720 : // counts the number of IR nodes of a particular Sage III IR
74721 : // nodes type.
74722 :
74723 4 : size_t count = 0;
74724 4 : if (SgIdentDirectiveStatement::pools.empty() == false)
74725 : {
74726 : // Generate an array of memory pools (this is actually a STL vector,
74727 : // but it is contiguious, so OK to treat this way).
74728 0 : SgIdentDirectiveStatement** objectArray = (SgIdentDirectiveStatement**) &(SgIdentDirectiveStatement::pools[0]);
74729 :
74730 : // Build a local variable for better performance (make it a loop invariant variable).
74731 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
74732 :
74733 : // Iterate over all of the memory pools for this IR node.
74734 0 : for (unsigned int i=0; i < SgIdentDirectiveStatement::pools.size(); i++)
74735 : {
74736 : // objectArray[i] is a single memory pool, iterate over all the
74737 : // IR nodes and only count those that are valid IR nodes used in
74738 : // the AST (i.e. allocated IR nodes).
74739 0 : for (unsigned j=0; j < SgIdentDirectiveStatement::pool_size; j++)
74740 : {
74741 : // This is indexing the STL vector of C/C++ style arrays as a doubly
74742 : // indexed array access. It is OK since we have leveraged the semantics
74743 : // of STL vector memory as contigous and cast the memory as an array
74744 : // of arrays to use the 2D array indexing. Hope this is not confusing,
74745 : // but it s very fast as an implementation.
74746 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
74747 : {
74748 0 : count++;
74749 : }
74750 : }
74751 : }
74752 : }
74753 :
74754 :
74755 :
74756 4 : return count;
74757 : }
74758 :
74759 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
74760 : // using values that overflow signed values of int.
74761 : size_t
74762 0 : SgIdentDirectiveStatement::memoryUsage()
74763 : {
74764 : // This function is required because we need the class name as a type when we call sizeof
74765 : // There might be another way to implement this if we have a traversal that only called a
74766 : // representative object (one call for each type of Sage IIIIR node).
74767 0 : size_t memory = numberOfNodes() * sizeof(SgIdentDirectiveStatement);
74768 :
74769 0 : return memory;
74770 : }
74771 :
74772 : /* #line 74773 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
74773 :
74774 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
74775 : void
74776 5342 : SgLinemarkerDirectiveStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
74777 : {
74778 : // This function traverses the memory pool for only a specific IR node
74779 : // and calls the visit function of the input class execute a traversal
74780 : // similar to the style of the attribute based traversals within ROSE.
74781 : // This traversal will visit ALL nodes of the AST where as the other
74782 : // attribute based traversals visit only the embedded tree within the AST.
74783 :
74784 : // Initialize array to the address of the first element of the STL vector
74785 : // (which is guaranteed to be contiguous storage).
74786 : // SgLinemarkerDirectiveStatement objectArray [] = *(Memory_Block_List.begin());
74787 5342 : if (SgLinemarkerDirectiveStatement::pools.empty() == false)
74788 : {
74789 : // Generate an array of memory pools
74790 0 : SgLinemarkerDirectiveStatement** objectArray = (SgLinemarkerDirectiveStatement**) &(SgLinemarkerDirectiveStatement::pools[0]);
74791 :
74792 : // Build a local variable for better performance
74793 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
74794 : #if 0
74795 : // Iterate over the memory pools
74796 : for (unsigned int i=0; i < SgLinemarkerDirectiveStatement::pools.size(); i++)
74797 : {
74798 : // objectArray[i] is a single memory pool
74799 : for (int j=0; j < SgLinemarkerDirectiveStatement::pool_size; j++)
74800 : {
74801 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
74802 : {
74803 : traversal.visit(&(objectArray[i][j]));
74804 : }
74805 : }
74806 : }
74807 : #else
74808 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
74809 : // compute the list first and then call the visit function on each list element.
74810 :
74811 : // printf ("Inside of SgLinemarkerDirectiveStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
74812 :
74813 0 : std::vector<SgLinemarkerDirectiveStatement*> nodeList;
74814 :
74815 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
74816 0 : for (unsigned int i=0; i < SgLinemarkerDirectiveStatement::pools.size(); i++)
74817 : {
74818 : // objectArray[i] is a single memory pool
74819 0 : for (unsigned j=0; j < SgLinemarkerDirectiveStatement::pool_size; j++)
74820 : {
74821 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
74822 : {
74823 0 : nodeList.push_back(&(objectArray[i][j]));
74824 : }
74825 : }
74826 : }
74827 :
74828 : // Iterate over the saved list
74829 0 : size_t nodeListSize = nodeList.size();
74830 0 : for (size_t i=0; i < nodeListSize; i++)
74831 : {
74832 0 : ROSE_ASSERT(nodeList[i] != NULL);
74833 : #if 0
74834 : traversal.visit(nodeList[i]);
74835 : #else
74836 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
74837 : {
74838 0 : traversal.visit(nodeList[i]);
74839 : }
74840 : #endif
74841 : }
74842 : #endif
74843 : }
74844 :
74845 : // This should not be required since all previously static data members are
74846 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
74847 :
74848 5342 : }
74849 :
74850 :
74851 : void
74852 194 : SgLinemarkerDirectiveStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
74853 : {
74854 : // This function traverses the memory pool for an IR node and
74855 : // calls the function to execute the visitor object.
74856 :
74857 : // Initialize array to the address of the first element of the STL vector
74858 : // (which is guarenteed to be contiguous storage).
74859 : // SgLinemarkerDirectiveStatement objectArray [] = *(Memory_Block_List.begin());
74860 194 : if (SgLinemarkerDirectiveStatement::pools.empty() == false)
74861 : {
74862 : // Generate an array of memory pools
74863 0 : SgLinemarkerDirectiveStatement** objectArray = (SgLinemarkerDirectiveStatement**) &(SgLinemarkerDirectiveStatement::pools[0]);
74864 :
74865 : // Build a local variable for better performance
74866 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
74867 :
74868 : // Iterate over the memory pools
74869 0 : for (unsigned int i=0; i < SgLinemarkerDirectiveStatement::pools.size(); i++)
74870 : {
74871 : // objectArray[i] is a single memory pool
74872 0 : for (unsigned j=0; j < SgLinemarkerDirectiveStatement::pool_size; j++)
74873 : {
74874 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
74875 : {
74876 : // printf ("Found a valid SgLinemarkerDirectiveStatement object in the memory pool %d at position %d \n",i,j);
74877 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
74878 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
74879 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
74880 : }
74881 : else
74882 : {
74883 : // printf ("Found a INVALID SgLinemarkerDirectiveStatement object in the memory pool \n");
74884 : }
74885 : }
74886 : }
74887 : }
74888 :
74889 : // This should not be required since all previously static data members are
74890 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
74891 :
74892 194 : }
74893 :
74894 : void
74895 0 : SgLinemarkerDirectiveStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
74896 : {
74897 : // This function visits only a single IR node of the memory pool.
74898 : // it is typically called once for each type of IR node within
74899 : // the automatically generated function: traverseRepresentativeNodes().
74900 :
74901 : // Initialize array to the address of the first element of the STL vector
74902 : // (which is guarenteed to be contiguous storage).
74903 : // SgLinemarkerDirectiveStatement objectArray [] = *(Memory_Block_List.begin());
74904 0 : if (SgLinemarkerDirectiveStatement::pools.empty() == false)
74905 : {
74906 : // Generate an array of memory pools
74907 0 : SgLinemarkerDirectiveStatement** objectArray = (SgLinemarkerDirectiveStatement**) &(SgLinemarkerDirectiveStatement::pools[0]);
74908 :
74909 : // Build a local variable for better performance
74910 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
74911 :
74912 : // Iterate over the memory pools
74913 0 : bool done = false;
74914 0 : unsigned i=0;
74915 :
74916 : // find the first valid IR node, call visit function, and then leave
74917 0 : while ( done == false && i < SgLinemarkerDirectiveStatement::pools.size() )
74918 : {
74919 : // objectArray[i] is a single memory pool
74920 : unsigned j=0;
74921 0 : while (done == false && j < SgLinemarkerDirectiveStatement::pool_size)
74922 : {
74923 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
74924 : {
74925 0 : traversal.visit(&(objectArray[i][j]));
74926 0 : done = true;
74927 : }
74928 0 : j++;
74929 : }
74930 0 : i++;
74931 : }
74932 :
74933 : #if 0
74934 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
74935 : if (done == false)
74936 : {
74937 : printf ("No representative for SgLinemarkerDirectiveStatement found in memory pools \n");
74938 : }
74939 : #endif
74940 : }
74941 0 : }
74942 :
74943 :
74944 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
74945 : // using values that overflow signed values of int.
74946 : size_t
74947 4 : SgLinemarkerDirectiveStatement::numberOfNodes()
74948 : {
74949 : // This function traverses the memory pool for an IR node and
74950 : // counts the number of IR nodes of a particular Sage III IR
74951 : // nodes type.
74952 :
74953 4 : size_t count = 0;
74954 4 : if (SgLinemarkerDirectiveStatement::pools.empty() == false)
74955 : {
74956 : // Generate an array of memory pools (this is actually a STL vector,
74957 : // but it is contiguious, so OK to treat this way).
74958 0 : SgLinemarkerDirectiveStatement** objectArray = (SgLinemarkerDirectiveStatement**) &(SgLinemarkerDirectiveStatement::pools[0]);
74959 :
74960 : // Build a local variable for better performance (make it a loop invariant variable).
74961 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
74962 :
74963 : // Iterate over all of the memory pools for this IR node.
74964 0 : for (unsigned int i=0; i < SgLinemarkerDirectiveStatement::pools.size(); i++)
74965 : {
74966 : // objectArray[i] is a single memory pool, iterate over all the
74967 : // IR nodes and only count those that are valid IR nodes used in
74968 : // the AST (i.e. allocated IR nodes).
74969 0 : for (unsigned j=0; j < SgLinemarkerDirectiveStatement::pool_size; j++)
74970 : {
74971 : // This is indexing the STL vector of C/C++ style arrays as a doubly
74972 : // indexed array access. It is OK since we have leveraged the semantics
74973 : // of STL vector memory as contigous and cast the memory as an array
74974 : // of arrays to use the 2D array indexing. Hope this is not confusing,
74975 : // but it s very fast as an implementation.
74976 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
74977 : {
74978 0 : count++;
74979 : }
74980 : }
74981 : }
74982 : }
74983 :
74984 :
74985 :
74986 4 : return count;
74987 : }
74988 :
74989 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
74990 : // using values that overflow signed values of int.
74991 : size_t
74992 0 : SgLinemarkerDirectiveStatement::memoryUsage()
74993 : {
74994 : // This function is required because we need the class name as a type when we call sizeof
74995 : // There might be another way to implement this if we have a traversal that only called a
74996 : // representative object (one call for each type of Sage IIIIR node).
74997 0 : size_t memory = numberOfNodes() * sizeof(SgLinemarkerDirectiveStatement);
74998 :
74999 0 : return memory;
75000 : }
75001 :
75002 : /* #line 75003 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
75003 :
75004 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
75005 : void
75006 5342 : SgOmpThreadprivateStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
75007 : {
75008 : // This function traverses the memory pool for only a specific IR node
75009 : // and calls the visit function of the input class execute a traversal
75010 : // similar to the style of the attribute based traversals within ROSE.
75011 : // This traversal will visit ALL nodes of the AST where as the other
75012 : // attribute based traversals visit only the embedded tree within the AST.
75013 :
75014 : // Initialize array to the address of the first element of the STL vector
75015 : // (which is guaranteed to be contiguous storage).
75016 : // SgOmpThreadprivateStatement objectArray [] = *(Memory_Block_List.begin());
75017 5342 : if (SgOmpThreadprivateStatement::pools.empty() == false)
75018 : {
75019 : // Generate an array of memory pools
75020 49 : SgOmpThreadprivateStatement** objectArray = (SgOmpThreadprivateStatement**) &(SgOmpThreadprivateStatement::pools[0]);
75021 :
75022 : // Build a local variable for better performance
75023 49 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
75024 : #if 0
75025 : // Iterate over the memory pools
75026 : for (unsigned int i=0; i < SgOmpThreadprivateStatement::pools.size(); i++)
75027 : {
75028 : // objectArray[i] is a single memory pool
75029 : for (int j=0; j < SgOmpThreadprivateStatement::pool_size; j++)
75030 : {
75031 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
75032 : {
75033 : traversal.visit(&(objectArray[i][j]));
75034 : }
75035 : }
75036 : }
75037 : #else
75038 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
75039 : // compute the list first and then call the visit function on each list element.
75040 :
75041 : // printf ("Inside of SgOmpThreadprivateStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
75042 :
75043 98 : std::vector<SgOmpThreadprivateStatement*> nodeList;
75044 :
75045 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
75046 98 : for (unsigned int i=0; i < SgOmpThreadprivateStatement::pools.size(); i++)
75047 : {
75048 : // objectArray[i] is a single memory pool
75049 98049 : for (unsigned j=0; j < SgOmpThreadprivateStatement::pool_size; j++)
75050 : {
75051 98000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
75052 : {
75053 49 : nodeList.push_back(&(objectArray[i][j]));
75054 : }
75055 : }
75056 : }
75057 :
75058 : // Iterate over the saved list
75059 49 : size_t nodeListSize = nodeList.size();
75060 98 : for (size_t i=0; i < nodeListSize; i++)
75061 : {
75062 49 : ROSE_ASSERT(nodeList[i] != NULL);
75063 : #if 0
75064 : traversal.visit(nodeList[i]);
75065 : #else
75066 49 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
75067 : {
75068 49 : traversal.visit(nodeList[i]);
75069 : }
75070 : #endif
75071 : }
75072 : #endif
75073 : }
75074 :
75075 : // This should not be required since all previously static data members are
75076 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
75077 :
75078 5342 : }
75079 :
75080 :
75081 : void
75082 194 : SgOmpThreadprivateStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
75083 : {
75084 : // This function traverses the memory pool for an IR node and
75085 : // calls the function to execute the visitor object.
75086 :
75087 : // Initialize array to the address of the first element of the STL vector
75088 : // (which is guarenteed to be contiguous storage).
75089 : // SgOmpThreadprivateStatement objectArray [] = *(Memory_Block_List.begin());
75090 194 : if (SgOmpThreadprivateStatement::pools.empty() == false)
75091 : {
75092 : // Generate an array of memory pools
75093 0 : SgOmpThreadprivateStatement** objectArray = (SgOmpThreadprivateStatement**) &(SgOmpThreadprivateStatement::pools[0]);
75094 :
75095 : // Build a local variable for better performance
75096 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
75097 :
75098 : // Iterate over the memory pools
75099 0 : for (unsigned int i=0; i < SgOmpThreadprivateStatement::pools.size(); i++)
75100 : {
75101 : // objectArray[i] is a single memory pool
75102 0 : for (unsigned j=0; j < SgOmpThreadprivateStatement::pool_size; j++)
75103 : {
75104 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
75105 : {
75106 : // printf ("Found a valid SgOmpThreadprivateStatement object in the memory pool %d at position %d \n",i,j);
75107 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
75108 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
75109 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
75110 : }
75111 : else
75112 : {
75113 : // printf ("Found a INVALID SgOmpThreadprivateStatement object in the memory pool \n");
75114 : }
75115 : }
75116 : }
75117 : }
75118 :
75119 : // This should not be required since all previously static data members are
75120 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
75121 :
75122 194 : }
75123 :
75124 : void
75125 0 : SgOmpThreadprivateStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
75126 : {
75127 : // This function visits only a single IR node of the memory pool.
75128 : // it is typically called once for each type of IR node within
75129 : // the automatically generated function: traverseRepresentativeNodes().
75130 :
75131 : // Initialize array to the address of the first element of the STL vector
75132 : // (which is guarenteed to be contiguous storage).
75133 : // SgOmpThreadprivateStatement objectArray [] = *(Memory_Block_List.begin());
75134 0 : if (SgOmpThreadprivateStatement::pools.empty() == false)
75135 : {
75136 : // Generate an array of memory pools
75137 0 : SgOmpThreadprivateStatement** objectArray = (SgOmpThreadprivateStatement**) &(SgOmpThreadprivateStatement::pools[0]);
75138 :
75139 : // Build a local variable for better performance
75140 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
75141 :
75142 : // Iterate over the memory pools
75143 0 : bool done = false;
75144 0 : unsigned i=0;
75145 :
75146 : // find the first valid IR node, call visit function, and then leave
75147 0 : while ( done == false && i < SgOmpThreadprivateStatement::pools.size() )
75148 : {
75149 : // objectArray[i] is a single memory pool
75150 : unsigned j=0;
75151 0 : while (done == false && j < SgOmpThreadprivateStatement::pool_size)
75152 : {
75153 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
75154 : {
75155 0 : traversal.visit(&(objectArray[i][j]));
75156 0 : done = true;
75157 : }
75158 0 : j++;
75159 : }
75160 0 : i++;
75161 : }
75162 :
75163 : #if 0
75164 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
75165 : if (done == false)
75166 : {
75167 : printf ("No representative for SgOmpThreadprivateStatement found in memory pools \n");
75168 : }
75169 : #endif
75170 : }
75171 0 : }
75172 :
75173 :
75174 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
75175 : // using values that overflow signed values of int.
75176 : size_t
75177 4 : SgOmpThreadprivateStatement::numberOfNodes()
75178 : {
75179 : // This function traverses the memory pool for an IR node and
75180 : // counts the number of IR nodes of a particular Sage III IR
75181 : // nodes type.
75182 :
75183 4 : size_t count = 0;
75184 4 : if (SgOmpThreadprivateStatement::pools.empty() == false)
75185 : {
75186 : // Generate an array of memory pools (this is actually a STL vector,
75187 : // but it is contiguious, so OK to treat this way).
75188 0 : SgOmpThreadprivateStatement** objectArray = (SgOmpThreadprivateStatement**) &(SgOmpThreadprivateStatement::pools[0]);
75189 :
75190 : // Build a local variable for better performance (make it a loop invariant variable).
75191 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
75192 :
75193 : // Iterate over all of the memory pools for this IR node.
75194 0 : for (unsigned int i=0; i < SgOmpThreadprivateStatement::pools.size(); i++)
75195 : {
75196 : // objectArray[i] is a single memory pool, iterate over all the
75197 : // IR nodes and only count those that are valid IR nodes used in
75198 : // the AST (i.e. allocated IR nodes).
75199 0 : for (unsigned j=0; j < SgOmpThreadprivateStatement::pool_size; j++)
75200 : {
75201 : // This is indexing the STL vector of C/C++ style arrays as a doubly
75202 : // indexed array access. It is OK since we have leveraged the semantics
75203 : // of STL vector memory as contigous and cast the memory as an array
75204 : // of arrays to use the 2D array indexing. Hope this is not confusing,
75205 : // but it s very fast as an implementation.
75206 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
75207 : {
75208 0 : count++;
75209 : }
75210 : }
75211 : }
75212 : }
75213 :
75214 :
75215 :
75216 4 : return count;
75217 : }
75218 :
75219 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
75220 : // using values that overflow signed values of int.
75221 : size_t
75222 0 : SgOmpThreadprivateStatement::memoryUsage()
75223 : {
75224 : // This function is required because we need the class name as a type when we call sizeof
75225 : // There might be another way to implement this if we have a traversal that only called a
75226 : // representative object (one call for each type of Sage IIIIR node).
75227 0 : size_t memory = numberOfNodes() * sizeof(SgOmpThreadprivateStatement);
75228 :
75229 0 : return memory;
75230 : }
75231 :
75232 : /* #line 75233 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
75233 :
75234 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
75235 : void
75236 5342 : SgOmpRequiresStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
75237 : {
75238 : // This function traverses the memory pool for only a specific IR node
75239 : // and calls the visit function of the input class execute a traversal
75240 : // similar to the style of the attribute based traversals within ROSE.
75241 : // This traversal will visit ALL nodes of the AST where as the other
75242 : // attribute based traversals visit only the embedded tree within the AST.
75243 :
75244 : // Initialize array to the address of the first element of the STL vector
75245 : // (which is guaranteed to be contiguous storage).
75246 : // SgOmpRequiresStatement objectArray [] = *(Memory_Block_List.begin());
75247 5342 : if (SgOmpRequiresStatement::pools.empty() == false)
75248 : {
75249 : // Generate an array of memory pools
75250 49 : SgOmpRequiresStatement** objectArray = (SgOmpRequiresStatement**) &(SgOmpRequiresStatement::pools[0]);
75251 :
75252 : // Build a local variable for better performance
75253 49 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
75254 : #if 0
75255 : // Iterate over the memory pools
75256 : for (unsigned int i=0; i < SgOmpRequiresStatement::pools.size(); i++)
75257 : {
75258 : // objectArray[i] is a single memory pool
75259 : for (int j=0; j < SgOmpRequiresStatement::pool_size; j++)
75260 : {
75261 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
75262 : {
75263 : traversal.visit(&(objectArray[i][j]));
75264 : }
75265 : }
75266 : }
75267 : #else
75268 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
75269 : // compute the list first and then call the visit function on each list element.
75270 :
75271 : // printf ("Inside of SgOmpRequiresStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
75272 :
75273 98 : std::vector<SgOmpRequiresStatement*> nodeList;
75274 :
75275 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
75276 98 : for (unsigned int i=0; i < SgOmpRequiresStatement::pools.size(); i++)
75277 : {
75278 : // objectArray[i] is a single memory pool
75279 98049 : for (unsigned j=0; j < SgOmpRequiresStatement::pool_size; j++)
75280 : {
75281 98000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
75282 : {
75283 49 : nodeList.push_back(&(objectArray[i][j]));
75284 : }
75285 : }
75286 : }
75287 :
75288 : // Iterate over the saved list
75289 49 : size_t nodeListSize = nodeList.size();
75290 98 : for (size_t i=0; i < nodeListSize; i++)
75291 : {
75292 49 : ROSE_ASSERT(nodeList[i] != NULL);
75293 : #if 0
75294 : traversal.visit(nodeList[i]);
75295 : #else
75296 49 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
75297 : {
75298 49 : traversal.visit(nodeList[i]);
75299 : }
75300 : #endif
75301 : }
75302 : #endif
75303 : }
75304 :
75305 : // This should not be required since all previously static data members are
75306 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
75307 :
75308 5342 : }
75309 :
75310 :
75311 : void
75312 194 : SgOmpRequiresStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
75313 : {
75314 : // This function traverses the memory pool for an IR node and
75315 : // calls the function to execute the visitor object.
75316 :
75317 : // Initialize array to the address of the first element of the STL vector
75318 : // (which is guarenteed to be contiguous storage).
75319 : // SgOmpRequiresStatement objectArray [] = *(Memory_Block_List.begin());
75320 194 : if (SgOmpRequiresStatement::pools.empty() == false)
75321 : {
75322 : // Generate an array of memory pools
75323 0 : SgOmpRequiresStatement** objectArray = (SgOmpRequiresStatement**) &(SgOmpRequiresStatement::pools[0]);
75324 :
75325 : // Build a local variable for better performance
75326 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
75327 :
75328 : // Iterate over the memory pools
75329 0 : for (unsigned int i=0; i < SgOmpRequiresStatement::pools.size(); i++)
75330 : {
75331 : // objectArray[i] is a single memory pool
75332 0 : for (unsigned j=0; j < SgOmpRequiresStatement::pool_size; j++)
75333 : {
75334 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
75335 : {
75336 : // printf ("Found a valid SgOmpRequiresStatement object in the memory pool %d at position %d \n",i,j);
75337 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
75338 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
75339 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
75340 : }
75341 : else
75342 : {
75343 : // printf ("Found a INVALID SgOmpRequiresStatement object in the memory pool \n");
75344 : }
75345 : }
75346 : }
75347 : }
75348 :
75349 : // This should not be required since all previously static data members are
75350 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
75351 :
75352 194 : }
75353 :
75354 : void
75355 0 : SgOmpRequiresStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
75356 : {
75357 : // This function visits only a single IR node of the memory pool.
75358 : // it is typically called once for each type of IR node within
75359 : // the automatically generated function: traverseRepresentativeNodes().
75360 :
75361 : // Initialize array to the address of the first element of the STL vector
75362 : // (which is guarenteed to be contiguous storage).
75363 : // SgOmpRequiresStatement objectArray [] = *(Memory_Block_List.begin());
75364 0 : if (SgOmpRequiresStatement::pools.empty() == false)
75365 : {
75366 : // Generate an array of memory pools
75367 0 : SgOmpRequiresStatement** objectArray = (SgOmpRequiresStatement**) &(SgOmpRequiresStatement::pools[0]);
75368 :
75369 : // Build a local variable for better performance
75370 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
75371 :
75372 : // Iterate over the memory pools
75373 0 : bool done = false;
75374 0 : unsigned i=0;
75375 :
75376 : // find the first valid IR node, call visit function, and then leave
75377 0 : while ( done == false && i < SgOmpRequiresStatement::pools.size() )
75378 : {
75379 : // objectArray[i] is a single memory pool
75380 : unsigned j=0;
75381 0 : while (done == false && j < SgOmpRequiresStatement::pool_size)
75382 : {
75383 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
75384 : {
75385 0 : traversal.visit(&(objectArray[i][j]));
75386 0 : done = true;
75387 : }
75388 0 : j++;
75389 : }
75390 0 : i++;
75391 : }
75392 :
75393 : #if 0
75394 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
75395 : if (done == false)
75396 : {
75397 : printf ("No representative for SgOmpRequiresStatement found in memory pools \n");
75398 : }
75399 : #endif
75400 : }
75401 0 : }
75402 :
75403 :
75404 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
75405 : // using values that overflow signed values of int.
75406 : size_t
75407 4 : SgOmpRequiresStatement::numberOfNodes()
75408 : {
75409 : // This function traverses the memory pool for an IR node and
75410 : // counts the number of IR nodes of a particular Sage III IR
75411 : // nodes type.
75412 :
75413 4 : size_t count = 0;
75414 4 : if (SgOmpRequiresStatement::pools.empty() == false)
75415 : {
75416 : // Generate an array of memory pools (this is actually a STL vector,
75417 : // but it is contiguious, so OK to treat this way).
75418 0 : SgOmpRequiresStatement** objectArray = (SgOmpRequiresStatement**) &(SgOmpRequiresStatement::pools[0]);
75419 :
75420 : // Build a local variable for better performance (make it a loop invariant variable).
75421 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
75422 :
75423 : // Iterate over all of the memory pools for this IR node.
75424 0 : for (unsigned int i=0; i < SgOmpRequiresStatement::pools.size(); i++)
75425 : {
75426 : // objectArray[i] is a single memory pool, iterate over all the
75427 : // IR nodes and only count those that are valid IR nodes used in
75428 : // the AST (i.e. allocated IR nodes).
75429 0 : for (unsigned j=0; j < SgOmpRequiresStatement::pool_size; j++)
75430 : {
75431 : // This is indexing the STL vector of C/C++ style arrays as a doubly
75432 : // indexed array access. It is OK since we have leveraged the semantics
75433 : // of STL vector memory as contigous and cast the memory as an array
75434 : // of arrays to use the 2D array indexing. Hope this is not confusing,
75435 : // but it s very fast as an implementation.
75436 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
75437 : {
75438 0 : count++;
75439 : }
75440 : }
75441 : }
75442 : }
75443 :
75444 :
75445 :
75446 4 : return count;
75447 : }
75448 :
75449 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
75450 : // using values that overflow signed values of int.
75451 : size_t
75452 0 : SgOmpRequiresStatement::memoryUsage()
75453 : {
75454 : // This function is required because we need the class name as a type when we call sizeof
75455 : // There might be another way to implement this if we have a traversal that only called a
75456 : // representative object (one call for each type of Sage IIIIR node).
75457 0 : size_t memory = numberOfNodes() * sizeof(SgOmpRequiresStatement);
75458 :
75459 0 : return memory;
75460 : }
75461 :
75462 : /* #line 75463 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
75463 :
75464 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
75465 : void
75466 5342 : SgFortranIncludeLine::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
75467 : {
75468 : // This function traverses the memory pool for only a specific IR node
75469 : // and calls the visit function of the input class execute a traversal
75470 : // similar to the style of the attribute based traversals within ROSE.
75471 : // This traversal will visit ALL nodes of the AST where as the other
75472 : // attribute based traversals visit only the embedded tree within the AST.
75473 :
75474 : // Initialize array to the address of the first element of the STL vector
75475 : // (which is guaranteed to be contiguous storage).
75476 : // SgFortranIncludeLine objectArray [] = *(Memory_Block_List.begin());
75477 5342 : if (SgFortranIncludeLine::pools.empty() == false)
75478 : {
75479 : // Generate an array of memory pools
75480 240 : SgFortranIncludeLine** objectArray = (SgFortranIncludeLine**) &(SgFortranIncludeLine::pools[0]);
75481 :
75482 : // Build a local variable for better performance
75483 240 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
75484 : #if 0
75485 : // Iterate over the memory pools
75486 : for (unsigned int i=0; i < SgFortranIncludeLine::pools.size(); i++)
75487 : {
75488 : // objectArray[i] is a single memory pool
75489 : for (int j=0; j < SgFortranIncludeLine::pool_size; j++)
75490 : {
75491 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
75492 : {
75493 : traversal.visit(&(objectArray[i][j]));
75494 : }
75495 : }
75496 : }
75497 : #else
75498 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
75499 : // compute the list first and then call the visit function on each list element.
75500 :
75501 : // printf ("Inside of SgFortranIncludeLine::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
75502 :
75503 480 : std::vector<SgFortranIncludeLine*> nodeList;
75504 :
75505 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
75506 480 : for (unsigned int i=0; i < SgFortranIncludeLine::pools.size(); i++)
75507 : {
75508 : // objectArray[i] is a single memory pool
75509 480240 : for (unsigned j=0; j < SgFortranIncludeLine::pool_size; j++)
75510 : {
75511 480000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
75512 : {
75513 560 : nodeList.push_back(&(objectArray[i][j]));
75514 : }
75515 : }
75516 : }
75517 :
75518 : // Iterate over the saved list
75519 240 : size_t nodeListSize = nodeList.size();
75520 800 : for (size_t i=0; i < nodeListSize; i++)
75521 : {
75522 560 : ROSE_ASSERT(nodeList[i] != NULL);
75523 : #if 0
75524 : traversal.visit(nodeList[i]);
75525 : #else
75526 560 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
75527 : {
75528 560 : traversal.visit(nodeList[i]);
75529 : }
75530 : #endif
75531 : }
75532 : #endif
75533 : }
75534 :
75535 : // This should not be required since all previously static data members are
75536 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
75537 :
75538 5342 : }
75539 :
75540 :
75541 : void
75542 194 : SgFortranIncludeLine::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
75543 : {
75544 : // This function traverses the memory pool for an IR node and
75545 : // calls the function to execute the visitor object.
75546 :
75547 : // Initialize array to the address of the first element of the STL vector
75548 : // (which is guarenteed to be contiguous storage).
75549 : // SgFortranIncludeLine objectArray [] = *(Memory_Block_List.begin());
75550 194 : if (SgFortranIncludeLine::pools.empty() == false)
75551 : {
75552 : // Generate an array of memory pools
75553 0 : SgFortranIncludeLine** objectArray = (SgFortranIncludeLine**) &(SgFortranIncludeLine::pools[0]);
75554 :
75555 : // Build a local variable for better performance
75556 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
75557 :
75558 : // Iterate over the memory pools
75559 0 : for (unsigned int i=0; i < SgFortranIncludeLine::pools.size(); i++)
75560 : {
75561 : // objectArray[i] is a single memory pool
75562 0 : for (unsigned j=0; j < SgFortranIncludeLine::pool_size; j++)
75563 : {
75564 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
75565 : {
75566 : // printf ("Found a valid SgFortranIncludeLine object in the memory pool %d at position %d \n",i,j);
75567 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
75568 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
75569 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
75570 : }
75571 : else
75572 : {
75573 : // printf ("Found a INVALID SgFortranIncludeLine object in the memory pool \n");
75574 : }
75575 : }
75576 : }
75577 : }
75578 :
75579 : // This should not be required since all previously static data members are
75580 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
75581 :
75582 194 : }
75583 :
75584 : void
75585 0 : SgFortranIncludeLine::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
75586 : {
75587 : // This function visits only a single IR node of the memory pool.
75588 : // it is typically called once for each type of IR node within
75589 : // the automatically generated function: traverseRepresentativeNodes().
75590 :
75591 : // Initialize array to the address of the first element of the STL vector
75592 : // (which is guarenteed to be contiguous storage).
75593 : // SgFortranIncludeLine objectArray [] = *(Memory_Block_List.begin());
75594 0 : if (SgFortranIncludeLine::pools.empty() == false)
75595 : {
75596 : // Generate an array of memory pools
75597 0 : SgFortranIncludeLine** objectArray = (SgFortranIncludeLine**) &(SgFortranIncludeLine::pools[0]);
75598 :
75599 : // Build a local variable for better performance
75600 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
75601 :
75602 : // Iterate over the memory pools
75603 0 : bool done = false;
75604 0 : unsigned i=0;
75605 :
75606 : // find the first valid IR node, call visit function, and then leave
75607 0 : while ( done == false && i < SgFortranIncludeLine::pools.size() )
75608 : {
75609 : // objectArray[i] is a single memory pool
75610 : unsigned j=0;
75611 0 : while (done == false && j < SgFortranIncludeLine::pool_size)
75612 : {
75613 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
75614 : {
75615 0 : traversal.visit(&(objectArray[i][j]));
75616 0 : done = true;
75617 : }
75618 0 : j++;
75619 : }
75620 0 : i++;
75621 : }
75622 :
75623 : #if 0
75624 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
75625 : if (done == false)
75626 : {
75627 : printf ("No representative for SgFortranIncludeLine found in memory pools \n");
75628 : }
75629 : #endif
75630 : }
75631 0 : }
75632 :
75633 :
75634 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
75635 : // using values that overflow signed values of int.
75636 : size_t
75637 4 : SgFortranIncludeLine::numberOfNodes()
75638 : {
75639 : // This function traverses the memory pool for an IR node and
75640 : // counts the number of IR nodes of a particular Sage III IR
75641 : // nodes type.
75642 :
75643 4 : size_t count = 0;
75644 4 : if (SgFortranIncludeLine::pools.empty() == false)
75645 : {
75646 : // Generate an array of memory pools (this is actually a STL vector,
75647 : // but it is contiguious, so OK to treat this way).
75648 0 : SgFortranIncludeLine** objectArray = (SgFortranIncludeLine**) &(SgFortranIncludeLine::pools[0]);
75649 :
75650 : // Build a local variable for better performance (make it a loop invariant variable).
75651 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
75652 :
75653 : // Iterate over all of the memory pools for this IR node.
75654 0 : for (unsigned int i=0; i < SgFortranIncludeLine::pools.size(); i++)
75655 : {
75656 : // objectArray[i] is a single memory pool, iterate over all the
75657 : // IR nodes and only count those that are valid IR nodes used in
75658 : // the AST (i.e. allocated IR nodes).
75659 0 : for (unsigned j=0; j < SgFortranIncludeLine::pool_size; j++)
75660 : {
75661 : // This is indexing the STL vector of C/C++ style arrays as a doubly
75662 : // indexed array access. It is OK since we have leveraged the semantics
75663 : // of STL vector memory as contigous and cast the memory as an array
75664 : // of arrays to use the 2D array indexing. Hope this is not confusing,
75665 : // but it s very fast as an implementation.
75666 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
75667 : {
75668 0 : count++;
75669 : }
75670 : }
75671 : }
75672 : }
75673 :
75674 :
75675 :
75676 4 : return count;
75677 : }
75678 :
75679 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
75680 : // using values that overflow signed values of int.
75681 : size_t
75682 0 : SgFortranIncludeLine::memoryUsage()
75683 : {
75684 : // This function is required because we need the class name as a type when we call sizeof
75685 : // There might be another way to implement this if we have a traversal that only called a
75686 : // representative object (one call for each type of Sage IIIIR node).
75687 0 : size_t memory = numberOfNodes() * sizeof(SgFortranIncludeLine);
75688 :
75689 0 : return memory;
75690 : }
75691 :
75692 : /* #line 75693 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
75693 :
75694 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
75695 : void
75696 5342 : SgOmpTaskwaitStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
75697 : {
75698 : // This function traverses the memory pool for only a specific IR node
75699 : // and calls the visit function of the input class execute a traversal
75700 : // similar to the style of the attribute based traversals within ROSE.
75701 : // This traversal will visit ALL nodes of the AST where as the other
75702 : // attribute based traversals visit only the embedded tree within the AST.
75703 :
75704 : // Initialize array to the address of the first element of the STL vector
75705 : // (which is guaranteed to be contiguous storage).
75706 : // SgOmpTaskwaitStatement objectArray [] = *(Memory_Block_List.begin());
75707 5342 : if (SgOmpTaskwaitStatement::pools.empty() == false)
75708 : {
75709 : // Generate an array of memory pools
75710 42 : SgOmpTaskwaitStatement** objectArray = (SgOmpTaskwaitStatement**) &(SgOmpTaskwaitStatement::pools[0]);
75711 :
75712 : // Build a local variable for better performance
75713 42 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
75714 : #if 0
75715 : // Iterate over the memory pools
75716 : for (unsigned int i=0; i < SgOmpTaskwaitStatement::pools.size(); i++)
75717 : {
75718 : // objectArray[i] is a single memory pool
75719 : for (int j=0; j < SgOmpTaskwaitStatement::pool_size; j++)
75720 : {
75721 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
75722 : {
75723 : traversal.visit(&(objectArray[i][j]));
75724 : }
75725 : }
75726 : }
75727 : #else
75728 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
75729 : // compute the list first and then call the visit function on each list element.
75730 :
75731 : // printf ("Inside of SgOmpTaskwaitStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
75732 :
75733 84 : std::vector<SgOmpTaskwaitStatement*> nodeList;
75734 :
75735 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
75736 84 : for (unsigned int i=0; i < SgOmpTaskwaitStatement::pools.size(); i++)
75737 : {
75738 : // objectArray[i] is a single memory pool
75739 84042 : for (unsigned j=0; j < SgOmpTaskwaitStatement::pool_size; j++)
75740 : {
75741 84000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
75742 : {
75743 196 : nodeList.push_back(&(objectArray[i][j]));
75744 : }
75745 : }
75746 : }
75747 :
75748 : // Iterate over the saved list
75749 42 : size_t nodeListSize = nodeList.size();
75750 238 : for (size_t i=0; i < nodeListSize; i++)
75751 : {
75752 196 : ROSE_ASSERT(nodeList[i] != NULL);
75753 : #if 0
75754 : traversal.visit(nodeList[i]);
75755 : #else
75756 196 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
75757 : {
75758 196 : traversal.visit(nodeList[i]);
75759 : }
75760 : #endif
75761 : }
75762 : #endif
75763 : }
75764 :
75765 : // This should not be required since all previously static data members are
75766 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
75767 :
75768 5342 : }
75769 :
75770 :
75771 : void
75772 194 : SgOmpTaskwaitStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
75773 : {
75774 : // This function traverses the memory pool for an IR node and
75775 : // calls the function to execute the visitor object.
75776 :
75777 : // Initialize array to the address of the first element of the STL vector
75778 : // (which is guarenteed to be contiguous storage).
75779 : // SgOmpTaskwaitStatement objectArray [] = *(Memory_Block_List.begin());
75780 194 : if (SgOmpTaskwaitStatement::pools.empty() == false)
75781 : {
75782 : // Generate an array of memory pools
75783 0 : SgOmpTaskwaitStatement** objectArray = (SgOmpTaskwaitStatement**) &(SgOmpTaskwaitStatement::pools[0]);
75784 :
75785 : // Build a local variable for better performance
75786 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
75787 :
75788 : // Iterate over the memory pools
75789 0 : for (unsigned int i=0; i < SgOmpTaskwaitStatement::pools.size(); i++)
75790 : {
75791 : // objectArray[i] is a single memory pool
75792 0 : for (unsigned j=0; j < SgOmpTaskwaitStatement::pool_size; j++)
75793 : {
75794 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
75795 : {
75796 : // printf ("Found a valid SgOmpTaskwaitStatement object in the memory pool %d at position %d \n",i,j);
75797 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
75798 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
75799 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
75800 : }
75801 : else
75802 : {
75803 : // printf ("Found a INVALID SgOmpTaskwaitStatement object in the memory pool \n");
75804 : }
75805 : }
75806 : }
75807 : }
75808 :
75809 : // This should not be required since all previously static data members are
75810 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
75811 :
75812 194 : }
75813 :
75814 : void
75815 0 : SgOmpTaskwaitStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
75816 : {
75817 : // This function visits only a single IR node of the memory pool.
75818 : // it is typically called once for each type of IR node within
75819 : // the automatically generated function: traverseRepresentativeNodes().
75820 :
75821 : // Initialize array to the address of the first element of the STL vector
75822 : // (which is guarenteed to be contiguous storage).
75823 : // SgOmpTaskwaitStatement objectArray [] = *(Memory_Block_List.begin());
75824 0 : if (SgOmpTaskwaitStatement::pools.empty() == false)
75825 : {
75826 : // Generate an array of memory pools
75827 0 : SgOmpTaskwaitStatement** objectArray = (SgOmpTaskwaitStatement**) &(SgOmpTaskwaitStatement::pools[0]);
75828 :
75829 : // Build a local variable for better performance
75830 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
75831 :
75832 : // Iterate over the memory pools
75833 0 : bool done = false;
75834 0 : unsigned i=0;
75835 :
75836 : // find the first valid IR node, call visit function, and then leave
75837 0 : while ( done == false && i < SgOmpTaskwaitStatement::pools.size() )
75838 : {
75839 : // objectArray[i] is a single memory pool
75840 : unsigned j=0;
75841 0 : while (done == false && j < SgOmpTaskwaitStatement::pool_size)
75842 : {
75843 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
75844 : {
75845 0 : traversal.visit(&(objectArray[i][j]));
75846 0 : done = true;
75847 : }
75848 0 : j++;
75849 : }
75850 0 : i++;
75851 : }
75852 :
75853 : #if 0
75854 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
75855 : if (done == false)
75856 : {
75857 : printf ("No representative for SgOmpTaskwaitStatement found in memory pools \n");
75858 : }
75859 : #endif
75860 : }
75861 0 : }
75862 :
75863 :
75864 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
75865 : // using values that overflow signed values of int.
75866 : size_t
75867 4 : SgOmpTaskwaitStatement::numberOfNodes()
75868 : {
75869 : // This function traverses the memory pool for an IR node and
75870 : // counts the number of IR nodes of a particular Sage III IR
75871 : // nodes type.
75872 :
75873 4 : size_t count = 0;
75874 4 : if (SgOmpTaskwaitStatement::pools.empty() == false)
75875 : {
75876 : // Generate an array of memory pools (this is actually a STL vector,
75877 : // but it is contiguious, so OK to treat this way).
75878 0 : SgOmpTaskwaitStatement** objectArray = (SgOmpTaskwaitStatement**) &(SgOmpTaskwaitStatement::pools[0]);
75879 :
75880 : // Build a local variable for better performance (make it a loop invariant variable).
75881 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
75882 :
75883 : // Iterate over all of the memory pools for this IR node.
75884 0 : for (unsigned int i=0; i < SgOmpTaskwaitStatement::pools.size(); i++)
75885 : {
75886 : // objectArray[i] is a single memory pool, iterate over all the
75887 : // IR nodes and only count those that are valid IR nodes used in
75888 : // the AST (i.e. allocated IR nodes).
75889 0 : for (unsigned j=0; j < SgOmpTaskwaitStatement::pool_size; j++)
75890 : {
75891 : // This is indexing the STL vector of C/C++ style arrays as a doubly
75892 : // indexed array access. It is OK since we have leveraged the semantics
75893 : // of STL vector memory as contigous and cast the memory as an array
75894 : // of arrays to use the 2D array indexing. Hope this is not confusing,
75895 : // but it s very fast as an implementation.
75896 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
75897 : {
75898 0 : count++;
75899 : }
75900 : }
75901 : }
75902 : }
75903 :
75904 :
75905 :
75906 4 : return count;
75907 : }
75908 :
75909 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
75910 : // using values that overflow signed values of int.
75911 : size_t
75912 0 : SgOmpTaskwaitStatement::memoryUsage()
75913 : {
75914 : // This function is required because we need the class name as a type when we call sizeof
75915 : // There might be another way to implement this if we have a traversal that only called a
75916 : // representative object (one call for each type of Sage IIIIR node).
75917 0 : size_t memory = numberOfNodes() * sizeof(SgOmpTaskwaitStatement);
75918 :
75919 0 : return memory;
75920 : }
75921 :
75922 : /* #line 75923 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
75923 :
75924 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
75925 : void
75926 5342 : SgStmtDeclarationStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
75927 : {
75928 : // This function traverses the memory pool for only a specific IR node
75929 : // and calls the visit function of the input class execute a traversal
75930 : // similar to the style of the attribute based traversals within ROSE.
75931 : // This traversal will visit ALL nodes of the AST where as the other
75932 : // attribute based traversals visit only the embedded tree within the AST.
75933 :
75934 : // Initialize array to the address of the first element of the STL vector
75935 : // (which is guaranteed to be contiguous storage).
75936 : // SgStmtDeclarationStatement objectArray [] = *(Memory_Block_List.begin());
75937 5342 : if (SgStmtDeclarationStatement::pools.empty() == false)
75938 : {
75939 : // Generate an array of memory pools
75940 0 : SgStmtDeclarationStatement** objectArray = (SgStmtDeclarationStatement**) &(SgStmtDeclarationStatement::pools[0]);
75941 :
75942 : // Build a local variable for better performance
75943 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
75944 : #if 0
75945 : // Iterate over the memory pools
75946 : for (unsigned int i=0; i < SgStmtDeclarationStatement::pools.size(); i++)
75947 : {
75948 : // objectArray[i] is a single memory pool
75949 : for (int j=0; j < SgStmtDeclarationStatement::pool_size; j++)
75950 : {
75951 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
75952 : {
75953 : traversal.visit(&(objectArray[i][j]));
75954 : }
75955 : }
75956 : }
75957 : #else
75958 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
75959 : // compute the list first and then call the visit function on each list element.
75960 :
75961 : // printf ("Inside of SgStmtDeclarationStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
75962 :
75963 0 : std::vector<SgStmtDeclarationStatement*> nodeList;
75964 :
75965 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
75966 0 : for (unsigned int i=0; i < SgStmtDeclarationStatement::pools.size(); i++)
75967 : {
75968 : // objectArray[i] is a single memory pool
75969 0 : for (unsigned j=0; j < SgStmtDeclarationStatement::pool_size; j++)
75970 : {
75971 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
75972 : {
75973 0 : nodeList.push_back(&(objectArray[i][j]));
75974 : }
75975 : }
75976 : }
75977 :
75978 : // Iterate over the saved list
75979 0 : size_t nodeListSize = nodeList.size();
75980 0 : for (size_t i=0; i < nodeListSize; i++)
75981 : {
75982 0 : ROSE_ASSERT(nodeList[i] != NULL);
75983 : #if 0
75984 : traversal.visit(nodeList[i]);
75985 : #else
75986 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
75987 : {
75988 0 : traversal.visit(nodeList[i]);
75989 : }
75990 : #endif
75991 : }
75992 : #endif
75993 : }
75994 :
75995 : // This should not be required since all previously static data members are
75996 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
75997 :
75998 5342 : }
75999 :
76000 :
76001 : void
76002 194 : SgStmtDeclarationStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
76003 : {
76004 : // This function traverses the memory pool for an IR node and
76005 : // calls the function to execute the visitor object.
76006 :
76007 : // Initialize array to the address of the first element of the STL vector
76008 : // (which is guarenteed to be contiguous storage).
76009 : // SgStmtDeclarationStatement objectArray [] = *(Memory_Block_List.begin());
76010 194 : if (SgStmtDeclarationStatement::pools.empty() == false)
76011 : {
76012 : // Generate an array of memory pools
76013 0 : SgStmtDeclarationStatement** objectArray = (SgStmtDeclarationStatement**) &(SgStmtDeclarationStatement::pools[0]);
76014 :
76015 : // Build a local variable for better performance
76016 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
76017 :
76018 : // Iterate over the memory pools
76019 0 : for (unsigned int i=0; i < SgStmtDeclarationStatement::pools.size(); i++)
76020 : {
76021 : // objectArray[i] is a single memory pool
76022 0 : for (unsigned j=0; j < SgStmtDeclarationStatement::pool_size; j++)
76023 : {
76024 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
76025 : {
76026 : // printf ("Found a valid SgStmtDeclarationStatement object in the memory pool %d at position %d \n",i,j);
76027 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
76028 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
76029 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
76030 : }
76031 : else
76032 : {
76033 : // printf ("Found a INVALID SgStmtDeclarationStatement object in the memory pool \n");
76034 : }
76035 : }
76036 : }
76037 : }
76038 :
76039 : // This should not be required since all previously static data members are
76040 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
76041 :
76042 194 : }
76043 :
76044 : void
76045 0 : SgStmtDeclarationStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
76046 : {
76047 : // This function visits only a single IR node of the memory pool.
76048 : // it is typically called once for each type of IR node within
76049 : // the automatically generated function: traverseRepresentativeNodes().
76050 :
76051 : // Initialize array to the address of the first element of the STL vector
76052 : // (which is guarenteed to be contiguous storage).
76053 : // SgStmtDeclarationStatement objectArray [] = *(Memory_Block_List.begin());
76054 0 : if (SgStmtDeclarationStatement::pools.empty() == false)
76055 : {
76056 : // Generate an array of memory pools
76057 0 : SgStmtDeclarationStatement** objectArray = (SgStmtDeclarationStatement**) &(SgStmtDeclarationStatement::pools[0]);
76058 :
76059 : // Build a local variable for better performance
76060 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
76061 :
76062 : // Iterate over the memory pools
76063 0 : bool done = false;
76064 0 : unsigned i=0;
76065 :
76066 : // find the first valid IR node, call visit function, and then leave
76067 0 : while ( done == false && i < SgStmtDeclarationStatement::pools.size() )
76068 : {
76069 : // objectArray[i] is a single memory pool
76070 : unsigned j=0;
76071 0 : while (done == false && j < SgStmtDeclarationStatement::pool_size)
76072 : {
76073 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
76074 : {
76075 0 : traversal.visit(&(objectArray[i][j]));
76076 0 : done = true;
76077 : }
76078 0 : j++;
76079 : }
76080 0 : i++;
76081 : }
76082 :
76083 : #if 0
76084 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
76085 : if (done == false)
76086 : {
76087 : printf ("No representative for SgStmtDeclarationStatement found in memory pools \n");
76088 : }
76089 : #endif
76090 : }
76091 0 : }
76092 :
76093 :
76094 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
76095 : // using values that overflow signed values of int.
76096 : size_t
76097 4 : SgStmtDeclarationStatement::numberOfNodes()
76098 : {
76099 : // This function traverses the memory pool for an IR node and
76100 : // counts the number of IR nodes of a particular Sage III IR
76101 : // nodes type.
76102 :
76103 4 : size_t count = 0;
76104 4 : if (SgStmtDeclarationStatement::pools.empty() == false)
76105 : {
76106 : // Generate an array of memory pools (this is actually a STL vector,
76107 : // but it is contiguious, so OK to treat this way).
76108 0 : SgStmtDeclarationStatement** objectArray = (SgStmtDeclarationStatement**) &(SgStmtDeclarationStatement::pools[0]);
76109 :
76110 : // Build a local variable for better performance (make it a loop invariant variable).
76111 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
76112 :
76113 : // Iterate over all of the memory pools for this IR node.
76114 0 : for (unsigned int i=0; i < SgStmtDeclarationStatement::pools.size(); i++)
76115 : {
76116 : // objectArray[i] is a single memory pool, iterate over all the
76117 : // IR nodes and only count those that are valid IR nodes used in
76118 : // the AST (i.e. allocated IR nodes).
76119 0 : for (unsigned j=0; j < SgStmtDeclarationStatement::pool_size; j++)
76120 : {
76121 : // This is indexing the STL vector of C/C++ style arrays as a doubly
76122 : // indexed array access. It is OK since we have leveraged the semantics
76123 : // of STL vector memory as contigous and cast the memory as an array
76124 : // of arrays to use the 2D array indexing. Hope this is not confusing,
76125 : // but it s very fast as an implementation.
76126 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
76127 : {
76128 0 : count++;
76129 : }
76130 : }
76131 : }
76132 : }
76133 :
76134 :
76135 :
76136 4 : return count;
76137 : }
76138 :
76139 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
76140 : // using values that overflow signed values of int.
76141 : size_t
76142 0 : SgStmtDeclarationStatement::memoryUsage()
76143 : {
76144 : // This function is required because we need the class name as a type when we call sizeof
76145 : // There might be another way to implement this if we have a traversal that only called a
76146 : // representative object (one call for each type of Sage IIIIR node).
76147 0 : size_t memory = numberOfNodes() * sizeof(SgStmtDeclarationStatement);
76148 :
76149 0 : return memory;
76150 : }
76151 :
76152 : /* #line 76153 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
76153 :
76154 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
76155 : void
76156 5342 : SgStaticAssertionDeclaration::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
76157 : {
76158 : // This function traverses the memory pool for only a specific IR node
76159 : // and calls the visit function of the input class execute a traversal
76160 : // similar to the style of the attribute based traversals within ROSE.
76161 : // This traversal will visit ALL nodes of the AST where as the other
76162 : // attribute based traversals visit only the embedded tree within the AST.
76163 :
76164 : // Initialize array to the address of the first element of the STL vector
76165 : // (which is guaranteed to be contiguous storage).
76166 : // SgStaticAssertionDeclaration objectArray [] = *(Memory_Block_List.begin());
76167 5342 : if (SgStaticAssertionDeclaration::pools.empty() == false)
76168 : {
76169 : // Generate an array of memory pools
76170 138 : SgStaticAssertionDeclaration** objectArray = (SgStaticAssertionDeclaration**) &(SgStaticAssertionDeclaration::pools[0]);
76171 :
76172 : // Build a local variable for better performance
76173 138 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
76174 : #if 0
76175 : // Iterate over the memory pools
76176 : for (unsigned int i=0; i < SgStaticAssertionDeclaration::pools.size(); i++)
76177 : {
76178 : // objectArray[i] is a single memory pool
76179 : for (int j=0; j < SgStaticAssertionDeclaration::pool_size; j++)
76180 : {
76181 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
76182 : {
76183 : traversal.visit(&(objectArray[i][j]));
76184 : }
76185 : }
76186 : }
76187 : #else
76188 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
76189 : // compute the list first and then call the visit function on each list element.
76190 :
76191 : // printf ("Inside of SgStaticAssertionDeclaration::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
76192 :
76193 276 : std::vector<SgStaticAssertionDeclaration*> nodeList;
76194 :
76195 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
76196 276 : for (unsigned int i=0; i < SgStaticAssertionDeclaration::pools.size(); i++)
76197 : {
76198 : // objectArray[i] is a single memory pool
76199 276138 : for (unsigned j=0; j < SgStaticAssertionDeclaration::pool_size; j++)
76200 : {
76201 276000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
76202 : {
76203 2095 : nodeList.push_back(&(objectArray[i][j]));
76204 : }
76205 : }
76206 : }
76207 :
76208 : // Iterate over the saved list
76209 138 : size_t nodeListSize = nodeList.size();
76210 2233 : for (size_t i=0; i < nodeListSize; i++)
76211 : {
76212 2095 : ROSE_ASSERT(nodeList[i] != NULL);
76213 : #if 0
76214 : traversal.visit(nodeList[i]);
76215 : #else
76216 2095 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
76217 : {
76218 2095 : traversal.visit(nodeList[i]);
76219 : }
76220 : #endif
76221 : }
76222 : #endif
76223 : }
76224 :
76225 : // This should not be required since all previously static data members are
76226 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
76227 :
76228 5342 : }
76229 :
76230 :
76231 : void
76232 194 : SgStaticAssertionDeclaration::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
76233 : {
76234 : // This function traverses the memory pool for an IR node and
76235 : // calls the function to execute the visitor object.
76236 :
76237 : // Initialize array to the address of the first element of the STL vector
76238 : // (which is guarenteed to be contiguous storage).
76239 : // SgStaticAssertionDeclaration objectArray [] = *(Memory_Block_List.begin());
76240 194 : if (SgStaticAssertionDeclaration::pools.empty() == false)
76241 : {
76242 : // Generate an array of memory pools
76243 137 : SgStaticAssertionDeclaration** objectArray = (SgStaticAssertionDeclaration**) &(SgStaticAssertionDeclaration::pools[0]);
76244 :
76245 : // Build a local variable for better performance
76246 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
76247 :
76248 : // Iterate over the memory pools
76249 274 : for (unsigned int i=0; i < SgStaticAssertionDeclaration::pools.size(); i++)
76250 : {
76251 : // objectArray[i] is a single memory pool
76252 274137 : for (unsigned j=0; j < SgStaticAssertionDeclaration::pool_size; j++)
76253 : {
76254 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
76255 : {
76256 : // printf ("Found a valid SgStaticAssertionDeclaration object in the memory pool %d at position %d \n",i,j);
76257 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
76258 2044 : objectArray[i][j].executeVisitorMemberFunction(visitor);
76259 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
76260 : }
76261 : else
76262 : {
76263 : // printf ("Found a INVALID SgStaticAssertionDeclaration object in the memory pool \n");
76264 : }
76265 : }
76266 : }
76267 : }
76268 :
76269 : // This should not be required since all previously static data members are
76270 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
76271 :
76272 194 : }
76273 :
76274 : void
76275 0 : SgStaticAssertionDeclaration::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
76276 : {
76277 : // This function visits only a single IR node of the memory pool.
76278 : // it is typically called once for each type of IR node within
76279 : // the automatically generated function: traverseRepresentativeNodes().
76280 :
76281 : // Initialize array to the address of the first element of the STL vector
76282 : // (which is guarenteed to be contiguous storage).
76283 : // SgStaticAssertionDeclaration objectArray [] = *(Memory_Block_List.begin());
76284 0 : if (SgStaticAssertionDeclaration::pools.empty() == false)
76285 : {
76286 : // Generate an array of memory pools
76287 0 : SgStaticAssertionDeclaration** objectArray = (SgStaticAssertionDeclaration**) &(SgStaticAssertionDeclaration::pools[0]);
76288 :
76289 : // Build a local variable for better performance
76290 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
76291 :
76292 : // Iterate over the memory pools
76293 0 : bool done = false;
76294 0 : unsigned i=0;
76295 :
76296 : // find the first valid IR node, call visit function, and then leave
76297 0 : while ( done == false && i < SgStaticAssertionDeclaration::pools.size() )
76298 : {
76299 : // objectArray[i] is a single memory pool
76300 : unsigned j=0;
76301 0 : while (done == false && j < SgStaticAssertionDeclaration::pool_size)
76302 : {
76303 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
76304 : {
76305 0 : traversal.visit(&(objectArray[i][j]));
76306 0 : done = true;
76307 : }
76308 0 : j++;
76309 : }
76310 0 : i++;
76311 : }
76312 :
76313 : #if 0
76314 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
76315 : if (done == false)
76316 : {
76317 : printf ("No representative for SgStaticAssertionDeclaration found in memory pools \n");
76318 : }
76319 : #endif
76320 : }
76321 0 : }
76322 :
76323 :
76324 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
76325 : // using values that overflow signed values of int.
76326 : size_t
76327 4 : SgStaticAssertionDeclaration::numberOfNodes()
76328 : {
76329 : // This function traverses the memory pool for an IR node and
76330 : // counts the number of IR nodes of a particular Sage III IR
76331 : // nodes type.
76332 :
76333 4 : size_t count = 0;
76334 4 : if (SgStaticAssertionDeclaration::pools.empty() == false)
76335 : {
76336 : // Generate an array of memory pools (this is actually a STL vector,
76337 : // but it is contiguious, so OK to treat this way).
76338 1 : SgStaticAssertionDeclaration** objectArray = (SgStaticAssertionDeclaration**) &(SgStaticAssertionDeclaration::pools[0]);
76339 :
76340 : // Build a local variable for better performance (make it a loop invariant variable).
76341 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
76342 :
76343 : // Iterate over all of the memory pools for this IR node.
76344 2 : for (unsigned int i=0; i < SgStaticAssertionDeclaration::pools.size(); i++)
76345 : {
76346 : // objectArray[i] is a single memory pool, iterate over all the
76347 : // IR nodes and only count those that are valid IR nodes used in
76348 : // the AST (i.e. allocated IR nodes).
76349 2001 : for (unsigned j=0; j < SgStaticAssertionDeclaration::pool_size; j++)
76350 : {
76351 : // This is indexing the STL vector of C/C++ style arrays as a doubly
76352 : // indexed array access. It is OK since we have leveraged the semantics
76353 : // of STL vector memory as contigous and cast the memory as an array
76354 : // of arrays to use the 2D array indexing. Hope this is not confusing,
76355 : // but it s very fast as an implementation.
76356 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
76357 : {
76358 14 : count++;
76359 : }
76360 : }
76361 : }
76362 : }
76363 :
76364 :
76365 :
76366 4 : return count;
76367 : }
76368 :
76369 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
76370 : // using values that overflow signed values of int.
76371 : size_t
76372 0 : SgStaticAssertionDeclaration::memoryUsage()
76373 : {
76374 : // This function is required because we need the class name as a type when we call sizeof
76375 : // There might be another way to implement this if we have a traversal that only called a
76376 : // representative object (one call for each type of Sage IIIIR node).
76377 0 : size_t memory = numberOfNodes() * sizeof(SgStaticAssertionDeclaration);
76378 :
76379 0 : return memory;
76380 : }
76381 :
76382 : /* #line 76383 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
76383 :
76384 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
76385 : void
76386 5342 : SgOmpDeclareSimdStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
76387 : {
76388 : // This function traverses the memory pool for only a specific IR node
76389 : // and calls the visit function of the input class execute a traversal
76390 : // similar to the style of the attribute based traversals within ROSE.
76391 : // This traversal will visit ALL nodes of the AST where as the other
76392 : // attribute based traversals visit only the embedded tree within the AST.
76393 :
76394 : // Initialize array to the address of the first element of the STL vector
76395 : // (which is guaranteed to be contiguous storage).
76396 : // SgOmpDeclareSimdStatement objectArray [] = *(Memory_Block_List.begin());
76397 5342 : if (SgOmpDeclareSimdStatement::pools.empty() == false)
76398 : {
76399 : // Generate an array of memory pools
76400 7 : SgOmpDeclareSimdStatement** objectArray = (SgOmpDeclareSimdStatement**) &(SgOmpDeclareSimdStatement::pools[0]);
76401 :
76402 : // Build a local variable for better performance
76403 7 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
76404 : #if 0
76405 : // Iterate over the memory pools
76406 : for (unsigned int i=0; i < SgOmpDeclareSimdStatement::pools.size(); i++)
76407 : {
76408 : // objectArray[i] is a single memory pool
76409 : for (int j=0; j < SgOmpDeclareSimdStatement::pool_size; j++)
76410 : {
76411 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
76412 : {
76413 : traversal.visit(&(objectArray[i][j]));
76414 : }
76415 : }
76416 : }
76417 : #else
76418 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
76419 : // compute the list first and then call the visit function on each list element.
76420 :
76421 : // printf ("Inside of SgOmpDeclareSimdStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
76422 :
76423 14 : std::vector<SgOmpDeclareSimdStatement*> nodeList;
76424 :
76425 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
76426 14 : for (unsigned int i=0; i < SgOmpDeclareSimdStatement::pools.size(); i++)
76427 : {
76428 : // objectArray[i] is a single memory pool
76429 14007 : for (unsigned j=0; j < SgOmpDeclareSimdStatement::pool_size; j++)
76430 : {
76431 14000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
76432 : {
76433 21 : nodeList.push_back(&(objectArray[i][j]));
76434 : }
76435 : }
76436 : }
76437 :
76438 : // Iterate over the saved list
76439 7 : size_t nodeListSize = nodeList.size();
76440 28 : for (size_t i=0; i < nodeListSize; i++)
76441 : {
76442 21 : ROSE_ASSERT(nodeList[i] != NULL);
76443 : #if 0
76444 : traversal.visit(nodeList[i]);
76445 : #else
76446 21 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
76447 : {
76448 21 : traversal.visit(nodeList[i]);
76449 : }
76450 : #endif
76451 : }
76452 : #endif
76453 : }
76454 :
76455 : // This should not be required since all previously static data members are
76456 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
76457 :
76458 5342 : }
76459 :
76460 :
76461 : void
76462 194 : SgOmpDeclareSimdStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
76463 : {
76464 : // This function traverses the memory pool for an IR node and
76465 : // calls the function to execute the visitor object.
76466 :
76467 : // Initialize array to the address of the first element of the STL vector
76468 : // (which is guarenteed to be contiguous storage).
76469 : // SgOmpDeclareSimdStatement objectArray [] = *(Memory_Block_List.begin());
76470 194 : if (SgOmpDeclareSimdStatement::pools.empty() == false)
76471 : {
76472 : // Generate an array of memory pools
76473 0 : SgOmpDeclareSimdStatement** objectArray = (SgOmpDeclareSimdStatement**) &(SgOmpDeclareSimdStatement::pools[0]);
76474 :
76475 : // Build a local variable for better performance
76476 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
76477 :
76478 : // Iterate over the memory pools
76479 0 : for (unsigned int i=0; i < SgOmpDeclareSimdStatement::pools.size(); i++)
76480 : {
76481 : // objectArray[i] is a single memory pool
76482 0 : for (unsigned j=0; j < SgOmpDeclareSimdStatement::pool_size; j++)
76483 : {
76484 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
76485 : {
76486 : // printf ("Found a valid SgOmpDeclareSimdStatement object in the memory pool %d at position %d \n",i,j);
76487 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
76488 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
76489 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
76490 : }
76491 : else
76492 : {
76493 : // printf ("Found a INVALID SgOmpDeclareSimdStatement object in the memory pool \n");
76494 : }
76495 : }
76496 : }
76497 : }
76498 :
76499 : // This should not be required since all previously static data members are
76500 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
76501 :
76502 194 : }
76503 :
76504 : void
76505 0 : SgOmpDeclareSimdStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
76506 : {
76507 : // This function visits only a single IR node of the memory pool.
76508 : // it is typically called once for each type of IR node within
76509 : // the automatically generated function: traverseRepresentativeNodes().
76510 :
76511 : // Initialize array to the address of the first element of the STL vector
76512 : // (which is guarenteed to be contiguous storage).
76513 : // SgOmpDeclareSimdStatement objectArray [] = *(Memory_Block_List.begin());
76514 0 : if (SgOmpDeclareSimdStatement::pools.empty() == false)
76515 : {
76516 : // Generate an array of memory pools
76517 0 : SgOmpDeclareSimdStatement** objectArray = (SgOmpDeclareSimdStatement**) &(SgOmpDeclareSimdStatement::pools[0]);
76518 :
76519 : // Build a local variable for better performance
76520 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
76521 :
76522 : // Iterate over the memory pools
76523 0 : bool done = false;
76524 0 : unsigned i=0;
76525 :
76526 : // find the first valid IR node, call visit function, and then leave
76527 0 : while ( done == false && i < SgOmpDeclareSimdStatement::pools.size() )
76528 : {
76529 : // objectArray[i] is a single memory pool
76530 : unsigned j=0;
76531 0 : while (done == false && j < SgOmpDeclareSimdStatement::pool_size)
76532 : {
76533 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
76534 : {
76535 0 : traversal.visit(&(objectArray[i][j]));
76536 0 : done = true;
76537 : }
76538 0 : j++;
76539 : }
76540 0 : i++;
76541 : }
76542 :
76543 : #if 0
76544 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
76545 : if (done == false)
76546 : {
76547 : printf ("No representative for SgOmpDeclareSimdStatement found in memory pools \n");
76548 : }
76549 : #endif
76550 : }
76551 0 : }
76552 :
76553 :
76554 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
76555 : // using values that overflow signed values of int.
76556 : size_t
76557 4 : SgOmpDeclareSimdStatement::numberOfNodes()
76558 : {
76559 : // This function traverses the memory pool for an IR node and
76560 : // counts the number of IR nodes of a particular Sage III IR
76561 : // nodes type.
76562 :
76563 4 : size_t count = 0;
76564 4 : if (SgOmpDeclareSimdStatement::pools.empty() == false)
76565 : {
76566 : // Generate an array of memory pools (this is actually a STL vector,
76567 : // but it is contiguious, so OK to treat this way).
76568 0 : SgOmpDeclareSimdStatement** objectArray = (SgOmpDeclareSimdStatement**) &(SgOmpDeclareSimdStatement::pools[0]);
76569 :
76570 : // Build a local variable for better performance (make it a loop invariant variable).
76571 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
76572 :
76573 : // Iterate over all of the memory pools for this IR node.
76574 0 : for (unsigned int i=0; i < SgOmpDeclareSimdStatement::pools.size(); i++)
76575 : {
76576 : // objectArray[i] is a single memory pool, iterate over all the
76577 : // IR nodes and only count those that are valid IR nodes used in
76578 : // the AST (i.e. allocated IR nodes).
76579 0 : for (unsigned j=0; j < SgOmpDeclareSimdStatement::pool_size; j++)
76580 : {
76581 : // This is indexing the STL vector of C/C++ style arrays as a doubly
76582 : // indexed array access. It is OK since we have leveraged the semantics
76583 : // of STL vector memory as contigous and cast the memory as an array
76584 : // of arrays to use the 2D array indexing. Hope this is not confusing,
76585 : // but it s very fast as an implementation.
76586 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
76587 : {
76588 0 : count++;
76589 : }
76590 : }
76591 : }
76592 : }
76593 :
76594 :
76595 :
76596 4 : return count;
76597 : }
76598 :
76599 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
76600 : // using values that overflow signed values of int.
76601 : size_t
76602 0 : SgOmpDeclareSimdStatement::memoryUsage()
76603 : {
76604 : // This function is required because we need the class name as a type when we call sizeof
76605 : // There might be another way to implement this if we have a traversal that only called a
76606 : // representative object (one call for each type of Sage IIIIR node).
76607 0 : size_t memory = numberOfNodes() * sizeof(SgOmpDeclareSimdStatement);
76608 :
76609 0 : return memory;
76610 : }
76611 :
76612 : /* #line 76613 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
76613 :
76614 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
76615 : void
76616 5342 : SgMicrosoftAttributeDeclaration::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
76617 : {
76618 : // This function traverses the memory pool for only a specific IR node
76619 : // and calls the visit function of the input class execute a traversal
76620 : // similar to the style of the attribute based traversals within ROSE.
76621 : // This traversal will visit ALL nodes of the AST where as the other
76622 : // attribute based traversals visit only the embedded tree within the AST.
76623 :
76624 : // Initialize array to the address of the first element of the STL vector
76625 : // (which is guaranteed to be contiguous storage).
76626 : // SgMicrosoftAttributeDeclaration objectArray [] = *(Memory_Block_List.begin());
76627 5342 : if (SgMicrosoftAttributeDeclaration::pools.empty() == false)
76628 : {
76629 : // Generate an array of memory pools
76630 0 : SgMicrosoftAttributeDeclaration** objectArray = (SgMicrosoftAttributeDeclaration**) &(SgMicrosoftAttributeDeclaration::pools[0]);
76631 :
76632 : // Build a local variable for better performance
76633 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
76634 : #if 0
76635 : // Iterate over the memory pools
76636 : for (unsigned int i=0; i < SgMicrosoftAttributeDeclaration::pools.size(); i++)
76637 : {
76638 : // objectArray[i] is a single memory pool
76639 : for (int j=0; j < SgMicrosoftAttributeDeclaration::pool_size; j++)
76640 : {
76641 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
76642 : {
76643 : traversal.visit(&(objectArray[i][j]));
76644 : }
76645 : }
76646 : }
76647 : #else
76648 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
76649 : // compute the list first and then call the visit function on each list element.
76650 :
76651 : // printf ("Inside of SgMicrosoftAttributeDeclaration::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
76652 :
76653 0 : std::vector<SgMicrosoftAttributeDeclaration*> nodeList;
76654 :
76655 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
76656 0 : for (unsigned int i=0; i < SgMicrosoftAttributeDeclaration::pools.size(); i++)
76657 : {
76658 : // objectArray[i] is a single memory pool
76659 0 : for (unsigned j=0; j < SgMicrosoftAttributeDeclaration::pool_size; j++)
76660 : {
76661 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
76662 : {
76663 0 : nodeList.push_back(&(objectArray[i][j]));
76664 : }
76665 : }
76666 : }
76667 :
76668 : // Iterate over the saved list
76669 0 : size_t nodeListSize = nodeList.size();
76670 0 : for (size_t i=0; i < nodeListSize; i++)
76671 : {
76672 0 : ROSE_ASSERT(nodeList[i] != NULL);
76673 : #if 0
76674 : traversal.visit(nodeList[i]);
76675 : #else
76676 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
76677 : {
76678 0 : traversal.visit(nodeList[i]);
76679 : }
76680 : #endif
76681 : }
76682 : #endif
76683 : }
76684 :
76685 : // This should not be required since all previously static data members are
76686 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
76687 :
76688 5342 : }
76689 :
76690 :
76691 : void
76692 194 : SgMicrosoftAttributeDeclaration::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
76693 : {
76694 : // This function traverses the memory pool for an IR node and
76695 : // calls the function to execute the visitor object.
76696 :
76697 : // Initialize array to the address of the first element of the STL vector
76698 : // (which is guarenteed to be contiguous storage).
76699 : // SgMicrosoftAttributeDeclaration objectArray [] = *(Memory_Block_List.begin());
76700 194 : if (SgMicrosoftAttributeDeclaration::pools.empty() == false)
76701 : {
76702 : // Generate an array of memory pools
76703 0 : SgMicrosoftAttributeDeclaration** objectArray = (SgMicrosoftAttributeDeclaration**) &(SgMicrosoftAttributeDeclaration::pools[0]);
76704 :
76705 : // Build a local variable for better performance
76706 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
76707 :
76708 : // Iterate over the memory pools
76709 0 : for (unsigned int i=0; i < SgMicrosoftAttributeDeclaration::pools.size(); i++)
76710 : {
76711 : // objectArray[i] is a single memory pool
76712 0 : for (unsigned j=0; j < SgMicrosoftAttributeDeclaration::pool_size; j++)
76713 : {
76714 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
76715 : {
76716 : // printf ("Found a valid SgMicrosoftAttributeDeclaration object in the memory pool %d at position %d \n",i,j);
76717 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
76718 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
76719 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
76720 : }
76721 : else
76722 : {
76723 : // printf ("Found a INVALID SgMicrosoftAttributeDeclaration object in the memory pool \n");
76724 : }
76725 : }
76726 : }
76727 : }
76728 :
76729 : // This should not be required since all previously static data members are
76730 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
76731 :
76732 194 : }
76733 :
76734 : void
76735 0 : SgMicrosoftAttributeDeclaration::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
76736 : {
76737 : // This function visits only a single IR node of the memory pool.
76738 : // it is typically called once for each type of IR node within
76739 : // the automatically generated function: traverseRepresentativeNodes().
76740 :
76741 : // Initialize array to the address of the first element of the STL vector
76742 : // (which is guarenteed to be contiguous storage).
76743 : // SgMicrosoftAttributeDeclaration objectArray [] = *(Memory_Block_List.begin());
76744 0 : if (SgMicrosoftAttributeDeclaration::pools.empty() == false)
76745 : {
76746 : // Generate an array of memory pools
76747 0 : SgMicrosoftAttributeDeclaration** objectArray = (SgMicrosoftAttributeDeclaration**) &(SgMicrosoftAttributeDeclaration::pools[0]);
76748 :
76749 : // Build a local variable for better performance
76750 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
76751 :
76752 : // Iterate over the memory pools
76753 0 : bool done = false;
76754 0 : unsigned i=0;
76755 :
76756 : // find the first valid IR node, call visit function, and then leave
76757 0 : while ( done == false && i < SgMicrosoftAttributeDeclaration::pools.size() )
76758 : {
76759 : // objectArray[i] is a single memory pool
76760 : unsigned j=0;
76761 0 : while (done == false && j < SgMicrosoftAttributeDeclaration::pool_size)
76762 : {
76763 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
76764 : {
76765 0 : traversal.visit(&(objectArray[i][j]));
76766 0 : done = true;
76767 : }
76768 0 : j++;
76769 : }
76770 0 : i++;
76771 : }
76772 :
76773 : #if 0
76774 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
76775 : if (done == false)
76776 : {
76777 : printf ("No representative for SgMicrosoftAttributeDeclaration found in memory pools \n");
76778 : }
76779 : #endif
76780 : }
76781 0 : }
76782 :
76783 :
76784 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
76785 : // using values that overflow signed values of int.
76786 : size_t
76787 4 : SgMicrosoftAttributeDeclaration::numberOfNodes()
76788 : {
76789 : // This function traverses the memory pool for an IR node and
76790 : // counts the number of IR nodes of a particular Sage III IR
76791 : // nodes type.
76792 :
76793 4 : size_t count = 0;
76794 4 : if (SgMicrosoftAttributeDeclaration::pools.empty() == false)
76795 : {
76796 : // Generate an array of memory pools (this is actually a STL vector,
76797 : // but it is contiguious, so OK to treat this way).
76798 0 : SgMicrosoftAttributeDeclaration** objectArray = (SgMicrosoftAttributeDeclaration**) &(SgMicrosoftAttributeDeclaration::pools[0]);
76799 :
76800 : // Build a local variable for better performance (make it a loop invariant variable).
76801 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
76802 :
76803 : // Iterate over all of the memory pools for this IR node.
76804 0 : for (unsigned int i=0; i < SgMicrosoftAttributeDeclaration::pools.size(); i++)
76805 : {
76806 : // objectArray[i] is a single memory pool, iterate over all the
76807 : // IR nodes and only count those that are valid IR nodes used in
76808 : // the AST (i.e. allocated IR nodes).
76809 0 : for (unsigned j=0; j < SgMicrosoftAttributeDeclaration::pool_size; j++)
76810 : {
76811 : // This is indexing the STL vector of C/C++ style arrays as a doubly
76812 : // indexed array access. It is OK since we have leveraged the semantics
76813 : // of STL vector memory as contigous and cast the memory as an array
76814 : // of arrays to use the 2D array indexing. Hope this is not confusing,
76815 : // but it s very fast as an implementation.
76816 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
76817 : {
76818 0 : count++;
76819 : }
76820 : }
76821 : }
76822 : }
76823 :
76824 :
76825 :
76826 4 : return count;
76827 : }
76828 :
76829 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
76830 : // using values that overflow signed values of int.
76831 : size_t
76832 0 : SgMicrosoftAttributeDeclaration::memoryUsage()
76833 : {
76834 : // This function is required because we need the class name as a type when we call sizeof
76835 : // There might be another way to implement this if we have a traversal that only called a
76836 : // representative object (one call for each type of Sage IIIIR node).
76837 0 : size_t memory = numberOfNodes() * sizeof(SgMicrosoftAttributeDeclaration);
76838 :
76839 0 : return memory;
76840 : }
76841 :
76842 : /* #line 76843 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
76843 :
76844 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
76845 : void
76846 5342 : SgNonrealDecl::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
76847 : {
76848 : // This function traverses the memory pool for only a specific IR node
76849 : // and calls the visit function of the input class execute a traversal
76850 : // similar to the style of the attribute based traversals within ROSE.
76851 : // This traversal will visit ALL nodes of the AST where as the other
76852 : // attribute based traversals visit only the embedded tree within the AST.
76853 :
76854 : // Initialize array to the address of the first element of the STL vector
76855 : // (which is guaranteed to be contiguous storage).
76856 : // SgNonrealDecl objectArray [] = *(Memory_Block_List.begin());
76857 5342 : if (SgNonrealDecl::pools.empty() == false)
76858 : {
76859 : // Generate an array of memory pools
76860 145 : SgNonrealDecl** objectArray = (SgNonrealDecl**) &(SgNonrealDecl::pools[0]);
76861 :
76862 : // Build a local variable for better performance
76863 145 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
76864 : #if 0
76865 : // Iterate over the memory pools
76866 : for (unsigned int i=0; i < SgNonrealDecl::pools.size(); i++)
76867 : {
76868 : // objectArray[i] is a single memory pool
76869 : for (int j=0; j < SgNonrealDecl::pool_size; j++)
76870 : {
76871 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
76872 : {
76873 : traversal.visit(&(objectArray[i][j]));
76874 : }
76875 : }
76876 : }
76877 : #else
76878 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
76879 : // compute the list first and then call the visit function on each list element.
76880 :
76881 : // printf ("Inside of SgNonrealDecl::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
76882 :
76883 290 : std::vector<SgNonrealDecl*> nodeList;
76884 :
76885 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
76886 566 : for (unsigned int i=0; i < SgNonrealDecl::pools.size(); i++)
76887 : {
76888 : // objectArray[i] is a single memory pool
76889 842421 : for (unsigned j=0; j < SgNonrealDecl::pool_size; j++)
76890 : {
76891 842000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
76892 : {
76893 682838 : nodeList.push_back(&(objectArray[i][j]));
76894 : }
76895 : }
76896 : }
76897 :
76898 : // Iterate over the saved list
76899 145 : size_t nodeListSize = nodeList.size();
76900 682983 : for (size_t i=0; i < nodeListSize; i++)
76901 : {
76902 682838 : ROSE_ASSERT(nodeList[i] != NULL);
76903 : #if 0
76904 : traversal.visit(nodeList[i]);
76905 : #else
76906 682838 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
76907 : {
76908 682838 : traversal.visit(nodeList[i]);
76909 : }
76910 : #endif
76911 : }
76912 : #endif
76913 : }
76914 :
76915 : // This should not be required since all previously static data members are
76916 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
76917 :
76918 5342 : }
76919 :
76920 :
76921 : void
76922 194 : SgNonrealDecl::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
76923 : {
76924 : // This function traverses the memory pool for an IR node and
76925 : // calls the function to execute the visitor object.
76926 :
76927 : // Initialize array to the address of the first element of the STL vector
76928 : // (which is guarenteed to be contiguous storage).
76929 : // SgNonrealDecl objectArray [] = *(Memory_Block_List.begin());
76930 194 : if (SgNonrealDecl::pools.empty() == false)
76931 : {
76932 : // Generate an array of memory pools
76933 137 : SgNonrealDecl** objectArray = (SgNonrealDecl**) &(SgNonrealDecl::pools[0]);
76934 :
76935 : // Build a local variable for better performance
76936 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
76937 :
76938 : // Iterate over the memory pools
76939 548 : for (unsigned int i=0; i < SgNonrealDecl::pools.size(); i++)
76940 : {
76941 : // objectArray[i] is a single memory pool
76942 822411 : for (unsigned j=0; j < SgNonrealDecl::pool_size; j++)
76943 : {
76944 822000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
76945 : {
76946 : // printf ("Found a valid SgNonrealDecl object in the memory pool %d at position %d \n",i,j);
76947 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
76948 704852 : objectArray[i][j].executeVisitorMemberFunction(visitor);
76949 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
76950 : }
76951 : else
76952 : {
76953 : // printf ("Found a INVALID SgNonrealDecl object in the memory pool \n");
76954 : }
76955 : }
76956 : }
76957 : }
76958 :
76959 : // This should not be required since all previously static data members are
76960 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
76961 :
76962 194 : }
76963 :
76964 : void
76965 0 : SgNonrealDecl::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
76966 : {
76967 : // This function visits only a single IR node of the memory pool.
76968 : // it is typically called once for each type of IR node within
76969 : // the automatically generated function: traverseRepresentativeNodes().
76970 :
76971 : // Initialize array to the address of the first element of the STL vector
76972 : // (which is guarenteed to be contiguous storage).
76973 : // SgNonrealDecl objectArray [] = *(Memory_Block_List.begin());
76974 0 : if (SgNonrealDecl::pools.empty() == false)
76975 : {
76976 : // Generate an array of memory pools
76977 0 : SgNonrealDecl** objectArray = (SgNonrealDecl**) &(SgNonrealDecl::pools[0]);
76978 :
76979 : // Build a local variable for better performance
76980 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
76981 :
76982 : // Iterate over the memory pools
76983 0 : bool done = false;
76984 0 : unsigned i=0;
76985 :
76986 : // find the first valid IR node, call visit function, and then leave
76987 0 : while ( done == false && i < SgNonrealDecl::pools.size() )
76988 : {
76989 : // objectArray[i] is a single memory pool
76990 : unsigned j=0;
76991 0 : while (done == false && j < SgNonrealDecl::pool_size)
76992 : {
76993 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
76994 : {
76995 0 : traversal.visit(&(objectArray[i][j]));
76996 0 : done = true;
76997 : }
76998 0 : j++;
76999 : }
77000 0 : i++;
77001 : }
77002 :
77003 : #if 0
77004 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
77005 : if (done == false)
77006 : {
77007 : printf ("No representative for SgNonrealDecl found in memory pools \n");
77008 : }
77009 : #endif
77010 : }
77011 0 : }
77012 :
77013 :
77014 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
77015 : // using values that overflow signed values of int.
77016 : size_t
77017 4 : SgNonrealDecl::numberOfNodes()
77018 : {
77019 : // This function traverses the memory pool for an IR node and
77020 : // counts the number of IR nodes of a particular Sage III IR
77021 : // nodes type.
77022 :
77023 4 : size_t count = 0;
77024 4 : if (SgNonrealDecl::pools.empty() == false)
77025 : {
77026 : // Generate an array of memory pools (this is actually a STL vector,
77027 : // but it is contiguious, so OK to treat this way).
77028 1 : SgNonrealDecl** objectArray = (SgNonrealDecl**) &(SgNonrealDecl::pools[0]);
77029 :
77030 : // Build a local variable for better performance (make it a loop invariant variable).
77031 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
77032 :
77033 : // Iterate over all of the memory pools for this IR node.
77034 4 : for (unsigned int i=0; i < SgNonrealDecl::pools.size(); i++)
77035 : {
77036 : // objectArray[i] is a single memory pool, iterate over all the
77037 : // IR nodes and only count those that are valid IR nodes used in
77038 : // the AST (i.e. allocated IR nodes).
77039 6003 : for (unsigned j=0; j < SgNonrealDecl::pool_size; j++)
77040 : {
77041 : // This is indexing the STL vector of C/C++ style arrays as a doubly
77042 : // indexed array access. It is OK since we have leveraged the semantics
77043 : // of STL vector memory as contigous and cast the memory as an array
77044 : // of arrays to use the 2D array indexing. Hope this is not confusing,
77045 : // but it s very fast as an implementation.
77046 6000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
77047 : {
77048 5080 : count++;
77049 : }
77050 : }
77051 : }
77052 : }
77053 :
77054 :
77055 :
77056 4 : return count;
77057 : }
77058 :
77059 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
77060 : // using values that overflow signed values of int.
77061 : size_t
77062 0 : SgNonrealDecl::memoryUsage()
77063 : {
77064 : // This function is required because we need the class name as a type when we call sizeof
77065 : // There might be another way to implement this if we have a traversal that only called a
77066 : // representative object (one call for each type of Sage IIIIR node).
77067 0 : size_t memory = numberOfNodes() * sizeof(SgNonrealDecl);
77068 :
77069 0 : return memory;
77070 : }
77071 :
77072 : /* #line 77073 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
77073 :
77074 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
77075 : void
77076 5342 : SgEmptyDeclaration::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
77077 : {
77078 : // This function traverses the memory pool for only a specific IR node
77079 : // and calls the visit function of the input class execute a traversal
77080 : // similar to the style of the attribute based traversals within ROSE.
77081 : // This traversal will visit ALL nodes of the AST where as the other
77082 : // attribute based traversals visit only the embedded tree within the AST.
77083 :
77084 : // Initialize array to the address of the first element of the STL vector
77085 : // (which is guaranteed to be contiguous storage).
77086 : // SgEmptyDeclaration objectArray [] = *(Memory_Block_List.begin());
77087 5342 : if (SgEmptyDeclaration::pools.empty() == false)
77088 : {
77089 : // Generate an array of memory pools
77090 0 : SgEmptyDeclaration** objectArray = (SgEmptyDeclaration**) &(SgEmptyDeclaration::pools[0]);
77091 :
77092 : // Build a local variable for better performance
77093 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
77094 : #if 0
77095 : // Iterate over the memory pools
77096 : for (unsigned int i=0; i < SgEmptyDeclaration::pools.size(); i++)
77097 : {
77098 : // objectArray[i] is a single memory pool
77099 : for (int j=0; j < SgEmptyDeclaration::pool_size; j++)
77100 : {
77101 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
77102 : {
77103 : traversal.visit(&(objectArray[i][j]));
77104 : }
77105 : }
77106 : }
77107 : #else
77108 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
77109 : // compute the list first and then call the visit function on each list element.
77110 :
77111 : // printf ("Inside of SgEmptyDeclaration::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
77112 :
77113 0 : std::vector<SgEmptyDeclaration*> nodeList;
77114 :
77115 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
77116 0 : for (unsigned int i=0; i < SgEmptyDeclaration::pools.size(); i++)
77117 : {
77118 : // objectArray[i] is a single memory pool
77119 0 : for (unsigned j=0; j < SgEmptyDeclaration::pool_size; j++)
77120 : {
77121 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
77122 : {
77123 0 : nodeList.push_back(&(objectArray[i][j]));
77124 : }
77125 : }
77126 : }
77127 :
77128 : // Iterate over the saved list
77129 0 : size_t nodeListSize = nodeList.size();
77130 0 : for (size_t i=0; i < nodeListSize; i++)
77131 : {
77132 0 : ROSE_ASSERT(nodeList[i] != NULL);
77133 : #if 0
77134 : traversal.visit(nodeList[i]);
77135 : #else
77136 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
77137 : {
77138 0 : traversal.visit(nodeList[i]);
77139 : }
77140 : #endif
77141 : }
77142 : #endif
77143 : }
77144 :
77145 : // This should not be required since all previously static data members are
77146 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
77147 :
77148 5342 : }
77149 :
77150 :
77151 : void
77152 194 : SgEmptyDeclaration::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
77153 : {
77154 : // This function traverses the memory pool for an IR node and
77155 : // calls the function to execute the visitor object.
77156 :
77157 : // Initialize array to the address of the first element of the STL vector
77158 : // (which is guarenteed to be contiguous storage).
77159 : // SgEmptyDeclaration objectArray [] = *(Memory_Block_List.begin());
77160 194 : if (SgEmptyDeclaration::pools.empty() == false)
77161 : {
77162 : // Generate an array of memory pools
77163 0 : SgEmptyDeclaration** objectArray = (SgEmptyDeclaration**) &(SgEmptyDeclaration::pools[0]);
77164 :
77165 : // Build a local variable for better performance
77166 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
77167 :
77168 : // Iterate over the memory pools
77169 0 : for (unsigned int i=0; i < SgEmptyDeclaration::pools.size(); i++)
77170 : {
77171 : // objectArray[i] is a single memory pool
77172 0 : for (unsigned j=0; j < SgEmptyDeclaration::pool_size; j++)
77173 : {
77174 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
77175 : {
77176 : // printf ("Found a valid SgEmptyDeclaration object in the memory pool %d at position %d \n",i,j);
77177 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
77178 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
77179 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
77180 : }
77181 : else
77182 : {
77183 : // printf ("Found a INVALID SgEmptyDeclaration object in the memory pool \n");
77184 : }
77185 : }
77186 : }
77187 : }
77188 :
77189 : // This should not be required since all previously static data members are
77190 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
77191 :
77192 194 : }
77193 :
77194 : void
77195 0 : SgEmptyDeclaration::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
77196 : {
77197 : // This function visits only a single IR node of the memory pool.
77198 : // it is typically called once for each type of IR node within
77199 : // the automatically generated function: traverseRepresentativeNodes().
77200 :
77201 : // Initialize array to the address of the first element of the STL vector
77202 : // (which is guarenteed to be contiguous storage).
77203 : // SgEmptyDeclaration objectArray [] = *(Memory_Block_List.begin());
77204 0 : if (SgEmptyDeclaration::pools.empty() == false)
77205 : {
77206 : // Generate an array of memory pools
77207 0 : SgEmptyDeclaration** objectArray = (SgEmptyDeclaration**) &(SgEmptyDeclaration::pools[0]);
77208 :
77209 : // Build a local variable for better performance
77210 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
77211 :
77212 : // Iterate over the memory pools
77213 0 : bool done = false;
77214 0 : unsigned i=0;
77215 :
77216 : // find the first valid IR node, call visit function, and then leave
77217 0 : while ( done == false && i < SgEmptyDeclaration::pools.size() )
77218 : {
77219 : // objectArray[i] is a single memory pool
77220 : unsigned j=0;
77221 0 : while (done == false && j < SgEmptyDeclaration::pool_size)
77222 : {
77223 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
77224 : {
77225 0 : traversal.visit(&(objectArray[i][j]));
77226 0 : done = true;
77227 : }
77228 0 : j++;
77229 : }
77230 0 : i++;
77231 : }
77232 :
77233 : #if 0
77234 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
77235 : if (done == false)
77236 : {
77237 : printf ("No representative for SgEmptyDeclaration found in memory pools \n");
77238 : }
77239 : #endif
77240 : }
77241 0 : }
77242 :
77243 :
77244 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
77245 : // using values that overflow signed values of int.
77246 : size_t
77247 4 : SgEmptyDeclaration::numberOfNodes()
77248 : {
77249 : // This function traverses the memory pool for an IR node and
77250 : // counts the number of IR nodes of a particular Sage III IR
77251 : // nodes type.
77252 :
77253 4 : size_t count = 0;
77254 4 : if (SgEmptyDeclaration::pools.empty() == false)
77255 : {
77256 : // Generate an array of memory pools (this is actually a STL vector,
77257 : // but it is contiguious, so OK to treat this way).
77258 0 : SgEmptyDeclaration** objectArray = (SgEmptyDeclaration**) &(SgEmptyDeclaration::pools[0]);
77259 :
77260 : // Build a local variable for better performance (make it a loop invariant variable).
77261 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
77262 :
77263 : // Iterate over all of the memory pools for this IR node.
77264 0 : for (unsigned int i=0; i < SgEmptyDeclaration::pools.size(); i++)
77265 : {
77266 : // objectArray[i] is a single memory pool, iterate over all the
77267 : // IR nodes and only count those that are valid IR nodes used in
77268 : // the AST (i.e. allocated IR nodes).
77269 0 : for (unsigned j=0; j < SgEmptyDeclaration::pool_size; j++)
77270 : {
77271 : // This is indexing the STL vector of C/C++ style arrays as a doubly
77272 : // indexed array access. It is OK since we have leveraged the semantics
77273 : // of STL vector memory as contigous and cast the memory as an array
77274 : // of arrays to use the 2D array indexing. Hope this is not confusing,
77275 : // but it s very fast as an implementation.
77276 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
77277 : {
77278 0 : count++;
77279 : }
77280 : }
77281 : }
77282 : }
77283 :
77284 :
77285 :
77286 4 : return count;
77287 : }
77288 :
77289 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
77290 : // using values that overflow signed values of int.
77291 : size_t
77292 0 : SgEmptyDeclaration::memoryUsage()
77293 : {
77294 : // This function is required because we need the class name as a type when we call sizeof
77295 : // There might be another way to implement this if we have a traversal that only called a
77296 : // representative object (one call for each type of Sage IIIIR node).
77297 0 : size_t memory = numberOfNodes() * sizeof(SgEmptyDeclaration);
77298 :
77299 0 : return memory;
77300 : }
77301 :
77302 : /* #line 77303 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
77303 :
77304 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
77305 : void
77306 5342 : SgExprStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
77307 : {
77308 : // This function traverses the memory pool for only a specific IR node
77309 : // and calls the visit function of the input class execute a traversal
77310 : // similar to the style of the attribute based traversals within ROSE.
77311 : // This traversal will visit ALL nodes of the AST where as the other
77312 : // attribute based traversals visit only the embedded tree within the AST.
77313 :
77314 : // Initialize array to the address of the first element of the STL vector
77315 : // (which is guaranteed to be contiguous storage).
77316 : // SgExprStatement objectArray [] = *(Memory_Block_List.begin());
77317 5342 : if (SgExprStatement::pools.empty() == false)
77318 : {
77319 : // Generate an array of memory pools
77320 4441 : SgExprStatement** objectArray = (SgExprStatement**) &(SgExprStatement::pools[0]);
77321 :
77322 : // Build a local variable for better performance
77323 4441 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
77324 : #if 0
77325 : // Iterate over the memory pools
77326 : for (unsigned int i=0; i < SgExprStatement::pools.size(); i++)
77327 : {
77328 : // objectArray[i] is a single memory pool
77329 : for (int j=0; j < SgExprStatement::pool_size; j++)
77330 : {
77331 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
77332 : {
77333 : traversal.visit(&(objectArray[i][j]));
77334 : }
77335 : }
77336 : }
77337 : #else
77338 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
77339 : // compute the list first and then call the visit function on each list element.
77340 :
77341 : // printf ("Inside of SgExprStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
77342 :
77343 8882 : std::vector<SgExprStatement*> nodeList;
77344 :
77345 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
77346 8997 : for (unsigned int i=0; i < SgExprStatement::pools.size(); i++)
77347 : {
77348 : // objectArray[i] is a single memory pool
77349 9116560 : for (unsigned j=0; j < SgExprStatement::pool_size; j++)
77350 : {
77351 9112000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
77352 : {
77353 331099 : nodeList.push_back(&(objectArray[i][j]));
77354 : }
77355 : }
77356 : }
77357 :
77358 : // Iterate over the saved list
77359 4441 : size_t nodeListSize = nodeList.size();
77360 335540 : for (size_t i=0; i < nodeListSize; i++)
77361 : {
77362 331099 : ROSE_ASSERT(nodeList[i] != NULL);
77363 : #if 0
77364 : traversal.visit(nodeList[i]);
77365 : #else
77366 331099 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
77367 : {
77368 331099 : traversal.visit(nodeList[i]);
77369 : }
77370 : #endif
77371 : }
77372 : #endif
77373 : }
77374 :
77375 : // This should not be required since all previously static data members are
77376 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
77377 :
77378 5342 : }
77379 :
77380 :
77381 : void
77382 194 : SgExprStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
77383 : {
77384 : // This function traverses the memory pool for an IR node and
77385 : // calls the function to execute the visitor object.
77386 :
77387 : // Initialize array to the address of the first element of the STL vector
77388 : // (which is guarenteed to be contiguous storage).
77389 : // SgExprStatement objectArray [] = *(Memory_Block_List.begin());
77390 194 : if (SgExprStatement::pools.empty() == false)
77391 : {
77392 : // Generate an array of memory pools
77393 194 : SgExprStatement** objectArray = (SgExprStatement**) &(SgExprStatement::pools[0]);
77394 :
77395 : // Build a local variable for better performance
77396 194 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
77397 :
77398 : // Iterate over the memory pools
77399 525 : for (unsigned int i=0; i < SgExprStatement::pools.size(); i++)
77400 : {
77401 : // objectArray[i] is a single memory pool
77402 662331 : for (unsigned j=0; j < SgExprStatement::pool_size; j++)
77403 : {
77404 662000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
77405 : {
77406 : // printf ("Found a valid SgExprStatement object in the memory pool %d at position %d \n",i,j);
77407 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
77408 315706 : objectArray[i][j].executeVisitorMemberFunction(visitor);
77409 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
77410 : }
77411 : else
77412 : {
77413 : // printf ("Found a INVALID SgExprStatement object in the memory pool \n");
77414 : }
77415 : }
77416 : }
77417 : }
77418 :
77419 : // This should not be required since all previously static data members are
77420 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
77421 :
77422 194 : }
77423 :
77424 : void
77425 0 : SgExprStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
77426 : {
77427 : // This function visits only a single IR node of the memory pool.
77428 : // it is typically called once for each type of IR node within
77429 : // the automatically generated function: traverseRepresentativeNodes().
77430 :
77431 : // Initialize array to the address of the first element of the STL vector
77432 : // (which is guarenteed to be contiguous storage).
77433 : // SgExprStatement objectArray [] = *(Memory_Block_List.begin());
77434 0 : if (SgExprStatement::pools.empty() == false)
77435 : {
77436 : // Generate an array of memory pools
77437 0 : SgExprStatement** objectArray = (SgExprStatement**) &(SgExprStatement::pools[0]);
77438 :
77439 : // Build a local variable for better performance
77440 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
77441 :
77442 : // Iterate over the memory pools
77443 0 : bool done = false;
77444 0 : unsigned i=0;
77445 :
77446 : // find the first valid IR node, call visit function, and then leave
77447 0 : while ( done == false && i < SgExprStatement::pools.size() )
77448 : {
77449 : // objectArray[i] is a single memory pool
77450 : unsigned j=0;
77451 0 : while (done == false && j < SgExprStatement::pool_size)
77452 : {
77453 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
77454 : {
77455 0 : traversal.visit(&(objectArray[i][j]));
77456 0 : done = true;
77457 : }
77458 0 : j++;
77459 : }
77460 0 : i++;
77461 : }
77462 :
77463 : #if 0
77464 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
77465 : if (done == false)
77466 : {
77467 : printf ("No representative for SgExprStatement found in memory pools \n");
77468 : }
77469 : #endif
77470 : }
77471 0 : }
77472 :
77473 :
77474 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
77475 : // using values that overflow signed values of int.
77476 : size_t
77477 4 : SgExprStatement::numberOfNodes()
77478 : {
77479 : // This function traverses the memory pool for an IR node and
77480 : // counts the number of IR nodes of a particular Sage III IR
77481 : // nodes type.
77482 :
77483 4 : size_t count = 0;
77484 4 : if (SgExprStatement::pools.empty() == false)
77485 : {
77486 : // Generate an array of memory pools (this is actually a STL vector,
77487 : // but it is contiguious, so OK to treat this way).
77488 3 : SgExprStatement** objectArray = (SgExprStatement**) &(SgExprStatement::pools[0]);
77489 :
77490 : // Build a local variable for better performance (make it a loop invariant variable).
77491 3 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
77492 :
77493 : // Iterate over all of the memory pools for this IR node.
77494 7 : for (unsigned int i=0; i < SgExprStatement::pools.size(); i++)
77495 : {
77496 : // objectArray[i] is a single memory pool, iterate over all the
77497 : // IR nodes and only count those that are valid IR nodes used in
77498 : // the AST (i.e. allocated IR nodes).
77499 8004 : for (unsigned j=0; j < SgExprStatement::pool_size; j++)
77500 : {
77501 : // This is indexing the STL vector of C/C++ style arrays as a doubly
77502 : // indexed array access. It is OK since we have leveraged the semantics
77503 : // of STL vector memory as contigous and cast the memory as an array
77504 : // of arrays to use the 2D array indexing. Hope this is not confusing,
77505 : // but it s very fast as an implementation.
77506 8000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
77507 : {
77508 2210 : count++;
77509 : }
77510 : }
77511 : }
77512 : }
77513 :
77514 :
77515 :
77516 4 : return count;
77517 : }
77518 :
77519 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
77520 : // using values that overflow signed values of int.
77521 : size_t
77522 0 : SgExprStatement::memoryUsage()
77523 : {
77524 : // This function is required because we need the class name as a type when we call sizeof
77525 : // There might be another way to implement this if we have a traversal that only called a
77526 : // representative object (one call for each type of Sage IIIIR node).
77527 0 : size_t memory = numberOfNodes() * sizeof(SgExprStatement);
77528 :
77529 0 : return memory;
77530 : }
77531 :
77532 : /* #line 77533 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
77533 :
77534 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
77535 : void
77536 5342 : SgLabelStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
77537 : {
77538 : // This function traverses the memory pool for only a specific IR node
77539 : // and calls the visit function of the input class execute a traversal
77540 : // similar to the style of the attribute based traversals within ROSE.
77541 : // This traversal will visit ALL nodes of the AST where as the other
77542 : // attribute based traversals visit only the embedded tree within the AST.
77543 :
77544 : // Initialize array to the address of the first element of the STL vector
77545 : // (which is guaranteed to be contiguous storage).
77546 : // SgLabelStatement objectArray [] = *(Memory_Block_List.begin());
77547 5342 : if (SgLabelStatement::pools.empty() == false)
77548 : {
77549 : // Generate an array of memory pools
77550 70 : SgLabelStatement** objectArray = (SgLabelStatement**) &(SgLabelStatement::pools[0]);
77551 :
77552 : // Build a local variable for better performance
77553 70 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
77554 : #if 0
77555 : // Iterate over the memory pools
77556 : for (unsigned int i=0; i < SgLabelStatement::pools.size(); i++)
77557 : {
77558 : // objectArray[i] is a single memory pool
77559 : for (int j=0; j < SgLabelStatement::pool_size; j++)
77560 : {
77561 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
77562 : {
77563 : traversal.visit(&(objectArray[i][j]));
77564 : }
77565 : }
77566 : }
77567 : #else
77568 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
77569 : // compute the list first and then call the visit function on each list element.
77570 :
77571 : // printf ("Inside of SgLabelStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
77572 :
77573 140 : std::vector<SgLabelStatement*> nodeList;
77574 :
77575 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
77576 140 : for (unsigned int i=0; i < SgLabelStatement::pools.size(); i++)
77577 : {
77578 : // objectArray[i] is a single memory pool
77579 140070 : for (unsigned j=0; j < SgLabelStatement::pool_size; j++)
77580 : {
77581 140000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
77582 : {
77583 120 : nodeList.push_back(&(objectArray[i][j]));
77584 : }
77585 : }
77586 : }
77587 :
77588 : // Iterate over the saved list
77589 70 : size_t nodeListSize = nodeList.size();
77590 190 : for (size_t i=0; i < nodeListSize; i++)
77591 : {
77592 120 : ROSE_ASSERT(nodeList[i] != NULL);
77593 : #if 0
77594 : traversal.visit(nodeList[i]);
77595 : #else
77596 120 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
77597 : {
77598 120 : traversal.visit(nodeList[i]);
77599 : }
77600 : #endif
77601 : }
77602 : #endif
77603 : }
77604 :
77605 : // This should not be required since all previously static data members are
77606 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
77607 :
77608 5342 : }
77609 :
77610 :
77611 : void
77612 194 : SgLabelStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
77613 : {
77614 : // This function traverses the memory pool for an IR node and
77615 : // calls the function to execute the visitor object.
77616 :
77617 : // Initialize array to the address of the first element of the STL vector
77618 : // (which is guarenteed to be contiguous storage).
77619 : // SgLabelStatement objectArray [] = *(Memory_Block_List.begin());
77620 194 : if (SgLabelStatement::pools.empty() == false)
77621 : {
77622 : // Generate an array of memory pools
77623 18 : SgLabelStatement** objectArray = (SgLabelStatement**) &(SgLabelStatement::pools[0]);
77624 :
77625 : // Build a local variable for better performance
77626 18 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
77627 :
77628 : // Iterate over the memory pools
77629 36 : for (unsigned int i=0; i < SgLabelStatement::pools.size(); i++)
77630 : {
77631 : // objectArray[i] is a single memory pool
77632 36018 : for (unsigned j=0; j < SgLabelStatement::pool_size; j++)
77633 : {
77634 36000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
77635 : {
77636 : // printf ("Found a valid SgLabelStatement object in the memory pool %d at position %d \n",i,j);
77637 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
77638 36 : objectArray[i][j].executeVisitorMemberFunction(visitor);
77639 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
77640 : }
77641 : else
77642 : {
77643 : // printf ("Found a INVALID SgLabelStatement object in the memory pool \n");
77644 : }
77645 : }
77646 : }
77647 : }
77648 :
77649 : // This should not be required since all previously static data members are
77650 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
77651 :
77652 194 : }
77653 :
77654 : void
77655 0 : SgLabelStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
77656 : {
77657 : // This function visits only a single IR node of the memory pool.
77658 : // it is typically called once for each type of IR node within
77659 : // the automatically generated function: traverseRepresentativeNodes().
77660 :
77661 : // Initialize array to the address of the first element of the STL vector
77662 : // (which is guarenteed to be contiguous storage).
77663 : // SgLabelStatement objectArray [] = *(Memory_Block_List.begin());
77664 0 : if (SgLabelStatement::pools.empty() == false)
77665 : {
77666 : // Generate an array of memory pools
77667 0 : SgLabelStatement** objectArray = (SgLabelStatement**) &(SgLabelStatement::pools[0]);
77668 :
77669 : // Build a local variable for better performance
77670 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
77671 :
77672 : // Iterate over the memory pools
77673 0 : bool done = false;
77674 0 : unsigned i=0;
77675 :
77676 : // find the first valid IR node, call visit function, and then leave
77677 0 : while ( done == false && i < SgLabelStatement::pools.size() )
77678 : {
77679 : // objectArray[i] is a single memory pool
77680 : unsigned j=0;
77681 0 : while (done == false && j < SgLabelStatement::pool_size)
77682 : {
77683 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
77684 : {
77685 0 : traversal.visit(&(objectArray[i][j]));
77686 0 : done = true;
77687 : }
77688 0 : j++;
77689 : }
77690 0 : i++;
77691 : }
77692 :
77693 : #if 0
77694 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
77695 : if (done == false)
77696 : {
77697 : printf ("No representative for SgLabelStatement found in memory pools \n");
77698 : }
77699 : #endif
77700 : }
77701 0 : }
77702 :
77703 :
77704 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
77705 : // using values that overflow signed values of int.
77706 : size_t
77707 4 : SgLabelStatement::numberOfNodes()
77708 : {
77709 : // This function traverses the memory pool for an IR node and
77710 : // counts the number of IR nodes of a particular Sage III IR
77711 : // nodes type.
77712 :
77713 4 : size_t count = 0;
77714 4 : if (SgLabelStatement::pools.empty() == false)
77715 : {
77716 : // Generate an array of memory pools (this is actually a STL vector,
77717 : // but it is contiguious, so OK to treat this way).
77718 0 : SgLabelStatement** objectArray = (SgLabelStatement**) &(SgLabelStatement::pools[0]);
77719 :
77720 : // Build a local variable for better performance (make it a loop invariant variable).
77721 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
77722 :
77723 : // Iterate over all of the memory pools for this IR node.
77724 0 : for (unsigned int i=0; i < SgLabelStatement::pools.size(); i++)
77725 : {
77726 : // objectArray[i] is a single memory pool, iterate over all the
77727 : // IR nodes and only count those that are valid IR nodes used in
77728 : // the AST (i.e. allocated IR nodes).
77729 0 : for (unsigned j=0; j < SgLabelStatement::pool_size; j++)
77730 : {
77731 : // This is indexing the STL vector of C/C++ style arrays as a doubly
77732 : // indexed array access. It is OK since we have leveraged the semantics
77733 : // of STL vector memory as contigous and cast the memory as an array
77734 : // of arrays to use the 2D array indexing. Hope this is not confusing,
77735 : // but it s very fast as an implementation.
77736 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
77737 : {
77738 0 : count++;
77739 : }
77740 : }
77741 : }
77742 : }
77743 :
77744 :
77745 :
77746 4 : return count;
77747 : }
77748 :
77749 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
77750 : // using values that overflow signed values of int.
77751 : size_t
77752 0 : SgLabelStatement::memoryUsage()
77753 : {
77754 : // This function is required because we need the class name as a type when we call sizeof
77755 : // There might be another way to implement this if we have a traversal that only called a
77756 : // representative object (one call for each type of Sage IIIIR node).
77757 0 : size_t memory = numberOfNodes() * sizeof(SgLabelStatement);
77758 :
77759 0 : return memory;
77760 : }
77761 :
77762 : /* #line 77763 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
77763 :
77764 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
77765 : void
77766 5342 : SgCaseOptionStmt::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
77767 : {
77768 : // This function traverses the memory pool for only a specific IR node
77769 : // and calls the visit function of the input class execute a traversal
77770 : // similar to the style of the attribute based traversals within ROSE.
77771 : // This traversal will visit ALL nodes of the AST where as the other
77772 : // attribute based traversals visit only the embedded tree within the AST.
77773 :
77774 : // Initialize array to the address of the first element of the STL vector
77775 : // (which is guaranteed to be contiguous storage).
77776 : // SgCaseOptionStmt objectArray [] = *(Memory_Block_List.begin());
77777 5342 : if (SgCaseOptionStmt::pools.empty() == false)
77778 : {
77779 : // Generate an array of memory pools
77780 9 : SgCaseOptionStmt** objectArray = (SgCaseOptionStmt**) &(SgCaseOptionStmt::pools[0]);
77781 :
77782 : // Build a local variable for better performance
77783 9 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
77784 : #if 0
77785 : // Iterate over the memory pools
77786 : for (unsigned int i=0; i < SgCaseOptionStmt::pools.size(); i++)
77787 : {
77788 : // objectArray[i] is a single memory pool
77789 : for (int j=0; j < SgCaseOptionStmt::pool_size; j++)
77790 : {
77791 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
77792 : {
77793 : traversal.visit(&(objectArray[i][j]));
77794 : }
77795 : }
77796 : }
77797 : #else
77798 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
77799 : // compute the list first and then call the visit function on each list element.
77800 :
77801 : // printf ("Inside of SgCaseOptionStmt::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
77802 :
77803 18 : std::vector<SgCaseOptionStmt*> nodeList;
77804 :
77805 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
77806 18 : for (unsigned int i=0; i < SgCaseOptionStmt::pools.size(); i++)
77807 : {
77808 : // objectArray[i] is a single memory pool
77809 18009 : for (unsigned j=0; j < SgCaseOptionStmt::pool_size; j++)
77810 : {
77811 18000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
77812 : {
77813 9 : nodeList.push_back(&(objectArray[i][j]));
77814 : }
77815 : }
77816 : }
77817 :
77818 : // Iterate over the saved list
77819 9 : size_t nodeListSize = nodeList.size();
77820 18 : for (size_t i=0; i < nodeListSize; i++)
77821 : {
77822 9 : ROSE_ASSERT(nodeList[i] != NULL);
77823 : #if 0
77824 : traversal.visit(nodeList[i]);
77825 : #else
77826 9 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
77827 : {
77828 9 : traversal.visit(nodeList[i]);
77829 : }
77830 : #endif
77831 : }
77832 : #endif
77833 : }
77834 :
77835 : // This should not be required since all previously static data members are
77836 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
77837 :
77838 5342 : }
77839 :
77840 :
77841 : void
77842 194 : SgCaseOptionStmt::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
77843 : {
77844 : // This function traverses the memory pool for an IR node and
77845 : // calls the function to execute the visitor object.
77846 :
77847 : // Initialize array to the address of the first element of the STL vector
77848 : // (which is guarenteed to be contiguous storage).
77849 : // SgCaseOptionStmt objectArray [] = *(Memory_Block_List.begin());
77850 194 : if (SgCaseOptionStmt::pools.empty() == false)
77851 : {
77852 : // Generate an array of memory pools
77853 18 : SgCaseOptionStmt** objectArray = (SgCaseOptionStmt**) &(SgCaseOptionStmt::pools[0]);
77854 :
77855 : // Build a local variable for better performance
77856 18 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
77857 :
77858 : // Iterate over the memory pools
77859 36 : for (unsigned int i=0; i < SgCaseOptionStmt::pools.size(); i++)
77860 : {
77861 : // objectArray[i] is a single memory pool
77862 36018 : for (unsigned j=0; j < SgCaseOptionStmt::pool_size; j++)
77863 : {
77864 36000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
77865 : {
77866 : // printf ("Found a valid SgCaseOptionStmt object in the memory pool %d at position %d \n",i,j);
77867 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
77868 18 : objectArray[i][j].executeVisitorMemberFunction(visitor);
77869 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
77870 : }
77871 : else
77872 : {
77873 : // printf ("Found a INVALID SgCaseOptionStmt object in the memory pool \n");
77874 : }
77875 : }
77876 : }
77877 : }
77878 :
77879 : // This should not be required since all previously static data members are
77880 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
77881 :
77882 194 : }
77883 :
77884 : void
77885 0 : SgCaseOptionStmt::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
77886 : {
77887 : // This function visits only a single IR node of the memory pool.
77888 : // it is typically called once for each type of IR node within
77889 : // the automatically generated function: traverseRepresentativeNodes().
77890 :
77891 : // Initialize array to the address of the first element of the STL vector
77892 : // (which is guarenteed to be contiguous storage).
77893 : // SgCaseOptionStmt objectArray [] = *(Memory_Block_List.begin());
77894 0 : if (SgCaseOptionStmt::pools.empty() == false)
77895 : {
77896 : // Generate an array of memory pools
77897 0 : SgCaseOptionStmt** objectArray = (SgCaseOptionStmt**) &(SgCaseOptionStmt::pools[0]);
77898 :
77899 : // Build a local variable for better performance
77900 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
77901 :
77902 : // Iterate over the memory pools
77903 0 : bool done = false;
77904 0 : unsigned i=0;
77905 :
77906 : // find the first valid IR node, call visit function, and then leave
77907 0 : while ( done == false && i < SgCaseOptionStmt::pools.size() )
77908 : {
77909 : // objectArray[i] is a single memory pool
77910 : unsigned j=0;
77911 0 : while (done == false && j < SgCaseOptionStmt::pool_size)
77912 : {
77913 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
77914 : {
77915 0 : traversal.visit(&(objectArray[i][j]));
77916 0 : done = true;
77917 : }
77918 0 : j++;
77919 : }
77920 0 : i++;
77921 : }
77922 :
77923 : #if 0
77924 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
77925 : if (done == false)
77926 : {
77927 : printf ("No representative for SgCaseOptionStmt found in memory pools \n");
77928 : }
77929 : #endif
77930 : }
77931 0 : }
77932 :
77933 :
77934 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
77935 : // using values that overflow signed values of int.
77936 : size_t
77937 4 : SgCaseOptionStmt::numberOfNodes()
77938 : {
77939 : // This function traverses the memory pool for an IR node and
77940 : // counts the number of IR nodes of a particular Sage III IR
77941 : // nodes type.
77942 :
77943 4 : size_t count = 0;
77944 4 : if (SgCaseOptionStmt::pools.empty() == false)
77945 : {
77946 : // Generate an array of memory pools (this is actually a STL vector,
77947 : // but it is contiguious, so OK to treat this way).
77948 0 : SgCaseOptionStmt** objectArray = (SgCaseOptionStmt**) &(SgCaseOptionStmt::pools[0]);
77949 :
77950 : // Build a local variable for better performance (make it a loop invariant variable).
77951 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
77952 :
77953 : // Iterate over all of the memory pools for this IR node.
77954 0 : for (unsigned int i=0; i < SgCaseOptionStmt::pools.size(); i++)
77955 : {
77956 : // objectArray[i] is a single memory pool, iterate over all the
77957 : // IR nodes and only count those that are valid IR nodes used in
77958 : // the AST (i.e. allocated IR nodes).
77959 0 : for (unsigned j=0; j < SgCaseOptionStmt::pool_size; j++)
77960 : {
77961 : // This is indexing the STL vector of C/C++ style arrays as a doubly
77962 : // indexed array access. It is OK since we have leveraged the semantics
77963 : // of STL vector memory as contigous and cast the memory as an array
77964 : // of arrays to use the 2D array indexing. Hope this is not confusing,
77965 : // but it s very fast as an implementation.
77966 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
77967 : {
77968 0 : count++;
77969 : }
77970 : }
77971 : }
77972 : }
77973 :
77974 :
77975 :
77976 4 : return count;
77977 : }
77978 :
77979 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
77980 : // using values that overflow signed values of int.
77981 : size_t
77982 0 : SgCaseOptionStmt::memoryUsage()
77983 : {
77984 : // This function is required because we need the class name as a type when we call sizeof
77985 : // There might be another way to implement this if we have a traversal that only called a
77986 : // representative object (one call for each type of Sage IIIIR node).
77987 0 : size_t memory = numberOfNodes() * sizeof(SgCaseOptionStmt);
77988 :
77989 0 : return memory;
77990 : }
77991 :
77992 : /* #line 77993 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
77993 :
77994 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
77995 : void
77996 5342 : SgTryStmt::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
77997 : {
77998 : // This function traverses the memory pool for only a specific IR node
77999 : // and calls the visit function of the input class execute a traversal
78000 : // similar to the style of the attribute based traversals within ROSE.
78001 : // This traversal will visit ALL nodes of the AST where as the other
78002 : // attribute based traversals visit only the embedded tree within the AST.
78003 :
78004 : // Initialize array to the address of the first element of the STL vector
78005 : // (which is guaranteed to be contiguous storage).
78006 : // SgTryStmt objectArray [] = *(Memory_Block_List.begin());
78007 5342 : if (SgTryStmt::pools.empty() == false)
78008 : {
78009 : // Generate an array of memory pools
78010 138 : SgTryStmt** objectArray = (SgTryStmt**) &(SgTryStmt::pools[0]);
78011 :
78012 : // Build a local variable for better performance
78013 138 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
78014 : #if 0
78015 : // Iterate over the memory pools
78016 : for (unsigned int i=0; i < SgTryStmt::pools.size(); i++)
78017 : {
78018 : // objectArray[i] is a single memory pool
78019 : for (int j=0; j < SgTryStmt::pool_size; j++)
78020 : {
78021 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
78022 : {
78023 : traversal.visit(&(objectArray[i][j]));
78024 : }
78025 : }
78026 : }
78027 : #else
78028 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
78029 : // compute the list first and then call the visit function on each list element.
78030 :
78031 : // printf ("Inside of SgTryStmt::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
78032 :
78033 276 : std::vector<SgTryStmt*> nodeList;
78034 :
78035 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
78036 276 : for (unsigned int i=0; i < SgTryStmt::pools.size(); i++)
78037 : {
78038 : // objectArray[i] is a single memory pool
78039 276138 : for (unsigned j=0; j < SgTryStmt::pool_size; j++)
78040 : {
78041 276000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
78042 : {
78043 7088 : nodeList.push_back(&(objectArray[i][j]));
78044 : }
78045 : }
78046 : }
78047 :
78048 : // Iterate over the saved list
78049 138 : size_t nodeListSize = nodeList.size();
78050 7226 : for (size_t i=0; i < nodeListSize; i++)
78051 : {
78052 7088 : ROSE_ASSERT(nodeList[i] != NULL);
78053 : #if 0
78054 : traversal.visit(nodeList[i]);
78055 : #else
78056 7088 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
78057 : {
78058 7088 : traversal.visit(nodeList[i]);
78059 : }
78060 : #endif
78061 : }
78062 : #endif
78063 : }
78064 :
78065 : // This should not be required since all previously static data members are
78066 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
78067 :
78068 5342 : }
78069 :
78070 :
78071 : void
78072 194 : SgTryStmt::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
78073 : {
78074 : // This function traverses the memory pool for an IR node and
78075 : // calls the function to execute the visitor object.
78076 :
78077 : // Initialize array to the address of the first element of the STL vector
78078 : // (which is guarenteed to be contiguous storage).
78079 : // SgTryStmt objectArray [] = *(Memory_Block_List.begin());
78080 194 : if (SgTryStmt::pools.empty() == false)
78081 : {
78082 : // Generate an array of memory pools
78083 137 : SgTryStmt** objectArray = (SgTryStmt**) &(SgTryStmt::pools[0]);
78084 :
78085 : // Build a local variable for better performance
78086 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
78087 :
78088 : // Iterate over the memory pools
78089 274 : for (unsigned int i=0; i < SgTryStmt::pools.size(); i++)
78090 : {
78091 : // objectArray[i] is a single memory pool
78092 274137 : for (unsigned j=0; j < SgTryStmt::pool_size; j++)
78093 : {
78094 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
78095 : {
78096 : // printf ("Found a valid SgTryStmt object in the memory pool %d at position %d \n",i,j);
78097 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
78098 7866 : objectArray[i][j].executeVisitorMemberFunction(visitor);
78099 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
78100 : }
78101 : else
78102 : {
78103 : // printf ("Found a INVALID SgTryStmt object in the memory pool \n");
78104 : }
78105 : }
78106 : }
78107 : }
78108 :
78109 : // This should not be required since all previously static data members are
78110 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
78111 :
78112 194 : }
78113 :
78114 : void
78115 0 : SgTryStmt::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
78116 : {
78117 : // This function visits only a single IR node of the memory pool.
78118 : // it is typically called once for each type of IR node within
78119 : // the automatically generated function: traverseRepresentativeNodes().
78120 :
78121 : // Initialize array to the address of the first element of the STL vector
78122 : // (which is guarenteed to be contiguous storage).
78123 : // SgTryStmt objectArray [] = *(Memory_Block_List.begin());
78124 0 : if (SgTryStmt::pools.empty() == false)
78125 : {
78126 : // Generate an array of memory pools
78127 0 : SgTryStmt** objectArray = (SgTryStmt**) &(SgTryStmt::pools[0]);
78128 :
78129 : // Build a local variable for better performance
78130 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
78131 :
78132 : // Iterate over the memory pools
78133 0 : bool done = false;
78134 0 : unsigned i=0;
78135 :
78136 : // find the first valid IR node, call visit function, and then leave
78137 0 : while ( done == false && i < SgTryStmt::pools.size() )
78138 : {
78139 : // objectArray[i] is a single memory pool
78140 : unsigned j=0;
78141 0 : while (done == false && j < SgTryStmt::pool_size)
78142 : {
78143 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
78144 : {
78145 0 : traversal.visit(&(objectArray[i][j]));
78146 0 : done = true;
78147 : }
78148 0 : j++;
78149 : }
78150 0 : i++;
78151 : }
78152 :
78153 : #if 0
78154 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
78155 : if (done == false)
78156 : {
78157 : printf ("No representative for SgTryStmt found in memory pools \n");
78158 : }
78159 : #endif
78160 : }
78161 0 : }
78162 :
78163 :
78164 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
78165 : // using values that overflow signed values of int.
78166 : size_t
78167 4 : SgTryStmt::numberOfNodes()
78168 : {
78169 : // This function traverses the memory pool for an IR node and
78170 : // counts the number of IR nodes of a particular Sage III IR
78171 : // nodes type.
78172 :
78173 4 : size_t count = 0;
78174 4 : if (SgTryStmt::pools.empty() == false)
78175 : {
78176 : // Generate an array of memory pools (this is actually a STL vector,
78177 : // but it is contiguious, so OK to treat this way).
78178 1 : SgTryStmt** objectArray = (SgTryStmt**) &(SgTryStmt::pools[0]);
78179 :
78180 : // Build a local variable for better performance (make it a loop invariant variable).
78181 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
78182 :
78183 : // Iterate over all of the memory pools for this IR node.
78184 2 : for (unsigned int i=0; i < SgTryStmt::pools.size(); i++)
78185 : {
78186 : // objectArray[i] is a single memory pool, iterate over all the
78187 : // IR nodes and only count those that are valid IR nodes used in
78188 : // the AST (i.e. allocated IR nodes).
78189 2001 : for (unsigned j=0; j < SgTryStmt::pool_size; j++)
78190 : {
78191 : // This is indexing the STL vector of C/C++ style arrays as a doubly
78192 : // indexed array access. It is OK since we have leveraged the semantics
78193 : // of STL vector memory as contigous and cast the memory as an array
78194 : // of arrays to use the 2D array indexing. Hope this is not confusing,
78195 : // but it s very fast as an implementation.
78196 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
78197 : {
78198 54 : count++;
78199 : }
78200 : }
78201 : }
78202 : }
78203 :
78204 :
78205 :
78206 4 : return count;
78207 : }
78208 :
78209 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
78210 : // using values that overflow signed values of int.
78211 : size_t
78212 0 : SgTryStmt::memoryUsage()
78213 : {
78214 : // This function is required because we need the class name as a type when we call sizeof
78215 : // There might be another way to implement this if we have a traversal that only called a
78216 : // representative object (one call for each type of Sage IIIIR node).
78217 0 : size_t memory = numberOfNodes() * sizeof(SgTryStmt);
78218 :
78219 0 : return memory;
78220 : }
78221 :
78222 : /* #line 78223 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
78223 :
78224 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
78225 : void
78226 5342 : SgDefaultOptionStmt::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
78227 : {
78228 : // This function traverses the memory pool for only a specific IR node
78229 : // and calls the visit function of the input class execute a traversal
78230 : // similar to the style of the attribute based traversals within ROSE.
78231 : // This traversal will visit ALL nodes of the AST where as the other
78232 : // attribute based traversals visit only the embedded tree within the AST.
78233 :
78234 : // Initialize array to the address of the first element of the STL vector
78235 : // (which is guaranteed to be contiguous storage).
78236 : // SgDefaultOptionStmt objectArray [] = *(Memory_Block_List.begin());
78237 5342 : if (SgDefaultOptionStmt::pools.empty() == false)
78238 : {
78239 : // Generate an array of memory pools
78240 9 : SgDefaultOptionStmt** objectArray = (SgDefaultOptionStmt**) &(SgDefaultOptionStmt::pools[0]);
78241 :
78242 : // Build a local variable for better performance
78243 9 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
78244 : #if 0
78245 : // Iterate over the memory pools
78246 : for (unsigned int i=0; i < SgDefaultOptionStmt::pools.size(); i++)
78247 : {
78248 : // objectArray[i] is a single memory pool
78249 : for (int j=0; j < SgDefaultOptionStmt::pool_size; j++)
78250 : {
78251 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
78252 : {
78253 : traversal.visit(&(objectArray[i][j]));
78254 : }
78255 : }
78256 : }
78257 : #else
78258 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
78259 : // compute the list first and then call the visit function on each list element.
78260 :
78261 : // printf ("Inside of SgDefaultOptionStmt::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
78262 :
78263 18 : std::vector<SgDefaultOptionStmt*> nodeList;
78264 :
78265 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
78266 18 : for (unsigned int i=0; i < SgDefaultOptionStmt::pools.size(); i++)
78267 : {
78268 : // objectArray[i] is a single memory pool
78269 18009 : for (unsigned j=0; j < SgDefaultOptionStmt::pool_size; j++)
78270 : {
78271 18000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
78272 : {
78273 9 : nodeList.push_back(&(objectArray[i][j]));
78274 : }
78275 : }
78276 : }
78277 :
78278 : // Iterate over the saved list
78279 9 : size_t nodeListSize = nodeList.size();
78280 18 : for (size_t i=0; i < nodeListSize; i++)
78281 : {
78282 9 : ROSE_ASSERT(nodeList[i] != NULL);
78283 : #if 0
78284 : traversal.visit(nodeList[i]);
78285 : #else
78286 9 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
78287 : {
78288 9 : traversal.visit(nodeList[i]);
78289 : }
78290 : #endif
78291 : }
78292 : #endif
78293 : }
78294 :
78295 : // This should not be required since all previously static data members are
78296 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
78297 :
78298 5342 : }
78299 :
78300 :
78301 : void
78302 194 : SgDefaultOptionStmt::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
78303 : {
78304 : // This function traverses the memory pool for an IR node and
78305 : // calls the function to execute the visitor object.
78306 :
78307 : // Initialize array to the address of the first element of the STL vector
78308 : // (which is guarenteed to be contiguous storage).
78309 : // SgDefaultOptionStmt objectArray [] = *(Memory_Block_List.begin());
78310 194 : if (SgDefaultOptionStmt::pools.empty() == false)
78311 : {
78312 : // Generate an array of memory pools
78313 18 : SgDefaultOptionStmt** objectArray = (SgDefaultOptionStmt**) &(SgDefaultOptionStmt::pools[0]);
78314 :
78315 : // Build a local variable for better performance
78316 18 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
78317 :
78318 : // Iterate over the memory pools
78319 36 : for (unsigned int i=0; i < SgDefaultOptionStmt::pools.size(); i++)
78320 : {
78321 : // objectArray[i] is a single memory pool
78322 36018 : for (unsigned j=0; j < SgDefaultOptionStmt::pool_size; j++)
78323 : {
78324 36000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
78325 : {
78326 : // printf ("Found a valid SgDefaultOptionStmt object in the memory pool %d at position %d \n",i,j);
78327 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
78328 18 : objectArray[i][j].executeVisitorMemberFunction(visitor);
78329 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
78330 : }
78331 : else
78332 : {
78333 : // printf ("Found a INVALID SgDefaultOptionStmt object in the memory pool \n");
78334 : }
78335 : }
78336 : }
78337 : }
78338 :
78339 : // This should not be required since all previously static data members are
78340 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
78341 :
78342 194 : }
78343 :
78344 : void
78345 0 : SgDefaultOptionStmt::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
78346 : {
78347 : // This function visits only a single IR node of the memory pool.
78348 : // it is typically called once for each type of IR node within
78349 : // the automatically generated function: traverseRepresentativeNodes().
78350 :
78351 : // Initialize array to the address of the first element of the STL vector
78352 : // (which is guarenteed to be contiguous storage).
78353 : // SgDefaultOptionStmt objectArray [] = *(Memory_Block_List.begin());
78354 0 : if (SgDefaultOptionStmt::pools.empty() == false)
78355 : {
78356 : // Generate an array of memory pools
78357 0 : SgDefaultOptionStmt** objectArray = (SgDefaultOptionStmt**) &(SgDefaultOptionStmt::pools[0]);
78358 :
78359 : // Build a local variable for better performance
78360 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
78361 :
78362 : // Iterate over the memory pools
78363 0 : bool done = false;
78364 0 : unsigned i=0;
78365 :
78366 : // find the first valid IR node, call visit function, and then leave
78367 0 : while ( done == false && i < SgDefaultOptionStmt::pools.size() )
78368 : {
78369 : // objectArray[i] is a single memory pool
78370 : unsigned j=0;
78371 0 : while (done == false && j < SgDefaultOptionStmt::pool_size)
78372 : {
78373 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
78374 : {
78375 0 : traversal.visit(&(objectArray[i][j]));
78376 0 : done = true;
78377 : }
78378 0 : j++;
78379 : }
78380 0 : i++;
78381 : }
78382 :
78383 : #if 0
78384 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
78385 : if (done == false)
78386 : {
78387 : printf ("No representative for SgDefaultOptionStmt found in memory pools \n");
78388 : }
78389 : #endif
78390 : }
78391 0 : }
78392 :
78393 :
78394 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
78395 : // using values that overflow signed values of int.
78396 : size_t
78397 4 : SgDefaultOptionStmt::numberOfNodes()
78398 : {
78399 : // This function traverses the memory pool for an IR node and
78400 : // counts the number of IR nodes of a particular Sage III IR
78401 : // nodes type.
78402 :
78403 4 : size_t count = 0;
78404 4 : if (SgDefaultOptionStmt::pools.empty() == false)
78405 : {
78406 : // Generate an array of memory pools (this is actually a STL vector,
78407 : // but it is contiguious, so OK to treat this way).
78408 0 : SgDefaultOptionStmt** objectArray = (SgDefaultOptionStmt**) &(SgDefaultOptionStmt::pools[0]);
78409 :
78410 : // Build a local variable for better performance (make it a loop invariant variable).
78411 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
78412 :
78413 : // Iterate over all of the memory pools for this IR node.
78414 0 : for (unsigned int i=0; i < SgDefaultOptionStmt::pools.size(); i++)
78415 : {
78416 : // objectArray[i] is a single memory pool, iterate over all the
78417 : // IR nodes and only count those that are valid IR nodes used in
78418 : // the AST (i.e. allocated IR nodes).
78419 0 : for (unsigned j=0; j < SgDefaultOptionStmt::pool_size; j++)
78420 : {
78421 : // This is indexing the STL vector of C/C++ style arrays as a doubly
78422 : // indexed array access. It is OK since we have leveraged the semantics
78423 : // of STL vector memory as contigous and cast the memory as an array
78424 : // of arrays to use the 2D array indexing. Hope this is not confusing,
78425 : // but it s very fast as an implementation.
78426 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
78427 : {
78428 0 : count++;
78429 : }
78430 : }
78431 : }
78432 : }
78433 :
78434 :
78435 :
78436 4 : return count;
78437 : }
78438 :
78439 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
78440 : // using values that overflow signed values of int.
78441 : size_t
78442 0 : SgDefaultOptionStmt::memoryUsage()
78443 : {
78444 : // This function is required because we need the class name as a type when we call sizeof
78445 : // There might be another way to implement this if we have a traversal that only called a
78446 : // representative object (one call for each type of Sage IIIIR node).
78447 0 : size_t memory = numberOfNodes() * sizeof(SgDefaultOptionStmt);
78448 :
78449 0 : return memory;
78450 : }
78451 :
78452 : /* #line 78453 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
78453 :
78454 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
78455 : void
78456 5342 : SgBreakStmt::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
78457 : {
78458 : // This function traverses the memory pool for only a specific IR node
78459 : // and calls the visit function of the input class execute a traversal
78460 : // similar to the style of the attribute based traversals within ROSE.
78461 : // This traversal will visit ALL nodes of the AST where as the other
78462 : // attribute based traversals visit only the embedded tree within the AST.
78463 :
78464 : // Initialize array to the address of the first element of the STL vector
78465 : // (which is guaranteed to be contiguous storage).
78466 : // SgBreakStmt objectArray [] = *(Memory_Block_List.begin());
78467 5342 : if (SgBreakStmt::pools.empty() == false)
78468 : {
78469 : // Generate an array of memory pools
78470 115 : SgBreakStmt** objectArray = (SgBreakStmt**) &(SgBreakStmt::pools[0]);
78471 :
78472 : // Build a local variable for better performance
78473 115 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
78474 : #if 0
78475 : // Iterate over the memory pools
78476 : for (unsigned int i=0; i < SgBreakStmt::pools.size(); i++)
78477 : {
78478 : // objectArray[i] is a single memory pool
78479 : for (int j=0; j < SgBreakStmt::pool_size; j++)
78480 : {
78481 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
78482 : {
78483 : traversal.visit(&(objectArray[i][j]));
78484 : }
78485 : }
78486 : }
78487 : #else
78488 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
78489 : // compute the list first and then call the visit function on each list element.
78490 :
78491 : // printf ("Inside of SgBreakStmt::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
78492 :
78493 230 : std::vector<SgBreakStmt*> nodeList;
78494 :
78495 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
78496 230 : for (unsigned int i=0; i < SgBreakStmt::pools.size(); i++)
78497 : {
78498 : // objectArray[i] is a single memory pool
78499 230115 : for (unsigned j=0; j < SgBreakStmt::pool_size; j++)
78500 : {
78501 230000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
78502 : {
78503 3468 : nodeList.push_back(&(objectArray[i][j]));
78504 : }
78505 : }
78506 : }
78507 :
78508 : // Iterate over the saved list
78509 115 : size_t nodeListSize = nodeList.size();
78510 3583 : for (size_t i=0; i < nodeListSize; i++)
78511 : {
78512 3468 : ROSE_ASSERT(nodeList[i] != NULL);
78513 : #if 0
78514 : traversal.visit(nodeList[i]);
78515 : #else
78516 3468 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
78517 : {
78518 3468 : traversal.visit(nodeList[i]);
78519 : }
78520 : #endif
78521 : }
78522 : #endif
78523 : }
78524 :
78525 : // This should not be required since all previously static data members are
78526 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
78527 :
78528 5342 : }
78529 :
78530 :
78531 : void
78532 194 : SgBreakStmt::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
78533 : {
78534 : // This function traverses the memory pool for an IR node and
78535 : // calls the function to execute the visitor object.
78536 :
78537 : // Initialize array to the address of the first element of the STL vector
78538 : // (which is guarenteed to be contiguous storage).
78539 : // SgBreakStmt objectArray [] = *(Memory_Block_List.begin());
78540 194 : if (SgBreakStmt::pools.empty() == false)
78541 : {
78542 : // Generate an array of memory pools
78543 137 : SgBreakStmt** objectArray = (SgBreakStmt**) &(SgBreakStmt::pools[0]);
78544 :
78545 : // Build a local variable for better performance
78546 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
78547 :
78548 : // Iterate over the memory pools
78549 274 : for (unsigned int i=0; i < SgBreakStmt::pools.size(); i++)
78550 : {
78551 : // objectArray[i] is a single memory pool
78552 274137 : for (unsigned j=0; j < SgBreakStmt::pool_size; j++)
78553 : {
78554 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
78555 : {
78556 : // printf ("Found a valid SgBreakStmt object in the memory pool %d at position %d \n",i,j);
78557 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
78558 4146 : objectArray[i][j].executeVisitorMemberFunction(visitor);
78559 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
78560 : }
78561 : else
78562 : {
78563 : // printf ("Found a INVALID SgBreakStmt object in the memory pool \n");
78564 : }
78565 : }
78566 : }
78567 : }
78568 :
78569 : // This should not be required since all previously static data members are
78570 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
78571 :
78572 194 : }
78573 :
78574 : void
78575 0 : SgBreakStmt::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
78576 : {
78577 : // This function visits only a single IR node of the memory pool.
78578 : // it is typically called once for each type of IR node within
78579 : // the automatically generated function: traverseRepresentativeNodes().
78580 :
78581 : // Initialize array to the address of the first element of the STL vector
78582 : // (which is guarenteed to be contiguous storage).
78583 : // SgBreakStmt objectArray [] = *(Memory_Block_List.begin());
78584 0 : if (SgBreakStmt::pools.empty() == false)
78585 : {
78586 : // Generate an array of memory pools
78587 0 : SgBreakStmt** objectArray = (SgBreakStmt**) &(SgBreakStmt::pools[0]);
78588 :
78589 : // Build a local variable for better performance
78590 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
78591 :
78592 : // Iterate over the memory pools
78593 0 : bool done = false;
78594 0 : unsigned i=0;
78595 :
78596 : // find the first valid IR node, call visit function, and then leave
78597 0 : while ( done == false && i < SgBreakStmt::pools.size() )
78598 : {
78599 : // objectArray[i] is a single memory pool
78600 : unsigned j=0;
78601 0 : while (done == false && j < SgBreakStmt::pool_size)
78602 : {
78603 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
78604 : {
78605 0 : traversal.visit(&(objectArray[i][j]));
78606 0 : done = true;
78607 : }
78608 0 : j++;
78609 : }
78610 0 : i++;
78611 : }
78612 :
78613 : #if 0
78614 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
78615 : if (done == false)
78616 : {
78617 : printf ("No representative for SgBreakStmt found in memory pools \n");
78618 : }
78619 : #endif
78620 : }
78621 0 : }
78622 :
78623 :
78624 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
78625 : // using values that overflow signed values of int.
78626 : size_t
78627 4 : SgBreakStmt::numberOfNodes()
78628 : {
78629 : // This function traverses the memory pool for an IR node and
78630 : // counts the number of IR nodes of a particular Sage III IR
78631 : // nodes type.
78632 :
78633 4 : size_t count = 0;
78634 4 : if (SgBreakStmt::pools.empty() == false)
78635 : {
78636 : // Generate an array of memory pools (this is actually a STL vector,
78637 : // but it is contiguious, so OK to treat this way).
78638 1 : SgBreakStmt** objectArray = (SgBreakStmt**) &(SgBreakStmt::pools[0]);
78639 :
78640 : // Build a local variable for better performance (make it a loop invariant variable).
78641 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
78642 :
78643 : // Iterate over all of the memory pools for this IR node.
78644 2 : for (unsigned int i=0; i < SgBreakStmt::pools.size(); i++)
78645 : {
78646 : // objectArray[i] is a single memory pool, iterate over all the
78647 : // IR nodes and only count those that are valid IR nodes used in
78648 : // the AST (i.e. allocated IR nodes).
78649 2001 : for (unsigned j=0; j < SgBreakStmt::pool_size; j++)
78650 : {
78651 : // This is indexing the STL vector of C/C++ style arrays as a doubly
78652 : // indexed array access. It is OK since we have leveraged the semantics
78653 : // of STL vector memory as contigous and cast the memory as an array
78654 : // of arrays to use the 2D array indexing. Hope this is not confusing,
78655 : // but it s very fast as an implementation.
78656 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
78657 : {
78658 30 : count++;
78659 : }
78660 : }
78661 : }
78662 : }
78663 :
78664 :
78665 :
78666 4 : return count;
78667 : }
78668 :
78669 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
78670 : // using values that overflow signed values of int.
78671 : size_t
78672 0 : SgBreakStmt::memoryUsage()
78673 : {
78674 : // This function is required because we need the class name as a type when we call sizeof
78675 : // There might be another way to implement this if we have a traversal that only called a
78676 : // representative object (one call for each type of Sage IIIIR node).
78677 0 : size_t memory = numberOfNodes() * sizeof(SgBreakStmt);
78678 :
78679 0 : return memory;
78680 : }
78681 :
78682 : /* #line 78683 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
78683 :
78684 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
78685 : void
78686 5342 : SgContinueStmt::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
78687 : {
78688 : // This function traverses the memory pool for only a specific IR node
78689 : // and calls the visit function of the input class execute a traversal
78690 : // similar to the style of the attribute based traversals within ROSE.
78691 : // This traversal will visit ALL nodes of the AST where as the other
78692 : // attribute based traversals visit only the embedded tree within the AST.
78693 :
78694 : // Initialize array to the address of the first element of the STL vector
78695 : // (which is guaranteed to be contiguous storage).
78696 : // SgContinueStmt objectArray [] = *(Memory_Block_List.begin());
78697 5342 : if (SgContinueStmt::pools.empty() == false)
78698 : {
78699 : // Generate an array of memory pools
78700 115 : SgContinueStmt** objectArray = (SgContinueStmt**) &(SgContinueStmt::pools[0]);
78701 :
78702 : // Build a local variable for better performance
78703 115 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
78704 : #if 0
78705 : // Iterate over the memory pools
78706 : for (unsigned int i=0; i < SgContinueStmt::pools.size(); i++)
78707 : {
78708 : // objectArray[i] is a single memory pool
78709 : for (int j=0; j < SgContinueStmt::pool_size; j++)
78710 : {
78711 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
78712 : {
78713 : traversal.visit(&(objectArray[i][j]));
78714 : }
78715 : }
78716 : }
78717 : #else
78718 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
78719 : // compute the list first and then call the visit function on each list element.
78720 :
78721 : // printf ("Inside of SgContinueStmt::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
78722 :
78723 230 : std::vector<SgContinueStmt*> nodeList;
78724 :
78725 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
78726 230 : for (unsigned int i=0; i < SgContinueStmt::pools.size(); i++)
78727 : {
78728 : // objectArray[i] is a single memory pool
78729 230115 : for (unsigned j=0; j < SgContinueStmt::pool_size; j++)
78730 : {
78731 230000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
78732 : {
78733 230 : nodeList.push_back(&(objectArray[i][j]));
78734 : }
78735 : }
78736 : }
78737 :
78738 : // Iterate over the saved list
78739 115 : size_t nodeListSize = nodeList.size();
78740 345 : for (size_t i=0; i < nodeListSize; i++)
78741 : {
78742 230 : ROSE_ASSERT(nodeList[i] != NULL);
78743 : #if 0
78744 : traversal.visit(nodeList[i]);
78745 : #else
78746 230 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
78747 : {
78748 230 : traversal.visit(nodeList[i]);
78749 : }
78750 : #endif
78751 : }
78752 : #endif
78753 : }
78754 :
78755 : // This should not be required since all previously static data members are
78756 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
78757 :
78758 5342 : }
78759 :
78760 :
78761 : void
78762 194 : SgContinueStmt::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
78763 : {
78764 : // This function traverses the memory pool for an IR node and
78765 : // calls the function to execute the visitor object.
78766 :
78767 : // Initialize array to the address of the first element of the STL vector
78768 : // (which is guarenteed to be contiguous storage).
78769 : // SgContinueStmt objectArray [] = *(Memory_Block_List.begin());
78770 194 : if (SgContinueStmt::pools.empty() == false)
78771 : {
78772 : // Generate an array of memory pools
78773 137 : SgContinueStmt** objectArray = (SgContinueStmt**) &(SgContinueStmt::pools[0]);
78774 :
78775 : // Build a local variable for better performance
78776 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
78777 :
78778 : // Iterate over the memory pools
78779 274 : for (unsigned int i=0; i < SgContinueStmt::pools.size(); i++)
78780 : {
78781 : // objectArray[i] is a single memory pool
78782 274137 : for (unsigned j=0; j < SgContinueStmt::pool_size; j++)
78783 : {
78784 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
78785 : {
78786 : // printf ("Found a valid SgContinueStmt object in the memory pool %d at position %d \n",i,j);
78787 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
78788 274 : objectArray[i][j].executeVisitorMemberFunction(visitor);
78789 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
78790 : }
78791 : else
78792 : {
78793 : // printf ("Found a INVALID SgContinueStmt object in the memory pool \n");
78794 : }
78795 : }
78796 : }
78797 : }
78798 :
78799 : // This should not be required since all previously static data members are
78800 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
78801 :
78802 194 : }
78803 :
78804 : void
78805 0 : SgContinueStmt::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
78806 : {
78807 : // This function visits only a single IR node of the memory pool.
78808 : // it is typically called once for each type of IR node within
78809 : // the automatically generated function: traverseRepresentativeNodes().
78810 :
78811 : // Initialize array to the address of the first element of the STL vector
78812 : // (which is guarenteed to be contiguous storage).
78813 : // SgContinueStmt objectArray [] = *(Memory_Block_List.begin());
78814 0 : if (SgContinueStmt::pools.empty() == false)
78815 : {
78816 : // Generate an array of memory pools
78817 0 : SgContinueStmt** objectArray = (SgContinueStmt**) &(SgContinueStmt::pools[0]);
78818 :
78819 : // Build a local variable for better performance
78820 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
78821 :
78822 : // Iterate over the memory pools
78823 0 : bool done = false;
78824 0 : unsigned i=0;
78825 :
78826 : // find the first valid IR node, call visit function, and then leave
78827 0 : while ( done == false && i < SgContinueStmt::pools.size() )
78828 : {
78829 : // objectArray[i] is a single memory pool
78830 : unsigned j=0;
78831 0 : while (done == false && j < SgContinueStmt::pool_size)
78832 : {
78833 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
78834 : {
78835 0 : traversal.visit(&(objectArray[i][j]));
78836 0 : done = true;
78837 : }
78838 0 : j++;
78839 : }
78840 0 : i++;
78841 : }
78842 :
78843 : #if 0
78844 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
78845 : if (done == false)
78846 : {
78847 : printf ("No representative for SgContinueStmt found in memory pools \n");
78848 : }
78849 : #endif
78850 : }
78851 0 : }
78852 :
78853 :
78854 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
78855 : // using values that overflow signed values of int.
78856 : size_t
78857 4 : SgContinueStmt::numberOfNodes()
78858 : {
78859 : // This function traverses the memory pool for an IR node and
78860 : // counts the number of IR nodes of a particular Sage III IR
78861 : // nodes type.
78862 :
78863 4 : size_t count = 0;
78864 4 : if (SgContinueStmt::pools.empty() == false)
78865 : {
78866 : // Generate an array of memory pools (this is actually a STL vector,
78867 : // but it is contiguious, so OK to treat this way).
78868 1 : SgContinueStmt** objectArray = (SgContinueStmt**) &(SgContinueStmt::pools[0]);
78869 :
78870 : // Build a local variable for better performance (make it a loop invariant variable).
78871 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
78872 :
78873 : // Iterate over all of the memory pools for this IR node.
78874 2 : for (unsigned int i=0; i < SgContinueStmt::pools.size(); i++)
78875 : {
78876 : // objectArray[i] is a single memory pool, iterate over all the
78877 : // IR nodes and only count those that are valid IR nodes used in
78878 : // the AST (i.e. allocated IR nodes).
78879 2001 : for (unsigned j=0; j < SgContinueStmt::pool_size; j++)
78880 : {
78881 : // This is indexing the STL vector of C/C++ style arrays as a doubly
78882 : // indexed array access. It is OK since we have leveraged the semantics
78883 : // of STL vector memory as contigous and cast the memory as an array
78884 : // of arrays to use the 2D array indexing. Hope this is not confusing,
78885 : // but it s very fast as an implementation.
78886 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
78887 : {
78888 2 : count++;
78889 : }
78890 : }
78891 : }
78892 : }
78893 :
78894 :
78895 :
78896 4 : return count;
78897 : }
78898 :
78899 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
78900 : // using values that overflow signed values of int.
78901 : size_t
78902 0 : SgContinueStmt::memoryUsage()
78903 : {
78904 : // This function is required because we need the class name as a type when we call sizeof
78905 : // There might be another way to implement this if we have a traversal that only called a
78906 : // representative object (one call for each type of Sage IIIIR node).
78907 0 : size_t memory = numberOfNodes() * sizeof(SgContinueStmt);
78908 :
78909 0 : return memory;
78910 : }
78911 :
78912 : /* #line 78913 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
78913 :
78914 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
78915 : void
78916 5354 : SgReturnStmt::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
78917 : {
78918 : // This function traverses the memory pool for only a specific IR node
78919 : // and calls the visit function of the input class execute a traversal
78920 : // similar to the style of the attribute based traversals within ROSE.
78921 : // This traversal will visit ALL nodes of the AST where as the other
78922 : // attribute based traversals visit only the embedded tree within the AST.
78923 :
78924 : // Initialize array to the address of the first element of the STL vector
78925 : // (which is guaranteed to be contiguous storage).
78926 : // SgReturnStmt objectArray [] = *(Memory_Block_List.begin());
78927 5354 : if (SgReturnStmt::pools.empty() == false)
78928 : {
78929 : // Generate an array of memory pools
78930 3607 : SgReturnStmt** objectArray = (SgReturnStmt**) &(SgReturnStmt::pools[0]);
78931 :
78932 : // Build a local variable for better performance
78933 3607 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
78934 : #if 0
78935 : // Iterate over the memory pools
78936 : for (unsigned int i=0; i < SgReturnStmt::pools.size(); i++)
78937 : {
78938 : // objectArray[i] is a single memory pool
78939 : for (int j=0; j < SgReturnStmt::pool_size; j++)
78940 : {
78941 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
78942 : {
78943 : traversal.visit(&(objectArray[i][j]));
78944 : }
78945 : }
78946 : }
78947 : #else
78948 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
78949 : // compute the list first and then call the visit function on each list element.
78950 :
78951 : // printf ("Inside of SgReturnStmt::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
78952 :
78953 7214 : std::vector<SgReturnStmt*> nodeList;
78954 :
78955 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
78956 7214 : for (unsigned int i=0; i < SgReturnStmt::pools.size(); i++)
78957 : {
78958 : // objectArray[i] is a single memory pool
78959 7217610 : for (unsigned j=0; j < SgReturnStmt::pool_size; j++)
78960 : {
78961 7214000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
78962 : {
78963 200672 : nodeList.push_back(&(objectArray[i][j]));
78964 : }
78965 : }
78966 : }
78967 :
78968 : // Iterate over the saved list
78969 3607 : size_t nodeListSize = nodeList.size();
78970 204279 : for (size_t i=0; i < nodeListSize; i++)
78971 : {
78972 200672 : ROSE_ASSERT(nodeList[i] != NULL);
78973 : #if 0
78974 : traversal.visit(nodeList[i]);
78975 : #else
78976 200672 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
78977 : {
78978 200672 : traversal.visit(nodeList[i]);
78979 : }
78980 : #endif
78981 : }
78982 : #endif
78983 : }
78984 :
78985 : // This should not be required since all previously static data members are
78986 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
78987 :
78988 5354 : }
78989 :
78990 :
78991 : void
78992 194 : SgReturnStmt::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
78993 : {
78994 : // This function traverses the memory pool for an IR node and
78995 : // calls the function to execute the visitor object.
78996 :
78997 : // Initialize array to the address of the first element of the STL vector
78998 : // (which is guarenteed to be contiguous storage).
78999 : // SgReturnStmt objectArray [] = *(Memory_Block_List.begin());
79000 194 : if (SgReturnStmt::pools.empty() == false)
79001 : {
79002 : // Generate an array of memory pools
79003 192 : SgReturnStmt** objectArray = (SgReturnStmt**) &(SgReturnStmt::pools[0]);
79004 :
79005 : // Build a local variable for better performance
79006 192 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
79007 :
79008 : // Iterate over the memory pools
79009 384 : for (unsigned int i=0; i < SgReturnStmt::pools.size(); i++)
79010 : {
79011 : // objectArray[i] is a single memory pool
79012 384192 : for (unsigned j=0; j < SgReturnStmt::pool_size; j++)
79013 : {
79014 384000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
79015 : {
79016 : // printf ("Found a valid SgReturnStmt object in the memory pool %d at position %d \n",i,j);
79017 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
79018 195885 : objectArray[i][j].executeVisitorMemberFunction(visitor);
79019 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
79020 : }
79021 : else
79022 : {
79023 : // printf ("Found a INVALID SgReturnStmt object in the memory pool \n");
79024 : }
79025 : }
79026 : }
79027 : }
79028 :
79029 : // This should not be required since all previously static data members are
79030 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
79031 :
79032 194 : }
79033 :
79034 : void
79035 0 : SgReturnStmt::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
79036 : {
79037 : // This function visits only a single IR node of the memory pool.
79038 : // it is typically called once for each type of IR node within
79039 : // the automatically generated function: traverseRepresentativeNodes().
79040 :
79041 : // Initialize array to the address of the first element of the STL vector
79042 : // (which is guarenteed to be contiguous storage).
79043 : // SgReturnStmt objectArray [] = *(Memory_Block_List.begin());
79044 0 : if (SgReturnStmt::pools.empty() == false)
79045 : {
79046 : // Generate an array of memory pools
79047 0 : SgReturnStmt** objectArray = (SgReturnStmt**) &(SgReturnStmt::pools[0]);
79048 :
79049 : // Build a local variable for better performance
79050 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
79051 :
79052 : // Iterate over the memory pools
79053 0 : bool done = false;
79054 0 : unsigned i=0;
79055 :
79056 : // find the first valid IR node, call visit function, and then leave
79057 0 : while ( done == false && i < SgReturnStmt::pools.size() )
79058 : {
79059 : // objectArray[i] is a single memory pool
79060 : unsigned j=0;
79061 0 : while (done == false && j < SgReturnStmt::pool_size)
79062 : {
79063 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
79064 : {
79065 0 : traversal.visit(&(objectArray[i][j]));
79066 0 : done = true;
79067 : }
79068 0 : j++;
79069 : }
79070 0 : i++;
79071 : }
79072 :
79073 : #if 0
79074 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
79075 : if (done == false)
79076 : {
79077 : printf ("No representative for SgReturnStmt found in memory pools \n");
79078 : }
79079 : #endif
79080 : }
79081 0 : }
79082 :
79083 :
79084 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
79085 : // using values that overflow signed values of int.
79086 : size_t
79087 4 : SgReturnStmt::numberOfNodes()
79088 : {
79089 : // This function traverses the memory pool for an IR node and
79090 : // counts the number of IR nodes of a particular Sage III IR
79091 : // nodes type.
79092 :
79093 4 : size_t count = 0;
79094 4 : if (SgReturnStmt::pools.empty() == false)
79095 : {
79096 : // Generate an array of memory pools (this is actually a STL vector,
79097 : // but it is contiguious, so OK to treat this way).
79098 2 : SgReturnStmt** objectArray = (SgReturnStmt**) &(SgReturnStmt::pools[0]);
79099 :
79100 : // Build a local variable for better performance (make it a loop invariant variable).
79101 2 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
79102 :
79103 : // Iterate over all of the memory pools for this IR node.
79104 4 : for (unsigned int i=0; i < SgReturnStmt::pools.size(); i++)
79105 : {
79106 : // objectArray[i] is a single memory pool, iterate over all the
79107 : // IR nodes and only count those that are valid IR nodes used in
79108 : // the AST (i.e. allocated IR nodes).
79109 4002 : for (unsigned j=0; j < SgReturnStmt::pool_size; j++)
79110 : {
79111 : // This is indexing the STL vector of C/C++ style arrays as a doubly
79112 : // indexed array access. It is OK since we have leveraged the semantics
79113 : // of STL vector memory as contigous and cast the memory as an array
79114 : // of arrays to use the 2D array indexing. Hope this is not confusing,
79115 : // but it s very fast as an implementation.
79116 4000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
79117 : {
79118 1405 : count++;
79119 : }
79120 : }
79121 : }
79122 : }
79123 :
79124 :
79125 :
79126 4 : return count;
79127 : }
79128 :
79129 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
79130 : // using values that overflow signed values of int.
79131 : size_t
79132 0 : SgReturnStmt::memoryUsage()
79133 : {
79134 : // This function is required because we need the class name as a type when we call sizeof
79135 : // There might be another way to implement this if we have a traversal that only called a
79136 : // representative object (one call for each type of Sage IIIIR node).
79137 0 : size_t memory = numberOfNodes() * sizeof(SgReturnStmt);
79138 :
79139 0 : return memory;
79140 : }
79141 :
79142 : /* #line 79143 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
79143 :
79144 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
79145 : void
79146 5371 : SgGotoStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
79147 : {
79148 : // This function traverses the memory pool for only a specific IR node
79149 : // and calls the visit function of the input class execute a traversal
79150 : // similar to the style of the attribute based traversals within ROSE.
79151 : // This traversal will visit ALL nodes of the AST where as the other
79152 : // attribute based traversals visit only the embedded tree within the AST.
79153 :
79154 : // Initialize array to the address of the first element of the STL vector
79155 : // (which is guaranteed to be contiguous storage).
79156 : // SgGotoStatement objectArray [] = *(Memory_Block_List.begin());
79157 5371 : if (SgGotoStatement::pools.empty() == false)
79158 : {
79159 : // Generate an array of memory pools
79160 23 : SgGotoStatement** objectArray = (SgGotoStatement**) &(SgGotoStatement::pools[0]);
79161 :
79162 : // Build a local variable for better performance
79163 23 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
79164 : #if 0
79165 : // Iterate over the memory pools
79166 : for (unsigned int i=0; i < SgGotoStatement::pools.size(); i++)
79167 : {
79168 : // objectArray[i] is a single memory pool
79169 : for (int j=0; j < SgGotoStatement::pool_size; j++)
79170 : {
79171 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
79172 : {
79173 : traversal.visit(&(objectArray[i][j]));
79174 : }
79175 : }
79176 : }
79177 : #else
79178 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
79179 : // compute the list first and then call the visit function on each list element.
79180 :
79181 : // printf ("Inside of SgGotoStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
79182 :
79183 46 : std::vector<SgGotoStatement*> nodeList;
79184 :
79185 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
79186 46 : for (unsigned int i=0; i < SgGotoStatement::pools.size(); i++)
79187 : {
79188 : // objectArray[i] is a single memory pool
79189 46023 : for (unsigned j=0; j < SgGotoStatement::pool_size; j++)
79190 : {
79191 46000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
79192 : {
79193 30 : nodeList.push_back(&(objectArray[i][j]));
79194 : }
79195 : }
79196 : }
79197 :
79198 : // Iterate over the saved list
79199 23 : size_t nodeListSize = nodeList.size();
79200 53 : for (size_t i=0; i < nodeListSize; i++)
79201 : {
79202 30 : ROSE_ASSERT(nodeList[i] != NULL);
79203 : #if 0
79204 : traversal.visit(nodeList[i]);
79205 : #else
79206 30 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
79207 : {
79208 30 : traversal.visit(nodeList[i]);
79209 : }
79210 : #endif
79211 : }
79212 : #endif
79213 : }
79214 :
79215 : // This should not be required since all previously static data members are
79216 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
79217 :
79218 5371 : }
79219 :
79220 :
79221 : void
79222 194 : SgGotoStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
79223 : {
79224 : // This function traverses the memory pool for an IR node and
79225 : // calls the function to execute the visitor object.
79226 :
79227 : // Initialize array to the address of the first element of the STL vector
79228 : // (which is guarenteed to be contiguous storage).
79229 : // SgGotoStatement objectArray [] = *(Memory_Block_List.begin());
79230 194 : if (SgGotoStatement::pools.empty() == false)
79231 : {
79232 : // Generate an array of memory pools
79233 18 : SgGotoStatement** objectArray = (SgGotoStatement**) &(SgGotoStatement::pools[0]);
79234 :
79235 : // Build a local variable for better performance
79236 18 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
79237 :
79238 : // Iterate over the memory pools
79239 36 : for (unsigned int i=0; i < SgGotoStatement::pools.size(); i++)
79240 : {
79241 : // objectArray[i] is a single memory pool
79242 36018 : for (unsigned j=0; j < SgGotoStatement::pool_size; j++)
79243 : {
79244 36000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
79245 : {
79246 : // printf ("Found a valid SgGotoStatement object in the memory pool %d at position %d \n",i,j);
79247 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
79248 18 : objectArray[i][j].executeVisitorMemberFunction(visitor);
79249 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
79250 : }
79251 : else
79252 : {
79253 : // printf ("Found a INVALID SgGotoStatement object in the memory pool \n");
79254 : }
79255 : }
79256 : }
79257 : }
79258 :
79259 : // This should not be required since all previously static data members are
79260 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
79261 :
79262 194 : }
79263 :
79264 : void
79265 0 : SgGotoStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
79266 : {
79267 : // This function visits only a single IR node of the memory pool.
79268 : // it is typically called once for each type of IR node within
79269 : // the automatically generated function: traverseRepresentativeNodes().
79270 :
79271 : // Initialize array to the address of the first element of the STL vector
79272 : // (which is guarenteed to be contiguous storage).
79273 : // SgGotoStatement objectArray [] = *(Memory_Block_List.begin());
79274 0 : if (SgGotoStatement::pools.empty() == false)
79275 : {
79276 : // Generate an array of memory pools
79277 0 : SgGotoStatement** objectArray = (SgGotoStatement**) &(SgGotoStatement::pools[0]);
79278 :
79279 : // Build a local variable for better performance
79280 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
79281 :
79282 : // Iterate over the memory pools
79283 0 : bool done = false;
79284 0 : unsigned i=0;
79285 :
79286 : // find the first valid IR node, call visit function, and then leave
79287 0 : while ( done == false && i < SgGotoStatement::pools.size() )
79288 : {
79289 : // objectArray[i] is a single memory pool
79290 : unsigned j=0;
79291 0 : while (done == false && j < SgGotoStatement::pool_size)
79292 : {
79293 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
79294 : {
79295 0 : traversal.visit(&(objectArray[i][j]));
79296 0 : done = true;
79297 : }
79298 0 : j++;
79299 : }
79300 0 : i++;
79301 : }
79302 :
79303 : #if 0
79304 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
79305 : if (done == false)
79306 : {
79307 : printf ("No representative for SgGotoStatement found in memory pools \n");
79308 : }
79309 : #endif
79310 : }
79311 0 : }
79312 :
79313 :
79314 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
79315 : // using values that overflow signed values of int.
79316 : size_t
79317 4 : SgGotoStatement::numberOfNodes()
79318 : {
79319 : // This function traverses the memory pool for an IR node and
79320 : // counts the number of IR nodes of a particular Sage III IR
79321 : // nodes type.
79322 :
79323 4 : size_t count = 0;
79324 4 : if (SgGotoStatement::pools.empty() == false)
79325 : {
79326 : // Generate an array of memory pools (this is actually a STL vector,
79327 : // but it is contiguious, so OK to treat this way).
79328 0 : SgGotoStatement** objectArray = (SgGotoStatement**) &(SgGotoStatement::pools[0]);
79329 :
79330 : // Build a local variable for better performance (make it a loop invariant variable).
79331 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
79332 :
79333 : // Iterate over all of the memory pools for this IR node.
79334 0 : for (unsigned int i=0; i < SgGotoStatement::pools.size(); i++)
79335 : {
79336 : // objectArray[i] is a single memory pool, iterate over all the
79337 : // IR nodes and only count those that are valid IR nodes used in
79338 : // the AST (i.e. allocated IR nodes).
79339 0 : for (unsigned j=0; j < SgGotoStatement::pool_size; j++)
79340 : {
79341 : // This is indexing the STL vector of C/C++ style arrays as a doubly
79342 : // indexed array access. It is OK since we have leveraged the semantics
79343 : // of STL vector memory as contigous and cast the memory as an array
79344 : // of arrays to use the 2D array indexing. Hope this is not confusing,
79345 : // but it s very fast as an implementation.
79346 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
79347 : {
79348 0 : count++;
79349 : }
79350 : }
79351 : }
79352 : }
79353 :
79354 :
79355 :
79356 4 : return count;
79357 : }
79358 :
79359 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
79360 : // using values that overflow signed values of int.
79361 : size_t
79362 0 : SgGotoStatement::memoryUsage()
79363 : {
79364 : // This function is required because we need the class name as a type when we call sizeof
79365 : // There might be another way to implement this if we have a traversal that only called a
79366 : // representative object (one call for each type of Sage IIIIR node).
79367 0 : size_t memory = numberOfNodes() * sizeof(SgGotoStatement);
79368 :
79369 0 : return memory;
79370 : }
79371 :
79372 : /* #line 79373 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
79373 :
79374 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
79375 : void
79376 5342 : SgSpawnStmt::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
79377 : {
79378 : // This function traverses the memory pool for only a specific IR node
79379 : // and calls the visit function of the input class execute a traversal
79380 : // similar to the style of the attribute based traversals within ROSE.
79381 : // This traversal will visit ALL nodes of the AST where as the other
79382 : // attribute based traversals visit only the embedded tree within the AST.
79383 :
79384 : // Initialize array to the address of the first element of the STL vector
79385 : // (which is guaranteed to be contiguous storage).
79386 : // SgSpawnStmt objectArray [] = *(Memory_Block_List.begin());
79387 5342 : if (SgSpawnStmt::pools.empty() == false)
79388 : {
79389 : // Generate an array of memory pools
79390 0 : SgSpawnStmt** objectArray = (SgSpawnStmt**) &(SgSpawnStmt::pools[0]);
79391 :
79392 : // Build a local variable for better performance
79393 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
79394 : #if 0
79395 : // Iterate over the memory pools
79396 : for (unsigned int i=0; i < SgSpawnStmt::pools.size(); i++)
79397 : {
79398 : // objectArray[i] is a single memory pool
79399 : for (int j=0; j < SgSpawnStmt::pool_size; j++)
79400 : {
79401 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
79402 : {
79403 : traversal.visit(&(objectArray[i][j]));
79404 : }
79405 : }
79406 : }
79407 : #else
79408 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
79409 : // compute the list first and then call the visit function on each list element.
79410 :
79411 : // printf ("Inside of SgSpawnStmt::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
79412 :
79413 0 : std::vector<SgSpawnStmt*> nodeList;
79414 :
79415 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
79416 0 : for (unsigned int i=0; i < SgSpawnStmt::pools.size(); i++)
79417 : {
79418 : // objectArray[i] is a single memory pool
79419 0 : for (unsigned j=0; j < SgSpawnStmt::pool_size; j++)
79420 : {
79421 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
79422 : {
79423 0 : nodeList.push_back(&(objectArray[i][j]));
79424 : }
79425 : }
79426 : }
79427 :
79428 : // Iterate over the saved list
79429 0 : size_t nodeListSize = nodeList.size();
79430 0 : for (size_t i=0; i < nodeListSize; i++)
79431 : {
79432 0 : ROSE_ASSERT(nodeList[i] != NULL);
79433 : #if 0
79434 : traversal.visit(nodeList[i]);
79435 : #else
79436 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
79437 : {
79438 0 : traversal.visit(nodeList[i]);
79439 : }
79440 : #endif
79441 : }
79442 : #endif
79443 : }
79444 :
79445 : // This should not be required since all previously static data members are
79446 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
79447 :
79448 5342 : }
79449 :
79450 :
79451 : void
79452 194 : SgSpawnStmt::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
79453 : {
79454 : // This function traverses the memory pool for an IR node and
79455 : // calls the function to execute the visitor object.
79456 :
79457 : // Initialize array to the address of the first element of the STL vector
79458 : // (which is guarenteed to be contiguous storage).
79459 : // SgSpawnStmt objectArray [] = *(Memory_Block_List.begin());
79460 194 : if (SgSpawnStmt::pools.empty() == false)
79461 : {
79462 : // Generate an array of memory pools
79463 0 : SgSpawnStmt** objectArray = (SgSpawnStmt**) &(SgSpawnStmt::pools[0]);
79464 :
79465 : // Build a local variable for better performance
79466 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
79467 :
79468 : // Iterate over the memory pools
79469 0 : for (unsigned int i=0; i < SgSpawnStmt::pools.size(); i++)
79470 : {
79471 : // objectArray[i] is a single memory pool
79472 0 : for (unsigned j=0; j < SgSpawnStmt::pool_size; j++)
79473 : {
79474 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
79475 : {
79476 : // printf ("Found a valid SgSpawnStmt object in the memory pool %d at position %d \n",i,j);
79477 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
79478 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
79479 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
79480 : }
79481 : else
79482 : {
79483 : // printf ("Found a INVALID SgSpawnStmt object in the memory pool \n");
79484 : }
79485 : }
79486 : }
79487 : }
79488 :
79489 : // This should not be required since all previously static data members are
79490 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
79491 :
79492 194 : }
79493 :
79494 : void
79495 0 : SgSpawnStmt::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
79496 : {
79497 : // This function visits only a single IR node of the memory pool.
79498 : // it is typically called once for each type of IR node within
79499 : // the automatically generated function: traverseRepresentativeNodes().
79500 :
79501 : // Initialize array to the address of the first element of the STL vector
79502 : // (which is guarenteed to be contiguous storage).
79503 : // SgSpawnStmt objectArray [] = *(Memory_Block_List.begin());
79504 0 : if (SgSpawnStmt::pools.empty() == false)
79505 : {
79506 : // Generate an array of memory pools
79507 0 : SgSpawnStmt** objectArray = (SgSpawnStmt**) &(SgSpawnStmt::pools[0]);
79508 :
79509 : // Build a local variable for better performance
79510 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
79511 :
79512 : // Iterate over the memory pools
79513 0 : bool done = false;
79514 0 : unsigned i=0;
79515 :
79516 : // find the first valid IR node, call visit function, and then leave
79517 0 : while ( done == false && i < SgSpawnStmt::pools.size() )
79518 : {
79519 : // objectArray[i] is a single memory pool
79520 : unsigned j=0;
79521 0 : while (done == false && j < SgSpawnStmt::pool_size)
79522 : {
79523 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
79524 : {
79525 0 : traversal.visit(&(objectArray[i][j]));
79526 0 : done = true;
79527 : }
79528 0 : j++;
79529 : }
79530 0 : i++;
79531 : }
79532 :
79533 : #if 0
79534 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
79535 : if (done == false)
79536 : {
79537 : printf ("No representative for SgSpawnStmt found in memory pools \n");
79538 : }
79539 : #endif
79540 : }
79541 0 : }
79542 :
79543 :
79544 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
79545 : // using values that overflow signed values of int.
79546 : size_t
79547 4 : SgSpawnStmt::numberOfNodes()
79548 : {
79549 : // This function traverses the memory pool for an IR node and
79550 : // counts the number of IR nodes of a particular Sage III IR
79551 : // nodes type.
79552 :
79553 4 : size_t count = 0;
79554 4 : if (SgSpawnStmt::pools.empty() == false)
79555 : {
79556 : // Generate an array of memory pools (this is actually a STL vector,
79557 : // but it is contiguious, so OK to treat this way).
79558 0 : SgSpawnStmt** objectArray = (SgSpawnStmt**) &(SgSpawnStmt::pools[0]);
79559 :
79560 : // Build a local variable for better performance (make it a loop invariant variable).
79561 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
79562 :
79563 : // Iterate over all of the memory pools for this IR node.
79564 0 : for (unsigned int i=0; i < SgSpawnStmt::pools.size(); i++)
79565 : {
79566 : // objectArray[i] is a single memory pool, iterate over all the
79567 : // IR nodes and only count those that are valid IR nodes used in
79568 : // the AST (i.e. allocated IR nodes).
79569 0 : for (unsigned j=0; j < SgSpawnStmt::pool_size; j++)
79570 : {
79571 : // This is indexing the STL vector of C/C++ style arrays as a doubly
79572 : // indexed array access. It is OK since we have leveraged the semantics
79573 : // of STL vector memory as contigous and cast the memory as an array
79574 : // of arrays to use the 2D array indexing. Hope this is not confusing,
79575 : // but it s very fast as an implementation.
79576 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
79577 : {
79578 0 : count++;
79579 : }
79580 : }
79581 : }
79582 : }
79583 :
79584 :
79585 :
79586 4 : return count;
79587 : }
79588 :
79589 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
79590 : // using values that overflow signed values of int.
79591 : size_t
79592 0 : SgSpawnStmt::memoryUsage()
79593 : {
79594 : // This function is required because we need the class name as a type when we call sizeof
79595 : // There might be another way to implement this if we have a traversal that only called a
79596 : // representative object (one call for each type of Sage IIIIR node).
79597 0 : size_t memory = numberOfNodes() * sizeof(SgSpawnStmt);
79598 :
79599 0 : return memory;
79600 : }
79601 :
79602 : /* #line 79603 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
79603 :
79604 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
79605 : void
79606 5342 : SgNullStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
79607 : {
79608 : // This function traverses the memory pool for only a specific IR node
79609 : // and calls the visit function of the input class execute a traversal
79610 : // similar to the style of the attribute based traversals within ROSE.
79611 : // This traversal will visit ALL nodes of the AST where as the other
79612 : // attribute based traversals visit only the embedded tree within the AST.
79613 :
79614 : // Initialize array to the address of the first element of the STL vector
79615 : // (which is guaranteed to be contiguous storage).
79616 : // SgNullStatement objectArray [] = *(Memory_Block_List.begin());
79617 5342 : if (SgNullStatement::pools.empty() == false)
79618 : {
79619 : // Generate an array of memory pools
79620 145 : SgNullStatement** objectArray = (SgNullStatement**) &(SgNullStatement::pools[0]);
79621 :
79622 : // Build a local variable for better performance
79623 145 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
79624 : #if 0
79625 : // Iterate over the memory pools
79626 : for (unsigned int i=0; i < SgNullStatement::pools.size(); i++)
79627 : {
79628 : // objectArray[i] is a single memory pool
79629 : for (int j=0; j < SgNullStatement::pool_size; j++)
79630 : {
79631 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
79632 : {
79633 : traversal.visit(&(objectArray[i][j]));
79634 : }
79635 : }
79636 : }
79637 : #else
79638 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
79639 : // compute the list first and then call the visit function on each list element.
79640 :
79641 : // printf ("Inside of SgNullStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
79642 :
79643 290 : std::vector<SgNullStatement*> nodeList;
79644 :
79645 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
79646 290 : for (unsigned int i=0; i < SgNullStatement::pools.size(); i++)
79647 : {
79648 : // objectArray[i] is a single memory pool
79649 290145 : for (unsigned j=0; j < SgNullStatement::pool_size; j++)
79650 : {
79651 290000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
79652 : {
79653 3312 : nodeList.push_back(&(objectArray[i][j]));
79654 : }
79655 : }
79656 : }
79657 :
79658 : // Iterate over the saved list
79659 145 : size_t nodeListSize = nodeList.size();
79660 3457 : for (size_t i=0; i < nodeListSize; i++)
79661 : {
79662 3312 : ROSE_ASSERT(nodeList[i] != NULL);
79663 : #if 0
79664 : traversal.visit(nodeList[i]);
79665 : #else
79666 3312 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
79667 : {
79668 3312 : traversal.visit(nodeList[i]);
79669 : }
79670 : #endif
79671 : }
79672 : #endif
79673 : }
79674 :
79675 : // This should not be required since all previously static data members are
79676 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
79677 :
79678 5342 : }
79679 :
79680 :
79681 : void
79682 194 : SgNullStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
79683 : {
79684 : // This function traverses the memory pool for an IR node and
79685 : // calls the function to execute the visitor object.
79686 :
79687 : // Initialize array to the address of the first element of the STL vector
79688 : // (which is guarenteed to be contiguous storage).
79689 : // SgNullStatement objectArray [] = *(Memory_Block_List.begin());
79690 194 : if (SgNullStatement::pools.empty() == false)
79691 : {
79692 : // Generate an array of memory pools
79693 137 : SgNullStatement** objectArray = (SgNullStatement**) &(SgNullStatement::pools[0]);
79694 :
79695 : // Build a local variable for better performance
79696 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
79697 :
79698 : // Iterate over the memory pools
79699 274 : for (unsigned int i=0; i < SgNullStatement::pools.size(); i++)
79700 : {
79701 : // objectArray[i] is a single memory pool
79702 274137 : for (unsigned j=0; j < SgNullStatement::pool_size; j++)
79703 : {
79704 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
79705 : {
79706 : // printf ("Found a valid SgNullStatement object in the memory pool %d at position %d \n",i,j);
79707 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
79708 3172 : objectArray[i][j].executeVisitorMemberFunction(visitor);
79709 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
79710 : }
79711 : else
79712 : {
79713 : // printf ("Found a INVALID SgNullStatement object in the memory pool \n");
79714 : }
79715 : }
79716 : }
79717 : }
79718 :
79719 : // This should not be required since all previously static data members are
79720 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
79721 :
79722 194 : }
79723 :
79724 : void
79725 0 : SgNullStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
79726 : {
79727 : // This function visits only a single IR node of the memory pool.
79728 : // it is typically called once for each type of IR node within
79729 : // the automatically generated function: traverseRepresentativeNodes().
79730 :
79731 : // Initialize array to the address of the first element of the STL vector
79732 : // (which is guarenteed to be contiguous storage).
79733 : // SgNullStatement objectArray [] = *(Memory_Block_List.begin());
79734 0 : if (SgNullStatement::pools.empty() == false)
79735 : {
79736 : // Generate an array of memory pools
79737 0 : SgNullStatement** objectArray = (SgNullStatement**) &(SgNullStatement::pools[0]);
79738 :
79739 : // Build a local variable for better performance
79740 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
79741 :
79742 : // Iterate over the memory pools
79743 0 : bool done = false;
79744 0 : unsigned i=0;
79745 :
79746 : // find the first valid IR node, call visit function, and then leave
79747 0 : while ( done == false && i < SgNullStatement::pools.size() )
79748 : {
79749 : // objectArray[i] is a single memory pool
79750 : unsigned j=0;
79751 0 : while (done == false && j < SgNullStatement::pool_size)
79752 : {
79753 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
79754 : {
79755 0 : traversal.visit(&(objectArray[i][j]));
79756 0 : done = true;
79757 : }
79758 0 : j++;
79759 : }
79760 0 : i++;
79761 : }
79762 :
79763 : #if 0
79764 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
79765 : if (done == false)
79766 : {
79767 : printf ("No representative for SgNullStatement found in memory pools \n");
79768 : }
79769 : #endif
79770 : }
79771 0 : }
79772 :
79773 :
79774 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
79775 : // using values that overflow signed values of int.
79776 : size_t
79777 4 : SgNullStatement::numberOfNodes()
79778 : {
79779 : // This function traverses the memory pool for an IR node and
79780 : // counts the number of IR nodes of a particular Sage III IR
79781 : // nodes type.
79782 :
79783 4 : size_t count = 0;
79784 4 : if (SgNullStatement::pools.empty() == false)
79785 : {
79786 : // Generate an array of memory pools (this is actually a STL vector,
79787 : // but it is contiguious, so OK to treat this way).
79788 1 : SgNullStatement** objectArray = (SgNullStatement**) &(SgNullStatement::pools[0]);
79789 :
79790 : // Build a local variable for better performance (make it a loop invariant variable).
79791 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
79792 :
79793 : // Iterate over all of the memory pools for this IR node.
79794 2 : for (unsigned int i=0; i < SgNullStatement::pools.size(); i++)
79795 : {
79796 : // objectArray[i] is a single memory pool, iterate over all the
79797 : // IR nodes and only count those that are valid IR nodes used in
79798 : // the AST (i.e. allocated IR nodes).
79799 2001 : for (unsigned j=0; j < SgNullStatement::pool_size; j++)
79800 : {
79801 : // This is indexing the STL vector of C/C++ style arrays as a doubly
79802 : // indexed array access. It is OK since we have leveraged the semantics
79803 : // of STL vector memory as contigous and cast the memory as an array
79804 : // of arrays to use the 2D array indexing. Hope this is not confusing,
79805 : // but it s very fast as an implementation.
79806 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
79807 : {
79808 20 : count++;
79809 : }
79810 : }
79811 : }
79812 : }
79813 :
79814 :
79815 :
79816 4 : return count;
79817 : }
79818 :
79819 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
79820 : // using values that overflow signed values of int.
79821 : size_t
79822 0 : SgNullStatement::memoryUsage()
79823 : {
79824 : // This function is required because we need the class name as a type when we call sizeof
79825 : // There might be another way to implement this if we have a traversal that only called a
79826 : // representative object (one call for each type of Sage IIIIR node).
79827 0 : size_t memory = numberOfNodes() * sizeof(SgNullStatement);
79828 :
79829 0 : return memory;
79830 : }
79831 :
79832 : /* #line 79833 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
79833 :
79834 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
79835 : void
79836 5342 : SgVariantStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
79837 : {
79838 : // This function traverses the memory pool for only a specific IR node
79839 : // and calls the visit function of the input class execute a traversal
79840 : // similar to the style of the attribute based traversals within ROSE.
79841 : // This traversal will visit ALL nodes of the AST where as the other
79842 : // attribute based traversals visit only the embedded tree within the AST.
79843 :
79844 : // Initialize array to the address of the first element of the STL vector
79845 : // (which is guaranteed to be contiguous storage).
79846 : // SgVariantStatement objectArray [] = *(Memory_Block_List.begin());
79847 5342 : if (SgVariantStatement::pools.empty() == false)
79848 : {
79849 : // Generate an array of memory pools
79850 0 : SgVariantStatement** objectArray = (SgVariantStatement**) &(SgVariantStatement::pools[0]);
79851 :
79852 : // Build a local variable for better performance
79853 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
79854 : #if 0
79855 : // Iterate over the memory pools
79856 : for (unsigned int i=0; i < SgVariantStatement::pools.size(); i++)
79857 : {
79858 : // objectArray[i] is a single memory pool
79859 : for (int j=0; j < SgVariantStatement::pool_size; j++)
79860 : {
79861 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
79862 : {
79863 : traversal.visit(&(objectArray[i][j]));
79864 : }
79865 : }
79866 : }
79867 : #else
79868 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
79869 : // compute the list first and then call the visit function on each list element.
79870 :
79871 : // printf ("Inside of SgVariantStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
79872 :
79873 0 : std::vector<SgVariantStatement*> nodeList;
79874 :
79875 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
79876 0 : for (unsigned int i=0; i < SgVariantStatement::pools.size(); i++)
79877 : {
79878 : // objectArray[i] is a single memory pool
79879 0 : for (unsigned j=0; j < SgVariantStatement::pool_size; j++)
79880 : {
79881 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
79882 : {
79883 0 : nodeList.push_back(&(objectArray[i][j]));
79884 : }
79885 : }
79886 : }
79887 :
79888 : // Iterate over the saved list
79889 0 : size_t nodeListSize = nodeList.size();
79890 0 : for (size_t i=0; i < nodeListSize; i++)
79891 : {
79892 0 : ROSE_ASSERT(nodeList[i] != NULL);
79893 : #if 0
79894 : traversal.visit(nodeList[i]);
79895 : #else
79896 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
79897 : {
79898 0 : traversal.visit(nodeList[i]);
79899 : }
79900 : #endif
79901 : }
79902 : #endif
79903 : }
79904 :
79905 : // This should not be required since all previously static data members are
79906 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
79907 :
79908 5342 : }
79909 :
79910 :
79911 : void
79912 194 : SgVariantStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
79913 : {
79914 : // This function traverses the memory pool for an IR node and
79915 : // calls the function to execute the visitor object.
79916 :
79917 : // Initialize array to the address of the first element of the STL vector
79918 : // (which is guarenteed to be contiguous storage).
79919 : // SgVariantStatement objectArray [] = *(Memory_Block_List.begin());
79920 194 : if (SgVariantStatement::pools.empty() == false)
79921 : {
79922 : // Generate an array of memory pools
79923 0 : SgVariantStatement** objectArray = (SgVariantStatement**) &(SgVariantStatement::pools[0]);
79924 :
79925 : // Build a local variable for better performance
79926 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
79927 :
79928 : // Iterate over the memory pools
79929 0 : for (unsigned int i=0; i < SgVariantStatement::pools.size(); i++)
79930 : {
79931 : // objectArray[i] is a single memory pool
79932 0 : for (unsigned j=0; j < SgVariantStatement::pool_size; j++)
79933 : {
79934 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
79935 : {
79936 : // printf ("Found a valid SgVariantStatement object in the memory pool %d at position %d \n",i,j);
79937 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
79938 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
79939 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
79940 : }
79941 : else
79942 : {
79943 : // printf ("Found a INVALID SgVariantStatement object in the memory pool \n");
79944 : }
79945 : }
79946 : }
79947 : }
79948 :
79949 : // This should not be required since all previously static data members are
79950 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
79951 :
79952 194 : }
79953 :
79954 : void
79955 0 : SgVariantStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
79956 : {
79957 : // This function visits only a single IR node of the memory pool.
79958 : // it is typically called once for each type of IR node within
79959 : // the automatically generated function: traverseRepresentativeNodes().
79960 :
79961 : // Initialize array to the address of the first element of the STL vector
79962 : // (which is guarenteed to be contiguous storage).
79963 : // SgVariantStatement objectArray [] = *(Memory_Block_List.begin());
79964 0 : if (SgVariantStatement::pools.empty() == false)
79965 : {
79966 : // Generate an array of memory pools
79967 0 : SgVariantStatement** objectArray = (SgVariantStatement**) &(SgVariantStatement::pools[0]);
79968 :
79969 : // Build a local variable for better performance
79970 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
79971 :
79972 : // Iterate over the memory pools
79973 0 : bool done = false;
79974 0 : unsigned i=0;
79975 :
79976 : // find the first valid IR node, call visit function, and then leave
79977 0 : while ( done == false && i < SgVariantStatement::pools.size() )
79978 : {
79979 : // objectArray[i] is a single memory pool
79980 : unsigned j=0;
79981 0 : while (done == false && j < SgVariantStatement::pool_size)
79982 : {
79983 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
79984 : {
79985 0 : traversal.visit(&(objectArray[i][j]));
79986 0 : done = true;
79987 : }
79988 0 : j++;
79989 : }
79990 0 : i++;
79991 : }
79992 :
79993 : #if 0
79994 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
79995 : if (done == false)
79996 : {
79997 : printf ("No representative for SgVariantStatement found in memory pools \n");
79998 : }
79999 : #endif
80000 : }
80001 0 : }
80002 :
80003 :
80004 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
80005 : // using values that overflow signed values of int.
80006 : size_t
80007 4 : SgVariantStatement::numberOfNodes()
80008 : {
80009 : // This function traverses the memory pool for an IR node and
80010 : // counts the number of IR nodes of a particular Sage III IR
80011 : // nodes type.
80012 :
80013 4 : size_t count = 0;
80014 4 : if (SgVariantStatement::pools.empty() == false)
80015 : {
80016 : // Generate an array of memory pools (this is actually a STL vector,
80017 : // but it is contiguious, so OK to treat this way).
80018 0 : SgVariantStatement** objectArray = (SgVariantStatement**) &(SgVariantStatement::pools[0]);
80019 :
80020 : // Build a local variable for better performance (make it a loop invariant variable).
80021 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
80022 :
80023 : // Iterate over all of the memory pools for this IR node.
80024 0 : for (unsigned int i=0; i < SgVariantStatement::pools.size(); i++)
80025 : {
80026 : // objectArray[i] is a single memory pool, iterate over all the
80027 : // IR nodes and only count those that are valid IR nodes used in
80028 : // the AST (i.e. allocated IR nodes).
80029 0 : for (unsigned j=0; j < SgVariantStatement::pool_size; j++)
80030 : {
80031 : // This is indexing the STL vector of C/C++ style arrays as a doubly
80032 : // indexed array access. It is OK since we have leveraged the semantics
80033 : // of STL vector memory as contigous and cast the memory as an array
80034 : // of arrays to use the 2D array indexing. Hope this is not confusing,
80035 : // but it s very fast as an implementation.
80036 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
80037 : {
80038 0 : count++;
80039 : }
80040 : }
80041 : }
80042 : }
80043 :
80044 :
80045 :
80046 4 : return count;
80047 : }
80048 :
80049 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
80050 : // using values that overflow signed values of int.
80051 : size_t
80052 0 : SgVariantStatement::memoryUsage()
80053 : {
80054 : // This function is required because we need the class name as a type when we call sizeof
80055 : // There might be another way to implement this if we have a traversal that only called a
80056 : // representative object (one call for each type of Sage IIIIR node).
80057 0 : size_t memory = numberOfNodes() * sizeof(SgVariantStatement);
80058 :
80059 0 : return memory;
80060 : }
80061 :
80062 : /* #line 80063 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
80063 :
80064 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
80065 : void
80066 5342 : SgForInitStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
80067 : {
80068 : // This function traverses the memory pool for only a specific IR node
80069 : // and calls the visit function of the input class execute a traversal
80070 : // similar to the style of the attribute based traversals within ROSE.
80071 : // This traversal will visit ALL nodes of the AST where as the other
80072 : // attribute based traversals visit only the embedded tree within the AST.
80073 :
80074 : // Initialize array to the address of the first element of the STL vector
80075 : // (which is guaranteed to be contiguous storage).
80076 : // SgForInitStatement objectArray [] = *(Memory_Block_List.begin());
80077 5342 : if (SgForInitStatement::pools.empty() == false)
80078 : {
80079 : // Generate an array of memory pools
80080 2482 : SgForInitStatement** objectArray = (SgForInitStatement**) &(SgForInitStatement::pools[0]);
80081 :
80082 : // Build a local variable for better performance
80083 2482 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
80084 : #if 0
80085 : // Iterate over the memory pools
80086 : for (unsigned int i=0; i < SgForInitStatement::pools.size(); i++)
80087 : {
80088 : // objectArray[i] is a single memory pool
80089 : for (int j=0; j < SgForInitStatement::pool_size; j++)
80090 : {
80091 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
80092 : {
80093 : traversal.visit(&(objectArray[i][j]));
80094 : }
80095 : }
80096 : }
80097 : #else
80098 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
80099 : // compute the list first and then call the visit function on each list element.
80100 :
80101 : // printf ("Inside of SgForInitStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
80102 :
80103 4964 : std::vector<SgForInitStatement*> nodeList;
80104 :
80105 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
80106 4964 : for (unsigned int i=0; i < SgForInitStatement::pools.size(); i++)
80107 : {
80108 : // objectArray[i] is a single memory pool
80109 4966480 : for (unsigned j=0; j < SgForInitStatement::pool_size; j++)
80110 : {
80111 4964000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
80112 : {
80113 13511 : nodeList.push_back(&(objectArray[i][j]));
80114 : }
80115 : }
80116 : }
80117 :
80118 : // Iterate over the saved list
80119 2482 : size_t nodeListSize = nodeList.size();
80120 15993 : for (size_t i=0; i < nodeListSize; i++)
80121 : {
80122 13511 : ROSE_ASSERT(nodeList[i] != NULL);
80123 : #if 0
80124 : traversal.visit(nodeList[i]);
80125 : #else
80126 13511 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
80127 : {
80128 13511 : traversal.visit(nodeList[i]);
80129 : }
80130 : #endif
80131 : }
80132 : #endif
80133 : }
80134 :
80135 : // This should not be required since all previously static data members are
80136 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
80137 :
80138 5342 : }
80139 :
80140 :
80141 : void
80142 194 : SgForInitStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
80143 : {
80144 : // This function traverses the memory pool for an IR node and
80145 : // calls the function to execute the visitor object.
80146 :
80147 : // Initialize array to the address of the first element of the STL vector
80148 : // (which is guarenteed to be contiguous storage).
80149 : // SgForInitStatement objectArray [] = *(Memory_Block_List.begin());
80150 194 : if (SgForInitStatement::pools.empty() == false)
80151 : {
80152 : // Generate an array of memory pools
80153 190 : SgForInitStatement** objectArray = (SgForInitStatement**) &(SgForInitStatement::pools[0]);
80154 :
80155 : // Build a local variable for better performance
80156 190 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
80157 :
80158 : // Iterate over the memory pools
80159 380 : for (unsigned int i=0; i < SgForInitStatement::pools.size(); i++)
80160 : {
80161 : // objectArray[i] is a single memory pool
80162 380190 : for (unsigned j=0; j < SgForInitStatement::pool_size; j++)
80163 : {
80164 380000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
80165 : {
80166 : // printf ("Found a valid SgForInitStatement object in the memory pool %d at position %d \n",i,j);
80167 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
80168 6160 : objectArray[i][j].executeVisitorMemberFunction(visitor);
80169 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
80170 : }
80171 : else
80172 : {
80173 : // printf ("Found a INVALID SgForInitStatement object in the memory pool \n");
80174 : }
80175 : }
80176 : }
80177 : }
80178 :
80179 : // This should not be required since all previously static data members are
80180 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
80181 :
80182 194 : }
80183 :
80184 : void
80185 0 : SgForInitStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
80186 : {
80187 : // This function visits only a single IR node of the memory pool.
80188 : // it is typically called once for each type of IR node within
80189 : // the automatically generated function: traverseRepresentativeNodes().
80190 :
80191 : // Initialize array to the address of the first element of the STL vector
80192 : // (which is guarenteed to be contiguous storage).
80193 : // SgForInitStatement objectArray [] = *(Memory_Block_List.begin());
80194 0 : if (SgForInitStatement::pools.empty() == false)
80195 : {
80196 : // Generate an array of memory pools
80197 0 : SgForInitStatement** objectArray = (SgForInitStatement**) &(SgForInitStatement::pools[0]);
80198 :
80199 : // Build a local variable for better performance
80200 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
80201 :
80202 : // Iterate over the memory pools
80203 0 : bool done = false;
80204 0 : unsigned i=0;
80205 :
80206 : // find the first valid IR node, call visit function, and then leave
80207 0 : while ( done == false && i < SgForInitStatement::pools.size() )
80208 : {
80209 : // objectArray[i] is a single memory pool
80210 : unsigned j=0;
80211 0 : while (done == false && j < SgForInitStatement::pool_size)
80212 : {
80213 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
80214 : {
80215 0 : traversal.visit(&(objectArray[i][j]));
80216 0 : done = true;
80217 : }
80218 0 : j++;
80219 : }
80220 0 : i++;
80221 : }
80222 :
80223 : #if 0
80224 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
80225 : if (done == false)
80226 : {
80227 : printf ("No representative for SgForInitStatement found in memory pools \n");
80228 : }
80229 : #endif
80230 : }
80231 0 : }
80232 :
80233 :
80234 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
80235 : // using values that overflow signed values of int.
80236 : size_t
80237 4 : SgForInitStatement::numberOfNodes()
80238 : {
80239 : // This function traverses the memory pool for an IR node and
80240 : // counts the number of IR nodes of a particular Sage III IR
80241 : // nodes type.
80242 :
80243 4 : size_t count = 0;
80244 4 : if (SgForInitStatement::pools.empty() == false)
80245 : {
80246 : // Generate an array of memory pools (this is actually a STL vector,
80247 : // but it is contiguious, so OK to treat this way).
80248 1 : SgForInitStatement** objectArray = (SgForInitStatement**) &(SgForInitStatement::pools[0]);
80249 :
80250 : // Build a local variable for better performance (make it a loop invariant variable).
80251 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
80252 :
80253 : // Iterate over all of the memory pools for this IR node.
80254 2 : for (unsigned int i=0; i < SgForInitStatement::pools.size(); i++)
80255 : {
80256 : // objectArray[i] is a single memory pool, iterate over all the
80257 : // IR nodes and only count those that are valid IR nodes used in
80258 : // the AST (i.e. allocated IR nodes).
80259 2001 : for (unsigned j=0; j < SgForInitStatement::pool_size; j++)
80260 : {
80261 : // This is indexing the STL vector of C/C++ style arrays as a doubly
80262 : // indexed array access. It is OK since we have leveraged the semantics
80263 : // of STL vector memory as contigous and cast the memory as an array
80264 : // of arrays to use the 2D array indexing. Hope this is not confusing,
80265 : // but it s very fast as an implementation.
80266 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
80267 : {
80268 40 : count++;
80269 : }
80270 : }
80271 : }
80272 : }
80273 :
80274 :
80275 :
80276 4 : return count;
80277 : }
80278 :
80279 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
80280 : // using values that overflow signed values of int.
80281 : size_t
80282 0 : SgForInitStatement::memoryUsage()
80283 : {
80284 : // This function is required because we need the class name as a type when we call sizeof
80285 : // There might be another way to implement this if we have a traversal that only called a
80286 : // representative object (one call for each type of Sage IIIIR node).
80287 0 : size_t memory = numberOfNodes() * sizeof(SgForInitStatement);
80288 :
80289 0 : return memory;
80290 : }
80291 :
80292 : /* #line 80293 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
80293 :
80294 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
80295 : void
80296 5342 : SgCatchStatementSeq::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
80297 : {
80298 : // This function traverses the memory pool for only a specific IR node
80299 : // and calls the visit function of the input class execute a traversal
80300 : // similar to the style of the attribute based traversals within ROSE.
80301 : // This traversal will visit ALL nodes of the AST where as the other
80302 : // attribute based traversals visit only the embedded tree within the AST.
80303 :
80304 : // Initialize array to the address of the first element of the STL vector
80305 : // (which is guaranteed to be contiguous storage).
80306 : // SgCatchStatementSeq objectArray [] = *(Memory_Block_List.begin());
80307 5342 : if (SgCatchStatementSeq::pools.empty() == false)
80308 : {
80309 : // Generate an array of memory pools
80310 138 : SgCatchStatementSeq** objectArray = (SgCatchStatementSeq**) &(SgCatchStatementSeq::pools[0]);
80311 :
80312 : // Build a local variable for better performance
80313 138 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
80314 : #if 0
80315 : // Iterate over the memory pools
80316 : for (unsigned int i=0; i < SgCatchStatementSeq::pools.size(); i++)
80317 : {
80318 : // objectArray[i] is a single memory pool
80319 : for (int j=0; j < SgCatchStatementSeq::pool_size; j++)
80320 : {
80321 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
80322 : {
80323 : traversal.visit(&(objectArray[i][j]));
80324 : }
80325 : }
80326 : }
80327 : #else
80328 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
80329 : // compute the list first and then call the visit function on each list element.
80330 :
80331 : // printf ("Inside of SgCatchStatementSeq::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
80332 :
80333 276 : std::vector<SgCatchStatementSeq*> nodeList;
80334 :
80335 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
80336 276 : for (unsigned int i=0; i < SgCatchStatementSeq::pools.size(); i++)
80337 : {
80338 : // objectArray[i] is a single memory pool
80339 276138 : for (unsigned j=0; j < SgCatchStatementSeq::pool_size; j++)
80340 : {
80341 276000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
80342 : {
80343 7088 : nodeList.push_back(&(objectArray[i][j]));
80344 : }
80345 : }
80346 : }
80347 :
80348 : // Iterate over the saved list
80349 138 : size_t nodeListSize = nodeList.size();
80350 7226 : for (size_t i=0; i < nodeListSize; i++)
80351 : {
80352 7088 : ROSE_ASSERT(nodeList[i] != NULL);
80353 : #if 0
80354 : traversal.visit(nodeList[i]);
80355 : #else
80356 7088 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
80357 : {
80358 7088 : traversal.visit(nodeList[i]);
80359 : }
80360 : #endif
80361 : }
80362 : #endif
80363 : }
80364 :
80365 : // This should not be required since all previously static data members are
80366 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
80367 :
80368 5342 : }
80369 :
80370 :
80371 : void
80372 194 : SgCatchStatementSeq::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
80373 : {
80374 : // This function traverses the memory pool for an IR node and
80375 : // calls the function to execute the visitor object.
80376 :
80377 : // Initialize array to the address of the first element of the STL vector
80378 : // (which is guarenteed to be contiguous storage).
80379 : // SgCatchStatementSeq objectArray [] = *(Memory_Block_List.begin());
80380 194 : if (SgCatchStatementSeq::pools.empty() == false)
80381 : {
80382 : // Generate an array of memory pools
80383 137 : SgCatchStatementSeq** objectArray = (SgCatchStatementSeq**) &(SgCatchStatementSeq::pools[0]);
80384 :
80385 : // Build a local variable for better performance
80386 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
80387 :
80388 : // Iterate over the memory pools
80389 274 : for (unsigned int i=0; i < SgCatchStatementSeq::pools.size(); i++)
80390 : {
80391 : // objectArray[i] is a single memory pool
80392 274137 : for (unsigned j=0; j < SgCatchStatementSeq::pool_size; j++)
80393 : {
80394 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
80395 : {
80396 : // printf ("Found a valid SgCatchStatementSeq object in the memory pool %d at position %d \n",i,j);
80397 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
80398 7866 : objectArray[i][j].executeVisitorMemberFunction(visitor);
80399 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
80400 : }
80401 : else
80402 : {
80403 : // printf ("Found a INVALID SgCatchStatementSeq object in the memory pool \n");
80404 : }
80405 : }
80406 : }
80407 : }
80408 :
80409 : // This should not be required since all previously static data members are
80410 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
80411 :
80412 194 : }
80413 :
80414 : void
80415 0 : SgCatchStatementSeq::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
80416 : {
80417 : // This function visits only a single IR node of the memory pool.
80418 : // it is typically called once for each type of IR node within
80419 : // the automatically generated function: traverseRepresentativeNodes().
80420 :
80421 : // Initialize array to the address of the first element of the STL vector
80422 : // (which is guarenteed to be contiguous storage).
80423 : // SgCatchStatementSeq objectArray [] = *(Memory_Block_List.begin());
80424 0 : if (SgCatchStatementSeq::pools.empty() == false)
80425 : {
80426 : // Generate an array of memory pools
80427 0 : SgCatchStatementSeq** objectArray = (SgCatchStatementSeq**) &(SgCatchStatementSeq::pools[0]);
80428 :
80429 : // Build a local variable for better performance
80430 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
80431 :
80432 : // Iterate over the memory pools
80433 0 : bool done = false;
80434 0 : unsigned i=0;
80435 :
80436 : // find the first valid IR node, call visit function, and then leave
80437 0 : while ( done == false && i < SgCatchStatementSeq::pools.size() )
80438 : {
80439 : // objectArray[i] is a single memory pool
80440 : unsigned j=0;
80441 0 : while (done == false && j < SgCatchStatementSeq::pool_size)
80442 : {
80443 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
80444 : {
80445 0 : traversal.visit(&(objectArray[i][j]));
80446 0 : done = true;
80447 : }
80448 0 : j++;
80449 : }
80450 0 : i++;
80451 : }
80452 :
80453 : #if 0
80454 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
80455 : if (done == false)
80456 : {
80457 : printf ("No representative for SgCatchStatementSeq found in memory pools \n");
80458 : }
80459 : #endif
80460 : }
80461 0 : }
80462 :
80463 :
80464 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
80465 : // using values that overflow signed values of int.
80466 : size_t
80467 4 : SgCatchStatementSeq::numberOfNodes()
80468 : {
80469 : // This function traverses the memory pool for an IR node and
80470 : // counts the number of IR nodes of a particular Sage III IR
80471 : // nodes type.
80472 :
80473 4 : size_t count = 0;
80474 4 : if (SgCatchStatementSeq::pools.empty() == false)
80475 : {
80476 : // Generate an array of memory pools (this is actually a STL vector,
80477 : // but it is contiguious, so OK to treat this way).
80478 1 : SgCatchStatementSeq** objectArray = (SgCatchStatementSeq**) &(SgCatchStatementSeq::pools[0]);
80479 :
80480 : // Build a local variable for better performance (make it a loop invariant variable).
80481 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
80482 :
80483 : // Iterate over all of the memory pools for this IR node.
80484 2 : for (unsigned int i=0; i < SgCatchStatementSeq::pools.size(); i++)
80485 : {
80486 : // objectArray[i] is a single memory pool, iterate over all the
80487 : // IR nodes and only count those that are valid IR nodes used in
80488 : // the AST (i.e. allocated IR nodes).
80489 2001 : for (unsigned j=0; j < SgCatchStatementSeq::pool_size; j++)
80490 : {
80491 : // This is indexing the STL vector of C/C++ style arrays as a doubly
80492 : // indexed array access. It is OK since we have leveraged the semantics
80493 : // of STL vector memory as contigous and cast the memory as an array
80494 : // of arrays to use the 2D array indexing. Hope this is not confusing,
80495 : // but it s very fast as an implementation.
80496 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
80497 : {
80498 54 : count++;
80499 : }
80500 : }
80501 : }
80502 : }
80503 :
80504 :
80505 :
80506 4 : return count;
80507 : }
80508 :
80509 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
80510 : // using values that overflow signed values of int.
80511 : size_t
80512 0 : SgCatchStatementSeq::memoryUsage()
80513 : {
80514 : // This function is required because we need the class name as a type when we call sizeof
80515 : // There might be another way to implement this if we have a traversal that only called a
80516 : // representative object (one call for each type of Sage IIIIR node).
80517 0 : size_t memory = numberOfNodes() * sizeof(SgCatchStatementSeq);
80518 :
80519 0 : return memory;
80520 : }
80521 :
80522 : /* #line 80523 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
80523 :
80524 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
80525 : void
80526 5342 : SgProcessControlStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
80527 : {
80528 : // This function traverses the memory pool for only a specific IR node
80529 : // and calls the visit function of the input class execute a traversal
80530 : // similar to the style of the attribute based traversals within ROSE.
80531 : // This traversal will visit ALL nodes of the AST where as the other
80532 : // attribute based traversals visit only the embedded tree within the AST.
80533 :
80534 : // Initialize array to the address of the first element of the STL vector
80535 : // (which is guaranteed to be contiguous storage).
80536 : // SgProcessControlStatement objectArray [] = *(Memory_Block_List.begin());
80537 5342 : if (SgProcessControlStatement::pools.empty() == false)
80538 : {
80539 : // Generate an array of memory pools
80540 20 : SgProcessControlStatement** objectArray = (SgProcessControlStatement**) &(SgProcessControlStatement::pools[0]);
80541 :
80542 : // Build a local variable for better performance
80543 20 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
80544 : #if 0
80545 : // Iterate over the memory pools
80546 : for (unsigned int i=0; i < SgProcessControlStatement::pools.size(); i++)
80547 : {
80548 : // objectArray[i] is a single memory pool
80549 : for (int j=0; j < SgProcessControlStatement::pool_size; j++)
80550 : {
80551 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
80552 : {
80553 : traversal.visit(&(objectArray[i][j]));
80554 : }
80555 : }
80556 : }
80557 : #else
80558 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
80559 : // compute the list first and then call the visit function on each list element.
80560 :
80561 : // printf ("Inside of SgProcessControlStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
80562 :
80563 40 : std::vector<SgProcessControlStatement*> nodeList;
80564 :
80565 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
80566 40 : for (unsigned int i=0; i < SgProcessControlStatement::pools.size(); i++)
80567 : {
80568 : // objectArray[i] is a single memory pool
80569 40020 : for (unsigned j=0; j < SgProcessControlStatement::pool_size; j++)
80570 : {
80571 40000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
80572 : {
80573 20 : nodeList.push_back(&(objectArray[i][j]));
80574 : }
80575 : }
80576 : }
80577 :
80578 : // Iterate over the saved list
80579 20 : size_t nodeListSize = nodeList.size();
80580 40 : for (size_t i=0; i < nodeListSize; i++)
80581 : {
80582 20 : ROSE_ASSERT(nodeList[i] != NULL);
80583 : #if 0
80584 : traversal.visit(nodeList[i]);
80585 : #else
80586 20 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
80587 : {
80588 20 : traversal.visit(nodeList[i]);
80589 : }
80590 : #endif
80591 : }
80592 : #endif
80593 : }
80594 :
80595 : // This should not be required since all previously static data members are
80596 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
80597 :
80598 5342 : }
80599 :
80600 :
80601 : void
80602 194 : SgProcessControlStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
80603 : {
80604 : // This function traverses the memory pool for an IR node and
80605 : // calls the function to execute the visitor object.
80606 :
80607 : // Initialize array to the address of the first element of the STL vector
80608 : // (which is guarenteed to be contiguous storage).
80609 : // SgProcessControlStatement objectArray [] = *(Memory_Block_List.begin());
80610 194 : if (SgProcessControlStatement::pools.empty() == false)
80611 : {
80612 : // Generate an array of memory pools
80613 0 : SgProcessControlStatement** objectArray = (SgProcessControlStatement**) &(SgProcessControlStatement::pools[0]);
80614 :
80615 : // Build a local variable for better performance
80616 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
80617 :
80618 : // Iterate over the memory pools
80619 0 : for (unsigned int i=0; i < SgProcessControlStatement::pools.size(); i++)
80620 : {
80621 : // objectArray[i] is a single memory pool
80622 0 : for (unsigned j=0; j < SgProcessControlStatement::pool_size; j++)
80623 : {
80624 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
80625 : {
80626 : // printf ("Found a valid SgProcessControlStatement object in the memory pool %d at position %d \n",i,j);
80627 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
80628 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
80629 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
80630 : }
80631 : else
80632 : {
80633 : // printf ("Found a INVALID SgProcessControlStatement object in the memory pool \n");
80634 : }
80635 : }
80636 : }
80637 : }
80638 :
80639 : // This should not be required since all previously static data members are
80640 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
80641 :
80642 194 : }
80643 :
80644 : void
80645 0 : SgProcessControlStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
80646 : {
80647 : // This function visits only a single IR node of the memory pool.
80648 : // it is typically called once for each type of IR node within
80649 : // the automatically generated function: traverseRepresentativeNodes().
80650 :
80651 : // Initialize array to the address of the first element of the STL vector
80652 : // (which is guarenteed to be contiguous storage).
80653 : // SgProcessControlStatement objectArray [] = *(Memory_Block_List.begin());
80654 0 : if (SgProcessControlStatement::pools.empty() == false)
80655 : {
80656 : // Generate an array of memory pools
80657 0 : SgProcessControlStatement** objectArray = (SgProcessControlStatement**) &(SgProcessControlStatement::pools[0]);
80658 :
80659 : // Build a local variable for better performance
80660 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
80661 :
80662 : // Iterate over the memory pools
80663 0 : bool done = false;
80664 0 : unsigned i=0;
80665 :
80666 : // find the first valid IR node, call visit function, and then leave
80667 0 : while ( done == false && i < SgProcessControlStatement::pools.size() )
80668 : {
80669 : // objectArray[i] is a single memory pool
80670 : unsigned j=0;
80671 0 : while (done == false && j < SgProcessControlStatement::pool_size)
80672 : {
80673 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
80674 : {
80675 0 : traversal.visit(&(objectArray[i][j]));
80676 0 : done = true;
80677 : }
80678 0 : j++;
80679 : }
80680 0 : i++;
80681 : }
80682 :
80683 : #if 0
80684 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
80685 : if (done == false)
80686 : {
80687 : printf ("No representative for SgProcessControlStatement found in memory pools \n");
80688 : }
80689 : #endif
80690 : }
80691 0 : }
80692 :
80693 :
80694 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
80695 : // using values that overflow signed values of int.
80696 : size_t
80697 4 : SgProcessControlStatement::numberOfNodes()
80698 : {
80699 : // This function traverses the memory pool for an IR node and
80700 : // counts the number of IR nodes of a particular Sage III IR
80701 : // nodes type.
80702 :
80703 4 : size_t count = 0;
80704 4 : if (SgProcessControlStatement::pools.empty() == false)
80705 : {
80706 : // Generate an array of memory pools (this is actually a STL vector,
80707 : // but it is contiguious, so OK to treat this way).
80708 0 : SgProcessControlStatement** objectArray = (SgProcessControlStatement**) &(SgProcessControlStatement::pools[0]);
80709 :
80710 : // Build a local variable for better performance (make it a loop invariant variable).
80711 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
80712 :
80713 : // Iterate over all of the memory pools for this IR node.
80714 0 : for (unsigned int i=0; i < SgProcessControlStatement::pools.size(); i++)
80715 : {
80716 : // objectArray[i] is a single memory pool, iterate over all the
80717 : // IR nodes and only count those that are valid IR nodes used in
80718 : // the AST (i.e. allocated IR nodes).
80719 0 : for (unsigned j=0; j < SgProcessControlStatement::pool_size; j++)
80720 : {
80721 : // This is indexing the STL vector of C/C++ style arrays as a doubly
80722 : // indexed array access. It is OK since we have leveraged the semantics
80723 : // of STL vector memory as contigous and cast the memory as an array
80724 : // of arrays to use the 2D array indexing. Hope this is not confusing,
80725 : // but it s very fast as an implementation.
80726 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
80727 : {
80728 0 : count++;
80729 : }
80730 : }
80731 : }
80732 : }
80733 :
80734 :
80735 :
80736 4 : return count;
80737 : }
80738 :
80739 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
80740 : // using values that overflow signed values of int.
80741 : size_t
80742 0 : SgProcessControlStatement::memoryUsage()
80743 : {
80744 : // This function is required because we need the class name as a type when we call sizeof
80745 : // There might be another way to implement this if we have a traversal that only called a
80746 : // representative object (one call for each type of Sage IIIIR node).
80747 0 : size_t memory = numberOfNodes() * sizeof(SgProcessControlStatement);
80748 :
80749 0 : return memory;
80750 : }
80751 :
80752 : /* #line 80753 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
80753 :
80754 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
80755 : void
80756 5342 : SgIOStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
80757 : {
80758 : // This function traverses the memory pool for only a specific IR node
80759 : // and calls the visit function of the input class execute a traversal
80760 : // similar to the style of the attribute based traversals within ROSE.
80761 : // This traversal will visit ALL nodes of the AST where as the other
80762 : // attribute based traversals visit only the embedded tree within the AST.
80763 :
80764 : // Initialize array to the address of the first element of the STL vector
80765 : // (which is guaranteed to be contiguous storage).
80766 : // SgIOStatement objectArray [] = *(Memory_Block_List.begin());
80767 5342 : if (SgIOStatement::pools.empty() == false)
80768 : {
80769 : // Generate an array of memory pools
80770 0 : SgIOStatement** objectArray = (SgIOStatement**) &(SgIOStatement::pools[0]);
80771 :
80772 : // Build a local variable for better performance
80773 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
80774 : #if 0
80775 : // Iterate over the memory pools
80776 : for (unsigned int i=0; i < SgIOStatement::pools.size(); i++)
80777 : {
80778 : // objectArray[i] is a single memory pool
80779 : for (int j=0; j < SgIOStatement::pool_size; j++)
80780 : {
80781 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
80782 : {
80783 : traversal.visit(&(objectArray[i][j]));
80784 : }
80785 : }
80786 : }
80787 : #else
80788 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
80789 : // compute the list first and then call the visit function on each list element.
80790 :
80791 : // printf ("Inside of SgIOStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
80792 :
80793 0 : std::vector<SgIOStatement*> nodeList;
80794 :
80795 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
80796 0 : for (unsigned int i=0; i < SgIOStatement::pools.size(); i++)
80797 : {
80798 : // objectArray[i] is a single memory pool
80799 0 : for (unsigned j=0; j < SgIOStatement::pool_size; j++)
80800 : {
80801 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
80802 : {
80803 0 : nodeList.push_back(&(objectArray[i][j]));
80804 : }
80805 : }
80806 : }
80807 :
80808 : // Iterate over the saved list
80809 0 : size_t nodeListSize = nodeList.size();
80810 0 : for (size_t i=0; i < nodeListSize; i++)
80811 : {
80812 0 : ROSE_ASSERT(nodeList[i] != NULL);
80813 : #if 0
80814 : traversal.visit(nodeList[i]);
80815 : #else
80816 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
80817 : {
80818 0 : traversal.visit(nodeList[i]);
80819 : }
80820 : #endif
80821 : }
80822 : #endif
80823 : }
80824 :
80825 : // This should not be required since all previously static data members are
80826 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
80827 :
80828 5342 : }
80829 :
80830 :
80831 : void
80832 194 : SgIOStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
80833 : {
80834 : // This function traverses the memory pool for an IR node and
80835 : // calls the function to execute the visitor object.
80836 :
80837 : // Initialize array to the address of the first element of the STL vector
80838 : // (which is guarenteed to be contiguous storage).
80839 : // SgIOStatement objectArray [] = *(Memory_Block_List.begin());
80840 194 : if (SgIOStatement::pools.empty() == false)
80841 : {
80842 : // Generate an array of memory pools
80843 0 : SgIOStatement** objectArray = (SgIOStatement**) &(SgIOStatement::pools[0]);
80844 :
80845 : // Build a local variable for better performance
80846 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
80847 :
80848 : // Iterate over the memory pools
80849 0 : for (unsigned int i=0; i < SgIOStatement::pools.size(); i++)
80850 : {
80851 : // objectArray[i] is a single memory pool
80852 0 : for (unsigned j=0; j < SgIOStatement::pool_size; j++)
80853 : {
80854 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
80855 : {
80856 : // printf ("Found a valid SgIOStatement object in the memory pool %d at position %d \n",i,j);
80857 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
80858 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
80859 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
80860 : }
80861 : else
80862 : {
80863 : // printf ("Found a INVALID SgIOStatement object in the memory pool \n");
80864 : }
80865 : }
80866 : }
80867 : }
80868 :
80869 : // This should not be required since all previously static data members are
80870 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
80871 :
80872 194 : }
80873 :
80874 : void
80875 0 : SgIOStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
80876 : {
80877 : // This function visits only a single IR node of the memory pool.
80878 : // it is typically called once for each type of IR node within
80879 : // the automatically generated function: traverseRepresentativeNodes().
80880 :
80881 : // Initialize array to the address of the first element of the STL vector
80882 : // (which is guarenteed to be contiguous storage).
80883 : // SgIOStatement objectArray [] = *(Memory_Block_List.begin());
80884 0 : if (SgIOStatement::pools.empty() == false)
80885 : {
80886 : // Generate an array of memory pools
80887 0 : SgIOStatement** objectArray = (SgIOStatement**) &(SgIOStatement::pools[0]);
80888 :
80889 : // Build a local variable for better performance
80890 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
80891 :
80892 : // Iterate over the memory pools
80893 0 : bool done = false;
80894 0 : unsigned i=0;
80895 :
80896 : // find the first valid IR node, call visit function, and then leave
80897 0 : while ( done == false && i < SgIOStatement::pools.size() )
80898 : {
80899 : // objectArray[i] is a single memory pool
80900 : unsigned j=0;
80901 0 : while (done == false && j < SgIOStatement::pool_size)
80902 : {
80903 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
80904 : {
80905 0 : traversal.visit(&(objectArray[i][j]));
80906 0 : done = true;
80907 : }
80908 0 : j++;
80909 : }
80910 0 : i++;
80911 : }
80912 :
80913 : #if 0
80914 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
80915 : if (done == false)
80916 : {
80917 : printf ("No representative for SgIOStatement found in memory pools \n");
80918 : }
80919 : #endif
80920 : }
80921 0 : }
80922 :
80923 :
80924 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
80925 : // using values that overflow signed values of int.
80926 : size_t
80927 4 : SgIOStatement::numberOfNodes()
80928 : {
80929 : // This function traverses the memory pool for an IR node and
80930 : // counts the number of IR nodes of a particular Sage III IR
80931 : // nodes type.
80932 :
80933 4 : size_t count = 0;
80934 4 : if (SgIOStatement::pools.empty() == false)
80935 : {
80936 : // Generate an array of memory pools (this is actually a STL vector,
80937 : // but it is contiguious, so OK to treat this way).
80938 0 : SgIOStatement** objectArray = (SgIOStatement**) &(SgIOStatement::pools[0]);
80939 :
80940 : // Build a local variable for better performance (make it a loop invariant variable).
80941 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
80942 :
80943 : // Iterate over all of the memory pools for this IR node.
80944 0 : for (unsigned int i=0; i < SgIOStatement::pools.size(); i++)
80945 : {
80946 : // objectArray[i] is a single memory pool, iterate over all the
80947 : // IR nodes and only count those that are valid IR nodes used in
80948 : // the AST (i.e. allocated IR nodes).
80949 0 : for (unsigned j=0; j < SgIOStatement::pool_size; j++)
80950 : {
80951 : // This is indexing the STL vector of C/C++ style arrays as a doubly
80952 : // indexed array access. It is OK since we have leveraged the semantics
80953 : // of STL vector memory as contigous and cast the memory as an array
80954 : // of arrays to use the 2D array indexing. Hope this is not confusing,
80955 : // but it s very fast as an implementation.
80956 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
80957 : {
80958 0 : count++;
80959 : }
80960 : }
80961 : }
80962 : }
80963 :
80964 :
80965 :
80966 4 : return count;
80967 : }
80968 :
80969 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
80970 : // using values that overflow signed values of int.
80971 : size_t
80972 0 : SgIOStatement::memoryUsage()
80973 : {
80974 : // This function is required because we need the class name as a type when we call sizeof
80975 : // There might be another way to implement this if we have a traversal that only called a
80976 : // representative object (one call for each type of Sage IIIIR node).
80977 0 : size_t memory = numberOfNodes() * sizeof(SgIOStatement);
80978 :
80979 0 : return memory;
80980 : }
80981 :
80982 : /* #line 80983 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
80983 :
80984 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
80985 : void
80986 5342 : SgPrintStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
80987 : {
80988 : // This function traverses the memory pool for only a specific IR node
80989 : // and calls the visit function of the input class execute a traversal
80990 : // similar to the style of the attribute based traversals within ROSE.
80991 : // This traversal will visit ALL nodes of the AST where as the other
80992 : // attribute based traversals visit only the embedded tree within the AST.
80993 :
80994 : // Initialize array to the address of the first element of the STL vector
80995 : // (which is guaranteed to be contiguous storage).
80996 : // SgPrintStatement objectArray [] = *(Memory_Block_List.begin());
80997 5342 : if (SgPrintStatement::pools.empty() == false)
80998 : {
80999 : // Generate an array of memory pools
81000 554 : SgPrintStatement** objectArray = (SgPrintStatement**) &(SgPrintStatement::pools[0]);
81001 :
81002 : // Build a local variable for better performance
81003 554 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
81004 : #if 0
81005 : // Iterate over the memory pools
81006 : for (unsigned int i=0; i < SgPrintStatement::pools.size(); i++)
81007 : {
81008 : // objectArray[i] is a single memory pool
81009 : for (int j=0; j < SgPrintStatement::pool_size; j++)
81010 : {
81011 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
81012 : {
81013 : traversal.visit(&(objectArray[i][j]));
81014 : }
81015 : }
81016 : }
81017 : #else
81018 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
81019 : // compute the list first and then call the visit function on each list element.
81020 :
81021 : // printf ("Inside of SgPrintStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
81022 :
81023 1108 : std::vector<SgPrintStatement*> nodeList;
81024 :
81025 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
81026 1108 : for (unsigned int i=0; i < SgPrintStatement::pools.size(); i++)
81027 : {
81028 : // objectArray[i] is a single memory pool
81029 1108550 : for (unsigned j=0; j < SgPrintStatement::pool_size; j++)
81030 : {
81031 1108000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
81032 : {
81033 1094 : nodeList.push_back(&(objectArray[i][j]));
81034 : }
81035 : }
81036 : }
81037 :
81038 : // Iterate over the saved list
81039 554 : size_t nodeListSize = nodeList.size();
81040 1648 : for (size_t i=0; i < nodeListSize; i++)
81041 : {
81042 1094 : ROSE_ASSERT(nodeList[i] != NULL);
81043 : #if 0
81044 : traversal.visit(nodeList[i]);
81045 : #else
81046 1094 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
81047 : {
81048 1094 : traversal.visit(nodeList[i]);
81049 : }
81050 : #endif
81051 : }
81052 : #endif
81053 : }
81054 :
81055 : // This should not be required since all previously static data members are
81056 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
81057 :
81058 5342 : }
81059 :
81060 :
81061 : void
81062 194 : SgPrintStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
81063 : {
81064 : // This function traverses the memory pool for an IR node and
81065 : // calls the function to execute the visitor object.
81066 :
81067 : // Initialize array to the address of the first element of the STL vector
81068 : // (which is guarenteed to be contiguous storage).
81069 : // SgPrintStatement objectArray [] = *(Memory_Block_List.begin());
81070 194 : if (SgPrintStatement::pools.empty() == false)
81071 : {
81072 : // Generate an array of memory pools
81073 0 : SgPrintStatement** objectArray = (SgPrintStatement**) &(SgPrintStatement::pools[0]);
81074 :
81075 : // Build a local variable for better performance
81076 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
81077 :
81078 : // Iterate over the memory pools
81079 0 : for (unsigned int i=0; i < SgPrintStatement::pools.size(); i++)
81080 : {
81081 : // objectArray[i] is a single memory pool
81082 0 : for (unsigned j=0; j < SgPrintStatement::pool_size; j++)
81083 : {
81084 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
81085 : {
81086 : // printf ("Found a valid SgPrintStatement object in the memory pool %d at position %d \n",i,j);
81087 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
81088 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
81089 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
81090 : }
81091 : else
81092 : {
81093 : // printf ("Found a INVALID SgPrintStatement object in the memory pool \n");
81094 : }
81095 : }
81096 : }
81097 : }
81098 :
81099 : // This should not be required since all previously static data members are
81100 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
81101 :
81102 194 : }
81103 :
81104 : void
81105 0 : SgPrintStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
81106 : {
81107 : // This function visits only a single IR node of the memory pool.
81108 : // it is typically called once for each type of IR node within
81109 : // the automatically generated function: traverseRepresentativeNodes().
81110 :
81111 : // Initialize array to the address of the first element of the STL vector
81112 : // (which is guarenteed to be contiguous storage).
81113 : // SgPrintStatement objectArray [] = *(Memory_Block_List.begin());
81114 0 : if (SgPrintStatement::pools.empty() == false)
81115 : {
81116 : // Generate an array of memory pools
81117 0 : SgPrintStatement** objectArray = (SgPrintStatement**) &(SgPrintStatement::pools[0]);
81118 :
81119 : // Build a local variable for better performance
81120 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
81121 :
81122 : // Iterate over the memory pools
81123 0 : bool done = false;
81124 0 : unsigned i=0;
81125 :
81126 : // find the first valid IR node, call visit function, and then leave
81127 0 : while ( done == false && i < SgPrintStatement::pools.size() )
81128 : {
81129 : // objectArray[i] is a single memory pool
81130 : unsigned j=0;
81131 0 : while (done == false && j < SgPrintStatement::pool_size)
81132 : {
81133 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
81134 : {
81135 0 : traversal.visit(&(objectArray[i][j]));
81136 0 : done = true;
81137 : }
81138 0 : j++;
81139 : }
81140 0 : i++;
81141 : }
81142 :
81143 : #if 0
81144 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
81145 : if (done == false)
81146 : {
81147 : printf ("No representative for SgPrintStatement found in memory pools \n");
81148 : }
81149 : #endif
81150 : }
81151 0 : }
81152 :
81153 :
81154 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
81155 : // using values that overflow signed values of int.
81156 : size_t
81157 4 : SgPrintStatement::numberOfNodes()
81158 : {
81159 : // This function traverses the memory pool for an IR node and
81160 : // counts the number of IR nodes of a particular Sage III IR
81161 : // nodes type.
81162 :
81163 4 : size_t count = 0;
81164 4 : if (SgPrintStatement::pools.empty() == false)
81165 : {
81166 : // Generate an array of memory pools (this is actually a STL vector,
81167 : // but it is contiguious, so OK to treat this way).
81168 0 : SgPrintStatement** objectArray = (SgPrintStatement**) &(SgPrintStatement::pools[0]);
81169 :
81170 : // Build a local variable for better performance (make it a loop invariant variable).
81171 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
81172 :
81173 : // Iterate over all of the memory pools for this IR node.
81174 0 : for (unsigned int i=0; i < SgPrintStatement::pools.size(); i++)
81175 : {
81176 : // objectArray[i] is a single memory pool, iterate over all the
81177 : // IR nodes and only count those that are valid IR nodes used in
81178 : // the AST (i.e. allocated IR nodes).
81179 0 : for (unsigned j=0; j < SgPrintStatement::pool_size; j++)
81180 : {
81181 : // This is indexing the STL vector of C/C++ style arrays as a doubly
81182 : // indexed array access. It is OK since we have leveraged the semantics
81183 : // of STL vector memory as contigous and cast the memory as an array
81184 : // of arrays to use the 2D array indexing. Hope this is not confusing,
81185 : // but it s very fast as an implementation.
81186 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
81187 : {
81188 0 : count++;
81189 : }
81190 : }
81191 : }
81192 : }
81193 :
81194 :
81195 :
81196 4 : return count;
81197 : }
81198 :
81199 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
81200 : // using values that overflow signed values of int.
81201 : size_t
81202 0 : SgPrintStatement::memoryUsage()
81203 : {
81204 : // This function is required because we need the class name as a type when we call sizeof
81205 : // There might be another way to implement this if we have a traversal that only called a
81206 : // representative object (one call for each type of Sage IIIIR node).
81207 0 : size_t memory = numberOfNodes() * sizeof(SgPrintStatement);
81208 :
81209 0 : return memory;
81210 : }
81211 :
81212 : /* #line 81213 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
81213 :
81214 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
81215 : void
81216 5342 : SgReadStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
81217 : {
81218 : // This function traverses the memory pool for only a specific IR node
81219 : // and calls the visit function of the input class execute a traversal
81220 : // similar to the style of the attribute based traversals within ROSE.
81221 : // This traversal will visit ALL nodes of the AST where as the other
81222 : // attribute based traversals visit only the embedded tree within the AST.
81223 :
81224 : // Initialize array to the address of the first element of the STL vector
81225 : // (which is guaranteed to be contiguous storage).
81226 : // SgReadStatement objectArray [] = *(Memory_Block_List.begin());
81227 5342 : if (SgReadStatement::pools.empty() == false)
81228 : {
81229 : // Generate an array of memory pools
81230 0 : SgReadStatement** objectArray = (SgReadStatement**) &(SgReadStatement::pools[0]);
81231 :
81232 : // Build a local variable for better performance
81233 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
81234 : #if 0
81235 : // Iterate over the memory pools
81236 : for (unsigned int i=0; i < SgReadStatement::pools.size(); i++)
81237 : {
81238 : // objectArray[i] is a single memory pool
81239 : for (int j=0; j < SgReadStatement::pool_size; j++)
81240 : {
81241 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
81242 : {
81243 : traversal.visit(&(objectArray[i][j]));
81244 : }
81245 : }
81246 : }
81247 : #else
81248 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
81249 : // compute the list first and then call the visit function on each list element.
81250 :
81251 : // printf ("Inside of SgReadStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
81252 :
81253 0 : std::vector<SgReadStatement*> nodeList;
81254 :
81255 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
81256 0 : for (unsigned int i=0; i < SgReadStatement::pools.size(); i++)
81257 : {
81258 : // objectArray[i] is a single memory pool
81259 0 : for (unsigned j=0; j < SgReadStatement::pool_size; j++)
81260 : {
81261 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
81262 : {
81263 0 : nodeList.push_back(&(objectArray[i][j]));
81264 : }
81265 : }
81266 : }
81267 :
81268 : // Iterate over the saved list
81269 0 : size_t nodeListSize = nodeList.size();
81270 0 : for (size_t i=0; i < nodeListSize; i++)
81271 : {
81272 0 : ROSE_ASSERT(nodeList[i] != NULL);
81273 : #if 0
81274 : traversal.visit(nodeList[i]);
81275 : #else
81276 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
81277 : {
81278 0 : traversal.visit(nodeList[i]);
81279 : }
81280 : #endif
81281 : }
81282 : #endif
81283 : }
81284 :
81285 : // This should not be required since all previously static data members are
81286 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
81287 :
81288 5342 : }
81289 :
81290 :
81291 : void
81292 194 : SgReadStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
81293 : {
81294 : // This function traverses the memory pool for an IR node and
81295 : // calls the function to execute the visitor object.
81296 :
81297 : // Initialize array to the address of the first element of the STL vector
81298 : // (which is guarenteed to be contiguous storage).
81299 : // SgReadStatement objectArray [] = *(Memory_Block_List.begin());
81300 194 : if (SgReadStatement::pools.empty() == false)
81301 : {
81302 : // Generate an array of memory pools
81303 0 : SgReadStatement** objectArray = (SgReadStatement**) &(SgReadStatement::pools[0]);
81304 :
81305 : // Build a local variable for better performance
81306 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
81307 :
81308 : // Iterate over the memory pools
81309 0 : for (unsigned int i=0; i < SgReadStatement::pools.size(); i++)
81310 : {
81311 : // objectArray[i] is a single memory pool
81312 0 : for (unsigned j=0; j < SgReadStatement::pool_size; j++)
81313 : {
81314 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
81315 : {
81316 : // printf ("Found a valid SgReadStatement object in the memory pool %d at position %d \n",i,j);
81317 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
81318 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
81319 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
81320 : }
81321 : else
81322 : {
81323 : // printf ("Found a INVALID SgReadStatement object in the memory pool \n");
81324 : }
81325 : }
81326 : }
81327 : }
81328 :
81329 : // This should not be required since all previously static data members are
81330 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
81331 :
81332 194 : }
81333 :
81334 : void
81335 0 : SgReadStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
81336 : {
81337 : // This function visits only a single IR node of the memory pool.
81338 : // it is typically called once for each type of IR node within
81339 : // the automatically generated function: traverseRepresentativeNodes().
81340 :
81341 : // Initialize array to the address of the first element of the STL vector
81342 : // (which is guarenteed to be contiguous storage).
81343 : // SgReadStatement objectArray [] = *(Memory_Block_List.begin());
81344 0 : if (SgReadStatement::pools.empty() == false)
81345 : {
81346 : // Generate an array of memory pools
81347 0 : SgReadStatement** objectArray = (SgReadStatement**) &(SgReadStatement::pools[0]);
81348 :
81349 : // Build a local variable for better performance
81350 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
81351 :
81352 : // Iterate over the memory pools
81353 0 : bool done = false;
81354 0 : unsigned i=0;
81355 :
81356 : // find the first valid IR node, call visit function, and then leave
81357 0 : while ( done == false && i < SgReadStatement::pools.size() )
81358 : {
81359 : // objectArray[i] is a single memory pool
81360 : unsigned j=0;
81361 0 : while (done == false && j < SgReadStatement::pool_size)
81362 : {
81363 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
81364 : {
81365 0 : traversal.visit(&(objectArray[i][j]));
81366 0 : done = true;
81367 : }
81368 0 : j++;
81369 : }
81370 0 : i++;
81371 : }
81372 :
81373 : #if 0
81374 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
81375 : if (done == false)
81376 : {
81377 : printf ("No representative for SgReadStatement found in memory pools \n");
81378 : }
81379 : #endif
81380 : }
81381 0 : }
81382 :
81383 :
81384 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
81385 : // using values that overflow signed values of int.
81386 : size_t
81387 4 : SgReadStatement::numberOfNodes()
81388 : {
81389 : // This function traverses the memory pool for an IR node and
81390 : // counts the number of IR nodes of a particular Sage III IR
81391 : // nodes type.
81392 :
81393 4 : size_t count = 0;
81394 4 : if (SgReadStatement::pools.empty() == false)
81395 : {
81396 : // Generate an array of memory pools (this is actually a STL vector,
81397 : // but it is contiguious, so OK to treat this way).
81398 0 : SgReadStatement** objectArray = (SgReadStatement**) &(SgReadStatement::pools[0]);
81399 :
81400 : // Build a local variable for better performance (make it a loop invariant variable).
81401 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
81402 :
81403 : // Iterate over all of the memory pools for this IR node.
81404 0 : for (unsigned int i=0; i < SgReadStatement::pools.size(); i++)
81405 : {
81406 : // objectArray[i] is a single memory pool, iterate over all the
81407 : // IR nodes and only count those that are valid IR nodes used in
81408 : // the AST (i.e. allocated IR nodes).
81409 0 : for (unsigned j=0; j < SgReadStatement::pool_size; j++)
81410 : {
81411 : // This is indexing the STL vector of C/C++ style arrays as a doubly
81412 : // indexed array access. It is OK since we have leveraged the semantics
81413 : // of STL vector memory as contigous and cast the memory as an array
81414 : // of arrays to use the 2D array indexing. Hope this is not confusing,
81415 : // but it s very fast as an implementation.
81416 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
81417 : {
81418 0 : count++;
81419 : }
81420 : }
81421 : }
81422 : }
81423 :
81424 :
81425 :
81426 4 : return count;
81427 : }
81428 :
81429 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
81430 : // using values that overflow signed values of int.
81431 : size_t
81432 0 : SgReadStatement::memoryUsage()
81433 : {
81434 : // This function is required because we need the class name as a type when we call sizeof
81435 : // There might be another way to implement this if we have a traversal that only called a
81436 : // representative object (one call for each type of Sage IIIIR node).
81437 0 : size_t memory = numberOfNodes() * sizeof(SgReadStatement);
81438 :
81439 0 : return memory;
81440 : }
81441 :
81442 : /* #line 81443 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
81443 :
81444 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
81445 : void
81446 5342 : SgWriteStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
81447 : {
81448 : // This function traverses the memory pool for only a specific IR node
81449 : // and calls the visit function of the input class execute a traversal
81450 : // similar to the style of the attribute based traversals within ROSE.
81451 : // This traversal will visit ALL nodes of the AST where as the other
81452 : // attribute based traversals visit only the embedded tree within the AST.
81453 :
81454 : // Initialize array to the address of the first element of the STL vector
81455 : // (which is guaranteed to be contiguous storage).
81456 : // SgWriteStatement objectArray [] = *(Memory_Block_List.begin());
81457 5342 : if (SgWriteStatement::pools.empty() == false)
81458 : {
81459 : // Generate an array of memory pools
81460 20 : SgWriteStatement** objectArray = (SgWriteStatement**) &(SgWriteStatement::pools[0]);
81461 :
81462 : // Build a local variable for better performance
81463 20 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
81464 : #if 0
81465 : // Iterate over the memory pools
81466 : for (unsigned int i=0; i < SgWriteStatement::pools.size(); i++)
81467 : {
81468 : // objectArray[i] is a single memory pool
81469 : for (int j=0; j < SgWriteStatement::pool_size; j++)
81470 : {
81471 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
81472 : {
81473 : traversal.visit(&(objectArray[i][j]));
81474 : }
81475 : }
81476 : }
81477 : #else
81478 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
81479 : // compute the list first and then call the visit function on each list element.
81480 :
81481 : // printf ("Inside of SgWriteStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
81482 :
81483 40 : std::vector<SgWriteStatement*> nodeList;
81484 :
81485 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
81486 40 : for (unsigned int i=0; i < SgWriteStatement::pools.size(); i++)
81487 : {
81488 : // objectArray[i] is a single memory pool
81489 40020 : for (unsigned j=0; j < SgWriteStatement::pool_size; j++)
81490 : {
81491 40000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
81492 : {
81493 140 : nodeList.push_back(&(objectArray[i][j]));
81494 : }
81495 : }
81496 : }
81497 :
81498 : // Iterate over the saved list
81499 20 : size_t nodeListSize = nodeList.size();
81500 160 : for (size_t i=0; i < nodeListSize; i++)
81501 : {
81502 140 : ROSE_ASSERT(nodeList[i] != NULL);
81503 : #if 0
81504 : traversal.visit(nodeList[i]);
81505 : #else
81506 140 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
81507 : {
81508 140 : traversal.visit(nodeList[i]);
81509 : }
81510 : #endif
81511 : }
81512 : #endif
81513 : }
81514 :
81515 : // This should not be required since all previously static data members are
81516 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
81517 :
81518 5342 : }
81519 :
81520 :
81521 : void
81522 194 : SgWriteStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
81523 : {
81524 : // This function traverses the memory pool for an IR node and
81525 : // calls the function to execute the visitor object.
81526 :
81527 : // Initialize array to the address of the first element of the STL vector
81528 : // (which is guarenteed to be contiguous storage).
81529 : // SgWriteStatement objectArray [] = *(Memory_Block_List.begin());
81530 194 : if (SgWriteStatement::pools.empty() == false)
81531 : {
81532 : // Generate an array of memory pools
81533 0 : SgWriteStatement** objectArray = (SgWriteStatement**) &(SgWriteStatement::pools[0]);
81534 :
81535 : // Build a local variable for better performance
81536 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
81537 :
81538 : // Iterate over the memory pools
81539 0 : for (unsigned int i=0; i < SgWriteStatement::pools.size(); i++)
81540 : {
81541 : // objectArray[i] is a single memory pool
81542 0 : for (unsigned j=0; j < SgWriteStatement::pool_size; j++)
81543 : {
81544 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
81545 : {
81546 : // printf ("Found a valid SgWriteStatement object in the memory pool %d at position %d \n",i,j);
81547 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
81548 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
81549 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
81550 : }
81551 : else
81552 : {
81553 : // printf ("Found a INVALID SgWriteStatement object in the memory pool \n");
81554 : }
81555 : }
81556 : }
81557 : }
81558 :
81559 : // This should not be required since all previously static data members are
81560 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
81561 :
81562 194 : }
81563 :
81564 : void
81565 0 : SgWriteStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
81566 : {
81567 : // This function visits only a single IR node of the memory pool.
81568 : // it is typically called once for each type of IR node within
81569 : // the automatically generated function: traverseRepresentativeNodes().
81570 :
81571 : // Initialize array to the address of the first element of the STL vector
81572 : // (which is guarenteed to be contiguous storage).
81573 : // SgWriteStatement objectArray [] = *(Memory_Block_List.begin());
81574 0 : if (SgWriteStatement::pools.empty() == false)
81575 : {
81576 : // Generate an array of memory pools
81577 0 : SgWriteStatement** objectArray = (SgWriteStatement**) &(SgWriteStatement::pools[0]);
81578 :
81579 : // Build a local variable for better performance
81580 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
81581 :
81582 : // Iterate over the memory pools
81583 0 : bool done = false;
81584 0 : unsigned i=0;
81585 :
81586 : // find the first valid IR node, call visit function, and then leave
81587 0 : while ( done == false && i < SgWriteStatement::pools.size() )
81588 : {
81589 : // objectArray[i] is a single memory pool
81590 : unsigned j=0;
81591 0 : while (done == false && j < SgWriteStatement::pool_size)
81592 : {
81593 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
81594 : {
81595 0 : traversal.visit(&(objectArray[i][j]));
81596 0 : done = true;
81597 : }
81598 0 : j++;
81599 : }
81600 0 : i++;
81601 : }
81602 :
81603 : #if 0
81604 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
81605 : if (done == false)
81606 : {
81607 : printf ("No representative for SgWriteStatement found in memory pools \n");
81608 : }
81609 : #endif
81610 : }
81611 0 : }
81612 :
81613 :
81614 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
81615 : // using values that overflow signed values of int.
81616 : size_t
81617 4 : SgWriteStatement::numberOfNodes()
81618 : {
81619 : // This function traverses the memory pool for an IR node and
81620 : // counts the number of IR nodes of a particular Sage III IR
81621 : // nodes type.
81622 :
81623 4 : size_t count = 0;
81624 4 : if (SgWriteStatement::pools.empty() == false)
81625 : {
81626 : // Generate an array of memory pools (this is actually a STL vector,
81627 : // but it is contiguious, so OK to treat this way).
81628 0 : SgWriteStatement** objectArray = (SgWriteStatement**) &(SgWriteStatement::pools[0]);
81629 :
81630 : // Build a local variable for better performance (make it a loop invariant variable).
81631 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
81632 :
81633 : // Iterate over all of the memory pools for this IR node.
81634 0 : for (unsigned int i=0; i < SgWriteStatement::pools.size(); i++)
81635 : {
81636 : // objectArray[i] is a single memory pool, iterate over all the
81637 : // IR nodes and only count those that are valid IR nodes used in
81638 : // the AST (i.e. allocated IR nodes).
81639 0 : for (unsigned j=0; j < SgWriteStatement::pool_size; j++)
81640 : {
81641 : // This is indexing the STL vector of C/C++ style arrays as a doubly
81642 : // indexed array access. It is OK since we have leveraged the semantics
81643 : // of STL vector memory as contigous and cast the memory as an array
81644 : // of arrays to use the 2D array indexing. Hope this is not confusing,
81645 : // but it s very fast as an implementation.
81646 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
81647 : {
81648 0 : count++;
81649 : }
81650 : }
81651 : }
81652 : }
81653 :
81654 :
81655 :
81656 4 : return count;
81657 : }
81658 :
81659 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
81660 : // using values that overflow signed values of int.
81661 : size_t
81662 0 : SgWriteStatement::memoryUsage()
81663 : {
81664 : // This function is required because we need the class name as a type when we call sizeof
81665 : // There might be another way to implement this if we have a traversal that only called a
81666 : // representative object (one call for each type of Sage IIIIR node).
81667 0 : size_t memory = numberOfNodes() * sizeof(SgWriteStatement);
81668 :
81669 0 : return memory;
81670 : }
81671 :
81672 : /* #line 81673 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
81673 :
81674 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
81675 : void
81676 5342 : SgOpenStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
81677 : {
81678 : // This function traverses the memory pool for only a specific IR node
81679 : // and calls the visit function of the input class execute a traversal
81680 : // similar to the style of the attribute based traversals within ROSE.
81681 : // This traversal will visit ALL nodes of the AST where as the other
81682 : // attribute based traversals visit only the embedded tree within the AST.
81683 :
81684 : // Initialize array to the address of the first element of the STL vector
81685 : // (which is guaranteed to be contiguous storage).
81686 : // SgOpenStatement objectArray [] = *(Memory_Block_List.begin());
81687 5342 : if (SgOpenStatement::pools.empty() == false)
81688 : {
81689 : // Generate an array of memory pools
81690 0 : SgOpenStatement** objectArray = (SgOpenStatement**) &(SgOpenStatement::pools[0]);
81691 :
81692 : // Build a local variable for better performance
81693 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
81694 : #if 0
81695 : // Iterate over the memory pools
81696 : for (unsigned int i=0; i < SgOpenStatement::pools.size(); i++)
81697 : {
81698 : // objectArray[i] is a single memory pool
81699 : for (int j=0; j < SgOpenStatement::pool_size; j++)
81700 : {
81701 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
81702 : {
81703 : traversal.visit(&(objectArray[i][j]));
81704 : }
81705 : }
81706 : }
81707 : #else
81708 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
81709 : // compute the list first and then call the visit function on each list element.
81710 :
81711 : // printf ("Inside of SgOpenStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
81712 :
81713 0 : std::vector<SgOpenStatement*> nodeList;
81714 :
81715 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
81716 0 : for (unsigned int i=0; i < SgOpenStatement::pools.size(); i++)
81717 : {
81718 : // objectArray[i] is a single memory pool
81719 0 : for (unsigned j=0; j < SgOpenStatement::pool_size; j++)
81720 : {
81721 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
81722 : {
81723 0 : nodeList.push_back(&(objectArray[i][j]));
81724 : }
81725 : }
81726 : }
81727 :
81728 : // Iterate over the saved list
81729 0 : size_t nodeListSize = nodeList.size();
81730 0 : for (size_t i=0; i < nodeListSize; i++)
81731 : {
81732 0 : ROSE_ASSERT(nodeList[i] != NULL);
81733 : #if 0
81734 : traversal.visit(nodeList[i]);
81735 : #else
81736 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
81737 : {
81738 0 : traversal.visit(nodeList[i]);
81739 : }
81740 : #endif
81741 : }
81742 : #endif
81743 : }
81744 :
81745 : // This should not be required since all previously static data members are
81746 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
81747 :
81748 5342 : }
81749 :
81750 :
81751 : void
81752 194 : SgOpenStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
81753 : {
81754 : // This function traverses the memory pool for an IR node and
81755 : // calls the function to execute the visitor object.
81756 :
81757 : // Initialize array to the address of the first element of the STL vector
81758 : // (which is guarenteed to be contiguous storage).
81759 : // SgOpenStatement objectArray [] = *(Memory_Block_List.begin());
81760 194 : if (SgOpenStatement::pools.empty() == false)
81761 : {
81762 : // Generate an array of memory pools
81763 0 : SgOpenStatement** objectArray = (SgOpenStatement**) &(SgOpenStatement::pools[0]);
81764 :
81765 : // Build a local variable for better performance
81766 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
81767 :
81768 : // Iterate over the memory pools
81769 0 : for (unsigned int i=0; i < SgOpenStatement::pools.size(); i++)
81770 : {
81771 : // objectArray[i] is a single memory pool
81772 0 : for (unsigned j=0; j < SgOpenStatement::pool_size; j++)
81773 : {
81774 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
81775 : {
81776 : // printf ("Found a valid SgOpenStatement object in the memory pool %d at position %d \n",i,j);
81777 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
81778 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
81779 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
81780 : }
81781 : else
81782 : {
81783 : // printf ("Found a INVALID SgOpenStatement object in the memory pool \n");
81784 : }
81785 : }
81786 : }
81787 : }
81788 :
81789 : // This should not be required since all previously static data members are
81790 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
81791 :
81792 194 : }
81793 :
81794 : void
81795 0 : SgOpenStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
81796 : {
81797 : // This function visits only a single IR node of the memory pool.
81798 : // it is typically called once for each type of IR node within
81799 : // the automatically generated function: traverseRepresentativeNodes().
81800 :
81801 : // Initialize array to the address of the first element of the STL vector
81802 : // (which is guarenteed to be contiguous storage).
81803 : // SgOpenStatement objectArray [] = *(Memory_Block_List.begin());
81804 0 : if (SgOpenStatement::pools.empty() == false)
81805 : {
81806 : // Generate an array of memory pools
81807 0 : SgOpenStatement** objectArray = (SgOpenStatement**) &(SgOpenStatement::pools[0]);
81808 :
81809 : // Build a local variable for better performance
81810 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
81811 :
81812 : // Iterate over the memory pools
81813 0 : bool done = false;
81814 0 : unsigned i=0;
81815 :
81816 : // find the first valid IR node, call visit function, and then leave
81817 0 : while ( done == false && i < SgOpenStatement::pools.size() )
81818 : {
81819 : // objectArray[i] is a single memory pool
81820 : unsigned j=0;
81821 0 : while (done == false && j < SgOpenStatement::pool_size)
81822 : {
81823 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
81824 : {
81825 0 : traversal.visit(&(objectArray[i][j]));
81826 0 : done = true;
81827 : }
81828 0 : j++;
81829 : }
81830 0 : i++;
81831 : }
81832 :
81833 : #if 0
81834 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
81835 : if (done == false)
81836 : {
81837 : printf ("No representative for SgOpenStatement found in memory pools \n");
81838 : }
81839 : #endif
81840 : }
81841 0 : }
81842 :
81843 :
81844 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
81845 : // using values that overflow signed values of int.
81846 : size_t
81847 4 : SgOpenStatement::numberOfNodes()
81848 : {
81849 : // This function traverses the memory pool for an IR node and
81850 : // counts the number of IR nodes of a particular Sage III IR
81851 : // nodes type.
81852 :
81853 4 : size_t count = 0;
81854 4 : if (SgOpenStatement::pools.empty() == false)
81855 : {
81856 : // Generate an array of memory pools (this is actually a STL vector,
81857 : // but it is contiguious, so OK to treat this way).
81858 0 : SgOpenStatement** objectArray = (SgOpenStatement**) &(SgOpenStatement::pools[0]);
81859 :
81860 : // Build a local variable for better performance (make it a loop invariant variable).
81861 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
81862 :
81863 : // Iterate over all of the memory pools for this IR node.
81864 0 : for (unsigned int i=0; i < SgOpenStatement::pools.size(); i++)
81865 : {
81866 : // objectArray[i] is a single memory pool, iterate over all the
81867 : // IR nodes and only count those that are valid IR nodes used in
81868 : // the AST (i.e. allocated IR nodes).
81869 0 : for (unsigned j=0; j < SgOpenStatement::pool_size; j++)
81870 : {
81871 : // This is indexing the STL vector of C/C++ style arrays as a doubly
81872 : // indexed array access. It is OK since we have leveraged the semantics
81873 : // of STL vector memory as contigous and cast the memory as an array
81874 : // of arrays to use the 2D array indexing. Hope this is not confusing,
81875 : // but it s very fast as an implementation.
81876 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
81877 : {
81878 0 : count++;
81879 : }
81880 : }
81881 : }
81882 : }
81883 :
81884 :
81885 :
81886 4 : return count;
81887 : }
81888 :
81889 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
81890 : // using values that overflow signed values of int.
81891 : size_t
81892 0 : SgOpenStatement::memoryUsage()
81893 : {
81894 : // This function is required because we need the class name as a type when we call sizeof
81895 : // There might be another way to implement this if we have a traversal that only called a
81896 : // representative object (one call for each type of Sage IIIIR node).
81897 0 : size_t memory = numberOfNodes() * sizeof(SgOpenStatement);
81898 :
81899 0 : return memory;
81900 : }
81901 :
81902 : /* #line 81903 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
81903 :
81904 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
81905 : void
81906 5342 : SgCloseStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
81907 : {
81908 : // This function traverses the memory pool for only a specific IR node
81909 : // and calls the visit function of the input class execute a traversal
81910 : // similar to the style of the attribute based traversals within ROSE.
81911 : // This traversal will visit ALL nodes of the AST where as the other
81912 : // attribute based traversals visit only the embedded tree within the AST.
81913 :
81914 : // Initialize array to the address of the first element of the STL vector
81915 : // (which is guaranteed to be contiguous storage).
81916 : // SgCloseStatement objectArray [] = *(Memory_Block_List.begin());
81917 5342 : if (SgCloseStatement::pools.empty() == false)
81918 : {
81919 : // Generate an array of memory pools
81920 0 : SgCloseStatement** objectArray = (SgCloseStatement**) &(SgCloseStatement::pools[0]);
81921 :
81922 : // Build a local variable for better performance
81923 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
81924 : #if 0
81925 : // Iterate over the memory pools
81926 : for (unsigned int i=0; i < SgCloseStatement::pools.size(); i++)
81927 : {
81928 : // objectArray[i] is a single memory pool
81929 : for (int j=0; j < SgCloseStatement::pool_size; j++)
81930 : {
81931 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
81932 : {
81933 : traversal.visit(&(objectArray[i][j]));
81934 : }
81935 : }
81936 : }
81937 : #else
81938 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
81939 : // compute the list first and then call the visit function on each list element.
81940 :
81941 : // printf ("Inside of SgCloseStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
81942 :
81943 0 : std::vector<SgCloseStatement*> nodeList;
81944 :
81945 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
81946 0 : for (unsigned int i=0; i < SgCloseStatement::pools.size(); i++)
81947 : {
81948 : // objectArray[i] is a single memory pool
81949 0 : for (unsigned j=0; j < SgCloseStatement::pool_size; j++)
81950 : {
81951 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
81952 : {
81953 0 : nodeList.push_back(&(objectArray[i][j]));
81954 : }
81955 : }
81956 : }
81957 :
81958 : // Iterate over the saved list
81959 0 : size_t nodeListSize = nodeList.size();
81960 0 : for (size_t i=0; i < nodeListSize; i++)
81961 : {
81962 0 : ROSE_ASSERT(nodeList[i] != NULL);
81963 : #if 0
81964 : traversal.visit(nodeList[i]);
81965 : #else
81966 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
81967 : {
81968 0 : traversal.visit(nodeList[i]);
81969 : }
81970 : #endif
81971 : }
81972 : #endif
81973 : }
81974 :
81975 : // This should not be required since all previously static data members are
81976 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
81977 :
81978 5342 : }
81979 :
81980 :
81981 : void
81982 194 : SgCloseStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
81983 : {
81984 : // This function traverses the memory pool for an IR node and
81985 : // calls the function to execute the visitor object.
81986 :
81987 : // Initialize array to the address of the first element of the STL vector
81988 : // (which is guarenteed to be contiguous storage).
81989 : // SgCloseStatement objectArray [] = *(Memory_Block_List.begin());
81990 194 : if (SgCloseStatement::pools.empty() == false)
81991 : {
81992 : // Generate an array of memory pools
81993 0 : SgCloseStatement** objectArray = (SgCloseStatement**) &(SgCloseStatement::pools[0]);
81994 :
81995 : // Build a local variable for better performance
81996 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
81997 :
81998 : // Iterate over the memory pools
81999 0 : for (unsigned int i=0; i < SgCloseStatement::pools.size(); i++)
82000 : {
82001 : // objectArray[i] is a single memory pool
82002 0 : for (unsigned j=0; j < SgCloseStatement::pool_size; j++)
82003 : {
82004 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
82005 : {
82006 : // printf ("Found a valid SgCloseStatement object in the memory pool %d at position %d \n",i,j);
82007 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
82008 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
82009 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
82010 : }
82011 : else
82012 : {
82013 : // printf ("Found a INVALID SgCloseStatement object in the memory pool \n");
82014 : }
82015 : }
82016 : }
82017 : }
82018 :
82019 : // This should not be required since all previously static data members are
82020 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
82021 :
82022 194 : }
82023 :
82024 : void
82025 0 : SgCloseStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
82026 : {
82027 : // This function visits only a single IR node of the memory pool.
82028 : // it is typically called once for each type of IR node within
82029 : // the automatically generated function: traverseRepresentativeNodes().
82030 :
82031 : // Initialize array to the address of the first element of the STL vector
82032 : // (which is guarenteed to be contiguous storage).
82033 : // SgCloseStatement objectArray [] = *(Memory_Block_List.begin());
82034 0 : if (SgCloseStatement::pools.empty() == false)
82035 : {
82036 : // Generate an array of memory pools
82037 0 : SgCloseStatement** objectArray = (SgCloseStatement**) &(SgCloseStatement::pools[0]);
82038 :
82039 : // Build a local variable for better performance
82040 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
82041 :
82042 : // Iterate over the memory pools
82043 0 : bool done = false;
82044 0 : unsigned i=0;
82045 :
82046 : // find the first valid IR node, call visit function, and then leave
82047 0 : while ( done == false && i < SgCloseStatement::pools.size() )
82048 : {
82049 : // objectArray[i] is a single memory pool
82050 : unsigned j=0;
82051 0 : while (done == false && j < SgCloseStatement::pool_size)
82052 : {
82053 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
82054 : {
82055 0 : traversal.visit(&(objectArray[i][j]));
82056 0 : done = true;
82057 : }
82058 0 : j++;
82059 : }
82060 0 : i++;
82061 : }
82062 :
82063 : #if 0
82064 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
82065 : if (done == false)
82066 : {
82067 : printf ("No representative for SgCloseStatement found in memory pools \n");
82068 : }
82069 : #endif
82070 : }
82071 0 : }
82072 :
82073 :
82074 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
82075 : // using values that overflow signed values of int.
82076 : size_t
82077 4 : SgCloseStatement::numberOfNodes()
82078 : {
82079 : // This function traverses the memory pool for an IR node and
82080 : // counts the number of IR nodes of a particular Sage III IR
82081 : // nodes type.
82082 :
82083 4 : size_t count = 0;
82084 4 : if (SgCloseStatement::pools.empty() == false)
82085 : {
82086 : // Generate an array of memory pools (this is actually a STL vector,
82087 : // but it is contiguious, so OK to treat this way).
82088 0 : SgCloseStatement** objectArray = (SgCloseStatement**) &(SgCloseStatement::pools[0]);
82089 :
82090 : // Build a local variable for better performance (make it a loop invariant variable).
82091 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
82092 :
82093 : // Iterate over all of the memory pools for this IR node.
82094 0 : for (unsigned int i=0; i < SgCloseStatement::pools.size(); i++)
82095 : {
82096 : // objectArray[i] is a single memory pool, iterate over all the
82097 : // IR nodes and only count those that are valid IR nodes used in
82098 : // the AST (i.e. allocated IR nodes).
82099 0 : for (unsigned j=0; j < SgCloseStatement::pool_size; j++)
82100 : {
82101 : // This is indexing the STL vector of C/C++ style arrays as a doubly
82102 : // indexed array access. It is OK since we have leveraged the semantics
82103 : // of STL vector memory as contigous and cast the memory as an array
82104 : // of arrays to use the 2D array indexing. Hope this is not confusing,
82105 : // but it s very fast as an implementation.
82106 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
82107 : {
82108 0 : count++;
82109 : }
82110 : }
82111 : }
82112 : }
82113 :
82114 :
82115 :
82116 4 : return count;
82117 : }
82118 :
82119 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
82120 : // using values that overflow signed values of int.
82121 : size_t
82122 0 : SgCloseStatement::memoryUsage()
82123 : {
82124 : // This function is required because we need the class name as a type when we call sizeof
82125 : // There might be another way to implement this if we have a traversal that only called a
82126 : // representative object (one call for each type of Sage IIIIR node).
82127 0 : size_t memory = numberOfNodes() * sizeof(SgCloseStatement);
82128 :
82129 0 : return memory;
82130 : }
82131 :
82132 : /* #line 82133 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
82133 :
82134 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
82135 : void
82136 5342 : SgInquireStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
82137 : {
82138 : // This function traverses the memory pool for only a specific IR node
82139 : // and calls the visit function of the input class execute a traversal
82140 : // similar to the style of the attribute based traversals within ROSE.
82141 : // This traversal will visit ALL nodes of the AST where as the other
82142 : // attribute based traversals visit only the embedded tree within the AST.
82143 :
82144 : // Initialize array to the address of the first element of the STL vector
82145 : // (which is guaranteed to be contiguous storage).
82146 : // SgInquireStatement objectArray [] = *(Memory_Block_List.begin());
82147 5342 : if (SgInquireStatement::pools.empty() == false)
82148 : {
82149 : // Generate an array of memory pools
82150 0 : SgInquireStatement** objectArray = (SgInquireStatement**) &(SgInquireStatement::pools[0]);
82151 :
82152 : // Build a local variable for better performance
82153 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
82154 : #if 0
82155 : // Iterate over the memory pools
82156 : for (unsigned int i=0; i < SgInquireStatement::pools.size(); i++)
82157 : {
82158 : // objectArray[i] is a single memory pool
82159 : for (int j=0; j < SgInquireStatement::pool_size; j++)
82160 : {
82161 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
82162 : {
82163 : traversal.visit(&(objectArray[i][j]));
82164 : }
82165 : }
82166 : }
82167 : #else
82168 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
82169 : // compute the list first and then call the visit function on each list element.
82170 :
82171 : // printf ("Inside of SgInquireStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
82172 :
82173 0 : std::vector<SgInquireStatement*> nodeList;
82174 :
82175 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
82176 0 : for (unsigned int i=0; i < SgInquireStatement::pools.size(); i++)
82177 : {
82178 : // objectArray[i] is a single memory pool
82179 0 : for (unsigned j=0; j < SgInquireStatement::pool_size; j++)
82180 : {
82181 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
82182 : {
82183 0 : nodeList.push_back(&(objectArray[i][j]));
82184 : }
82185 : }
82186 : }
82187 :
82188 : // Iterate over the saved list
82189 0 : size_t nodeListSize = nodeList.size();
82190 0 : for (size_t i=0; i < nodeListSize; i++)
82191 : {
82192 0 : ROSE_ASSERT(nodeList[i] != NULL);
82193 : #if 0
82194 : traversal.visit(nodeList[i]);
82195 : #else
82196 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
82197 : {
82198 0 : traversal.visit(nodeList[i]);
82199 : }
82200 : #endif
82201 : }
82202 : #endif
82203 : }
82204 :
82205 : // This should not be required since all previously static data members are
82206 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
82207 :
82208 5342 : }
82209 :
82210 :
82211 : void
82212 194 : SgInquireStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
82213 : {
82214 : // This function traverses the memory pool for an IR node and
82215 : // calls the function to execute the visitor object.
82216 :
82217 : // Initialize array to the address of the first element of the STL vector
82218 : // (which is guarenteed to be contiguous storage).
82219 : // SgInquireStatement objectArray [] = *(Memory_Block_List.begin());
82220 194 : if (SgInquireStatement::pools.empty() == false)
82221 : {
82222 : // Generate an array of memory pools
82223 0 : SgInquireStatement** objectArray = (SgInquireStatement**) &(SgInquireStatement::pools[0]);
82224 :
82225 : // Build a local variable for better performance
82226 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
82227 :
82228 : // Iterate over the memory pools
82229 0 : for (unsigned int i=0; i < SgInquireStatement::pools.size(); i++)
82230 : {
82231 : // objectArray[i] is a single memory pool
82232 0 : for (unsigned j=0; j < SgInquireStatement::pool_size; j++)
82233 : {
82234 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
82235 : {
82236 : // printf ("Found a valid SgInquireStatement object in the memory pool %d at position %d \n",i,j);
82237 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
82238 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
82239 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
82240 : }
82241 : else
82242 : {
82243 : // printf ("Found a INVALID SgInquireStatement object in the memory pool \n");
82244 : }
82245 : }
82246 : }
82247 : }
82248 :
82249 : // This should not be required since all previously static data members are
82250 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
82251 :
82252 194 : }
82253 :
82254 : void
82255 0 : SgInquireStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
82256 : {
82257 : // This function visits only a single IR node of the memory pool.
82258 : // it is typically called once for each type of IR node within
82259 : // the automatically generated function: traverseRepresentativeNodes().
82260 :
82261 : // Initialize array to the address of the first element of the STL vector
82262 : // (which is guarenteed to be contiguous storage).
82263 : // SgInquireStatement objectArray [] = *(Memory_Block_List.begin());
82264 0 : if (SgInquireStatement::pools.empty() == false)
82265 : {
82266 : // Generate an array of memory pools
82267 0 : SgInquireStatement** objectArray = (SgInquireStatement**) &(SgInquireStatement::pools[0]);
82268 :
82269 : // Build a local variable for better performance
82270 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
82271 :
82272 : // Iterate over the memory pools
82273 0 : bool done = false;
82274 0 : unsigned i=0;
82275 :
82276 : // find the first valid IR node, call visit function, and then leave
82277 0 : while ( done == false && i < SgInquireStatement::pools.size() )
82278 : {
82279 : // objectArray[i] is a single memory pool
82280 : unsigned j=0;
82281 0 : while (done == false && j < SgInquireStatement::pool_size)
82282 : {
82283 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
82284 : {
82285 0 : traversal.visit(&(objectArray[i][j]));
82286 0 : done = true;
82287 : }
82288 0 : j++;
82289 : }
82290 0 : i++;
82291 : }
82292 :
82293 : #if 0
82294 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
82295 : if (done == false)
82296 : {
82297 : printf ("No representative for SgInquireStatement found in memory pools \n");
82298 : }
82299 : #endif
82300 : }
82301 0 : }
82302 :
82303 :
82304 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
82305 : // using values that overflow signed values of int.
82306 : size_t
82307 4 : SgInquireStatement::numberOfNodes()
82308 : {
82309 : // This function traverses the memory pool for an IR node and
82310 : // counts the number of IR nodes of a particular Sage III IR
82311 : // nodes type.
82312 :
82313 4 : size_t count = 0;
82314 4 : if (SgInquireStatement::pools.empty() == false)
82315 : {
82316 : // Generate an array of memory pools (this is actually a STL vector,
82317 : // but it is contiguious, so OK to treat this way).
82318 0 : SgInquireStatement** objectArray = (SgInquireStatement**) &(SgInquireStatement::pools[0]);
82319 :
82320 : // Build a local variable for better performance (make it a loop invariant variable).
82321 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
82322 :
82323 : // Iterate over all of the memory pools for this IR node.
82324 0 : for (unsigned int i=0; i < SgInquireStatement::pools.size(); i++)
82325 : {
82326 : // objectArray[i] is a single memory pool, iterate over all the
82327 : // IR nodes and only count those that are valid IR nodes used in
82328 : // the AST (i.e. allocated IR nodes).
82329 0 : for (unsigned j=0; j < SgInquireStatement::pool_size; j++)
82330 : {
82331 : // This is indexing the STL vector of C/C++ style arrays as a doubly
82332 : // indexed array access. It is OK since we have leveraged the semantics
82333 : // of STL vector memory as contigous and cast the memory as an array
82334 : // of arrays to use the 2D array indexing. Hope this is not confusing,
82335 : // but it s very fast as an implementation.
82336 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
82337 : {
82338 0 : count++;
82339 : }
82340 : }
82341 : }
82342 : }
82343 :
82344 :
82345 :
82346 4 : return count;
82347 : }
82348 :
82349 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
82350 : // using values that overflow signed values of int.
82351 : size_t
82352 0 : SgInquireStatement::memoryUsage()
82353 : {
82354 : // This function is required because we need the class name as a type when we call sizeof
82355 : // There might be another way to implement this if we have a traversal that only called a
82356 : // representative object (one call for each type of Sage IIIIR node).
82357 0 : size_t memory = numberOfNodes() * sizeof(SgInquireStatement);
82358 :
82359 0 : return memory;
82360 : }
82361 :
82362 : /* #line 82363 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
82363 :
82364 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
82365 : void
82366 5342 : SgFlushStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
82367 : {
82368 : // This function traverses the memory pool for only a specific IR node
82369 : // and calls the visit function of the input class execute a traversal
82370 : // similar to the style of the attribute based traversals within ROSE.
82371 : // This traversal will visit ALL nodes of the AST where as the other
82372 : // attribute based traversals visit only the embedded tree within the AST.
82373 :
82374 : // Initialize array to the address of the first element of the STL vector
82375 : // (which is guaranteed to be contiguous storage).
82376 : // SgFlushStatement objectArray [] = *(Memory_Block_List.begin());
82377 5342 : if (SgFlushStatement::pools.empty() == false)
82378 : {
82379 : // Generate an array of memory pools
82380 0 : SgFlushStatement** objectArray = (SgFlushStatement**) &(SgFlushStatement::pools[0]);
82381 :
82382 : // Build a local variable for better performance
82383 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
82384 : #if 0
82385 : // Iterate over the memory pools
82386 : for (unsigned int i=0; i < SgFlushStatement::pools.size(); i++)
82387 : {
82388 : // objectArray[i] is a single memory pool
82389 : for (int j=0; j < SgFlushStatement::pool_size; j++)
82390 : {
82391 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
82392 : {
82393 : traversal.visit(&(objectArray[i][j]));
82394 : }
82395 : }
82396 : }
82397 : #else
82398 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
82399 : // compute the list first and then call the visit function on each list element.
82400 :
82401 : // printf ("Inside of SgFlushStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
82402 :
82403 0 : std::vector<SgFlushStatement*> nodeList;
82404 :
82405 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
82406 0 : for (unsigned int i=0; i < SgFlushStatement::pools.size(); i++)
82407 : {
82408 : // objectArray[i] is a single memory pool
82409 0 : for (unsigned j=0; j < SgFlushStatement::pool_size; j++)
82410 : {
82411 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
82412 : {
82413 0 : nodeList.push_back(&(objectArray[i][j]));
82414 : }
82415 : }
82416 : }
82417 :
82418 : // Iterate over the saved list
82419 0 : size_t nodeListSize = nodeList.size();
82420 0 : for (size_t i=0; i < nodeListSize; i++)
82421 : {
82422 0 : ROSE_ASSERT(nodeList[i] != NULL);
82423 : #if 0
82424 : traversal.visit(nodeList[i]);
82425 : #else
82426 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
82427 : {
82428 0 : traversal.visit(nodeList[i]);
82429 : }
82430 : #endif
82431 : }
82432 : #endif
82433 : }
82434 :
82435 : // This should not be required since all previously static data members are
82436 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
82437 :
82438 5342 : }
82439 :
82440 :
82441 : void
82442 194 : SgFlushStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
82443 : {
82444 : // This function traverses the memory pool for an IR node and
82445 : // calls the function to execute the visitor object.
82446 :
82447 : // Initialize array to the address of the first element of the STL vector
82448 : // (which is guarenteed to be contiguous storage).
82449 : // SgFlushStatement objectArray [] = *(Memory_Block_List.begin());
82450 194 : if (SgFlushStatement::pools.empty() == false)
82451 : {
82452 : // Generate an array of memory pools
82453 0 : SgFlushStatement** objectArray = (SgFlushStatement**) &(SgFlushStatement::pools[0]);
82454 :
82455 : // Build a local variable for better performance
82456 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
82457 :
82458 : // Iterate over the memory pools
82459 0 : for (unsigned int i=0; i < SgFlushStatement::pools.size(); i++)
82460 : {
82461 : // objectArray[i] is a single memory pool
82462 0 : for (unsigned j=0; j < SgFlushStatement::pool_size; j++)
82463 : {
82464 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
82465 : {
82466 : // printf ("Found a valid SgFlushStatement object in the memory pool %d at position %d \n",i,j);
82467 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
82468 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
82469 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
82470 : }
82471 : else
82472 : {
82473 : // printf ("Found a INVALID SgFlushStatement object in the memory pool \n");
82474 : }
82475 : }
82476 : }
82477 : }
82478 :
82479 : // This should not be required since all previously static data members are
82480 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
82481 :
82482 194 : }
82483 :
82484 : void
82485 0 : SgFlushStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
82486 : {
82487 : // This function visits only a single IR node of the memory pool.
82488 : // it is typically called once for each type of IR node within
82489 : // the automatically generated function: traverseRepresentativeNodes().
82490 :
82491 : // Initialize array to the address of the first element of the STL vector
82492 : // (which is guarenteed to be contiguous storage).
82493 : // SgFlushStatement objectArray [] = *(Memory_Block_List.begin());
82494 0 : if (SgFlushStatement::pools.empty() == false)
82495 : {
82496 : // Generate an array of memory pools
82497 0 : SgFlushStatement** objectArray = (SgFlushStatement**) &(SgFlushStatement::pools[0]);
82498 :
82499 : // Build a local variable for better performance
82500 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
82501 :
82502 : // Iterate over the memory pools
82503 0 : bool done = false;
82504 0 : unsigned i=0;
82505 :
82506 : // find the first valid IR node, call visit function, and then leave
82507 0 : while ( done == false && i < SgFlushStatement::pools.size() )
82508 : {
82509 : // objectArray[i] is a single memory pool
82510 : unsigned j=0;
82511 0 : while (done == false && j < SgFlushStatement::pool_size)
82512 : {
82513 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
82514 : {
82515 0 : traversal.visit(&(objectArray[i][j]));
82516 0 : done = true;
82517 : }
82518 0 : j++;
82519 : }
82520 0 : i++;
82521 : }
82522 :
82523 : #if 0
82524 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
82525 : if (done == false)
82526 : {
82527 : printf ("No representative for SgFlushStatement found in memory pools \n");
82528 : }
82529 : #endif
82530 : }
82531 0 : }
82532 :
82533 :
82534 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
82535 : // using values that overflow signed values of int.
82536 : size_t
82537 4 : SgFlushStatement::numberOfNodes()
82538 : {
82539 : // This function traverses the memory pool for an IR node and
82540 : // counts the number of IR nodes of a particular Sage III IR
82541 : // nodes type.
82542 :
82543 4 : size_t count = 0;
82544 4 : if (SgFlushStatement::pools.empty() == false)
82545 : {
82546 : // Generate an array of memory pools (this is actually a STL vector,
82547 : // but it is contiguious, so OK to treat this way).
82548 0 : SgFlushStatement** objectArray = (SgFlushStatement**) &(SgFlushStatement::pools[0]);
82549 :
82550 : // Build a local variable for better performance (make it a loop invariant variable).
82551 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
82552 :
82553 : // Iterate over all of the memory pools for this IR node.
82554 0 : for (unsigned int i=0; i < SgFlushStatement::pools.size(); i++)
82555 : {
82556 : // objectArray[i] is a single memory pool, iterate over all the
82557 : // IR nodes and only count those that are valid IR nodes used in
82558 : // the AST (i.e. allocated IR nodes).
82559 0 : for (unsigned j=0; j < SgFlushStatement::pool_size; j++)
82560 : {
82561 : // This is indexing the STL vector of C/C++ style arrays as a doubly
82562 : // indexed array access. It is OK since we have leveraged the semantics
82563 : // of STL vector memory as contigous and cast the memory as an array
82564 : // of arrays to use the 2D array indexing. Hope this is not confusing,
82565 : // but it s very fast as an implementation.
82566 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
82567 : {
82568 0 : count++;
82569 : }
82570 : }
82571 : }
82572 : }
82573 :
82574 :
82575 :
82576 4 : return count;
82577 : }
82578 :
82579 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
82580 : // using values that overflow signed values of int.
82581 : size_t
82582 0 : SgFlushStatement::memoryUsage()
82583 : {
82584 : // This function is required because we need the class name as a type when we call sizeof
82585 : // There might be another way to implement this if we have a traversal that only called a
82586 : // representative object (one call for each type of Sage IIIIR node).
82587 0 : size_t memory = numberOfNodes() * sizeof(SgFlushStatement);
82588 :
82589 0 : return memory;
82590 : }
82591 :
82592 : /* #line 82593 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
82593 :
82594 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
82595 : void
82596 5342 : SgBackspaceStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
82597 : {
82598 : // This function traverses the memory pool for only a specific IR node
82599 : // and calls the visit function of the input class execute a traversal
82600 : // similar to the style of the attribute based traversals within ROSE.
82601 : // This traversal will visit ALL nodes of the AST where as the other
82602 : // attribute based traversals visit only the embedded tree within the AST.
82603 :
82604 : // Initialize array to the address of the first element of the STL vector
82605 : // (which is guaranteed to be contiguous storage).
82606 : // SgBackspaceStatement objectArray [] = *(Memory_Block_List.begin());
82607 5342 : if (SgBackspaceStatement::pools.empty() == false)
82608 : {
82609 : // Generate an array of memory pools
82610 0 : SgBackspaceStatement** objectArray = (SgBackspaceStatement**) &(SgBackspaceStatement::pools[0]);
82611 :
82612 : // Build a local variable for better performance
82613 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
82614 : #if 0
82615 : // Iterate over the memory pools
82616 : for (unsigned int i=0; i < SgBackspaceStatement::pools.size(); i++)
82617 : {
82618 : // objectArray[i] is a single memory pool
82619 : for (int j=0; j < SgBackspaceStatement::pool_size; j++)
82620 : {
82621 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
82622 : {
82623 : traversal.visit(&(objectArray[i][j]));
82624 : }
82625 : }
82626 : }
82627 : #else
82628 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
82629 : // compute the list first and then call the visit function on each list element.
82630 :
82631 : // printf ("Inside of SgBackspaceStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
82632 :
82633 0 : std::vector<SgBackspaceStatement*> nodeList;
82634 :
82635 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
82636 0 : for (unsigned int i=0; i < SgBackspaceStatement::pools.size(); i++)
82637 : {
82638 : // objectArray[i] is a single memory pool
82639 0 : for (unsigned j=0; j < SgBackspaceStatement::pool_size; j++)
82640 : {
82641 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
82642 : {
82643 0 : nodeList.push_back(&(objectArray[i][j]));
82644 : }
82645 : }
82646 : }
82647 :
82648 : // Iterate over the saved list
82649 0 : size_t nodeListSize = nodeList.size();
82650 0 : for (size_t i=0; i < nodeListSize; i++)
82651 : {
82652 0 : ROSE_ASSERT(nodeList[i] != NULL);
82653 : #if 0
82654 : traversal.visit(nodeList[i]);
82655 : #else
82656 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
82657 : {
82658 0 : traversal.visit(nodeList[i]);
82659 : }
82660 : #endif
82661 : }
82662 : #endif
82663 : }
82664 :
82665 : // This should not be required since all previously static data members are
82666 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
82667 :
82668 5342 : }
82669 :
82670 :
82671 : void
82672 194 : SgBackspaceStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
82673 : {
82674 : // This function traverses the memory pool for an IR node and
82675 : // calls the function to execute the visitor object.
82676 :
82677 : // Initialize array to the address of the first element of the STL vector
82678 : // (which is guarenteed to be contiguous storage).
82679 : // SgBackspaceStatement objectArray [] = *(Memory_Block_List.begin());
82680 194 : if (SgBackspaceStatement::pools.empty() == false)
82681 : {
82682 : // Generate an array of memory pools
82683 0 : SgBackspaceStatement** objectArray = (SgBackspaceStatement**) &(SgBackspaceStatement::pools[0]);
82684 :
82685 : // Build a local variable for better performance
82686 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
82687 :
82688 : // Iterate over the memory pools
82689 0 : for (unsigned int i=0; i < SgBackspaceStatement::pools.size(); i++)
82690 : {
82691 : // objectArray[i] is a single memory pool
82692 0 : for (unsigned j=0; j < SgBackspaceStatement::pool_size; j++)
82693 : {
82694 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
82695 : {
82696 : // printf ("Found a valid SgBackspaceStatement object in the memory pool %d at position %d \n",i,j);
82697 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
82698 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
82699 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
82700 : }
82701 : else
82702 : {
82703 : // printf ("Found a INVALID SgBackspaceStatement object in the memory pool \n");
82704 : }
82705 : }
82706 : }
82707 : }
82708 :
82709 : // This should not be required since all previously static data members are
82710 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
82711 :
82712 194 : }
82713 :
82714 : void
82715 0 : SgBackspaceStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
82716 : {
82717 : // This function visits only a single IR node of the memory pool.
82718 : // it is typically called once for each type of IR node within
82719 : // the automatically generated function: traverseRepresentativeNodes().
82720 :
82721 : // Initialize array to the address of the first element of the STL vector
82722 : // (which is guarenteed to be contiguous storage).
82723 : // SgBackspaceStatement objectArray [] = *(Memory_Block_List.begin());
82724 0 : if (SgBackspaceStatement::pools.empty() == false)
82725 : {
82726 : // Generate an array of memory pools
82727 0 : SgBackspaceStatement** objectArray = (SgBackspaceStatement**) &(SgBackspaceStatement::pools[0]);
82728 :
82729 : // Build a local variable for better performance
82730 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
82731 :
82732 : // Iterate over the memory pools
82733 0 : bool done = false;
82734 0 : unsigned i=0;
82735 :
82736 : // find the first valid IR node, call visit function, and then leave
82737 0 : while ( done == false && i < SgBackspaceStatement::pools.size() )
82738 : {
82739 : // objectArray[i] is a single memory pool
82740 : unsigned j=0;
82741 0 : while (done == false && j < SgBackspaceStatement::pool_size)
82742 : {
82743 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
82744 : {
82745 0 : traversal.visit(&(objectArray[i][j]));
82746 0 : done = true;
82747 : }
82748 0 : j++;
82749 : }
82750 0 : i++;
82751 : }
82752 :
82753 : #if 0
82754 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
82755 : if (done == false)
82756 : {
82757 : printf ("No representative for SgBackspaceStatement found in memory pools \n");
82758 : }
82759 : #endif
82760 : }
82761 0 : }
82762 :
82763 :
82764 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
82765 : // using values that overflow signed values of int.
82766 : size_t
82767 4 : SgBackspaceStatement::numberOfNodes()
82768 : {
82769 : // This function traverses the memory pool for an IR node and
82770 : // counts the number of IR nodes of a particular Sage III IR
82771 : // nodes type.
82772 :
82773 4 : size_t count = 0;
82774 4 : if (SgBackspaceStatement::pools.empty() == false)
82775 : {
82776 : // Generate an array of memory pools (this is actually a STL vector,
82777 : // but it is contiguious, so OK to treat this way).
82778 0 : SgBackspaceStatement** objectArray = (SgBackspaceStatement**) &(SgBackspaceStatement::pools[0]);
82779 :
82780 : // Build a local variable for better performance (make it a loop invariant variable).
82781 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
82782 :
82783 : // Iterate over all of the memory pools for this IR node.
82784 0 : for (unsigned int i=0; i < SgBackspaceStatement::pools.size(); i++)
82785 : {
82786 : // objectArray[i] is a single memory pool, iterate over all the
82787 : // IR nodes and only count those that are valid IR nodes used in
82788 : // the AST (i.e. allocated IR nodes).
82789 0 : for (unsigned j=0; j < SgBackspaceStatement::pool_size; j++)
82790 : {
82791 : // This is indexing the STL vector of C/C++ style arrays as a doubly
82792 : // indexed array access. It is OK since we have leveraged the semantics
82793 : // of STL vector memory as contigous and cast the memory as an array
82794 : // of arrays to use the 2D array indexing. Hope this is not confusing,
82795 : // but it s very fast as an implementation.
82796 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
82797 : {
82798 0 : count++;
82799 : }
82800 : }
82801 : }
82802 : }
82803 :
82804 :
82805 :
82806 4 : return count;
82807 : }
82808 :
82809 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
82810 : // using values that overflow signed values of int.
82811 : size_t
82812 0 : SgBackspaceStatement::memoryUsage()
82813 : {
82814 : // This function is required because we need the class name as a type when we call sizeof
82815 : // There might be another way to implement this if we have a traversal that only called a
82816 : // representative object (one call for each type of Sage IIIIR node).
82817 0 : size_t memory = numberOfNodes() * sizeof(SgBackspaceStatement);
82818 :
82819 0 : return memory;
82820 : }
82821 :
82822 : /* #line 82823 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
82823 :
82824 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
82825 : void
82826 5342 : SgRewindStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
82827 : {
82828 : // This function traverses the memory pool for only a specific IR node
82829 : // and calls the visit function of the input class execute a traversal
82830 : // similar to the style of the attribute based traversals within ROSE.
82831 : // This traversal will visit ALL nodes of the AST where as the other
82832 : // attribute based traversals visit only the embedded tree within the AST.
82833 :
82834 : // Initialize array to the address of the first element of the STL vector
82835 : // (which is guaranteed to be contiguous storage).
82836 : // SgRewindStatement objectArray [] = *(Memory_Block_List.begin());
82837 5342 : if (SgRewindStatement::pools.empty() == false)
82838 : {
82839 : // Generate an array of memory pools
82840 0 : SgRewindStatement** objectArray = (SgRewindStatement**) &(SgRewindStatement::pools[0]);
82841 :
82842 : // Build a local variable for better performance
82843 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
82844 : #if 0
82845 : // Iterate over the memory pools
82846 : for (unsigned int i=0; i < SgRewindStatement::pools.size(); i++)
82847 : {
82848 : // objectArray[i] is a single memory pool
82849 : for (int j=0; j < SgRewindStatement::pool_size; j++)
82850 : {
82851 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
82852 : {
82853 : traversal.visit(&(objectArray[i][j]));
82854 : }
82855 : }
82856 : }
82857 : #else
82858 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
82859 : // compute the list first and then call the visit function on each list element.
82860 :
82861 : // printf ("Inside of SgRewindStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
82862 :
82863 0 : std::vector<SgRewindStatement*> nodeList;
82864 :
82865 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
82866 0 : for (unsigned int i=0; i < SgRewindStatement::pools.size(); i++)
82867 : {
82868 : // objectArray[i] is a single memory pool
82869 0 : for (unsigned j=0; j < SgRewindStatement::pool_size; j++)
82870 : {
82871 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
82872 : {
82873 0 : nodeList.push_back(&(objectArray[i][j]));
82874 : }
82875 : }
82876 : }
82877 :
82878 : // Iterate over the saved list
82879 0 : size_t nodeListSize = nodeList.size();
82880 0 : for (size_t i=0; i < nodeListSize; i++)
82881 : {
82882 0 : ROSE_ASSERT(nodeList[i] != NULL);
82883 : #if 0
82884 : traversal.visit(nodeList[i]);
82885 : #else
82886 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
82887 : {
82888 0 : traversal.visit(nodeList[i]);
82889 : }
82890 : #endif
82891 : }
82892 : #endif
82893 : }
82894 :
82895 : // This should not be required since all previously static data members are
82896 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
82897 :
82898 5342 : }
82899 :
82900 :
82901 : void
82902 194 : SgRewindStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
82903 : {
82904 : // This function traverses the memory pool for an IR node and
82905 : // calls the function to execute the visitor object.
82906 :
82907 : // Initialize array to the address of the first element of the STL vector
82908 : // (which is guarenteed to be contiguous storage).
82909 : // SgRewindStatement objectArray [] = *(Memory_Block_List.begin());
82910 194 : if (SgRewindStatement::pools.empty() == false)
82911 : {
82912 : // Generate an array of memory pools
82913 0 : SgRewindStatement** objectArray = (SgRewindStatement**) &(SgRewindStatement::pools[0]);
82914 :
82915 : // Build a local variable for better performance
82916 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
82917 :
82918 : // Iterate over the memory pools
82919 0 : for (unsigned int i=0; i < SgRewindStatement::pools.size(); i++)
82920 : {
82921 : // objectArray[i] is a single memory pool
82922 0 : for (unsigned j=0; j < SgRewindStatement::pool_size; j++)
82923 : {
82924 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
82925 : {
82926 : // printf ("Found a valid SgRewindStatement object in the memory pool %d at position %d \n",i,j);
82927 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
82928 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
82929 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
82930 : }
82931 : else
82932 : {
82933 : // printf ("Found a INVALID SgRewindStatement object in the memory pool \n");
82934 : }
82935 : }
82936 : }
82937 : }
82938 :
82939 : // This should not be required since all previously static data members are
82940 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
82941 :
82942 194 : }
82943 :
82944 : void
82945 0 : SgRewindStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
82946 : {
82947 : // This function visits only a single IR node of the memory pool.
82948 : // it is typically called once for each type of IR node within
82949 : // the automatically generated function: traverseRepresentativeNodes().
82950 :
82951 : // Initialize array to the address of the first element of the STL vector
82952 : // (which is guarenteed to be contiguous storage).
82953 : // SgRewindStatement objectArray [] = *(Memory_Block_List.begin());
82954 0 : if (SgRewindStatement::pools.empty() == false)
82955 : {
82956 : // Generate an array of memory pools
82957 0 : SgRewindStatement** objectArray = (SgRewindStatement**) &(SgRewindStatement::pools[0]);
82958 :
82959 : // Build a local variable for better performance
82960 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
82961 :
82962 : // Iterate over the memory pools
82963 0 : bool done = false;
82964 0 : unsigned i=0;
82965 :
82966 : // find the first valid IR node, call visit function, and then leave
82967 0 : while ( done == false && i < SgRewindStatement::pools.size() )
82968 : {
82969 : // objectArray[i] is a single memory pool
82970 : unsigned j=0;
82971 0 : while (done == false && j < SgRewindStatement::pool_size)
82972 : {
82973 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
82974 : {
82975 0 : traversal.visit(&(objectArray[i][j]));
82976 0 : done = true;
82977 : }
82978 0 : j++;
82979 : }
82980 0 : i++;
82981 : }
82982 :
82983 : #if 0
82984 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
82985 : if (done == false)
82986 : {
82987 : printf ("No representative for SgRewindStatement found in memory pools \n");
82988 : }
82989 : #endif
82990 : }
82991 0 : }
82992 :
82993 :
82994 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
82995 : // using values that overflow signed values of int.
82996 : size_t
82997 4 : SgRewindStatement::numberOfNodes()
82998 : {
82999 : // This function traverses the memory pool for an IR node and
83000 : // counts the number of IR nodes of a particular Sage III IR
83001 : // nodes type.
83002 :
83003 4 : size_t count = 0;
83004 4 : if (SgRewindStatement::pools.empty() == false)
83005 : {
83006 : // Generate an array of memory pools (this is actually a STL vector,
83007 : // but it is contiguious, so OK to treat this way).
83008 0 : SgRewindStatement** objectArray = (SgRewindStatement**) &(SgRewindStatement::pools[0]);
83009 :
83010 : // Build a local variable for better performance (make it a loop invariant variable).
83011 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
83012 :
83013 : // Iterate over all of the memory pools for this IR node.
83014 0 : for (unsigned int i=0; i < SgRewindStatement::pools.size(); i++)
83015 : {
83016 : // objectArray[i] is a single memory pool, iterate over all the
83017 : // IR nodes and only count those that are valid IR nodes used in
83018 : // the AST (i.e. allocated IR nodes).
83019 0 : for (unsigned j=0; j < SgRewindStatement::pool_size; j++)
83020 : {
83021 : // This is indexing the STL vector of C/C++ style arrays as a doubly
83022 : // indexed array access. It is OK since we have leveraged the semantics
83023 : // of STL vector memory as contigous and cast the memory as an array
83024 : // of arrays to use the 2D array indexing. Hope this is not confusing,
83025 : // but it s very fast as an implementation.
83026 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
83027 : {
83028 0 : count++;
83029 : }
83030 : }
83031 : }
83032 : }
83033 :
83034 :
83035 :
83036 4 : return count;
83037 : }
83038 :
83039 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
83040 : // using values that overflow signed values of int.
83041 : size_t
83042 0 : SgRewindStatement::memoryUsage()
83043 : {
83044 : // This function is required because we need the class name as a type when we call sizeof
83045 : // There might be another way to implement this if we have a traversal that only called a
83046 : // representative object (one call for each type of Sage IIIIR node).
83047 0 : size_t memory = numberOfNodes() * sizeof(SgRewindStatement);
83048 :
83049 0 : return memory;
83050 : }
83051 :
83052 : /* #line 83053 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
83053 :
83054 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
83055 : void
83056 5342 : SgEndfileStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
83057 : {
83058 : // This function traverses the memory pool for only a specific IR node
83059 : // and calls the visit function of the input class execute a traversal
83060 : // similar to the style of the attribute based traversals within ROSE.
83061 : // This traversal will visit ALL nodes of the AST where as the other
83062 : // attribute based traversals visit only the embedded tree within the AST.
83063 :
83064 : // Initialize array to the address of the first element of the STL vector
83065 : // (which is guaranteed to be contiguous storage).
83066 : // SgEndfileStatement objectArray [] = *(Memory_Block_List.begin());
83067 5342 : if (SgEndfileStatement::pools.empty() == false)
83068 : {
83069 : // Generate an array of memory pools
83070 0 : SgEndfileStatement** objectArray = (SgEndfileStatement**) &(SgEndfileStatement::pools[0]);
83071 :
83072 : // Build a local variable for better performance
83073 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
83074 : #if 0
83075 : // Iterate over the memory pools
83076 : for (unsigned int i=0; i < SgEndfileStatement::pools.size(); i++)
83077 : {
83078 : // objectArray[i] is a single memory pool
83079 : for (int j=0; j < SgEndfileStatement::pool_size; j++)
83080 : {
83081 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
83082 : {
83083 : traversal.visit(&(objectArray[i][j]));
83084 : }
83085 : }
83086 : }
83087 : #else
83088 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
83089 : // compute the list first and then call the visit function on each list element.
83090 :
83091 : // printf ("Inside of SgEndfileStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
83092 :
83093 0 : std::vector<SgEndfileStatement*> nodeList;
83094 :
83095 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
83096 0 : for (unsigned int i=0; i < SgEndfileStatement::pools.size(); i++)
83097 : {
83098 : // objectArray[i] is a single memory pool
83099 0 : for (unsigned j=0; j < SgEndfileStatement::pool_size; j++)
83100 : {
83101 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
83102 : {
83103 0 : nodeList.push_back(&(objectArray[i][j]));
83104 : }
83105 : }
83106 : }
83107 :
83108 : // Iterate over the saved list
83109 0 : size_t nodeListSize = nodeList.size();
83110 0 : for (size_t i=0; i < nodeListSize; i++)
83111 : {
83112 0 : ROSE_ASSERT(nodeList[i] != NULL);
83113 : #if 0
83114 : traversal.visit(nodeList[i]);
83115 : #else
83116 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
83117 : {
83118 0 : traversal.visit(nodeList[i]);
83119 : }
83120 : #endif
83121 : }
83122 : #endif
83123 : }
83124 :
83125 : // This should not be required since all previously static data members are
83126 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
83127 :
83128 5342 : }
83129 :
83130 :
83131 : void
83132 194 : SgEndfileStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
83133 : {
83134 : // This function traverses the memory pool for an IR node and
83135 : // calls the function to execute the visitor object.
83136 :
83137 : // Initialize array to the address of the first element of the STL vector
83138 : // (which is guarenteed to be contiguous storage).
83139 : // SgEndfileStatement objectArray [] = *(Memory_Block_List.begin());
83140 194 : if (SgEndfileStatement::pools.empty() == false)
83141 : {
83142 : // Generate an array of memory pools
83143 0 : SgEndfileStatement** objectArray = (SgEndfileStatement**) &(SgEndfileStatement::pools[0]);
83144 :
83145 : // Build a local variable for better performance
83146 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
83147 :
83148 : // Iterate over the memory pools
83149 0 : for (unsigned int i=0; i < SgEndfileStatement::pools.size(); i++)
83150 : {
83151 : // objectArray[i] is a single memory pool
83152 0 : for (unsigned j=0; j < SgEndfileStatement::pool_size; j++)
83153 : {
83154 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
83155 : {
83156 : // printf ("Found a valid SgEndfileStatement object in the memory pool %d at position %d \n",i,j);
83157 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
83158 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
83159 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
83160 : }
83161 : else
83162 : {
83163 : // printf ("Found a INVALID SgEndfileStatement object in the memory pool \n");
83164 : }
83165 : }
83166 : }
83167 : }
83168 :
83169 : // This should not be required since all previously static data members are
83170 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
83171 :
83172 194 : }
83173 :
83174 : void
83175 0 : SgEndfileStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
83176 : {
83177 : // This function visits only a single IR node of the memory pool.
83178 : // it is typically called once for each type of IR node within
83179 : // the automatically generated function: traverseRepresentativeNodes().
83180 :
83181 : // Initialize array to the address of the first element of the STL vector
83182 : // (which is guarenteed to be contiguous storage).
83183 : // SgEndfileStatement objectArray [] = *(Memory_Block_List.begin());
83184 0 : if (SgEndfileStatement::pools.empty() == false)
83185 : {
83186 : // Generate an array of memory pools
83187 0 : SgEndfileStatement** objectArray = (SgEndfileStatement**) &(SgEndfileStatement::pools[0]);
83188 :
83189 : // Build a local variable for better performance
83190 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
83191 :
83192 : // Iterate over the memory pools
83193 0 : bool done = false;
83194 0 : unsigned i=0;
83195 :
83196 : // find the first valid IR node, call visit function, and then leave
83197 0 : while ( done == false && i < SgEndfileStatement::pools.size() )
83198 : {
83199 : // objectArray[i] is a single memory pool
83200 : unsigned j=0;
83201 0 : while (done == false && j < SgEndfileStatement::pool_size)
83202 : {
83203 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
83204 : {
83205 0 : traversal.visit(&(objectArray[i][j]));
83206 0 : done = true;
83207 : }
83208 0 : j++;
83209 : }
83210 0 : i++;
83211 : }
83212 :
83213 : #if 0
83214 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
83215 : if (done == false)
83216 : {
83217 : printf ("No representative for SgEndfileStatement found in memory pools \n");
83218 : }
83219 : #endif
83220 : }
83221 0 : }
83222 :
83223 :
83224 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
83225 : // using values that overflow signed values of int.
83226 : size_t
83227 4 : SgEndfileStatement::numberOfNodes()
83228 : {
83229 : // This function traverses the memory pool for an IR node and
83230 : // counts the number of IR nodes of a particular Sage III IR
83231 : // nodes type.
83232 :
83233 4 : size_t count = 0;
83234 4 : if (SgEndfileStatement::pools.empty() == false)
83235 : {
83236 : // Generate an array of memory pools (this is actually a STL vector,
83237 : // but it is contiguious, so OK to treat this way).
83238 0 : SgEndfileStatement** objectArray = (SgEndfileStatement**) &(SgEndfileStatement::pools[0]);
83239 :
83240 : // Build a local variable for better performance (make it a loop invariant variable).
83241 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
83242 :
83243 : // Iterate over all of the memory pools for this IR node.
83244 0 : for (unsigned int i=0; i < SgEndfileStatement::pools.size(); i++)
83245 : {
83246 : // objectArray[i] is a single memory pool, iterate over all the
83247 : // IR nodes and only count those that are valid IR nodes used in
83248 : // the AST (i.e. allocated IR nodes).
83249 0 : for (unsigned j=0; j < SgEndfileStatement::pool_size; j++)
83250 : {
83251 : // This is indexing the STL vector of C/C++ style arrays as a doubly
83252 : // indexed array access. It is OK since we have leveraged the semantics
83253 : // of STL vector memory as contigous and cast the memory as an array
83254 : // of arrays to use the 2D array indexing. Hope this is not confusing,
83255 : // but it s very fast as an implementation.
83256 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
83257 : {
83258 0 : count++;
83259 : }
83260 : }
83261 : }
83262 : }
83263 :
83264 :
83265 :
83266 4 : return count;
83267 : }
83268 :
83269 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
83270 : // using values that overflow signed values of int.
83271 : size_t
83272 0 : SgEndfileStatement::memoryUsage()
83273 : {
83274 : // This function is required because we need the class name as a type when we call sizeof
83275 : // There might be another way to implement this if we have a traversal that only called a
83276 : // representative object (one call for each type of Sage IIIIR node).
83277 0 : size_t memory = numberOfNodes() * sizeof(SgEndfileStatement);
83278 :
83279 0 : return memory;
83280 : }
83281 :
83282 : /* #line 83283 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
83283 :
83284 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
83285 : void
83286 5342 : SgWaitStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
83287 : {
83288 : // This function traverses the memory pool for only a specific IR node
83289 : // and calls the visit function of the input class execute a traversal
83290 : // similar to the style of the attribute based traversals within ROSE.
83291 : // This traversal will visit ALL nodes of the AST where as the other
83292 : // attribute based traversals visit only the embedded tree within the AST.
83293 :
83294 : // Initialize array to the address of the first element of the STL vector
83295 : // (which is guaranteed to be contiguous storage).
83296 : // SgWaitStatement objectArray [] = *(Memory_Block_List.begin());
83297 5342 : if (SgWaitStatement::pools.empty() == false)
83298 : {
83299 : // Generate an array of memory pools
83300 0 : SgWaitStatement** objectArray = (SgWaitStatement**) &(SgWaitStatement::pools[0]);
83301 :
83302 : // Build a local variable for better performance
83303 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
83304 : #if 0
83305 : // Iterate over the memory pools
83306 : for (unsigned int i=0; i < SgWaitStatement::pools.size(); i++)
83307 : {
83308 : // objectArray[i] is a single memory pool
83309 : for (int j=0; j < SgWaitStatement::pool_size; j++)
83310 : {
83311 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
83312 : {
83313 : traversal.visit(&(objectArray[i][j]));
83314 : }
83315 : }
83316 : }
83317 : #else
83318 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
83319 : // compute the list first and then call the visit function on each list element.
83320 :
83321 : // printf ("Inside of SgWaitStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
83322 :
83323 0 : std::vector<SgWaitStatement*> nodeList;
83324 :
83325 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
83326 0 : for (unsigned int i=0; i < SgWaitStatement::pools.size(); i++)
83327 : {
83328 : // objectArray[i] is a single memory pool
83329 0 : for (unsigned j=0; j < SgWaitStatement::pool_size; j++)
83330 : {
83331 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
83332 : {
83333 0 : nodeList.push_back(&(objectArray[i][j]));
83334 : }
83335 : }
83336 : }
83337 :
83338 : // Iterate over the saved list
83339 0 : size_t nodeListSize = nodeList.size();
83340 0 : for (size_t i=0; i < nodeListSize; i++)
83341 : {
83342 0 : ROSE_ASSERT(nodeList[i] != NULL);
83343 : #if 0
83344 : traversal.visit(nodeList[i]);
83345 : #else
83346 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
83347 : {
83348 0 : traversal.visit(nodeList[i]);
83349 : }
83350 : #endif
83351 : }
83352 : #endif
83353 : }
83354 :
83355 : // This should not be required since all previously static data members are
83356 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
83357 :
83358 5342 : }
83359 :
83360 :
83361 : void
83362 194 : SgWaitStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
83363 : {
83364 : // This function traverses the memory pool for an IR node and
83365 : // calls the function to execute the visitor object.
83366 :
83367 : // Initialize array to the address of the first element of the STL vector
83368 : // (which is guarenteed to be contiguous storage).
83369 : // SgWaitStatement objectArray [] = *(Memory_Block_List.begin());
83370 194 : if (SgWaitStatement::pools.empty() == false)
83371 : {
83372 : // Generate an array of memory pools
83373 0 : SgWaitStatement** objectArray = (SgWaitStatement**) &(SgWaitStatement::pools[0]);
83374 :
83375 : // Build a local variable for better performance
83376 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
83377 :
83378 : // Iterate over the memory pools
83379 0 : for (unsigned int i=0; i < SgWaitStatement::pools.size(); i++)
83380 : {
83381 : // objectArray[i] is a single memory pool
83382 0 : for (unsigned j=0; j < SgWaitStatement::pool_size; j++)
83383 : {
83384 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
83385 : {
83386 : // printf ("Found a valid SgWaitStatement object in the memory pool %d at position %d \n",i,j);
83387 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
83388 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
83389 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
83390 : }
83391 : else
83392 : {
83393 : // printf ("Found a INVALID SgWaitStatement object in the memory pool \n");
83394 : }
83395 : }
83396 : }
83397 : }
83398 :
83399 : // This should not be required since all previously static data members are
83400 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
83401 :
83402 194 : }
83403 :
83404 : void
83405 0 : SgWaitStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
83406 : {
83407 : // This function visits only a single IR node of the memory pool.
83408 : // it is typically called once for each type of IR node within
83409 : // the automatically generated function: traverseRepresentativeNodes().
83410 :
83411 : // Initialize array to the address of the first element of the STL vector
83412 : // (which is guarenteed to be contiguous storage).
83413 : // SgWaitStatement objectArray [] = *(Memory_Block_List.begin());
83414 0 : if (SgWaitStatement::pools.empty() == false)
83415 : {
83416 : // Generate an array of memory pools
83417 0 : SgWaitStatement** objectArray = (SgWaitStatement**) &(SgWaitStatement::pools[0]);
83418 :
83419 : // Build a local variable for better performance
83420 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
83421 :
83422 : // Iterate over the memory pools
83423 0 : bool done = false;
83424 0 : unsigned i=0;
83425 :
83426 : // find the first valid IR node, call visit function, and then leave
83427 0 : while ( done == false && i < SgWaitStatement::pools.size() )
83428 : {
83429 : // objectArray[i] is a single memory pool
83430 : unsigned j=0;
83431 0 : while (done == false && j < SgWaitStatement::pool_size)
83432 : {
83433 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
83434 : {
83435 0 : traversal.visit(&(objectArray[i][j]));
83436 0 : done = true;
83437 : }
83438 0 : j++;
83439 : }
83440 0 : i++;
83441 : }
83442 :
83443 : #if 0
83444 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
83445 : if (done == false)
83446 : {
83447 : printf ("No representative for SgWaitStatement found in memory pools \n");
83448 : }
83449 : #endif
83450 : }
83451 0 : }
83452 :
83453 :
83454 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
83455 : // using values that overflow signed values of int.
83456 : size_t
83457 4 : SgWaitStatement::numberOfNodes()
83458 : {
83459 : // This function traverses the memory pool for an IR node and
83460 : // counts the number of IR nodes of a particular Sage III IR
83461 : // nodes type.
83462 :
83463 4 : size_t count = 0;
83464 4 : if (SgWaitStatement::pools.empty() == false)
83465 : {
83466 : // Generate an array of memory pools (this is actually a STL vector,
83467 : // but it is contiguious, so OK to treat this way).
83468 0 : SgWaitStatement** objectArray = (SgWaitStatement**) &(SgWaitStatement::pools[0]);
83469 :
83470 : // Build a local variable for better performance (make it a loop invariant variable).
83471 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
83472 :
83473 : // Iterate over all of the memory pools for this IR node.
83474 0 : for (unsigned int i=0; i < SgWaitStatement::pools.size(); i++)
83475 : {
83476 : // objectArray[i] is a single memory pool, iterate over all the
83477 : // IR nodes and only count those that are valid IR nodes used in
83478 : // the AST (i.e. allocated IR nodes).
83479 0 : for (unsigned j=0; j < SgWaitStatement::pool_size; j++)
83480 : {
83481 : // This is indexing the STL vector of C/C++ style arrays as a doubly
83482 : // indexed array access. It is OK since we have leveraged the semantics
83483 : // of STL vector memory as contigous and cast the memory as an array
83484 : // of arrays to use the 2D array indexing. Hope this is not confusing,
83485 : // but it s very fast as an implementation.
83486 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
83487 : {
83488 0 : count++;
83489 : }
83490 : }
83491 : }
83492 : }
83493 :
83494 :
83495 :
83496 4 : return count;
83497 : }
83498 :
83499 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
83500 : // using values that overflow signed values of int.
83501 : size_t
83502 0 : SgWaitStatement::memoryUsage()
83503 : {
83504 : // This function is required because we need the class name as a type when we call sizeof
83505 : // There might be another way to implement this if we have a traversal that only called a
83506 : // representative object (one call for each type of Sage IIIIR node).
83507 0 : size_t memory = numberOfNodes() * sizeof(SgWaitStatement);
83508 :
83509 0 : return memory;
83510 : }
83511 :
83512 : /* #line 83513 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
83513 :
83514 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
83515 : void
83516 5342 : SgWhereStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
83517 : {
83518 : // This function traverses the memory pool for only a specific IR node
83519 : // and calls the visit function of the input class execute a traversal
83520 : // similar to the style of the attribute based traversals within ROSE.
83521 : // This traversal will visit ALL nodes of the AST where as the other
83522 : // attribute based traversals visit only the embedded tree within the AST.
83523 :
83524 : // Initialize array to the address of the first element of the STL vector
83525 : // (which is guaranteed to be contiguous storage).
83526 : // SgWhereStatement objectArray [] = *(Memory_Block_List.begin());
83527 5342 : if (SgWhereStatement::pools.empty() == false)
83528 : {
83529 : // Generate an array of memory pools
83530 0 : SgWhereStatement** objectArray = (SgWhereStatement**) &(SgWhereStatement::pools[0]);
83531 :
83532 : // Build a local variable for better performance
83533 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
83534 : #if 0
83535 : // Iterate over the memory pools
83536 : for (unsigned int i=0; i < SgWhereStatement::pools.size(); i++)
83537 : {
83538 : // objectArray[i] is a single memory pool
83539 : for (int j=0; j < SgWhereStatement::pool_size; j++)
83540 : {
83541 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
83542 : {
83543 : traversal.visit(&(objectArray[i][j]));
83544 : }
83545 : }
83546 : }
83547 : #else
83548 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
83549 : // compute the list first and then call the visit function on each list element.
83550 :
83551 : // printf ("Inside of SgWhereStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
83552 :
83553 0 : std::vector<SgWhereStatement*> nodeList;
83554 :
83555 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
83556 0 : for (unsigned int i=0; i < SgWhereStatement::pools.size(); i++)
83557 : {
83558 : // objectArray[i] is a single memory pool
83559 0 : for (unsigned j=0; j < SgWhereStatement::pool_size; j++)
83560 : {
83561 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
83562 : {
83563 0 : nodeList.push_back(&(objectArray[i][j]));
83564 : }
83565 : }
83566 : }
83567 :
83568 : // Iterate over the saved list
83569 0 : size_t nodeListSize = nodeList.size();
83570 0 : for (size_t i=0; i < nodeListSize; i++)
83571 : {
83572 0 : ROSE_ASSERT(nodeList[i] != NULL);
83573 : #if 0
83574 : traversal.visit(nodeList[i]);
83575 : #else
83576 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
83577 : {
83578 0 : traversal.visit(nodeList[i]);
83579 : }
83580 : #endif
83581 : }
83582 : #endif
83583 : }
83584 :
83585 : // This should not be required since all previously static data members are
83586 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
83587 :
83588 5342 : }
83589 :
83590 :
83591 : void
83592 194 : SgWhereStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
83593 : {
83594 : // This function traverses the memory pool for an IR node and
83595 : // calls the function to execute the visitor object.
83596 :
83597 : // Initialize array to the address of the first element of the STL vector
83598 : // (which is guarenteed to be contiguous storage).
83599 : // SgWhereStatement objectArray [] = *(Memory_Block_List.begin());
83600 194 : if (SgWhereStatement::pools.empty() == false)
83601 : {
83602 : // Generate an array of memory pools
83603 0 : SgWhereStatement** objectArray = (SgWhereStatement**) &(SgWhereStatement::pools[0]);
83604 :
83605 : // Build a local variable for better performance
83606 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
83607 :
83608 : // Iterate over the memory pools
83609 0 : for (unsigned int i=0; i < SgWhereStatement::pools.size(); i++)
83610 : {
83611 : // objectArray[i] is a single memory pool
83612 0 : for (unsigned j=0; j < SgWhereStatement::pool_size; j++)
83613 : {
83614 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
83615 : {
83616 : // printf ("Found a valid SgWhereStatement object in the memory pool %d at position %d \n",i,j);
83617 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
83618 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
83619 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
83620 : }
83621 : else
83622 : {
83623 : // printf ("Found a INVALID SgWhereStatement object in the memory pool \n");
83624 : }
83625 : }
83626 : }
83627 : }
83628 :
83629 : // This should not be required since all previously static data members are
83630 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
83631 :
83632 194 : }
83633 :
83634 : void
83635 0 : SgWhereStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
83636 : {
83637 : // This function visits only a single IR node of the memory pool.
83638 : // it is typically called once for each type of IR node within
83639 : // the automatically generated function: traverseRepresentativeNodes().
83640 :
83641 : // Initialize array to the address of the first element of the STL vector
83642 : // (which is guarenteed to be contiguous storage).
83643 : // SgWhereStatement objectArray [] = *(Memory_Block_List.begin());
83644 0 : if (SgWhereStatement::pools.empty() == false)
83645 : {
83646 : // Generate an array of memory pools
83647 0 : SgWhereStatement** objectArray = (SgWhereStatement**) &(SgWhereStatement::pools[0]);
83648 :
83649 : // Build a local variable for better performance
83650 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
83651 :
83652 : // Iterate over the memory pools
83653 0 : bool done = false;
83654 0 : unsigned i=0;
83655 :
83656 : // find the first valid IR node, call visit function, and then leave
83657 0 : while ( done == false && i < SgWhereStatement::pools.size() )
83658 : {
83659 : // objectArray[i] is a single memory pool
83660 : unsigned j=0;
83661 0 : while (done == false && j < SgWhereStatement::pool_size)
83662 : {
83663 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
83664 : {
83665 0 : traversal.visit(&(objectArray[i][j]));
83666 0 : done = true;
83667 : }
83668 0 : j++;
83669 : }
83670 0 : i++;
83671 : }
83672 :
83673 : #if 0
83674 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
83675 : if (done == false)
83676 : {
83677 : printf ("No representative for SgWhereStatement found in memory pools \n");
83678 : }
83679 : #endif
83680 : }
83681 0 : }
83682 :
83683 :
83684 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
83685 : // using values that overflow signed values of int.
83686 : size_t
83687 4 : SgWhereStatement::numberOfNodes()
83688 : {
83689 : // This function traverses the memory pool for an IR node and
83690 : // counts the number of IR nodes of a particular Sage III IR
83691 : // nodes type.
83692 :
83693 4 : size_t count = 0;
83694 4 : if (SgWhereStatement::pools.empty() == false)
83695 : {
83696 : // Generate an array of memory pools (this is actually a STL vector,
83697 : // but it is contiguious, so OK to treat this way).
83698 0 : SgWhereStatement** objectArray = (SgWhereStatement**) &(SgWhereStatement::pools[0]);
83699 :
83700 : // Build a local variable for better performance (make it a loop invariant variable).
83701 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
83702 :
83703 : // Iterate over all of the memory pools for this IR node.
83704 0 : for (unsigned int i=0; i < SgWhereStatement::pools.size(); i++)
83705 : {
83706 : // objectArray[i] is a single memory pool, iterate over all the
83707 : // IR nodes and only count those that are valid IR nodes used in
83708 : // the AST (i.e. allocated IR nodes).
83709 0 : for (unsigned j=0; j < SgWhereStatement::pool_size; j++)
83710 : {
83711 : // This is indexing the STL vector of C/C++ style arrays as a doubly
83712 : // indexed array access. It is OK since we have leveraged the semantics
83713 : // of STL vector memory as contigous and cast the memory as an array
83714 : // of arrays to use the 2D array indexing. Hope this is not confusing,
83715 : // but it s very fast as an implementation.
83716 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
83717 : {
83718 0 : count++;
83719 : }
83720 : }
83721 : }
83722 : }
83723 :
83724 :
83725 :
83726 4 : return count;
83727 : }
83728 :
83729 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
83730 : // using values that overflow signed values of int.
83731 : size_t
83732 0 : SgWhereStatement::memoryUsage()
83733 : {
83734 : // This function is required because we need the class name as a type when we call sizeof
83735 : // There might be another way to implement this if we have a traversal that only called a
83736 : // representative object (one call for each type of Sage IIIIR node).
83737 0 : size_t memory = numberOfNodes() * sizeof(SgWhereStatement);
83738 :
83739 0 : return memory;
83740 : }
83741 :
83742 : /* #line 83743 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
83743 :
83744 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
83745 : void
83746 5342 : SgElseWhereStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
83747 : {
83748 : // This function traverses the memory pool for only a specific IR node
83749 : // and calls the visit function of the input class execute a traversal
83750 : // similar to the style of the attribute based traversals within ROSE.
83751 : // This traversal will visit ALL nodes of the AST where as the other
83752 : // attribute based traversals visit only the embedded tree within the AST.
83753 :
83754 : // Initialize array to the address of the first element of the STL vector
83755 : // (which is guaranteed to be contiguous storage).
83756 : // SgElseWhereStatement objectArray [] = *(Memory_Block_List.begin());
83757 5342 : if (SgElseWhereStatement::pools.empty() == false)
83758 : {
83759 : // Generate an array of memory pools
83760 0 : SgElseWhereStatement** objectArray = (SgElseWhereStatement**) &(SgElseWhereStatement::pools[0]);
83761 :
83762 : // Build a local variable for better performance
83763 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
83764 : #if 0
83765 : // Iterate over the memory pools
83766 : for (unsigned int i=0; i < SgElseWhereStatement::pools.size(); i++)
83767 : {
83768 : // objectArray[i] is a single memory pool
83769 : for (int j=0; j < SgElseWhereStatement::pool_size; j++)
83770 : {
83771 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
83772 : {
83773 : traversal.visit(&(objectArray[i][j]));
83774 : }
83775 : }
83776 : }
83777 : #else
83778 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
83779 : // compute the list first and then call the visit function on each list element.
83780 :
83781 : // printf ("Inside of SgElseWhereStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
83782 :
83783 0 : std::vector<SgElseWhereStatement*> nodeList;
83784 :
83785 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
83786 0 : for (unsigned int i=0; i < SgElseWhereStatement::pools.size(); i++)
83787 : {
83788 : // objectArray[i] is a single memory pool
83789 0 : for (unsigned j=0; j < SgElseWhereStatement::pool_size; j++)
83790 : {
83791 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
83792 : {
83793 0 : nodeList.push_back(&(objectArray[i][j]));
83794 : }
83795 : }
83796 : }
83797 :
83798 : // Iterate over the saved list
83799 0 : size_t nodeListSize = nodeList.size();
83800 0 : for (size_t i=0; i < nodeListSize; i++)
83801 : {
83802 0 : ROSE_ASSERT(nodeList[i] != NULL);
83803 : #if 0
83804 : traversal.visit(nodeList[i]);
83805 : #else
83806 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
83807 : {
83808 0 : traversal.visit(nodeList[i]);
83809 : }
83810 : #endif
83811 : }
83812 : #endif
83813 : }
83814 :
83815 : // This should not be required since all previously static data members are
83816 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
83817 :
83818 5342 : }
83819 :
83820 :
83821 : void
83822 194 : SgElseWhereStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
83823 : {
83824 : // This function traverses the memory pool for an IR node and
83825 : // calls the function to execute the visitor object.
83826 :
83827 : // Initialize array to the address of the first element of the STL vector
83828 : // (which is guarenteed to be contiguous storage).
83829 : // SgElseWhereStatement objectArray [] = *(Memory_Block_List.begin());
83830 194 : if (SgElseWhereStatement::pools.empty() == false)
83831 : {
83832 : // Generate an array of memory pools
83833 0 : SgElseWhereStatement** objectArray = (SgElseWhereStatement**) &(SgElseWhereStatement::pools[0]);
83834 :
83835 : // Build a local variable for better performance
83836 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
83837 :
83838 : // Iterate over the memory pools
83839 0 : for (unsigned int i=0; i < SgElseWhereStatement::pools.size(); i++)
83840 : {
83841 : // objectArray[i] is a single memory pool
83842 0 : for (unsigned j=0; j < SgElseWhereStatement::pool_size; j++)
83843 : {
83844 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
83845 : {
83846 : // printf ("Found a valid SgElseWhereStatement object in the memory pool %d at position %d \n",i,j);
83847 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
83848 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
83849 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
83850 : }
83851 : else
83852 : {
83853 : // printf ("Found a INVALID SgElseWhereStatement object in the memory pool \n");
83854 : }
83855 : }
83856 : }
83857 : }
83858 :
83859 : // This should not be required since all previously static data members are
83860 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
83861 :
83862 194 : }
83863 :
83864 : void
83865 0 : SgElseWhereStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
83866 : {
83867 : // This function visits only a single IR node of the memory pool.
83868 : // it is typically called once for each type of IR node within
83869 : // the automatically generated function: traverseRepresentativeNodes().
83870 :
83871 : // Initialize array to the address of the first element of the STL vector
83872 : // (which is guarenteed to be contiguous storage).
83873 : // SgElseWhereStatement objectArray [] = *(Memory_Block_List.begin());
83874 0 : if (SgElseWhereStatement::pools.empty() == false)
83875 : {
83876 : // Generate an array of memory pools
83877 0 : SgElseWhereStatement** objectArray = (SgElseWhereStatement**) &(SgElseWhereStatement::pools[0]);
83878 :
83879 : // Build a local variable for better performance
83880 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
83881 :
83882 : // Iterate over the memory pools
83883 0 : bool done = false;
83884 0 : unsigned i=0;
83885 :
83886 : // find the first valid IR node, call visit function, and then leave
83887 0 : while ( done == false && i < SgElseWhereStatement::pools.size() )
83888 : {
83889 : // objectArray[i] is a single memory pool
83890 : unsigned j=0;
83891 0 : while (done == false && j < SgElseWhereStatement::pool_size)
83892 : {
83893 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
83894 : {
83895 0 : traversal.visit(&(objectArray[i][j]));
83896 0 : done = true;
83897 : }
83898 0 : j++;
83899 : }
83900 0 : i++;
83901 : }
83902 :
83903 : #if 0
83904 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
83905 : if (done == false)
83906 : {
83907 : printf ("No representative for SgElseWhereStatement found in memory pools \n");
83908 : }
83909 : #endif
83910 : }
83911 0 : }
83912 :
83913 :
83914 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
83915 : // using values that overflow signed values of int.
83916 : size_t
83917 4 : SgElseWhereStatement::numberOfNodes()
83918 : {
83919 : // This function traverses the memory pool for an IR node and
83920 : // counts the number of IR nodes of a particular Sage III IR
83921 : // nodes type.
83922 :
83923 4 : size_t count = 0;
83924 4 : if (SgElseWhereStatement::pools.empty() == false)
83925 : {
83926 : // Generate an array of memory pools (this is actually a STL vector,
83927 : // but it is contiguious, so OK to treat this way).
83928 0 : SgElseWhereStatement** objectArray = (SgElseWhereStatement**) &(SgElseWhereStatement::pools[0]);
83929 :
83930 : // Build a local variable for better performance (make it a loop invariant variable).
83931 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
83932 :
83933 : // Iterate over all of the memory pools for this IR node.
83934 0 : for (unsigned int i=0; i < SgElseWhereStatement::pools.size(); i++)
83935 : {
83936 : // objectArray[i] is a single memory pool, iterate over all the
83937 : // IR nodes and only count those that are valid IR nodes used in
83938 : // the AST (i.e. allocated IR nodes).
83939 0 : for (unsigned j=0; j < SgElseWhereStatement::pool_size; j++)
83940 : {
83941 : // This is indexing the STL vector of C/C++ style arrays as a doubly
83942 : // indexed array access. It is OK since we have leveraged the semantics
83943 : // of STL vector memory as contigous and cast the memory as an array
83944 : // of arrays to use the 2D array indexing. Hope this is not confusing,
83945 : // but it s very fast as an implementation.
83946 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
83947 : {
83948 0 : count++;
83949 : }
83950 : }
83951 : }
83952 : }
83953 :
83954 :
83955 :
83956 4 : return count;
83957 : }
83958 :
83959 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
83960 : // using values that overflow signed values of int.
83961 : size_t
83962 0 : SgElseWhereStatement::memoryUsage()
83963 : {
83964 : // This function is required because we need the class name as a type when we call sizeof
83965 : // There might be another way to implement this if we have a traversal that only called a
83966 : // representative object (one call for each type of Sage IIIIR node).
83967 0 : size_t memory = numberOfNodes() * sizeof(SgElseWhereStatement);
83968 :
83969 0 : return memory;
83970 : }
83971 :
83972 : /* #line 83973 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
83973 :
83974 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
83975 : void
83976 5342 : SgNullifyStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
83977 : {
83978 : // This function traverses the memory pool for only a specific IR node
83979 : // and calls the visit function of the input class execute a traversal
83980 : // similar to the style of the attribute based traversals within ROSE.
83981 : // This traversal will visit ALL nodes of the AST where as the other
83982 : // attribute based traversals visit only the embedded tree within the AST.
83983 :
83984 : // Initialize array to the address of the first element of the STL vector
83985 : // (which is guaranteed to be contiguous storage).
83986 : // SgNullifyStatement objectArray [] = *(Memory_Block_List.begin());
83987 5342 : if (SgNullifyStatement::pools.empty() == false)
83988 : {
83989 : // Generate an array of memory pools
83990 0 : SgNullifyStatement** objectArray = (SgNullifyStatement**) &(SgNullifyStatement::pools[0]);
83991 :
83992 : // Build a local variable for better performance
83993 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
83994 : #if 0
83995 : // Iterate over the memory pools
83996 : for (unsigned int i=0; i < SgNullifyStatement::pools.size(); i++)
83997 : {
83998 : // objectArray[i] is a single memory pool
83999 : for (int j=0; j < SgNullifyStatement::pool_size; j++)
84000 : {
84001 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
84002 : {
84003 : traversal.visit(&(objectArray[i][j]));
84004 : }
84005 : }
84006 : }
84007 : #else
84008 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
84009 : // compute the list first and then call the visit function on each list element.
84010 :
84011 : // printf ("Inside of SgNullifyStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
84012 :
84013 0 : std::vector<SgNullifyStatement*> nodeList;
84014 :
84015 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
84016 0 : for (unsigned int i=0; i < SgNullifyStatement::pools.size(); i++)
84017 : {
84018 : // objectArray[i] is a single memory pool
84019 0 : for (unsigned j=0; j < SgNullifyStatement::pool_size; j++)
84020 : {
84021 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
84022 : {
84023 0 : nodeList.push_back(&(objectArray[i][j]));
84024 : }
84025 : }
84026 : }
84027 :
84028 : // Iterate over the saved list
84029 0 : size_t nodeListSize = nodeList.size();
84030 0 : for (size_t i=0; i < nodeListSize; i++)
84031 : {
84032 0 : ROSE_ASSERT(nodeList[i] != NULL);
84033 : #if 0
84034 : traversal.visit(nodeList[i]);
84035 : #else
84036 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
84037 : {
84038 0 : traversal.visit(nodeList[i]);
84039 : }
84040 : #endif
84041 : }
84042 : #endif
84043 : }
84044 :
84045 : // This should not be required since all previously static data members are
84046 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
84047 :
84048 5342 : }
84049 :
84050 :
84051 : void
84052 194 : SgNullifyStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
84053 : {
84054 : // This function traverses the memory pool for an IR node and
84055 : // calls the function to execute the visitor object.
84056 :
84057 : // Initialize array to the address of the first element of the STL vector
84058 : // (which is guarenteed to be contiguous storage).
84059 : // SgNullifyStatement objectArray [] = *(Memory_Block_List.begin());
84060 194 : if (SgNullifyStatement::pools.empty() == false)
84061 : {
84062 : // Generate an array of memory pools
84063 0 : SgNullifyStatement** objectArray = (SgNullifyStatement**) &(SgNullifyStatement::pools[0]);
84064 :
84065 : // Build a local variable for better performance
84066 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
84067 :
84068 : // Iterate over the memory pools
84069 0 : for (unsigned int i=0; i < SgNullifyStatement::pools.size(); i++)
84070 : {
84071 : // objectArray[i] is a single memory pool
84072 0 : for (unsigned j=0; j < SgNullifyStatement::pool_size; j++)
84073 : {
84074 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
84075 : {
84076 : // printf ("Found a valid SgNullifyStatement object in the memory pool %d at position %d \n",i,j);
84077 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
84078 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
84079 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
84080 : }
84081 : else
84082 : {
84083 : // printf ("Found a INVALID SgNullifyStatement object in the memory pool \n");
84084 : }
84085 : }
84086 : }
84087 : }
84088 :
84089 : // This should not be required since all previously static data members are
84090 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
84091 :
84092 194 : }
84093 :
84094 : void
84095 0 : SgNullifyStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
84096 : {
84097 : // This function visits only a single IR node of the memory pool.
84098 : // it is typically called once for each type of IR node within
84099 : // the automatically generated function: traverseRepresentativeNodes().
84100 :
84101 : // Initialize array to the address of the first element of the STL vector
84102 : // (which is guarenteed to be contiguous storage).
84103 : // SgNullifyStatement objectArray [] = *(Memory_Block_List.begin());
84104 0 : if (SgNullifyStatement::pools.empty() == false)
84105 : {
84106 : // Generate an array of memory pools
84107 0 : SgNullifyStatement** objectArray = (SgNullifyStatement**) &(SgNullifyStatement::pools[0]);
84108 :
84109 : // Build a local variable for better performance
84110 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
84111 :
84112 : // Iterate over the memory pools
84113 0 : bool done = false;
84114 0 : unsigned i=0;
84115 :
84116 : // find the first valid IR node, call visit function, and then leave
84117 0 : while ( done == false && i < SgNullifyStatement::pools.size() )
84118 : {
84119 : // objectArray[i] is a single memory pool
84120 : unsigned j=0;
84121 0 : while (done == false && j < SgNullifyStatement::pool_size)
84122 : {
84123 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
84124 : {
84125 0 : traversal.visit(&(objectArray[i][j]));
84126 0 : done = true;
84127 : }
84128 0 : j++;
84129 : }
84130 0 : i++;
84131 : }
84132 :
84133 : #if 0
84134 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
84135 : if (done == false)
84136 : {
84137 : printf ("No representative for SgNullifyStatement found in memory pools \n");
84138 : }
84139 : #endif
84140 : }
84141 0 : }
84142 :
84143 :
84144 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
84145 : // using values that overflow signed values of int.
84146 : size_t
84147 4 : SgNullifyStatement::numberOfNodes()
84148 : {
84149 : // This function traverses the memory pool for an IR node and
84150 : // counts the number of IR nodes of a particular Sage III IR
84151 : // nodes type.
84152 :
84153 4 : size_t count = 0;
84154 4 : if (SgNullifyStatement::pools.empty() == false)
84155 : {
84156 : // Generate an array of memory pools (this is actually a STL vector,
84157 : // but it is contiguious, so OK to treat this way).
84158 0 : SgNullifyStatement** objectArray = (SgNullifyStatement**) &(SgNullifyStatement::pools[0]);
84159 :
84160 : // Build a local variable for better performance (make it a loop invariant variable).
84161 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
84162 :
84163 : // Iterate over all of the memory pools for this IR node.
84164 0 : for (unsigned int i=0; i < SgNullifyStatement::pools.size(); i++)
84165 : {
84166 : // objectArray[i] is a single memory pool, iterate over all the
84167 : // IR nodes and only count those that are valid IR nodes used in
84168 : // the AST (i.e. allocated IR nodes).
84169 0 : for (unsigned j=0; j < SgNullifyStatement::pool_size; j++)
84170 : {
84171 : // This is indexing the STL vector of C/C++ style arrays as a doubly
84172 : // indexed array access. It is OK since we have leveraged the semantics
84173 : // of STL vector memory as contigous and cast the memory as an array
84174 : // of arrays to use the 2D array indexing. Hope this is not confusing,
84175 : // but it s very fast as an implementation.
84176 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
84177 : {
84178 0 : count++;
84179 : }
84180 : }
84181 : }
84182 : }
84183 :
84184 :
84185 :
84186 4 : return count;
84187 : }
84188 :
84189 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
84190 : // using values that overflow signed values of int.
84191 : size_t
84192 0 : SgNullifyStatement::memoryUsage()
84193 : {
84194 : // This function is required because we need the class name as a type when we call sizeof
84195 : // There might be another way to implement this if we have a traversal that only called a
84196 : // representative object (one call for each type of Sage IIIIR node).
84197 0 : size_t memory = numberOfNodes() * sizeof(SgNullifyStatement);
84198 :
84199 0 : return memory;
84200 : }
84201 :
84202 : /* #line 84203 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
84203 :
84204 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
84205 : void
84206 5342 : SgArithmeticIfStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
84207 : {
84208 : // This function traverses the memory pool for only a specific IR node
84209 : // and calls the visit function of the input class execute a traversal
84210 : // similar to the style of the attribute based traversals within ROSE.
84211 : // This traversal will visit ALL nodes of the AST where as the other
84212 : // attribute based traversals visit only the embedded tree within the AST.
84213 :
84214 : // Initialize array to the address of the first element of the STL vector
84215 : // (which is guaranteed to be contiguous storage).
84216 : // SgArithmeticIfStatement objectArray [] = *(Memory_Block_List.begin());
84217 5342 : if (SgArithmeticIfStatement::pools.empty() == false)
84218 : {
84219 : // Generate an array of memory pools
84220 0 : SgArithmeticIfStatement** objectArray = (SgArithmeticIfStatement**) &(SgArithmeticIfStatement::pools[0]);
84221 :
84222 : // Build a local variable for better performance
84223 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
84224 : #if 0
84225 : // Iterate over the memory pools
84226 : for (unsigned int i=0; i < SgArithmeticIfStatement::pools.size(); i++)
84227 : {
84228 : // objectArray[i] is a single memory pool
84229 : for (int j=0; j < SgArithmeticIfStatement::pool_size; j++)
84230 : {
84231 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
84232 : {
84233 : traversal.visit(&(objectArray[i][j]));
84234 : }
84235 : }
84236 : }
84237 : #else
84238 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
84239 : // compute the list first and then call the visit function on each list element.
84240 :
84241 : // printf ("Inside of SgArithmeticIfStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
84242 :
84243 0 : std::vector<SgArithmeticIfStatement*> nodeList;
84244 :
84245 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
84246 0 : for (unsigned int i=0; i < SgArithmeticIfStatement::pools.size(); i++)
84247 : {
84248 : // objectArray[i] is a single memory pool
84249 0 : for (unsigned j=0; j < SgArithmeticIfStatement::pool_size; j++)
84250 : {
84251 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
84252 : {
84253 0 : nodeList.push_back(&(objectArray[i][j]));
84254 : }
84255 : }
84256 : }
84257 :
84258 : // Iterate over the saved list
84259 0 : size_t nodeListSize = nodeList.size();
84260 0 : for (size_t i=0; i < nodeListSize; i++)
84261 : {
84262 0 : ROSE_ASSERT(nodeList[i] != NULL);
84263 : #if 0
84264 : traversal.visit(nodeList[i]);
84265 : #else
84266 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
84267 : {
84268 0 : traversal.visit(nodeList[i]);
84269 : }
84270 : #endif
84271 : }
84272 : #endif
84273 : }
84274 :
84275 : // This should not be required since all previously static data members are
84276 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
84277 :
84278 5342 : }
84279 :
84280 :
84281 : void
84282 194 : SgArithmeticIfStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
84283 : {
84284 : // This function traverses the memory pool for an IR node and
84285 : // calls the function to execute the visitor object.
84286 :
84287 : // Initialize array to the address of the first element of the STL vector
84288 : // (which is guarenteed to be contiguous storage).
84289 : // SgArithmeticIfStatement objectArray [] = *(Memory_Block_List.begin());
84290 194 : if (SgArithmeticIfStatement::pools.empty() == false)
84291 : {
84292 : // Generate an array of memory pools
84293 0 : SgArithmeticIfStatement** objectArray = (SgArithmeticIfStatement**) &(SgArithmeticIfStatement::pools[0]);
84294 :
84295 : // Build a local variable for better performance
84296 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
84297 :
84298 : // Iterate over the memory pools
84299 0 : for (unsigned int i=0; i < SgArithmeticIfStatement::pools.size(); i++)
84300 : {
84301 : // objectArray[i] is a single memory pool
84302 0 : for (unsigned j=0; j < SgArithmeticIfStatement::pool_size; j++)
84303 : {
84304 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
84305 : {
84306 : // printf ("Found a valid SgArithmeticIfStatement object in the memory pool %d at position %d \n",i,j);
84307 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
84308 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
84309 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
84310 : }
84311 : else
84312 : {
84313 : // printf ("Found a INVALID SgArithmeticIfStatement object in the memory pool \n");
84314 : }
84315 : }
84316 : }
84317 : }
84318 :
84319 : // This should not be required since all previously static data members are
84320 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
84321 :
84322 194 : }
84323 :
84324 : void
84325 0 : SgArithmeticIfStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
84326 : {
84327 : // This function visits only a single IR node of the memory pool.
84328 : // it is typically called once for each type of IR node within
84329 : // the automatically generated function: traverseRepresentativeNodes().
84330 :
84331 : // Initialize array to the address of the first element of the STL vector
84332 : // (which is guarenteed to be contiguous storage).
84333 : // SgArithmeticIfStatement objectArray [] = *(Memory_Block_List.begin());
84334 0 : if (SgArithmeticIfStatement::pools.empty() == false)
84335 : {
84336 : // Generate an array of memory pools
84337 0 : SgArithmeticIfStatement** objectArray = (SgArithmeticIfStatement**) &(SgArithmeticIfStatement::pools[0]);
84338 :
84339 : // Build a local variable for better performance
84340 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
84341 :
84342 : // Iterate over the memory pools
84343 0 : bool done = false;
84344 0 : unsigned i=0;
84345 :
84346 : // find the first valid IR node, call visit function, and then leave
84347 0 : while ( done == false && i < SgArithmeticIfStatement::pools.size() )
84348 : {
84349 : // objectArray[i] is a single memory pool
84350 : unsigned j=0;
84351 0 : while (done == false && j < SgArithmeticIfStatement::pool_size)
84352 : {
84353 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
84354 : {
84355 0 : traversal.visit(&(objectArray[i][j]));
84356 0 : done = true;
84357 : }
84358 0 : j++;
84359 : }
84360 0 : i++;
84361 : }
84362 :
84363 : #if 0
84364 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
84365 : if (done == false)
84366 : {
84367 : printf ("No representative for SgArithmeticIfStatement found in memory pools \n");
84368 : }
84369 : #endif
84370 : }
84371 0 : }
84372 :
84373 :
84374 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
84375 : // using values that overflow signed values of int.
84376 : size_t
84377 4 : SgArithmeticIfStatement::numberOfNodes()
84378 : {
84379 : // This function traverses the memory pool for an IR node and
84380 : // counts the number of IR nodes of a particular Sage III IR
84381 : // nodes type.
84382 :
84383 4 : size_t count = 0;
84384 4 : if (SgArithmeticIfStatement::pools.empty() == false)
84385 : {
84386 : // Generate an array of memory pools (this is actually a STL vector,
84387 : // but it is contiguious, so OK to treat this way).
84388 0 : SgArithmeticIfStatement** objectArray = (SgArithmeticIfStatement**) &(SgArithmeticIfStatement::pools[0]);
84389 :
84390 : // Build a local variable for better performance (make it a loop invariant variable).
84391 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
84392 :
84393 : // Iterate over all of the memory pools for this IR node.
84394 0 : for (unsigned int i=0; i < SgArithmeticIfStatement::pools.size(); i++)
84395 : {
84396 : // objectArray[i] is a single memory pool, iterate over all the
84397 : // IR nodes and only count those that are valid IR nodes used in
84398 : // the AST (i.e. allocated IR nodes).
84399 0 : for (unsigned j=0; j < SgArithmeticIfStatement::pool_size; j++)
84400 : {
84401 : // This is indexing the STL vector of C/C++ style arrays as a doubly
84402 : // indexed array access. It is OK since we have leveraged the semantics
84403 : // of STL vector memory as contigous and cast the memory as an array
84404 : // of arrays to use the 2D array indexing. Hope this is not confusing,
84405 : // but it s very fast as an implementation.
84406 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
84407 : {
84408 0 : count++;
84409 : }
84410 : }
84411 : }
84412 : }
84413 :
84414 :
84415 :
84416 4 : return count;
84417 : }
84418 :
84419 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
84420 : // using values that overflow signed values of int.
84421 : size_t
84422 0 : SgArithmeticIfStatement::memoryUsage()
84423 : {
84424 : // This function is required because we need the class name as a type when we call sizeof
84425 : // There might be another way to implement this if we have a traversal that only called a
84426 : // representative object (one call for each type of Sage IIIIR node).
84427 0 : size_t memory = numberOfNodes() * sizeof(SgArithmeticIfStatement);
84428 :
84429 0 : return memory;
84430 : }
84431 :
84432 : /* #line 84433 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
84433 :
84434 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
84435 : void
84436 5342 : SgAssignStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
84437 : {
84438 : // This function traverses the memory pool for only a specific IR node
84439 : // and calls the visit function of the input class execute a traversal
84440 : // similar to the style of the attribute based traversals within ROSE.
84441 : // This traversal will visit ALL nodes of the AST where as the other
84442 : // attribute based traversals visit only the embedded tree within the AST.
84443 :
84444 : // Initialize array to the address of the first element of the STL vector
84445 : // (which is guaranteed to be contiguous storage).
84446 : // SgAssignStatement objectArray [] = *(Memory_Block_List.begin());
84447 5342 : if (SgAssignStatement::pools.empty() == false)
84448 : {
84449 : // Generate an array of memory pools
84450 0 : SgAssignStatement** objectArray = (SgAssignStatement**) &(SgAssignStatement::pools[0]);
84451 :
84452 : // Build a local variable for better performance
84453 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
84454 : #if 0
84455 : // Iterate over the memory pools
84456 : for (unsigned int i=0; i < SgAssignStatement::pools.size(); i++)
84457 : {
84458 : // objectArray[i] is a single memory pool
84459 : for (int j=0; j < SgAssignStatement::pool_size; j++)
84460 : {
84461 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
84462 : {
84463 : traversal.visit(&(objectArray[i][j]));
84464 : }
84465 : }
84466 : }
84467 : #else
84468 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
84469 : // compute the list first and then call the visit function on each list element.
84470 :
84471 : // printf ("Inside of SgAssignStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
84472 :
84473 0 : std::vector<SgAssignStatement*> nodeList;
84474 :
84475 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
84476 0 : for (unsigned int i=0; i < SgAssignStatement::pools.size(); i++)
84477 : {
84478 : // objectArray[i] is a single memory pool
84479 0 : for (unsigned j=0; j < SgAssignStatement::pool_size; j++)
84480 : {
84481 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
84482 : {
84483 0 : nodeList.push_back(&(objectArray[i][j]));
84484 : }
84485 : }
84486 : }
84487 :
84488 : // Iterate over the saved list
84489 0 : size_t nodeListSize = nodeList.size();
84490 0 : for (size_t i=0; i < nodeListSize; i++)
84491 : {
84492 0 : ROSE_ASSERT(nodeList[i] != NULL);
84493 : #if 0
84494 : traversal.visit(nodeList[i]);
84495 : #else
84496 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
84497 : {
84498 0 : traversal.visit(nodeList[i]);
84499 : }
84500 : #endif
84501 : }
84502 : #endif
84503 : }
84504 :
84505 : // This should not be required since all previously static data members are
84506 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
84507 :
84508 5342 : }
84509 :
84510 :
84511 : void
84512 194 : SgAssignStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
84513 : {
84514 : // This function traverses the memory pool for an IR node and
84515 : // calls the function to execute the visitor object.
84516 :
84517 : // Initialize array to the address of the first element of the STL vector
84518 : // (which is guarenteed to be contiguous storage).
84519 : // SgAssignStatement objectArray [] = *(Memory_Block_List.begin());
84520 194 : if (SgAssignStatement::pools.empty() == false)
84521 : {
84522 : // Generate an array of memory pools
84523 0 : SgAssignStatement** objectArray = (SgAssignStatement**) &(SgAssignStatement::pools[0]);
84524 :
84525 : // Build a local variable for better performance
84526 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
84527 :
84528 : // Iterate over the memory pools
84529 0 : for (unsigned int i=0; i < SgAssignStatement::pools.size(); i++)
84530 : {
84531 : // objectArray[i] is a single memory pool
84532 0 : for (unsigned j=0; j < SgAssignStatement::pool_size; j++)
84533 : {
84534 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
84535 : {
84536 : // printf ("Found a valid SgAssignStatement object in the memory pool %d at position %d \n",i,j);
84537 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
84538 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
84539 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
84540 : }
84541 : else
84542 : {
84543 : // printf ("Found a INVALID SgAssignStatement object in the memory pool \n");
84544 : }
84545 : }
84546 : }
84547 : }
84548 :
84549 : // This should not be required since all previously static data members are
84550 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
84551 :
84552 194 : }
84553 :
84554 : void
84555 0 : SgAssignStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
84556 : {
84557 : // This function visits only a single IR node of the memory pool.
84558 : // it is typically called once for each type of IR node within
84559 : // the automatically generated function: traverseRepresentativeNodes().
84560 :
84561 : // Initialize array to the address of the first element of the STL vector
84562 : // (which is guarenteed to be contiguous storage).
84563 : // SgAssignStatement objectArray [] = *(Memory_Block_List.begin());
84564 0 : if (SgAssignStatement::pools.empty() == false)
84565 : {
84566 : // Generate an array of memory pools
84567 0 : SgAssignStatement** objectArray = (SgAssignStatement**) &(SgAssignStatement::pools[0]);
84568 :
84569 : // Build a local variable for better performance
84570 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
84571 :
84572 : // Iterate over the memory pools
84573 0 : bool done = false;
84574 0 : unsigned i=0;
84575 :
84576 : // find the first valid IR node, call visit function, and then leave
84577 0 : while ( done == false && i < SgAssignStatement::pools.size() )
84578 : {
84579 : // objectArray[i] is a single memory pool
84580 : unsigned j=0;
84581 0 : while (done == false && j < SgAssignStatement::pool_size)
84582 : {
84583 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
84584 : {
84585 0 : traversal.visit(&(objectArray[i][j]));
84586 0 : done = true;
84587 : }
84588 0 : j++;
84589 : }
84590 0 : i++;
84591 : }
84592 :
84593 : #if 0
84594 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
84595 : if (done == false)
84596 : {
84597 : printf ("No representative for SgAssignStatement found in memory pools \n");
84598 : }
84599 : #endif
84600 : }
84601 0 : }
84602 :
84603 :
84604 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
84605 : // using values that overflow signed values of int.
84606 : size_t
84607 4 : SgAssignStatement::numberOfNodes()
84608 : {
84609 : // This function traverses the memory pool for an IR node and
84610 : // counts the number of IR nodes of a particular Sage III IR
84611 : // nodes type.
84612 :
84613 4 : size_t count = 0;
84614 4 : if (SgAssignStatement::pools.empty() == false)
84615 : {
84616 : // Generate an array of memory pools (this is actually a STL vector,
84617 : // but it is contiguious, so OK to treat this way).
84618 0 : SgAssignStatement** objectArray = (SgAssignStatement**) &(SgAssignStatement::pools[0]);
84619 :
84620 : // Build a local variable for better performance (make it a loop invariant variable).
84621 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
84622 :
84623 : // Iterate over all of the memory pools for this IR node.
84624 0 : for (unsigned int i=0; i < SgAssignStatement::pools.size(); i++)
84625 : {
84626 : // objectArray[i] is a single memory pool, iterate over all the
84627 : // IR nodes and only count those that are valid IR nodes used in
84628 : // the AST (i.e. allocated IR nodes).
84629 0 : for (unsigned j=0; j < SgAssignStatement::pool_size; j++)
84630 : {
84631 : // This is indexing the STL vector of C/C++ style arrays as a doubly
84632 : // indexed array access. It is OK since we have leveraged the semantics
84633 : // of STL vector memory as contigous and cast the memory as an array
84634 : // of arrays to use the 2D array indexing. Hope this is not confusing,
84635 : // but it s very fast as an implementation.
84636 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
84637 : {
84638 0 : count++;
84639 : }
84640 : }
84641 : }
84642 : }
84643 :
84644 :
84645 :
84646 4 : return count;
84647 : }
84648 :
84649 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
84650 : // using values that overflow signed values of int.
84651 : size_t
84652 0 : SgAssignStatement::memoryUsage()
84653 : {
84654 : // This function is required because we need the class name as a type when we call sizeof
84655 : // There might be another way to implement this if we have a traversal that only called a
84656 : // representative object (one call for each type of Sage IIIIR node).
84657 0 : size_t memory = numberOfNodes() * sizeof(SgAssignStatement);
84658 :
84659 0 : return memory;
84660 : }
84661 :
84662 : /* #line 84663 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
84663 :
84664 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
84665 : void
84666 5342 : SgComputedGotoStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
84667 : {
84668 : // This function traverses the memory pool for only a specific IR node
84669 : // and calls the visit function of the input class execute a traversal
84670 : // similar to the style of the attribute based traversals within ROSE.
84671 : // This traversal will visit ALL nodes of the AST where as the other
84672 : // attribute based traversals visit only the embedded tree within the AST.
84673 :
84674 : // Initialize array to the address of the first element of the STL vector
84675 : // (which is guaranteed to be contiguous storage).
84676 : // SgComputedGotoStatement objectArray [] = *(Memory_Block_List.begin());
84677 5342 : if (SgComputedGotoStatement::pools.empty() == false)
84678 : {
84679 : // Generate an array of memory pools
84680 0 : SgComputedGotoStatement** objectArray = (SgComputedGotoStatement**) &(SgComputedGotoStatement::pools[0]);
84681 :
84682 : // Build a local variable for better performance
84683 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
84684 : #if 0
84685 : // Iterate over the memory pools
84686 : for (unsigned int i=0; i < SgComputedGotoStatement::pools.size(); i++)
84687 : {
84688 : // objectArray[i] is a single memory pool
84689 : for (int j=0; j < SgComputedGotoStatement::pool_size; j++)
84690 : {
84691 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
84692 : {
84693 : traversal.visit(&(objectArray[i][j]));
84694 : }
84695 : }
84696 : }
84697 : #else
84698 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
84699 : // compute the list first and then call the visit function on each list element.
84700 :
84701 : // printf ("Inside of SgComputedGotoStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
84702 :
84703 0 : std::vector<SgComputedGotoStatement*> nodeList;
84704 :
84705 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
84706 0 : for (unsigned int i=0; i < SgComputedGotoStatement::pools.size(); i++)
84707 : {
84708 : // objectArray[i] is a single memory pool
84709 0 : for (unsigned j=0; j < SgComputedGotoStatement::pool_size; j++)
84710 : {
84711 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
84712 : {
84713 0 : nodeList.push_back(&(objectArray[i][j]));
84714 : }
84715 : }
84716 : }
84717 :
84718 : // Iterate over the saved list
84719 0 : size_t nodeListSize = nodeList.size();
84720 0 : for (size_t i=0; i < nodeListSize; i++)
84721 : {
84722 0 : ROSE_ASSERT(nodeList[i] != NULL);
84723 : #if 0
84724 : traversal.visit(nodeList[i]);
84725 : #else
84726 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
84727 : {
84728 0 : traversal.visit(nodeList[i]);
84729 : }
84730 : #endif
84731 : }
84732 : #endif
84733 : }
84734 :
84735 : // This should not be required since all previously static data members are
84736 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
84737 :
84738 5342 : }
84739 :
84740 :
84741 : void
84742 194 : SgComputedGotoStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
84743 : {
84744 : // This function traverses the memory pool for an IR node and
84745 : // calls the function to execute the visitor object.
84746 :
84747 : // Initialize array to the address of the first element of the STL vector
84748 : // (which is guarenteed to be contiguous storage).
84749 : // SgComputedGotoStatement objectArray [] = *(Memory_Block_List.begin());
84750 194 : if (SgComputedGotoStatement::pools.empty() == false)
84751 : {
84752 : // Generate an array of memory pools
84753 0 : SgComputedGotoStatement** objectArray = (SgComputedGotoStatement**) &(SgComputedGotoStatement::pools[0]);
84754 :
84755 : // Build a local variable for better performance
84756 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
84757 :
84758 : // Iterate over the memory pools
84759 0 : for (unsigned int i=0; i < SgComputedGotoStatement::pools.size(); i++)
84760 : {
84761 : // objectArray[i] is a single memory pool
84762 0 : for (unsigned j=0; j < SgComputedGotoStatement::pool_size; j++)
84763 : {
84764 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
84765 : {
84766 : // printf ("Found a valid SgComputedGotoStatement object in the memory pool %d at position %d \n",i,j);
84767 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
84768 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
84769 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
84770 : }
84771 : else
84772 : {
84773 : // printf ("Found a INVALID SgComputedGotoStatement object in the memory pool \n");
84774 : }
84775 : }
84776 : }
84777 : }
84778 :
84779 : // This should not be required since all previously static data members are
84780 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
84781 :
84782 194 : }
84783 :
84784 : void
84785 0 : SgComputedGotoStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
84786 : {
84787 : // This function visits only a single IR node of the memory pool.
84788 : // it is typically called once for each type of IR node within
84789 : // the automatically generated function: traverseRepresentativeNodes().
84790 :
84791 : // Initialize array to the address of the first element of the STL vector
84792 : // (which is guarenteed to be contiguous storage).
84793 : // SgComputedGotoStatement objectArray [] = *(Memory_Block_List.begin());
84794 0 : if (SgComputedGotoStatement::pools.empty() == false)
84795 : {
84796 : // Generate an array of memory pools
84797 0 : SgComputedGotoStatement** objectArray = (SgComputedGotoStatement**) &(SgComputedGotoStatement::pools[0]);
84798 :
84799 : // Build a local variable for better performance
84800 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
84801 :
84802 : // Iterate over the memory pools
84803 0 : bool done = false;
84804 0 : unsigned i=0;
84805 :
84806 : // find the first valid IR node, call visit function, and then leave
84807 0 : while ( done == false && i < SgComputedGotoStatement::pools.size() )
84808 : {
84809 : // objectArray[i] is a single memory pool
84810 : unsigned j=0;
84811 0 : while (done == false && j < SgComputedGotoStatement::pool_size)
84812 : {
84813 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
84814 : {
84815 0 : traversal.visit(&(objectArray[i][j]));
84816 0 : done = true;
84817 : }
84818 0 : j++;
84819 : }
84820 0 : i++;
84821 : }
84822 :
84823 : #if 0
84824 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
84825 : if (done == false)
84826 : {
84827 : printf ("No representative for SgComputedGotoStatement found in memory pools \n");
84828 : }
84829 : #endif
84830 : }
84831 0 : }
84832 :
84833 :
84834 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
84835 : // using values that overflow signed values of int.
84836 : size_t
84837 4 : SgComputedGotoStatement::numberOfNodes()
84838 : {
84839 : // This function traverses the memory pool for an IR node and
84840 : // counts the number of IR nodes of a particular Sage III IR
84841 : // nodes type.
84842 :
84843 4 : size_t count = 0;
84844 4 : if (SgComputedGotoStatement::pools.empty() == false)
84845 : {
84846 : // Generate an array of memory pools (this is actually a STL vector,
84847 : // but it is contiguious, so OK to treat this way).
84848 0 : SgComputedGotoStatement** objectArray = (SgComputedGotoStatement**) &(SgComputedGotoStatement::pools[0]);
84849 :
84850 : // Build a local variable for better performance (make it a loop invariant variable).
84851 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
84852 :
84853 : // Iterate over all of the memory pools for this IR node.
84854 0 : for (unsigned int i=0; i < SgComputedGotoStatement::pools.size(); i++)
84855 : {
84856 : // objectArray[i] is a single memory pool, iterate over all the
84857 : // IR nodes and only count those that are valid IR nodes used in
84858 : // the AST (i.e. allocated IR nodes).
84859 0 : for (unsigned j=0; j < SgComputedGotoStatement::pool_size; j++)
84860 : {
84861 : // This is indexing the STL vector of C/C++ style arrays as a doubly
84862 : // indexed array access. It is OK since we have leveraged the semantics
84863 : // of STL vector memory as contigous and cast the memory as an array
84864 : // of arrays to use the 2D array indexing. Hope this is not confusing,
84865 : // but it s very fast as an implementation.
84866 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
84867 : {
84868 0 : count++;
84869 : }
84870 : }
84871 : }
84872 : }
84873 :
84874 :
84875 :
84876 4 : return count;
84877 : }
84878 :
84879 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
84880 : // using values that overflow signed values of int.
84881 : size_t
84882 0 : SgComputedGotoStatement::memoryUsage()
84883 : {
84884 : // This function is required because we need the class name as a type when we call sizeof
84885 : // There might be another way to implement this if we have a traversal that only called a
84886 : // representative object (one call for each type of Sage IIIIR node).
84887 0 : size_t memory = numberOfNodes() * sizeof(SgComputedGotoStatement);
84888 :
84889 0 : return memory;
84890 : }
84891 :
84892 : /* #line 84893 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
84893 :
84894 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
84895 : void
84896 5342 : SgAssignedGotoStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
84897 : {
84898 : // This function traverses the memory pool for only a specific IR node
84899 : // and calls the visit function of the input class execute a traversal
84900 : // similar to the style of the attribute based traversals within ROSE.
84901 : // This traversal will visit ALL nodes of the AST where as the other
84902 : // attribute based traversals visit only the embedded tree within the AST.
84903 :
84904 : // Initialize array to the address of the first element of the STL vector
84905 : // (which is guaranteed to be contiguous storage).
84906 : // SgAssignedGotoStatement objectArray [] = *(Memory_Block_List.begin());
84907 5342 : if (SgAssignedGotoStatement::pools.empty() == false)
84908 : {
84909 : // Generate an array of memory pools
84910 0 : SgAssignedGotoStatement** objectArray = (SgAssignedGotoStatement**) &(SgAssignedGotoStatement::pools[0]);
84911 :
84912 : // Build a local variable for better performance
84913 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
84914 : #if 0
84915 : // Iterate over the memory pools
84916 : for (unsigned int i=0; i < SgAssignedGotoStatement::pools.size(); i++)
84917 : {
84918 : // objectArray[i] is a single memory pool
84919 : for (int j=0; j < SgAssignedGotoStatement::pool_size; j++)
84920 : {
84921 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
84922 : {
84923 : traversal.visit(&(objectArray[i][j]));
84924 : }
84925 : }
84926 : }
84927 : #else
84928 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
84929 : // compute the list first and then call the visit function on each list element.
84930 :
84931 : // printf ("Inside of SgAssignedGotoStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
84932 :
84933 0 : std::vector<SgAssignedGotoStatement*> nodeList;
84934 :
84935 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
84936 0 : for (unsigned int i=0; i < SgAssignedGotoStatement::pools.size(); i++)
84937 : {
84938 : // objectArray[i] is a single memory pool
84939 0 : for (unsigned j=0; j < SgAssignedGotoStatement::pool_size; j++)
84940 : {
84941 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
84942 : {
84943 0 : nodeList.push_back(&(objectArray[i][j]));
84944 : }
84945 : }
84946 : }
84947 :
84948 : // Iterate over the saved list
84949 0 : size_t nodeListSize = nodeList.size();
84950 0 : for (size_t i=0; i < nodeListSize; i++)
84951 : {
84952 0 : ROSE_ASSERT(nodeList[i] != NULL);
84953 : #if 0
84954 : traversal.visit(nodeList[i]);
84955 : #else
84956 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
84957 : {
84958 0 : traversal.visit(nodeList[i]);
84959 : }
84960 : #endif
84961 : }
84962 : #endif
84963 : }
84964 :
84965 : // This should not be required since all previously static data members are
84966 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
84967 :
84968 5342 : }
84969 :
84970 :
84971 : void
84972 194 : SgAssignedGotoStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
84973 : {
84974 : // This function traverses the memory pool for an IR node and
84975 : // calls the function to execute the visitor object.
84976 :
84977 : // Initialize array to the address of the first element of the STL vector
84978 : // (which is guarenteed to be contiguous storage).
84979 : // SgAssignedGotoStatement objectArray [] = *(Memory_Block_List.begin());
84980 194 : if (SgAssignedGotoStatement::pools.empty() == false)
84981 : {
84982 : // Generate an array of memory pools
84983 0 : SgAssignedGotoStatement** objectArray = (SgAssignedGotoStatement**) &(SgAssignedGotoStatement::pools[0]);
84984 :
84985 : // Build a local variable for better performance
84986 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
84987 :
84988 : // Iterate over the memory pools
84989 0 : for (unsigned int i=0; i < SgAssignedGotoStatement::pools.size(); i++)
84990 : {
84991 : // objectArray[i] is a single memory pool
84992 0 : for (unsigned j=0; j < SgAssignedGotoStatement::pool_size; j++)
84993 : {
84994 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
84995 : {
84996 : // printf ("Found a valid SgAssignedGotoStatement object in the memory pool %d at position %d \n",i,j);
84997 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
84998 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
84999 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
85000 : }
85001 : else
85002 : {
85003 : // printf ("Found a INVALID SgAssignedGotoStatement object in the memory pool \n");
85004 : }
85005 : }
85006 : }
85007 : }
85008 :
85009 : // This should not be required since all previously static data members are
85010 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
85011 :
85012 194 : }
85013 :
85014 : void
85015 0 : SgAssignedGotoStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
85016 : {
85017 : // This function visits only a single IR node of the memory pool.
85018 : // it is typically called once for each type of IR node within
85019 : // the automatically generated function: traverseRepresentativeNodes().
85020 :
85021 : // Initialize array to the address of the first element of the STL vector
85022 : // (which is guarenteed to be contiguous storage).
85023 : // SgAssignedGotoStatement objectArray [] = *(Memory_Block_List.begin());
85024 0 : if (SgAssignedGotoStatement::pools.empty() == false)
85025 : {
85026 : // Generate an array of memory pools
85027 0 : SgAssignedGotoStatement** objectArray = (SgAssignedGotoStatement**) &(SgAssignedGotoStatement::pools[0]);
85028 :
85029 : // Build a local variable for better performance
85030 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
85031 :
85032 : // Iterate over the memory pools
85033 0 : bool done = false;
85034 0 : unsigned i=0;
85035 :
85036 : // find the first valid IR node, call visit function, and then leave
85037 0 : while ( done == false && i < SgAssignedGotoStatement::pools.size() )
85038 : {
85039 : // objectArray[i] is a single memory pool
85040 : unsigned j=0;
85041 0 : while (done == false && j < SgAssignedGotoStatement::pool_size)
85042 : {
85043 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
85044 : {
85045 0 : traversal.visit(&(objectArray[i][j]));
85046 0 : done = true;
85047 : }
85048 0 : j++;
85049 : }
85050 0 : i++;
85051 : }
85052 :
85053 : #if 0
85054 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
85055 : if (done == false)
85056 : {
85057 : printf ("No representative for SgAssignedGotoStatement found in memory pools \n");
85058 : }
85059 : #endif
85060 : }
85061 0 : }
85062 :
85063 :
85064 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
85065 : // using values that overflow signed values of int.
85066 : size_t
85067 4 : SgAssignedGotoStatement::numberOfNodes()
85068 : {
85069 : // This function traverses the memory pool for an IR node and
85070 : // counts the number of IR nodes of a particular Sage III IR
85071 : // nodes type.
85072 :
85073 4 : size_t count = 0;
85074 4 : if (SgAssignedGotoStatement::pools.empty() == false)
85075 : {
85076 : // Generate an array of memory pools (this is actually a STL vector,
85077 : // but it is contiguious, so OK to treat this way).
85078 0 : SgAssignedGotoStatement** objectArray = (SgAssignedGotoStatement**) &(SgAssignedGotoStatement::pools[0]);
85079 :
85080 : // Build a local variable for better performance (make it a loop invariant variable).
85081 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
85082 :
85083 : // Iterate over all of the memory pools for this IR node.
85084 0 : for (unsigned int i=0; i < SgAssignedGotoStatement::pools.size(); i++)
85085 : {
85086 : // objectArray[i] is a single memory pool, iterate over all the
85087 : // IR nodes and only count those that are valid IR nodes used in
85088 : // the AST (i.e. allocated IR nodes).
85089 0 : for (unsigned j=0; j < SgAssignedGotoStatement::pool_size; j++)
85090 : {
85091 : // This is indexing the STL vector of C/C++ style arrays as a doubly
85092 : // indexed array access. It is OK since we have leveraged the semantics
85093 : // of STL vector memory as contigous and cast the memory as an array
85094 : // of arrays to use the 2D array indexing. Hope this is not confusing,
85095 : // but it s very fast as an implementation.
85096 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
85097 : {
85098 0 : count++;
85099 : }
85100 : }
85101 : }
85102 : }
85103 :
85104 :
85105 :
85106 4 : return count;
85107 : }
85108 :
85109 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
85110 : // using values that overflow signed values of int.
85111 : size_t
85112 0 : SgAssignedGotoStatement::memoryUsage()
85113 : {
85114 : // This function is required because we need the class name as a type when we call sizeof
85115 : // There might be another way to implement this if we have a traversal that only called a
85116 : // representative object (one call for each type of Sage IIIIR node).
85117 0 : size_t memory = numberOfNodes() * sizeof(SgAssignedGotoStatement);
85118 :
85119 0 : return memory;
85120 : }
85121 :
85122 : /* #line 85123 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
85123 :
85124 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
85125 : void
85126 5342 : SgAllocateStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
85127 : {
85128 : // This function traverses the memory pool for only a specific IR node
85129 : // and calls the visit function of the input class execute a traversal
85130 : // similar to the style of the attribute based traversals within ROSE.
85131 : // This traversal will visit ALL nodes of the AST where as the other
85132 : // attribute based traversals visit only the embedded tree within the AST.
85133 :
85134 : // Initialize array to the address of the first element of the STL vector
85135 : // (which is guaranteed to be contiguous storage).
85136 : // SgAllocateStatement objectArray [] = *(Memory_Block_List.begin());
85137 5342 : if (SgAllocateStatement::pools.empty() == false)
85138 : {
85139 : // Generate an array of memory pools
85140 0 : SgAllocateStatement** objectArray = (SgAllocateStatement**) &(SgAllocateStatement::pools[0]);
85141 :
85142 : // Build a local variable for better performance
85143 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
85144 : #if 0
85145 : // Iterate over the memory pools
85146 : for (unsigned int i=0; i < SgAllocateStatement::pools.size(); i++)
85147 : {
85148 : // objectArray[i] is a single memory pool
85149 : for (int j=0; j < SgAllocateStatement::pool_size; j++)
85150 : {
85151 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
85152 : {
85153 : traversal.visit(&(objectArray[i][j]));
85154 : }
85155 : }
85156 : }
85157 : #else
85158 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
85159 : // compute the list first and then call the visit function on each list element.
85160 :
85161 : // printf ("Inside of SgAllocateStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
85162 :
85163 0 : std::vector<SgAllocateStatement*> nodeList;
85164 :
85165 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
85166 0 : for (unsigned int i=0; i < SgAllocateStatement::pools.size(); i++)
85167 : {
85168 : // objectArray[i] is a single memory pool
85169 0 : for (unsigned j=0; j < SgAllocateStatement::pool_size; j++)
85170 : {
85171 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
85172 : {
85173 0 : nodeList.push_back(&(objectArray[i][j]));
85174 : }
85175 : }
85176 : }
85177 :
85178 : // Iterate over the saved list
85179 0 : size_t nodeListSize = nodeList.size();
85180 0 : for (size_t i=0; i < nodeListSize; i++)
85181 : {
85182 0 : ROSE_ASSERT(nodeList[i] != NULL);
85183 : #if 0
85184 : traversal.visit(nodeList[i]);
85185 : #else
85186 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
85187 : {
85188 0 : traversal.visit(nodeList[i]);
85189 : }
85190 : #endif
85191 : }
85192 : #endif
85193 : }
85194 :
85195 : // This should not be required since all previously static data members are
85196 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
85197 :
85198 5342 : }
85199 :
85200 :
85201 : void
85202 194 : SgAllocateStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
85203 : {
85204 : // This function traverses the memory pool for an IR node and
85205 : // calls the function to execute the visitor object.
85206 :
85207 : // Initialize array to the address of the first element of the STL vector
85208 : // (which is guarenteed to be contiguous storage).
85209 : // SgAllocateStatement objectArray [] = *(Memory_Block_List.begin());
85210 194 : if (SgAllocateStatement::pools.empty() == false)
85211 : {
85212 : // Generate an array of memory pools
85213 0 : SgAllocateStatement** objectArray = (SgAllocateStatement**) &(SgAllocateStatement::pools[0]);
85214 :
85215 : // Build a local variable for better performance
85216 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
85217 :
85218 : // Iterate over the memory pools
85219 0 : for (unsigned int i=0; i < SgAllocateStatement::pools.size(); i++)
85220 : {
85221 : // objectArray[i] is a single memory pool
85222 0 : for (unsigned j=0; j < SgAllocateStatement::pool_size; j++)
85223 : {
85224 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
85225 : {
85226 : // printf ("Found a valid SgAllocateStatement object in the memory pool %d at position %d \n",i,j);
85227 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
85228 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
85229 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
85230 : }
85231 : else
85232 : {
85233 : // printf ("Found a INVALID SgAllocateStatement object in the memory pool \n");
85234 : }
85235 : }
85236 : }
85237 : }
85238 :
85239 : // This should not be required since all previously static data members are
85240 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
85241 :
85242 194 : }
85243 :
85244 : void
85245 0 : SgAllocateStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
85246 : {
85247 : // This function visits only a single IR node of the memory pool.
85248 : // it is typically called once for each type of IR node within
85249 : // the automatically generated function: traverseRepresentativeNodes().
85250 :
85251 : // Initialize array to the address of the first element of the STL vector
85252 : // (which is guarenteed to be contiguous storage).
85253 : // SgAllocateStatement objectArray [] = *(Memory_Block_List.begin());
85254 0 : if (SgAllocateStatement::pools.empty() == false)
85255 : {
85256 : // Generate an array of memory pools
85257 0 : SgAllocateStatement** objectArray = (SgAllocateStatement**) &(SgAllocateStatement::pools[0]);
85258 :
85259 : // Build a local variable for better performance
85260 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
85261 :
85262 : // Iterate over the memory pools
85263 0 : bool done = false;
85264 0 : unsigned i=0;
85265 :
85266 : // find the first valid IR node, call visit function, and then leave
85267 0 : while ( done == false && i < SgAllocateStatement::pools.size() )
85268 : {
85269 : // objectArray[i] is a single memory pool
85270 : unsigned j=0;
85271 0 : while (done == false && j < SgAllocateStatement::pool_size)
85272 : {
85273 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
85274 : {
85275 0 : traversal.visit(&(objectArray[i][j]));
85276 0 : done = true;
85277 : }
85278 0 : j++;
85279 : }
85280 0 : i++;
85281 : }
85282 :
85283 : #if 0
85284 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
85285 : if (done == false)
85286 : {
85287 : printf ("No representative for SgAllocateStatement found in memory pools \n");
85288 : }
85289 : #endif
85290 : }
85291 0 : }
85292 :
85293 :
85294 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
85295 : // using values that overflow signed values of int.
85296 : size_t
85297 4 : SgAllocateStatement::numberOfNodes()
85298 : {
85299 : // This function traverses the memory pool for an IR node and
85300 : // counts the number of IR nodes of a particular Sage III IR
85301 : // nodes type.
85302 :
85303 4 : size_t count = 0;
85304 4 : if (SgAllocateStatement::pools.empty() == false)
85305 : {
85306 : // Generate an array of memory pools (this is actually a STL vector,
85307 : // but it is contiguious, so OK to treat this way).
85308 0 : SgAllocateStatement** objectArray = (SgAllocateStatement**) &(SgAllocateStatement::pools[0]);
85309 :
85310 : // Build a local variable for better performance (make it a loop invariant variable).
85311 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
85312 :
85313 : // Iterate over all of the memory pools for this IR node.
85314 0 : for (unsigned int i=0; i < SgAllocateStatement::pools.size(); i++)
85315 : {
85316 : // objectArray[i] is a single memory pool, iterate over all the
85317 : // IR nodes and only count those that are valid IR nodes used in
85318 : // the AST (i.e. allocated IR nodes).
85319 0 : for (unsigned j=0; j < SgAllocateStatement::pool_size; j++)
85320 : {
85321 : // This is indexing the STL vector of C/C++ style arrays as a doubly
85322 : // indexed array access. It is OK since we have leveraged the semantics
85323 : // of STL vector memory as contigous and cast the memory as an array
85324 : // of arrays to use the 2D array indexing. Hope this is not confusing,
85325 : // but it s very fast as an implementation.
85326 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
85327 : {
85328 0 : count++;
85329 : }
85330 : }
85331 : }
85332 : }
85333 :
85334 :
85335 :
85336 4 : return count;
85337 : }
85338 :
85339 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
85340 : // using values that overflow signed values of int.
85341 : size_t
85342 0 : SgAllocateStatement::memoryUsage()
85343 : {
85344 : // This function is required because we need the class name as a type when we call sizeof
85345 : // There might be another way to implement this if we have a traversal that only called a
85346 : // representative object (one call for each type of Sage IIIIR node).
85347 0 : size_t memory = numberOfNodes() * sizeof(SgAllocateStatement);
85348 :
85349 0 : return memory;
85350 : }
85351 :
85352 : /* #line 85353 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
85353 :
85354 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
85355 : void
85356 5342 : SgDeallocateStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
85357 : {
85358 : // This function traverses the memory pool for only a specific IR node
85359 : // and calls the visit function of the input class execute a traversal
85360 : // similar to the style of the attribute based traversals within ROSE.
85361 : // This traversal will visit ALL nodes of the AST where as the other
85362 : // attribute based traversals visit only the embedded tree within the AST.
85363 :
85364 : // Initialize array to the address of the first element of the STL vector
85365 : // (which is guaranteed to be contiguous storage).
85366 : // SgDeallocateStatement objectArray [] = *(Memory_Block_List.begin());
85367 5342 : if (SgDeallocateStatement::pools.empty() == false)
85368 : {
85369 : // Generate an array of memory pools
85370 0 : SgDeallocateStatement** objectArray = (SgDeallocateStatement**) &(SgDeallocateStatement::pools[0]);
85371 :
85372 : // Build a local variable for better performance
85373 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
85374 : #if 0
85375 : // Iterate over the memory pools
85376 : for (unsigned int i=0; i < SgDeallocateStatement::pools.size(); i++)
85377 : {
85378 : // objectArray[i] is a single memory pool
85379 : for (int j=0; j < SgDeallocateStatement::pool_size; j++)
85380 : {
85381 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
85382 : {
85383 : traversal.visit(&(objectArray[i][j]));
85384 : }
85385 : }
85386 : }
85387 : #else
85388 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
85389 : // compute the list first and then call the visit function on each list element.
85390 :
85391 : // printf ("Inside of SgDeallocateStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
85392 :
85393 0 : std::vector<SgDeallocateStatement*> nodeList;
85394 :
85395 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
85396 0 : for (unsigned int i=0; i < SgDeallocateStatement::pools.size(); i++)
85397 : {
85398 : // objectArray[i] is a single memory pool
85399 0 : for (unsigned j=0; j < SgDeallocateStatement::pool_size; j++)
85400 : {
85401 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
85402 : {
85403 0 : nodeList.push_back(&(objectArray[i][j]));
85404 : }
85405 : }
85406 : }
85407 :
85408 : // Iterate over the saved list
85409 0 : size_t nodeListSize = nodeList.size();
85410 0 : for (size_t i=0; i < nodeListSize; i++)
85411 : {
85412 0 : ROSE_ASSERT(nodeList[i] != NULL);
85413 : #if 0
85414 : traversal.visit(nodeList[i]);
85415 : #else
85416 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
85417 : {
85418 0 : traversal.visit(nodeList[i]);
85419 : }
85420 : #endif
85421 : }
85422 : #endif
85423 : }
85424 :
85425 : // This should not be required since all previously static data members are
85426 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
85427 :
85428 5342 : }
85429 :
85430 :
85431 : void
85432 194 : SgDeallocateStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
85433 : {
85434 : // This function traverses the memory pool for an IR node and
85435 : // calls the function to execute the visitor object.
85436 :
85437 : // Initialize array to the address of the first element of the STL vector
85438 : // (which is guarenteed to be contiguous storage).
85439 : // SgDeallocateStatement objectArray [] = *(Memory_Block_List.begin());
85440 194 : if (SgDeallocateStatement::pools.empty() == false)
85441 : {
85442 : // Generate an array of memory pools
85443 0 : SgDeallocateStatement** objectArray = (SgDeallocateStatement**) &(SgDeallocateStatement::pools[0]);
85444 :
85445 : // Build a local variable for better performance
85446 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
85447 :
85448 : // Iterate over the memory pools
85449 0 : for (unsigned int i=0; i < SgDeallocateStatement::pools.size(); i++)
85450 : {
85451 : // objectArray[i] is a single memory pool
85452 0 : for (unsigned j=0; j < SgDeallocateStatement::pool_size; j++)
85453 : {
85454 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
85455 : {
85456 : // printf ("Found a valid SgDeallocateStatement object in the memory pool %d at position %d \n",i,j);
85457 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
85458 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
85459 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
85460 : }
85461 : else
85462 : {
85463 : // printf ("Found a INVALID SgDeallocateStatement object in the memory pool \n");
85464 : }
85465 : }
85466 : }
85467 : }
85468 :
85469 : // This should not be required since all previously static data members are
85470 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
85471 :
85472 194 : }
85473 :
85474 : void
85475 0 : SgDeallocateStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
85476 : {
85477 : // This function visits only a single IR node of the memory pool.
85478 : // it is typically called once for each type of IR node within
85479 : // the automatically generated function: traverseRepresentativeNodes().
85480 :
85481 : // Initialize array to the address of the first element of the STL vector
85482 : // (which is guarenteed to be contiguous storage).
85483 : // SgDeallocateStatement objectArray [] = *(Memory_Block_List.begin());
85484 0 : if (SgDeallocateStatement::pools.empty() == false)
85485 : {
85486 : // Generate an array of memory pools
85487 0 : SgDeallocateStatement** objectArray = (SgDeallocateStatement**) &(SgDeallocateStatement::pools[0]);
85488 :
85489 : // Build a local variable for better performance
85490 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
85491 :
85492 : // Iterate over the memory pools
85493 0 : bool done = false;
85494 0 : unsigned i=0;
85495 :
85496 : // find the first valid IR node, call visit function, and then leave
85497 0 : while ( done == false && i < SgDeallocateStatement::pools.size() )
85498 : {
85499 : // objectArray[i] is a single memory pool
85500 : unsigned j=0;
85501 0 : while (done == false && j < SgDeallocateStatement::pool_size)
85502 : {
85503 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
85504 : {
85505 0 : traversal.visit(&(objectArray[i][j]));
85506 0 : done = true;
85507 : }
85508 0 : j++;
85509 : }
85510 0 : i++;
85511 : }
85512 :
85513 : #if 0
85514 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
85515 : if (done == false)
85516 : {
85517 : printf ("No representative for SgDeallocateStatement found in memory pools \n");
85518 : }
85519 : #endif
85520 : }
85521 0 : }
85522 :
85523 :
85524 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
85525 : // using values that overflow signed values of int.
85526 : size_t
85527 4 : SgDeallocateStatement::numberOfNodes()
85528 : {
85529 : // This function traverses the memory pool for an IR node and
85530 : // counts the number of IR nodes of a particular Sage III IR
85531 : // nodes type.
85532 :
85533 4 : size_t count = 0;
85534 4 : if (SgDeallocateStatement::pools.empty() == false)
85535 : {
85536 : // Generate an array of memory pools (this is actually a STL vector,
85537 : // but it is contiguious, so OK to treat this way).
85538 0 : SgDeallocateStatement** objectArray = (SgDeallocateStatement**) &(SgDeallocateStatement::pools[0]);
85539 :
85540 : // Build a local variable for better performance (make it a loop invariant variable).
85541 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
85542 :
85543 : // Iterate over all of the memory pools for this IR node.
85544 0 : for (unsigned int i=0; i < SgDeallocateStatement::pools.size(); i++)
85545 : {
85546 : // objectArray[i] is a single memory pool, iterate over all the
85547 : // IR nodes and only count those that are valid IR nodes used in
85548 : // the AST (i.e. allocated IR nodes).
85549 0 : for (unsigned j=0; j < SgDeallocateStatement::pool_size; j++)
85550 : {
85551 : // This is indexing the STL vector of C/C++ style arrays as a doubly
85552 : // indexed array access. It is OK since we have leveraged the semantics
85553 : // of STL vector memory as contigous and cast the memory as an array
85554 : // of arrays to use the 2D array indexing. Hope this is not confusing,
85555 : // but it s very fast as an implementation.
85556 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
85557 : {
85558 0 : count++;
85559 : }
85560 : }
85561 : }
85562 : }
85563 :
85564 :
85565 :
85566 4 : return count;
85567 : }
85568 :
85569 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
85570 : // using values that overflow signed values of int.
85571 : size_t
85572 0 : SgDeallocateStatement::memoryUsage()
85573 : {
85574 : // This function is required because we need the class name as a type when we call sizeof
85575 : // There might be another way to implement this if we have a traversal that only called a
85576 : // representative object (one call for each type of Sage IIIIR node).
85577 0 : size_t memory = numberOfNodes() * sizeof(SgDeallocateStatement);
85578 :
85579 0 : return memory;
85580 : }
85581 :
85582 : /* #line 85583 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
85583 :
85584 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
85585 : void
85586 5342 : SgUpcNotifyStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
85587 : {
85588 : // This function traverses the memory pool for only a specific IR node
85589 : // and calls the visit function of the input class execute a traversal
85590 : // similar to the style of the attribute based traversals within ROSE.
85591 : // This traversal will visit ALL nodes of the AST where as the other
85592 : // attribute based traversals visit only the embedded tree within the AST.
85593 :
85594 : // Initialize array to the address of the first element of the STL vector
85595 : // (which is guaranteed to be contiguous storage).
85596 : // SgUpcNotifyStatement objectArray [] = *(Memory_Block_List.begin());
85597 5342 : if (SgUpcNotifyStatement::pools.empty() == false)
85598 : {
85599 : // Generate an array of memory pools
85600 0 : SgUpcNotifyStatement** objectArray = (SgUpcNotifyStatement**) &(SgUpcNotifyStatement::pools[0]);
85601 :
85602 : // Build a local variable for better performance
85603 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
85604 : #if 0
85605 : // Iterate over the memory pools
85606 : for (unsigned int i=0; i < SgUpcNotifyStatement::pools.size(); i++)
85607 : {
85608 : // objectArray[i] is a single memory pool
85609 : for (int j=0; j < SgUpcNotifyStatement::pool_size; j++)
85610 : {
85611 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
85612 : {
85613 : traversal.visit(&(objectArray[i][j]));
85614 : }
85615 : }
85616 : }
85617 : #else
85618 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
85619 : // compute the list first and then call the visit function on each list element.
85620 :
85621 : // printf ("Inside of SgUpcNotifyStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
85622 :
85623 0 : std::vector<SgUpcNotifyStatement*> nodeList;
85624 :
85625 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
85626 0 : for (unsigned int i=0; i < SgUpcNotifyStatement::pools.size(); i++)
85627 : {
85628 : // objectArray[i] is a single memory pool
85629 0 : for (unsigned j=0; j < SgUpcNotifyStatement::pool_size; j++)
85630 : {
85631 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
85632 : {
85633 0 : nodeList.push_back(&(objectArray[i][j]));
85634 : }
85635 : }
85636 : }
85637 :
85638 : // Iterate over the saved list
85639 0 : size_t nodeListSize = nodeList.size();
85640 0 : for (size_t i=0; i < nodeListSize; i++)
85641 : {
85642 0 : ROSE_ASSERT(nodeList[i] != NULL);
85643 : #if 0
85644 : traversal.visit(nodeList[i]);
85645 : #else
85646 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
85647 : {
85648 0 : traversal.visit(nodeList[i]);
85649 : }
85650 : #endif
85651 : }
85652 : #endif
85653 : }
85654 :
85655 : // This should not be required since all previously static data members are
85656 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
85657 :
85658 5342 : }
85659 :
85660 :
85661 : void
85662 194 : SgUpcNotifyStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
85663 : {
85664 : // This function traverses the memory pool for an IR node and
85665 : // calls the function to execute the visitor object.
85666 :
85667 : // Initialize array to the address of the first element of the STL vector
85668 : // (which is guarenteed to be contiguous storage).
85669 : // SgUpcNotifyStatement objectArray [] = *(Memory_Block_List.begin());
85670 194 : if (SgUpcNotifyStatement::pools.empty() == false)
85671 : {
85672 : // Generate an array of memory pools
85673 0 : SgUpcNotifyStatement** objectArray = (SgUpcNotifyStatement**) &(SgUpcNotifyStatement::pools[0]);
85674 :
85675 : // Build a local variable for better performance
85676 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
85677 :
85678 : // Iterate over the memory pools
85679 0 : for (unsigned int i=0; i < SgUpcNotifyStatement::pools.size(); i++)
85680 : {
85681 : // objectArray[i] is a single memory pool
85682 0 : for (unsigned j=0; j < SgUpcNotifyStatement::pool_size; j++)
85683 : {
85684 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
85685 : {
85686 : // printf ("Found a valid SgUpcNotifyStatement object in the memory pool %d at position %d \n",i,j);
85687 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
85688 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
85689 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
85690 : }
85691 : else
85692 : {
85693 : // printf ("Found a INVALID SgUpcNotifyStatement object in the memory pool \n");
85694 : }
85695 : }
85696 : }
85697 : }
85698 :
85699 : // This should not be required since all previously static data members are
85700 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
85701 :
85702 194 : }
85703 :
85704 : void
85705 0 : SgUpcNotifyStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
85706 : {
85707 : // This function visits only a single IR node of the memory pool.
85708 : // it is typically called once for each type of IR node within
85709 : // the automatically generated function: traverseRepresentativeNodes().
85710 :
85711 : // Initialize array to the address of the first element of the STL vector
85712 : // (which is guarenteed to be contiguous storage).
85713 : // SgUpcNotifyStatement objectArray [] = *(Memory_Block_List.begin());
85714 0 : if (SgUpcNotifyStatement::pools.empty() == false)
85715 : {
85716 : // Generate an array of memory pools
85717 0 : SgUpcNotifyStatement** objectArray = (SgUpcNotifyStatement**) &(SgUpcNotifyStatement::pools[0]);
85718 :
85719 : // Build a local variable for better performance
85720 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
85721 :
85722 : // Iterate over the memory pools
85723 0 : bool done = false;
85724 0 : unsigned i=0;
85725 :
85726 : // find the first valid IR node, call visit function, and then leave
85727 0 : while ( done == false && i < SgUpcNotifyStatement::pools.size() )
85728 : {
85729 : // objectArray[i] is a single memory pool
85730 : unsigned j=0;
85731 0 : while (done == false && j < SgUpcNotifyStatement::pool_size)
85732 : {
85733 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
85734 : {
85735 0 : traversal.visit(&(objectArray[i][j]));
85736 0 : done = true;
85737 : }
85738 0 : j++;
85739 : }
85740 0 : i++;
85741 : }
85742 :
85743 : #if 0
85744 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
85745 : if (done == false)
85746 : {
85747 : printf ("No representative for SgUpcNotifyStatement found in memory pools \n");
85748 : }
85749 : #endif
85750 : }
85751 0 : }
85752 :
85753 :
85754 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
85755 : // using values that overflow signed values of int.
85756 : size_t
85757 4 : SgUpcNotifyStatement::numberOfNodes()
85758 : {
85759 : // This function traverses the memory pool for an IR node and
85760 : // counts the number of IR nodes of a particular Sage III IR
85761 : // nodes type.
85762 :
85763 4 : size_t count = 0;
85764 4 : if (SgUpcNotifyStatement::pools.empty() == false)
85765 : {
85766 : // Generate an array of memory pools (this is actually a STL vector,
85767 : // but it is contiguious, so OK to treat this way).
85768 0 : SgUpcNotifyStatement** objectArray = (SgUpcNotifyStatement**) &(SgUpcNotifyStatement::pools[0]);
85769 :
85770 : // Build a local variable for better performance (make it a loop invariant variable).
85771 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
85772 :
85773 : // Iterate over all of the memory pools for this IR node.
85774 0 : for (unsigned int i=0; i < SgUpcNotifyStatement::pools.size(); i++)
85775 : {
85776 : // objectArray[i] is a single memory pool, iterate over all the
85777 : // IR nodes and only count those that are valid IR nodes used in
85778 : // the AST (i.e. allocated IR nodes).
85779 0 : for (unsigned j=0; j < SgUpcNotifyStatement::pool_size; j++)
85780 : {
85781 : // This is indexing the STL vector of C/C++ style arrays as a doubly
85782 : // indexed array access. It is OK since we have leveraged the semantics
85783 : // of STL vector memory as contigous and cast the memory as an array
85784 : // of arrays to use the 2D array indexing. Hope this is not confusing,
85785 : // but it s very fast as an implementation.
85786 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
85787 : {
85788 0 : count++;
85789 : }
85790 : }
85791 : }
85792 : }
85793 :
85794 :
85795 :
85796 4 : return count;
85797 : }
85798 :
85799 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
85800 : // using values that overflow signed values of int.
85801 : size_t
85802 0 : SgUpcNotifyStatement::memoryUsage()
85803 : {
85804 : // This function is required because we need the class name as a type when we call sizeof
85805 : // There might be another way to implement this if we have a traversal that only called a
85806 : // representative object (one call for each type of Sage IIIIR node).
85807 0 : size_t memory = numberOfNodes() * sizeof(SgUpcNotifyStatement);
85808 :
85809 0 : return memory;
85810 : }
85811 :
85812 : /* #line 85813 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
85813 :
85814 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
85815 : void
85816 5342 : SgUpcWaitStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
85817 : {
85818 : // This function traverses the memory pool for only a specific IR node
85819 : // and calls the visit function of the input class execute a traversal
85820 : // similar to the style of the attribute based traversals within ROSE.
85821 : // This traversal will visit ALL nodes of the AST where as the other
85822 : // attribute based traversals visit only the embedded tree within the AST.
85823 :
85824 : // Initialize array to the address of the first element of the STL vector
85825 : // (which is guaranteed to be contiguous storage).
85826 : // SgUpcWaitStatement objectArray [] = *(Memory_Block_List.begin());
85827 5342 : if (SgUpcWaitStatement::pools.empty() == false)
85828 : {
85829 : // Generate an array of memory pools
85830 0 : SgUpcWaitStatement** objectArray = (SgUpcWaitStatement**) &(SgUpcWaitStatement::pools[0]);
85831 :
85832 : // Build a local variable for better performance
85833 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
85834 : #if 0
85835 : // Iterate over the memory pools
85836 : for (unsigned int i=0; i < SgUpcWaitStatement::pools.size(); i++)
85837 : {
85838 : // objectArray[i] is a single memory pool
85839 : for (int j=0; j < SgUpcWaitStatement::pool_size; j++)
85840 : {
85841 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
85842 : {
85843 : traversal.visit(&(objectArray[i][j]));
85844 : }
85845 : }
85846 : }
85847 : #else
85848 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
85849 : // compute the list first and then call the visit function on each list element.
85850 :
85851 : // printf ("Inside of SgUpcWaitStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
85852 :
85853 0 : std::vector<SgUpcWaitStatement*> nodeList;
85854 :
85855 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
85856 0 : for (unsigned int i=0; i < SgUpcWaitStatement::pools.size(); i++)
85857 : {
85858 : // objectArray[i] is a single memory pool
85859 0 : for (unsigned j=0; j < SgUpcWaitStatement::pool_size; j++)
85860 : {
85861 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
85862 : {
85863 0 : nodeList.push_back(&(objectArray[i][j]));
85864 : }
85865 : }
85866 : }
85867 :
85868 : // Iterate over the saved list
85869 0 : size_t nodeListSize = nodeList.size();
85870 0 : for (size_t i=0; i < nodeListSize; i++)
85871 : {
85872 0 : ROSE_ASSERT(nodeList[i] != NULL);
85873 : #if 0
85874 : traversal.visit(nodeList[i]);
85875 : #else
85876 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
85877 : {
85878 0 : traversal.visit(nodeList[i]);
85879 : }
85880 : #endif
85881 : }
85882 : #endif
85883 : }
85884 :
85885 : // This should not be required since all previously static data members are
85886 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
85887 :
85888 5342 : }
85889 :
85890 :
85891 : void
85892 194 : SgUpcWaitStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
85893 : {
85894 : // This function traverses the memory pool for an IR node and
85895 : // calls the function to execute the visitor object.
85896 :
85897 : // Initialize array to the address of the first element of the STL vector
85898 : // (which is guarenteed to be contiguous storage).
85899 : // SgUpcWaitStatement objectArray [] = *(Memory_Block_List.begin());
85900 194 : if (SgUpcWaitStatement::pools.empty() == false)
85901 : {
85902 : // Generate an array of memory pools
85903 0 : SgUpcWaitStatement** objectArray = (SgUpcWaitStatement**) &(SgUpcWaitStatement::pools[0]);
85904 :
85905 : // Build a local variable for better performance
85906 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
85907 :
85908 : // Iterate over the memory pools
85909 0 : for (unsigned int i=0; i < SgUpcWaitStatement::pools.size(); i++)
85910 : {
85911 : // objectArray[i] is a single memory pool
85912 0 : for (unsigned j=0; j < SgUpcWaitStatement::pool_size; j++)
85913 : {
85914 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
85915 : {
85916 : // printf ("Found a valid SgUpcWaitStatement object in the memory pool %d at position %d \n",i,j);
85917 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
85918 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
85919 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
85920 : }
85921 : else
85922 : {
85923 : // printf ("Found a INVALID SgUpcWaitStatement object in the memory pool \n");
85924 : }
85925 : }
85926 : }
85927 : }
85928 :
85929 : // This should not be required since all previously static data members are
85930 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
85931 :
85932 194 : }
85933 :
85934 : void
85935 0 : SgUpcWaitStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
85936 : {
85937 : // This function visits only a single IR node of the memory pool.
85938 : // it is typically called once for each type of IR node within
85939 : // the automatically generated function: traverseRepresentativeNodes().
85940 :
85941 : // Initialize array to the address of the first element of the STL vector
85942 : // (which is guarenteed to be contiguous storage).
85943 : // SgUpcWaitStatement objectArray [] = *(Memory_Block_List.begin());
85944 0 : if (SgUpcWaitStatement::pools.empty() == false)
85945 : {
85946 : // Generate an array of memory pools
85947 0 : SgUpcWaitStatement** objectArray = (SgUpcWaitStatement**) &(SgUpcWaitStatement::pools[0]);
85948 :
85949 : // Build a local variable for better performance
85950 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
85951 :
85952 : // Iterate over the memory pools
85953 0 : bool done = false;
85954 0 : unsigned i=0;
85955 :
85956 : // find the first valid IR node, call visit function, and then leave
85957 0 : while ( done == false && i < SgUpcWaitStatement::pools.size() )
85958 : {
85959 : // objectArray[i] is a single memory pool
85960 : unsigned j=0;
85961 0 : while (done == false && j < SgUpcWaitStatement::pool_size)
85962 : {
85963 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
85964 : {
85965 0 : traversal.visit(&(objectArray[i][j]));
85966 0 : done = true;
85967 : }
85968 0 : j++;
85969 : }
85970 0 : i++;
85971 : }
85972 :
85973 : #if 0
85974 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
85975 : if (done == false)
85976 : {
85977 : printf ("No representative for SgUpcWaitStatement found in memory pools \n");
85978 : }
85979 : #endif
85980 : }
85981 0 : }
85982 :
85983 :
85984 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
85985 : // using values that overflow signed values of int.
85986 : size_t
85987 4 : SgUpcWaitStatement::numberOfNodes()
85988 : {
85989 : // This function traverses the memory pool for an IR node and
85990 : // counts the number of IR nodes of a particular Sage III IR
85991 : // nodes type.
85992 :
85993 4 : size_t count = 0;
85994 4 : if (SgUpcWaitStatement::pools.empty() == false)
85995 : {
85996 : // Generate an array of memory pools (this is actually a STL vector,
85997 : // but it is contiguious, so OK to treat this way).
85998 0 : SgUpcWaitStatement** objectArray = (SgUpcWaitStatement**) &(SgUpcWaitStatement::pools[0]);
85999 :
86000 : // Build a local variable for better performance (make it a loop invariant variable).
86001 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
86002 :
86003 : // Iterate over all of the memory pools for this IR node.
86004 0 : for (unsigned int i=0; i < SgUpcWaitStatement::pools.size(); i++)
86005 : {
86006 : // objectArray[i] is a single memory pool, iterate over all the
86007 : // IR nodes and only count those that are valid IR nodes used in
86008 : // the AST (i.e. allocated IR nodes).
86009 0 : for (unsigned j=0; j < SgUpcWaitStatement::pool_size; j++)
86010 : {
86011 : // This is indexing the STL vector of C/C++ style arrays as a doubly
86012 : // indexed array access. It is OK since we have leveraged the semantics
86013 : // of STL vector memory as contigous and cast the memory as an array
86014 : // of arrays to use the 2D array indexing. Hope this is not confusing,
86015 : // but it s very fast as an implementation.
86016 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
86017 : {
86018 0 : count++;
86019 : }
86020 : }
86021 : }
86022 : }
86023 :
86024 :
86025 :
86026 4 : return count;
86027 : }
86028 :
86029 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
86030 : // using values that overflow signed values of int.
86031 : size_t
86032 0 : SgUpcWaitStatement::memoryUsage()
86033 : {
86034 : // This function is required because we need the class name as a type when we call sizeof
86035 : // There might be another way to implement this if we have a traversal that only called a
86036 : // representative object (one call for each type of Sage IIIIR node).
86037 0 : size_t memory = numberOfNodes() * sizeof(SgUpcWaitStatement);
86038 :
86039 0 : return memory;
86040 : }
86041 :
86042 : /* #line 86043 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
86043 :
86044 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
86045 : void
86046 5342 : SgUpcBarrierStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
86047 : {
86048 : // This function traverses the memory pool for only a specific IR node
86049 : // and calls the visit function of the input class execute a traversal
86050 : // similar to the style of the attribute based traversals within ROSE.
86051 : // This traversal will visit ALL nodes of the AST where as the other
86052 : // attribute based traversals visit only the embedded tree within the AST.
86053 :
86054 : // Initialize array to the address of the first element of the STL vector
86055 : // (which is guaranteed to be contiguous storage).
86056 : // SgUpcBarrierStatement objectArray [] = *(Memory_Block_List.begin());
86057 5342 : if (SgUpcBarrierStatement::pools.empty() == false)
86058 : {
86059 : // Generate an array of memory pools
86060 0 : SgUpcBarrierStatement** objectArray = (SgUpcBarrierStatement**) &(SgUpcBarrierStatement::pools[0]);
86061 :
86062 : // Build a local variable for better performance
86063 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
86064 : #if 0
86065 : // Iterate over the memory pools
86066 : for (unsigned int i=0; i < SgUpcBarrierStatement::pools.size(); i++)
86067 : {
86068 : // objectArray[i] is a single memory pool
86069 : for (int j=0; j < SgUpcBarrierStatement::pool_size; j++)
86070 : {
86071 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
86072 : {
86073 : traversal.visit(&(objectArray[i][j]));
86074 : }
86075 : }
86076 : }
86077 : #else
86078 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
86079 : // compute the list first and then call the visit function on each list element.
86080 :
86081 : // printf ("Inside of SgUpcBarrierStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
86082 :
86083 0 : std::vector<SgUpcBarrierStatement*> nodeList;
86084 :
86085 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
86086 0 : for (unsigned int i=0; i < SgUpcBarrierStatement::pools.size(); i++)
86087 : {
86088 : // objectArray[i] is a single memory pool
86089 0 : for (unsigned j=0; j < SgUpcBarrierStatement::pool_size; j++)
86090 : {
86091 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
86092 : {
86093 0 : nodeList.push_back(&(objectArray[i][j]));
86094 : }
86095 : }
86096 : }
86097 :
86098 : // Iterate over the saved list
86099 0 : size_t nodeListSize = nodeList.size();
86100 0 : for (size_t i=0; i < nodeListSize; i++)
86101 : {
86102 0 : ROSE_ASSERT(nodeList[i] != NULL);
86103 : #if 0
86104 : traversal.visit(nodeList[i]);
86105 : #else
86106 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
86107 : {
86108 0 : traversal.visit(nodeList[i]);
86109 : }
86110 : #endif
86111 : }
86112 : #endif
86113 : }
86114 :
86115 : // This should not be required since all previously static data members are
86116 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
86117 :
86118 5342 : }
86119 :
86120 :
86121 : void
86122 194 : SgUpcBarrierStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
86123 : {
86124 : // This function traverses the memory pool for an IR node and
86125 : // calls the function to execute the visitor object.
86126 :
86127 : // Initialize array to the address of the first element of the STL vector
86128 : // (which is guarenteed to be contiguous storage).
86129 : // SgUpcBarrierStatement objectArray [] = *(Memory_Block_List.begin());
86130 194 : if (SgUpcBarrierStatement::pools.empty() == false)
86131 : {
86132 : // Generate an array of memory pools
86133 0 : SgUpcBarrierStatement** objectArray = (SgUpcBarrierStatement**) &(SgUpcBarrierStatement::pools[0]);
86134 :
86135 : // Build a local variable for better performance
86136 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
86137 :
86138 : // Iterate over the memory pools
86139 0 : for (unsigned int i=0; i < SgUpcBarrierStatement::pools.size(); i++)
86140 : {
86141 : // objectArray[i] is a single memory pool
86142 0 : for (unsigned j=0; j < SgUpcBarrierStatement::pool_size; j++)
86143 : {
86144 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
86145 : {
86146 : // printf ("Found a valid SgUpcBarrierStatement object in the memory pool %d at position %d \n",i,j);
86147 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
86148 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
86149 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
86150 : }
86151 : else
86152 : {
86153 : // printf ("Found a INVALID SgUpcBarrierStatement object in the memory pool \n");
86154 : }
86155 : }
86156 : }
86157 : }
86158 :
86159 : // This should not be required since all previously static data members are
86160 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
86161 :
86162 194 : }
86163 :
86164 : void
86165 0 : SgUpcBarrierStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
86166 : {
86167 : // This function visits only a single IR node of the memory pool.
86168 : // it is typically called once for each type of IR node within
86169 : // the automatically generated function: traverseRepresentativeNodes().
86170 :
86171 : // Initialize array to the address of the first element of the STL vector
86172 : // (which is guarenteed to be contiguous storage).
86173 : // SgUpcBarrierStatement objectArray [] = *(Memory_Block_List.begin());
86174 0 : if (SgUpcBarrierStatement::pools.empty() == false)
86175 : {
86176 : // Generate an array of memory pools
86177 0 : SgUpcBarrierStatement** objectArray = (SgUpcBarrierStatement**) &(SgUpcBarrierStatement::pools[0]);
86178 :
86179 : // Build a local variable for better performance
86180 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
86181 :
86182 : // Iterate over the memory pools
86183 0 : bool done = false;
86184 0 : unsigned i=0;
86185 :
86186 : // find the first valid IR node, call visit function, and then leave
86187 0 : while ( done == false && i < SgUpcBarrierStatement::pools.size() )
86188 : {
86189 : // objectArray[i] is a single memory pool
86190 : unsigned j=0;
86191 0 : while (done == false && j < SgUpcBarrierStatement::pool_size)
86192 : {
86193 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
86194 : {
86195 0 : traversal.visit(&(objectArray[i][j]));
86196 0 : done = true;
86197 : }
86198 0 : j++;
86199 : }
86200 0 : i++;
86201 : }
86202 :
86203 : #if 0
86204 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
86205 : if (done == false)
86206 : {
86207 : printf ("No representative for SgUpcBarrierStatement found in memory pools \n");
86208 : }
86209 : #endif
86210 : }
86211 0 : }
86212 :
86213 :
86214 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
86215 : // using values that overflow signed values of int.
86216 : size_t
86217 4 : SgUpcBarrierStatement::numberOfNodes()
86218 : {
86219 : // This function traverses the memory pool for an IR node and
86220 : // counts the number of IR nodes of a particular Sage III IR
86221 : // nodes type.
86222 :
86223 4 : size_t count = 0;
86224 4 : if (SgUpcBarrierStatement::pools.empty() == false)
86225 : {
86226 : // Generate an array of memory pools (this is actually a STL vector,
86227 : // but it is contiguious, so OK to treat this way).
86228 0 : SgUpcBarrierStatement** objectArray = (SgUpcBarrierStatement**) &(SgUpcBarrierStatement::pools[0]);
86229 :
86230 : // Build a local variable for better performance (make it a loop invariant variable).
86231 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
86232 :
86233 : // Iterate over all of the memory pools for this IR node.
86234 0 : for (unsigned int i=0; i < SgUpcBarrierStatement::pools.size(); i++)
86235 : {
86236 : // objectArray[i] is a single memory pool, iterate over all the
86237 : // IR nodes and only count those that are valid IR nodes used in
86238 : // the AST (i.e. allocated IR nodes).
86239 0 : for (unsigned j=0; j < SgUpcBarrierStatement::pool_size; j++)
86240 : {
86241 : // This is indexing the STL vector of C/C++ style arrays as a doubly
86242 : // indexed array access. It is OK since we have leveraged the semantics
86243 : // of STL vector memory as contigous and cast the memory as an array
86244 : // of arrays to use the 2D array indexing. Hope this is not confusing,
86245 : // but it s very fast as an implementation.
86246 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
86247 : {
86248 0 : count++;
86249 : }
86250 : }
86251 : }
86252 : }
86253 :
86254 :
86255 :
86256 4 : return count;
86257 : }
86258 :
86259 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
86260 : // using values that overflow signed values of int.
86261 : size_t
86262 0 : SgUpcBarrierStatement::memoryUsage()
86263 : {
86264 : // This function is required because we need the class name as a type when we call sizeof
86265 : // There might be another way to implement this if we have a traversal that only called a
86266 : // representative object (one call for each type of Sage IIIIR node).
86267 0 : size_t memory = numberOfNodes() * sizeof(SgUpcBarrierStatement);
86268 :
86269 0 : return memory;
86270 : }
86271 :
86272 : /* #line 86273 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
86273 :
86274 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
86275 : void
86276 5342 : SgUpcFenceStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
86277 : {
86278 : // This function traverses the memory pool for only a specific IR node
86279 : // and calls the visit function of the input class execute a traversal
86280 : // similar to the style of the attribute based traversals within ROSE.
86281 : // This traversal will visit ALL nodes of the AST where as the other
86282 : // attribute based traversals visit only the embedded tree within the AST.
86283 :
86284 : // Initialize array to the address of the first element of the STL vector
86285 : // (which is guaranteed to be contiguous storage).
86286 : // SgUpcFenceStatement objectArray [] = *(Memory_Block_List.begin());
86287 5342 : if (SgUpcFenceStatement::pools.empty() == false)
86288 : {
86289 : // Generate an array of memory pools
86290 0 : SgUpcFenceStatement** objectArray = (SgUpcFenceStatement**) &(SgUpcFenceStatement::pools[0]);
86291 :
86292 : // Build a local variable for better performance
86293 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
86294 : #if 0
86295 : // Iterate over the memory pools
86296 : for (unsigned int i=0; i < SgUpcFenceStatement::pools.size(); i++)
86297 : {
86298 : // objectArray[i] is a single memory pool
86299 : for (int j=0; j < SgUpcFenceStatement::pool_size; j++)
86300 : {
86301 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
86302 : {
86303 : traversal.visit(&(objectArray[i][j]));
86304 : }
86305 : }
86306 : }
86307 : #else
86308 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
86309 : // compute the list first and then call the visit function on each list element.
86310 :
86311 : // printf ("Inside of SgUpcFenceStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
86312 :
86313 0 : std::vector<SgUpcFenceStatement*> nodeList;
86314 :
86315 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
86316 0 : for (unsigned int i=0; i < SgUpcFenceStatement::pools.size(); i++)
86317 : {
86318 : // objectArray[i] is a single memory pool
86319 0 : for (unsigned j=0; j < SgUpcFenceStatement::pool_size; j++)
86320 : {
86321 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
86322 : {
86323 0 : nodeList.push_back(&(objectArray[i][j]));
86324 : }
86325 : }
86326 : }
86327 :
86328 : // Iterate over the saved list
86329 0 : size_t nodeListSize = nodeList.size();
86330 0 : for (size_t i=0; i < nodeListSize; i++)
86331 : {
86332 0 : ROSE_ASSERT(nodeList[i] != NULL);
86333 : #if 0
86334 : traversal.visit(nodeList[i]);
86335 : #else
86336 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
86337 : {
86338 0 : traversal.visit(nodeList[i]);
86339 : }
86340 : #endif
86341 : }
86342 : #endif
86343 : }
86344 :
86345 : // This should not be required since all previously static data members are
86346 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
86347 :
86348 5342 : }
86349 :
86350 :
86351 : void
86352 194 : SgUpcFenceStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
86353 : {
86354 : // This function traverses the memory pool for an IR node and
86355 : // calls the function to execute the visitor object.
86356 :
86357 : // Initialize array to the address of the first element of the STL vector
86358 : // (which is guarenteed to be contiguous storage).
86359 : // SgUpcFenceStatement objectArray [] = *(Memory_Block_List.begin());
86360 194 : if (SgUpcFenceStatement::pools.empty() == false)
86361 : {
86362 : // Generate an array of memory pools
86363 0 : SgUpcFenceStatement** objectArray = (SgUpcFenceStatement**) &(SgUpcFenceStatement::pools[0]);
86364 :
86365 : // Build a local variable for better performance
86366 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
86367 :
86368 : // Iterate over the memory pools
86369 0 : for (unsigned int i=0; i < SgUpcFenceStatement::pools.size(); i++)
86370 : {
86371 : // objectArray[i] is a single memory pool
86372 0 : for (unsigned j=0; j < SgUpcFenceStatement::pool_size; j++)
86373 : {
86374 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
86375 : {
86376 : // printf ("Found a valid SgUpcFenceStatement object in the memory pool %d at position %d \n",i,j);
86377 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
86378 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
86379 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
86380 : }
86381 : else
86382 : {
86383 : // printf ("Found a INVALID SgUpcFenceStatement object in the memory pool \n");
86384 : }
86385 : }
86386 : }
86387 : }
86388 :
86389 : // This should not be required since all previously static data members are
86390 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
86391 :
86392 194 : }
86393 :
86394 : void
86395 0 : SgUpcFenceStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
86396 : {
86397 : // This function visits only a single IR node of the memory pool.
86398 : // it is typically called once for each type of IR node within
86399 : // the automatically generated function: traverseRepresentativeNodes().
86400 :
86401 : // Initialize array to the address of the first element of the STL vector
86402 : // (which is guarenteed to be contiguous storage).
86403 : // SgUpcFenceStatement objectArray [] = *(Memory_Block_List.begin());
86404 0 : if (SgUpcFenceStatement::pools.empty() == false)
86405 : {
86406 : // Generate an array of memory pools
86407 0 : SgUpcFenceStatement** objectArray = (SgUpcFenceStatement**) &(SgUpcFenceStatement::pools[0]);
86408 :
86409 : // Build a local variable for better performance
86410 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
86411 :
86412 : // Iterate over the memory pools
86413 0 : bool done = false;
86414 0 : unsigned i=0;
86415 :
86416 : // find the first valid IR node, call visit function, and then leave
86417 0 : while ( done == false && i < SgUpcFenceStatement::pools.size() )
86418 : {
86419 : // objectArray[i] is a single memory pool
86420 : unsigned j=0;
86421 0 : while (done == false && j < SgUpcFenceStatement::pool_size)
86422 : {
86423 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
86424 : {
86425 0 : traversal.visit(&(objectArray[i][j]));
86426 0 : done = true;
86427 : }
86428 0 : j++;
86429 : }
86430 0 : i++;
86431 : }
86432 :
86433 : #if 0
86434 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
86435 : if (done == false)
86436 : {
86437 : printf ("No representative for SgUpcFenceStatement found in memory pools \n");
86438 : }
86439 : #endif
86440 : }
86441 0 : }
86442 :
86443 :
86444 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
86445 : // using values that overflow signed values of int.
86446 : size_t
86447 4 : SgUpcFenceStatement::numberOfNodes()
86448 : {
86449 : // This function traverses the memory pool for an IR node and
86450 : // counts the number of IR nodes of a particular Sage III IR
86451 : // nodes type.
86452 :
86453 4 : size_t count = 0;
86454 4 : if (SgUpcFenceStatement::pools.empty() == false)
86455 : {
86456 : // Generate an array of memory pools (this is actually a STL vector,
86457 : // but it is contiguious, so OK to treat this way).
86458 0 : SgUpcFenceStatement** objectArray = (SgUpcFenceStatement**) &(SgUpcFenceStatement::pools[0]);
86459 :
86460 : // Build a local variable for better performance (make it a loop invariant variable).
86461 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
86462 :
86463 : // Iterate over all of the memory pools for this IR node.
86464 0 : for (unsigned int i=0; i < SgUpcFenceStatement::pools.size(); i++)
86465 : {
86466 : // objectArray[i] is a single memory pool, iterate over all the
86467 : // IR nodes and only count those that are valid IR nodes used in
86468 : // the AST (i.e. allocated IR nodes).
86469 0 : for (unsigned j=0; j < SgUpcFenceStatement::pool_size; j++)
86470 : {
86471 : // This is indexing the STL vector of C/C++ style arrays as a doubly
86472 : // indexed array access. It is OK since we have leveraged the semantics
86473 : // of STL vector memory as contigous and cast the memory as an array
86474 : // of arrays to use the 2D array indexing. Hope this is not confusing,
86475 : // but it s very fast as an implementation.
86476 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
86477 : {
86478 0 : count++;
86479 : }
86480 : }
86481 : }
86482 : }
86483 :
86484 :
86485 :
86486 4 : return count;
86487 : }
86488 :
86489 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
86490 : // using values that overflow signed values of int.
86491 : size_t
86492 0 : SgUpcFenceStatement::memoryUsage()
86493 : {
86494 : // This function is required because we need the class name as a type when we call sizeof
86495 : // There might be another way to implement this if we have a traversal that only called a
86496 : // representative object (one call for each type of Sage IIIIR node).
86497 0 : size_t memory = numberOfNodes() * sizeof(SgUpcFenceStatement);
86498 :
86499 0 : return memory;
86500 : }
86501 :
86502 : /* #line 86503 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
86503 :
86504 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
86505 : void
86506 5342 : SgUpirBaseStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
86507 : {
86508 : // This function traverses the memory pool for only a specific IR node
86509 : // and calls the visit function of the input class execute a traversal
86510 : // similar to the style of the attribute based traversals within ROSE.
86511 : // This traversal will visit ALL nodes of the AST where as the other
86512 : // attribute based traversals visit only the embedded tree within the AST.
86513 :
86514 : // Initialize array to the address of the first element of the STL vector
86515 : // (which is guaranteed to be contiguous storage).
86516 : // SgUpirBaseStatement objectArray [] = *(Memory_Block_List.begin());
86517 5342 : if (SgUpirBaseStatement::pools.empty() == false)
86518 : {
86519 : // Generate an array of memory pools
86520 0 : SgUpirBaseStatement** objectArray = (SgUpirBaseStatement**) &(SgUpirBaseStatement::pools[0]);
86521 :
86522 : // Build a local variable for better performance
86523 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
86524 : #if 0
86525 : // Iterate over the memory pools
86526 : for (unsigned int i=0; i < SgUpirBaseStatement::pools.size(); i++)
86527 : {
86528 : // objectArray[i] is a single memory pool
86529 : for (int j=0; j < SgUpirBaseStatement::pool_size; j++)
86530 : {
86531 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
86532 : {
86533 : traversal.visit(&(objectArray[i][j]));
86534 : }
86535 : }
86536 : }
86537 : #else
86538 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
86539 : // compute the list first and then call the visit function on each list element.
86540 :
86541 : // printf ("Inside of SgUpirBaseStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
86542 :
86543 0 : std::vector<SgUpirBaseStatement*> nodeList;
86544 :
86545 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
86546 0 : for (unsigned int i=0; i < SgUpirBaseStatement::pools.size(); i++)
86547 : {
86548 : // objectArray[i] is a single memory pool
86549 0 : for (unsigned j=0; j < SgUpirBaseStatement::pool_size; j++)
86550 : {
86551 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
86552 : {
86553 0 : nodeList.push_back(&(objectArray[i][j]));
86554 : }
86555 : }
86556 : }
86557 :
86558 : // Iterate over the saved list
86559 0 : size_t nodeListSize = nodeList.size();
86560 0 : for (size_t i=0; i < nodeListSize; i++)
86561 : {
86562 0 : ROSE_ASSERT(nodeList[i] != NULL);
86563 : #if 0
86564 : traversal.visit(nodeList[i]);
86565 : #else
86566 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
86567 : {
86568 0 : traversal.visit(nodeList[i]);
86569 : }
86570 : #endif
86571 : }
86572 : #endif
86573 : }
86574 :
86575 : // This should not be required since all previously static data members are
86576 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
86577 :
86578 5342 : }
86579 :
86580 :
86581 : void
86582 194 : SgUpirBaseStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
86583 : {
86584 : // This function traverses the memory pool for an IR node and
86585 : // calls the function to execute the visitor object.
86586 :
86587 : // Initialize array to the address of the first element of the STL vector
86588 : // (which is guarenteed to be contiguous storage).
86589 : // SgUpirBaseStatement objectArray [] = *(Memory_Block_List.begin());
86590 194 : if (SgUpirBaseStatement::pools.empty() == false)
86591 : {
86592 : // Generate an array of memory pools
86593 0 : SgUpirBaseStatement** objectArray = (SgUpirBaseStatement**) &(SgUpirBaseStatement::pools[0]);
86594 :
86595 : // Build a local variable for better performance
86596 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
86597 :
86598 : // Iterate over the memory pools
86599 0 : for (unsigned int i=0; i < SgUpirBaseStatement::pools.size(); i++)
86600 : {
86601 : // objectArray[i] is a single memory pool
86602 0 : for (unsigned j=0; j < SgUpirBaseStatement::pool_size; j++)
86603 : {
86604 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
86605 : {
86606 : // printf ("Found a valid SgUpirBaseStatement object in the memory pool %d at position %d \n",i,j);
86607 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
86608 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
86609 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
86610 : }
86611 : else
86612 : {
86613 : // printf ("Found a INVALID SgUpirBaseStatement object in the memory pool \n");
86614 : }
86615 : }
86616 : }
86617 : }
86618 :
86619 : // This should not be required since all previously static data members are
86620 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
86621 :
86622 194 : }
86623 :
86624 : void
86625 0 : SgUpirBaseStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
86626 : {
86627 : // This function visits only a single IR node of the memory pool.
86628 : // it is typically called once for each type of IR node within
86629 : // the automatically generated function: traverseRepresentativeNodes().
86630 :
86631 : // Initialize array to the address of the first element of the STL vector
86632 : // (which is guarenteed to be contiguous storage).
86633 : // SgUpirBaseStatement objectArray [] = *(Memory_Block_List.begin());
86634 0 : if (SgUpirBaseStatement::pools.empty() == false)
86635 : {
86636 : // Generate an array of memory pools
86637 0 : SgUpirBaseStatement** objectArray = (SgUpirBaseStatement**) &(SgUpirBaseStatement::pools[0]);
86638 :
86639 : // Build a local variable for better performance
86640 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
86641 :
86642 : // Iterate over the memory pools
86643 0 : bool done = false;
86644 0 : unsigned i=0;
86645 :
86646 : // find the first valid IR node, call visit function, and then leave
86647 0 : while ( done == false && i < SgUpirBaseStatement::pools.size() )
86648 : {
86649 : // objectArray[i] is a single memory pool
86650 : unsigned j=0;
86651 0 : while (done == false && j < SgUpirBaseStatement::pool_size)
86652 : {
86653 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
86654 : {
86655 0 : traversal.visit(&(objectArray[i][j]));
86656 0 : done = true;
86657 : }
86658 0 : j++;
86659 : }
86660 0 : i++;
86661 : }
86662 :
86663 : #if 0
86664 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
86665 : if (done == false)
86666 : {
86667 : printf ("No representative for SgUpirBaseStatement found in memory pools \n");
86668 : }
86669 : #endif
86670 : }
86671 0 : }
86672 :
86673 :
86674 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
86675 : // using values that overflow signed values of int.
86676 : size_t
86677 4 : SgUpirBaseStatement::numberOfNodes()
86678 : {
86679 : // This function traverses the memory pool for an IR node and
86680 : // counts the number of IR nodes of a particular Sage III IR
86681 : // nodes type.
86682 :
86683 4 : size_t count = 0;
86684 4 : if (SgUpirBaseStatement::pools.empty() == false)
86685 : {
86686 : // Generate an array of memory pools (this is actually a STL vector,
86687 : // but it is contiguious, so OK to treat this way).
86688 0 : SgUpirBaseStatement** objectArray = (SgUpirBaseStatement**) &(SgUpirBaseStatement::pools[0]);
86689 :
86690 : // Build a local variable for better performance (make it a loop invariant variable).
86691 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
86692 :
86693 : // Iterate over all of the memory pools for this IR node.
86694 0 : for (unsigned int i=0; i < SgUpirBaseStatement::pools.size(); i++)
86695 : {
86696 : // objectArray[i] is a single memory pool, iterate over all the
86697 : // IR nodes and only count those that are valid IR nodes used in
86698 : // the AST (i.e. allocated IR nodes).
86699 0 : for (unsigned j=0; j < SgUpirBaseStatement::pool_size; j++)
86700 : {
86701 : // This is indexing the STL vector of C/C++ style arrays as a doubly
86702 : // indexed array access. It is OK since we have leveraged the semantics
86703 : // of STL vector memory as contigous and cast the memory as an array
86704 : // of arrays to use the 2D array indexing. Hope this is not confusing,
86705 : // but it s very fast as an implementation.
86706 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
86707 : {
86708 0 : count++;
86709 : }
86710 : }
86711 : }
86712 : }
86713 :
86714 :
86715 :
86716 4 : return count;
86717 : }
86718 :
86719 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
86720 : // using values that overflow signed values of int.
86721 : size_t
86722 0 : SgUpirBaseStatement::memoryUsage()
86723 : {
86724 : // This function is required because we need the class name as a type when we call sizeof
86725 : // There might be another way to implement this if we have a traversal that only called a
86726 : // representative object (one call for each type of Sage IIIIR node).
86727 0 : size_t memory = numberOfNodes() * sizeof(SgUpirBaseStatement);
86728 :
86729 0 : return memory;
86730 : }
86731 :
86732 : /* #line 86733 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
86733 :
86734 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
86735 : void
86736 5342 : SgOmpTaskyieldStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
86737 : {
86738 : // This function traverses the memory pool for only a specific IR node
86739 : // and calls the visit function of the input class execute a traversal
86740 : // similar to the style of the attribute based traversals within ROSE.
86741 : // This traversal will visit ALL nodes of the AST where as the other
86742 : // attribute based traversals visit only the embedded tree within the AST.
86743 :
86744 : // Initialize array to the address of the first element of the STL vector
86745 : // (which is guaranteed to be contiguous storage).
86746 : // SgOmpTaskyieldStatement objectArray [] = *(Memory_Block_List.begin());
86747 5342 : if (SgOmpTaskyieldStatement::pools.empty() == false)
86748 : {
86749 : // Generate an array of memory pools
86750 7 : SgOmpTaskyieldStatement** objectArray = (SgOmpTaskyieldStatement**) &(SgOmpTaskyieldStatement::pools[0]);
86751 :
86752 : // Build a local variable for better performance
86753 7 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
86754 : #if 0
86755 : // Iterate over the memory pools
86756 : for (unsigned int i=0; i < SgOmpTaskyieldStatement::pools.size(); i++)
86757 : {
86758 : // objectArray[i] is a single memory pool
86759 : for (int j=0; j < SgOmpTaskyieldStatement::pool_size; j++)
86760 : {
86761 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
86762 : {
86763 : traversal.visit(&(objectArray[i][j]));
86764 : }
86765 : }
86766 : }
86767 : #else
86768 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
86769 : // compute the list first and then call the visit function on each list element.
86770 :
86771 : // printf ("Inside of SgOmpTaskyieldStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
86772 :
86773 14 : std::vector<SgOmpTaskyieldStatement*> nodeList;
86774 :
86775 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
86776 14 : for (unsigned int i=0; i < SgOmpTaskyieldStatement::pools.size(); i++)
86777 : {
86778 : // objectArray[i] is a single memory pool
86779 14007 : for (unsigned j=0; j < SgOmpTaskyieldStatement::pool_size; j++)
86780 : {
86781 14000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
86782 : {
86783 7 : nodeList.push_back(&(objectArray[i][j]));
86784 : }
86785 : }
86786 : }
86787 :
86788 : // Iterate over the saved list
86789 7 : size_t nodeListSize = nodeList.size();
86790 14 : for (size_t i=0; i < nodeListSize; i++)
86791 : {
86792 7 : ROSE_ASSERT(nodeList[i] != NULL);
86793 : #if 0
86794 : traversal.visit(nodeList[i]);
86795 : #else
86796 7 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
86797 : {
86798 7 : traversal.visit(nodeList[i]);
86799 : }
86800 : #endif
86801 : }
86802 : #endif
86803 : }
86804 :
86805 : // This should not be required since all previously static data members are
86806 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
86807 :
86808 5342 : }
86809 :
86810 :
86811 : void
86812 194 : SgOmpTaskyieldStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
86813 : {
86814 : // This function traverses the memory pool for an IR node and
86815 : // calls the function to execute the visitor object.
86816 :
86817 : // Initialize array to the address of the first element of the STL vector
86818 : // (which is guarenteed to be contiguous storage).
86819 : // SgOmpTaskyieldStatement objectArray [] = *(Memory_Block_List.begin());
86820 194 : if (SgOmpTaskyieldStatement::pools.empty() == false)
86821 : {
86822 : // Generate an array of memory pools
86823 0 : SgOmpTaskyieldStatement** objectArray = (SgOmpTaskyieldStatement**) &(SgOmpTaskyieldStatement::pools[0]);
86824 :
86825 : // Build a local variable for better performance
86826 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
86827 :
86828 : // Iterate over the memory pools
86829 0 : for (unsigned int i=0; i < SgOmpTaskyieldStatement::pools.size(); i++)
86830 : {
86831 : // objectArray[i] is a single memory pool
86832 0 : for (unsigned j=0; j < SgOmpTaskyieldStatement::pool_size; j++)
86833 : {
86834 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
86835 : {
86836 : // printf ("Found a valid SgOmpTaskyieldStatement object in the memory pool %d at position %d \n",i,j);
86837 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
86838 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
86839 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
86840 : }
86841 : else
86842 : {
86843 : // printf ("Found a INVALID SgOmpTaskyieldStatement object in the memory pool \n");
86844 : }
86845 : }
86846 : }
86847 : }
86848 :
86849 : // This should not be required since all previously static data members are
86850 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
86851 :
86852 194 : }
86853 :
86854 : void
86855 0 : SgOmpTaskyieldStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
86856 : {
86857 : // This function visits only a single IR node of the memory pool.
86858 : // it is typically called once for each type of IR node within
86859 : // the automatically generated function: traverseRepresentativeNodes().
86860 :
86861 : // Initialize array to the address of the first element of the STL vector
86862 : // (which is guarenteed to be contiguous storage).
86863 : // SgOmpTaskyieldStatement objectArray [] = *(Memory_Block_List.begin());
86864 0 : if (SgOmpTaskyieldStatement::pools.empty() == false)
86865 : {
86866 : // Generate an array of memory pools
86867 0 : SgOmpTaskyieldStatement** objectArray = (SgOmpTaskyieldStatement**) &(SgOmpTaskyieldStatement::pools[0]);
86868 :
86869 : // Build a local variable for better performance
86870 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
86871 :
86872 : // Iterate over the memory pools
86873 0 : bool done = false;
86874 0 : unsigned i=0;
86875 :
86876 : // find the first valid IR node, call visit function, and then leave
86877 0 : while ( done == false && i < SgOmpTaskyieldStatement::pools.size() )
86878 : {
86879 : // objectArray[i] is a single memory pool
86880 : unsigned j=0;
86881 0 : while (done == false && j < SgOmpTaskyieldStatement::pool_size)
86882 : {
86883 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
86884 : {
86885 0 : traversal.visit(&(objectArray[i][j]));
86886 0 : done = true;
86887 : }
86888 0 : j++;
86889 : }
86890 0 : i++;
86891 : }
86892 :
86893 : #if 0
86894 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
86895 : if (done == false)
86896 : {
86897 : printf ("No representative for SgOmpTaskyieldStatement found in memory pools \n");
86898 : }
86899 : #endif
86900 : }
86901 0 : }
86902 :
86903 :
86904 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
86905 : // using values that overflow signed values of int.
86906 : size_t
86907 4 : SgOmpTaskyieldStatement::numberOfNodes()
86908 : {
86909 : // This function traverses the memory pool for an IR node and
86910 : // counts the number of IR nodes of a particular Sage III IR
86911 : // nodes type.
86912 :
86913 4 : size_t count = 0;
86914 4 : if (SgOmpTaskyieldStatement::pools.empty() == false)
86915 : {
86916 : // Generate an array of memory pools (this is actually a STL vector,
86917 : // but it is contiguious, so OK to treat this way).
86918 0 : SgOmpTaskyieldStatement** objectArray = (SgOmpTaskyieldStatement**) &(SgOmpTaskyieldStatement::pools[0]);
86919 :
86920 : // Build a local variable for better performance (make it a loop invariant variable).
86921 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
86922 :
86923 : // Iterate over all of the memory pools for this IR node.
86924 0 : for (unsigned int i=0; i < SgOmpTaskyieldStatement::pools.size(); i++)
86925 : {
86926 : // objectArray[i] is a single memory pool, iterate over all the
86927 : // IR nodes and only count those that are valid IR nodes used in
86928 : // the AST (i.e. allocated IR nodes).
86929 0 : for (unsigned j=0; j < SgOmpTaskyieldStatement::pool_size; j++)
86930 : {
86931 : // This is indexing the STL vector of C/C++ style arrays as a doubly
86932 : // indexed array access. It is OK since we have leveraged the semantics
86933 : // of STL vector memory as contigous and cast the memory as an array
86934 : // of arrays to use the 2D array indexing. Hope this is not confusing,
86935 : // but it s very fast as an implementation.
86936 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
86937 : {
86938 0 : count++;
86939 : }
86940 : }
86941 : }
86942 : }
86943 :
86944 :
86945 :
86946 4 : return count;
86947 : }
86948 :
86949 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
86950 : // using values that overflow signed values of int.
86951 : size_t
86952 0 : SgOmpTaskyieldStatement::memoryUsage()
86953 : {
86954 : // This function is required because we need the class name as a type when we call sizeof
86955 : // There might be another way to implement this if we have a traversal that only called a
86956 : // representative object (one call for each type of Sage IIIIR node).
86957 0 : size_t memory = numberOfNodes() * sizeof(SgOmpTaskyieldStatement);
86958 :
86959 0 : return memory;
86960 : }
86961 :
86962 : /* #line 86963 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
86963 :
86964 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
86965 : void
86966 5342 : SgOmpBarrierStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
86967 : {
86968 : // This function traverses the memory pool for only a specific IR node
86969 : // and calls the visit function of the input class execute a traversal
86970 : // similar to the style of the attribute based traversals within ROSE.
86971 : // This traversal will visit ALL nodes of the AST where as the other
86972 : // attribute based traversals visit only the embedded tree within the AST.
86973 :
86974 : // Initialize array to the address of the first element of the STL vector
86975 : // (which is guaranteed to be contiguous storage).
86976 : // SgOmpBarrierStatement objectArray [] = *(Memory_Block_List.begin());
86977 5342 : if (SgOmpBarrierStatement::pools.empty() == false)
86978 : {
86979 : // Generate an array of memory pools
86980 84 : SgOmpBarrierStatement** objectArray = (SgOmpBarrierStatement**) &(SgOmpBarrierStatement::pools[0]);
86981 :
86982 : // Build a local variable for better performance
86983 84 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
86984 : #if 0
86985 : // Iterate over the memory pools
86986 : for (unsigned int i=0; i < SgOmpBarrierStatement::pools.size(); i++)
86987 : {
86988 : // objectArray[i] is a single memory pool
86989 : for (int j=0; j < SgOmpBarrierStatement::pool_size; j++)
86990 : {
86991 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
86992 : {
86993 : traversal.visit(&(objectArray[i][j]));
86994 : }
86995 : }
86996 : }
86997 : #else
86998 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
86999 : // compute the list first and then call the visit function on each list element.
87000 :
87001 : // printf ("Inside of SgOmpBarrierStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
87002 :
87003 168 : std::vector<SgOmpBarrierStatement*> nodeList;
87004 :
87005 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
87006 168 : for (unsigned int i=0; i < SgOmpBarrierStatement::pools.size(); i++)
87007 : {
87008 : // objectArray[i] is a single memory pool
87009 168084 : for (unsigned j=0; j < SgOmpBarrierStatement::pool_size; j++)
87010 : {
87011 168000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
87012 : {
87013 119 : nodeList.push_back(&(objectArray[i][j]));
87014 : }
87015 : }
87016 : }
87017 :
87018 : // Iterate over the saved list
87019 84 : size_t nodeListSize = nodeList.size();
87020 203 : for (size_t i=0; i < nodeListSize; i++)
87021 : {
87022 119 : ROSE_ASSERT(nodeList[i] != NULL);
87023 : #if 0
87024 : traversal.visit(nodeList[i]);
87025 : #else
87026 119 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
87027 : {
87028 119 : traversal.visit(nodeList[i]);
87029 : }
87030 : #endif
87031 : }
87032 : #endif
87033 : }
87034 :
87035 : // This should not be required since all previously static data members are
87036 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
87037 :
87038 5342 : }
87039 :
87040 :
87041 : void
87042 194 : SgOmpBarrierStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
87043 : {
87044 : // This function traverses the memory pool for an IR node and
87045 : // calls the function to execute the visitor object.
87046 :
87047 : // Initialize array to the address of the first element of the STL vector
87048 : // (which is guarenteed to be contiguous storage).
87049 : // SgOmpBarrierStatement objectArray [] = *(Memory_Block_List.begin());
87050 194 : if (SgOmpBarrierStatement::pools.empty() == false)
87051 : {
87052 : // Generate an array of memory pools
87053 0 : SgOmpBarrierStatement** objectArray = (SgOmpBarrierStatement**) &(SgOmpBarrierStatement::pools[0]);
87054 :
87055 : // Build a local variable for better performance
87056 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
87057 :
87058 : // Iterate over the memory pools
87059 0 : for (unsigned int i=0; i < SgOmpBarrierStatement::pools.size(); i++)
87060 : {
87061 : // objectArray[i] is a single memory pool
87062 0 : for (unsigned j=0; j < SgOmpBarrierStatement::pool_size; j++)
87063 : {
87064 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
87065 : {
87066 : // printf ("Found a valid SgOmpBarrierStatement object in the memory pool %d at position %d \n",i,j);
87067 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
87068 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
87069 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
87070 : }
87071 : else
87072 : {
87073 : // printf ("Found a INVALID SgOmpBarrierStatement object in the memory pool \n");
87074 : }
87075 : }
87076 : }
87077 : }
87078 :
87079 : // This should not be required since all previously static data members are
87080 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
87081 :
87082 194 : }
87083 :
87084 : void
87085 0 : SgOmpBarrierStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
87086 : {
87087 : // This function visits only a single IR node of the memory pool.
87088 : // it is typically called once for each type of IR node within
87089 : // the automatically generated function: traverseRepresentativeNodes().
87090 :
87091 : // Initialize array to the address of the first element of the STL vector
87092 : // (which is guarenteed to be contiguous storage).
87093 : // SgOmpBarrierStatement objectArray [] = *(Memory_Block_List.begin());
87094 0 : if (SgOmpBarrierStatement::pools.empty() == false)
87095 : {
87096 : // Generate an array of memory pools
87097 0 : SgOmpBarrierStatement** objectArray = (SgOmpBarrierStatement**) &(SgOmpBarrierStatement::pools[0]);
87098 :
87099 : // Build a local variable for better performance
87100 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
87101 :
87102 : // Iterate over the memory pools
87103 0 : bool done = false;
87104 0 : unsigned i=0;
87105 :
87106 : // find the first valid IR node, call visit function, and then leave
87107 0 : while ( done == false && i < SgOmpBarrierStatement::pools.size() )
87108 : {
87109 : // objectArray[i] is a single memory pool
87110 : unsigned j=0;
87111 0 : while (done == false && j < SgOmpBarrierStatement::pool_size)
87112 : {
87113 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
87114 : {
87115 0 : traversal.visit(&(objectArray[i][j]));
87116 0 : done = true;
87117 : }
87118 0 : j++;
87119 : }
87120 0 : i++;
87121 : }
87122 :
87123 : #if 0
87124 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
87125 : if (done == false)
87126 : {
87127 : printf ("No representative for SgOmpBarrierStatement found in memory pools \n");
87128 : }
87129 : #endif
87130 : }
87131 0 : }
87132 :
87133 :
87134 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
87135 : // using values that overflow signed values of int.
87136 : size_t
87137 4 : SgOmpBarrierStatement::numberOfNodes()
87138 : {
87139 : // This function traverses the memory pool for an IR node and
87140 : // counts the number of IR nodes of a particular Sage III IR
87141 : // nodes type.
87142 :
87143 4 : size_t count = 0;
87144 4 : if (SgOmpBarrierStatement::pools.empty() == false)
87145 : {
87146 : // Generate an array of memory pools (this is actually a STL vector,
87147 : // but it is contiguious, so OK to treat this way).
87148 0 : SgOmpBarrierStatement** objectArray = (SgOmpBarrierStatement**) &(SgOmpBarrierStatement::pools[0]);
87149 :
87150 : // Build a local variable for better performance (make it a loop invariant variable).
87151 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
87152 :
87153 : // Iterate over all of the memory pools for this IR node.
87154 0 : for (unsigned int i=0; i < SgOmpBarrierStatement::pools.size(); i++)
87155 : {
87156 : // objectArray[i] is a single memory pool, iterate over all the
87157 : // IR nodes and only count those that are valid IR nodes used in
87158 : // the AST (i.e. allocated IR nodes).
87159 0 : for (unsigned j=0; j < SgOmpBarrierStatement::pool_size; j++)
87160 : {
87161 : // This is indexing the STL vector of C/C++ style arrays as a doubly
87162 : // indexed array access. It is OK since we have leveraged the semantics
87163 : // of STL vector memory as contigous and cast the memory as an array
87164 : // of arrays to use the 2D array indexing. Hope this is not confusing,
87165 : // but it s very fast as an implementation.
87166 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
87167 : {
87168 0 : count++;
87169 : }
87170 : }
87171 : }
87172 : }
87173 :
87174 :
87175 :
87176 4 : return count;
87177 : }
87178 :
87179 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
87180 : // using values that overflow signed values of int.
87181 : size_t
87182 0 : SgOmpBarrierStatement::memoryUsage()
87183 : {
87184 : // This function is required because we need the class name as a type when we call sizeof
87185 : // There might be another way to implement this if we have a traversal that only called a
87186 : // representative object (one call for each type of Sage IIIIR node).
87187 0 : size_t memory = numberOfNodes() * sizeof(SgOmpBarrierStatement);
87188 :
87189 0 : return memory;
87190 : }
87191 :
87192 : /* #line 87193 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
87193 :
87194 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
87195 : void
87196 5342 : SgUpirBodyStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
87197 : {
87198 : // This function traverses the memory pool for only a specific IR node
87199 : // and calls the visit function of the input class execute a traversal
87200 : // similar to the style of the attribute based traversals within ROSE.
87201 : // This traversal will visit ALL nodes of the AST where as the other
87202 : // attribute based traversals visit only the embedded tree within the AST.
87203 :
87204 : // Initialize array to the address of the first element of the STL vector
87205 : // (which is guaranteed to be contiguous storage).
87206 : // SgUpirBodyStatement objectArray [] = *(Memory_Block_List.begin());
87207 5342 : if (SgUpirBodyStatement::pools.empty() == false)
87208 : {
87209 : // Generate an array of memory pools
87210 0 : SgUpirBodyStatement** objectArray = (SgUpirBodyStatement**) &(SgUpirBodyStatement::pools[0]);
87211 :
87212 : // Build a local variable for better performance
87213 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
87214 : #if 0
87215 : // Iterate over the memory pools
87216 : for (unsigned int i=0; i < SgUpirBodyStatement::pools.size(); i++)
87217 : {
87218 : // objectArray[i] is a single memory pool
87219 : for (int j=0; j < SgUpirBodyStatement::pool_size; j++)
87220 : {
87221 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
87222 : {
87223 : traversal.visit(&(objectArray[i][j]));
87224 : }
87225 : }
87226 : }
87227 : #else
87228 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
87229 : // compute the list first and then call the visit function on each list element.
87230 :
87231 : // printf ("Inside of SgUpirBodyStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
87232 :
87233 0 : std::vector<SgUpirBodyStatement*> nodeList;
87234 :
87235 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
87236 0 : for (unsigned int i=0; i < SgUpirBodyStatement::pools.size(); i++)
87237 : {
87238 : // objectArray[i] is a single memory pool
87239 0 : for (unsigned j=0; j < SgUpirBodyStatement::pool_size; j++)
87240 : {
87241 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
87242 : {
87243 0 : nodeList.push_back(&(objectArray[i][j]));
87244 : }
87245 : }
87246 : }
87247 :
87248 : // Iterate over the saved list
87249 0 : size_t nodeListSize = nodeList.size();
87250 0 : for (size_t i=0; i < nodeListSize; i++)
87251 : {
87252 0 : ROSE_ASSERT(nodeList[i] != NULL);
87253 : #if 0
87254 : traversal.visit(nodeList[i]);
87255 : #else
87256 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
87257 : {
87258 0 : traversal.visit(nodeList[i]);
87259 : }
87260 : #endif
87261 : }
87262 : #endif
87263 : }
87264 :
87265 : // This should not be required since all previously static data members are
87266 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
87267 :
87268 5342 : }
87269 :
87270 :
87271 : void
87272 194 : SgUpirBodyStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
87273 : {
87274 : // This function traverses the memory pool for an IR node and
87275 : // calls the function to execute the visitor object.
87276 :
87277 : // Initialize array to the address of the first element of the STL vector
87278 : // (which is guarenteed to be contiguous storage).
87279 : // SgUpirBodyStatement objectArray [] = *(Memory_Block_List.begin());
87280 194 : if (SgUpirBodyStatement::pools.empty() == false)
87281 : {
87282 : // Generate an array of memory pools
87283 0 : SgUpirBodyStatement** objectArray = (SgUpirBodyStatement**) &(SgUpirBodyStatement::pools[0]);
87284 :
87285 : // Build a local variable for better performance
87286 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
87287 :
87288 : // Iterate over the memory pools
87289 0 : for (unsigned int i=0; i < SgUpirBodyStatement::pools.size(); i++)
87290 : {
87291 : // objectArray[i] is a single memory pool
87292 0 : for (unsigned j=0; j < SgUpirBodyStatement::pool_size; j++)
87293 : {
87294 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
87295 : {
87296 : // printf ("Found a valid SgUpirBodyStatement object in the memory pool %d at position %d \n",i,j);
87297 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
87298 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
87299 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
87300 : }
87301 : else
87302 : {
87303 : // printf ("Found a INVALID SgUpirBodyStatement object in the memory pool \n");
87304 : }
87305 : }
87306 : }
87307 : }
87308 :
87309 : // This should not be required since all previously static data members are
87310 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
87311 :
87312 194 : }
87313 :
87314 : void
87315 0 : SgUpirBodyStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
87316 : {
87317 : // This function visits only a single IR node of the memory pool.
87318 : // it is typically called once for each type of IR node within
87319 : // the automatically generated function: traverseRepresentativeNodes().
87320 :
87321 : // Initialize array to the address of the first element of the STL vector
87322 : // (which is guarenteed to be contiguous storage).
87323 : // SgUpirBodyStatement objectArray [] = *(Memory_Block_List.begin());
87324 0 : if (SgUpirBodyStatement::pools.empty() == false)
87325 : {
87326 : // Generate an array of memory pools
87327 0 : SgUpirBodyStatement** objectArray = (SgUpirBodyStatement**) &(SgUpirBodyStatement::pools[0]);
87328 :
87329 : // Build a local variable for better performance
87330 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
87331 :
87332 : // Iterate over the memory pools
87333 0 : bool done = false;
87334 0 : unsigned i=0;
87335 :
87336 : // find the first valid IR node, call visit function, and then leave
87337 0 : while ( done == false && i < SgUpirBodyStatement::pools.size() )
87338 : {
87339 : // objectArray[i] is a single memory pool
87340 : unsigned j=0;
87341 0 : while (done == false && j < SgUpirBodyStatement::pool_size)
87342 : {
87343 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
87344 : {
87345 0 : traversal.visit(&(objectArray[i][j]));
87346 0 : done = true;
87347 : }
87348 0 : j++;
87349 : }
87350 0 : i++;
87351 : }
87352 :
87353 : #if 0
87354 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
87355 : if (done == false)
87356 : {
87357 : printf ("No representative for SgUpirBodyStatement found in memory pools \n");
87358 : }
87359 : #endif
87360 : }
87361 0 : }
87362 :
87363 :
87364 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
87365 : // using values that overflow signed values of int.
87366 : size_t
87367 4 : SgUpirBodyStatement::numberOfNodes()
87368 : {
87369 : // This function traverses the memory pool for an IR node and
87370 : // counts the number of IR nodes of a particular Sage III IR
87371 : // nodes type.
87372 :
87373 4 : size_t count = 0;
87374 4 : if (SgUpirBodyStatement::pools.empty() == false)
87375 : {
87376 : // Generate an array of memory pools (this is actually a STL vector,
87377 : // but it is contiguious, so OK to treat this way).
87378 0 : SgUpirBodyStatement** objectArray = (SgUpirBodyStatement**) &(SgUpirBodyStatement::pools[0]);
87379 :
87380 : // Build a local variable for better performance (make it a loop invariant variable).
87381 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
87382 :
87383 : // Iterate over all of the memory pools for this IR node.
87384 0 : for (unsigned int i=0; i < SgUpirBodyStatement::pools.size(); i++)
87385 : {
87386 : // objectArray[i] is a single memory pool, iterate over all the
87387 : // IR nodes and only count those that are valid IR nodes used in
87388 : // the AST (i.e. allocated IR nodes).
87389 0 : for (unsigned j=0; j < SgUpirBodyStatement::pool_size; j++)
87390 : {
87391 : // This is indexing the STL vector of C/C++ style arrays as a doubly
87392 : // indexed array access. It is OK since we have leveraged the semantics
87393 : // of STL vector memory as contigous and cast the memory as an array
87394 : // of arrays to use the 2D array indexing. Hope this is not confusing,
87395 : // but it s very fast as an implementation.
87396 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
87397 : {
87398 0 : count++;
87399 : }
87400 : }
87401 : }
87402 : }
87403 :
87404 :
87405 :
87406 4 : return count;
87407 : }
87408 :
87409 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
87410 : // using values that overflow signed values of int.
87411 : size_t
87412 0 : SgUpirBodyStatement::memoryUsage()
87413 : {
87414 : // This function is required because we need the class name as a type when we call sizeof
87415 : // There might be another way to implement this if we have a traversal that only called a
87416 : // representative object (one call for each type of Sage IIIIR node).
87417 0 : size_t memory = numberOfNodes() * sizeof(SgUpirBodyStatement);
87418 :
87419 0 : return memory;
87420 : }
87421 :
87422 : /* #line 87423 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
87423 :
87424 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
87425 : void
87426 5342 : SgOmpMasterStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
87427 : {
87428 : // This function traverses the memory pool for only a specific IR node
87429 : // and calls the visit function of the input class execute a traversal
87430 : // similar to the style of the attribute based traversals within ROSE.
87431 : // This traversal will visit ALL nodes of the AST where as the other
87432 : // attribute based traversals visit only the embedded tree within the AST.
87433 :
87434 : // Initialize array to the address of the first element of the STL vector
87435 : // (which is guaranteed to be contiguous storage).
87436 : // SgOmpMasterStatement objectArray [] = *(Memory_Block_List.begin());
87437 5342 : if (SgOmpMasterStatement::pools.empty() == false)
87438 : {
87439 : // Generate an array of memory pools
87440 56 : SgOmpMasterStatement** objectArray = (SgOmpMasterStatement**) &(SgOmpMasterStatement::pools[0]);
87441 :
87442 : // Build a local variable for better performance
87443 56 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
87444 : #if 0
87445 : // Iterate over the memory pools
87446 : for (unsigned int i=0; i < SgOmpMasterStatement::pools.size(); i++)
87447 : {
87448 : // objectArray[i] is a single memory pool
87449 : for (int j=0; j < SgOmpMasterStatement::pool_size; j++)
87450 : {
87451 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
87452 : {
87453 : traversal.visit(&(objectArray[i][j]));
87454 : }
87455 : }
87456 : }
87457 : #else
87458 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
87459 : // compute the list first and then call the visit function on each list element.
87460 :
87461 : // printf ("Inside of SgOmpMasterStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
87462 :
87463 112 : std::vector<SgOmpMasterStatement*> nodeList;
87464 :
87465 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
87466 112 : for (unsigned int i=0; i < SgOmpMasterStatement::pools.size(); i++)
87467 : {
87468 : // objectArray[i] is a single memory pool
87469 112056 : for (unsigned j=0; j < SgOmpMasterStatement::pool_size; j++)
87470 : {
87471 112000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
87472 : {
87473 98 : nodeList.push_back(&(objectArray[i][j]));
87474 : }
87475 : }
87476 : }
87477 :
87478 : // Iterate over the saved list
87479 56 : size_t nodeListSize = nodeList.size();
87480 154 : for (size_t i=0; i < nodeListSize; i++)
87481 : {
87482 98 : ROSE_ASSERT(nodeList[i] != NULL);
87483 : #if 0
87484 : traversal.visit(nodeList[i]);
87485 : #else
87486 98 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
87487 : {
87488 98 : traversal.visit(nodeList[i]);
87489 : }
87490 : #endif
87491 : }
87492 : #endif
87493 : }
87494 :
87495 : // This should not be required since all previously static data members are
87496 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
87497 :
87498 5342 : }
87499 :
87500 :
87501 : void
87502 194 : SgOmpMasterStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
87503 : {
87504 : // This function traverses the memory pool for an IR node and
87505 : // calls the function to execute the visitor object.
87506 :
87507 : // Initialize array to the address of the first element of the STL vector
87508 : // (which is guarenteed to be contiguous storage).
87509 : // SgOmpMasterStatement objectArray [] = *(Memory_Block_List.begin());
87510 194 : if (SgOmpMasterStatement::pools.empty() == false)
87511 : {
87512 : // Generate an array of memory pools
87513 0 : SgOmpMasterStatement** objectArray = (SgOmpMasterStatement**) &(SgOmpMasterStatement::pools[0]);
87514 :
87515 : // Build a local variable for better performance
87516 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
87517 :
87518 : // Iterate over the memory pools
87519 0 : for (unsigned int i=0; i < SgOmpMasterStatement::pools.size(); i++)
87520 : {
87521 : // objectArray[i] is a single memory pool
87522 0 : for (unsigned j=0; j < SgOmpMasterStatement::pool_size; j++)
87523 : {
87524 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
87525 : {
87526 : // printf ("Found a valid SgOmpMasterStatement object in the memory pool %d at position %d \n",i,j);
87527 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
87528 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
87529 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
87530 : }
87531 : else
87532 : {
87533 : // printf ("Found a INVALID SgOmpMasterStatement object in the memory pool \n");
87534 : }
87535 : }
87536 : }
87537 : }
87538 :
87539 : // This should not be required since all previously static data members are
87540 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
87541 :
87542 194 : }
87543 :
87544 : void
87545 0 : SgOmpMasterStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
87546 : {
87547 : // This function visits only a single IR node of the memory pool.
87548 : // it is typically called once for each type of IR node within
87549 : // the automatically generated function: traverseRepresentativeNodes().
87550 :
87551 : // Initialize array to the address of the first element of the STL vector
87552 : // (which is guarenteed to be contiguous storage).
87553 : // SgOmpMasterStatement objectArray [] = *(Memory_Block_List.begin());
87554 0 : if (SgOmpMasterStatement::pools.empty() == false)
87555 : {
87556 : // Generate an array of memory pools
87557 0 : SgOmpMasterStatement** objectArray = (SgOmpMasterStatement**) &(SgOmpMasterStatement::pools[0]);
87558 :
87559 : // Build a local variable for better performance
87560 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
87561 :
87562 : // Iterate over the memory pools
87563 0 : bool done = false;
87564 0 : unsigned i=0;
87565 :
87566 : // find the first valid IR node, call visit function, and then leave
87567 0 : while ( done == false && i < SgOmpMasterStatement::pools.size() )
87568 : {
87569 : // objectArray[i] is a single memory pool
87570 : unsigned j=0;
87571 0 : while (done == false && j < SgOmpMasterStatement::pool_size)
87572 : {
87573 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
87574 : {
87575 0 : traversal.visit(&(objectArray[i][j]));
87576 0 : done = true;
87577 : }
87578 0 : j++;
87579 : }
87580 0 : i++;
87581 : }
87582 :
87583 : #if 0
87584 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
87585 : if (done == false)
87586 : {
87587 : printf ("No representative for SgOmpMasterStatement found in memory pools \n");
87588 : }
87589 : #endif
87590 : }
87591 0 : }
87592 :
87593 :
87594 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
87595 : // using values that overflow signed values of int.
87596 : size_t
87597 4 : SgOmpMasterStatement::numberOfNodes()
87598 : {
87599 : // This function traverses the memory pool for an IR node and
87600 : // counts the number of IR nodes of a particular Sage III IR
87601 : // nodes type.
87602 :
87603 4 : size_t count = 0;
87604 4 : if (SgOmpMasterStatement::pools.empty() == false)
87605 : {
87606 : // Generate an array of memory pools (this is actually a STL vector,
87607 : // but it is contiguious, so OK to treat this way).
87608 0 : SgOmpMasterStatement** objectArray = (SgOmpMasterStatement**) &(SgOmpMasterStatement::pools[0]);
87609 :
87610 : // Build a local variable for better performance (make it a loop invariant variable).
87611 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
87612 :
87613 : // Iterate over all of the memory pools for this IR node.
87614 0 : for (unsigned int i=0; i < SgOmpMasterStatement::pools.size(); i++)
87615 : {
87616 : // objectArray[i] is a single memory pool, iterate over all the
87617 : // IR nodes and only count those that are valid IR nodes used in
87618 : // the AST (i.e. allocated IR nodes).
87619 0 : for (unsigned j=0; j < SgOmpMasterStatement::pool_size; j++)
87620 : {
87621 : // This is indexing the STL vector of C/C++ style arrays as a doubly
87622 : // indexed array access. It is OK since we have leveraged the semantics
87623 : // of STL vector memory as contigous and cast the memory as an array
87624 : // of arrays to use the 2D array indexing. Hope this is not confusing,
87625 : // but it s very fast as an implementation.
87626 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
87627 : {
87628 0 : count++;
87629 : }
87630 : }
87631 : }
87632 : }
87633 :
87634 :
87635 :
87636 4 : return count;
87637 : }
87638 :
87639 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
87640 : // using values that overflow signed values of int.
87641 : size_t
87642 0 : SgOmpMasterStatement::memoryUsage()
87643 : {
87644 : // This function is required because we need the class name as a type when we call sizeof
87645 : // There might be another way to implement this if we have a traversal that only called a
87646 : // representative object (one call for each type of Sage IIIIR node).
87647 0 : size_t memory = numberOfNodes() * sizeof(SgOmpMasterStatement);
87648 :
87649 0 : return memory;
87650 : }
87651 :
87652 : /* #line 87653 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
87653 :
87654 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
87655 : void
87656 5342 : SgOmpSectionStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
87657 : {
87658 : // This function traverses the memory pool for only a specific IR node
87659 : // and calls the visit function of the input class execute a traversal
87660 : // similar to the style of the attribute based traversals within ROSE.
87661 : // This traversal will visit ALL nodes of the AST where as the other
87662 : // attribute based traversals visit only the embedded tree within the AST.
87663 :
87664 : // Initialize array to the address of the first element of the STL vector
87665 : // (which is guaranteed to be contiguous storage).
87666 : // SgOmpSectionStatement objectArray [] = *(Memory_Block_List.begin());
87667 5342 : if (SgOmpSectionStatement::pools.empty() == false)
87668 : {
87669 : // Generate an array of memory pools
87670 63 : SgOmpSectionStatement** objectArray = (SgOmpSectionStatement**) &(SgOmpSectionStatement::pools[0]);
87671 :
87672 : // Build a local variable for better performance
87673 63 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
87674 : #if 0
87675 : // Iterate over the memory pools
87676 : for (unsigned int i=0; i < SgOmpSectionStatement::pools.size(); i++)
87677 : {
87678 : // objectArray[i] is a single memory pool
87679 : for (int j=0; j < SgOmpSectionStatement::pool_size; j++)
87680 : {
87681 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
87682 : {
87683 : traversal.visit(&(objectArray[i][j]));
87684 : }
87685 : }
87686 : }
87687 : #else
87688 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
87689 : // compute the list first and then call the visit function on each list element.
87690 :
87691 : // printf ("Inside of SgOmpSectionStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
87692 :
87693 126 : std::vector<SgOmpSectionStatement*> nodeList;
87694 :
87695 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
87696 126 : for (unsigned int i=0; i < SgOmpSectionStatement::pools.size(); i++)
87697 : {
87698 : // objectArray[i] is a single memory pool
87699 126063 : for (unsigned j=0; j < SgOmpSectionStatement::pool_size; j++)
87700 : {
87701 126000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
87702 : {
87703 203 : nodeList.push_back(&(objectArray[i][j]));
87704 : }
87705 : }
87706 : }
87707 :
87708 : // Iterate over the saved list
87709 63 : size_t nodeListSize = nodeList.size();
87710 266 : for (size_t i=0; i < nodeListSize; i++)
87711 : {
87712 203 : ROSE_ASSERT(nodeList[i] != NULL);
87713 : #if 0
87714 : traversal.visit(nodeList[i]);
87715 : #else
87716 203 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
87717 : {
87718 203 : traversal.visit(nodeList[i]);
87719 : }
87720 : #endif
87721 : }
87722 : #endif
87723 : }
87724 :
87725 : // This should not be required since all previously static data members are
87726 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
87727 :
87728 5342 : }
87729 :
87730 :
87731 : void
87732 194 : SgOmpSectionStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
87733 : {
87734 : // This function traverses the memory pool for an IR node and
87735 : // calls the function to execute the visitor object.
87736 :
87737 : // Initialize array to the address of the first element of the STL vector
87738 : // (which is guarenteed to be contiguous storage).
87739 : // SgOmpSectionStatement objectArray [] = *(Memory_Block_List.begin());
87740 194 : if (SgOmpSectionStatement::pools.empty() == false)
87741 : {
87742 : // Generate an array of memory pools
87743 0 : SgOmpSectionStatement** objectArray = (SgOmpSectionStatement**) &(SgOmpSectionStatement::pools[0]);
87744 :
87745 : // Build a local variable for better performance
87746 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
87747 :
87748 : // Iterate over the memory pools
87749 0 : for (unsigned int i=0; i < SgOmpSectionStatement::pools.size(); i++)
87750 : {
87751 : // objectArray[i] is a single memory pool
87752 0 : for (unsigned j=0; j < SgOmpSectionStatement::pool_size; j++)
87753 : {
87754 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
87755 : {
87756 : // printf ("Found a valid SgOmpSectionStatement object in the memory pool %d at position %d \n",i,j);
87757 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
87758 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
87759 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
87760 : }
87761 : else
87762 : {
87763 : // printf ("Found a INVALID SgOmpSectionStatement object in the memory pool \n");
87764 : }
87765 : }
87766 : }
87767 : }
87768 :
87769 : // This should not be required since all previously static data members are
87770 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
87771 :
87772 194 : }
87773 :
87774 : void
87775 0 : SgOmpSectionStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
87776 : {
87777 : // This function visits only a single IR node of the memory pool.
87778 : // it is typically called once for each type of IR node within
87779 : // the automatically generated function: traverseRepresentativeNodes().
87780 :
87781 : // Initialize array to the address of the first element of the STL vector
87782 : // (which is guarenteed to be contiguous storage).
87783 : // SgOmpSectionStatement objectArray [] = *(Memory_Block_List.begin());
87784 0 : if (SgOmpSectionStatement::pools.empty() == false)
87785 : {
87786 : // Generate an array of memory pools
87787 0 : SgOmpSectionStatement** objectArray = (SgOmpSectionStatement**) &(SgOmpSectionStatement::pools[0]);
87788 :
87789 : // Build a local variable for better performance
87790 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
87791 :
87792 : // Iterate over the memory pools
87793 0 : bool done = false;
87794 0 : unsigned i=0;
87795 :
87796 : // find the first valid IR node, call visit function, and then leave
87797 0 : while ( done == false && i < SgOmpSectionStatement::pools.size() )
87798 : {
87799 : // objectArray[i] is a single memory pool
87800 : unsigned j=0;
87801 0 : while (done == false && j < SgOmpSectionStatement::pool_size)
87802 : {
87803 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
87804 : {
87805 0 : traversal.visit(&(objectArray[i][j]));
87806 0 : done = true;
87807 : }
87808 0 : j++;
87809 : }
87810 0 : i++;
87811 : }
87812 :
87813 : #if 0
87814 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
87815 : if (done == false)
87816 : {
87817 : printf ("No representative for SgOmpSectionStatement found in memory pools \n");
87818 : }
87819 : #endif
87820 : }
87821 0 : }
87822 :
87823 :
87824 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
87825 : // using values that overflow signed values of int.
87826 : size_t
87827 4 : SgOmpSectionStatement::numberOfNodes()
87828 : {
87829 : // This function traverses the memory pool for an IR node and
87830 : // counts the number of IR nodes of a particular Sage III IR
87831 : // nodes type.
87832 :
87833 4 : size_t count = 0;
87834 4 : if (SgOmpSectionStatement::pools.empty() == false)
87835 : {
87836 : // Generate an array of memory pools (this is actually a STL vector,
87837 : // but it is contiguious, so OK to treat this way).
87838 0 : SgOmpSectionStatement** objectArray = (SgOmpSectionStatement**) &(SgOmpSectionStatement::pools[0]);
87839 :
87840 : // Build a local variable for better performance (make it a loop invariant variable).
87841 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
87842 :
87843 : // Iterate over all of the memory pools for this IR node.
87844 0 : for (unsigned int i=0; i < SgOmpSectionStatement::pools.size(); i++)
87845 : {
87846 : // objectArray[i] is a single memory pool, iterate over all the
87847 : // IR nodes and only count those that are valid IR nodes used in
87848 : // the AST (i.e. allocated IR nodes).
87849 0 : for (unsigned j=0; j < SgOmpSectionStatement::pool_size; j++)
87850 : {
87851 : // This is indexing the STL vector of C/C++ style arrays as a doubly
87852 : // indexed array access. It is OK since we have leveraged the semantics
87853 : // of STL vector memory as contigous and cast the memory as an array
87854 : // of arrays to use the 2D array indexing. Hope this is not confusing,
87855 : // but it s very fast as an implementation.
87856 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
87857 : {
87858 0 : count++;
87859 : }
87860 : }
87861 : }
87862 : }
87863 :
87864 :
87865 :
87866 4 : return count;
87867 : }
87868 :
87869 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
87870 : // using values that overflow signed values of int.
87871 : size_t
87872 0 : SgOmpSectionStatement::memoryUsage()
87873 : {
87874 : // This function is required because we need the class name as a type when we call sizeof
87875 : // There might be another way to implement this if we have a traversal that only called a
87876 : // representative object (one call for each type of Sage IIIIR node).
87877 0 : size_t memory = numberOfNodes() * sizeof(SgOmpSectionStatement);
87878 :
87879 0 : return memory;
87880 : }
87881 :
87882 : /* #line 87883 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
87883 :
87884 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
87885 : void
87886 5342 : SgOmpWorkshareStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
87887 : {
87888 : // This function traverses the memory pool for only a specific IR node
87889 : // and calls the visit function of the input class execute a traversal
87890 : // similar to the style of the attribute based traversals within ROSE.
87891 : // This traversal will visit ALL nodes of the AST where as the other
87892 : // attribute based traversals visit only the embedded tree within the AST.
87893 :
87894 : // Initialize array to the address of the first element of the STL vector
87895 : // (which is guaranteed to be contiguous storage).
87896 : // SgOmpWorkshareStatement objectArray [] = *(Memory_Block_List.begin());
87897 5342 : if (SgOmpWorkshareStatement::pools.empty() == false)
87898 : {
87899 : // Generate an array of memory pools
87900 0 : SgOmpWorkshareStatement** objectArray = (SgOmpWorkshareStatement**) &(SgOmpWorkshareStatement::pools[0]);
87901 :
87902 : // Build a local variable for better performance
87903 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
87904 : #if 0
87905 : // Iterate over the memory pools
87906 : for (unsigned int i=0; i < SgOmpWorkshareStatement::pools.size(); i++)
87907 : {
87908 : // objectArray[i] is a single memory pool
87909 : for (int j=0; j < SgOmpWorkshareStatement::pool_size; j++)
87910 : {
87911 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
87912 : {
87913 : traversal.visit(&(objectArray[i][j]));
87914 : }
87915 : }
87916 : }
87917 : #else
87918 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
87919 : // compute the list first and then call the visit function on each list element.
87920 :
87921 : // printf ("Inside of SgOmpWorkshareStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
87922 :
87923 0 : std::vector<SgOmpWorkshareStatement*> nodeList;
87924 :
87925 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
87926 0 : for (unsigned int i=0; i < SgOmpWorkshareStatement::pools.size(); i++)
87927 : {
87928 : // objectArray[i] is a single memory pool
87929 0 : for (unsigned j=0; j < SgOmpWorkshareStatement::pool_size; j++)
87930 : {
87931 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
87932 : {
87933 0 : nodeList.push_back(&(objectArray[i][j]));
87934 : }
87935 : }
87936 : }
87937 :
87938 : // Iterate over the saved list
87939 0 : size_t nodeListSize = nodeList.size();
87940 0 : for (size_t i=0; i < nodeListSize; i++)
87941 : {
87942 0 : ROSE_ASSERT(nodeList[i] != NULL);
87943 : #if 0
87944 : traversal.visit(nodeList[i]);
87945 : #else
87946 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
87947 : {
87948 0 : traversal.visit(nodeList[i]);
87949 : }
87950 : #endif
87951 : }
87952 : #endif
87953 : }
87954 :
87955 : // This should not be required since all previously static data members are
87956 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
87957 :
87958 5342 : }
87959 :
87960 :
87961 : void
87962 194 : SgOmpWorkshareStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
87963 : {
87964 : // This function traverses the memory pool for an IR node and
87965 : // calls the function to execute the visitor object.
87966 :
87967 : // Initialize array to the address of the first element of the STL vector
87968 : // (which is guarenteed to be contiguous storage).
87969 : // SgOmpWorkshareStatement objectArray [] = *(Memory_Block_List.begin());
87970 194 : if (SgOmpWorkshareStatement::pools.empty() == false)
87971 : {
87972 : // Generate an array of memory pools
87973 0 : SgOmpWorkshareStatement** objectArray = (SgOmpWorkshareStatement**) &(SgOmpWorkshareStatement::pools[0]);
87974 :
87975 : // Build a local variable for better performance
87976 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
87977 :
87978 : // Iterate over the memory pools
87979 0 : for (unsigned int i=0; i < SgOmpWorkshareStatement::pools.size(); i++)
87980 : {
87981 : // objectArray[i] is a single memory pool
87982 0 : for (unsigned j=0; j < SgOmpWorkshareStatement::pool_size; j++)
87983 : {
87984 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
87985 : {
87986 : // printf ("Found a valid SgOmpWorkshareStatement object in the memory pool %d at position %d \n",i,j);
87987 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
87988 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
87989 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
87990 : }
87991 : else
87992 : {
87993 : // printf ("Found a INVALID SgOmpWorkshareStatement object in the memory pool \n");
87994 : }
87995 : }
87996 : }
87997 : }
87998 :
87999 : // This should not be required since all previously static data members are
88000 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
88001 :
88002 194 : }
88003 :
88004 : void
88005 0 : SgOmpWorkshareStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
88006 : {
88007 : // This function visits only a single IR node of the memory pool.
88008 : // it is typically called once for each type of IR node within
88009 : // the automatically generated function: traverseRepresentativeNodes().
88010 :
88011 : // Initialize array to the address of the first element of the STL vector
88012 : // (which is guarenteed to be contiguous storage).
88013 : // SgOmpWorkshareStatement objectArray [] = *(Memory_Block_List.begin());
88014 0 : if (SgOmpWorkshareStatement::pools.empty() == false)
88015 : {
88016 : // Generate an array of memory pools
88017 0 : SgOmpWorkshareStatement** objectArray = (SgOmpWorkshareStatement**) &(SgOmpWorkshareStatement::pools[0]);
88018 :
88019 : // Build a local variable for better performance
88020 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
88021 :
88022 : // Iterate over the memory pools
88023 0 : bool done = false;
88024 0 : unsigned i=0;
88025 :
88026 : // find the first valid IR node, call visit function, and then leave
88027 0 : while ( done == false && i < SgOmpWorkshareStatement::pools.size() )
88028 : {
88029 : // objectArray[i] is a single memory pool
88030 : unsigned j=0;
88031 0 : while (done == false && j < SgOmpWorkshareStatement::pool_size)
88032 : {
88033 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
88034 : {
88035 0 : traversal.visit(&(objectArray[i][j]));
88036 0 : done = true;
88037 : }
88038 0 : j++;
88039 : }
88040 0 : i++;
88041 : }
88042 :
88043 : #if 0
88044 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
88045 : if (done == false)
88046 : {
88047 : printf ("No representative for SgOmpWorkshareStatement found in memory pools \n");
88048 : }
88049 : #endif
88050 : }
88051 0 : }
88052 :
88053 :
88054 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
88055 : // using values that overflow signed values of int.
88056 : size_t
88057 4 : SgOmpWorkshareStatement::numberOfNodes()
88058 : {
88059 : // This function traverses the memory pool for an IR node and
88060 : // counts the number of IR nodes of a particular Sage III IR
88061 : // nodes type.
88062 :
88063 4 : size_t count = 0;
88064 4 : if (SgOmpWorkshareStatement::pools.empty() == false)
88065 : {
88066 : // Generate an array of memory pools (this is actually a STL vector,
88067 : // but it is contiguious, so OK to treat this way).
88068 0 : SgOmpWorkshareStatement** objectArray = (SgOmpWorkshareStatement**) &(SgOmpWorkshareStatement::pools[0]);
88069 :
88070 : // Build a local variable for better performance (make it a loop invariant variable).
88071 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
88072 :
88073 : // Iterate over all of the memory pools for this IR node.
88074 0 : for (unsigned int i=0; i < SgOmpWorkshareStatement::pools.size(); i++)
88075 : {
88076 : // objectArray[i] is a single memory pool, iterate over all the
88077 : // IR nodes and only count those that are valid IR nodes used in
88078 : // the AST (i.e. allocated IR nodes).
88079 0 : for (unsigned j=0; j < SgOmpWorkshareStatement::pool_size; j++)
88080 : {
88081 : // This is indexing the STL vector of C/C++ style arrays as a doubly
88082 : // indexed array access. It is OK since we have leveraged the semantics
88083 : // of STL vector memory as contigous and cast the memory as an array
88084 : // of arrays to use the 2D array indexing. Hope this is not confusing,
88085 : // but it s very fast as an implementation.
88086 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
88087 : {
88088 0 : count++;
88089 : }
88090 : }
88091 : }
88092 : }
88093 :
88094 :
88095 :
88096 4 : return count;
88097 : }
88098 :
88099 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
88100 : // using values that overflow signed values of int.
88101 : size_t
88102 0 : SgOmpWorkshareStatement::memoryUsage()
88103 : {
88104 : // This function is required because we need the class name as a type when we call sizeof
88105 : // There might be another way to implement this if we have a traversal that only called a
88106 : // representative object (one call for each type of Sage IIIIR node).
88107 0 : size_t memory = numberOfNodes() * sizeof(SgOmpWorkshareStatement);
88108 :
88109 0 : return memory;
88110 : }
88111 :
88112 : /* #line 88113 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
88113 :
88114 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
88115 : void
88116 5342 : SgUpirFieldBodyStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
88117 : {
88118 : // This function traverses the memory pool for only a specific IR node
88119 : // and calls the visit function of the input class execute a traversal
88120 : // similar to the style of the attribute based traversals within ROSE.
88121 : // This traversal will visit ALL nodes of the AST where as the other
88122 : // attribute based traversals visit only the embedded tree within the AST.
88123 :
88124 : // Initialize array to the address of the first element of the STL vector
88125 : // (which is guaranteed to be contiguous storage).
88126 : // SgUpirFieldBodyStatement objectArray [] = *(Memory_Block_List.begin());
88127 5342 : if (SgUpirFieldBodyStatement::pools.empty() == false)
88128 : {
88129 : // Generate an array of memory pools
88130 0 : SgUpirFieldBodyStatement** objectArray = (SgUpirFieldBodyStatement**) &(SgUpirFieldBodyStatement::pools[0]);
88131 :
88132 : // Build a local variable for better performance
88133 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
88134 : #if 0
88135 : // Iterate over the memory pools
88136 : for (unsigned int i=0; i < SgUpirFieldBodyStatement::pools.size(); i++)
88137 : {
88138 : // objectArray[i] is a single memory pool
88139 : for (int j=0; j < SgUpirFieldBodyStatement::pool_size; j++)
88140 : {
88141 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
88142 : {
88143 : traversal.visit(&(objectArray[i][j]));
88144 : }
88145 : }
88146 : }
88147 : #else
88148 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
88149 : // compute the list first and then call the visit function on each list element.
88150 :
88151 : // printf ("Inside of SgUpirFieldBodyStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
88152 :
88153 0 : std::vector<SgUpirFieldBodyStatement*> nodeList;
88154 :
88155 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
88156 0 : for (unsigned int i=0; i < SgUpirFieldBodyStatement::pools.size(); i++)
88157 : {
88158 : // objectArray[i] is a single memory pool
88159 0 : for (unsigned j=0; j < SgUpirFieldBodyStatement::pool_size; j++)
88160 : {
88161 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
88162 : {
88163 0 : nodeList.push_back(&(objectArray[i][j]));
88164 : }
88165 : }
88166 : }
88167 :
88168 : // Iterate over the saved list
88169 0 : size_t nodeListSize = nodeList.size();
88170 0 : for (size_t i=0; i < nodeListSize; i++)
88171 : {
88172 0 : ROSE_ASSERT(nodeList[i] != NULL);
88173 : #if 0
88174 : traversal.visit(nodeList[i]);
88175 : #else
88176 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
88177 : {
88178 0 : traversal.visit(nodeList[i]);
88179 : }
88180 : #endif
88181 : }
88182 : #endif
88183 : }
88184 :
88185 : // This should not be required since all previously static data members are
88186 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
88187 :
88188 5342 : }
88189 :
88190 :
88191 : void
88192 194 : SgUpirFieldBodyStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
88193 : {
88194 : // This function traverses the memory pool for an IR node and
88195 : // calls the function to execute the visitor object.
88196 :
88197 : // Initialize array to the address of the first element of the STL vector
88198 : // (which is guarenteed to be contiguous storage).
88199 : // SgUpirFieldBodyStatement objectArray [] = *(Memory_Block_List.begin());
88200 194 : if (SgUpirFieldBodyStatement::pools.empty() == false)
88201 : {
88202 : // Generate an array of memory pools
88203 0 : SgUpirFieldBodyStatement** objectArray = (SgUpirFieldBodyStatement**) &(SgUpirFieldBodyStatement::pools[0]);
88204 :
88205 : // Build a local variable for better performance
88206 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
88207 :
88208 : // Iterate over the memory pools
88209 0 : for (unsigned int i=0; i < SgUpirFieldBodyStatement::pools.size(); i++)
88210 : {
88211 : // objectArray[i] is a single memory pool
88212 0 : for (unsigned j=0; j < SgUpirFieldBodyStatement::pool_size; j++)
88213 : {
88214 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
88215 : {
88216 : // printf ("Found a valid SgUpirFieldBodyStatement object in the memory pool %d at position %d \n",i,j);
88217 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
88218 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
88219 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
88220 : }
88221 : else
88222 : {
88223 : // printf ("Found a INVALID SgUpirFieldBodyStatement object in the memory pool \n");
88224 : }
88225 : }
88226 : }
88227 : }
88228 :
88229 : // This should not be required since all previously static data members are
88230 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
88231 :
88232 194 : }
88233 :
88234 : void
88235 0 : SgUpirFieldBodyStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
88236 : {
88237 : // This function visits only a single IR node of the memory pool.
88238 : // it is typically called once for each type of IR node within
88239 : // the automatically generated function: traverseRepresentativeNodes().
88240 :
88241 : // Initialize array to the address of the first element of the STL vector
88242 : // (which is guarenteed to be contiguous storage).
88243 : // SgUpirFieldBodyStatement objectArray [] = *(Memory_Block_List.begin());
88244 0 : if (SgUpirFieldBodyStatement::pools.empty() == false)
88245 : {
88246 : // Generate an array of memory pools
88247 0 : SgUpirFieldBodyStatement** objectArray = (SgUpirFieldBodyStatement**) &(SgUpirFieldBodyStatement::pools[0]);
88248 :
88249 : // Build a local variable for better performance
88250 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
88251 :
88252 : // Iterate over the memory pools
88253 0 : bool done = false;
88254 0 : unsigned i=0;
88255 :
88256 : // find the first valid IR node, call visit function, and then leave
88257 0 : while ( done == false && i < SgUpirFieldBodyStatement::pools.size() )
88258 : {
88259 : // objectArray[i] is a single memory pool
88260 : unsigned j=0;
88261 0 : while (done == false && j < SgUpirFieldBodyStatement::pool_size)
88262 : {
88263 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
88264 : {
88265 0 : traversal.visit(&(objectArray[i][j]));
88266 0 : done = true;
88267 : }
88268 0 : j++;
88269 : }
88270 0 : i++;
88271 : }
88272 :
88273 : #if 0
88274 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
88275 : if (done == false)
88276 : {
88277 : printf ("No representative for SgUpirFieldBodyStatement found in memory pools \n");
88278 : }
88279 : #endif
88280 : }
88281 0 : }
88282 :
88283 :
88284 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
88285 : // using values that overflow signed values of int.
88286 : size_t
88287 4 : SgUpirFieldBodyStatement::numberOfNodes()
88288 : {
88289 : // This function traverses the memory pool for an IR node and
88290 : // counts the number of IR nodes of a particular Sage III IR
88291 : // nodes type.
88292 :
88293 4 : size_t count = 0;
88294 4 : if (SgUpirFieldBodyStatement::pools.empty() == false)
88295 : {
88296 : // Generate an array of memory pools (this is actually a STL vector,
88297 : // but it is contiguious, so OK to treat this way).
88298 0 : SgUpirFieldBodyStatement** objectArray = (SgUpirFieldBodyStatement**) &(SgUpirFieldBodyStatement::pools[0]);
88299 :
88300 : // Build a local variable for better performance (make it a loop invariant variable).
88301 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
88302 :
88303 : // Iterate over all of the memory pools for this IR node.
88304 0 : for (unsigned int i=0; i < SgUpirFieldBodyStatement::pools.size(); i++)
88305 : {
88306 : // objectArray[i] is a single memory pool, iterate over all the
88307 : // IR nodes and only count those that are valid IR nodes used in
88308 : // the AST (i.e. allocated IR nodes).
88309 0 : for (unsigned j=0; j < SgUpirFieldBodyStatement::pool_size; j++)
88310 : {
88311 : // This is indexing the STL vector of C/C++ style arrays as a doubly
88312 : // indexed array access. It is OK since we have leveraged the semantics
88313 : // of STL vector memory as contigous and cast the memory as an array
88314 : // of arrays to use the 2D array indexing. Hope this is not confusing,
88315 : // but it s very fast as an implementation.
88316 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
88317 : {
88318 0 : count++;
88319 : }
88320 : }
88321 : }
88322 : }
88323 :
88324 :
88325 :
88326 4 : return count;
88327 : }
88328 :
88329 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
88330 : // using values that overflow signed values of int.
88331 : size_t
88332 0 : SgUpirFieldBodyStatement::memoryUsage()
88333 : {
88334 : // This function is required because we need the class name as a type when we call sizeof
88335 : // There might be another way to implement this if we have a traversal that only called a
88336 : // representative object (one call for each type of Sage IIIIR node).
88337 0 : size_t memory = numberOfNodes() * sizeof(SgUpirFieldBodyStatement);
88338 :
88339 0 : return memory;
88340 : }
88341 :
88342 : /* #line 88343 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
88343 :
88344 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
88345 : void
88346 5342 : SgUpirSpmdStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
88347 : {
88348 : // This function traverses the memory pool for only a specific IR node
88349 : // and calls the visit function of the input class execute a traversal
88350 : // similar to the style of the attribute based traversals within ROSE.
88351 : // This traversal will visit ALL nodes of the AST where as the other
88352 : // attribute based traversals visit only the embedded tree within the AST.
88353 :
88354 : // Initialize array to the address of the first element of the STL vector
88355 : // (which is guaranteed to be contiguous storage).
88356 : // SgUpirSpmdStatement objectArray [] = *(Memory_Block_List.begin());
88357 5342 : if (SgUpirSpmdStatement::pools.empty() == false)
88358 : {
88359 : // Generate an array of memory pools
88360 1435 : SgUpirSpmdStatement** objectArray = (SgUpirSpmdStatement**) &(SgUpirSpmdStatement::pools[0]);
88361 :
88362 : // Build a local variable for better performance
88363 1435 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
88364 : #if 0
88365 : // Iterate over the memory pools
88366 : for (unsigned int i=0; i < SgUpirSpmdStatement::pools.size(); i++)
88367 : {
88368 : // objectArray[i] is a single memory pool
88369 : for (int j=0; j < SgUpirSpmdStatement::pool_size; j++)
88370 : {
88371 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
88372 : {
88373 : traversal.visit(&(objectArray[i][j]));
88374 : }
88375 : }
88376 : }
88377 : #else
88378 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
88379 : // compute the list first and then call the visit function on each list element.
88380 :
88381 : // printf ("Inside of SgUpirSpmdStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
88382 :
88383 2870 : std::vector<SgUpirSpmdStatement*> nodeList;
88384 :
88385 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
88386 2870 : for (unsigned int i=0; i < SgUpirSpmdStatement::pools.size(); i++)
88387 : {
88388 : // objectArray[i] is a single memory pool
88389 2871440 : for (unsigned j=0; j < SgUpirSpmdStatement::pool_size; j++)
88390 : {
88391 2870000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
88392 : {
88393 2478 : nodeList.push_back(&(objectArray[i][j]));
88394 : }
88395 : }
88396 : }
88397 :
88398 : // Iterate over the saved list
88399 1435 : size_t nodeListSize = nodeList.size();
88400 3913 : for (size_t i=0; i < nodeListSize; i++)
88401 : {
88402 2478 : ROSE_ASSERT(nodeList[i] != NULL);
88403 : #if 0
88404 : traversal.visit(nodeList[i]);
88405 : #else
88406 2478 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
88407 : {
88408 2478 : traversal.visit(nodeList[i]);
88409 : }
88410 : #endif
88411 : }
88412 : #endif
88413 : }
88414 :
88415 : // This should not be required since all previously static data members are
88416 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
88417 :
88418 5342 : }
88419 :
88420 :
88421 : void
88422 194 : SgUpirSpmdStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
88423 : {
88424 : // This function traverses the memory pool for an IR node and
88425 : // calls the function to execute the visitor object.
88426 :
88427 : // Initialize array to the address of the first element of the STL vector
88428 : // (which is guarenteed to be contiguous storage).
88429 : // SgUpirSpmdStatement objectArray [] = *(Memory_Block_List.begin());
88430 194 : if (SgUpirSpmdStatement::pools.empty() == false)
88431 : {
88432 : // Generate an array of memory pools
88433 0 : SgUpirSpmdStatement** objectArray = (SgUpirSpmdStatement**) &(SgUpirSpmdStatement::pools[0]);
88434 :
88435 : // Build a local variable for better performance
88436 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
88437 :
88438 : // Iterate over the memory pools
88439 0 : for (unsigned int i=0; i < SgUpirSpmdStatement::pools.size(); i++)
88440 : {
88441 : // objectArray[i] is a single memory pool
88442 0 : for (unsigned j=0; j < SgUpirSpmdStatement::pool_size; j++)
88443 : {
88444 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
88445 : {
88446 : // printf ("Found a valid SgUpirSpmdStatement object in the memory pool %d at position %d \n",i,j);
88447 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
88448 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
88449 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
88450 : }
88451 : else
88452 : {
88453 : // printf ("Found a INVALID SgUpirSpmdStatement object in the memory pool \n");
88454 : }
88455 : }
88456 : }
88457 : }
88458 :
88459 : // This should not be required since all previously static data members are
88460 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
88461 :
88462 194 : }
88463 :
88464 : void
88465 0 : SgUpirSpmdStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
88466 : {
88467 : // This function visits only a single IR node of the memory pool.
88468 : // it is typically called once for each type of IR node within
88469 : // the automatically generated function: traverseRepresentativeNodes().
88470 :
88471 : // Initialize array to the address of the first element of the STL vector
88472 : // (which is guarenteed to be contiguous storage).
88473 : // SgUpirSpmdStatement objectArray [] = *(Memory_Block_List.begin());
88474 0 : if (SgUpirSpmdStatement::pools.empty() == false)
88475 : {
88476 : // Generate an array of memory pools
88477 0 : SgUpirSpmdStatement** objectArray = (SgUpirSpmdStatement**) &(SgUpirSpmdStatement::pools[0]);
88478 :
88479 : // Build a local variable for better performance
88480 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
88481 :
88482 : // Iterate over the memory pools
88483 0 : bool done = false;
88484 0 : unsigned i=0;
88485 :
88486 : // find the first valid IR node, call visit function, and then leave
88487 0 : while ( done == false && i < SgUpirSpmdStatement::pools.size() )
88488 : {
88489 : // objectArray[i] is a single memory pool
88490 : unsigned j=0;
88491 0 : while (done == false && j < SgUpirSpmdStatement::pool_size)
88492 : {
88493 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
88494 : {
88495 0 : traversal.visit(&(objectArray[i][j]));
88496 0 : done = true;
88497 : }
88498 0 : j++;
88499 : }
88500 0 : i++;
88501 : }
88502 :
88503 : #if 0
88504 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
88505 : if (done == false)
88506 : {
88507 : printf ("No representative for SgUpirSpmdStatement found in memory pools \n");
88508 : }
88509 : #endif
88510 : }
88511 0 : }
88512 :
88513 :
88514 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
88515 : // using values that overflow signed values of int.
88516 : size_t
88517 4 : SgUpirSpmdStatement::numberOfNodes()
88518 : {
88519 : // This function traverses the memory pool for an IR node and
88520 : // counts the number of IR nodes of a particular Sage III IR
88521 : // nodes type.
88522 :
88523 4 : size_t count = 0;
88524 4 : if (SgUpirSpmdStatement::pools.empty() == false)
88525 : {
88526 : // Generate an array of memory pools (this is actually a STL vector,
88527 : // but it is contiguious, so OK to treat this way).
88528 0 : SgUpirSpmdStatement** objectArray = (SgUpirSpmdStatement**) &(SgUpirSpmdStatement::pools[0]);
88529 :
88530 : // Build a local variable for better performance (make it a loop invariant variable).
88531 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
88532 :
88533 : // Iterate over all of the memory pools for this IR node.
88534 0 : for (unsigned int i=0; i < SgUpirSpmdStatement::pools.size(); i++)
88535 : {
88536 : // objectArray[i] is a single memory pool, iterate over all the
88537 : // IR nodes and only count those that are valid IR nodes used in
88538 : // the AST (i.e. allocated IR nodes).
88539 0 : for (unsigned j=0; j < SgUpirSpmdStatement::pool_size; j++)
88540 : {
88541 : // This is indexing the STL vector of C/C++ style arrays as a doubly
88542 : // indexed array access. It is OK since we have leveraged the semantics
88543 : // of STL vector memory as contigous and cast the memory as an array
88544 : // of arrays to use the 2D array indexing. Hope this is not confusing,
88545 : // but it s very fast as an implementation.
88546 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
88547 : {
88548 0 : count++;
88549 : }
88550 : }
88551 : }
88552 : }
88553 :
88554 :
88555 :
88556 4 : return count;
88557 : }
88558 :
88559 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
88560 : // using values that overflow signed values of int.
88561 : size_t
88562 0 : SgUpirSpmdStatement::memoryUsage()
88563 : {
88564 : // This function is required because we need the class name as a type when we call sizeof
88565 : // There might be another way to implement this if we have a traversal that only called a
88566 : // representative object (one call for each type of Sage IIIIR node).
88567 0 : size_t memory = numberOfNodes() * sizeof(SgUpirSpmdStatement);
88568 :
88569 0 : return memory;
88570 : }
88571 :
88572 : /* #line 88573 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
88573 :
88574 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
88575 : void
88576 5342 : SgOmpTeamsStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
88577 : {
88578 : // This function traverses the memory pool for only a specific IR node
88579 : // and calls the visit function of the input class execute a traversal
88580 : // similar to the style of the attribute based traversals within ROSE.
88581 : // This traversal will visit ALL nodes of the AST where as the other
88582 : // attribute based traversals visit only the embedded tree within the AST.
88583 :
88584 : // Initialize array to the address of the first element of the STL vector
88585 : // (which is guaranteed to be contiguous storage).
88586 : // SgOmpTeamsStatement objectArray [] = *(Memory_Block_List.begin());
88587 5342 : if (SgOmpTeamsStatement::pools.empty() == false)
88588 : {
88589 : // Generate an array of memory pools
88590 21 : SgOmpTeamsStatement** objectArray = (SgOmpTeamsStatement**) &(SgOmpTeamsStatement::pools[0]);
88591 :
88592 : // Build a local variable for better performance
88593 21 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
88594 : #if 0
88595 : // Iterate over the memory pools
88596 : for (unsigned int i=0; i < SgOmpTeamsStatement::pools.size(); i++)
88597 : {
88598 : // objectArray[i] is a single memory pool
88599 : for (int j=0; j < SgOmpTeamsStatement::pool_size; j++)
88600 : {
88601 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
88602 : {
88603 : traversal.visit(&(objectArray[i][j]));
88604 : }
88605 : }
88606 : }
88607 : #else
88608 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
88609 : // compute the list first and then call the visit function on each list element.
88610 :
88611 : // printf ("Inside of SgOmpTeamsStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
88612 :
88613 42 : std::vector<SgOmpTeamsStatement*> nodeList;
88614 :
88615 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
88616 42 : for (unsigned int i=0; i < SgOmpTeamsStatement::pools.size(); i++)
88617 : {
88618 : // objectArray[i] is a single memory pool
88619 42021 : for (unsigned j=0; j < SgOmpTeamsStatement::pool_size; j++)
88620 : {
88621 42000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
88622 : {
88623 21 : nodeList.push_back(&(objectArray[i][j]));
88624 : }
88625 : }
88626 : }
88627 :
88628 : // Iterate over the saved list
88629 21 : size_t nodeListSize = nodeList.size();
88630 42 : for (size_t i=0; i < nodeListSize; i++)
88631 : {
88632 21 : ROSE_ASSERT(nodeList[i] != NULL);
88633 : #if 0
88634 : traversal.visit(nodeList[i]);
88635 : #else
88636 21 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
88637 : {
88638 21 : traversal.visit(nodeList[i]);
88639 : }
88640 : #endif
88641 : }
88642 : #endif
88643 : }
88644 :
88645 : // This should not be required since all previously static data members are
88646 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
88647 :
88648 5342 : }
88649 :
88650 :
88651 : void
88652 194 : SgOmpTeamsStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
88653 : {
88654 : // This function traverses the memory pool for an IR node and
88655 : // calls the function to execute the visitor object.
88656 :
88657 : // Initialize array to the address of the first element of the STL vector
88658 : // (which is guarenteed to be contiguous storage).
88659 : // SgOmpTeamsStatement objectArray [] = *(Memory_Block_List.begin());
88660 194 : if (SgOmpTeamsStatement::pools.empty() == false)
88661 : {
88662 : // Generate an array of memory pools
88663 0 : SgOmpTeamsStatement** objectArray = (SgOmpTeamsStatement**) &(SgOmpTeamsStatement::pools[0]);
88664 :
88665 : // Build a local variable for better performance
88666 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
88667 :
88668 : // Iterate over the memory pools
88669 0 : for (unsigned int i=0; i < SgOmpTeamsStatement::pools.size(); i++)
88670 : {
88671 : // objectArray[i] is a single memory pool
88672 0 : for (unsigned j=0; j < SgOmpTeamsStatement::pool_size; j++)
88673 : {
88674 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
88675 : {
88676 : // printf ("Found a valid SgOmpTeamsStatement object in the memory pool %d at position %d \n",i,j);
88677 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
88678 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
88679 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
88680 : }
88681 : else
88682 : {
88683 : // printf ("Found a INVALID SgOmpTeamsStatement object in the memory pool \n");
88684 : }
88685 : }
88686 : }
88687 : }
88688 :
88689 : // This should not be required since all previously static data members are
88690 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
88691 :
88692 194 : }
88693 :
88694 : void
88695 0 : SgOmpTeamsStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
88696 : {
88697 : // This function visits only a single IR node of the memory pool.
88698 : // it is typically called once for each type of IR node within
88699 : // the automatically generated function: traverseRepresentativeNodes().
88700 :
88701 : // Initialize array to the address of the first element of the STL vector
88702 : // (which is guarenteed to be contiguous storage).
88703 : // SgOmpTeamsStatement objectArray [] = *(Memory_Block_List.begin());
88704 0 : if (SgOmpTeamsStatement::pools.empty() == false)
88705 : {
88706 : // Generate an array of memory pools
88707 0 : SgOmpTeamsStatement** objectArray = (SgOmpTeamsStatement**) &(SgOmpTeamsStatement::pools[0]);
88708 :
88709 : // Build a local variable for better performance
88710 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
88711 :
88712 : // Iterate over the memory pools
88713 0 : bool done = false;
88714 0 : unsigned i=0;
88715 :
88716 : // find the first valid IR node, call visit function, and then leave
88717 0 : while ( done == false && i < SgOmpTeamsStatement::pools.size() )
88718 : {
88719 : // objectArray[i] is a single memory pool
88720 : unsigned j=0;
88721 0 : while (done == false && j < SgOmpTeamsStatement::pool_size)
88722 : {
88723 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
88724 : {
88725 0 : traversal.visit(&(objectArray[i][j]));
88726 0 : done = true;
88727 : }
88728 0 : j++;
88729 : }
88730 0 : i++;
88731 : }
88732 :
88733 : #if 0
88734 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
88735 : if (done == false)
88736 : {
88737 : printf ("No representative for SgOmpTeamsStatement found in memory pools \n");
88738 : }
88739 : #endif
88740 : }
88741 0 : }
88742 :
88743 :
88744 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
88745 : // using values that overflow signed values of int.
88746 : size_t
88747 4 : SgOmpTeamsStatement::numberOfNodes()
88748 : {
88749 : // This function traverses the memory pool for an IR node and
88750 : // counts the number of IR nodes of a particular Sage III IR
88751 : // nodes type.
88752 :
88753 4 : size_t count = 0;
88754 4 : if (SgOmpTeamsStatement::pools.empty() == false)
88755 : {
88756 : // Generate an array of memory pools (this is actually a STL vector,
88757 : // but it is contiguious, so OK to treat this way).
88758 0 : SgOmpTeamsStatement** objectArray = (SgOmpTeamsStatement**) &(SgOmpTeamsStatement::pools[0]);
88759 :
88760 : // Build a local variable for better performance (make it a loop invariant variable).
88761 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
88762 :
88763 : // Iterate over all of the memory pools for this IR node.
88764 0 : for (unsigned int i=0; i < SgOmpTeamsStatement::pools.size(); i++)
88765 : {
88766 : // objectArray[i] is a single memory pool, iterate over all the
88767 : // IR nodes and only count those that are valid IR nodes used in
88768 : // the AST (i.e. allocated IR nodes).
88769 0 : for (unsigned j=0; j < SgOmpTeamsStatement::pool_size; j++)
88770 : {
88771 : // This is indexing the STL vector of C/C++ style arrays as a doubly
88772 : // indexed array access. It is OK since we have leveraged the semantics
88773 : // of STL vector memory as contigous and cast the memory as an array
88774 : // of arrays to use the 2D array indexing. Hope this is not confusing,
88775 : // but it s very fast as an implementation.
88776 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
88777 : {
88778 0 : count++;
88779 : }
88780 : }
88781 : }
88782 : }
88783 :
88784 :
88785 :
88786 4 : return count;
88787 : }
88788 :
88789 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
88790 : // using values that overflow signed values of int.
88791 : size_t
88792 0 : SgOmpTeamsStatement::memoryUsage()
88793 : {
88794 : // This function is required because we need the class name as a type when we call sizeof
88795 : // There might be another way to implement this if we have a traversal that only called a
88796 : // representative object (one call for each type of Sage IIIIR node).
88797 0 : size_t memory = numberOfNodes() * sizeof(SgOmpTeamsStatement);
88798 :
88799 0 : return memory;
88800 : }
88801 :
88802 : /* #line 88803 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
88803 :
88804 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
88805 : void
88806 5342 : SgOmpSingleStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
88807 : {
88808 : // This function traverses the memory pool for only a specific IR node
88809 : // and calls the visit function of the input class execute a traversal
88810 : // similar to the style of the attribute based traversals within ROSE.
88811 : // This traversal will visit ALL nodes of the AST where as the other
88812 : // attribute based traversals visit only the embedded tree within the AST.
88813 :
88814 : // Initialize array to the address of the first element of the STL vector
88815 : // (which is guaranteed to be contiguous storage).
88816 : // SgOmpSingleStatement objectArray [] = *(Memory_Block_List.begin());
88817 5342 : if (SgOmpSingleStatement::pools.empty() == false)
88818 : {
88819 : // Generate an array of memory pools
88820 448 : SgOmpSingleStatement** objectArray = (SgOmpSingleStatement**) &(SgOmpSingleStatement::pools[0]);
88821 :
88822 : // Build a local variable for better performance
88823 448 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
88824 : #if 0
88825 : // Iterate over the memory pools
88826 : for (unsigned int i=0; i < SgOmpSingleStatement::pools.size(); i++)
88827 : {
88828 : // objectArray[i] is a single memory pool
88829 : for (int j=0; j < SgOmpSingleStatement::pool_size; j++)
88830 : {
88831 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
88832 : {
88833 : traversal.visit(&(objectArray[i][j]));
88834 : }
88835 : }
88836 : }
88837 : #else
88838 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
88839 : // compute the list first and then call the visit function on each list element.
88840 :
88841 : // printf ("Inside of SgOmpSingleStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
88842 :
88843 896 : std::vector<SgOmpSingleStatement*> nodeList;
88844 :
88845 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
88846 896 : for (unsigned int i=0; i < SgOmpSingleStatement::pools.size(); i++)
88847 : {
88848 : // objectArray[i] is a single memory pool
88849 896448 : for (unsigned j=0; j < SgOmpSingleStatement::pool_size; j++)
88850 : {
88851 896000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
88852 : {
88853 588 : nodeList.push_back(&(objectArray[i][j]));
88854 : }
88855 : }
88856 : }
88857 :
88858 : // Iterate over the saved list
88859 448 : size_t nodeListSize = nodeList.size();
88860 1036 : for (size_t i=0; i < nodeListSize; i++)
88861 : {
88862 588 : ROSE_ASSERT(nodeList[i] != NULL);
88863 : #if 0
88864 : traversal.visit(nodeList[i]);
88865 : #else
88866 588 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
88867 : {
88868 588 : traversal.visit(nodeList[i]);
88869 : }
88870 : #endif
88871 : }
88872 : #endif
88873 : }
88874 :
88875 : // This should not be required since all previously static data members are
88876 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
88877 :
88878 5342 : }
88879 :
88880 :
88881 : void
88882 194 : SgOmpSingleStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
88883 : {
88884 : // This function traverses the memory pool for an IR node and
88885 : // calls the function to execute the visitor object.
88886 :
88887 : // Initialize array to the address of the first element of the STL vector
88888 : // (which is guarenteed to be contiguous storage).
88889 : // SgOmpSingleStatement objectArray [] = *(Memory_Block_List.begin());
88890 194 : if (SgOmpSingleStatement::pools.empty() == false)
88891 : {
88892 : // Generate an array of memory pools
88893 0 : SgOmpSingleStatement** objectArray = (SgOmpSingleStatement**) &(SgOmpSingleStatement::pools[0]);
88894 :
88895 : // Build a local variable for better performance
88896 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
88897 :
88898 : // Iterate over the memory pools
88899 0 : for (unsigned int i=0; i < SgOmpSingleStatement::pools.size(); i++)
88900 : {
88901 : // objectArray[i] is a single memory pool
88902 0 : for (unsigned j=0; j < SgOmpSingleStatement::pool_size; j++)
88903 : {
88904 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
88905 : {
88906 : // printf ("Found a valid SgOmpSingleStatement object in the memory pool %d at position %d \n",i,j);
88907 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
88908 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
88909 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
88910 : }
88911 : else
88912 : {
88913 : // printf ("Found a INVALID SgOmpSingleStatement object in the memory pool \n");
88914 : }
88915 : }
88916 : }
88917 : }
88918 :
88919 : // This should not be required since all previously static data members are
88920 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
88921 :
88922 194 : }
88923 :
88924 : void
88925 0 : SgOmpSingleStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
88926 : {
88927 : // This function visits only a single IR node of the memory pool.
88928 : // it is typically called once for each type of IR node within
88929 : // the automatically generated function: traverseRepresentativeNodes().
88930 :
88931 : // Initialize array to the address of the first element of the STL vector
88932 : // (which is guarenteed to be contiguous storage).
88933 : // SgOmpSingleStatement objectArray [] = *(Memory_Block_List.begin());
88934 0 : if (SgOmpSingleStatement::pools.empty() == false)
88935 : {
88936 : // Generate an array of memory pools
88937 0 : SgOmpSingleStatement** objectArray = (SgOmpSingleStatement**) &(SgOmpSingleStatement::pools[0]);
88938 :
88939 : // Build a local variable for better performance
88940 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
88941 :
88942 : // Iterate over the memory pools
88943 0 : bool done = false;
88944 0 : unsigned i=0;
88945 :
88946 : // find the first valid IR node, call visit function, and then leave
88947 0 : while ( done == false && i < SgOmpSingleStatement::pools.size() )
88948 : {
88949 : // objectArray[i] is a single memory pool
88950 : unsigned j=0;
88951 0 : while (done == false && j < SgOmpSingleStatement::pool_size)
88952 : {
88953 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
88954 : {
88955 0 : traversal.visit(&(objectArray[i][j]));
88956 0 : done = true;
88957 : }
88958 0 : j++;
88959 : }
88960 0 : i++;
88961 : }
88962 :
88963 : #if 0
88964 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
88965 : if (done == false)
88966 : {
88967 : printf ("No representative for SgOmpSingleStatement found in memory pools \n");
88968 : }
88969 : #endif
88970 : }
88971 0 : }
88972 :
88973 :
88974 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
88975 : // using values that overflow signed values of int.
88976 : size_t
88977 4 : SgOmpSingleStatement::numberOfNodes()
88978 : {
88979 : // This function traverses the memory pool for an IR node and
88980 : // counts the number of IR nodes of a particular Sage III IR
88981 : // nodes type.
88982 :
88983 4 : size_t count = 0;
88984 4 : if (SgOmpSingleStatement::pools.empty() == false)
88985 : {
88986 : // Generate an array of memory pools (this is actually a STL vector,
88987 : // but it is contiguious, so OK to treat this way).
88988 0 : SgOmpSingleStatement** objectArray = (SgOmpSingleStatement**) &(SgOmpSingleStatement::pools[0]);
88989 :
88990 : // Build a local variable for better performance (make it a loop invariant variable).
88991 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
88992 :
88993 : // Iterate over all of the memory pools for this IR node.
88994 0 : for (unsigned int i=0; i < SgOmpSingleStatement::pools.size(); i++)
88995 : {
88996 : // objectArray[i] is a single memory pool, iterate over all the
88997 : // IR nodes and only count those that are valid IR nodes used in
88998 : // the AST (i.e. allocated IR nodes).
88999 0 : for (unsigned j=0; j < SgOmpSingleStatement::pool_size; j++)
89000 : {
89001 : // This is indexing the STL vector of C/C++ style arrays as a doubly
89002 : // indexed array access. It is OK since we have leveraged the semantics
89003 : // of STL vector memory as contigous and cast the memory as an array
89004 : // of arrays to use the 2D array indexing. Hope this is not confusing,
89005 : // but it s very fast as an implementation.
89006 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
89007 : {
89008 0 : count++;
89009 : }
89010 : }
89011 : }
89012 : }
89013 :
89014 :
89015 :
89016 4 : return count;
89017 : }
89018 :
89019 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
89020 : // using values that overflow signed values of int.
89021 : size_t
89022 0 : SgOmpSingleStatement::memoryUsage()
89023 : {
89024 : // This function is required because we need the class name as a type when we call sizeof
89025 : // There might be another way to implement this if we have a traversal that only called a
89026 : // representative object (one call for each type of Sage IIIIR node).
89027 0 : size_t memory = numberOfNodes() * sizeof(SgOmpSingleStatement);
89028 :
89029 0 : return memory;
89030 : }
89031 :
89032 : /* #line 89033 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
89033 :
89034 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
89035 : void
89036 5342 : SgOmpAtomicStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
89037 : {
89038 : // This function traverses the memory pool for only a specific IR node
89039 : // and calls the visit function of the input class execute a traversal
89040 : // similar to the style of the attribute based traversals within ROSE.
89041 : // This traversal will visit ALL nodes of the AST where as the other
89042 : // attribute based traversals visit only the embedded tree within the AST.
89043 :
89044 : // Initialize array to the address of the first element of the STL vector
89045 : // (which is guaranteed to be contiguous storage).
89046 : // SgOmpAtomicStatement objectArray [] = *(Memory_Block_List.begin());
89047 5342 : if (SgOmpAtomicStatement::pools.empty() == false)
89048 : {
89049 : // Generate an array of memory pools
89050 35 : SgOmpAtomicStatement** objectArray = (SgOmpAtomicStatement**) &(SgOmpAtomicStatement::pools[0]);
89051 :
89052 : // Build a local variable for better performance
89053 35 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
89054 : #if 0
89055 : // Iterate over the memory pools
89056 : for (unsigned int i=0; i < SgOmpAtomicStatement::pools.size(); i++)
89057 : {
89058 : // objectArray[i] is a single memory pool
89059 : for (int j=0; j < SgOmpAtomicStatement::pool_size; j++)
89060 : {
89061 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
89062 : {
89063 : traversal.visit(&(objectArray[i][j]));
89064 : }
89065 : }
89066 : }
89067 : #else
89068 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
89069 : // compute the list first and then call the visit function on each list element.
89070 :
89071 : // printf ("Inside of SgOmpAtomicStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
89072 :
89073 70 : std::vector<SgOmpAtomicStatement*> nodeList;
89074 :
89075 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
89076 70 : for (unsigned int i=0; i < SgOmpAtomicStatement::pools.size(); i++)
89077 : {
89078 : // objectArray[i] is a single memory pool
89079 70035 : for (unsigned j=0; j < SgOmpAtomicStatement::pool_size; j++)
89080 : {
89081 70000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
89082 : {
89083 56 : nodeList.push_back(&(objectArray[i][j]));
89084 : }
89085 : }
89086 : }
89087 :
89088 : // Iterate over the saved list
89089 35 : size_t nodeListSize = nodeList.size();
89090 91 : for (size_t i=0; i < nodeListSize; i++)
89091 : {
89092 56 : ROSE_ASSERT(nodeList[i] != NULL);
89093 : #if 0
89094 : traversal.visit(nodeList[i]);
89095 : #else
89096 56 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
89097 : {
89098 56 : traversal.visit(nodeList[i]);
89099 : }
89100 : #endif
89101 : }
89102 : #endif
89103 : }
89104 :
89105 : // This should not be required since all previously static data members are
89106 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
89107 :
89108 5342 : }
89109 :
89110 :
89111 : void
89112 194 : SgOmpAtomicStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
89113 : {
89114 : // This function traverses the memory pool for an IR node and
89115 : // calls the function to execute the visitor object.
89116 :
89117 : // Initialize array to the address of the first element of the STL vector
89118 : // (which is guarenteed to be contiguous storage).
89119 : // SgOmpAtomicStatement objectArray [] = *(Memory_Block_List.begin());
89120 194 : if (SgOmpAtomicStatement::pools.empty() == false)
89121 : {
89122 : // Generate an array of memory pools
89123 0 : SgOmpAtomicStatement** objectArray = (SgOmpAtomicStatement**) &(SgOmpAtomicStatement::pools[0]);
89124 :
89125 : // Build a local variable for better performance
89126 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
89127 :
89128 : // Iterate over the memory pools
89129 0 : for (unsigned int i=0; i < SgOmpAtomicStatement::pools.size(); i++)
89130 : {
89131 : // objectArray[i] is a single memory pool
89132 0 : for (unsigned j=0; j < SgOmpAtomicStatement::pool_size; j++)
89133 : {
89134 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
89135 : {
89136 : // printf ("Found a valid SgOmpAtomicStatement object in the memory pool %d at position %d \n",i,j);
89137 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
89138 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
89139 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
89140 : }
89141 : else
89142 : {
89143 : // printf ("Found a INVALID SgOmpAtomicStatement object in the memory pool \n");
89144 : }
89145 : }
89146 : }
89147 : }
89148 :
89149 : // This should not be required since all previously static data members are
89150 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
89151 :
89152 194 : }
89153 :
89154 : void
89155 0 : SgOmpAtomicStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
89156 : {
89157 : // This function visits only a single IR node of the memory pool.
89158 : // it is typically called once for each type of IR node within
89159 : // the automatically generated function: traverseRepresentativeNodes().
89160 :
89161 : // Initialize array to the address of the first element of the STL vector
89162 : // (which is guarenteed to be contiguous storage).
89163 : // SgOmpAtomicStatement objectArray [] = *(Memory_Block_List.begin());
89164 0 : if (SgOmpAtomicStatement::pools.empty() == false)
89165 : {
89166 : // Generate an array of memory pools
89167 0 : SgOmpAtomicStatement** objectArray = (SgOmpAtomicStatement**) &(SgOmpAtomicStatement::pools[0]);
89168 :
89169 : // Build a local variable for better performance
89170 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
89171 :
89172 : // Iterate over the memory pools
89173 0 : bool done = false;
89174 0 : unsigned i=0;
89175 :
89176 : // find the first valid IR node, call visit function, and then leave
89177 0 : while ( done == false && i < SgOmpAtomicStatement::pools.size() )
89178 : {
89179 : // objectArray[i] is a single memory pool
89180 : unsigned j=0;
89181 0 : while (done == false && j < SgOmpAtomicStatement::pool_size)
89182 : {
89183 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
89184 : {
89185 0 : traversal.visit(&(objectArray[i][j]));
89186 0 : done = true;
89187 : }
89188 0 : j++;
89189 : }
89190 0 : i++;
89191 : }
89192 :
89193 : #if 0
89194 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
89195 : if (done == false)
89196 : {
89197 : printf ("No representative for SgOmpAtomicStatement found in memory pools \n");
89198 : }
89199 : #endif
89200 : }
89201 0 : }
89202 :
89203 :
89204 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
89205 : // using values that overflow signed values of int.
89206 : size_t
89207 4 : SgOmpAtomicStatement::numberOfNodes()
89208 : {
89209 : // This function traverses the memory pool for an IR node and
89210 : // counts the number of IR nodes of a particular Sage III IR
89211 : // nodes type.
89212 :
89213 4 : size_t count = 0;
89214 4 : if (SgOmpAtomicStatement::pools.empty() == false)
89215 : {
89216 : // Generate an array of memory pools (this is actually a STL vector,
89217 : // but it is contiguious, so OK to treat this way).
89218 0 : SgOmpAtomicStatement** objectArray = (SgOmpAtomicStatement**) &(SgOmpAtomicStatement::pools[0]);
89219 :
89220 : // Build a local variable for better performance (make it a loop invariant variable).
89221 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
89222 :
89223 : // Iterate over all of the memory pools for this IR node.
89224 0 : for (unsigned int i=0; i < SgOmpAtomicStatement::pools.size(); i++)
89225 : {
89226 : // objectArray[i] is a single memory pool, iterate over all the
89227 : // IR nodes and only count those that are valid IR nodes used in
89228 : // the AST (i.e. allocated IR nodes).
89229 0 : for (unsigned j=0; j < SgOmpAtomicStatement::pool_size; j++)
89230 : {
89231 : // This is indexing the STL vector of C/C++ style arrays as a doubly
89232 : // indexed array access. It is OK since we have leveraged the semantics
89233 : // of STL vector memory as contigous and cast the memory as an array
89234 : // of arrays to use the 2D array indexing. Hope this is not confusing,
89235 : // but it s very fast as an implementation.
89236 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
89237 : {
89238 0 : count++;
89239 : }
89240 : }
89241 : }
89242 : }
89243 :
89244 :
89245 :
89246 4 : return count;
89247 : }
89248 :
89249 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
89250 : // using values that overflow signed values of int.
89251 : size_t
89252 0 : SgOmpAtomicStatement::memoryUsage()
89253 : {
89254 : // This function is required because we need the class name as a type when we call sizeof
89255 : // There might be another way to implement this if we have a traversal that only called a
89256 : // representative object (one call for each type of Sage IIIIR node).
89257 0 : size_t memory = numberOfNodes() * sizeof(SgOmpAtomicStatement);
89258 :
89259 0 : return memory;
89260 : }
89261 :
89262 : /* #line 89263 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
89263 :
89264 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
89265 : void
89266 5342 : SgOmpScanStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
89267 : {
89268 : // This function traverses the memory pool for only a specific IR node
89269 : // and calls the visit function of the input class execute a traversal
89270 : // similar to the style of the attribute based traversals within ROSE.
89271 : // This traversal will visit ALL nodes of the AST where as the other
89272 : // attribute based traversals visit only the embedded tree within the AST.
89273 :
89274 : // Initialize array to the address of the first element of the STL vector
89275 : // (which is guaranteed to be contiguous storage).
89276 : // SgOmpScanStatement objectArray [] = *(Memory_Block_List.begin());
89277 5342 : if (SgOmpScanStatement::pools.empty() == false)
89278 : {
89279 : // Generate an array of memory pools
89280 7 : SgOmpScanStatement** objectArray = (SgOmpScanStatement**) &(SgOmpScanStatement::pools[0]);
89281 :
89282 : // Build a local variable for better performance
89283 7 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
89284 : #if 0
89285 : // Iterate over the memory pools
89286 : for (unsigned int i=0; i < SgOmpScanStatement::pools.size(); i++)
89287 : {
89288 : // objectArray[i] is a single memory pool
89289 : for (int j=0; j < SgOmpScanStatement::pool_size; j++)
89290 : {
89291 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
89292 : {
89293 : traversal.visit(&(objectArray[i][j]));
89294 : }
89295 : }
89296 : }
89297 : #else
89298 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
89299 : // compute the list first and then call the visit function on each list element.
89300 :
89301 : // printf ("Inside of SgOmpScanStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
89302 :
89303 14 : std::vector<SgOmpScanStatement*> nodeList;
89304 :
89305 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
89306 14 : for (unsigned int i=0; i < SgOmpScanStatement::pools.size(); i++)
89307 : {
89308 : // objectArray[i] is a single memory pool
89309 14007 : for (unsigned j=0; j < SgOmpScanStatement::pool_size; j++)
89310 : {
89311 14000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
89312 : {
89313 7 : nodeList.push_back(&(objectArray[i][j]));
89314 : }
89315 : }
89316 : }
89317 :
89318 : // Iterate over the saved list
89319 7 : size_t nodeListSize = nodeList.size();
89320 14 : for (size_t i=0; i < nodeListSize; i++)
89321 : {
89322 7 : ROSE_ASSERT(nodeList[i] != NULL);
89323 : #if 0
89324 : traversal.visit(nodeList[i]);
89325 : #else
89326 7 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
89327 : {
89328 7 : traversal.visit(nodeList[i]);
89329 : }
89330 : #endif
89331 : }
89332 : #endif
89333 : }
89334 :
89335 : // This should not be required since all previously static data members are
89336 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
89337 :
89338 5342 : }
89339 :
89340 :
89341 : void
89342 194 : SgOmpScanStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
89343 : {
89344 : // This function traverses the memory pool for an IR node and
89345 : // calls the function to execute the visitor object.
89346 :
89347 : // Initialize array to the address of the first element of the STL vector
89348 : // (which is guarenteed to be contiguous storage).
89349 : // SgOmpScanStatement objectArray [] = *(Memory_Block_List.begin());
89350 194 : if (SgOmpScanStatement::pools.empty() == false)
89351 : {
89352 : // Generate an array of memory pools
89353 0 : SgOmpScanStatement** objectArray = (SgOmpScanStatement**) &(SgOmpScanStatement::pools[0]);
89354 :
89355 : // Build a local variable for better performance
89356 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
89357 :
89358 : // Iterate over the memory pools
89359 0 : for (unsigned int i=0; i < SgOmpScanStatement::pools.size(); i++)
89360 : {
89361 : // objectArray[i] is a single memory pool
89362 0 : for (unsigned j=0; j < SgOmpScanStatement::pool_size; j++)
89363 : {
89364 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
89365 : {
89366 : // printf ("Found a valid SgOmpScanStatement object in the memory pool %d at position %d \n",i,j);
89367 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
89368 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
89369 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
89370 : }
89371 : else
89372 : {
89373 : // printf ("Found a INVALID SgOmpScanStatement object in the memory pool \n");
89374 : }
89375 : }
89376 : }
89377 : }
89378 :
89379 : // This should not be required since all previously static data members are
89380 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
89381 :
89382 194 : }
89383 :
89384 : void
89385 0 : SgOmpScanStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
89386 : {
89387 : // This function visits only a single IR node of the memory pool.
89388 : // it is typically called once for each type of IR node within
89389 : // the automatically generated function: traverseRepresentativeNodes().
89390 :
89391 : // Initialize array to the address of the first element of the STL vector
89392 : // (which is guarenteed to be contiguous storage).
89393 : // SgOmpScanStatement objectArray [] = *(Memory_Block_List.begin());
89394 0 : if (SgOmpScanStatement::pools.empty() == false)
89395 : {
89396 : // Generate an array of memory pools
89397 0 : SgOmpScanStatement** objectArray = (SgOmpScanStatement**) &(SgOmpScanStatement::pools[0]);
89398 :
89399 : // Build a local variable for better performance
89400 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
89401 :
89402 : // Iterate over the memory pools
89403 0 : bool done = false;
89404 0 : unsigned i=0;
89405 :
89406 : // find the first valid IR node, call visit function, and then leave
89407 0 : while ( done == false && i < SgOmpScanStatement::pools.size() )
89408 : {
89409 : // objectArray[i] is a single memory pool
89410 : unsigned j=0;
89411 0 : while (done == false && j < SgOmpScanStatement::pool_size)
89412 : {
89413 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
89414 : {
89415 0 : traversal.visit(&(objectArray[i][j]));
89416 0 : done = true;
89417 : }
89418 0 : j++;
89419 : }
89420 0 : i++;
89421 : }
89422 :
89423 : #if 0
89424 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
89425 : if (done == false)
89426 : {
89427 : printf ("No representative for SgOmpScanStatement found in memory pools \n");
89428 : }
89429 : #endif
89430 : }
89431 0 : }
89432 :
89433 :
89434 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
89435 : // using values that overflow signed values of int.
89436 : size_t
89437 4 : SgOmpScanStatement::numberOfNodes()
89438 : {
89439 : // This function traverses the memory pool for an IR node and
89440 : // counts the number of IR nodes of a particular Sage III IR
89441 : // nodes type.
89442 :
89443 4 : size_t count = 0;
89444 4 : if (SgOmpScanStatement::pools.empty() == false)
89445 : {
89446 : // Generate an array of memory pools (this is actually a STL vector,
89447 : // but it is contiguious, so OK to treat this way).
89448 0 : SgOmpScanStatement** objectArray = (SgOmpScanStatement**) &(SgOmpScanStatement::pools[0]);
89449 :
89450 : // Build a local variable for better performance (make it a loop invariant variable).
89451 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
89452 :
89453 : // Iterate over all of the memory pools for this IR node.
89454 0 : for (unsigned int i=0; i < SgOmpScanStatement::pools.size(); i++)
89455 : {
89456 : // objectArray[i] is a single memory pool, iterate over all the
89457 : // IR nodes and only count those that are valid IR nodes used in
89458 : // the AST (i.e. allocated IR nodes).
89459 0 : for (unsigned j=0; j < SgOmpScanStatement::pool_size; j++)
89460 : {
89461 : // This is indexing the STL vector of C/C++ style arrays as a doubly
89462 : // indexed array access. It is OK since we have leveraged the semantics
89463 : // of STL vector memory as contigous and cast the memory as an array
89464 : // of arrays to use the 2D array indexing. Hope this is not confusing,
89465 : // but it s very fast as an implementation.
89466 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
89467 : {
89468 0 : count++;
89469 : }
89470 : }
89471 : }
89472 : }
89473 :
89474 :
89475 :
89476 4 : return count;
89477 : }
89478 :
89479 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
89480 : // using values that overflow signed values of int.
89481 : size_t
89482 0 : SgOmpScanStatement::memoryUsage()
89483 : {
89484 : // This function is required because we need the class name as a type when we call sizeof
89485 : // There might be another way to implement this if we have a traversal that only called a
89486 : // representative object (one call for each type of Sage IIIIR node).
89487 0 : size_t memory = numberOfNodes() * sizeof(SgOmpScanStatement);
89488 :
89489 0 : return memory;
89490 : }
89491 :
89492 : /* #line 89493 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
89493 :
89494 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
89495 : void
89496 5342 : SgOmpMetadirectiveStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
89497 : {
89498 : // This function traverses the memory pool for only a specific IR node
89499 : // and calls the visit function of the input class execute a traversal
89500 : // similar to the style of the attribute based traversals within ROSE.
89501 : // This traversal will visit ALL nodes of the AST where as the other
89502 : // attribute based traversals visit only the embedded tree within the AST.
89503 :
89504 : // Initialize array to the address of the first element of the STL vector
89505 : // (which is guaranteed to be contiguous storage).
89506 : // SgOmpMetadirectiveStatement objectArray [] = *(Memory_Block_List.begin());
89507 5342 : if (SgOmpMetadirectiveStatement::pools.empty() == false)
89508 : {
89509 : // Generate an array of memory pools
89510 0 : SgOmpMetadirectiveStatement** objectArray = (SgOmpMetadirectiveStatement**) &(SgOmpMetadirectiveStatement::pools[0]);
89511 :
89512 : // Build a local variable for better performance
89513 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
89514 : #if 0
89515 : // Iterate over the memory pools
89516 : for (unsigned int i=0; i < SgOmpMetadirectiveStatement::pools.size(); i++)
89517 : {
89518 : // objectArray[i] is a single memory pool
89519 : for (int j=0; j < SgOmpMetadirectiveStatement::pool_size; j++)
89520 : {
89521 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
89522 : {
89523 : traversal.visit(&(objectArray[i][j]));
89524 : }
89525 : }
89526 : }
89527 : #else
89528 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
89529 : // compute the list first and then call the visit function on each list element.
89530 :
89531 : // printf ("Inside of SgOmpMetadirectiveStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
89532 :
89533 0 : std::vector<SgOmpMetadirectiveStatement*> nodeList;
89534 :
89535 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
89536 0 : for (unsigned int i=0; i < SgOmpMetadirectiveStatement::pools.size(); i++)
89537 : {
89538 : // objectArray[i] is a single memory pool
89539 0 : for (unsigned j=0; j < SgOmpMetadirectiveStatement::pool_size; j++)
89540 : {
89541 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
89542 : {
89543 0 : nodeList.push_back(&(objectArray[i][j]));
89544 : }
89545 : }
89546 : }
89547 :
89548 : // Iterate over the saved list
89549 0 : size_t nodeListSize = nodeList.size();
89550 0 : for (size_t i=0; i < nodeListSize; i++)
89551 : {
89552 0 : ROSE_ASSERT(nodeList[i] != NULL);
89553 : #if 0
89554 : traversal.visit(nodeList[i]);
89555 : #else
89556 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
89557 : {
89558 0 : traversal.visit(nodeList[i]);
89559 : }
89560 : #endif
89561 : }
89562 : #endif
89563 : }
89564 :
89565 : // This should not be required since all previously static data members are
89566 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
89567 :
89568 5342 : }
89569 :
89570 :
89571 : void
89572 194 : SgOmpMetadirectiveStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
89573 : {
89574 : // This function traverses the memory pool for an IR node and
89575 : // calls the function to execute the visitor object.
89576 :
89577 : // Initialize array to the address of the first element of the STL vector
89578 : // (which is guarenteed to be contiguous storage).
89579 : // SgOmpMetadirectiveStatement objectArray [] = *(Memory_Block_List.begin());
89580 194 : if (SgOmpMetadirectiveStatement::pools.empty() == false)
89581 : {
89582 : // Generate an array of memory pools
89583 0 : SgOmpMetadirectiveStatement** objectArray = (SgOmpMetadirectiveStatement**) &(SgOmpMetadirectiveStatement::pools[0]);
89584 :
89585 : // Build a local variable for better performance
89586 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
89587 :
89588 : // Iterate over the memory pools
89589 0 : for (unsigned int i=0; i < SgOmpMetadirectiveStatement::pools.size(); i++)
89590 : {
89591 : // objectArray[i] is a single memory pool
89592 0 : for (unsigned j=0; j < SgOmpMetadirectiveStatement::pool_size; j++)
89593 : {
89594 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
89595 : {
89596 : // printf ("Found a valid SgOmpMetadirectiveStatement object in the memory pool %d at position %d \n",i,j);
89597 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
89598 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
89599 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
89600 : }
89601 : else
89602 : {
89603 : // printf ("Found a INVALID SgOmpMetadirectiveStatement object in the memory pool \n");
89604 : }
89605 : }
89606 : }
89607 : }
89608 :
89609 : // This should not be required since all previously static data members are
89610 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
89611 :
89612 194 : }
89613 :
89614 : void
89615 0 : SgOmpMetadirectiveStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
89616 : {
89617 : // This function visits only a single IR node of the memory pool.
89618 : // it is typically called once for each type of IR node within
89619 : // the automatically generated function: traverseRepresentativeNodes().
89620 :
89621 : // Initialize array to the address of the first element of the STL vector
89622 : // (which is guarenteed to be contiguous storage).
89623 : // SgOmpMetadirectiveStatement objectArray [] = *(Memory_Block_List.begin());
89624 0 : if (SgOmpMetadirectiveStatement::pools.empty() == false)
89625 : {
89626 : // Generate an array of memory pools
89627 0 : SgOmpMetadirectiveStatement** objectArray = (SgOmpMetadirectiveStatement**) &(SgOmpMetadirectiveStatement::pools[0]);
89628 :
89629 : // Build a local variable for better performance
89630 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
89631 :
89632 : // Iterate over the memory pools
89633 0 : bool done = false;
89634 0 : unsigned i=0;
89635 :
89636 : // find the first valid IR node, call visit function, and then leave
89637 0 : while ( done == false && i < SgOmpMetadirectiveStatement::pools.size() )
89638 : {
89639 : // objectArray[i] is a single memory pool
89640 : unsigned j=0;
89641 0 : while (done == false && j < SgOmpMetadirectiveStatement::pool_size)
89642 : {
89643 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
89644 : {
89645 0 : traversal.visit(&(objectArray[i][j]));
89646 0 : done = true;
89647 : }
89648 0 : j++;
89649 : }
89650 0 : i++;
89651 : }
89652 :
89653 : #if 0
89654 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
89655 : if (done == false)
89656 : {
89657 : printf ("No representative for SgOmpMetadirectiveStatement found in memory pools \n");
89658 : }
89659 : #endif
89660 : }
89661 0 : }
89662 :
89663 :
89664 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
89665 : // using values that overflow signed values of int.
89666 : size_t
89667 4 : SgOmpMetadirectiveStatement::numberOfNodes()
89668 : {
89669 : // This function traverses the memory pool for an IR node and
89670 : // counts the number of IR nodes of a particular Sage III IR
89671 : // nodes type.
89672 :
89673 4 : size_t count = 0;
89674 4 : if (SgOmpMetadirectiveStatement::pools.empty() == false)
89675 : {
89676 : // Generate an array of memory pools (this is actually a STL vector,
89677 : // but it is contiguious, so OK to treat this way).
89678 0 : SgOmpMetadirectiveStatement** objectArray = (SgOmpMetadirectiveStatement**) &(SgOmpMetadirectiveStatement::pools[0]);
89679 :
89680 : // Build a local variable for better performance (make it a loop invariant variable).
89681 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
89682 :
89683 : // Iterate over all of the memory pools for this IR node.
89684 0 : for (unsigned int i=0; i < SgOmpMetadirectiveStatement::pools.size(); i++)
89685 : {
89686 : // objectArray[i] is a single memory pool, iterate over all the
89687 : // IR nodes and only count those that are valid IR nodes used in
89688 : // the AST (i.e. allocated IR nodes).
89689 0 : for (unsigned j=0; j < SgOmpMetadirectiveStatement::pool_size; j++)
89690 : {
89691 : // This is indexing the STL vector of C/C++ style arrays as a doubly
89692 : // indexed array access. It is OK since we have leveraged the semantics
89693 : // of STL vector memory as contigous and cast the memory as an array
89694 : // of arrays to use the 2D array indexing. Hope this is not confusing,
89695 : // but it s very fast as an implementation.
89696 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
89697 : {
89698 0 : count++;
89699 : }
89700 : }
89701 : }
89702 : }
89703 :
89704 :
89705 :
89706 4 : return count;
89707 : }
89708 :
89709 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
89710 : // using values that overflow signed values of int.
89711 : size_t
89712 0 : SgOmpMetadirectiveStatement::memoryUsage()
89713 : {
89714 : // This function is required because we need the class name as a type when we call sizeof
89715 : // There might be another way to implement this if we have a traversal that only called a
89716 : // representative object (one call for each type of Sage IIIIR node).
89717 0 : size_t memory = numberOfNodes() * sizeof(SgOmpMetadirectiveStatement);
89718 :
89719 0 : return memory;
89720 : }
89721 :
89722 : /* #line 89723 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
89723 :
89724 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
89725 : void
89726 5342 : SgOmpLoopStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
89727 : {
89728 : // This function traverses the memory pool for only a specific IR node
89729 : // and calls the visit function of the input class execute a traversal
89730 : // similar to the style of the attribute based traversals within ROSE.
89731 : // This traversal will visit ALL nodes of the AST where as the other
89732 : // attribute based traversals visit only the embedded tree within the AST.
89733 :
89734 : // Initialize array to the address of the first element of the STL vector
89735 : // (which is guaranteed to be contiguous storage).
89736 : // SgOmpLoopStatement objectArray [] = *(Memory_Block_List.begin());
89737 5342 : if (SgOmpLoopStatement::pools.empty() == false)
89738 : {
89739 : // Generate an array of memory pools
89740 7 : SgOmpLoopStatement** objectArray = (SgOmpLoopStatement**) &(SgOmpLoopStatement::pools[0]);
89741 :
89742 : // Build a local variable for better performance
89743 7 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
89744 : #if 0
89745 : // Iterate over the memory pools
89746 : for (unsigned int i=0; i < SgOmpLoopStatement::pools.size(); i++)
89747 : {
89748 : // objectArray[i] is a single memory pool
89749 : for (int j=0; j < SgOmpLoopStatement::pool_size; j++)
89750 : {
89751 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
89752 : {
89753 : traversal.visit(&(objectArray[i][j]));
89754 : }
89755 : }
89756 : }
89757 : #else
89758 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
89759 : // compute the list first and then call the visit function on each list element.
89760 :
89761 : // printf ("Inside of SgOmpLoopStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
89762 :
89763 14 : std::vector<SgOmpLoopStatement*> nodeList;
89764 :
89765 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
89766 14 : for (unsigned int i=0; i < SgOmpLoopStatement::pools.size(); i++)
89767 : {
89768 : // objectArray[i] is a single memory pool
89769 14007 : for (unsigned j=0; j < SgOmpLoopStatement::pool_size; j++)
89770 : {
89771 14000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
89772 : {
89773 7 : nodeList.push_back(&(objectArray[i][j]));
89774 : }
89775 : }
89776 : }
89777 :
89778 : // Iterate over the saved list
89779 7 : size_t nodeListSize = nodeList.size();
89780 14 : for (size_t i=0; i < nodeListSize; i++)
89781 : {
89782 7 : ROSE_ASSERT(nodeList[i] != NULL);
89783 : #if 0
89784 : traversal.visit(nodeList[i]);
89785 : #else
89786 7 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
89787 : {
89788 7 : traversal.visit(nodeList[i]);
89789 : }
89790 : #endif
89791 : }
89792 : #endif
89793 : }
89794 :
89795 : // This should not be required since all previously static data members are
89796 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
89797 :
89798 5342 : }
89799 :
89800 :
89801 : void
89802 194 : SgOmpLoopStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
89803 : {
89804 : // This function traverses the memory pool for an IR node and
89805 : // calls the function to execute the visitor object.
89806 :
89807 : // Initialize array to the address of the first element of the STL vector
89808 : // (which is guarenteed to be contiguous storage).
89809 : // SgOmpLoopStatement objectArray [] = *(Memory_Block_List.begin());
89810 194 : if (SgOmpLoopStatement::pools.empty() == false)
89811 : {
89812 : // Generate an array of memory pools
89813 0 : SgOmpLoopStatement** objectArray = (SgOmpLoopStatement**) &(SgOmpLoopStatement::pools[0]);
89814 :
89815 : // Build a local variable for better performance
89816 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
89817 :
89818 : // Iterate over the memory pools
89819 0 : for (unsigned int i=0; i < SgOmpLoopStatement::pools.size(); i++)
89820 : {
89821 : // objectArray[i] is a single memory pool
89822 0 : for (unsigned j=0; j < SgOmpLoopStatement::pool_size; j++)
89823 : {
89824 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
89825 : {
89826 : // printf ("Found a valid SgOmpLoopStatement object in the memory pool %d at position %d \n",i,j);
89827 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
89828 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
89829 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
89830 : }
89831 : else
89832 : {
89833 : // printf ("Found a INVALID SgOmpLoopStatement object in the memory pool \n");
89834 : }
89835 : }
89836 : }
89837 : }
89838 :
89839 : // This should not be required since all previously static data members are
89840 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
89841 :
89842 194 : }
89843 :
89844 : void
89845 0 : SgOmpLoopStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
89846 : {
89847 : // This function visits only a single IR node of the memory pool.
89848 : // it is typically called once for each type of IR node within
89849 : // the automatically generated function: traverseRepresentativeNodes().
89850 :
89851 : // Initialize array to the address of the first element of the STL vector
89852 : // (which is guarenteed to be contiguous storage).
89853 : // SgOmpLoopStatement objectArray [] = *(Memory_Block_List.begin());
89854 0 : if (SgOmpLoopStatement::pools.empty() == false)
89855 : {
89856 : // Generate an array of memory pools
89857 0 : SgOmpLoopStatement** objectArray = (SgOmpLoopStatement**) &(SgOmpLoopStatement::pools[0]);
89858 :
89859 : // Build a local variable for better performance
89860 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
89861 :
89862 : // Iterate over the memory pools
89863 0 : bool done = false;
89864 0 : unsigned i=0;
89865 :
89866 : // find the first valid IR node, call visit function, and then leave
89867 0 : while ( done == false && i < SgOmpLoopStatement::pools.size() )
89868 : {
89869 : // objectArray[i] is a single memory pool
89870 : unsigned j=0;
89871 0 : while (done == false && j < SgOmpLoopStatement::pool_size)
89872 : {
89873 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
89874 : {
89875 0 : traversal.visit(&(objectArray[i][j]));
89876 0 : done = true;
89877 : }
89878 0 : j++;
89879 : }
89880 0 : i++;
89881 : }
89882 :
89883 : #if 0
89884 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
89885 : if (done == false)
89886 : {
89887 : printf ("No representative for SgOmpLoopStatement found in memory pools \n");
89888 : }
89889 : #endif
89890 : }
89891 0 : }
89892 :
89893 :
89894 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
89895 : // using values that overflow signed values of int.
89896 : size_t
89897 4 : SgOmpLoopStatement::numberOfNodes()
89898 : {
89899 : // This function traverses the memory pool for an IR node and
89900 : // counts the number of IR nodes of a particular Sage III IR
89901 : // nodes type.
89902 :
89903 4 : size_t count = 0;
89904 4 : if (SgOmpLoopStatement::pools.empty() == false)
89905 : {
89906 : // Generate an array of memory pools (this is actually a STL vector,
89907 : // but it is contiguious, so OK to treat this way).
89908 0 : SgOmpLoopStatement** objectArray = (SgOmpLoopStatement**) &(SgOmpLoopStatement::pools[0]);
89909 :
89910 : // Build a local variable for better performance (make it a loop invariant variable).
89911 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
89912 :
89913 : // Iterate over all of the memory pools for this IR node.
89914 0 : for (unsigned int i=0; i < SgOmpLoopStatement::pools.size(); i++)
89915 : {
89916 : // objectArray[i] is a single memory pool, iterate over all the
89917 : // IR nodes and only count those that are valid IR nodes used in
89918 : // the AST (i.e. allocated IR nodes).
89919 0 : for (unsigned j=0; j < SgOmpLoopStatement::pool_size; j++)
89920 : {
89921 : // This is indexing the STL vector of C/C++ style arrays as a doubly
89922 : // indexed array access. It is OK since we have leveraged the semantics
89923 : // of STL vector memory as contigous and cast the memory as an array
89924 : // of arrays to use the 2D array indexing. Hope this is not confusing,
89925 : // but it s very fast as an implementation.
89926 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
89927 : {
89928 0 : count++;
89929 : }
89930 : }
89931 : }
89932 : }
89933 :
89934 :
89935 :
89936 4 : return count;
89937 : }
89938 :
89939 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
89940 : // using values that overflow signed values of int.
89941 : size_t
89942 0 : SgOmpLoopStatement::memoryUsage()
89943 : {
89944 : // This function is required because we need the class name as a type when we call sizeof
89945 : // There might be another way to implement this if we have a traversal that only called a
89946 : // representative object (one call for each type of Sage IIIIR node).
89947 0 : size_t memory = numberOfNodes() * sizeof(SgOmpLoopStatement);
89948 :
89949 0 : return memory;
89950 : }
89951 :
89952 : /* #line 89953 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
89953 :
89954 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
89955 : void
89956 5342 : SgOmpOrderedStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
89957 : {
89958 : // This function traverses the memory pool for only a specific IR node
89959 : // and calls the visit function of the input class execute a traversal
89960 : // similar to the style of the attribute based traversals within ROSE.
89961 : // This traversal will visit ALL nodes of the AST where as the other
89962 : // attribute based traversals visit only the embedded tree within the AST.
89963 :
89964 : // Initialize array to the address of the first element of the STL vector
89965 : // (which is guaranteed to be contiguous storage).
89966 : // SgOmpOrderedStatement objectArray [] = *(Memory_Block_List.begin());
89967 5342 : if (SgOmpOrderedStatement::pools.empty() == false)
89968 : {
89969 : // Generate an array of memory pools
89970 28 : SgOmpOrderedStatement** objectArray = (SgOmpOrderedStatement**) &(SgOmpOrderedStatement::pools[0]);
89971 :
89972 : // Build a local variable for better performance
89973 28 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
89974 : #if 0
89975 : // Iterate over the memory pools
89976 : for (unsigned int i=0; i < SgOmpOrderedStatement::pools.size(); i++)
89977 : {
89978 : // objectArray[i] is a single memory pool
89979 : for (int j=0; j < SgOmpOrderedStatement::pool_size; j++)
89980 : {
89981 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
89982 : {
89983 : traversal.visit(&(objectArray[i][j]));
89984 : }
89985 : }
89986 : }
89987 : #else
89988 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
89989 : // compute the list first and then call the visit function on each list element.
89990 :
89991 : // printf ("Inside of SgOmpOrderedStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
89992 :
89993 56 : std::vector<SgOmpOrderedStatement*> nodeList;
89994 :
89995 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
89996 56 : for (unsigned int i=0; i < SgOmpOrderedStatement::pools.size(); i++)
89997 : {
89998 : // objectArray[i] is a single memory pool
89999 56028 : for (unsigned j=0; j < SgOmpOrderedStatement::pool_size; j++)
90000 : {
90001 56000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
90002 : {
90003 28 : nodeList.push_back(&(objectArray[i][j]));
90004 : }
90005 : }
90006 : }
90007 :
90008 : // Iterate over the saved list
90009 28 : size_t nodeListSize = nodeList.size();
90010 56 : for (size_t i=0; i < nodeListSize; i++)
90011 : {
90012 28 : ROSE_ASSERT(nodeList[i] != NULL);
90013 : #if 0
90014 : traversal.visit(nodeList[i]);
90015 : #else
90016 28 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
90017 : {
90018 28 : traversal.visit(nodeList[i]);
90019 : }
90020 : #endif
90021 : }
90022 : #endif
90023 : }
90024 :
90025 : // This should not be required since all previously static data members are
90026 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
90027 :
90028 5342 : }
90029 :
90030 :
90031 : void
90032 194 : SgOmpOrderedStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
90033 : {
90034 : // This function traverses the memory pool for an IR node and
90035 : // calls the function to execute the visitor object.
90036 :
90037 : // Initialize array to the address of the first element of the STL vector
90038 : // (which is guarenteed to be contiguous storage).
90039 : // SgOmpOrderedStatement objectArray [] = *(Memory_Block_List.begin());
90040 194 : if (SgOmpOrderedStatement::pools.empty() == false)
90041 : {
90042 : // Generate an array of memory pools
90043 0 : SgOmpOrderedStatement** objectArray = (SgOmpOrderedStatement**) &(SgOmpOrderedStatement::pools[0]);
90044 :
90045 : // Build a local variable for better performance
90046 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
90047 :
90048 : // Iterate over the memory pools
90049 0 : for (unsigned int i=0; i < SgOmpOrderedStatement::pools.size(); i++)
90050 : {
90051 : // objectArray[i] is a single memory pool
90052 0 : for (unsigned j=0; j < SgOmpOrderedStatement::pool_size; j++)
90053 : {
90054 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
90055 : {
90056 : // printf ("Found a valid SgOmpOrderedStatement object in the memory pool %d at position %d \n",i,j);
90057 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
90058 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
90059 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
90060 : }
90061 : else
90062 : {
90063 : // printf ("Found a INVALID SgOmpOrderedStatement object in the memory pool \n");
90064 : }
90065 : }
90066 : }
90067 : }
90068 :
90069 : // This should not be required since all previously static data members are
90070 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
90071 :
90072 194 : }
90073 :
90074 : void
90075 0 : SgOmpOrderedStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
90076 : {
90077 : // This function visits only a single IR node of the memory pool.
90078 : // it is typically called once for each type of IR node within
90079 : // the automatically generated function: traverseRepresentativeNodes().
90080 :
90081 : // Initialize array to the address of the first element of the STL vector
90082 : // (which is guarenteed to be contiguous storage).
90083 : // SgOmpOrderedStatement objectArray [] = *(Memory_Block_List.begin());
90084 0 : if (SgOmpOrderedStatement::pools.empty() == false)
90085 : {
90086 : // Generate an array of memory pools
90087 0 : SgOmpOrderedStatement** objectArray = (SgOmpOrderedStatement**) &(SgOmpOrderedStatement::pools[0]);
90088 :
90089 : // Build a local variable for better performance
90090 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
90091 :
90092 : // Iterate over the memory pools
90093 0 : bool done = false;
90094 0 : unsigned i=0;
90095 :
90096 : // find the first valid IR node, call visit function, and then leave
90097 0 : while ( done == false && i < SgOmpOrderedStatement::pools.size() )
90098 : {
90099 : // objectArray[i] is a single memory pool
90100 : unsigned j=0;
90101 0 : while (done == false && j < SgOmpOrderedStatement::pool_size)
90102 : {
90103 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
90104 : {
90105 0 : traversal.visit(&(objectArray[i][j]));
90106 0 : done = true;
90107 : }
90108 0 : j++;
90109 : }
90110 0 : i++;
90111 : }
90112 :
90113 : #if 0
90114 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
90115 : if (done == false)
90116 : {
90117 : printf ("No representative for SgOmpOrderedStatement found in memory pools \n");
90118 : }
90119 : #endif
90120 : }
90121 0 : }
90122 :
90123 :
90124 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
90125 : // using values that overflow signed values of int.
90126 : size_t
90127 4 : SgOmpOrderedStatement::numberOfNodes()
90128 : {
90129 : // This function traverses the memory pool for an IR node and
90130 : // counts the number of IR nodes of a particular Sage III IR
90131 : // nodes type.
90132 :
90133 4 : size_t count = 0;
90134 4 : if (SgOmpOrderedStatement::pools.empty() == false)
90135 : {
90136 : // Generate an array of memory pools (this is actually a STL vector,
90137 : // but it is contiguious, so OK to treat this way).
90138 0 : SgOmpOrderedStatement** objectArray = (SgOmpOrderedStatement**) &(SgOmpOrderedStatement::pools[0]);
90139 :
90140 : // Build a local variable for better performance (make it a loop invariant variable).
90141 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
90142 :
90143 : // Iterate over all of the memory pools for this IR node.
90144 0 : for (unsigned int i=0; i < SgOmpOrderedStatement::pools.size(); i++)
90145 : {
90146 : // objectArray[i] is a single memory pool, iterate over all the
90147 : // IR nodes and only count those that are valid IR nodes used in
90148 : // the AST (i.e. allocated IR nodes).
90149 0 : for (unsigned j=0; j < SgOmpOrderedStatement::pool_size; j++)
90150 : {
90151 : // This is indexing the STL vector of C/C++ style arrays as a doubly
90152 : // indexed array access. It is OK since we have leveraged the semantics
90153 : // of STL vector memory as contigous and cast the memory as an array
90154 : // of arrays to use the 2D array indexing. Hope this is not confusing,
90155 : // but it s very fast as an implementation.
90156 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
90157 : {
90158 0 : count++;
90159 : }
90160 : }
90161 : }
90162 : }
90163 :
90164 :
90165 :
90166 4 : return count;
90167 : }
90168 :
90169 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
90170 : // using values that overflow signed values of int.
90171 : size_t
90172 0 : SgOmpOrderedStatement::memoryUsage()
90173 : {
90174 : // This function is required because we need the class name as a type when we call sizeof
90175 : // There might be another way to implement this if we have a traversal that only called a
90176 : // representative object (one call for each type of Sage IIIIR node).
90177 0 : size_t memory = numberOfNodes() * sizeof(SgOmpOrderedStatement);
90178 :
90179 0 : return memory;
90180 : }
90181 :
90182 : /* #line 90183 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
90183 :
90184 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
90185 : void
90186 5342 : SgOmpTaskgroupStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
90187 : {
90188 : // This function traverses the memory pool for only a specific IR node
90189 : // and calls the visit function of the input class execute a traversal
90190 : // similar to the style of the attribute based traversals within ROSE.
90191 : // This traversal will visit ALL nodes of the AST where as the other
90192 : // attribute based traversals visit only the embedded tree within the AST.
90193 :
90194 : // Initialize array to the address of the first element of the STL vector
90195 : // (which is guaranteed to be contiguous storage).
90196 : // SgOmpTaskgroupStatement objectArray [] = *(Memory_Block_List.begin());
90197 5342 : if (SgOmpTaskgroupStatement::pools.empty() == false)
90198 : {
90199 : // Generate an array of memory pools
90200 14 : SgOmpTaskgroupStatement** objectArray = (SgOmpTaskgroupStatement**) &(SgOmpTaskgroupStatement::pools[0]);
90201 :
90202 : // Build a local variable for better performance
90203 14 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
90204 : #if 0
90205 : // Iterate over the memory pools
90206 : for (unsigned int i=0; i < SgOmpTaskgroupStatement::pools.size(); i++)
90207 : {
90208 : // objectArray[i] is a single memory pool
90209 : for (int j=0; j < SgOmpTaskgroupStatement::pool_size; j++)
90210 : {
90211 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
90212 : {
90213 : traversal.visit(&(objectArray[i][j]));
90214 : }
90215 : }
90216 : }
90217 : #else
90218 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
90219 : // compute the list first and then call the visit function on each list element.
90220 :
90221 : // printf ("Inside of SgOmpTaskgroupStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
90222 :
90223 28 : std::vector<SgOmpTaskgroupStatement*> nodeList;
90224 :
90225 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
90226 28 : for (unsigned int i=0; i < SgOmpTaskgroupStatement::pools.size(); i++)
90227 : {
90228 : // objectArray[i] is a single memory pool
90229 28014 : for (unsigned j=0; j < SgOmpTaskgroupStatement::pool_size; j++)
90230 : {
90231 28000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
90232 : {
90233 14 : nodeList.push_back(&(objectArray[i][j]));
90234 : }
90235 : }
90236 : }
90237 :
90238 : // Iterate over the saved list
90239 14 : size_t nodeListSize = nodeList.size();
90240 28 : for (size_t i=0; i < nodeListSize; i++)
90241 : {
90242 14 : ROSE_ASSERT(nodeList[i] != NULL);
90243 : #if 0
90244 : traversal.visit(nodeList[i]);
90245 : #else
90246 14 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
90247 : {
90248 14 : traversal.visit(nodeList[i]);
90249 : }
90250 : #endif
90251 : }
90252 : #endif
90253 : }
90254 :
90255 : // This should not be required since all previously static data members are
90256 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
90257 :
90258 5342 : }
90259 :
90260 :
90261 : void
90262 194 : SgOmpTaskgroupStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
90263 : {
90264 : // This function traverses the memory pool for an IR node and
90265 : // calls the function to execute the visitor object.
90266 :
90267 : // Initialize array to the address of the first element of the STL vector
90268 : // (which is guarenteed to be contiguous storage).
90269 : // SgOmpTaskgroupStatement objectArray [] = *(Memory_Block_List.begin());
90270 194 : if (SgOmpTaskgroupStatement::pools.empty() == false)
90271 : {
90272 : // Generate an array of memory pools
90273 0 : SgOmpTaskgroupStatement** objectArray = (SgOmpTaskgroupStatement**) &(SgOmpTaskgroupStatement::pools[0]);
90274 :
90275 : // Build a local variable for better performance
90276 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
90277 :
90278 : // Iterate over the memory pools
90279 0 : for (unsigned int i=0; i < SgOmpTaskgroupStatement::pools.size(); i++)
90280 : {
90281 : // objectArray[i] is a single memory pool
90282 0 : for (unsigned j=0; j < SgOmpTaskgroupStatement::pool_size; j++)
90283 : {
90284 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
90285 : {
90286 : // printf ("Found a valid SgOmpTaskgroupStatement object in the memory pool %d at position %d \n",i,j);
90287 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
90288 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
90289 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
90290 : }
90291 : else
90292 : {
90293 : // printf ("Found a INVALID SgOmpTaskgroupStatement object in the memory pool \n");
90294 : }
90295 : }
90296 : }
90297 : }
90298 :
90299 : // This should not be required since all previously static data members are
90300 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
90301 :
90302 194 : }
90303 :
90304 : void
90305 0 : SgOmpTaskgroupStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
90306 : {
90307 : // This function visits only a single IR node of the memory pool.
90308 : // it is typically called once for each type of IR node within
90309 : // the automatically generated function: traverseRepresentativeNodes().
90310 :
90311 : // Initialize array to the address of the first element of the STL vector
90312 : // (which is guarenteed to be contiguous storage).
90313 : // SgOmpTaskgroupStatement objectArray [] = *(Memory_Block_List.begin());
90314 0 : if (SgOmpTaskgroupStatement::pools.empty() == false)
90315 : {
90316 : // Generate an array of memory pools
90317 0 : SgOmpTaskgroupStatement** objectArray = (SgOmpTaskgroupStatement**) &(SgOmpTaskgroupStatement::pools[0]);
90318 :
90319 : // Build a local variable for better performance
90320 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
90321 :
90322 : // Iterate over the memory pools
90323 0 : bool done = false;
90324 0 : unsigned i=0;
90325 :
90326 : // find the first valid IR node, call visit function, and then leave
90327 0 : while ( done == false && i < SgOmpTaskgroupStatement::pools.size() )
90328 : {
90329 : // objectArray[i] is a single memory pool
90330 : unsigned j=0;
90331 0 : while (done == false && j < SgOmpTaskgroupStatement::pool_size)
90332 : {
90333 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
90334 : {
90335 0 : traversal.visit(&(objectArray[i][j]));
90336 0 : done = true;
90337 : }
90338 0 : j++;
90339 : }
90340 0 : i++;
90341 : }
90342 :
90343 : #if 0
90344 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
90345 : if (done == false)
90346 : {
90347 : printf ("No representative for SgOmpTaskgroupStatement found in memory pools \n");
90348 : }
90349 : #endif
90350 : }
90351 0 : }
90352 :
90353 :
90354 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
90355 : // using values that overflow signed values of int.
90356 : size_t
90357 4 : SgOmpTaskgroupStatement::numberOfNodes()
90358 : {
90359 : // This function traverses the memory pool for an IR node and
90360 : // counts the number of IR nodes of a particular Sage III IR
90361 : // nodes type.
90362 :
90363 4 : size_t count = 0;
90364 4 : if (SgOmpTaskgroupStatement::pools.empty() == false)
90365 : {
90366 : // Generate an array of memory pools (this is actually a STL vector,
90367 : // but it is contiguious, so OK to treat this way).
90368 0 : SgOmpTaskgroupStatement** objectArray = (SgOmpTaskgroupStatement**) &(SgOmpTaskgroupStatement::pools[0]);
90369 :
90370 : // Build a local variable for better performance (make it a loop invariant variable).
90371 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
90372 :
90373 : // Iterate over all of the memory pools for this IR node.
90374 0 : for (unsigned int i=0; i < SgOmpTaskgroupStatement::pools.size(); i++)
90375 : {
90376 : // objectArray[i] is a single memory pool, iterate over all the
90377 : // IR nodes and only count those that are valid IR nodes used in
90378 : // the AST (i.e. allocated IR nodes).
90379 0 : for (unsigned j=0; j < SgOmpTaskgroupStatement::pool_size; j++)
90380 : {
90381 : // This is indexing the STL vector of C/C++ style arrays as a doubly
90382 : // indexed array access. It is OK since we have leveraged the semantics
90383 : // of STL vector memory as contigous and cast the memory as an array
90384 : // of arrays to use the 2D array indexing. Hope this is not confusing,
90385 : // but it s very fast as an implementation.
90386 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
90387 : {
90388 0 : count++;
90389 : }
90390 : }
90391 : }
90392 : }
90393 :
90394 :
90395 :
90396 4 : return count;
90397 : }
90398 :
90399 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
90400 : // using values that overflow signed values of int.
90401 : size_t
90402 0 : SgOmpTaskgroupStatement::memoryUsage()
90403 : {
90404 : // This function is required because we need the class name as a type when we call sizeof
90405 : // There might be another way to implement this if we have a traversal that only called a
90406 : // representative object (one call for each type of Sage IIIIR node).
90407 0 : size_t memory = numberOfNodes() * sizeof(SgOmpTaskgroupStatement);
90408 :
90409 0 : return memory;
90410 : }
90411 :
90412 : /* #line 90413 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
90413 :
90414 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
90415 : void
90416 5342 : SgOmpTaskloopStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
90417 : {
90418 : // This function traverses the memory pool for only a specific IR node
90419 : // and calls the visit function of the input class execute a traversal
90420 : // similar to the style of the attribute based traversals within ROSE.
90421 : // This traversal will visit ALL nodes of the AST where as the other
90422 : // attribute based traversals visit only the embedded tree within the AST.
90423 :
90424 : // Initialize array to the address of the first element of the STL vector
90425 : // (which is guaranteed to be contiguous storage).
90426 : // SgOmpTaskloopStatement objectArray [] = *(Memory_Block_List.begin());
90427 5342 : if (SgOmpTaskloopStatement::pools.empty() == false)
90428 : {
90429 : // Generate an array of memory pools
90430 14 : SgOmpTaskloopStatement** objectArray = (SgOmpTaskloopStatement**) &(SgOmpTaskloopStatement::pools[0]);
90431 :
90432 : // Build a local variable for better performance
90433 14 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
90434 : #if 0
90435 : // Iterate over the memory pools
90436 : for (unsigned int i=0; i < SgOmpTaskloopStatement::pools.size(); i++)
90437 : {
90438 : // objectArray[i] is a single memory pool
90439 : for (int j=0; j < SgOmpTaskloopStatement::pool_size; j++)
90440 : {
90441 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
90442 : {
90443 : traversal.visit(&(objectArray[i][j]));
90444 : }
90445 : }
90446 : }
90447 : #else
90448 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
90449 : // compute the list first and then call the visit function on each list element.
90450 :
90451 : // printf ("Inside of SgOmpTaskloopStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
90452 :
90453 28 : std::vector<SgOmpTaskloopStatement*> nodeList;
90454 :
90455 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
90456 28 : for (unsigned int i=0; i < SgOmpTaskloopStatement::pools.size(); i++)
90457 : {
90458 : // objectArray[i] is a single memory pool
90459 28014 : for (unsigned j=0; j < SgOmpTaskloopStatement::pool_size; j++)
90460 : {
90461 28000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
90462 : {
90463 14 : nodeList.push_back(&(objectArray[i][j]));
90464 : }
90465 : }
90466 : }
90467 :
90468 : // Iterate over the saved list
90469 14 : size_t nodeListSize = nodeList.size();
90470 28 : for (size_t i=0; i < nodeListSize; i++)
90471 : {
90472 14 : ROSE_ASSERT(nodeList[i] != NULL);
90473 : #if 0
90474 : traversal.visit(nodeList[i]);
90475 : #else
90476 14 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
90477 : {
90478 14 : traversal.visit(nodeList[i]);
90479 : }
90480 : #endif
90481 : }
90482 : #endif
90483 : }
90484 :
90485 : // This should not be required since all previously static data members are
90486 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
90487 :
90488 5342 : }
90489 :
90490 :
90491 : void
90492 194 : SgOmpTaskloopStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
90493 : {
90494 : // This function traverses the memory pool for an IR node and
90495 : // calls the function to execute the visitor object.
90496 :
90497 : // Initialize array to the address of the first element of the STL vector
90498 : // (which is guarenteed to be contiguous storage).
90499 : // SgOmpTaskloopStatement objectArray [] = *(Memory_Block_List.begin());
90500 194 : if (SgOmpTaskloopStatement::pools.empty() == false)
90501 : {
90502 : // Generate an array of memory pools
90503 0 : SgOmpTaskloopStatement** objectArray = (SgOmpTaskloopStatement**) &(SgOmpTaskloopStatement::pools[0]);
90504 :
90505 : // Build a local variable for better performance
90506 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
90507 :
90508 : // Iterate over the memory pools
90509 0 : for (unsigned int i=0; i < SgOmpTaskloopStatement::pools.size(); i++)
90510 : {
90511 : // objectArray[i] is a single memory pool
90512 0 : for (unsigned j=0; j < SgOmpTaskloopStatement::pool_size; j++)
90513 : {
90514 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
90515 : {
90516 : // printf ("Found a valid SgOmpTaskloopStatement object in the memory pool %d at position %d \n",i,j);
90517 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
90518 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
90519 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
90520 : }
90521 : else
90522 : {
90523 : // printf ("Found a INVALID SgOmpTaskloopStatement object in the memory pool \n");
90524 : }
90525 : }
90526 : }
90527 : }
90528 :
90529 : // This should not be required since all previously static data members are
90530 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
90531 :
90532 194 : }
90533 :
90534 : void
90535 0 : SgOmpTaskloopStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
90536 : {
90537 : // This function visits only a single IR node of the memory pool.
90538 : // it is typically called once for each type of IR node within
90539 : // the automatically generated function: traverseRepresentativeNodes().
90540 :
90541 : // Initialize array to the address of the first element of the STL vector
90542 : // (which is guarenteed to be contiguous storage).
90543 : // SgOmpTaskloopStatement objectArray [] = *(Memory_Block_List.begin());
90544 0 : if (SgOmpTaskloopStatement::pools.empty() == false)
90545 : {
90546 : // Generate an array of memory pools
90547 0 : SgOmpTaskloopStatement** objectArray = (SgOmpTaskloopStatement**) &(SgOmpTaskloopStatement::pools[0]);
90548 :
90549 : // Build a local variable for better performance
90550 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
90551 :
90552 : // Iterate over the memory pools
90553 0 : bool done = false;
90554 0 : unsigned i=0;
90555 :
90556 : // find the first valid IR node, call visit function, and then leave
90557 0 : while ( done == false && i < SgOmpTaskloopStatement::pools.size() )
90558 : {
90559 : // objectArray[i] is a single memory pool
90560 : unsigned j=0;
90561 0 : while (done == false && j < SgOmpTaskloopStatement::pool_size)
90562 : {
90563 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
90564 : {
90565 0 : traversal.visit(&(objectArray[i][j]));
90566 0 : done = true;
90567 : }
90568 0 : j++;
90569 : }
90570 0 : i++;
90571 : }
90572 :
90573 : #if 0
90574 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
90575 : if (done == false)
90576 : {
90577 : printf ("No representative for SgOmpTaskloopStatement found in memory pools \n");
90578 : }
90579 : #endif
90580 : }
90581 0 : }
90582 :
90583 :
90584 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
90585 : // using values that overflow signed values of int.
90586 : size_t
90587 4 : SgOmpTaskloopStatement::numberOfNodes()
90588 : {
90589 : // This function traverses the memory pool for an IR node and
90590 : // counts the number of IR nodes of a particular Sage III IR
90591 : // nodes type.
90592 :
90593 4 : size_t count = 0;
90594 4 : if (SgOmpTaskloopStatement::pools.empty() == false)
90595 : {
90596 : // Generate an array of memory pools (this is actually a STL vector,
90597 : // but it is contiguious, so OK to treat this way).
90598 0 : SgOmpTaskloopStatement** objectArray = (SgOmpTaskloopStatement**) &(SgOmpTaskloopStatement::pools[0]);
90599 :
90600 : // Build a local variable for better performance (make it a loop invariant variable).
90601 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
90602 :
90603 : // Iterate over all of the memory pools for this IR node.
90604 0 : for (unsigned int i=0; i < SgOmpTaskloopStatement::pools.size(); i++)
90605 : {
90606 : // objectArray[i] is a single memory pool, iterate over all the
90607 : // IR nodes and only count those that are valid IR nodes used in
90608 : // the AST (i.e. allocated IR nodes).
90609 0 : for (unsigned j=0; j < SgOmpTaskloopStatement::pool_size; j++)
90610 : {
90611 : // This is indexing the STL vector of C/C++ style arrays as a doubly
90612 : // indexed array access. It is OK since we have leveraged the semantics
90613 : // of STL vector memory as contigous and cast the memory as an array
90614 : // of arrays to use the 2D array indexing. Hope this is not confusing,
90615 : // but it s very fast as an implementation.
90616 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
90617 : {
90618 0 : count++;
90619 : }
90620 : }
90621 : }
90622 : }
90623 :
90624 :
90625 :
90626 4 : return count;
90627 : }
90628 :
90629 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
90630 : // using values that overflow signed values of int.
90631 : size_t
90632 0 : SgOmpTaskloopStatement::memoryUsage()
90633 : {
90634 : // This function is required because we need the class name as a type when we call sizeof
90635 : // There might be another way to implement this if we have a traversal that only called a
90636 : // representative object (one call for each type of Sage IIIIR node).
90637 0 : size_t memory = numberOfNodes() * sizeof(SgOmpTaskloopStatement);
90638 :
90639 0 : return memory;
90640 : }
90641 :
90642 : /* #line 90643 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
90643 :
90644 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
90645 : void
90646 5342 : SgOmpDepobjStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
90647 : {
90648 : // This function traverses the memory pool for only a specific IR node
90649 : // and calls the visit function of the input class execute a traversal
90650 : // similar to the style of the attribute based traversals within ROSE.
90651 : // This traversal will visit ALL nodes of the AST where as the other
90652 : // attribute based traversals visit only the embedded tree within the AST.
90653 :
90654 : // Initialize array to the address of the first element of the STL vector
90655 : // (which is guaranteed to be contiguous storage).
90656 : // SgOmpDepobjStatement objectArray [] = *(Memory_Block_List.begin());
90657 5342 : if (SgOmpDepobjStatement::pools.empty() == false)
90658 : {
90659 : // Generate an array of memory pools
90660 7 : SgOmpDepobjStatement** objectArray = (SgOmpDepobjStatement**) &(SgOmpDepobjStatement::pools[0]);
90661 :
90662 : // Build a local variable for better performance
90663 7 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
90664 : #if 0
90665 : // Iterate over the memory pools
90666 : for (unsigned int i=0; i < SgOmpDepobjStatement::pools.size(); i++)
90667 : {
90668 : // objectArray[i] is a single memory pool
90669 : for (int j=0; j < SgOmpDepobjStatement::pool_size; j++)
90670 : {
90671 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
90672 : {
90673 : traversal.visit(&(objectArray[i][j]));
90674 : }
90675 : }
90676 : }
90677 : #else
90678 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
90679 : // compute the list first and then call the visit function on each list element.
90680 :
90681 : // printf ("Inside of SgOmpDepobjStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
90682 :
90683 14 : std::vector<SgOmpDepobjStatement*> nodeList;
90684 :
90685 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
90686 14 : for (unsigned int i=0; i < SgOmpDepobjStatement::pools.size(); i++)
90687 : {
90688 : // objectArray[i] is a single memory pool
90689 14007 : for (unsigned j=0; j < SgOmpDepobjStatement::pool_size; j++)
90690 : {
90691 14000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
90692 : {
90693 21 : nodeList.push_back(&(objectArray[i][j]));
90694 : }
90695 : }
90696 : }
90697 :
90698 : // Iterate over the saved list
90699 7 : size_t nodeListSize = nodeList.size();
90700 28 : for (size_t i=0; i < nodeListSize; i++)
90701 : {
90702 21 : ROSE_ASSERT(nodeList[i] != NULL);
90703 : #if 0
90704 : traversal.visit(nodeList[i]);
90705 : #else
90706 21 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
90707 : {
90708 21 : traversal.visit(nodeList[i]);
90709 : }
90710 : #endif
90711 : }
90712 : #endif
90713 : }
90714 :
90715 : // This should not be required since all previously static data members are
90716 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
90717 :
90718 5342 : }
90719 :
90720 :
90721 : void
90722 194 : SgOmpDepobjStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
90723 : {
90724 : // This function traverses the memory pool for an IR node and
90725 : // calls the function to execute the visitor object.
90726 :
90727 : // Initialize array to the address of the first element of the STL vector
90728 : // (which is guarenteed to be contiguous storage).
90729 : // SgOmpDepobjStatement objectArray [] = *(Memory_Block_List.begin());
90730 194 : if (SgOmpDepobjStatement::pools.empty() == false)
90731 : {
90732 : // Generate an array of memory pools
90733 0 : SgOmpDepobjStatement** objectArray = (SgOmpDepobjStatement**) &(SgOmpDepobjStatement::pools[0]);
90734 :
90735 : // Build a local variable for better performance
90736 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
90737 :
90738 : // Iterate over the memory pools
90739 0 : for (unsigned int i=0; i < SgOmpDepobjStatement::pools.size(); i++)
90740 : {
90741 : // objectArray[i] is a single memory pool
90742 0 : for (unsigned j=0; j < SgOmpDepobjStatement::pool_size; j++)
90743 : {
90744 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
90745 : {
90746 : // printf ("Found a valid SgOmpDepobjStatement object in the memory pool %d at position %d \n",i,j);
90747 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
90748 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
90749 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
90750 : }
90751 : else
90752 : {
90753 : // printf ("Found a INVALID SgOmpDepobjStatement object in the memory pool \n");
90754 : }
90755 : }
90756 : }
90757 : }
90758 :
90759 : // This should not be required since all previously static data members are
90760 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
90761 :
90762 194 : }
90763 :
90764 : void
90765 0 : SgOmpDepobjStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
90766 : {
90767 : // This function visits only a single IR node of the memory pool.
90768 : // it is typically called once for each type of IR node within
90769 : // the automatically generated function: traverseRepresentativeNodes().
90770 :
90771 : // Initialize array to the address of the first element of the STL vector
90772 : // (which is guarenteed to be contiguous storage).
90773 : // SgOmpDepobjStatement objectArray [] = *(Memory_Block_List.begin());
90774 0 : if (SgOmpDepobjStatement::pools.empty() == false)
90775 : {
90776 : // Generate an array of memory pools
90777 0 : SgOmpDepobjStatement** objectArray = (SgOmpDepobjStatement**) &(SgOmpDepobjStatement::pools[0]);
90778 :
90779 : // Build a local variable for better performance
90780 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
90781 :
90782 : // Iterate over the memory pools
90783 0 : bool done = false;
90784 0 : unsigned i=0;
90785 :
90786 : // find the first valid IR node, call visit function, and then leave
90787 0 : while ( done == false && i < SgOmpDepobjStatement::pools.size() )
90788 : {
90789 : // objectArray[i] is a single memory pool
90790 : unsigned j=0;
90791 0 : while (done == false && j < SgOmpDepobjStatement::pool_size)
90792 : {
90793 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
90794 : {
90795 0 : traversal.visit(&(objectArray[i][j]));
90796 0 : done = true;
90797 : }
90798 0 : j++;
90799 : }
90800 0 : i++;
90801 : }
90802 :
90803 : #if 0
90804 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
90805 : if (done == false)
90806 : {
90807 : printf ("No representative for SgOmpDepobjStatement found in memory pools \n");
90808 : }
90809 : #endif
90810 : }
90811 0 : }
90812 :
90813 :
90814 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
90815 : // using values that overflow signed values of int.
90816 : size_t
90817 4 : SgOmpDepobjStatement::numberOfNodes()
90818 : {
90819 : // This function traverses the memory pool for an IR node and
90820 : // counts the number of IR nodes of a particular Sage III IR
90821 : // nodes type.
90822 :
90823 4 : size_t count = 0;
90824 4 : if (SgOmpDepobjStatement::pools.empty() == false)
90825 : {
90826 : // Generate an array of memory pools (this is actually a STL vector,
90827 : // but it is contiguious, so OK to treat this way).
90828 0 : SgOmpDepobjStatement** objectArray = (SgOmpDepobjStatement**) &(SgOmpDepobjStatement::pools[0]);
90829 :
90830 : // Build a local variable for better performance (make it a loop invariant variable).
90831 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
90832 :
90833 : // Iterate over all of the memory pools for this IR node.
90834 0 : for (unsigned int i=0; i < SgOmpDepobjStatement::pools.size(); i++)
90835 : {
90836 : // objectArray[i] is a single memory pool, iterate over all the
90837 : // IR nodes and only count those that are valid IR nodes used in
90838 : // the AST (i.e. allocated IR nodes).
90839 0 : for (unsigned j=0; j < SgOmpDepobjStatement::pool_size; j++)
90840 : {
90841 : // This is indexing the STL vector of C/C++ style arrays as a doubly
90842 : // indexed array access. It is OK since we have leveraged the semantics
90843 : // of STL vector memory as contigous and cast the memory as an array
90844 : // of arrays to use the 2D array indexing. Hope this is not confusing,
90845 : // but it s very fast as an implementation.
90846 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
90847 : {
90848 0 : count++;
90849 : }
90850 : }
90851 : }
90852 : }
90853 :
90854 :
90855 :
90856 4 : return count;
90857 : }
90858 :
90859 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
90860 : // using values that overflow signed values of int.
90861 : size_t
90862 0 : SgOmpDepobjStatement::memoryUsage()
90863 : {
90864 : // This function is required because we need the class name as a type when we call sizeof
90865 : // There might be another way to implement this if we have a traversal that only called a
90866 : // representative object (one call for each type of Sage IIIIR node).
90867 0 : size_t memory = numberOfNodes() * sizeof(SgOmpDepobjStatement);
90868 :
90869 0 : return memory;
90870 : }
90871 :
90872 : /* #line 90873 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
90873 :
90874 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
90875 : void
90876 5342 : SgOmpTargetEnterDataStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
90877 : {
90878 : // This function traverses the memory pool for only a specific IR node
90879 : // and calls the visit function of the input class execute a traversal
90880 : // similar to the style of the attribute based traversals within ROSE.
90881 : // This traversal will visit ALL nodes of the AST where as the other
90882 : // attribute based traversals visit only the embedded tree within the AST.
90883 :
90884 : // Initialize array to the address of the first element of the STL vector
90885 : // (which is guaranteed to be contiguous storage).
90886 : // SgOmpTargetEnterDataStatement objectArray [] = *(Memory_Block_List.begin());
90887 5342 : if (SgOmpTargetEnterDataStatement::pools.empty() == false)
90888 : {
90889 : // Generate an array of memory pools
90890 0 : SgOmpTargetEnterDataStatement** objectArray = (SgOmpTargetEnterDataStatement**) &(SgOmpTargetEnterDataStatement::pools[0]);
90891 :
90892 : // Build a local variable for better performance
90893 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
90894 : #if 0
90895 : // Iterate over the memory pools
90896 : for (unsigned int i=0; i < SgOmpTargetEnterDataStatement::pools.size(); i++)
90897 : {
90898 : // objectArray[i] is a single memory pool
90899 : for (int j=0; j < SgOmpTargetEnterDataStatement::pool_size; j++)
90900 : {
90901 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
90902 : {
90903 : traversal.visit(&(objectArray[i][j]));
90904 : }
90905 : }
90906 : }
90907 : #else
90908 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
90909 : // compute the list first and then call the visit function on each list element.
90910 :
90911 : // printf ("Inside of SgOmpTargetEnterDataStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
90912 :
90913 0 : std::vector<SgOmpTargetEnterDataStatement*> nodeList;
90914 :
90915 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
90916 0 : for (unsigned int i=0; i < SgOmpTargetEnterDataStatement::pools.size(); i++)
90917 : {
90918 : // objectArray[i] is a single memory pool
90919 0 : for (unsigned j=0; j < SgOmpTargetEnterDataStatement::pool_size; j++)
90920 : {
90921 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
90922 : {
90923 0 : nodeList.push_back(&(objectArray[i][j]));
90924 : }
90925 : }
90926 : }
90927 :
90928 : // Iterate over the saved list
90929 0 : size_t nodeListSize = nodeList.size();
90930 0 : for (size_t i=0; i < nodeListSize; i++)
90931 : {
90932 0 : ROSE_ASSERT(nodeList[i] != NULL);
90933 : #if 0
90934 : traversal.visit(nodeList[i]);
90935 : #else
90936 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
90937 : {
90938 0 : traversal.visit(nodeList[i]);
90939 : }
90940 : #endif
90941 : }
90942 : #endif
90943 : }
90944 :
90945 : // This should not be required since all previously static data members are
90946 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
90947 :
90948 5342 : }
90949 :
90950 :
90951 : void
90952 194 : SgOmpTargetEnterDataStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
90953 : {
90954 : // This function traverses the memory pool for an IR node and
90955 : // calls the function to execute the visitor object.
90956 :
90957 : // Initialize array to the address of the first element of the STL vector
90958 : // (which is guarenteed to be contiguous storage).
90959 : // SgOmpTargetEnterDataStatement objectArray [] = *(Memory_Block_List.begin());
90960 194 : if (SgOmpTargetEnterDataStatement::pools.empty() == false)
90961 : {
90962 : // Generate an array of memory pools
90963 0 : SgOmpTargetEnterDataStatement** objectArray = (SgOmpTargetEnterDataStatement**) &(SgOmpTargetEnterDataStatement::pools[0]);
90964 :
90965 : // Build a local variable for better performance
90966 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
90967 :
90968 : // Iterate over the memory pools
90969 0 : for (unsigned int i=0; i < SgOmpTargetEnterDataStatement::pools.size(); i++)
90970 : {
90971 : // objectArray[i] is a single memory pool
90972 0 : for (unsigned j=0; j < SgOmpTargetEnterDataStatement::pool_size; j++)
90973 : {
90974 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
90975 : {
90976 : // printf ("Found a valid SgOmpTargetEnterDataStatement object in the memory pool %d at position %d \n",i,j);
90977 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
90978 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
90979 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
90980 : }
90981 : else
90982 : {
90983 : // printf ("Found a INVALID SgOmpTargetEnterDataStatement object in the memory pool \n");
90984 : }
90985 : }
90986 : }
90987 : }
90988 :
90989 : // This should not be required since all previously static data members are
90990 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
90991 :
90992 194 : }
90993 :
90994 : void
90995 0 : SgOmpTargetEnterDataStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
90996 : {
90997 : // This function visits only a single IR node of the memory pool.
90998 : // it is typically called once for each type of IR node within
90999 : // the automatically generated function: traverseRepresentativeNodes().
91000 :
91001 : // Initialize array to the address of the first element of the STL vector
91002 : // (which is guarenteed to be contiguous storage).
91003 : // SgOmpTargetEnterDataStatement objectArray [] = *(Memory_Block_List.begin());
91004 0 : if (SgOmpTargetEnterDataStatement::pools.empty() == false)
91005 : {
91006 : // Generate an array of memory pools
91007 0 : SgOmpTargetEnterDataStatement** objectArray = (SgOmpTargetEnterDataStatement**) &(SgOmpTargetEnterDataStatement::pools[0]);
91008 :
91009 : // Build a local variable for better performance
91010 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
91011 :
91012 : // Iterate over the memory pools
91013 0 : bool done = false;
91014 0 : unsigned i=0;
91015 :
91016 : // find the first valid IR node, call visit function, and then leave
91017 0 : while ( done == false && i < SgOmpTargetEnterDataStatement::pools.size() )
91018 : {
91019 : // objectArray[i] is a single memory pool
91020 : unsigned j=0;
91021 0 : while (done == false && j < SgOmpTargetEnterDataStatement::pool_size)
91022 : {
91023 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
91024 : {
91025 0 : traversal.visit(&(objectArray[i][j]));
91026 0 : done = true;
91027 : }
91028 0 : j++;
91029 : }
91030 0 : i++;
91031 : }
91032 :
91033 : #if 0
91034 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
91035 : if (done == false)
91036 : {
91037 : printf ("No representative for SgOmpTargetEnterDataStatement found in memory pools \n");
91038 : }
91039 : #endif
91040 : }
91041 0 : }
91042 :
91043 :
91044 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
91045 : // using values that overflow signed values of int.
91046 : size_t
91047 4 : SgOmpTargetEnterDataStatement::numberOfNodes()
91048 : {
91049 : // This function traverses the memory pool for an IR node and
91050 : // counts the number of IR nodes of a particular Sage III IR
91051 : // nodes type.
91052 :
91053 4 : size_t count = 0;
91054 4 : if (SgOmpTargetEnterDataStatement::pools.empty() == false)
91055 : {
91056 : // Generate an array of memory pools (this is actually a STL vector,
91057 : // but it is contiguious, so OK to treat this way).
91058 0 : SgOmpTargetEnterDataStatement** objectArray = (SgOmpTargetEnterDataStatement**) &(SgOmpTargetEnterDataStatement::pools[0]);
91059 :
91060 : // Build a local variable for better performance (make it a loop invariant variable).
91061 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
91062 :
91063 : // Iterate over all of the memory pools for this IR node.
91064 0 : for (unsigned int i=0; i < SgOmpTargetEnterDataStatement::pools.size(); i++)
91065 : {
91066 : // objectArray[i] is a single memory pool, iterate over all the
91067 : // IR nodes and only count those that are valid IR nodes used in
91068 : // the AST (i.e. allocated IR nodes).
91069 0 : for (unsigned j=0; j < SgOmpTargetEnterDataStatement::pool_size; j++)
91070 : {
91071 : // This is indexing the STL vector of C/C++ style arrays as a doubly
91072 : // indexed array access. It is OK since we have leveraged the semantics
91073 : // of STL vector memory as contigous and cast the memory as an array
91074 : // of arrays to use the 2D array indexing. Hope this is not confusing,
91075 : // but it s very fast as an implementation.
91076 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
91077 : {
91078 0 : count++;
91079 : }
91080 : }
91081 : }
91082 : }
91083 :
91084 :
91085 :
91086 4 : return count;
91087 : }
91088 :
91089 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
91090 : // using values that overflow signed values of int.
91091 : size_t
91092 0 : SgOmpTargetEnterDataStatement::memoryUsage()
91093 : {
91094 : // This function is required because we need the class name as a type when we call sizeof
91095 : // There might be another way to implement this if we have a traversal that only called a
91096 : // representative object (one call for each type of Sage IIIIR node).
91097 0 : size_t memory = numberOfNodes() * sizeof(SgOmpTargetEnterDataStatement);
91098 :
91099 0 : return memory;
91100 : }
91101 :
91102 : /* #line 91103 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
91103 :
91104 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
91105 : void
91106 5342 : SgOmpTargetExitDataStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
91107 : {
91108 : // This function traverses the memory pool for only a specific IR node
91109 : // and calls the visit function of the input class execute a traversal
91110 : // similar to the style of the attribute based traversals within ROSE.
91111 : // This traversal will visit ALL nodes of the AST where as the other
91112 : // attribute based traversals visit only the embedded tree within the AST.
91113 :
91114 : // Initialize array to the address of the first element of the STL vector
91115 : // (which is guaranteed to be contiguous storage).
91116 : // SgOmpTargetExitDataStatement objectArray [] = *(Memory_Block_List.begin());
91117 5342 : if (SgOmpTargetExitDataStatement::pools.empty() == false)
91118 : {
91119 : // Generate an array of memory pools
91120 0 : SgOmpTargetExitDataStatement** objectArray = (SgOmpTargetExitDataStatement**) &(SgOmpTargetExitDataStatement::pools[0]);
91121 :
91122 : // Build a local variable for better performance
91123 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
91124 : #if 0
91125 : // Iterate over the memory pools
91126 : for (unsigned int i=0; i < SgOmpTargetExitDataStatement::pools.size(); i++)
91127 : {
91128 : // objectArray[i] is a single memory pool
91129 : for (int j=0; j < SgOmpTargetExitDataStatement::pool_size; j++)
91130 : {
91131 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
91132 : {
91133 : traversal.visit(&(objectArray[i][j]));
91134 : }
91135 : }
91136 : }
91137 : #else
91138 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
91139 : // compute the list first and then call the visit function on each list element.
91140 :
91141 : // printf ("Inside of SgOmpTargetExitDataStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
91142 :
91143 0 : std::vector<SgOmpTargetExitDataStatement*> nodeList;
91144 :
91145 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
91146 0 : for (unsigned int i=0; i < SgOmpTargetExitDataStatement::pools.size(); i++)
91147 : {
91148 : // objectArray[i] is a single memory pool
91149 0 : for (unsigned j=0; j < SgOmpTargetExitDataStatement::pool_size; j++)
91150 : {
91151 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
91152 : {
91153 0 : nodeList.push_back(&(objectArray[i][j]));
91154 : }
91155 : }
91156 : }
91157 :
91158 : // Iterate over the saved list
91159 0 : size_t nodeListSize = nodeList.size();
91160 0 : for (size_t i=0; i < nodeListSize; i++)
91161 : {
91162 0 : ROSE_ASSERT(nodeList[i] != NULL);
91163 : #if 0
91164 : traversal.visit(nodeList[i]);
91165 : #else
91166 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
91167 : {
91168 0 : traversal.visit(nodeList[i]);
91169 : }
91170 : #endif
91171 : }
91172 : #endif
91173 : }
91174 :
91175 : // This should not be required since all previously static data members are
91176 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
91177 :
91178 5342 : }
91179 :
91180 :
91181 : void
91182 194 : SgOmpTargetExitDataStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
91183 : {
91184 : // This function traverses the memory pool for an IR node and
91185 : // calls the function to execute the visitor object.
91186 :
91187 : // Initialize array to the address of the first element of the STL vector
91188 : // (which is guarenteed to be contiguous storage).
91189 : // SgOmpTargetExitDataStatement objectArray [] = *(Memory_Block_List.begin());
91190 194 : if (SgOmpTargetExitDataStatement::pools.empty() == false)
91191 : {
91192 : // Generate an array of memory pools
91193 0 : SgOmpTargetExitDataStatement** objectArray = (SgOmpTargetExitDataStatement**) &(SgOmpTargetExitDataStatement::pools[0]);
91194 :
91195 : // Build a local variable for better performance
91196 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
91197 :
91198 : // Iterate over the memory pools
91199 0 : for (unsigned int i=0; i < SgOmpTargetExitDataStatement::pools.size(); i++)
91200 : {
91201 : // objectArray[i] is a single memory pool
91202 0 : for (unsigned j=0; j < SgOmpTargetExitDataStatement::pool_size; j++)
91203 : {
91204 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
91205 : {
91206 : // printf ("Found a valid SgOmpTargetExitDataStatement object in the memory pool %d at position %d \n",i,j);
91207 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
91208 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
91209 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
91210 : }
91211 : else
91212 : {
91213 : // printf ("Found a INVALID SgOmpTargetExitDataStatement object in the memory pool \n");
91214 : }
91215 : }
91216 : }
91217 : }
91218 :
91219 : // This should not be required since all previously static data members are
91220 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
91221 :
91222 194 : }
91223 :
91224 : void
91225 0 : SgOmpTargetExitDataStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
91226 : {
91227 : // This function visits only a single IR node of the memory pool.
91228 : // it is typically called once for each type of IR node within
91229 : // the automatically generated function: traverseRepresentativeNodes().
91230 :
91231 : // Initialize array to the address of the first element of the STL vector
91232 : // (which is guarenteed to be contiguous storage).
91233 : // SgOmpTargetExitDataStatement objectArray [] = *(Memory_Block_List.begin());
91234 0 : if (SgOmpTargetExitDataStatement::pools.empty() == false)
91235 : {
91236 : // Generate an array of memory pools
91237 0 : SgOmpTargetExitDataStatement** objectArray = (SgOmpTargetExitDataStatement**) &(SgOmpTargetExitDataStatement::pools[0]);
91238 :
91239 : // Build a local variable for better performance
91240 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
91241 :
91242 : // Iterate over the memory pools
91243 0 : bool done = false;
91244 0 : unsigned i=0;
91245 :
91246 : // find the first valid IR node, call visit function, and then leave
91247 0 : while ( done == false && i < SgOmpTargetExitDataStatement::pools.size() )
91248 : {
91249 : // objectArray[i] is a single memory pool
91250 : unsigned j=0;
91251 0 : while (done == false && j < SgOmpTargetExitDataStatement::pool_size)
91252 : {
91253 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
91254 : {
91255 0 : traversal.visit(&(objectArray[i][j]));
91256 0 : done = true;
91257 : }
91258 0 : j++;
91259 : }
91260 0 : i++;
91261 : }
91262 :
91263 : #if 0
91264 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
91265 : if (done == false)
91266 : {
91267 : printf ("No representative for SgOmpTargetExitDataStatement found in memory pools \n");
91268 : }
91269 : #endif
91270 : }
91271 0 : }
91272 :
91273 :
91274 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
91275 : // using values that overflow signed values of int.
91276 : size_t
91277 4 : SgOmpTargetExitDataStatement::numberOfNodes()
91278 : {
91279 : // This function traverses the memory pool for an IR node and
91280 : // counts the number of IR nodes of a particular Sage III IR
91281 : // nodes type.
91282 :
91283 4 : size_t count = 0;
91284 4 : if (SgOmpTargetExitDataStatement::pools.empty() == false)
91285 : {
91286 : // Generate an array of memory pools (this is actually a STL vector,
91287 : // but it is contiguious, so OK to treat this way).
91288 0 : SgOmpTargetExitDataStatement** objectArray = (SgOmpTargetExitDataStatement**) &(SgOmpTargetExitDataStatement::pools[0]);
91289 :
91290 : // Build a local variable for better performance (make it a loop invariant variable).
91291 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
91292 :
91293 : // Iterate over all of the memory pools for this IR node.
91294 0 : for (unsigned int i=0; i < SgOmpTargetExitDataStatement::pools.size(); i++)
91295 : {
91296 : // objectArray[i] is a single memory pool, iterate over all the
91297 : // IR nodes and only count those that are valid IR nodes used in
91298 : // the AST (i.e. allocated IR nodes).
91299 0 : for (unsigned j=0; j < SgOmpTargetExitDataStatement::pool_size; j++)
91300 : {
91301 : // This is indexing the STL vector of C/C++ style arrays as a doubly
91302 : // indexed array access. It is OK since we have leveraged the semantics
91303 : // of STL vector memory as contigous and cast the memory as an array
91304 : // of arrays to use the 2D array indexing. Hope this is not confusing,
91305 : // but it s very fast as an implementation.
91306 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
91307 : {
91308 0 : count++;
91309 : }
91310 : }
91311 : }
91312 : }
91313 :
91314 :
91315 :
91316 4 : return count;
91317 : }
91318 :
91319 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
91320 : // using values that overflow signed values of int.
91321 : size_t
91322 0 : SgOmpTargetExitDataStatement::memoryUsage()
91323 : {
91324 : // This function is required because we need the class name as a type when we call sizeof
91325 : // There might be another way to implement this if we have a traversal that only called a
91326 : // representative object (one call for each type of Sage IIIIR node).
91327 0 : size_t memory = numberOfNodes() * sizeof(SgOmpTargetExitDataStatement);
91328 :
91329 0 : return memory;
91330 : }
91331 :
91332 : /* #line 91333 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
91333 :
91334 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
91335 : void
91336 5342 : SgOmpParallelMasterStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
91337 : {
91338 : // This function traverses the memory pool for only a specific IR node
91339 : // and calls the visit function of the input class execute a traversal
91340 : // similar to the style of the attribute based traversals within ROSE.
91341 : // This traversal will visit ALL nodes of the AST where as the other
91342 : // attribute based traversals visit only the embedded tree within the AST.
91343 :
91344 : // Initialize array to the address of the first element of the STL vector
91345 : // (which is guaranteed to be contiguous storage).
91346 : // SgOmpParallelMasterStatement objectArray [] = *(Memory_Block_List.begin());
91347 5342 : if (SgOmpParallelMasterStatement::pools.empty() == false)
91348 : {
91349 : // Generate an array of memory pools
91350 14 : SgOmpParallelMasterStatement** objectArray = (SgOmpParallelMasterStatement**) &(SgOmpParallelMasterStatement::pools[0]);
91351 :
91352 : // Build a local variable for better performance
91353 14 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
91354 : #if 0
91355 : // Iterate over the memory pools
91356 : for (unsigned int i=0; i < SgOmpParallelMasterStatement::pools.size(); i++)
91357 : {
91358 : // objectArray[i] is a single memory pool
91359 : for (int j=0; j < SgOmpParallelMasterStatement::pool_size; j++)
91360 : {
91361 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
91362 : {
91363 : traversal.visit(&(objectArray[i][j]));
91364 : }
91365 : }
91366 : }
91367 : #else
91368 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
91369 : // compute the list first and then call the visit function on each list element.
91370 :
91371 : // printf ("Inside of SgOmpParallelMasterStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
91372 :
91373 28 : std::vector<SgOmpParallelMasterStatement*> nodeList;
91374 :
91375 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
91376 28 : for (unsigned int i=0; i < SgOmpParallelMasterStatement::pools.size(); i++)
91377 : {
91378 : // objectArray[i] is a single memory pool
91379 28014 : for (unsigned j=0; j < SgOmpParallelMasterStatement::pool_size; j++)
91380 : {
91381 28000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
91382 : {
91383 21 : nodeList.push_back(&(objectArray[i][j]));
91384 : }
91385 : }
91386 : }
91387 :
91388 : // Iterate over the saved list
91389 14 : size_t nodeListSize = nodeList.size();
91390 35 : for (size_t i=0; i < nodeListSize; i++)
91391 : {
91392 21 : ROSE_ASSERT(nodeList[i] != NULL);
91393 : #if 0
91394 : traversal.visit(nodeList[i]);
91395 : #else
91396 21 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
91397 : {
91398 21 : traversal.visit(nodeList[i]);
91399 : }
91400 : #endif
91401 : }
91402 : #endif
91403 : }
91404 :
91405 : // This should not be required since all previously static data members are
91406 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
91407 :
91408 5342 : }
91409 :
91410 :
91411 : void
91412 194 : SgOmpParallelMasterStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
91413 : {
91414 : // This function traverses the memory pool for an IR node and
91415 : // calls the function to execute the visitor object.
91416 :
91417 : // Initialize array to the address of the first element of the STL vector
91418 : // (which is guarenteed to be contiguous storage).
91419 : // SgOmpParallelMasterStatement objectArray [] = *(Memory_Block_List.begin());
91420 194 : if (SgOmpParallelMasterStatement::pools.empty() == false)
91421 : {
91422 : // Generate an array of memory pools
91423 0 : SgOmpParallelMasterStatement** objectArray = (SgOmpParallelMasterStatement**) &(SgOmpParallelMasterStatement::pools[0]);
91424 :
91425 : // Build a local variable for better performance
91426 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
91427 :
91428 : // Iterate over the memory pools
91429 0 : for (unsigned int i=0; i < SgOmpParallelMasterStatement::pools.size(); i++)
91430 : {
91431 : // objectArray[i] is a single memory pool
91432 0 : for (unsigned j=0; j < SgOmpParallelMasterStatement::pool_size; j++)
91433 : {
91434 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
91435 : {
91436 : // printf ("Found a valid SgOmpParallelMasterStatement object in the memory pool %d at position %d \n",i,j);
91437 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
91438 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
91439 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
91440 : }
91441 : else
91442 : {
91443 : // printf ("Found a INVALID SgOmpParallelMasterStatement object in the memory pool \n");
91444 : }
91445 : }
91446 : }
91447 : }
91448 :
91449 : // This should not be required since all previously static data members are
91450 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
91451 :
91452 194 : }
91453 :
91454 : void
91455 0 : SgOmpParallelMasterStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
91456 : {
91457 : // This function visits only a single IR node of the memory pool.
91458 : // it is typically called once for each type of IR node within
91459 : // the automatically generated function: traverseRepresentativeNodes().
91460 :
91461 : // Initialize array to the address of the first element of the STL vector
91462 : // (which is guarenteed to be contiguous storage).
91463 : // SgOmpParallelMasterStatement objectArray [] = *(Memory_Block_List.begin());
91464 0 : if (SgOmpParallelMasterStatement::pools.empty() == false)
91465 : {
91466 : // Generate an array of memory pools
91467 0 : SgOmpParallelMasterStatement** objectArray = (SgOmpParallelMasterStatement**) &(SgOmpParallelMasterStatement::pools[0]);
91468 :
91469 : // Build a local variable for better performance
91470 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
91471 :
91472 : // Iterate over the memory pools
91473 0 : bool done = false;
91474 0 : unsigned i=0;
91475 :
91476 : // find the first valid IR node, call visit function, and then leave
91477 0 : while ( done == false && i < SgOmpParallelMasterStatement::pools.size() )
91478 : {
91479 : // objectArray[i] is a single memory pool
91480 : unsigned j=0;
91481 0 : while (done == false && j < SgOmpParallelMasterStatement::pool_size)
91482 : {
91483 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
91484 : {
91485 0 : traversal.visit(&(objectArray[i][j]));
91486 0 : done = true;
91487 : }
91488 0 : j++;
91489 : }
91490 0 : i++;
91491 : }
91492 :
91493 : #if 0
91494 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
91495 : if (done == false)
91496 : {
91497 : printf ("No representative for SgOmpParallelMasterStatement found in memory pools \n");
91498 : }
91499 : #endif
91500 : }
91501 0 : }
91502 :
91503 :
91504 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
91505 : // using values that overflow signed values of int.
91506 : size_t
91507 4 : SgOmpParallelMasterStatement::numberOfNodes()
91508 : {
91509 : // This function traverses the memory pool for an IR node and
91510 : // counts the number of IR nodes of a particular Sage III IR
91511 : // nodes type.
91512 :
91513 4 : size_t count = 0;
91514 4 : if (SgOmpParallelMasterStatement::pools.empty() == false)
91515 : {
91516 : // Generate an array of memory pools (this is actually a STL vector,
91517 : // but it is contiguious, so OK to treat this way).
91518 0 : SgOmpParallelMasterStatement** objectArray = (SgOmpParallelMasterStatement**) &(SgOmpParallelMasterStatement::pools[0]);
91519 :
91520 : // Build a local variable for better performance (make it a loop invariant variable).
91521 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
91522 :
91523 : // Iterate over all of the memory pools for this IR node.
91524 0 : for (unsigned int i=0; i < SgOmpParallelMasterStatement::pools.size(); i++)
91525 : {
91526 : // objectArray[i] is a single memory pool, iterate over all the
91527 : // IR nodes and only count those that are valid IR nodes used in
91528 : // the AST (i.e. allocated IR nodes).
91529 0 : for (unsigned j=0; j < SgOmpParallelMasterStatement::pool_size; j++)
91530 : {
91531 : // This is indexing the STL vector of C/C++ style arrays as a doubly
91532 : // indexed array access. It is OK since we have leveraged the semantics
91533 : // of STL vector memory as contigous and cast the memory as an array
91534 : // of arrays to use the 2D array indexing. Hope this is not confusing,
91535 : // but it s very fast as an implementation.
91536 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
91537 : {
91538 0 : count++;
91539 : }
91540 : }
91541 : }
91542 : }
91543 :
91544 :
91545 :
91546 4 : return count;
91547 : }
91548 :
91549 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
91550 : // using values that overflow signed values of int.
91551 : size_t
91552 0 : SgOmpParallelMasterStatement::memoryUsage()
91553 : {
91554 : // This function is required because we need the class name as a type when we call sizeof
91555 : // There might be another way to implement this if we have a traversal that only called a
91556 : // representative object (one call for each type of Sage IIIIR node).
91557 0 : size_t memory = numberOfNodes() * sizeof(SgOmpParallelMasterStatement);
91558 :
91559 0 : return memory;
91560 : }
91561 :
91562 : /* #line 91563 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
91563 :
91564 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
91565 : void
91566 5342 : SgOmpMasterTaskloopStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
91567 : {
91568 : // This function traverses the memory pool for only a specific IR node
91569 : // and calls the visit function of the input class execute a traversal
91570 : // similar to the style of the attribute based traversals within ROSE.
91571 : // This traversal will visit ALL nodes of the AST where as the other
91572 : // attribute based traversals visit only the embedded tree within the AST.
91573 :
91574 : // Initialize array to the address of the first element of the STL vector
91575 : // (which is guaranteed to be contiguous storage).
91576 : // SgOmpMasterTaskloopStatement objectArray [] = *(Memory_Block_List.begin());
91577 5342 : if (SgOmpMasterTaskloopStatement::pools.empty() == false)
91578 : {
91579 : // Generate an array of memory pools
91580 14 : SgOmpMasterTaskloopStatement** objectArray = (SgOmpMasterTaskloopStatement**) &(SgOmpMasterTaskloopStatement::pools[0]);
91581 :
91582 : // Build a local variable for better performance
91583 14 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
91584 : #if 0
91585 : // Iterate over the memory pools
91586 : for (unsigned int i=0; i < SgOmpMasterTaskloopStatement::pools.size(); i++)
91587 : {
91588 : // objectArray[i] is a single memory pool
91589 : for (int j=0; j < SgOmpMasterTaskloopStatement::pool_size; j++)
91590 : {
91591 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
91592 : {
91593 : traversal.visit(&(objectArray[i][j]));
91594 : }
91595 : }
91596 : }
91597 : #else
91598 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
91599 : // compute the list first and then call the visit function on each list element.
91600 :
91601 : // printf ("Inside of SgOmpMasterTaskloopStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
91602 :
91603 28 : std::vector<SgOmpMasterTaskloopStatement*> nodeList;
91604 :
91605 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
91606 28 : for (unsigned int i=0; i < SgOmpMasterTaskloopStatement::pools.size(); i++)
91607 : {
91608 : // objectArray[i] is a single memory pool
91609 28014 : for (unsigned j=0; j < SgOmpMasterTaskloopStatement::pool_size; j++)
91610 : {
91611 28000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
91612 : {
91613 14 : nodeList.push_back(&(objectArray[i][j]));
91614 : }
91615 : }
91616 : }
91617 :
91618 : // Iterate over the saved list
91619 14 : size_t nodeListSize = nodeList.size();
91620 28 : for (size_t i=0; i < nodeListSize; i++)
91621 : {
91622 14 : ROSE_ASSERT(nodeList[i] != NULL);
91623 : #if 0
91624 : traversal.visit(nodeList[i]);
91625 : #else
91626 14 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
91627 : {
91628 14 : traversal.visit(nodeList[i]);
91629 : }
91630 : #endif
91631 : }
91632 : #endif
91633 : }
91634 :
91635 : // This should not be required since all previously static data members are
91636 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
91637 :
91638 5342 : }
91639 :
91640 :
91641 : void
91642 194 : SgOmpMasterTaskloopStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
91643 : {
91644 : // This function traverses the memory pool for an IR node and
91645 : // calls the function to execute the visitor object.
91646 :
91647 : // Initialize array to the address of the first element of the STL vector
91648 : // (which is guarenteed to be contiguous storage).
91649 : // SgOmpMasterTaskloopStatement objectArray [] = *(Memory_Block_List.begin());
91650 194 : if (SgOmpMasterTaskloopStatement::pools.empty() == false)
91651 : {
91652 : // Generate an array of memory pools
91653 0 : SgOmpMasterTaskloopStatement** objectArray = (SgOmpMasterTaskloopStatement**) &(SgOmpMasterTaskloopStatement::pools[0]);
91654 :
91655 : // Build a local variable for better performance
91656 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
91657 :
91658 : // Iterate over the memory pools
91659 0 : for (unsigned int i=0; i < SgOmpMasterTaskloopStatement::pools.size(); i++)
91660 : {
91661 : // objectArray[i] is a single memory pool
91662 0 : for (unsigned j=0; j < SgOmpMasterTaskloopStatement::pool_size; j++)
91663 : {
91664 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
91665 : {
91666 : // printf ("Found a valid SgOmpMasterTaskloopStatement object in the memory pool %d at position %d \n",i,j);
91667 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
91668 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
91669 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
91670 : }
91671 : else
91672 : {
91673 : // printf ("Found a INVALID SgOmpMasterTaskloopStatement object in the memory pool \n");
91674 : }
91675 : }
91676 : }
91677 : }
91678 :
91679 : // This should not be required since all previously static data members are
91680 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
91681 :
91682 194 : }
91683 :
91684 : void
91685 0 : SgOmpMasterTaskloopStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
91686 : {
91687 : // This function visits only a single IR node of the memory pool.
91688 : // it is typically called once for each type of IR node within
91689 : // the automatically generated function: traverseRepresentativeNodes().
91690 :
91691 : // Initialize array to the address of the first element of the STL vector
91692 : // (which is guarenteed to be contiguous storage).
91693 : // SgOmpMasterTaskloopStatement objectArray [] = *(Memory_Block_List.begin());
91694 0 : if (SgOmpMasterTaskloopStatement::pools.empty() == false)
91695 : {
91696 : // Generate an array of memory pools
91697 0 : SgOmpMasterTaskloopStatement** objectArray = (SgOmpMasterTaskloopStatement**) &(SgOmpMasterTaskloopStatement::pools[0]);
91698 :
91699 : // Build a local variable for better performance
91700 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
91701 :
91702 : // Iterate over the memory pools
91703 0 : bool done = false;
91704 0 : unsigned i=0;
91705 :
91706 : // find the first valid IR node, call visit function, and then leave
91707 0 : while ( done == false && i < SgOmpMasterTaskloopStatement::pools.size() )
91708 : {
91709 : // objectArray[i] is a single memory pool
91710 : unsigned j=0;
91711 0 : while (done == false && j < SgOmpMasterTaskloopStatement::pool_size)
91712 : {
91713 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
91714 : {
91715 0 : traversal.visit(&(objectArray[i][j]));
91716 0 : done = true;
91717 : }
91718 0 : j++;
91719 : }
91720 0 : i++;
91721 : }
91722 :
91723 : #if 0
91724 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
91725 : if (done == false)
91726 : {
91727 : printf ("No representative for SgOmpMasterTaskloopStatement found in memory pools \n");
91728 : }
91729 : #endif
91730 : }
91731 0 : }
91732 :
91733 :
91734 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
91735 : // using values that overflow signed values of int.
91736 : size_t
91737 4 : SgOmpMasterTaskloopStatement::numberOfNodes()
91738 : {
91739 : // This function traverses the memory pool for an IR node and
91740 : // counts the number of IR nodes of a particular Sage III IR
91741 : // nodes type.
91742 :
91743 4 : size_t count = 0;
91744 4 : if (SgOmpMasterTaskloopStatement::pools.empty() == false)
91745 : {
91746 : // Generate an array of memory pools (this is actually a STL vector,
91747 : // but it is contiguious, so OK to treat this way).
91748 0 : SgOmpMasterTaskloopStatement** objectArray = (SgOmpMasterTaskloopStatement**) &(SgOmpMasterTaskloopStatement::pools[0]);
91749 :
91750 : // Build a local variable for better performance (make it a loop invariant variable).
91751 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
91752 :
91753 : // Iterate over all of the memory pools for this IR node.
91754 0 : for (unsigned int i=0; i < SgOmpMasterTaskloopStatement::pools.size(); i++)
91755 : {
91756 : // objectArray[i] is a single memory pool, iterate over all the
91757 : // IR nodes and only count those that are valid IR nodes used in
91758 : // the AST (i.e. allocated IR nodes).
91759 0 : for (unsigned j=0; j < SgOmpMasterTaskloopStatement::pool_size; j++)
91760 : {
91761 : // This is indexing the STL vector of C/C++ style arrays as a doubly
91762 : // indexed array access. It is OK since we have leveraged the semantics
91763 : // of STL vector memory as contigous and cast the memory as an array
91764 : // of arrays to use the 2D array indexing. Hope this is not confusing,
91765 : // but it s very fast as an implementation.
91766 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
91767 : {
91768 0 : count++;
91769 : }
91770 : }
91771 : }
91772 : }
91773 :
91774 :
91775 :
91776 4 : return count;
91777 : }
91778 :
91779 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
91780 : // using values that overflow signed values of int.
91781 : size_t
91782 0 : SgOmpMasterTaskloopStatement::memoryUsage()
91783 : {
91784 : // This function is required because we need the class name as a type when we call sizeof
91785 : // There might be another way to implement this if we have a traversal that only called a
91786 : // representative object (one call for each type of Sage IIIIR node).
91787 0 : size_t memory = numberOfNodes() * sizeof(SgOmpMasterTaskloopStatement);
91788 :
91789 0 : return memory;
91790 : }
91791 :
91792 : /* #line 91793 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
91793 :
91794 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
91795 : void
91796 5342 : SgOmpTaskStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
91797 : {
91798 : // This function traverses the memory pool for only a specific IR node
91799 : // and calls the visit function of the input class execute a traversal
91800 : // similar to the style of the attribute based traversals within ROSE.
91801 : // This traversal will visit ALL nodes of the AST where as the other
91802 : // attribute based traversals visit only the embedded tree within the AST.
91803 :
91804 : // Initialize array to the address of the first element of the STL vector
91805 : // (which is guaranteed to be contiguous storage).
91806 : // SgOmpTaskStatement objectArray [] = *(Memory_Block_List.begin());
91807 5342 : if (SgOmpTaskStatement::pools.empty() == false)
91808 : {
91809 : // Generate an array of memory pools
91810 210 : SgOmpTaskStatement** objectArray = (SgOmpTaskStatement**) &(SgOmpTaskStatement::pools[0]);
91811 :
91812 : // Build a local variable for better performance
91813 210 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
91814 : #if 0
91815 : // Iterate over the memory pools
91816 : for (unsigned int i=0; i < SgOmpTaskStatement::pools.size(); i++)
91817 : {
91818 : // objectArray[i] is a single memory pool
91819 : for (int j=0; j < SgOmpTaskStatement::pool_size; j++)
91820 : {
91821 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
91822 : {
91823 : traversal.visit(&(objectArray[i][j]));
91824 : }
91825 : }
91826 : }
91827 : #else
91828 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
91829 : // compute the list first and then call the visit function on each list element.
91830 :
91831 : // printf ("Inside of SgOmpTaskStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
91832 :
91833 420 : std::vector<SgOmpTaskStatement*> nodeList;
91834 :
91835 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
91836 420 : for (unsigned int i=0; i < SgOmpTaskStatement::pools.size(); i++)
91837 : {
91838 : // objectArray[i] is a single memory pool
91839 420210 : for (unsigned j=0; j < SgOmpTaskStatement::pool_size; j++)
91840 : {
91841 420000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
91842 : {
91843 518 : nodeList.push_back(&(objectArray[i][j]));
91844 : }
91845 : }
91846 : }
91847 :
91848 : // Iterate over the saved list
91849 210 : size_t nodeListSize = nodeList.size();
91850 728 : for (size_t i=0; i < nodeListSize; i++)
91851 : {
91852 518 : ROSE_ASSERT(nodeList[i] != NULL);
91853 : #if 0
91854 : traversal.visit(nodeList[i]);
91855 : #else
91856 518 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
91857 : {
91858 518 : traversal.visit(nodeList[i]);
91859 : }
91860 : #endif
91861 : }
91862 : #endif
91863 : }
91864 :
91865 : // This should not be required since all previously static data members are
91866 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
91867 :
91868 5342 : }
91869 :
91870 :
91871 : void
91872 194 : SgOmpTaskStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
91873 : {
91874 : // This function traverses the memory pool for an IR node and
91875 : // calls the function to execute the visitor object.
91876 :
91877 : // Initialize array to the address of the first element of the STL vector
91878 : // (which is guarenteed to be contiguous storage).
91879 : // SgOmpTaskStatement objectArray [] = *(Memory_Block_List.begin());
91880 194 : if (SgOmpTaskStatement::pools.empty() == false)
91881 : {
91882 : // Generate an array of memory pools
91883 0 : SgOmpTaskStatement** objectArray = (SgOmpTaskStatement**) &(SgOmpTaskStatement::pools[0]);
91884 :
91885 : // Build a local variable for better performance
91886 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
91887 :
91888 : // Iterate over the memory pools
91889 0 : for (unsigned int i=0; i < SgOmpTaskStatement::pools.size(); i++)
91890 : {
91891 : // objectArray[i] is a single memory pool
91892 0 : for (unsigned j=0; j < SgOmpTaskStatement::pool_size; j++)
91893 : {
91894 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
91895 : {
91896 : // printf ("Found a valid SgOmpTaskStatement object in the memory pool %d at position %d \n",i,j);
91897 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
91898 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
91899 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
91900 : }
91901 : else
91902 : {
91903 : // printf ("Found a INVALID SgOmpTaskStatement object in the memory pool \n");
91904 : }
91905 : }
91906 : }
91907 : }
91908 :
91909 : // This should not be required since all previously static data members are
91910 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
91911 :
91912 194 : }
91913 :
91914 : void
91915 0 : SgOmpTaskStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
91916 : {
91917 : // This function visits only a single IR node of the memory pool.
91918 : // it is typically called once for each type of IR node within
91919 : // the automatically generated function: traverseRepresentativeNodes().
91920 :
91921 : // Initialize array to the address of the first element of the STL vector
91922 : // (which is guarenteed to be contiguous storage).
91923 : // SgOmpTaskStatement objectArray [] = *(Memory_Block_List.begin());
91924 0 : if (SgOmpTaskStatement::pools.empty() == false)
91925 : {
91926 : // Generate an array of memory pools
91927 0 : SgOmpTaskStatement** objectArray = (SgOmpTaskStatement**) &(SgOmpTaskStatement::pools[0]);
91928 :
91929 : // Build a local variable for better performance
91930 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
91931 :
91932 : // Iterate over the memory pools
91933 0 : bool done = false;
91934 0 : unsigned i=0;
91935 :
91936 : // find the first valid IR node, call visit function, and then leave
91937 0 : while ( done == false && i < SgOmpTaskStatement::pools.size() )
91938 : {
91939 : // objectArray[i] is a single memory pool
91940 : unsigned j=0;
91941 0 : while (done == false && j < SgOmpTaskStatement::pool_size)
91942 : {
91943 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
91944 : {
91945 0 : traversal.visit(&(objectArray[i][j]));
91946 0 : done = true;
91947 : }
91948 0 : j++;
91949 : }
91950 0 : i++;
91951 : }
91952 :
91953 : #if 0
91954 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
91955 : if (done == false)
91956 : {
91957 : printf ("No representative for SgOmpTaskStatement found in memory pools \n");
91958 : }
91959 : #endif
91960 : }
91961 0 : }
91962 :
91963 :
91964 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
91965 : // using values that overflow signed values of int.
91966 : size_t
91967 4 : SgOmpTaskStatement::numberOfNodes()
91968 : {
91969 : // This function traverses the memory pool for an IR node and
91970 : // counts the number of IR nodes of a particular Sage III IR
91971 : // nodes type.
91972 :
91973 4 : size_t count = 0;
91974 4 : if (SgOmpTaskStatement::pools.empty() == false)
91975 : {
91976 : // Generate an array of memory pools (this is actually a STL vector,
91977 : // but it is contiguious, so OK to treat this way).
91978 0 : SgOmpTaskStatement** objectArray = (SgOmpTaskStatement**) &(SgOmpTaskStatement::pools[0]);
91979 :
91980 : // Build a local variable for better performance (make it a loop invariant variable).
91981 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
91982 :
91983 : // Iterate over all of the memory pools for this IR node.
91984 0 : for (unsigned int i=0; i < SgOmpTaskStatement::pools.size(); i++)
91985 : {
91986 : // objectArray[i] is a single memory pool, iterate over all the
91987 : // IR nodes and only count those that are valid IR nodes used in
91988 : // the AST (i.e. allocated IR nodes).
91989 0 : for (unsigned j=0; j < SgOmpTaskStatement::pool_size; j++)
91990 : {
91991 : // This is indexing the STL vector of C/C++ style arrays as a doubly
91992 : // indexed array access. It is OK since we have leveraged the semantics
91993 : // of STL vector memory as contigous and cast the memory as an array
91994 : // of arrays to use the 2D array indexing. Hope this is not confusing,
91995 : // but it s very fast as an implementation.
91996 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
91997 : {
91998 0 : count++;
91999 : }
92000 : }
92001 : }
92002 : }
92003 :
92004 :
92005 :
92006 4 : return count;
92007 : }
92008 :
92009 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
92010 : // using values that overflow signed values of int.
92011 : size_t
92012 0 : SgOmpTaskStatement::memoryUsage()
92013 : {
92014 : // This function is required because we need the class name as a type when we call sizeof
92015 : // There might be another way to implement this if we have a traversal that only called a
92016 : // representative object (one call for each type of Sage IIIIR node).
92017 0 : size_t memory = numberOfNodes() * sizeof(SgOmpTaskStatement);
92018 :
92019 0 : return memory;
92020 : }
92021 :
92022 : /* #line 92023 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
92023 :
92024 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
92025 : void
92026 5342 : SgOmpDoStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
92027 : {
92028 : // This function traverses the memory pool for only a specific IR node
92029 : // and calls the visit function of the input class execute a traversal
92030 : // similar to the style of the attribute based traversals within ROSE.
92031 : // This traversal will visit ALL nodes of the AST where as the other
92032 : // attribute based traversals visit only the embedded tree within the AST.
92033 :
92034 : // Initialize array to the address of the first element of the STL vector
92035 : // (which is guaranteed to be contiguous storage).
92036 : // SgOmpDoStatement objectArray [] = *(Memory_Block_List.begin());
92037 5342 : if (SgOmpDoStatement::pools.empty() == false)
92038 : {
92039 : // Generate an array of memory pools
92040 63 : SgOmpDoStatement** objectArray = (SgOmpDoStatement**) &(SgOmpDoStatement::pools[0]);
92041 :
92042 : // Build a local variable for better performance
92043 63 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
92044 : #if 0
92045 : // Iterate over the memory pools
92046 : for (unsigned int i=0; i < SgOmpDoStatement::pools.size(); i++)
92047 : {
92048 : // objectArray[i] is a single memory pool
92049 : for (int j=0; j < SgOmpDoStatement::pool_size; j++)
92050 : {
92051 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
92052 : {
92053 : traversal.visit(&(objectArray[i][j]));
92054 : }
92055 : }
92056 : }
92057 : #else
92058 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
92059 : // compute the list first and then call the visit function on each list element.
92060 :
92061 : // printf ("Inside of SgOmpDoStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
92062 :
92063 126 : std::vector<SgOmpDoStatement*> nodeList;
92064 :
92065 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
92066 126 : for (unsigned int i=0; i < SgOmpDoStatement::pools.size(); i++)
92067 : {
92068 : // objectArray[i] is a single memory pool
92069 126063 : for (unsigned j=0; j < SgOmpDoStatement::pool_size; j++)
92070 : {
92071 126000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
92072 : {
92073 84 : nodeList.push_back(&(objectArray[i][j]));
92074 : }
92075 : }
92076 : }
92077 :
92078 : // Iterate over the saved list
92079 63 : size_t nodeListSize = nodeList.size();
92080 147 : for (size_t i=0; i < nodeListSize; i++)
92081 : {
92082 84 : ROSE_ASSERT(nodeList[i] != NULL);
92083 : #if 0
92084 : traversal.visit(nodeList[i]);
92085 : #else
92086 84 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
92087 : {
92088 84 : traversal.visit(nodeList[i]);
92089 : }
92090 : #endif
92091 : }
92092 : #endif
92093 : }
92094 :
92095 : // This should not be required since all previously static data members are
92096 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
92097 :
92098 5342 : }
92099 :
92100 :
92101 : void
92102 194 : SgOmpDoStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
92103 : {
92104 : // This function traverses the memory pool for an IR node and
92105 : // calls the function to execute the visitor object.
92106 :
92107 : // Initialize array to the address of the first element of the STL vector
92108 : // (which is guarenteed to be contiguous storage).
92109 : // SgOmpDoStatement objectArray [] = *(Memory_Block_List.begin());
92110 194 : if (SgOmpDoStatement::pools.empty() == false)
92111 : {
92112 : // Generate an array of memory pools
92113 0 : SgOmpDoStatement** objectArray = (SgOmpDoStatement**) &(SgOmpDoStatement::pools[0]);
92114 :
92115 : // Build a local variable for better performance
92116 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
92117 :
92118 : // Iterate over the memory pools
92119 0 : for (unsigned int i=0; i < SgOmpDoStatement::pools.size(); i++)
92120 : {
92121 : // objectArray[i] is a single memory pool
92122 0 : for (unsigned j=0; j < SgOmpDoStatement::pool_size; j++)
92123 : {
92124 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
92125 : {
92126 : // printf ("Found a valid SgOmpDoStatement object in the memory pool %d at position %d \n",i,j);
92127 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
92128 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
92129 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
92130 : }
92131 : else
92132 : {
92133 : // printf ("Found a INVALID SgOmpDoStatement object in the memory pool \n");
92134 : }
92135 : }
92136 : }
92137 : }
92138 :
92139 : // This should not be required since all previously static data members are
92140 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
92141 :
92142 194 : }
92143 :
92144 : void
92145 0 : SgOmpDoStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
92146 : {
92147 : // This function visits only a single IR node of the memory pool.
92148 : // it is typically called once for each type of IR node within
92149 : // the automatically generated function: traverseRepresentativeNodes().
92150 :
92151 : // Initialize array to the address of the first element of the STL vector
92152 : // (which is guarenteed to be contiguous storage).
92153 : // SgOmpDoStatement objectArray [] = *(Memory_Block_List.begin());
92154 0 : if (SgOmpDoStatement::pools.empty() == false)
92155 : {
92156 : // Generate an array of memory pools
92157 0 : SgOmpDoStatement** objectArray = (SgOmpDoStatement**) &(SgOmpDoStatement::pools[0]);
92158 :
92159 : // Build a local variable for better performance
92160 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
92161 :
92162 : // Iterate over the memory pools
92163 0 : bool done = false;
92164 0 : unsigned i=0;
92165 :
92166 : // find the first valid IR node, call visit function, and then leave
92167 0 : while ( done == false && i < SgOmpDoStatement::pools.size() )
92168 : {
92169 : // objectArray[i] is a single memory pool
92170 : unsigned j=0;
92171 0 : while (done == false && j < SgOmpDoStatement::pool_size)
92172 : {
92173 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
92174 : {
92175 0 : traversal.visit(&(objectArray[i][j]));
92176 0 : done = true;
92177 : }
92178 0 : j++;
92179 : }
92180 0 : i++;
92181 : }
92182 :
92183 : #if 0
92184 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
92185 : if (done == false)
92186 : {
92187 : printf ("No representative for SgOmpDoStatement found in memory pools \n");
92188 : }
92189 : #endif
92190 : }
92191 0 : }
92192 :
92193 :
92194 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
92195 : // using values that overflow signed values of int.
92196 : size_t
92197 4 : SgOmpDoStatement::numberOfNodes()
92198 : {
92199 : // This function traverses the memory pool for an IR node and
92200 : // counts the number of IR nodes of a particular Sage III IR
92201 : // nodes type.
92202 :
92203 4 : size_t count = 0;
92204 4 : if (SgOmpDoStatement::pools.empty() == false)
92205 : {
92206 : // Generate an array of memory pools (this is actually a STL vector,
92207 : // but it is contiguious, so OK to treat this way).
92208 0 : SgOmpDoStatement** objectArray = (SgOmpDoStatement**) &(SgOmpDoStatement::pools[0]);
92209 :
92210 : // Build a local variable for better performance (make it a loop invariant variable).
92211 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
92212 :
92213 : // Iterate over all of the memory pools for this IR node.
92214 0 : for (unsigned int i=0; i < SgOmpDoStatement::pools.size(); i++)
92215 : {
92216 : // objectArray[i] is a single memory pool, iterate over all the
92217 : // IR nodes and only count those that are valid IR nodes used in
92218 : // the AST (i.e. allocated IR nodes).
92219 0 : for (unsigned j=0; j < SgOmpDoStatement::pool_size; j++)
92220 : {
92221 : // This is indexing the STL vector of C/C++ style arrays as a doubly
92222 : // indexed array access. It is OK since we have leveraged the semantics
92223 : // of STL vector memory as contigous and cast the memory as an array
92224 : // of arrays to use the 2D array indexing. Hope this is not confusing,
92225 : // but it s very fast as an implementation.
92226 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
92227 : {
92228 0 : count++;
92229 : }
92230 : }
92231 : }
92232 : }
92233 :
92234 :
92235 :
92236 4 : return count;
92237 : }
92238 :
92239 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
92240 : // using values that overflow signed values of int.
92241 : size_t
92242 0 : SgOmpDoStatement::memoryUsage()
92243 : {
92244 : // This function is required because we need the class name as a type when we call sizeof
92245 : // There might be another way to implement this if we have a traversal that only called a
92246 : // representative object (one call for each type of Sage IIIIR node).
92247 0 : size_t memory = numberOfNodes() * sizeof(SgOmpDoStatement);
92248 :
92249 0 : return memory;
92250 : }
92251 :
92252 : /* #line 92253 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
92253 :
92254 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
92255 : void
92256 5342 : SgOmpSectionsStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
92257 : {
92258 : // This function traverses the memory pool for only a specific IR node
92259 : // and calls the visit function of the input class execute a traversal
92260 : // similar to the style of the attribute based traversals within ROSE.
92261 : // This traversal will visit ALL nodes of the AST where as the other
92262 : // attribute based traversals visit only the embedded tree within the AST.
92263 :
92264 : // Initialize array to the address of the first element of the STL vector
92265 : // (which is guaranteed to be contiguous storage).
92266 : // SgOmpSectionsStatement objectArray [] = *(Memory_Block_List.begin());
92267 5342 : if (SgOmpSectionsStatement::pools.empty() == false)
92268 : {
92269 : // Generate an array of memory pools
92270 63 : SgOmpSectionsStatement** objectArray = (SgOmpSectionsStatement**) &(SgOmpSectionsStatement::pools[0]);
92271 :
92272 : // Build a local variable for better performance
92273 63 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
92274 : #if 0
92275 : // Iterate over the memory pools
92276 : for (unsigned int i=0; i < SgOmpSectionsStatement::pools.size(); i++)
92277 : {
92278 : // objectArray[i] is a single memory pool
92279 : for (int j=0; j < SgOmpSectionsStatement::pool_size; j++)
92280 : {
92281 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
92282 : {
92283 : traversal.visit(&(objectArray[i][j]));
92284 : }
92285 : }
92286 : }
92287 : #else
92288 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
92289 : // compute the list first and then call the visit function on each list element.
92290 :
92291 : // printf ("Inside of SgOmpSectionsStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
92292 :
92293 126 : std::vector<SgOmpSectionsStatement*> nodeList;
92294 :
92295 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
92296 126 : for (unsigned int i=0; i < SgOmpSectionsStatement::pools.size(); i++)
92297 : {
92298 : // objectArray[i] is a single memory pool
92299 126063 : for (unsigned j=0; j < SgOmpSectionsStatement::pool_size; j++)
92300 : {
92301 126000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
92302 : {
92303 77 : nodeList.push_back(&(objectArray[i][j]));
92304 : }
92305 : }
92306 : }
92307 :
92308 : // Iterate over the saved list
92309 63 : size_t nodeListSize = nodeList.size();
92310 140 : for (size_t i=0; i < nodeListSize; i++)
92311 : {
92312 77 : ROSE_ASSERT(nodeList[i] != NULL);
92313 : #if 0
92314 : traversal.visit(nodeList[i]);
92315 : #else
92316 77 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
92317 : {
92318 77 : traversal.visit(nodeList[i]);
92319 : }
92320 : #endif
92321 : }
92322 : #endif
92323 : }
92324 :
92325 : // This should not be required since all previously static data members are
92326 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
92327 :
92328 5342 : }
92329 :
92330 :
92331 : void
92332 194 : SgOmpSectionsStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
92333 : {
92334 : // This function traverses the memory pool for an IR node and
92335 : // calls the function to execute the visitor object.
92336 :
92337 : // Initialize array to the address of the first element of the STL vector
92338 : // (which is guarenteed to be contiguous storage).
92339 : // SgOmpSectionsStatement objectArray [] = *(Memory_Block_List.begin());
92340 194 : if (SgOmpSectionsStatement::pools.empty() == false)
92341 : {
92342 : // Generate an array of memory pools
92343 0 : SgOmpSectionsStatement** objectArray = (SgOmpSectionsStatement**) &(SgOmpSectionsStatement::pools[0]);
92344 :
92345 : // Build a local variable for better performance
92346 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
92347 :
92348 : // Iterate over the memory pools
92349 0 : for (unsigned int i=0; i < SgOmpSectionsStatement::pools.size(); i++)
92350 : {
92351 : // objectArray[i] is a single memory pool
92352 0 : for (unsigned j=0; j < SgOmpSectionsStatement::pool_size; j++)
92353 : {
92354 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
92355 : {
92356 : // printf ("Found a valid SgOmpSectionsStatement object in the memory pool %d at position %d \n",i,j);
92357 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
92358 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
92359 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
92360 : }
92361 : else
92362 : {
92363 : // printf ("Found a INVALID SgOmpSectionsStatement object in the memory pool \n");
92364 : }
92365 : }
92366 : }
92367 : }
92368 :
92369 : // This should not be required since all previously static data members are
92370 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
92371 :
92372 194 : }
92373 :
92374 : void
92375 0 : SgOmpSectionsStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
92376 : {
92377 : // This function visits only a single IR node of the memory pool.
92378 : // it is typically called once for each type of IR node within
92379 : // the automatically generated function: traverseRepresentativeNodes().
92380 :
92381 : // Initialize array to the address of the first element of the STL vector
92382 : // (which is guarenteed to be contiguous storage).
92383 : // SgOmpSectionsStatement objectArray [] = *(Memory_Block_List.begin());
92384 0 : if (SgOmpSectionsStatement::pools.empty() == false)
92385 : {
92386 : // Generate an array of memory pools
92387 0 : SgOmpSectionsStatement** objectArray = (SgOmpSectionsStatement**) &(SgOmpSectionsStatement::pools[0]);
92388 :
92389 : // Build a local variable for better performance
92390 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
92391 :
92392 : // Iterate over the memory pools
92393 0 : bool done = false;
92394 0 : unsigned i=0;
92395 :
92396 : // find the first valid IR node, call visit function, and then leave
92397 0 : while ( done == false && i < SgOmpSectionsStatement::pools.size() )
92398 : {
92399 : // objectArray[i] is a single memory pool
92400 : unsigned j=0;
92401 0 : while (done == false && j < SgOmpSectionsStatement::pool_size)
92402 : {
92403 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
92404 : {
92405 0 : traversal.visit(&(objectArray[i][j]));
92406 0 : done = true;
92407 : }
92408 0 : j++;
92409 : }
92410 0 : i++;
92411 : }
92412 :
92413 : #if 0
92414 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
92415 : if (done == false)
92416 : {
92417 : printf ("No representative for SgOmpSectionsStatement found in memory pools \n");
92418 : }
92419 : #endif
92420 : }
92421 0 : }
92422 :
92423 :
92424 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
92425 : // using values that overflow signed values of int.
92426 : size_t
92427 4 : SgOmpSectionsStatement::numberOfNodes()
92428 : {
92429 : // This function traverses the memory pool for an IR node and
92430 : // counts the number of IR nodes of a particular Sage III IR
92431 : // nodes type.
92432 :
92433 4 : size_t count = 0;
92434 4 : if (SgOmpSectionsStatement::pools.empty() == false)
92435 : {
92436 : // Generate an array of memory pools (this is actually a STL vector,
92437 : // but it is contiguious, so OK to treat this way).
92438 0 : SgOmpSectionsStatement** objectArray = (SgOmpSectionsStatement**) &(SgOmpSectionsStatement::pools[0]);
92439 :
92440 : // Build a local variable for better performance (make it a loop invariant variable).
92441 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
92442 :
92443 : // Iterate over all of the memory pools for this IR node.
92444 0 : for (unsigned int i=0; i < SgOmpSectionsStatement::pools.size(); i++)
92445 : {
92446 : // objectArray[i] is a single memory pool, iterate over all the
92447 : // IR nodes and only count those that are valid IR nodes used in
92448 : // the AST (i.e. allocated IR nodes).
92449 0 : for (unsigned j=0; j < SgOmpSectionsStatement::pool_size; j++)
92450 : {
92451 : // This is indexing the STL vector of C/C++ style arrays as a doubly
92452 : // indexed array access. It is OK since we have leveraged the semantics
92453 : // of STL vector memory as contigous and cast the memory as an array
92454 : // of arrays to use the 2D array indexing. Hope this is not confusing,
92455 : // but it s very fast as an implementation.
92456 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
92457 : {
92458 0 : count++;
92459 : }
92460 : }
92461 : }
92462 : }
92463 :
92464 :
92465 :
92466 4 : return count;
92467 : }
92468 :
92469 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
92470 : // using values that overflow signed values of int.
92471 : size_t
92472 0 : SgOmpSectionsStatement::memoryUsage()
92473 : {
92474 : // This function is required because we need the class name as a type when we call sizeof
92475 : // There might be another way to implement this if we have a traversal that only called a
92476 : // representative object (one call for each type of Sage IIIIR node).
92477 0 : size_t memory = numberOfNodes() * sizeof(SgOmpSectionsStatement);
92478 :
92479 0 : return memory;
92480 : }
92481 :
92482 : /* #line 92483 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
92483 :
92484 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
92485 : void
92486 5342 : SgUpirTaskStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
92487 : {
92488 : // This function traverses the memory pool for only a specific IR node
92489 : // and calls the visit function of the input class execute a traversal
92490 : // similar to the style of the attribute based traversals within ROSE.
92491 : // This traversal will visit ALL nodes of the AST where as the other
92492 : // attribute based traversals visit only the embedded tree within the AST.
92493 :
92494 : // Initialize array to the address of the first element of the STL vector
92495 : // (which is guaranteed to be contiguous storage).
92496 : // SgUpirTaskStatement objectArray [] = *(Memory_Block_List.begin());
92497 5342 : if (SgUpirTaskStatement::pools.empty() == false)
92498 : {
92499 : // Generate an array of memory pools
92500 119 : SgUpirTaskStatement** objectArray = (SgUpirTaskStatement**) &(SgUpirTaskStatement::pools[0]);
92501 :
92502 : // Build a local variable for better performance
92503 119 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
92504 : #if 0
92505 : // Iterate over the memory pools
92506 : for (unsigned int i=0; i < SgUpirTaskStatement::pools.size(); i++)
92507 : {
92508 : // objectArray[i] is a single memory pool
92509 : for (int j=0; j < SgUpirTaskStatement::pool_size; j++)
92510 : {
92511 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
92512 : {
92513 : traversal.visit(&(objectArray[i][j]));
92514 : }
92515 : }
92516 : }
92517 : #else
92518 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
92519 : // compute the list first and then call the visit function on each list element.
92520 :
92521 : // printf ("Inside of SgUpirTaskStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
92522 :
92523 238 : std::vector<SgUpirTaskStatement*> nodeList;
92524 :
92525 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
92526 238 : for (unsigned int i=0; i < SgUpirTaskStatement::pools.size(); i++)
92527 : {
92528 : // objectArray[i] is a single memory pool
92529 238119 : for (unsigned j=0; j < SgUpirTaskStatement::pool_size; j++)
92530 : {
92531 238000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
92532 : {
92533 168 : nodeList.push_back(&(objectArray[i][j]));
92534 : }
92535 : }
92536 : }
92537 :
92538 : // Iterate over the saved list
92539 119 : size_t nodeListSize = nodeList.size();
92540 287 : for (size_t i=0; i < nodeListSize; i++)
92541 : {
92542 168 : ROSE_ASSERT(nodeList[i] != NULL);
92543 : #if 0
92544 : traversal.visit(nodeList[i]);
92545 : #else
92546 168 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
92547 : {
92548 168 : traversal.visit(nodeList[i]);
92549 : }
92550 : #endif
92551 : }
92552 : #endif
92553 : }
92554 :
92555 : // This should not be required since all previously static data members are
92556 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
92557 :
92558 5342 : }
92559 :
92560 :
92561 : void
92562 194 : SgUpirTaskStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
92563 : {
92564 : // This function traverses the memory pool for an IR node and
92565 : // calls the function to execute the visitor object.
92566 :
92567 : // Initialize array to the address of the first element of the STL vector
92568 : // (which is guarenteed to be contiguous storage).
92569 : // SgUpirTaskStatement objectArray [] = *(Memory_Block_List.begin());
92570 194 : if (SgUpirTaskStatement::pools.empty() == false)
92571 : {
92572 : // Generate an array of memory pools
92573 0 : SgUpirTaskStatement** objectArray = (SgUpirTaskStatement**) &(SgUpirTaskStatement::pools[0]);
92574 :
92575 : // Build a local variable for better performance
92576 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
92577 :
92578 : // Iterate over the memory pools
92579 0 : for (unsigned int i=0; i < SgUpirTaskStatement::pools.size(); i++)
92580 : {
92581 : // objectArray[i] is a single memory pool
92582 0 : for (unsigned j=0; j < SgUpirTaskStatement::pool_size; j++)
92583 : {
92584 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
92585 : {
92586 : // printf ("Found a valid SgUpirTaskStatement object in the memory pool %d at position %d \n",i,j);
92587 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
92588 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
92589 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
92590 : }
92591 : else
92592 : {
92593 : // printf ("Found a INVALID SgUpirTaskStatement object in the memory pool \n");
92594 : }
92595 : }
92596 : }
92597 : }
92598 :
92599 : // This should not be required since all previously static data members are
92600 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
92601 :
92602 194 : }
92603 :
92604 : void
92605 0 : SgUpirTaskStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
92606 : {
92607 : // This function visits only a single IR node of the memory pool.
92608 : // it is typically called once for each type of IR node within
92609 : // the automatically generated function: traverseRepresentativeNodes().
92610 :
92611 : // Initialize array to the address of the first element of the STL vector
92612 : // (which is guarenteed to be contiguous storage).
92613 : // SgUpirTaskStatement objectArray [] = *(Memory_Block_List.begin());
92614 0 : if (SgUpirTaskStatement::pools.empty() == false)
92615 : {
92616 : // Generate an array of memory pools
92617 0 : SgUpirTaskStatement** objectArray = (SgUpirTaskStatement**) &(SgUpirTaskStatement::pools[0]);
92618 :
92619 : // Build a local variable for better performance
92620 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
92621 :
92622 : // Iterate over the memory pools
92623 0 : bool done = false;
92624 0 : unsigned i=0;
92625 :
92626 : // find the first valid IR node, call visit function, and then leave
92627 0 : while ( done == false && i < SgUpirTaskStatement::pools.size() )
92628 : {
92629 : // objectArray[i] is a single memory pool
92630 : unsigned j=0;
92631 0 : while (done == false && j < SgUpirTaskStatement::pool_size)
92632 : {
92633 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
92634 : {
92635 0 : traversal.visit(&(objectArray[i][j]));
92636 0 : done = true;
92637 : }
92638 0 : j++;
92639 : }
92640 0 : i++;
92641 : }
92642 :
92643 : #if 0
92644 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
92645 : if (done == false)
92646 : {
92647 : printf ("No representative for SgUpirTaskStatement found in memory pools \n");
92648 : }
92649 : #endif
92650 : }
92651 0 : }
92652 :
92653 :
92654 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
92655 : // using values that overflow signed values of int.
92656 : size_t
92657 4 : SgUpirTaskStatement::numberOfNodes()
92658 : {
92659 : // This function traverses the memory pool for an IR node and
92660 : // counts the number of IR nodes of a particular Sage III IR
92661 : // nodes type.
92662 :
92663 4 : size_t count = 0;
92664 4 : if (SgUpirTaskStatement::pools.empty() == false)
92665 : {
92666 : // Generate an array of memory pools (this is actually a STL vector,
92667 : // but it is contiguious, so OK to treat this way).
92668 0 : SgUpirTaskStatement** objectArray = (SgUpirTaskStatement**) &(SgUpirTaskStatement::pools[0]);
92669 :
92670 : // Build a local variable for better performance (make it a loop invariant variable).
92671 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
92672 :
92673 : // Iterate over all of the memory pools for this IR node.
92674 0 : for (unsigned int i=0; i < SgUpirTaskStatement::pools.size(); i++)
92675 : {
92676 : // objectArray[i] is a single memory pool, iterate over all the
92677 : // IR nodes and only count those that are valid IR nodes used in
92678 : // the AST (i.e. allocated IR nodes).
92679 0 : for (unsigned j=0; j < SgUpirTaskStatement::pool_size; j++)
92680 : {
92681 : // This is indexing the STL vector of C/C++ style arrays as a doubly
92682 : // indexed array access. It is OK since we have leveraged the semantics
92683 : // of STL vector memory as contigous and cast the memory as an array
92684 : // of arrays to use the 2D array indexing. Hope this is not confusing,
92685 : // but it s very fast as an implementation.
92686 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
92687 : {
92688 0 : count++;
92689 : }
92690 : }
92691 : }
92692 : }
92693 :
92694 :
92695 :
92696 4 : return count;
92697 : }
92698 :
92699 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
92700 : // using values that overflow signed values of int.
92701 : size_t
92702 0 : SgUpirTaskStatement::memoryUsage()
92703 : {
92704 : // This function is required because we need the class name as a type when we call sizeof
92705 : // There might be another way to implement this if we have a traversal that only called a
92706 : // representative object (one call for each type of Sage IIIIR node).
92707 0 : size_t memory = numberOfNodes() * sizeof(SgUpirTaskStatement);
92708 :
92709 0 : return memory;
92710 : }
92711 :
92712 : /* #line 92713 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
92713 :
92714 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
92715 : void
92716 5342 : SgOmpTargetDataStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
92717 : {
92718 : // This function traverses the memory pool for only a specific IR node
92719 : // and calls the visit function of the input class execute a traversal
92720 : // similar to the style of the attribute based traversals within ROSE.
92721 : // This traversal will visit ALL nodes of the AST where as the other
92722 : // attribute based traversals visit only the embedded tree within the AST.
92723 :
92724 : // Initialize array to the address of the first element of the STL vector
92725 : // (which is guaranteed to be contiguous storage).
92726 : // SgOmpTargetDataStatement objectArray [] = *(Memory_Block_List.begin());
92727 5342 : if (SgOmpTargetDataStatement::pools.empty() == false)
92728 : {
92729 : // Generate an array of memory pools
92730 49 : SgOmpTargetDataStatement** objectArray = (SgOmpTargetDataStatement**) &(SgOmpTargetDataStatement::pools[0]);
92731 :
92732 : // Build a local variable for better performance
92733 49 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
92734 : #if 0
92735 : // Iterate over the memory pools
92736 : for (unsigned int i=0; i < SgOmpTargetDataStatement::pools.size(); i++)
92737 : {
92738 : // objectArray[i] is a single memory pool
92739 : for (int j=0; j < SgOmpTargetDataStatement::pool_size; j++)
92740 : {
92741 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
92742 : {
92743 : traversal.visit(&(objectArray[i][j]));
92744 : }
92745 : }
92746 : }
92747 : #else
92748 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
92749 : // compute the list first and then call the visit function on each list element.
92750 :
92751 : // printf ("Inside of SgOmpTargetDataStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
92752 :
92753 98 : std::vector<SgOmpTargetDataStatement*> nodeList;
92754 :
92755 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
92756 98 : for (unsigned int i=0; i < SgOmpTargetDataStatement::pools.size(); i++)
92757 : {
92758 : // objectArray[i] is a single memory pool
92759 98049 : for (unsigned j=0; j < SgOmpTargetDataStatement::pool_size; j++)
92760 : {
92761 98000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
92762 : {
92763 49 : nodeList.push_back(&(objectArray[i][j]));
92764 : }
92765 : }
92766 : }
92767 :
92768 : // Iterate over the saved list
92769 49 : size_t nodeListSize = nodeList.size();
92770 98 : for (size_t i=0; i < nodeListSize; i++)
92771 : {
92772 49 : ROSE_ASSERT(nodeList[i] != NULL);
92773 : #if 0
92774 : traversal.visit(nodeList[i]);
92775 : #else
92776 49 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
92777 : {
92778 49 : traversal.visit(nodeList[i]);
92779 : }
92780 : #endif
92781 : }
92782 : #endif
92783 : }
92784 :
92785 : // This should not be required since all previously static data members are
92786 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
92787 :
92788 5342 : }
92789 :
92790 :
92791 : void
92792 194 : SgOmpTargetDataStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
92793 : {
92794 : // This function traverses the memory pool for an IR node and
92795 : // calls the function to execute the visitor object.
92796 :
92797 : // Initialize array to the address of the first element of the STL vector
92798 : // (which is guarenteed to be contiguous storage).
92799 : // SgOmpTargetDataStatement objectArray [] = *(Memory_Block_List.begin());
92800 194 : if (SgOmpTargetDataStatement::pools.empty() == false)
92801 : {
92802 : // Generate an array of memory pools
92803 0 : SgOmpTargetDataStatement** objectArray = (SgOmpTargetDataStatement**) &(SgOmpTargetDataStatement::pools[0]);
92804 :
92805 : // Build a local variable for better performance
92806 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
92807 :
92808 : // Iterate over the memory pools
92809 0 : for (unsigned int i=0; i < SgOmpTargetDataStatement::pools.size(); i++)
92810 : {
92811 : // objectArray[i] is a single memory pool
92812 0 : for (unsigned j=0; j < SgOmpTargetDataStatement::pool_size; j++)
92813 : {
92814 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
92815 : {
92816 : // printf ("Found a valid SgOmpTargetDataStatement object in the memory pool %d at position %d \n",i,j);
92817 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
92818 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
92819 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
92820 : }
92821 : else
92822 : {
92823 : // printf ("Found a INVALID SgOmpTargetDataStatement object in the memory pool \n");
92824 : }
92825 : }
92826 : }
92827 : }
92828 :
92829 : // This should not be required since all previously static data members are
92830 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
92831 :
92832 194 : }
92833 :
92834 : void
92835 0 : SgOmpTargetDataStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
92836 : {
92837 : // This function visits only a single IR node of the memory pool.
92838 : // it is typically called once for each type of IR node within
92839 : // the automatically generated function: traverseRepresentativeNodes().
92840 :
92841 : // Initialize array to the address of the first element of the STL vector
92842 : // (which is guarenteed to be contiguous storage).
92843 : // SgOmpTargetDataStatement objectArray [] = *(Memory_Block_List.begin());
92844 0 : if (SgOmpTargetDataStatement::pools.empty() == false)
92845 : {
92846 : // Generate an array of memory pools
92847 0 : SgOmpTargetDataStatement** objectArray = (SgOmpTargetDataStatement**) &(SgOmpTargetDataStatement::pools[0]);
92848 :
92849 : // Build a local variable for better performance
92850 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
92851 :
92852 : // Iterate over the memory pools
92853 0 : bool done = false;
92854 0 : unsigned i=0;
92855 :
92856 : // find the first valid IR node, call visit function, and then leave
92857 0 : while ( done == false && i < SgOmpTargetDataStatement::pools.size() )
92858 : {
92859 : // objectArray[i] is a single memory pool
92860 : unsigned j=0;
92861 0 : while (done == false && j < SgOmpTargetDataStatement::pool_size)
92862 : {
92863 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
92864 : {
92865 0 : traversal.visit(&(objectArray[i][j]));
92866 0 : done = true;
92867 : }
92868 0 : j++;
92869 : }
92870 0 : i++;
92871 : }
92872 :
92873 : #if 0
92874 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
92875 : if (done == false)
92876 : {
92877 : printf ("No representative for SgOmpTargetDataStatement found in memory pools \n");
92878 : }
92879 : #endif
92880 : }
92881 0 : }
92882 :
92883 :
92884 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
92885 : // using values that overflow signed values of int.
92886 : size_t
92887 4 : SgOmpTargetDataStatement::numberOfNodes()
92888 : {
92889 : // This function traverses the memory pool for an IR node and
92890 : // counts the number of IR nodes of a particular Sage III IR
92891 : // nodes type.
92892 :
92893 4 : size_t count = 0;
92894 4 : if (SgOmpTargetDataStatement::pools.empty() == false)
92895 : {
92896 : // Generate an array of memory pools (this is actually a STL vector,
92897 : // but it is contiguious, so OK to treat this way).
92898 0 : SgOmpTargetDataStatement** objectArray = (SgOmpTargetDataStatement**) &(SgOmpTargetDataStatement::pools[0]);
92899 :
92900 : // Build a local variable for better performance (make it a loop invariant variable).
92901 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
92902 :
92903 : // Iterate over all of the memory pools for this IR node.
92904 0 : for (unsigned int i=0; i < SgOmpTargetDataStatement::pools.size(); i++)
92905 : {
92906 : // objectArray[i] is a single memory pool, iterate over all the
92907 : // IR nodes and only count those that are valid IR nodes used in
92908 : // the AST (i.e. allocated IR nodes).
92909 0 : for (unsigned j=0; j < SgOmpTargetDataStatement::pool_size; j++)
92910 : {
92911 : // This is indexing the STL vector of C/C++ style arrays as a doubly
92912 : // indexed array access. It is OK since we have leveraged the semantics
92913 : // of STL vector memory as contigous and cast the memory as an array
92914 : // of arrays to use the 2D array indexing. Hope this is not confusing,
92915 : // but it s very fast as an implementation.
92916 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
92917 : {
92918 0 : count++;
92919 : }
92920 : }
92921 : }
92922 : }
92923 :
92924 :
92925 :
92926 4 : return count;
92927 : }
92928 :
92929 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
92930 : // using values that overflow signed values of int.
92931 : size_t
92932 0 : SgOmpTargetDataStatement::memoryUsage()
92933 : {
92934 : // This function is required because we need the class name as a type when we call sizeof
92935 : // There might be another way to implement this if we have a traversal that only called a
92936 : // representative object (one call for each type of Sage IIIIR node).
92937 0 : size_t memory = numberOfNodes() * sizeof(SgOmpTargetDataStatement);
92938 :
92939 0 : return memory;
92940 : }
92941 :
92942 : /* #line 92943 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
92943 :
92944 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
92945 : void
92946 5342 : SgOmpTargetParallelForStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
92947 : {
92948 : // This function traverses the memory pool for only a specific IR node
92949 : // and calls the visit function of the input class execute a traversal
92950 : // similar to the style of the attribute based traversals within ROSE.
92951 : // This traversal will visit ALL nodes of the AST where as the other
92952 : // attribute based traversals visit only the embedded tree within the AST.
92953 :
92954 : // Initialize array to the address of the first element of the STL vector
92955 : // (which is guaranteed to be contiguous storage).
92956 : // SgOmpTargetParallelForStatement objectArray [] = *(Memory_Block_List.begin());
92957 5342 : if (SgOmpTargetParallelForStatement::pools.empty() == false)
92958 : {
92959 : // Generate an array of memory pools
92960 0 : SgOmpTargetParallelForStatement** objectArray = (SgOmpTargetParallelForStatement**) &(SgOmpTargetParallelForStatement::pools[0]);
92961 :
92962 : // Build a local variable for better performance
92963 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
92964 : #if 0
92965 : // Iterate over the memory pools
92966 : for (unsigned int i=0; i < SgOmpTargetParallelForStatement::pools.size(); i++)
92967 : {
92968 : // objectArray[i] is a single memory pool
92969 : for (int j=0; j < SgOmpTargetParallelForStatement::pool_size; j++)
92970 : {
92971 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
92972 : {
92973 : traversal.visit(&(objectArray[i][j]));
92974 : }
92975 : }
92976 : }
92977 : #else
92978 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
92979 : // compute the list first and then call the visit function on each list element.
92980 :
92981 : // printf ("Inside of SgOmpTargetParallelForStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
92982 :
92983 0 : std::vector<SgOmpTargetParallelForStatement*> nodeList;
92984 :
92985 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
92986 0 : for (unsigned int i=0; i < SgOmpTargetParallelForStatement::pools.size(); i++)
92987 : {
92988 : // objectArray[i] is a single memory pool
92989 0 : for (unsigned j=0; j < SgOmpTargetParallelForStatement::pool_size; j++)
92990 : {
92991 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
92992 : {
92993 0 : nodeList.push_back(&(objectArray[i][j]));
92994 : }
92995 : }
92996 : }
92997 :
92998 : // Iterate over the saved list
92999 0 : size_t nodeListSize = nodeList.size();
93000 0 : for (size_t i=0; i < nodeListSize; i++)
93001 : {
93002 0 : ROSE_ASSERT(nodeList[i] != NULL);
93003 : #if 0
93004 : traversal.visit(nodeList[i]);
93005 : #else
93006 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
93007 : {
93008 0 : traversal.visit(nodeList[i]);
93009 : }
93010 : #endif
93011 : }
93012 : #endif
93013 : }
93014 :
93015 : // This should not be required since all previously static data members are
93016 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
93017 :
93018 5342 : }
93019 :
93020 :
93021 : void
93022 194 : SgOmpTargetParallelForStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
93023 : {
93024 : // This function traverses the memory pool for an IR node and
93025 : // calls the function to execute the visitor object.
93026 :
93027 : // Initialize array to the address of the first element of the STL vector
93028 : // (which is guarenteed to be contiguous storage).
93029 : // SgOmpTargetParallelForStatement objectArray [] = *(Memory_Block_List.begin());
93030 194 : if (SgOmpTargetParallelForStatement::pools.empty() == false)
93031 : {
93032 : // Generate an array of memory pools
93033 0 : SgOmpTargetParallelForStatement** objectArray = (SgOmpTargetParallelForStatement**) &(SgOmpTargetParallelForStatement::pools[0]);
93034 :
93035 : // Build a local variable for better performance
93036 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
93037 :
93038 : // Iterate over the memory pools
93039 0 : for (unsigned int i=0; i < SgOmpTargetParallelForStatement::pools.size(); i++)
93040 : {
93041 : // objectArray[i] is a single memory pool
93042 0 : for (unsigned j=0; j < SgOmpTargetParallelForStatement::pool_size; j++)
93043 : {
93044 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
93045 : {
93046 : // printf ("Found a valid SgOmpTargetParallelForStatement object in the memory pool %d at position %d \n",i,j);
93047 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
93048 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
93049 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
93050 : }
93051 : else
93052 : {
93053 : // printf ("Found a INVALID SgOmpTargetParallelForStatement object in the memory pool \n");
93054 : }
93055 : }
93056 : }
93057 : }
93058 :
93059 : // This should not be required since all previously static data members are
93060 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
93061 :
93062 194 : }
93063 :
93064 : void
93065 0 : SgOmpTargetParallelForStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
93066 : {
93067 : // This function visits only a single IR node of the memory pool.
93068 : // it is typically called once for each type of IR node within
93069 : // the automatically generated function: traverseRepresentativeNodes().
93070 :
93071 : // Initialize array to the address of the first element of the STL vector
93072 : // (which is guarenteed to be contiguous storage).
93073 : // SgOmpTargetParallelForStatement objectArray [] = *(Memory_Block_List.begin());
93074 0 : if (SgOmpTargetParallelForStatement::pools.empty() == false)
93075 : {
93076 : // Generate an array of memory pools
93077 0 : SgOmpTargetParallelForStatement** objectArray = (SgOmpTargetParallelForStatement**) &(SgOmpTargetParallelForStatement::pools[0]);
93078 :
93079 : // Build a local variable for better performance
93080 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
93081 :
93082 : // Iterate over the memory pools
93083 0 : bool done = false;
93084 0 : unsigned i=0;
93085 :
93086 : // find the first valid IR node, call visit function, and then leave
93087 0 : while ( done == false && i < SgOmpTargetParallelForStatement::pools.size() )
93088 : {
93089 : // objectArray[i] is a single memory pool
93090 : unsigned j=0;
93091 0 : while (done == false && j < SgOmpTargetParallelForStatement::pool_size)
93092 : {
93093 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
93094 : {
93095 0 : traversal.visit(&(objectArray[i][j]));
93096 0 : done = true;
93097 : }
93098 0 : j++;
93099 : }
93100 0 : i++;
93101 : }
93102 :
93103 : #if 0
93104 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
93105 : if (done == false)
93106 : {
93107 : printf ("No representative for SgOmpTargetParallelForStatement found in memory pools \n");
93108 : }
93109 : #endif
93110 : }
93111 0 : }
93112 :
93113 :
93114 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
93115 : // using values that overflow signed values of int.
93116 : size_t
93117 4 : SgOmpTargetParallelForStatement::numberOfNodes()
93118 : {
93119 : // This function traverses the memory pool for an IR node and
93120 : // counts the number of IR nodes of a particular Sage III IR
93121 : // nodes type.
93122 :
93123 4 : size_t count = 0;
93124 4 : if (SgOmpTargetParallelForStatement::pools.empty() == false)
93125 : {
93126 : // Generate an array of memory pools (this is actually a STL vector,
93127 : // but it is contiguious, so OK to treat this way).
93128 0 : SgOmpTargetParallelForStatement** objectArray = (SgOmpTargetParallelForStatement**) &(SgOmpTargetParallelForStatement::pools[0]);
93129 :
93130 : // Build a local variable for better performance (make it a loop invariant variable).
93131 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
93132 :
93133 : // Iterate over all of the memory pools for this IR node.
93134 0 : for (unsigned int i=0; i < SgOmpTargetParallelForStatement::pools.size(); i++)
93135 : {
93136 : // objectArray[i] is a single memory pool, iterate over all the
93137 : // IR nodes and only count those that are valid IR nodes used in
93138 : // the AST (i.e. allocated IR nodes).
93139 0 : for (unsigned j=0; j < SgOmpTargetParallelForStatement::pool_size; j++)
93140 : {
93141 : // This is indexing the STL vector of C/C++ style arrays as a doubly
93142 : // indexed array access. It is OK since we have leveraged the semantics
93143 : // of STL vector memory as contigous and cast the memory as an array
93144 : // of arrays to use the 2D array indexing. Hope this is not confusing,
93145 : // but it s very fast as an implementation.
93146 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
93147 : {
93148 0 : count++;
93149 : }
93150 : }
93151 : }
93152 : }
93153 :
93154 :
93155 :
93156 4 : return count;
93157 : }
93158 :
93159 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
93160 : // using values that overflow signed values of int.
93161 : size_t
93162 0 : SgOmpTargetParallelForStatement::memoryUsage()
93163 : {
93164 : // This function is required because we need the class name as a type when we call sizeof
93165 : // There might be another way to implement this if we have a traversal that only called a
93166 : // representative object (one call for each type of Sage IIIIR node).
93167 0 : size_t memory = numberOfNodes() * sizeof(SgOmpTargetParallelForStatement);
93168 :
93169 0 : return memory;
93170 : }
93171 :
93172 : /* #line 93173 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
93173 :
93174 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
93175 : void
93176 5342 : SgOmpParallelLoopStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
93177 : {
93178 : // This function traverses the memory pool for only a specific IR node
93179 : // and calls the visit function of the input class execute a traversal
93180 : // similar to the style of the attribute based traversals within ROSE.
93181 : // This traversal will visit ALL nodes of the AST where as the other
93182 : // attribute based traversals visit only the embedded tree within the AST.
93183 :
93184 : // Initialize array to the address of the first element of the STL vector
93185 : // (which is guaranteed to be contiguous storage).
93186 : // SgOmpParallelLoopStatement objectArray [] = *(Memory_Block_List.begin());
93187 5342 : if (SgOmpParallelLoopStatement::pools.empty() == false)
93188 : {
93189 : // Generate an array of memory pools
93190 7 : SgOmpParallelLoopStatement** objectArray = (SgOmpParallelLoopStatement**) &(SgOmpParallelLoopStatement::pools[0]);
93191 :
93192 : // Build a local variable for better performance
93193 7 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
93194 : #if 0
93195 : // Iterate over the memory pools
93196 : for (unsigned int i=0; i < SgOmpParallelLoopStatement::pools.size(); i++)
93197 : {
93198 : // objectArray[i] is a single memory pool
93199 : for (int j=0; j < SgOmpParallelLoopStatement::pool_size; j++)
93200 : {
93201 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
93202 : {
93203 : traversal.visit(&(objectArray[i][j]));
93204 : }
93205 : }
93206 : }
93207 : #else
93208 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
93209 : // compute the list first and then call the visit function on each list element.
93210 :
93211 : // printf ("Inside of SgOmpParallelLoopStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
93212 :
93213 14 : std::vector<SgOmpParallelLoopStatement*> nodeList;
93214 :
93215 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
93216 14 : for (unsigned int i=0; i < SgOmpParallelLoopStatement::pools.size(); i++)
93217 : {
93218 : // objectArray[i] is a single memory pool
93219 14007 : for (unsigned j=0; j < SgOmpParallelLoopStatement::pool_size; j++)
93220 : {
93221 14000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
93222 : {
93223 7 : nodeList.push_back(&(objectArray[i][j]));
93224 : }
93225 : }
93226 : }
93227 :
93228 : // Iterate over the saved list
93229 7 : size_t nodeListSize = nodeList.size();
93230 14 : for (size_t i=0; i < nodeListSize; i++)
93231 : {
93232 7 : ROSE_ASSERT(nodeList[i] != NULL);
93233 : #if 0
93234 : traversal.visit(nodeList[i]);
93235 : #else
93236 7 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
93237 : {
93238 7 : traversal.visit(nodeList[i]);
93239 : }
93240 : #endif
93241 : }
93242 : #endif
93243 : }
93244 :
93245 : // This should not be required since all previously static data members are
93246 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
93247 :
93248 5342 : }
93249 :
93250 :
93251 : void
93252 194 : SgOmpParallelLoopStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
93253 : {
93254 : // This function traverses the memory pool for an IR node and
93255 : // calls the function to execute the visitor object.
93256 :
93257 : // Initialize array to the address of the first element of the STL vector
93258 : // (which is guarenteed to be contiguous storage).
93259 : // SgOmpParallelLoopStatement objectArray [] = *(Memory_Block_List.begin());
93260 194 : if (SgOmpParallelLoopStatement::pools.empty() == false)
93261 : {
93262 : // Generate an array of memory pools
93263 0 : SgOmpParallelLoopStatement** objectArray = (SgOmpParallelLoopStatement**) &(SgOmpParallelLoopStatement::pools[0]);
93264 :
93265 : // Build a local variable for better performance
93266 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
93267 :
93268 : // Iterate over the memory pools
93269 0 : for (unsigned int i=0; i < SgOmpParallelLoopStatement::pools.size(); i++)
93270 : {
93271 : // objectArray[i] is a single memory pool
93272 0 : for (unsigned j=0; j < SgOmpParallelLoopStatement::pool_size; j++)
93273 : {
93274 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
93275 : {
93276 : // printf ("Found a valid SgOmpParallelLoopStatement object in the memory pool %d at position %d \n",i,j);
93277 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
93278 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
93279 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
93280 : }
93281 : else
93282 : {
93283 : // printf ("Found a INVALID SgOmpParallelLoopStatement object in the memory pool \n");
93284 : }
93285 : }
93286 : }
93287 : }
93288 :
93289 : // This should not be required since all previously static data members are
93290 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
93291 :
93292 194 : }
93293 :
93294 : void
93295 0 : SgOmpParallelLoopStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
93296 : {
93297 : // This function visits only a single IR node of the memory pool.
93298 : // it is typically called once for each type of IR node within
93299 : // the automatically generated function: traverseRepresentativeNodes().
93300 :
93301 : // Initialize array to the address of the first element of the STL vector
93302 : // (which is guarenteed to be contiguous storage).
93303 : // SgOmpParallelLoopStatement objectArray [] = *(Memory_Block_List.begin());
93304 0 : if (SgOmpParallelLoopStatement::pools.empty() == false)
93305 : {
93306 : // Generate an array of memory pools
93307 0 : SgOmpParallelLoopStatement** objectArray = (SgOmpParallelLoopStatement**) &(SgOmpParallelLoopStatement::pools[0]);
93308 :
93309 : // Build a local variable for better performance
93310 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
93311 :
93312 : // Iterate over the memory pools
93313 0 : bool done = false;
93314 0 : unsigned i=0;
93315 :
93316 : // find the first valid IR node, call visit function, and then leave
93317 0 : while ( done == false && i < SgOmpParallelLoopStatement::pools.size() )
93318 : {
93319 : // objectArray[i] is a single memory pool
93320 : unsigned j=0;
93321 0 : while (done == false && j < SgOmpParallelLoopStatement::pool_size)
93322 : {
93323 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
93324 : {
93325 0 : traversal.visit(&(objectArray[i][j]));
93326 0 : done = true;
93327 : }
93328 0 : j++;
93329 : }
93330 0 : i++;
93331 : }
93332 :
93333 : #if 0
93334 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
93335 : if (done == false)
93336 : {
93337 : printf ("No representative for SgOmpParallelLoopStatement found in memory pools \n");
93338 : }
93339 : #endif
93340 : }
93341 0 : }
93342 :
93343 :
93344 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
93345 : // using values that overflow signed values of int.
93346 : size_t
93347 4 : SgOmpParallelLoopStatement::numberOfNodes()
93348 : {
93349 : // This function traverses the memory pool for an IR node and
93350 : // counts the number of IR nodes of a particular Sage III IR
93351 : // nodes type.
93352 :
93353 4 : size_t count = 0;
93354 4 : if (SgOmpParallelLoopStatement::pools.empty() == false)
93355 : {
93356 : // Generate an array of memory pools (this is actually a STL vector,
93357 : // but it is contiguious, so OK to treat this way).
93358 0 : SgOmpParallelLoopStatement** objectArray = (SgOmpParallelLoopStatement**) &(SgOmpParallelLoopStatement::pools[0]);
93359 :
93360 : // Build a local variable for better performance (make it a loop invariant variable).
93361 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
93362 :
93363 : // Iterate over all of the memory pools for this IR node.
93364 0 : for (unsigned int i=0; i < SgOmpParallelLoopStatement::pools.size(); i++)
93365 : {
93366 : // objectArray[i] is a single memory pool, iterate over all the
93367 : // IR nodes and only count those that are valid IR nodes used in
93368 : // the AST (i.e. allocated IR nodes).
93369 0 : for (unsigned j=0; j < SgOmpParallelLoopStatement::pool_size; j++)
93370 : {
93371 : // This is indexing the STL vector of C/C++ style arrays as a doubly
93372 : // indexed array access. It is OK since we have leveraged the semantics
93373 : // of STL vector memory as contigous and cast the memory as an array
93374 : // of arrays to use the 2D array indexing. Hope this is not confusing,
93375 : // but it s very fast as an implementation.
93376 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
93377 : {
93378 0 : count++;
93379 : }
93380 : }
93381 : }
93382 : }
93383 :
93384 :
93385 :
93386 4 : return count;
93387 : }
93388 :
93389 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
93390 : // using values that overflow signed values of int.
93391 : size_t
93392 0 : SgOmpParallelLoopStatement::memoryUsage()
93393 : {
93394 : // This function is required because we need the class name as a type when we call sizeof
93395 : // There might be another way to implement this if we have a traversal that only called a
93396 : // representative object (one call for each type of Sage IIIIR node).
93397 0 : size_t memory = numberOfNodes() * sizeof(SgOmpParallelLoopStatement);
93398 :
93399 0 : return memory;
93400 : }
93401 :
93402 : /* #line 93403 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
93403 :
93404 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
93405 : void
93406 5342 : SgOmpTargetParallelStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
93407 : {
93408 : // This function traverses the memory pool for only a specific IR node
93409 : // and calls the visit function of the input class execute a traversal
93410 : // similar to the style of the attribute based traversals within ROSE.
93411 : // This traversal will visit ALL nodes of the AST where as the other
93412 : // attribute based traversals visit only the embedded tree within the AST.
93413 :
93414 : // Initialize array to the address of the first element of the STL vector
93415 : // (which is guaranteed to be contiguous storage).
93416 : // SgOmpTargetParallelStatement objectArray [] = *(Memory_Block_List.begin());
93417 5342 : if (SgOmpTargetParallelStatement::pools.empty() == false)
93418 : {
93419 : // Generate an array of memory pools
93420 7 : SgOmpTargetParallelStatement** objectArray = (SgOmpTargetParallelStatement**) &(SgOmpTargetParallelStatement::pools[0]);
93421 :
93422 : // Build a local variable for better performance
93423 7 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
93424 : #if 0
93425 : // Iterate over the memory pools
93426 : for (unsigned int i=0; i < SgOmpTargetParallelStatement::pools.size(); i++)
93427 : {
93428 : // objectArray[i] is a single memory pool
93429 : for (int j=0; j < SgOmpTargetParallelStatement::pool_size; j++)
93430 : {
93431 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
93432 : {
93433 : traversal.visit(&(objectArray[i][j]));
93434 : }
93435 : }
93436 : }
93437 : #else
93438 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
93439 : // compute the list first and then call the visit function on each list element.
93440 :
93441 : // printf ("Inside of SgOmpTargetParallelStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
93442 :
93443 14 : std::vector<SgOmpTargetParallelStatement*> nodeList;
93444 :
93445 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
93446 14 : for (unsigned int i=0; i < SgOmpTargetParallelStatement::pools.size(); i++)
93447 : {
93448 : // objectArray[i] is a single memory pool
93449 14007 : for (unsigned j=0; j < SgOmpTargetParallelStatement::pool_size; j++)
93450 : {
93451 14000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
93452 : {
93453 7 : nodeList.push_back(&(objectArray[i][j]));
93454 : }
93455 : }
93456 : }
93457 :
93458 : // Iterate over the saved list
93459 7 : size_t nodeListSize = nodeList.size();
93460 14 : for (size_t i=0; i < nodeListSize; i++)
93461 : {
93462 7 : ROSE_ASSERT(nodeList[i] != NULL);
93463 : #if 0
93464 : traversal.visit(nodeList[i]);
93465 : #else
93466 7 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
93467 : {
93468 7 : traversal.visit(nodeList[i]);
93469 : }
93470 : #endif
93471 : }
93472 : #endif
93473 : }
93474 :
93475 : // This should not be required since all previously static data members are
93476 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
93477 :
93478 5342 : }
93479 :
93480 :
93481 : void
93482 194 : SgOmpTargetParallelStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
93483 : {
93484 : // This function traverses the memory pool for an IR node and
93485 : // calls the function to execute the visitor object.
93486 :
93487 : // Initialize array to the address of the first element of the STL vector
93488 : // (which is guarenteed to be contiguous storage).
93489 : // SgOmpTargetParallelStatement objectArray [] = *(Memory_Block_List.begin());
93490 194 : if (SgOmpTargetParallelStatement::pools.empty() == false)
93491 : {
93492 : // Generate an array of memory pools
93493 0 : SgOmpTargetParallelStatement** objectArray = (SgOmpTargetParallelStatement**) &(SgOmpTargetParallelStatement::pools[0]);
93494 :
93495 : // Build a local variable for better performance
93496 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
93497 :
93498 : // Iterate over the memory pools
93499 0 : for (unsigned int i=0; i < SgOmpTargetParallelStatement::pools.size(); i++)
93500 : {
93501 : // objectArray[i] is a single memory pool
93502 0 : for (unsigned j=0; j < SgOmpTargetParallelStatement::pool_size; j++)
93503 : {
93504 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
93505 : {
93506 : // printf ("Found a valid SgOmpTargetParallelStatement object in the memory pool %d at position %d \n",i,j);
93507 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
93508 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
93509 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
93510 : }
93511 : else
93512 : {
93513 : // printf ("Found a INVALID SgOmpTargetParallelStatement object in the memory pool \n");
93514 : }
93515 : }
93516 : }
93517 : }
93518 :
93519 : // This should not be required since all previously static data members are
93520 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
93521 :
93522 194 : }
93523 :
93524 : void
93525 0 : SgOmpTargetParallelStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
93526 : {
93527 : // This function visits only a single IR node of the memory pool.
93528 : // it is typically called once for each type of IR node within
93529 : // the automatically generated function: traverseRepresentativeNodes().
93530 :
93531 : // Initialize array to the address of the first element of the STL vector
93532 : // (which is guarenteed to be contiguous storage).
93533 : // SgOmpTargetParallelStatement objectArray [] = *(Memory_Block_List.begin());
93534 0 : if (SgOmpTargetParallelStatement::pools.empty() == false)
93535 : {
93536 : // Generate an array of memory pools
93537 0 : SgOmpTargetParallelStatement** objectArray = (SgOmpTargetParallelStatement**) &(SgOmpTargetParallelStatement::pools[0]);
93538 :
93539 : // Build a local variable for better performance
93540 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
93541 :
93542 : // Iterate over the memory pools
93543 0 : bool done = false;
93544 0 : unsigned i=0;
93545 :
93546 : // find the first valid IR node, call visit function, and then leave
93547 0 : while ( done == false && i < SgOmpTargetParallelStatement::pools.size() )
93548 : {
93549 : // objectArray[i] is a single memory pool
93550 : unsigned j=0;
93551 0 : while (done == false && j < SgOmpTargetParallelStatement::pool_size)
93552 : {
93553 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
93554 : {
93555 0 : traversal.visit(&(objectArray[i][j]));
93556 0 : done = true;
93557 : }
93558 0 : j++;
93559 : }
93560 0 : i++;
93561 : }
93562 :
93563 : #if 0
93564 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
93565 : if (done == false)
93566 : {
93567 : printf ("No representative for SgOmpTargetParallelStatement found in memory pools \n");
93568 : }
93569 : #endif
93570 : }
93571 0 : }
93572 :
93573 :
93574 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
93575 : // using values that overflow signed values of int.
93576 : size_t
93577 4 : SgOmpTargetParallelStatement::numberOfNodes()
93578 : {
93579 : // This function traverses the memory pool for an IR node and
93580 : // counts the number of IR nodes of a particular Sage III IR
93581 : // nodes type.
93582 :
93583 4 : size_t count = 0;
93584 4 : if (SgOmpTargetParallelStatement::pools.empty() == false)
93585 : {
93586 : // Generate an array of memory pools (this is actually a STL vector,
93587 : // but it is contiguious, so OK to treat this way).
93588 0 : SgOmpTargetParallelStatement** objectArray = (SgOmpTargetParallelStatement**) &(SgOmpTargetParallelStatement::pools[0]);
93589 :
93590 : // Build a local variable for better performance (make it a loop invariant variable).
93591 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
93592 :
93593 : // Iterate over all of the memory pools for this IR node.
93594 0 : for (unsigned int i=0; i < SgOmpTargetParallelStatement::pools.size(); i++)
93595 : {
93596 : // objectArray[i] is a single memory pool, iterate over all the
93597 : // IR nodes and only count those that are valid IR nodes used in
93598 : // the AST (i.e. allocated IR nodes).
93599 0 : for (unsigned j=0; j < SgOmpTargetParallelStatement::pool_size; j++)
93600 : {
93601 : // This is indexing the STL vector of C/C++ style arrays as a doubly
93602 : // indexed array access. It is OK since we have leveraged the semantics
93603 : // of STL vector memory as contigous and cast the memory as an array
93604 : // of arrays to use the 2D array indexing. Hope this is not confusing,
93605 : // but it s very fast as an implementation.
93606 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
93607 : {
93608 0 : count++;
93609 : }
93610 : }
93611 : }
93612 : }
93613 :
93614 :
93615 :
93616 4 : return count;
93617 : }
93618 :
93619 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
93620 : // using values that overflow signed values of int.
93621 : size_t
93622 0 : SgOmpTargetParallelStatement::memoryUsage()
93623 : {
93624 : // This function is required because we need the class name as a type when we call sizeof
93625 : // There might be another way to implement this if we have a traversal that only called a
93626 : // representative object (one call for each type of Sage IIIIR node).
93627 0 : size_t memory = numberOfNodes() * sizeof(SgOmpTargetParallelStatement);
93628 :
93629 0 : return memory;
93630 : }
93631 :
93632 : /* #line 93633 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
93633 :
93634 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
93635 : void
93636 5342 : SgOmpTargetParallelForSimdStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
93637 : {
93638 : // This function traverses the memory pool for only a specific IR node
93639 : // and calls the visit function of the input class execute a traversal
93640 : // similar to the style of the attribute based traversals within ROSE.
93641 : // This traversal will visit ALL nodes of the AST where as the other
93642 : // attribute based traversals visit only the embedded tree within the AST.
93643 :
93644 : // Initialize array to the address of the first element of the STL vector
93645 : // (which is guaranteed to be contiguous storage).
93646 : // SgOmpTargetParallelForSimdStatement objectArray [] = *(Memory_Block_List.begin());
93647 5342 : if (SgOmpTargetParallelForSimdStatement::pools.empty() == false)
93648 : {
93649 : // Generate an array of memory pools
93650 7 : SgOmpTargetParallelForSimdStatement** objectArray = (SgOmpTargetParallelForSimdStatement**) &(SgOmpTargetParallelForSimdStatement::pools[0]);
93651 :
93652 : // Build a local variable for better performance
93653 7 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
93654 : #if 0
93655 : // Iterate over the memory pools
93656 : for (unsigned int i=0; i < SgOmpTargetParallelForSimdStatement::pools.size(); i++)
93657 : {
93658 : // objectArray[i] is a single memory pool
93659 : for (int j=0; j < SgOmpTargetParallelForSimdStatement::pool_size; j++)
93660 : {
93661 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
93662 : {
93663 : traversal.visit(&(objectArray[i][j]));
93664 : }
93665 : }
93666 : }
93667 : #else
93668 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
93669 : // compute the list first and then call the visit function on each list element.
93670 :
93671 : // printf ("Inside of SgOmpTargetParallelForSimdStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
93672 :
93673 14 : std::vector<SgOmpTargetParallelForSimdStatement*> nodeList;
93674 :
93675 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
93676 14 : for (unsigned int i=0; i < SgOmpTargetParallelForSimdStatement::pools.size(); i++)
93677 : {
93678 : // objectArray[i] is a single memory pool
93679 14007 : for (unsigned j=0; j < SgOmpTargetParallelForSimdStatement::pool_size; j++)
93680 : {
93681 14000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
93682 : {
93683 7 : nodeList.push_back(&(objectArray[i][j]));
93684 : }
93685 : }
93686 : }
93687 :
93688 : // Iterate over the saved list
93689 7 : size_t nodeListSize = nodeList.size();
93690 14 : for (size_t i=0; i < nodeListSize; i++)
93691 : {
93692 7 : ROSE_ASSERT(nodeList[i] != NULL);
93693 : #if 0
93694 : traversal.visit(nodeList[i]);
93695 : #else
93696 7 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
93697 : {
93698 7 : traversal.visit(nodeList[i]);
93699 : }
93700 : #endif
93701 : }
93702 : #endif
93703 : }
93704 :
93705 : // This should not be required since all previously static data members are
93706 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
93707 :
93708 5342 : }
93709 :
93710 :
93711 : void
93712 194 : SgOmpTargetParallelForSimdStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
93713 : {
93714 : // This function traverses the memory pool for an IR node and
93715 : // calls the function to execute the visitor object.
93716 :
93717 : // Initialize array to the address of the first element of the STL vector
93718 : // (which is guarenteed to be contiguous storage).
93719 : // SgOmpTargetParallelForSimdStatement objectArray [] = *(Memory_Block_List.begin());
93720 194 : if (SgOmpTargetParallelForSimdStatement::pools.empty() == false)
93721 : {
93722 : // Generate an array of memory pools
93723 0 : SgOmpTargetParallelForSimdStatement** objectArray = (SgOmpTargetParallelForSimdStatement**) &(SgOmpTargetParallelForSimdStatement::pools[0]);
93724 :
93725 : // Build a local variable for better performance
93726 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
93727 :
93728 : // Iterate over the memory pools
93729 0 : for (unsigned int i=0; i < SgOmpTargetParallelForSimdStatement::pools.size(); i++)
93730 : {
93731 : // objectArray[i] is a single memory pool
93732 0 : for (unsigned j=0; j < SgOmpTargetParallelForSimdStatement::pool_size; j++)
93733 : {
93734 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
93735 : {
93736 : // printf ("Found a valid SgOmpTargetParallelForSimdStatement object in the memory pool %d at position %d \n",i,j);
93737 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
93738 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
93739 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
93740 : }
93741 : else
93742 : {
93743 : // printf ("Found a INVALID SgOmpTargetParallelForSimdStatement object in the memory pool \n");
93744 : }
93745 : }
93746 : }
93747 : }
93748 :
93749 : // This should not be required since all previously static data members are
93750 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
93751 :
93752 194 : }
93753 :
93754 : void
93755 0 : SgOmpTargetParallelForSimdStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
93756 : {
93757 : // This function visits only a single IR node of the memory pool.
93758 : // it is typically called once for each type of IR node within
93759 : // the automatically generated function: traverseRepresentativeNodes().
93760 :
93761 : // Initialize array to the address of the first element of the STL vector
93762 : // (which is guarenteed to be contiguous storage).
93763 : // SgOmpTargetParallelForSimdStatement objectArray [] = *(Memory_Block_List.begin());
93764 0 : if (SgOmpTargetParallelForSimdStatement::pools.empty() == false)
93765 : {
93766 : // Generate an array of memory pools
93767 0 : SgOmpTargetParallelForSimdStatement** objectArray = (SgOmpTargetParallelForSimdStatement**) &(SgOmpTargetParallelForSimdStatement::pools[0]);
93768 :
93769 : // Build a local variable for better performance
93770 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
93771 :
93772 : // Iterate over the memory pools
93773 0 : bool done = false;
93774 0 : unsigned i=0;
93775 :
93776 : // find the first valid IR node, call visit function, and then leave
93777 0 : while ( done == false && i < SgOmpTargetParallelForSimdStatement::pools.size() )
93778 : {
93779 : // objectArray[i] is a single memory pool
93780 : unsigned j=0;
93781 0 : while (done == false && j < SgOmpTargetParallelForSimdStatement::pool_size)
93782 : {
93783 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
93784 : {
93785 0 : traversal.visit(&(objectArray[i][j]));
93786 0 : done = true;
93787 : }
93788 0 : j++;
93789 : }
93790 0 : i++;
93791 : }
93792 :
93793 : #if 0
93794 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
93795 : if (done == false)
93796 : {
93797 : printf ("No representative for SgOmpTargetParallelForSimdStatement found in memory pools \n");
93798 : }
93799 : #endif
93800 : }
93801 0 : }
93802 :
93803 :
93804 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
93805 : // using values that overflow signed values of int.
93806 : size_t
93807 4 : SgOmpTargetParallelForSimdStatement::numberOfNodes()
93808 : {
93809 : // This function traverses the memory pool for an IR node and
93810 : // counts the number of IR nodes of a particular Sage III IR
93811 : // nodes type.
93812 :
93813 4 : size_t count = 0;
93814 4 : if (SgOmpTargetParallelForSimdStatement::pools.empty() == false)
93815 : {
93816 : // Generate an array of memory pools (this is actually a STL vector,
93817 : // but it is contiguious, so OK to treat this way).
93818 0 : SgOmpTargetParallelForSimdStatement** objectArray = (SgOmpTargetParallelForSimdStatement**) &(SgOmpTargetParallelForSimdStatement::pools[0]);
93819 :
93820 : // Build a local variable for better performance (make it a loop invariant variable).
93821 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
93822 :
93823 : // Iterate over all of the memory pools for this IR node.
93824 0 : for (unsigned int i=0; i < SgOmpTargetParallelForSimdStatement::pools.size(); i++)
93825 : {
93826 : // objectArray[i] is a single memory pool, iterate over all the
93827 : // IR nodes and only count those that are valid IR nodes used in
93828 : // the AST (i.e. allocated IR nodes).
93829 0 : for (unsigned j=0; j < SgOmpTargetParallelForSimdStatement::pool_size; j++)
93830 : {
93831 : // This is indexing the STL vector of C/C++ style arrays as a doubly
93832 : // indexed array access. It is OK since we have leveraged the semantics
93833 : // of STL vector memory as contigous and cast the memory as an array
93834 : // of arrays to use the 2D array indexing. Hope this is not confusing,
93835 : // but it s very fast as an implementation.
93836 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
93837 : {
93838 0 : count++;
93839 : }
93840 : }
93841 : }
93842 : }
93843 :
93844 :
93845 :
93846 4 : return count;
93847 : }
93848 :
93849 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
93850 : // using values that overflow signed values of int.
93851 : size_t
93852 0 : SgOmpTargetParallelForSimdStatement::memoryUsage()
93853 : {
93854 : // This function is required because we need the class name as a type when we call sizeof
93855 : // There might be another way to implement this if we have a traversal that only called a
93856 : // representative object (one call for each type of Sage IIIIR node).
93857 0 : size_t memory = numberOfNodes() * sizeof(SgOmpTargetParallelForSimdStatement);
93858 :
93859 0 : return memory;
93860 : }
93861 :
93862 : /* #line 93863 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
93863 :
93864 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
93865 : void
93866 5342 : SgOmpTargetParallelLoopStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
93867 : {
93868 : // This function traverses the memory pool for only a specific IR node
93869 : // and calls the visit function of the input class execute a traversal
93870 : // similar to the style of the attribute based traversals within ROSE.
93871 : // This traversal will visit ALL nodes of the AST where as the other
93872 : // attribute based traversals visit only the embedded tree within the AST.
93873 :
93874 : // Initialize array to the address of the first element of the STL vector
93875 : // (which is guaranteed to be contiguous storage).
93876 : // SgOmpTargetParallelLoopStatement objectArray [] = *(Memory_Block_List.begin());
93877 5342 : if (SgOmpTargetParallelLoopStatement::pools.empty() == false)
93878 : {
93879 : // Generate an array of memory pools
93880 7 : SgOmpTargetParallelLoopStatement** objectArray = (SgOmpTargetParallelLoopStatement**) &(SgOmpTargetParallelLoopStatement::pools[0]);
93881 :
93882 : // Build a local variable for better performance
93883 7 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
93884 : #if 0
93885 : // Iterate over the memory pools
93886 : for (unsigned int i=0; i < SgOmpTargetParallelLoopStatement::pools.size(); i++)
93887 : {
93888 : // objectArray[i] is a single memory pool
93889 : for (int j=0; j < SgOmpTargetParallelLoopStatement::pool_size; j++)
93890 : {
93891 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
93892 : {
93893 : traversal.visit(&(objectArray[i][j]));
93894 : }
93895 : }
93896 : }
93897 : #else
93898 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
93899 : // compute the list first and then call the visit function on each list element.
93900 :
93901 : // printf ("Inside of SgOmpTargetParallelLoopStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
93902 :
93903 14 : std::vector<SgOmpTargetParallelLoopStatement*> nodeList;
93904 :
93905 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
93906 14 : for (unsigned int i=0; i < SgOmpTargetParallelLoopStatement::pools.size(); i++)
93907 : {
93908 : // objectArray[i] is a single memory pool
93909 14007 : for (unsigned j=0; j < SgOmpTargetParallelLoopStatement::pool_size; j++)
93910 : {
93911 14000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
93912 : {
93913 7 : nodeList.push_back(&(objectArray[i][j]));
93914 : }
93915 : }
93916 : }
93917 :
93918 : // Iterate over the saved list
93919 7 : size_t nodeListSize = nodeList.size();
93920 14 : for (size_t i=0; i < nodeListSize; i++)
93921 : {
93922 7 : ROSE_ASSERT(nodeList[i] != NULL);
93923 : #if 0
93924 : traversal.visit(nodeList[i]);
93925 : #else
93926 7 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
93927 : {
93928 7 : traversal.visit(nodeList[i]);
93929 : }
93930 : #endif
93931 : }
93932 : #endif
93933 : }
93934 :
93935 : // This should not be required since all previously static data members are
93936 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
93937 :
93938 5342 : }
93939 :
93940 :
93941 : void
93942 194 : SgOmpTargetParallelLoopStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
93943 : {
93944 : // This function traverses the memory pool for an IR node and
93945 : // calls the function to execute the visitor object.
93946 :
93947 : // Initialize array to the address of the first element of the STL vector
93948 : // (which is guarenteed to be contiguous storage).
93949 : // SgOmpTargetParallelLoopStatement objectArray [] = *(Memory_Block_List.begin());
93950 194 : if (SgOmpTargetParallelLoopStatement::pools.empty() == false)
93951 : {
93952 : // Generate an array of memory pools
93953 0 : SgOmpTargetParallelLoopStatement** objectArray = (SgOmpTargetParallelLoopStatement**) &(SgOmpTargetParallelLoopStatement::pools[0]);
93954 :
93955 : // Build a local variable for better performance
93956 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
93957 :
93958 : // Iterate over the memory pools
93959 0 : for (unsigned int i=0; i < SgOmpTargetParallelLoopStatement::pools.size(); i++)
93960 : {
93961 : // objectArray[i] is a single memory pool
93962 0 : for (unsigned j=0; j < SgOmpTargetParallelLoopStatement::pool_size; j++)
93963 : {
93964 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
93965 : {
93966 : // printf ("Found a valid SgOmpTargetParallelLoopStatement object in the memory pool %d at position %d \n",i,j);
93967 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
93968 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
93969 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
93970 : }
93971 : else
93972 : {
93973 : // printf ("Found a INVALID SgOmpTargetParallelLoopStatement object in the memory pool \n");
93974 : }
93975 : }
93976 : }
93977 : }
93978 :
93979 : // This should not be required since all previously static data members are
93980 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
93981 :
93982 194 : }
93983 :
93984 : void
93985 0 : SgOmpTargetParallelLoopStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
93986 : {
93987 : // This function visits only a single IR node of the memory pool.
93988 : // it is typically called once for each type of IR node within
93989 : // the automatically generated function: traverseRepresentativeNodes().
93990 :
93991 : // Initialize array to the address of the first element of the STL vector
93992 : // (which is guarenteed to be contiguous storage).
93993 : // SgOmpTargetParallelLoopStatement objectArray [] = *(Memory_Block_List.begin());
93994 0 : if (SgOmpTargetParallelLoopStatement::pools.empty() == false)
93995 : {
93996 : // Generate an array of memory pools
93997 0 : SgOmpTargetParallelLoopStatement** objectArray = (SgOmpTargetParallelLoopStatement**) &(SgOmpTargetParallelLoopStatement::pools[0]);
93998 :
93999 : // Build a local variable for better performance
94000 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
94001 :
94002 : // Iterate over the memory pools
94003 0 : bool done = false;
94004 0 : unsigned i=0;
94005 :
94006 : // find the first valid IR node, call visit function, and then leave
94007 0 : while ( done == false && i < SgOmpTargetParallelLoopStatement::pools.size() )
94008 : {
94009 : // objectArray[i] is a single memory pool
94010 : unsigned j=0;
94011 0 : while (done == false && j < SgOmpTargetParallelLoopStatement::pool_size)
94012 : {
94013 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
94014 : {
94015 0 : traversal.visit(&(objectArray[i][j]));
94016 0 : done = true;
94017 : }
94018 0 : j++;
94019 : }
94020 0 : i++;
94021 : }
94022 :
94023 : #if 0
94024 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
94025 : if (done == false)
94026 : {
94027 : printf ("No representative for SgOmpTargetParallelLoopStatement found in memory pools \n");
94028 : }
94029 : #endif
94030 : }
94031 0 : }
94032 :
94033 :
94034 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
94035 : // using values that overflow signed values of int.
94036 : size_t
94037 4 : SgOmpTargetParallelLoopStatement::numberOfNodes()
94038 : {
94039 : // This function traverses the memory pool for an IR node and
94040 : // counts the number of IR nodes of a particular Sage III IR
94041 : // nodes type.
94042 :
94043 4 : size_t count = 0;
94044 4 : if (SgOmpTargetParallelLoopStatement::pools.empty() == false)
94045 : {
94046 : // Generate an array of memory pools (this is actually a STL vector,
94047 : // but it is contiguious, so OK to treat this way).
94048 0 : SgOmpTargetParallelLoopStatement** objectArray = (SgOmpTargetParallelLoopStatement**) &(SgOmpTargetParallelLoopStatement::pools[0]);
94049 :
94050 : // Build a local variable for better performance (make it a loop invariant variable).
94051 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
94052 :
94053 : // Iterate over all of the memory pools for this IR node.
94054 0 : for (unsigned int i=0; i < SgOmpTargetParallelLoopStatement::pools.size(); i++)
94055 : {
94056 : // objectArray[i] is a single memory pool, iterate over all the
94057 : // IR nodes and only count those that are valid IR nodes used in
94058 : // the AST (i.e. allocated IR nodes).
94059 0 : for (unsigned j=0; j < SgOmpTargetParallelLoopStatement::pool_size; j++)
94060 : {
94061 : // This is indexing the STL vector of C/C++ style arrays as a doubly
94062 : // indexed array access. It is OK since we have leveraged the semantics
94063 : // of STL vector memory as contigous and cast the memory as an array
94064 : // of arrays to use the 2D array indexing. Hope this is not confusing,
94065 : // but it s very fast as an implementation.
94066 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
94067 : {
94068 0 : count++;
94069 : }
94070 : }
94071 : }
94072 : }
94073 :
94074 :
94075 :
94076 4 : return count;
94077 : }
94078 :
94079 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
94080 : // using values that overflow signed values of int.
94081 : size_t
94082 0 : SgOmpTargetParallelLoopStatement::memoryUsage()
94083 : {
94084 : // This function is required because we need the class name as a type when we call sizeof
94085 : // There might be another way to implement this if we have a traversal that only called a
94086 : // representative object (one call for each type of Sage IIIIR node).
94087 0 : size_t memory = numberOfNodes() * sizeof(SgOmpTargetParallelLoopStatement);
94088 :
94089 0 : return memory;
94090 : }
94091 :
94092 : /* #line 94093 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
94093 :
94094 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
94095 : void
94096 5342 : SgOmpTargetSimdStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
94097 : {
94098 : // This function traverses the memory pool for only a specific IR node
94099 : // and calls the visit function of the input class execute a traversal
94100 : // similar to the style of the attribute based traversals within ROSE.
94101 : // This traversal will visit ALL nodes of the AST where as the other
94102 : // attribute based traversals visit only the embedded tree within the AST.
94103 :
94104 : // Initialize array to the address of the first element of the STL vector
94105 : // (which is guaranteed to be contiguous storage).
94106 : // SgOmpTargetSimdStatement objectArray [] = *(Memory_Block_List.begin());
94107 5342 : if (SgOmpTargetSimdStatement::pools.empty() == false)
94108 : {
94109 : // Generate an array of memory pools
94110 7 : SgOmpTargetSimdStatement** objectArray = (SgOmpTargetSimdStatement**) &(SgOmpTargetSimdStatement::pools[0]);
94111 :
94112 : // Build a local variable for better performance
94113 7 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
94114 : #if 0
94115 : // Iterate over the memory pools
94116 : for (unsigned int i=0; i < SgOmpTargetSimdStatement::pools.size(); i++)
94117 : {
94118 : // objectArray[i] is a single memory pool
94119 : for (int j=0; j < SgOmpTargetSimdStatement::pool_size; j++)
94120 : {
94121 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
94122 : {
94123 : traversal.visit(&(objectArray[i][j]));
94124 : }
94125 : }
94126 : }
94127 : #else
94128 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
94129 : // compute the list first and then call the visit function on each list element.
94130 :
94131 : // printf ("Inside of SgOmpTargetSimdStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
94132 :
94133 14 : std::vector<SgOmpTargetSimdStatement*> nodeList;
94134 :
94135 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
94136 14 : for (unsigned int i=0; i < SgOmpTargetSimdStatement::pools.size(); i++)
94137 : {
94138 : // objectArray[i] is a single memory pool
94139 14007 : for (unsigned j=0; j < SgOmpTargetSimdStatement::pool_size; j++)
94140 : {
94141 14000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
94142 : {
94143 7 : nodeList.push_back(&(objectArray[i][j]));
94144 : }
94145 : }
94146 : }
94147 :
94148 : // Iterate over the saved list
94149 7 : size_t nodeListSize = nodeList.size();
94150 14 : for (size_t i=0; i < nodeListSize; i++)
94151 : {
94152 7 : ROSE_ASSERT(nodeList[i] != NULL);
94153 : #if 0
94154 : traversal.visit(nodeList[i]);
94155 : #else
94156 7 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
94157 : {
94158 7 : traversal.visit(nodeList[i]);
94159 : }
94160 : #endif
94161 : }
94162 : #endif
94163 : }
94164 :
94165 : // This should not be required since all previously static data members are
94166 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
94167 :
94168 5342 : }
94169 :
94170 :
94171 : void
94172 194 : SgOmpTargetSimdStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
94173 : {
94174 : // This function traverses the memory pool for an IR node and
94175 : // calls the function to execute the visitor object.
94176 :
94177 : // Initialize array to the address of the first element of the STL vector
94178 : // (which is guarenteed to be contiguous storage).
94179 : // SgOmpTargetSimdStatement objectArray [] = *(Memory_Block_List.begin());
94180 194 : if (SgOmpTargetSimdStatement::pools.empty() == false)
94181 : {
94182 : // Generate an array of memory pools
94183 0 : SgOmpTargetSimdStatement** objectArray = (SgOmpTargetSimdStatement**) &(SgOmpTargetSimdStatement::pools[0]);
94184 :
94185 : // Build a local variable for better performance
94186 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
94187 :
94188 : // Iterate over the memory pools
94189 0 : for (unsigned int i=0; i < SgOmpTargetSimdStatement::pools.size(); i++)
94190 : {
94191 : // objectArray[i] is a single memory pool
94192 0 : for (unsigned j=0; j < SgOmpTargetSimdStatement::pool_size; j++)
94193 : {
94194 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
94195 : {
94196 : // printf ("Found a valid SgOmpTargetSimdStatement object in the memory pool %d at position %d \n",i,j);
94197 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
94198 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
94199 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
94200 : }
94201 : else
94202 : {
94203 : // printf ("Found a INVALID SgOmpTargetSimdStatement object in the memory pool \n");
94204 : }
94205 : }
94206 : }
94207 : }
94208 :
94209 : // This should not be required since all previously static data members are
94210 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
94211 :
94212 194 : }
94213 :
94214 : void
94215 0 : SgOmpTargetSimdStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
94216 : {
94217 : // This function visits only a single IR node of the memory pool.
94218 : // it is typically called once for each type of IR node within
94219 : // the automatically generated function: traverseRepresentativeNodes().
94220 :
94221 : // Initialize array to the address of the first element of the STL vector
94222 : // (which is guarenteed to be contiguous storage).
94223 : // SgOmpTargetSimdStatement objectArray [] = *(Memory_Block_List.begin());
94224 0 : if (SgOmpTargetSimdStatement::pools.empty() == false)
94225 : {
94226 : // Generate an array of memory pools
94227 0 : SgOmpTargetSimdStatement** objectArray = (SgOmpTargetSimdStatement**) &(SgOmpTargetSimdStatement::pools[0]);
94228 :
94229 : // Build a local variable for better performance
94230 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
94231 :
94232 : // Iterate over the memory pools
94233 0 : bool done = false;
94234 0 : unsigned i=0;
94235 :
94236 : // find the first valid IR node, call visit function, and then leave
94237 0 : while ( done == false && i < SgOmpTargetSimdStatement::pools.size() )
94238 : {
94239 : // objectArray[i] is a single memory pool
94240 : unsigned j=0;
94241 0 : while (done == false && j < SgOmpTargetSimdStatement::pool_size)
94242 : {
94243 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
94244 : {
94245 0 : traversal.visit(&(objectArray[i][j]));
94246 0 : done = true;
94247 : }
94248 0 : j++;
94249 : }
94250 0 : i++;
94251 : }
94252 :
94253 : #if 0
94254 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
94255 : if (done == false)
94256 : {
94257 : printf ("No representative for SgOmpTargetSimdStatement found in memory pools \n");
94258 : }
94259 : #endif
94260 : }
94261 0 : }
94262 :
94263 :
94264 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
94265 : // using values that overflow signed values of int.
94266 : size_t
94267 4 : SgOmpTargetSimdStatement::numberOfNodes()
94268 : {
94269 : // This function traverses the memory pool for an IR node and
94270 : // counts the number of IR nodes of a particular Sage III IR
94271 : // nodes type.
94272 :
94273 4 : size_t count = 0;
94274 4 : if (SgOmpTargetSimdStatement::pools.empty() == false)
94275 : {
94276 : // Generate an array of memory pools (this is actually a STL vector,
94277 : // but it is contiguious, so OK to treat this way).
94278 0 : SgOmpTargetSimdStatement** objectArray = (SgOmpTargetSimdStatement**) &(SgOmpTargetSimdStatement::pools[0]);
94279 :
94280 : // Build a local variable for better performance (make it a loop invariant variable).
94281 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
94282 :
94283 : // Iterate over all of the memory pools for this IR node.
94284 0 : for (unsigned int i=0; i < SgOmpTargetSimdStatement::pools.size(); i++)
94285 : {
94286 : // objectArray[i] is a single memory pool, iterate over all the
94287 : // IR nodes and only count those that are valid IR nodes used in
94288 : // the AST (i.e. allocated IR nodes).
94289 0 : for (unsigned j=0; j < SgOmpTargetSimdStatement::pool_size; j++)
94290 : {
94291 : // This is indexing the STL vector of C/C++ style arrays as a doubly
94292 : // indexed array access. It is OK since we have leveraged the semantics
94293 : // of STL vector memory as contigous and cast the memory as an array
94294 : // of arrays to use the 2D array indexing. Hope this is not confusing,
94295 : // but it s very fast as an implementation.
94296 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
94297 : {
94298 0 : count++;
94299 : }
94300 : }
94301 : }
94302 : }
94303 :
94304 :
94305 :
94306 4 : return count;
94307 : }
94308 :
94309 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
94310 : // using values that overflow signed values of int.
94311 : size_t
94312 0 : SgOmpTargetSimdStatement::memoryUsage()
94313 : {
94314 : // This function is required because we need the class name as a type when we call sizeof
94315 : // There might be another way to implement this if we have a traversal that only called a
94316 : // representative object (one call for each type of Sage IIIIR node).
94317 0 : size_t memory = numberOfNodes() * sizeof(SgOmpTargetSimdStatement);
94318 :
94319 0 : return memory;
94320 : }
94321 :
94322 : /* #line 94323 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
94323 :
94324 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
94325 : void
94326 5342 : SgOmpTargetTeamsStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
94327 : {
94328 : // This function traverses the memory pool for only a specific IR node
94329 : // and calls the visit function of the input class execute a traversal
94330 : // similar to the style of the attribute based traversals within ROSE.
94331 : // This traversal will visit ALL nodes of the AST where as the other
94332 : // attribute based traversals visit only the embedded tree within the AST.
94333 :
94334 : // Initialize array to the address of the first element of the STL vector
94335 : // (which is guaranteed to be contiguous storage).
94336 : // SgOmpTargetTeamsStatement objectArray [] = *(Memory_Block_List.begin());
94337 5342 : if (SgOmpTargetTeamsStatement::pools.empty() == false)
94338 : {
94339 : // Generate an array of memory pools
94340 28 : SgOmpTargetTeamsStatement** objectArray = (SgOmpTargetTeamsStatement**) &(SgOmpTargetTeamsStatement::pools[0]);
94341 :
94342 : // Build a local variable for better performance
94343 28 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
94344 : #if 0
94345 : // Iterate over the memory pools
94346 : for (unsigned int i=0; i < SgOmpTargetTeamsStatement::pools.size(); i++)
94347 : {
94348 : // objectArray[i] is a single memory pool
94349 : for (int j=0; j < SgOmpTargetTeamsStatement::pool_size; j++)
94350 : {
94351 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
94352 : {
94353 : traversal.visit(&(objectArray[i][j]));
94354 : }
94355 : }
94356 : }
94357 : #else
94358 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
94359 : // compute the list first and then call the visit function on each list element.
94360 :
94361 : // printf ("Inside of SgOmpTargetTeamsStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
94362 :
94363 56 : std::vector<SgOmpTargetTeamsStatement*> nodeList;
94364 :
94365 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
94366 56 : for (unsigned int i=0; i < SgOmpTargetTeamsStatement::pools.size(); i++)
94367 : {
94368 : // objectArray[i] is a single memory pool
94369 56028 : for (unsigned j=0; j < SgOmpTargetTeamsStatement::pool_size; j++)
94370 : {
94371 56000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
94372 : {
94373 28 : nodeList.push_back(&(objectArray[i][j]));
94374 : }
94375 : }
94376 : }
94377 :
94378 : // Iterate over the saved list
94379 28 : size_t nodeListSize = nodeList.size();
94380 56 : for (size_t i=0; i < nodeListSize; i++)
94381 : {
94382 28 : ROSE_ASSERT(nodeList[i] != NULL);
94383 : #if 0
94384 : traversal.visit(nodeList[i]);
94385 : #else
94386 28 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
94387 : {
94388 28 : traversal.visit(nodeList[i]);
94389 : }
94390 : #endif
94391 : }
94392 : #endif
94393 : }
94394 :
94395 : // This should not be required since all previously static data members are
94396 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
94397 :
94398 5342 : }
94399 :
94400 :
94401 : void
94402 194 : SgOmpTargetTeamsStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
94403 : {
94404 : // This function traverses the memory pool for an IR node and
94405 : // calls the function to execute the visitor object.
94406 :
94407 : // Initialize array to the address of the first element of the STL vector
94408 : // (which is guarenteed to be contiguous storage).
94409 : // SgOmpTargetTeamsStatement objectArray [] = *(Memory_Block_List.begin());
94410 194 : if (SgOmpTargetTeamsStatement::pools.empty() == false)
94411 : {
94412 : // Generate an array of memory pools
94413 0 : SgOmpTargetTeamsStatement** objectArray = (SgOmpTargetTeamsStatement**) &(SgOmpTargetTeamsStatement::pools[0]);
94414 :
94415 : // Build a local variable for better performance
94416 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
94417 :
94418 : // Iterate over the memory pools
94419 0 : for (unsigned int i=0; i < SgOmpTargetTeamsStatement::pools.size(); i++)
94420 : {
94421 : // objectArray[i] is a single memory pool
94422 0 : for (unsigned j=0; j < SgOmpTargetTeamsStatement::pool_size; j++)
94423 : {
94424 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
94425 : {
94426 : // printf ("Found a valid SgOmpTargetTeamsStatement object in the memory pool %d at position %d \n",i,j);
94427 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
94428 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
94429 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
94430 : }
94431 : else
94432 : {
94433 : // printf ("Found a INVALID SgOmpTargetTeamsStatement object in the memory pool \n");
94434 : }
94435 : }
94436 : }
94437 : }
94438 :
94439 : // This should not be required since all previously static data members are
94440 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
94441 :
94442 194 : }
94443 :
94444 : void
94445 0 : SgOmpTargetTeamsStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
94446 : {
94447 : // This function visits only a single IR node of the memory pool.
94448 : // it is typically called once for each type of IR node within
94449 : // the automatically generated function: traverseRepresentativeNodes().
94450 :
94451 : // Initialize array to the address of the first element of the STL vector
94452 : // (which is guarenteed to be contiguous storage).
94453 : // SgOmpTargetTeamsStatement objectArray [] = *(Memory_Block_List.begin());
94454 0 : if (SgOmpTargetTeamsStatement::pools.empty() == false)
94455 : {
94456 : // Generate an array of memory pools
94457 0 : SgOmpTargetTeamsStatement** objectArray = (SgOmpTargetTeamsStatement**) &(SgOmpTargetTeamsStatement::pools[0]);
94458 :
94459 : // Build a local variable for better performance
94460 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
94461 :
94462 : // Iterate over the memory pools
94463 0 : bool done = false;
94464 0 : unsigned i=0;
94465 :
94466 : // find the first valid IR node, call visit function, and then leave
94467 0 : while ( done == false && i < SgOmpTargetTeamsStatement::pools.size() )
94468 : {
94469 : // objectArray[i] is a single memory pool
94470 : unsigned j=0;
94471 0 : while (done == false && j < SgOmpTargetTeamsStatement::pool_size)
94472 : {
94473 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
94474 : {
94475 0 : traversal.visit(&(objectArray[i][j]));
94476 0 : done = true;
94477 : }
94478 0 : j++;
94479 : }
94480 0 : i++;
94481 : }
94482 :
94483 : #if 0
94484 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
94485 : if (done == false)
94486 : {
94487 : printf ("No representative for SgOmpTargetTeamsStatement found in memory pools \n");
94488 : }
94489 : #endif
94490 : }
94491 0 : }
94492 :
94493 :
94494 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
94495 : // using values that overflow signed values of int.
94496 : size_t
94497 4 : SgOmpTargetTeamsStatement::numberOfNodes()
94498 : {
94499 : // This function traverses the memory pool for an IR node and
94500 : // counts the number of IR nodes of a particular Sage III IR
94501 : // nodes type.
94502 :
94503 4 : size_t count = 0;
94504 4 : if (SgOmpTargetTeamsStatement::pools.empty() == false)
94505 : {
94506 : // Generate an array of memory pools (this is actually a STL vector,
94507 : // but it is contiguious, so OK to treat this way).
94508 0 : SgOmpTargetTeamsStatement** objectArray = (SgOmpTargetTeamsStatement**) &(SgOmpTargetTeamsStatement::pools[0]);
94509 :
94510 : // Build a local variable for better performance (make it a loop invariant variable).
94511 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
94512 :
94513 : // Iterate over all of the memory pools for this IR node.
94514 0 : for (unsigned int i=0; i < SgOmpTargetTeamsStatement::pools.size(); i++)
94515 : {
94516 : // objectArray[i] is a single memory pool, iterate over all the
94517 : // IR nodes and only count those that are valid IR nodes used in
94518 : // the AST (i.e. allocated IR nodes).
94519 0 : for (unsigned j=0; j < SgOmpTargetTeamsStatement::pool_size; j++)
94520 : {
94521 : // This is indexing the STL vector of C/C++ style arrays as a doubly
94522 : // indexed array access. It is OK since we have leveraged the semantics
94523 : // of STL vector memory as contigous and cast the memory as an array
94524 : // of arrays to use the 2D array indexing. Hope this is not confusing,
94525 : // but it s very fast as an implementation.
94526 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
94527 : {
94528 0 : count++;
94529 : }
94530 : }
94531 : }
94532 : }
94533 :
94534 :
94535 :
94536 4 : return count;
94537 : }
94538 :
94539 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
94540 : // using values that overflow signed values of int.
94541 : size_t
94542 0 : SgOmpTargetTeamsStatement::memoryUsage()
94543 : {
94544 : // This function is required because we need the class name as a type when we call sizeof
94545 : // There might be another way to implement this if we have a traversal that only called a
94546 : // representative object (one call for each type of Sage IIIIR node).
94547 0 : size_t memory = numberOfNodes() * sizeof(SgOmpTargetTeamsStatement);
94548 :
94549 0 : return memory;
94550 : }
94551 :
94552 : /* #line 94553 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
94553 :
94554 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
94555 : void
94556 5342 : SgOmpTargetTeamsDistributeStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
94557 : {
94558 : // This function traverses the memory pool for only a specific IR node
94559 : // and calls the visit function of the input class execute a traversal
94560 : // similar to the style of the attribute based traversals within ROSE.
94561 : // This traversal will visit ALL nodes of the AST where as the other
94562 : // attribute based traversals visit only the embedded tree within the AST.
94563 :
94564 : // Initialize array to the address of the first element of the STL vector
94565 : // (which is guaranteed to be contiguous storage).
94566 : // SgOmpTargetTeamsDistributeStatement objectArray [] = *(Memory_Block_List.begin());
94567 5342 : if (SgOmpTargetTeamsDistributeStatement::pools.empty() == false)
94568 : {
94569 : // Generate an array of memory pools
94570 7 : SgOmpTargetTeamsDistributeStatement** objectArray = (SgOmpTargetTeamsDistributeStatement**) &(SgOmpTargetTeamsDistributeStatement::pools[0]);
94571 :
94572 : // Build a local variable for better performance
94573 7 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
94574 : #if 0
94575 : // Iterate over the memory pools
94576 : for (unsigned int i=0; i < SgOmpTargetTeamsDistributeStatement::pools.size(); i++)
94577 : {
94578 : // objectArray[i] is a single memory pool
94579 : for (int j=0; j < SgOmpTargetTeamsDistributeStatement::pool_size; j++)
94580 : {
94581 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
94582 : {
94583 : traversal.visit(&(objectArray[i][j]));
94584 : }
94585 : }
94586 : }
94587 : #else
94588 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
94589 : // compute the list first and then call the visit function on each list element.
94590 :
94591 : // printf ("Inside of SgOmpTargetTeamsDistributeStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
94592 :
94593 14 : std::vector<SgOmpTargetTeamsDistributeStatement*> nodeList;
94594 :
94595 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
94596 14 : for (unsigned int i=0; i < SgOmpTargetTeamsDistributeStatement::pools.size(); i++)
94597 : {
94598 : // objectArray[i] is a single memory pool
94599 14007 : for (unsigned j=0; j < SgOmpTargetTeamsDistributeStatement::pool_size; j++)
94600 : {
94601 14000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
94602 : {
94603 7 : nodeList.push_back(&(objectArray[i][j]));
94604 : }
94605 : }
94606 : }
94607 :
94608 : // Iterate over the saved list
94609 7 : size_t nodeListSize = nodeList.size();
94610 14 : for (size_t i=0; i < nodeListSize; i++)
94611 : {
94612 7 : ROSE_ASSERT(nodeList[i] != NULL);
94613 : #if 0
94614 : traversal.visit(nodeList[i]);
94615 : #else
94616 7 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
94617 : {
94618 7 : traversal.visit(nodeList[i]);
94619 : }
94620 : #endif
94621 : }
94622 : #endif
94623 : }
94624 :
94625 : // This should not be required since all previously static data members are
94626 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
94627 :
94628 5342 : }
94629 :
94630 :
94631 : void
94632 194 : SgOmpTargetTeamsDistributeStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
94633 : {
94634 : // This function traverses the memory pool for an IR node and
94635 : // calls the function to execute the visitor object.
94636 :
94637 : // Initialize array to the address of the first element of the STL vector
94638 : // (which is guarenteed to be contiguous storage).
94639 : // SgOmpTargetTeamsDistributeStatement objectArray [] = *(Memory_Block_List.begin());
94640 194 : if (SgOmpTargetTeamsDistributeStatement::pools.empty() == false)
94641 : {
94642 : // Generate an array of memory pools
94643 0 : SgOmpTargetTeamsDistributeStatement** objectArray = (SgOmpTargetTeamsDistributeStatement**) &(SgOmpTargetTeamsDistributeStatement::pools[0]);
94644 :
94645 : // Build a local variable for better performance
94646 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
94647 :
94648 : // Iterate over the memory pools
94649 0 : for (unsigned int i=0; i < SgOmpTargetTeamsDistributeStatement::pools.size(); i++)
94650 : {
94651 : // objectArray[i] is a single memory pool
94652 0 : for (unsigned j=0; j < SgOmpTargetTeamsDistributeStatement::pool_size; j++)
94653 : {
94654 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
94655 : {
94656 : // printf ("Found a valid SgOmpTargetTeamsDistributeStatement object in the memory pool %d at position %d \n",i,j);
94657 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
94658 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
94659 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
94660 : }
94661 : else
94662 : {
94663 : // printf ("Found a INVALID SgOmpTargetTeamsDistributeStatement object in the memory pool \n");
94664 : }
94665 : }
94666 : }
94667 : }
94668 :
94669 : // This should not be required since all previously static data members are
94670 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
94671 :
94672 194 : }
94673 :
94674 : void
94675 0 : SgOmpTargetTeamsDistributeStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
94676 : {
94677 : // This function visits only a single IR node of the memory pool.
94678 : // it is typically called once for each type of IR node within
94679 : // the automatically generated function: traverseRepresentativeNodes().
94680 :
94681 : // Initialize array to the address of the first element of the STL vector
94682 : // (which is guarenteed to be contiguous storage).
94683 : // SgOmpTargetTeamsDistributeStatement objectArray [] = *(Memory_Block_List.begin());
94684 0 : if (SgOmpTargetTeamsDistributeStatement::pools.empty() == false)
94685 : {
94686 : // Generate an array of memory pools
94687 0 : SgOmpTargetTeamsDistributeStatement** objectArray = (SgOmpTargetTeamsDistributeStatement**) &(SgOmpTargetTeamsDistributeStatement::pools[0]);
94688 :
94689 : // Build a local variable for better performance
94690 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
94691 :
94692 : // Iterate over the memory pools
94693 0 : bool done = false;
94694 0 : unsigned i=0;
94695 :
94696 : // find the first valid IR node, call visit function, and then leave
94697 0 : while ( done == false && i < SgOmpTargetTeamsDistributeStatement::pools.size() )
94698 : {
94699 : // objectArray[i] is a single memory pool
94700 : unsigned j=0;
94701 0 : while (done == false && j < SgOmpTargetTeamsDistributeStatement::pool_size)
94702 : {
94703 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
94704 : {
94705 0 : traversal.visit(&(objectArray[i][j]));
94706 0 : done = true;
94707 : }
94708 0 : j++;
94709 : }
94710 0 : i++;
94711 : }
94712 :
94713 : #if 0
94714 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
94715 : if (done == false)
94716 : {
94717 : printf ("No representative for SgOmpTargetTeamsDistributeStatement found in memory pools \n");
94718 : }
94719 : #endif
94720 : }
94721 0 : }
94722 :
94723 :
94724 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
94725 : // using values that overflow signed values of int.
94726 : size_t
94727 4 : SgOmpTargetTeamsDistributeStatement::numberOfNodes()
94728 : {
94729 : // This function traverses the memory pool for an IR node and
94730 : // counts the number of IR nodes of a particular Sage III IR
94731 : // nodes type.
94732 :
94733 4 : size_t count = 0;
94734 4 : if (SgOmpTargetTeamsDistributeStatement::pools.empty() == false)
94735 : {
94736 : // Generate an array of memory pools (this is actually a STL vector,
94737 : // but it is contiguious, so OK to treat this way).
94738 0 : SgOmpTargetTeamsDistributeStatement** objectArray = (SgOmpTargetTeamsDistributeStatement**) &(SgOmpTargetTeamsDistributeStatement::pools[0]);
94739 :
94740 : // Build a local variable for better performance (make it a loop invariant variable).
94741 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
94742 :
94743 : // Iterate over all of the memory pools for this IR node.
94744 0 : for (unsigned int i=0; i < SgOmpTargetTeamsDistributeStatement::pools.size(); i++)
94745 : {
94746 : // objectArray[i] is a single memory pool, iterate over all the
94747 : // IR nodes and only count those that are valid IR nodes used in
94748 : // the AST (i.e. allocated IR nodes).
94749 0 : for (unsigned j=0; j < SgOmpTargetTeamsDistributeStatement::pool_size; j++)
94750 : {
94751 : // This is indexing the STL vector of C/C++ style arrays as a doubly
94752 : // indexed array access. It is OK since we have leveraged the semantics
94753 : // of STL vector memory as contigous and cast the memory as an array
94754 : // of arrays to use the 2D array indexing. Hope this is not confusing,
94755 : // but it s very fast as an implementation.
94756 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
94757 : {
94758 0 : count++;
94759 : }
94760 : }
94761 : }
94762 : }
94763 :
94764 :
94765 :
94766 4 : return count;
94767 : }
94768 :
94769 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
94770 : // using values that overflow signed values of int.
94771 : size_t
94772 0 : SgOmpTargetTeamsDistributeStatement::memoryUsage()
94773 : {
94774 : // This function is required because we need the class name as a type when we call sizeof
94775 : // There might be another way to implement this if we have a traversal that only called a
94776 : // representative object (one call for each type of Sage IIIIR node).
94777 0 : size_t memory = numberOfNodes() * sizeof(SgOmpTargetTeamsDistributeStatement);
94778 :
94779 0 : return memory;
94780 : }
94781 :
94782 : /* #line 94783 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
94783 :
94784 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
94785 : void
94786 5342 : SgOmpTargetTeamsDistributeSimdStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
94787 : {
94788 : // This function traverses the memory pool for only a specific IR node
94789 : // and calls the visit function of the input class execute a traversal
94790 : // similar to the style of the attribute based traversals within ROSE.
94791 : // This traversal will visit ALL nodes of the AST where as the other
94792 : // attribute based traversals visit only the embedded tree within the AST.
94793 :
94794 : // Initialize array to the address of the first element of the STL vector
94795 : // (which is guaranteed to be contiguous storage).
94796 : // SgOmpTargetTeamsDistributeSimdStatement objectArray [] = *(Memory_Block_List.begin());
94797 5342 : if (SgOmpTargetTeamsDistributeSimdStatement::pools.empty() == false)
94798 : {
94799 : // Generate an array of memory pools
94800 7 : SgOmpTargetTeamsDistributeSimdStatement** objectArray = (SgOmpTargetTeamsDistributeSimdStatement**) &(SgOmpTargetTeamsDistributeSimdStatement::pools[0]);
94801 :
94802 : // Build a local variable for better performance
94803 7 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
94804 : #if 0
94805 : // Iterate over the memory pools
94806 : for (unsigned int i=0; i < SgOmpTargetTeamsDistributeSimdStatement::pools.size(); i++)
94807 : {
94808 : // objectArray[i] is a single memory pool
94809 : for (int j=0; j < SgOmpTargetTeamsDistributeSimdStatement::pool_size; j++)
94810 : {
94811 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
94812 : {
94813 : traversal.visit(&(objectArray[i][j]));
94814 : }
94815 : }
94816 : }
94817 : #else
94818 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
94819 : // compute the list first and then call the visit function on each list element.
94820 :
94821 : // printf ("Inside of SgOmpTargetTeamsDistributeSimdStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
94822 :
94823 14 : std::vector<SgOmpTargetTeamsDistributeSimdStatement*> nodeList;
94824 :
94825 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
94826 14 : for (unsigned int i=0; i < SgOmpTargetTeamsDistributeSimdStatement::pools.size(); i++)
94827 : {
94828 : // objectArray[i] is a single memory pool
94829 14007 : for (unsigned j=0; j < SgOmpTargetTeamsDistributeSimdStatement::pool_size; j++)
94830 : {
94831 14000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
94832 : {
94833 7 : nodeList.push_back(&(objectArray[i][j]));
94834 : }
94835 : }
94836 : }
94837 :
94838 : // Iterate over the saved list
94839 7 : size_t nodeListSize = nodeList.size();
94840 14 : for (size_t i=0; i < nodeListSize; i++)
94841 : {
94842 7 : ROSE_ASSERT(nodeList[i] != NULL);
94843 : #if 0
94844 : traversal.visit(nodeList[i]);
94845 : #else
94846 7 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
94847 : {
94848 7 : traversal.visit(nodeList[i]);
94849 : }
94850 : #endif
94851 : }
94852 : #endif
94853 : }
94854 :
94855 : // This should not be required since all previously static data members are
94856 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
94857 :
94858 5342 : }
94859 :
94860 :
94861 : void
94862 194 : SgOmpTargetTeamsDistributeSimdStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
94863 : {
94864 : // This function traverses the memory pool for an IR node and
94865 : // calls the function to execute the visitor object.
94866 :
94867 : // Initialize array to the address of the first element of the STL vector
94868 : // (which is guarenteed to be contiguous storage).
94869 : // SgOmpTargetTeamsDistributeSimdStatement objectArray [] = *(Memory_Block_List.begin());
94870 194 : if (SgOmpTargetTeamsDistributeSimdStatement::pools.empty() == false)
94871 : {
94872 : // Generate an array of memory pools
94873 0 : SgOmpTargetTeamsDistributeSimdStatement** objectArray = (SgOmpTargetTeamsDistributeSimdStatement**) &(SgOmpTargetTeamsDistributeSimdStatement::pools[0]);
94874 :
94875 : // Build a local variable for better performance
94876 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
94877 :
94878 : // Iterate over the memory pools
94879 0 : for (unsigned int i=0; i < SgOmpTargetTeamsDistributeSimdStatement::pools.size(); i++)
94880 : {
94881 : // objectArray[i] is a single memory pool
94882 0 : for (unsigned j=0; j < SgOmpTargetTeamsDistributeSimdStatement::pool_size; j++)
94883 : {
94884 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
94885 : {
94886 : // printf ("Found a valid SgOmpTargetTeamsDistributeSimdStatement object in the memory pool %d at position %d \n",i,j);
94887 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
94888 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
94889 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
94890 : }
94891 : else
94892 : {
94893 : // printf ("Found a INVALID SgOmpTargetTeamsDistributeSimdStatement object in the memory pool \n");
94894 : }
94895 : }
94896 : }
94897 : }
94898 :
94899 : // This should not be required since all previously static data members are
94900 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
94901 :
94902 194 : }
94903 :
94904 : void
94905 0 : SgOmpTargetTeamsDistributeSimdStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
94906 : {
94907 : // This function visits only a single IR node of the memory pool.
94908 : // it is typically called once for each type of IR node within
94909 : // the automatically generated function: traverseRepresentativeNodes().
94910 :
94911 : // Initialize array to the address of the first element of the STL vector
94912 : // (which is guarenteed to be contiguous storage).
94913 : // SgOmpTargetTeamsDistributeSimdStatement objectArray [] = *(Memory_Block_List.begin());
94914 0 : if (SgOmpTargetTeamsDistributeSimdStatement::pools.empty() == false)
94915 : {
94916 : // Generate an array of memory pools
94917 0 : SgOmpTargetTeamsDistributeSimdStatement** objectArray = (SgOmpTargetTeamsDistributeSimdStatement**) &(SgOmpTargetTeamsDistributeSimdStatement::pools[0]);
94918 :
94919 : // Build a local variable for better performance
94920 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
94921 :
94922 : // Iterate over the memory pools
94923 0 : bool done = false;
94924 0 : unsigned i=0;
94925 :
94926 : // find the first valid IR node, call visit function, and then leave
94927 0 : while ( done == false && i < SgOmpTargetTeamsDistributeSimdStatement::pools.size() )
94928 : {
94929 : // objectArray[i] is a single memory pool
94930 : unsigned j=0;
94931 0 : while (done == false && j < SgOmpTargetTeamsDistributeSimdStatement::pool_size)
94932 : {
94933 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
94934 : {
94935 0 : traversal.visit(&(objectArray[i][j]));
94936 0 : done = true;
94937 : }
94938 0 : j++;
94939 : }
94940 0 : i++;
94941 : }
94942 :
94943 : #if 0
94944 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
94945 : if (done == false)
94946 : {
94947 : printf ("No representative for SgOmpTargetTeamsDistributeSimdStatement found in memory pools \n");
94948 : }
94949 : #endif
94950 : }
94951 0 : }
94952 :
94953 :
94954 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
94955 : // using values that overflow signed values of int.
94956 : size_t
94957 4 : SgOmpTargetTeamsDistributeSimdStatement::numberOfNodes()
94958 : {
94959 : // This function traverses the memory pool for an IR node and
94960 : // counts the number of IR nodes of a particular Sage III IR
94961 : // nodes type.
94962 :
94963 4 : size_t count = 0;
94964 4 : if (SgOmpTargetTeamsDistributeSimdStatement::pools.empty() == false)
94965 : {
94966 : // Generate an array of memory pools (this is actually a STL vector,
94967 : // but it is contiguious, so OK to treat this way).
94968 0 : SgOmpTargetTeamsDistributeSimdStatement** objectArray = (SgOmpTargetTeamsDistributeSimdStatement**) &(SgOmpTargetTeamsDistributeSimdStatement::pools[0]);
94969 :
94970 : // Build a local variable for better performance (make it a loop invariant variable).
94971 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
94972 :
94973 : // Iterate over all of the memory pools for this IR node.
94974 0 : for (unsigned int i=0; i < SgOmpTargetTeamsDistributeSimdStatement::pools.size(); i++)
94975 : {
94976 : // objectArray[i] is a single memory pool, iterate over all the
94977 : // IR nodes and only count those that are valid IR nodes used in
94978 : // the AST (i.e. allocated IR nodes).
94979 0 : for (unsigned j=0; j < SgOmpTargetTeamsDistributeSimdStatement::pool_size; j++)
94980 : {
94981 : // This is indexing the STL vector of C/C++ style arrays as a doubly
94982 : // indexed array access. It is OK since we have leveraged the semantics
94983 : // of STL vector memory as contigous and cast the memory as an array
94984 : // of arrays to use the 2D array indexing. Hope this is not confusing,
94985 : // but it s very fast as an implementation.
94986 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
94987 : {
94988 0 : count++;
94989 : }
94990 : }
94991 : }
94992 : }
94993 :
94994 :
94995 :
94996 4 : return count;
94997 : }
94998 :
94999 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
95000 : // using values that overflow signed values of int.
95001 : size_t
95002 0 : SgOmpTargetTeamsDistributeSimdStatement::memoryUsage()
95003 : {
95004 : // This function is required because we need the class name as a type when we call sizeof
95005 : // There might be another way to implement this if we have a traversal that only called a
95006 : // representative object (one call for each type of Sage IIIIR node).
95007 0 : size_t memory = numberOfNodes() * sizeof(SgOmpTargetTeamsDistributeSimdStatement);
95008 :
95009 0 : return memory;
95010 : }
95011 :
95012 : /* #line 95013 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
95013 :
95014 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
95015 : void
95016 5342 : SgOmpTargetTeamsLoopStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
95017 : {
95018 : // This function traverses the memory pool for only a specific IR node
95019 : // and calls the visit function of the input class execute a traversal
95020 : // similar to the style of the attribute based traversals within ROSE.
95021 : // This traversal will visit ALL nodes of the AST where as the other
95022 : // attribute based traversals visit only the embedded tree within the AST.
95023 :
95024 : // Initialize array to the address of the first element of the STL vector
95025 : // (which is guaranteed to be contiguous storage).
95026 : // SgOmpTargetTeamsLoopStatement objectArray [] = *(Memory_Block_List.begin());
95027 5342 : if (SgOmpTargetTeamsLoopStatement::pools.empty() == false)
95028 : {
95029 : // Generate an array of memory pools
95030 7 : SgOmpTargetTeamsLoopStatement** objectArray = (SgOmpTargetTeamsLoopStatement**) &(SgOmpTargetTeamsLoopStatement::pools[0]);
95031 :
95032 : // Build a local variable for better performance
95033 7 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
95034 : #if 0
95035 : // Iterate over the memory pools
95036 : for (unsigned int i=0; i < SgOmpTargetTeamsLoopStatement::pools.size(); i++)
95037 : {
95038 : // objectArray[i] is a single memory pool
95039 : for (int j=0; j < SgOmpTargetTeamsLoopStatement::pool_size; j++)
95040 : {
95041 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
95042 : {
95043 : traversal.visit(&(objectArray[i][j]));
95044 : }
95045 : }
95046 : }
95047 : #else
95048 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
95049 : // compute the list first and then call the visit function on each list element.
95050 :
95051 : // printf ("Inside of SgOmpTargetTeamsLoopStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
95052 :
95053 14 : std::vector<SgOmpTargetTeamsLoopStatement*> nodeList;
95054 :
95055 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
95056 14 : for (unsigned int i=0; i < SgOmpTargetTeamsLoopStatement::pools.size(); i++)
95057 : {
95058 : // objectArray[i] is a single memory pool
95059 14007 : for (unsigned j=0; j < SgOmpTargetTeamsLoopStatement::pool_size; j++)
95060 : {
95061 14000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
95062 : {
95063 7 : nodeList.push_back(&(objectArray[i][j]));
95064 : }
95065 : }
95066 : }
95067 :
95068 : // Iterate over the saved list
95069 7 : size_t nodeListSize = nodeList.size();
95070 14 : for (size_t i=0; i < nodeListSize; i++)
95071 : {
95072 7 : ROSE_ASSERT(nodeList[i] != NULL);
95073 : #if 0
95074 : traversal.visit(nodeList[i]);
95075 : #else
95076 7 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
95077 : {
95078 7 : traversal.visit(nodeList[i]);
95079 : }
95080 : #endif
95081 : }
95082 : #endif
95083 : }
95084 :
95085 : // This should not be required since all previously static data members are
95086 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
95087 :
95088 5342 : }
95089 :
95090 :
95091 : void
95092 194 : SgOmpTargetTeamsLoopStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
95093 : {
95094 : // This function traverses the memory pool for an IR node and
95095 : // calls the function to execute the visitor object.
95096 :
95097 : // Initialize array to the address of the first element of the STL vector
95098 : // (which is guarenteed to be contiguous storage).
95099 : // SgOmpTargetTeamsLoopStatement objectArray [] = *(Memory_Block_List.begin());
95100 194 : if (SgOmpTargetTeamsLoopStatement::pools.empty() == false)
95101 : {
95102 : // Generate an array of memory pools
95103 0 : SgOmpTargetTeamsLoopStatement** objectArray = (SgOmpTargetTeamsLoopStatement**) &(SgOmpTargetTeamsLoopStatement::pools[0]);
95104 :
95105 : // Build a local variable for better performance
95106 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
95107 :
95108 : // Iterate over the memory pools
95109 0 : for (unsigned int i=0; i < SgOmpTargetTeamsLoopStatement::pools.size(); i++)
95110 : {
95111 : // objectArray[i] is a single memory pool
95112 0 : for (unsigned j=0; j < SgOmpTargetTeamsLoopStatement::pool_size; j++)
95113 : {
95114 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
95115 : {
95116 : // printf ("Found a valid SgOmpTargetTeamsLoopStatement object in the memory pool %d at position %d \n",i,j);
95117 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
95118 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
95119 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
95120 : }
95121 : else
95122 : {
95123 : // printf ("Found a INVALID SgOmpTargetTeamsLoopStatement object in the memory pool \n");
95124 : }
95125 : }
95126 : }
95127 : }
95128 :
95129 : // This should not be required since all previously static data members are
95130 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
95131 :
95132 194 : }
95133 :
95134 : void
95135 0 : SgOmpTargetTeamsLoopStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
95136 : {
95137 : // This function visits only a single IR node of the memory pool.
95138 : // it is typically called once for each type of IR node within
95139 : // the automatically generated function: traverseRepresentativeNodes().
95140 :
95141 : // Initialize array to the address of the first element of the STL vector
95142 : // (which is guarenteed to be contiguous storage).
95143 : // SgOmpTargetTeamsLoopStatement objectArray [] = *(Memory_Block_List.begin());
95144 0 : if (SgOmpTargetTeamsLoopStatement::pools.empty() == false)
95145 : {
95146 : // Generate an array of memory pools
95147 0 : SgOmpTargetTeamsLoopStatement** objectArray = (SgOmpTargetTeamsLoopStatement**) &(SgOmpTargetTeamsLoopStatement::pools[0]);
95148 :
95149 : // Build a local variable for better performance
95150 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
95151 :
95152 : // Iterate over the memory pools
95153 0 : bool done = false;
95154 0 : unsigned i=0;
95155 :
95156 : // find the first valid IR node, call visit function, and then leave
95157 0 : while ( done == false && i < SgOmpTargetTeamsLoopStatement::pools.size() )
95158 : {
95159 : // objectArray[i] is a single memory pool
95160 : unsigned j=0;
95161 0 : while (done == false && j < SgOmpTargetTeamsLoopStatement::pool_size)
95162 : {
95163 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
95164 : {
95165 0 : traversal.visit(&(objectArray[i][j]));
95166 0 : done = true;
95167 : }
95168 0 : j++;
95169 : }
95170 0 : i++;
95171 : }
95172 :
95173 : #if 0
95174 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
95175 : if (done == false)
95176 : {
95177 : printf ("No representative for SgOmpTargetTeamsLoopStatement found in memory pools \n");
95178 : }
95179 : #endif
95180 : }
95181 0 : }
95182 :
95183 :
95184 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
95185 : // using values that overflow signed values of int.
95186 : size_t
95187 4 : SgOmpTargetTeamsLoopStatement::numberOfNodes()
95188 : {
95189 : // This function traverses the memory pool for an IR node and
95190 : // counts the number of IR nodes of a particular Sage III IR
95191 : // nodes type.
95192 :
95193 4 : size_t count = 0;
95194 4 : if (SgOmpTargetTeamsLoopStatement::pools.empty() == false)
95195 : {
95196 : // Generate an array of memory pools (this is actually a STL vector,
95197 : // but it is contiguious, so OK to treat this way).
95198 0 : SgOmpTargetTeamsLoopStatement** objectArray = (SgOmpTargetTeamsLoopStatement**) &(SgOmpTargetTeamsLoopStatement::pools[0]);
95199 :
95200 : // Build a local variable for better performance (make it a loop invariant variable).
95201 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
95202 :
95203 : // Iterate over all of the memory pools for this IR node.
95204 0 : for (unsigned int i=0; i < SgOmpTargetTeamsLoopStatement::pools.size(); i++)
95205 : {
95206 : // objectArray[i] is a single memory pool, iterate over all the
95207 : // IR nodes and only count those that are valid IR nodes used in
95208 : // the AST (i.e. allocated IR nodes).
95209 0 : for (unsigned j=0; j < SgOmpTargetTeamsLoopStatement::pool_size; j++)
95210 : {
95211 : // This is indexing the STL vector of C/C++ style arrays as a doubly
95212 : // indexed array access. It is OK since we have leveraged the semantics
95213 : // of STL vector memory as contigous and cast the memory as an array
95214 : // of arrays to use the 2D array indexing. Hope this is not confusing,
95215 : // but it s very fast as an implementation.
95216 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
95217 : {
95218 0 : count++;
95219 : }
95220 : }
95221 : }
95222 : }
95223 :
95224 :
95225 :
95226 4 : return count;
95227 : }
95228 :
95229 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
95230 : // using values that overflow signed values of int.
95231 : size_t
95232 0 : SgOmpTargetTeamsLoopStatement::memoryUsage()
95233 : {
95234 : // This function is required because we need the class name as a type when we call sizeof
95235 : // There might be another way to implement this if we have a traversal that only called a
95236 : // representative object (one call for each type of Sage IIIIR node).
95237 0 : size_t memory = numberOfNodes() * sizeof(SgOmpTargetTeamsLoopStatement);
95238 :
95239 0 : return memory;
95240 : }
95241 :
95242 : /* #line 95243 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
95243 :
95244 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
95245 : void
95246 5342 : SgOmpTargetTeamsDistributeParallelForStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
95247 : {
95248 : // This function traverses the memory pool for only a specific IR node
95249 : // and calls the visit function of the input class execute a traversal
95250 : // similar to the style of the attribute based traversals within ROSE.
95251 : // This traversal will visit ALL nodes of the AST where as the other
95252 : // attribute based traversals visit only the embedded tree within the AST.
95253 :
95254 : // Initialize array to the address of the first element of the STL vector
95255 : // (which is guaranteed to be contiguous storage).
95256 : // SgOmpTargetTeamsDistributeParallelForStatement objectArray [] = *(Memory_Block_List.begin());
95257 5342 : if (SgOmpTargetTeamsDistributeParallelForStatement::pools.empty() == false)
95258 : {
95259 : // Generate an array of memory pools
95260 7 : SgOmpTargetTeamsDistributeParallelForStatement** objectArray = (SgOmpTargetTeamsDistributeParallelForStatement**) &(SgOmpTargetTeamsDistributeParallelForStatement::pools[0]);
95261 :
95262 : // Build a local variable for better performance
95263 7 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
95264 : #if 0
95265 : // Iterate over the memory pools
95266 : for (unsigned int i=0; i < SgOmpTargetTeamsDistributeParallelForStatement::pools.size(); i++)
95267 : {
95268 : // objectArray[i] is a single memory pool
95269 : for (int j=0; j < SgOmpTargetTeamsDistributeParallelForStatement::pool_size; j++)
95270 : {
95271 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
95272 : {
95273 : traversal.visit(&(objectArray[i][j]));
95274 : }
95275 : }
95276 : }
95277 : #else
95278 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
95279 : // compute the list first and then call the visit function on each list element.
95280 :
95281 : // printf ("Inside of SgOmpTargetTeamsDistributeParallelForStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
95282 :
95283 14 : std::vector<SgOmpTargetTeamsDistributeParallelForStatement*> nodeList;
95284 :
95285 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
95286 14 : for (unsigned int i=0; i < SgOmpTargetTeamsDistributeParallelForStatement::pools.size(); i++)
95287 : {
95288 : // objectArray[i] is a single memory pool
95289 14007 : for (unsigned j=0; j < SgOmpTargetTeamsDistributeParallelForStatement::pool_size; j++)
95290 : {
95291 14000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
95292 : {
95293 7 : nodeList.push_back(&(objectArray[i][j]));
95294 : }
95295 : }
95296 : }
95297 :
95298 : // Iterate over the saved list
95299 7 : size_t nodeListSize = nodeList.size();
95300 14 : for (size_t i=0; i < nodeListSize; i++)
95301 : {
95302 7 : ROSE_ASSERT(nodeList[i] != NULL);
95303 : #if 0
95304 : traversal.visit(nodeList[i]);
95305 : #else
95306 7 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
95307 : {
95308 7 : traversal.visit(nodeList[i]);
95309 : }
95310 : #endif
95311 : }
95312 : #endif
95313 : }
95314 :
95315 : // This should not be required since all previously static data members are
95316 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
95317 :
95318 5342 : }
95319 :
95320 :
95321 : void
95322 194 : SgOmpTargetTeamsDistributeParallelForStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
95323 : {
95324 : // This function traverses the memory pool for an IR node and
95325 : // calls the function to execute the visitor object.
95326 :
95327 : // Initialize array to the address of the first element of the STL vector
95328 : // (which is guarenteed to be contiguous storage).
95329 : // SgOmpTargetTeamsDistributeParallelForStatement objectArray [] = *(Memory_Block_List.begin());
95330 194 : if (SgOmpTargetTeamsDistributeParallelForStatement::pools.empty() == false)
95331 : {
95332 : // Generate an array of memory pools
95333 0 : SgOmpTargetTeamsDistributeParallelForStatement** objectArray = (SgOmpTargetTeamsDistributeParallelForStatement**) &(SgOmpTargetTeamsDistributeParallelForStatement::pools[0]);
95334 :
95335 : // Build a local variable for better performance
95336 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
95337 :
95338 : // Iterate over the memory pools
95339 0 : for (unsigned int i=0; i < SgOmpTargetTeamsDistributeParallelForStatement::pools.size(); i++)
95340 : {
95341 : // objectArray[i] is a single memory pool
95342 0 : for (unsigned j=0; j < SgOmpTargetTeamsDistributeParallelForStatement::pool_size; j++)
95343 : {
95344 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
95345 : {
95346 : // printf ("Found a valid SgOmpTargetTeamsDistributeParallelForStatement object in the memory pool %d at position %d \n",i,j);
95347 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
95348 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
95349 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
95350 : }
95351 : else
95352 : {
95353 : // printf ("Found a INVALID SgOmpTargetTeamsDistributeParallelForStatement object in the memory pool \n");
95354 : }
95355 : }
95356 : }
95357 : }
95358 :
95359 : // This should not be required since all previously static data members are
95360 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
95361 :
95362 194 : }
95363 :
95364 : void
95365 0 : SgOmpTargetTeamsDistributeParallelForStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
95366 : {
95367 : // This function visits only a single IR node of the memory pool.
95368 : // it is typically called once for each type of IR node within
95369 : // the automatically generated function: traverseRepresentativeNodes().
95370 :
95371 : // Initialize array to the address of the first element of the STL vector
95372 : // (which is guarenteed to be contiguous storage).
95373 : // SgOmpTargetTeamsDistributeParallelForStatement objectArray [] = *(Memory_Block_List.begin());
95374 0 : if (SgOmpTargetTeamsDistributeParallelForStatement::pools.empty() == false)
95375 : {
95376 : // Generate an array of memory pools
95377 0 : SgOmpTargetTeamsDistributeParallelForStatement** objectArray = (SgOmpTargetTeamsDistributeParallelForStatement**) &(SgOmpTargetTeamsDistributeParallelForStatement::pools[0]);
95378 :
95379 : // Build a local variable for better performance
95380 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
95381 :
95382 : // Iterate over the memory pools
95383 0 : bool done = false;
95384 0 : unsigned i=0;
95385 :
95386 : // find the first valid IR node, call visit function, and then leave
95387 0 : while ( done == false && i < SgOmpTargetTeamsDistributeParallelForStatement::pools.size() )
95388 : {
95389 : // objectArray[i] is a single memory pool
95390 : unsigned j=0;
95391 0 : while (done == false && j < SgOmpTargetTeamsDistributeParallelForStatement::pool_size)
95392 : {
95393 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
95394 : {
95395 0 : traversal.visit(&(objectArray[i][j]));
95396 0 : done = true;
95397 : }
95398 0 : j++;
95399 : }
95400 0 : i++;
95401 : }
95402 :
95403 : #if 0
95404 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
95405 : if (done == false)
95406 : {
95407 : printf ("No representative for SgOmpTargetTeamsDistributeParallelForStatement found in memory pools \n");
95408 : }
95409 : #endif
95410 : }
95411 0 : }
95412 :
95413 :
95414 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
95415 : // using values that overflow signed values of int.
95416 : size_t
95417 4 : SgOmpTargetTeamsDistributeParallelForStatement::numberOfNodes()
95418 : {
95419 : // This function traverses the memory pool for an IR node and
95420 : // counts the number of IR nodes of a particular Sage III IR
95421 : // nodes type.
95422 :
95423 4 : size_t count = 0;
95424 4 : if (SgOmpTargetTeamsDistributeParallelForStatement::pools.empty() == false)
95425 : {
95426 : // Generate an array of memory pools (this is actually a STL vector,
95427 : // but it is contiguious, so OK to treat this way).
95428 0 : SgOmpTargetTeamsDistributeParallelForStatement** objectArray = (SgOmpTargetTeamsDistributeParallelForStatement**) &(SgOmpTargetTeamsDistributeParallelForStatement::pools[0]);
95429 :
95430 : // Build a local variable for better performance (make it a loop invariant variable).
95431 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
95432 :
95433 : // Iterate over all of the memory pools for this IR node.
95434 0 : for (unsigned int i=0; i < SgOmpTargetTeamsDistributeParallelForStatement::pools.size(); i++)
95435 : {
95436 : // objectArray[i] is a single memory pool, iterate over all the
95437 : // IR nodes and only count those that are valid IR nodes used in
95438 : // the AST (i.e. allocated IR nodes).
95439 0 : for (unsigned j=0; j < SgOmpTargetTeamsDistributeParallelForStatement::pool_size; j++)
95440 : {
95441 : // This is indexing the STL vector of C/C++ style arrays as a doubly
95442 : // indexed array access. It is OK since we have leveraged the semantics
95443 : // of STL vector memory as contigous and cast the memory as an array
95444 : // of arrays to use the 2D array indexing. Hope this is not confusing,
95445 : // but it s very fast as an implementation.
95446 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
95447 : {
95448 0 : count++;
95449 : }
95450 : }
95451 : }
95452 : }
95453 :
95454 :
95455 :
95456 4 : return count;
95457 : }
95458 :
95459 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
95460 : // using values that overflow signed values of int.
95461 : size_t
95462 0 : SgOmpTargetTeamsDistributeParallelForStatement::memoryUsage()
95463 : {
95464 : // This function is required because we need the class name as a type when we call sizeof
95465 : // There might be another way to implement this if we have a traversal that only called a
95466 : // representative object (one call for each type of Sage IIIIR node).
95467 0 : size_t memory = numberOfNodes() * sizeof(SgOmpTargetTeamsDistributeParallelForStatement);
95468 :
95469 0 : return memory;
95470 : }
95471 :
95472 : /* #line 95473 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
95473 :
95474 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
95475 : void
95476 5342 : SgOmpTargetTeamsDistributeParallelForSimdStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
95477 : {
95478 : // This function traverses the memory pool for only a specific IR node
95479 : // and calls the visit function of the input class execute a traversal
95480 : // similar to the style of the attribute based traversals within ROSE.
95481 : // This traversal will visit ALL nodes of the AST where as the other
95482 : // attribute based traversals visit only the embedded tree within the AST.
95483 :
95484 : // Initialize array to the address of the first element of the STL vector
95485 : // (which is guaranteed to be contiguous storage).
95486 : // SgOmpTargetTeamsDistributeParallelForSimdStatement objectArray [] = *(Memory_Block_List.begin());
95487 5342 : if (SgOmpTargetTeamsDistributeParallelForSimdStatement::pools.empty() == false)
95488 : {
95489 : // Generate an array of memory pools
95490 7 : SgOmpTargetTeamsDistributeParallelForSimdStatement** objectArray = (SgOmpTargetTeamsDistributeParallelForSimdStatement**) &(SgOmpTargetTeamsDistributeParallelForSimdStatement::pools[0]);
95491 :
95492 : // Build a local variable for better performance
95493 7 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
95494 : #if 0
95495 : // Iterate over the memory pools
95496 : for (unsigned int i=0; i < SgOmpTargetTeamsDistributeParallelForSimdStatement::pools.size(); i++)
95497 : {
95498 : // objectArray[i] is a single memory pool
95499 : for (int j=0; j < SgOmpTargetTeamsDistributeParallelForSimdStatement::pool_size; j++)
95500 : {
95501 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
95502 : {
95503 : traversal.visit(&(objectArray[i][j]));
95504 : }
95505 : }
95506 : }
95507 : #else
95508 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
95509 : // compute the list first and then call the visit function on each list element.
95510 :
95511 : // printf ("Inside of SgOmpTargetTeamsDistributeParallelForSimdStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
95512 :
95513 14 : std::vector<SgOmpTargetTeamsDistributeParallelForSimdStatement*> nodeList;
95514 :
95515 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
95516 14 : for (unsigned int i=0; i < SgOmpTargetTeamsDistributeParallelForSimdStatement::pools.size(); i++)
95517 : {
95518 : // objectArray[i] is a single memory pool
95519 14007 : for (unsigned j=0; j < SgOmpTargetTeamsDistributeParallelForSimdStatement::pool_size; j++)
95520 : {
95521 14000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
95522 : {
95523 7 : nodeList.push_back(&(objectArray[i][j]));
95524 : }
95525 : }
95526 : }
95527 :
95528 : // Iterate over the saved list
95529 7 : size_t nodeListSize = nodeList.size();
95530 14 : for (size_t i=0; i < nodeListSize; i++)
95531 : {
95532 7 : ROSE_ASSERT(nodeList[i] != NULL);
95533 : #if 0
95534 : traversal.visit(nodeList[i]);
95535 : #else
95536 7 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
95537 : {
95538 7 : traversal.visit(nodeList[i]);
95539 : }
95540 : #endif
95541 : }
95542 : #endif
95543 : }
95544 :
95545 : // This should not be required since all previously static data members are
95546 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
95547 :
95548 5342 : }
95549 :
95550 :
95551 : void
95552 194 : SgOmpTargetTeamsDistributeParallelForSimdStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
95553 : {
95554 : // This function traverses the memory pool for an IR node and
95555 : // calls the function to execute the visitor object.
95556 :
95557 : // Initialize array to the address of the first element of the STL vector
95558 : // (which is guarenteed to be contiguous storage).
95559 : // SgOmpTargetTeamsDistributeParallelForSimdStatement objectArray [] = *(Memory_Block_List.begin());
95560 194 : if (SgOmpTargetTeamsDistributeParallelForSimdStatement::pools.empty() == false)
95561 : {
95562 : // Generate an array of memory pools
95563 0 : SgOmpTargetTeamsDistributeParallelForSimdStatement** objectArray = (SgOmpTargetTeamsDistributeParallelForSimdStatement**) &(SgOmpTargetTeamsDistributeParallelForSimdStatement::pools[0]);
95564 :
95565 : // Build a local variable for better performance
95566 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
95567 :
95568 : // Iterate over the memory pools
95569 0 : for (unsigned int i=0; i < SgOmpTargetTeamsDistributeParallelForSimdStatement::pools.size(); i++)
95570 : {
95571 : // objectArray[i] is a single memory pool
95572 0 : for (unsigned j=0; j < SgOmpTargetTeamsDistributeParallelForSimdStatement::pool_size; j++)
95573 : {
95574 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
95575 : {
95576 : // printf ("Found a valid SgOmpTargetTeamsDistributeParallelForSimdStatement object in the memory pool %d at position %d \n",i,j);
95577 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
95578 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
95579 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
95580 : }
95581 : else
95582 : {
95583 : // printf ("Found a INVALID SgOmpTargetTeamsDistributeParallelForSimdStatement object in the memory pool \n");
95584 : }
95585 : }
95586 : }
95587 : }
95588 :
95589 : // This should not be required since all previously static data members are
95590 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
95591 :
95592 194 : }
95593 :
95594 : void
95595 0 : SgOmpTargetTeamsDistributeParallelForSimdStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
95596 : {
95597 : // This function visits only a single IR node of the memory pool.
95598 : // it is typically called once for each type of IR node within
95599 : // the automatically generated function: traverseRepresentativeNodes().
95600 :
95601 : // Initialize array to the address of the first element of the STL vector
95602 : // (which is guarenteed to be contiguous storage).
95603 : // SgOmpTargetTeamsDistributeParallelForSimdStatement objectArray [] = *(Memory_Block_List.begin());
95604 0 : if (SgOmpTargetTeamsDistributeParallelForSimdStatement::pools.empty() == false)
95605 : {
95606 : // Generate an array of memory pools
95607 0 : SgOmpTargetTeamsDistributeParallelForSimdStatement** objectArray = (SgOmpTargetTeamsDistributeParallelForSimdStatement**) &(SgOmpTargetTeamsDistributeParallelForSimdStatement::pools[0]);
95608 :
95609 : // Build a local variable for better performance
95610 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
95611 :
95612 : // Iterate over the memory pools
95613 0 : bool done = false;
95614 0 : unsigned i=0;
95615 :
95616 : // find the first valid IR node, call visit function, and then leave
95617 0 : while ( done == false && i < SgOmpTargetTeamsDistributeParallelForSimdStatement::pools.size() )
95618 : {
95619 : // objectArray[i] is a single memory pool
95620 : unsigned j=0;
95621 0 : while (done == false && j < SgOmpTargetTeamsDistributeParallelForSimdStatement::pool_size)
95622 : {
95623 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
95624 : {
95625 0 : traversal.visit(&(objectArray[i][j]));
95626 0 : done = true;
95627 : }
95628 0 : j++;
95629 : }
95630 0 : i++;
95631 : }
95632 :
95633 : #if 0
95634 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
95635 : if (done == false)
95636 : {
95637 : printf ("No representative for SgOmpTargetTeamsDistributeParallelForSimdStatement found in memory pools \n");
95638 : }
95639 : #endif
95640 : }
95641 0 : }
95642 :
95643 :
95644 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
95645 : // using values that overflow signed values of int.
95646 : size_t
95647 4 : SgOmpTargetTeamsDistributeParallelForSimdStatement::numberOfNodes()
95648 : {
95649 : // This function traverses the memory pool for an IR node and
95650 : // counts the number of IR nodes of a particular Sage III IR
95651 : // nodes type.
95652 :
95653 4 : size_t count = 0;
95654 4 : if (SgOmpTargetTeamsDistributeParallelForSimdStatement::pools.empty() == false)
95655 : {
95656 : // Generate an array of memory pools (this is actually a STL vector,
95657 : // but it is contiguious, so OK to treat this way).
95658 0 : SgOmpTargetTeamsDistributeParallelForSimdStatement** objectArray = (SgOmpTargetTeamsDistributeParallelForSimdStatement**) &(SgOmpTargetTeamsDistributeParallelForSimdStatement::pools[0]);
95659 :
95660 : // Build a local variable for better performance (make it a loop invariant variable).
95661 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
95662 :
95663 : // Iterate over all of the memory pools for this IR node.
95664 0 : for (unsigned int i=0; i < SgOmpTargetTeamsDistributeParallelForSimdStatement::pools.size(); i++)
95665 : {
95666 : // objectArray[i] is a single memory pool, iterate over all the
95667 : // IR nodes and only count those that are valid IR nodes used in
95668 : // the AST (i.e. allocated IR nodes).
95669 0 : for (unsigned j=0; j < SgOmpTargetTeamsDistributeParallelForSimdStatement::pool_size; j++)
95670 : {
95671 : // This is indexing the STL vector of C/C++ style arrays as a doubly
95672 : // indexed array access. It is OK since we have leveraged the semantics
95673 : // of STL vector memory as contigous and cast the memory as an array
95674 : // of arrays to use the 2D array indexing. Hope this is not confusing,
95675 : // but it s very fast as an implementation.
95676 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
95677 : {
95678 0 : count++;
95679 : }
95680 : }
95681 : }
95682 : }
95683 :
95684 :
95685 :
95686 4 : return count;
95687 : }
95688 :
95689 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
95690 : // using values that overflow signed values of int.
95691 : size_t
95692 0 : SgOmpTargetTeamsDistributeParallelForSimdStatement::memoryUsage()
95693 : {
95694 : // This function is required because we need the class name as a type when we call sizeof
95695 : // There might be another way to implement this if we have a traversal that only called a
95696 : // representative object (one call for each type of Sage IIIIR node).
95697 0 : size_t memory = numberOfNodes() * sizeof(SgOmpTargetTeamsDistributeParallelForSimdStatement);
95698 :
95699 0 : return memory;
95700 : }
95701 :
95702 : /* #line 95703 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
95703 :
95704 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
95705 : void
95706 5342 : SgOmpDistributeSimdStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
95707 : {
95708 : // This function traverses the memory pool for only a specific IR node
95709 : // and calls the visit function of the input class execute a traversal
95710 : // similar to the style of the attribute based traversals within ROSE.
95711 : // This traversal will visit ALL nodes of the AST where as the other
95712 : // attribute based traversals visit only the embedded tree within the AST.
95713 :
95714 : // Initialize array to the address of the first element of the STL vector
95715 : // (which is guaranteed to be contiguous storage).
95716 : // SgOmpDistributeSimdStatement objectArray [] = *(Memory_Block_List.begin());
95717 5342 : if (SgOmpDistributeSimdStatement::pools.empty() == false)
95718 : {
95719 : // Generate an array of memory pools
95720 7 : SgOmpDistributeSimdStatement** objectArray = (SgOmpDistributeSimdStatement**) &(SgOmpDistributeSimdStatement::pools[0]);
95721 :
95722 : // Build a local variable for better performance
95723 7 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
95724 : #if 0
95725 : // Iterate over the memory pools
95726 : for (unsigned int i=0; i < SgOmpDistributeSimdStatement::pools.size(); i++)
95727 : {
95728 : // objectArray[i] is a single memory pool
95729 : for (int j=0; j < SgOmpDistributeSimdStatement::pool_size; j++)
95730 : {
95731 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
95732 : {
95733 : traversal.visit(&(objectArray[i][j]));
95734 : }
95735 : }
95736 : }
95737 : #else
95738 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
95739 : // compute the list first and then call the visit function on each list element.
95740 :
95741 : // printf ("Inside of SgOmpDistributeSimdStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
95742 :
95743 14 : std::vector<SgOmpDistributeSimdStatement*> nodeList;
95744 :
95745 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
95746 14 : for (unsigned int i=0; i < SgOmpDistributeSimdStatement::pools.size(); i++)
95747 : {
95748 : // objectArray[i] is a single memory pool
95749 14007 : for (unsigned j=0; j < SgOmpDistributeSimdStatement::pool_size; j++)
95750 : {
95751 14000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
95752 : {
95753 7 : nodeList.push_back(&(objectArray[i][j]));
95754 : }
95755 : }
95756 : }
95757 :
95758 : // Iterate over the saved list
95759 7 : size_t nodeListSize = nodeList.size();
95760 14 : for (size_t i=0; i < nodeListSize; i++)
95761 : {
95762 7 : ROSE_ASSERT(nodeList[i] != NULL);
95763 : #if 0
95764 : traversal.visit(nodeList[i]);
95765 : #else
95766 7 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
95767 : {
95768 7 : traversal.visit(nodeList[i]);
95769 : }
95770 : #endif
95771 : }
95772 : #endif
95773 : }
95774 :
95775 : // This should not be required since all previously static data members are
95776 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
95777 :
95778 5342 : }
95779 :
95780 :
95781 : void
95782 194 : SgOmpDistributeSimdStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
95783 : {
95784 : // This function traverses the memory pool for an IR node and
95785 : // calls the function to execute the visitor object.
95786 :
95787 : // Initialize array to the address of the first element of the STL vector
95788 : // (which is guarenteed to be contiguous storage).
95789 : // SgOmpDistributeSimdStatement objectArray [] = *(Memory_Block_List.begin());
95790 194 : if (SgOmpDistributeSimdStatement::pools.empty() == false)
95791 : {
95792 : // Generate an array of memory pools
95793 0 : SgOmpDistributeSimdStatement** objectArray = (SgOmpDistributeSimdStatement**) &(SgOmpDistributeSimdStatement::pools[0]);
95794 :
95795 : // Build a local variable for better performance
95796 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
95797 :
95798 : // Iterate over the memory pools
95799 0 : for (unsigned int i=0; i < SgOmpDistributeSimdStatement::pools.size(); i++)
95800 : {
95801 : // objectArray[i] is a single memory pool
95802 0 : for (unsigned j=0; j < SgOmpDistributeSimdStatement::pool_size; j++)
95803 : {
95804 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
95805 : {
95806 : // printf ("Found a valid SgOmpDistributeSimdStatement object in the memory pool %d at position %d \n",i,j);
95807 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
95808 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
95809 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
95810 : }
95811 : else
95812 : {
95813 : // printf ("Found a INVALID SgOmpDistributeSimdStatement object in the memory pool \n");
95814 : }
95815 : }
95816 : }
95817 : }
95818 :
95819 : // This should not be required since all previously static data members are
95820 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
95821 :
95822 194 : }
95823 :
95824 : void
95825 0 : SgOmpDistributeSimdStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
95826 : {
95827 : // This function visits only a single IR node of the memory pool.
95828 : // it is typically called once for each type of IR node within
95829 : // the automatically generated function: traverseRepresentativeNodes().
95830 :
95831 : // Initialize array to the address of the first element of the STL vector
95832 : // (which is guarenteed to be contiguous storage).
95833 : // SgOmpDistributeSimdStatement objectArray [] = *(Memory_Block_List.begin());
95834 0 : if (SgOmpDistributeSimdStatement::pools.empty() == false)
95835 : {
95836 : // Generate an array of memory pools
95837 0 : SgOmpDistributeSimdStatement** objectArray = (SgOmpDistributeSimdStatement**) &(SgOmpDistributeSimdStatement::pools[0]);
95838 :
95839 : // Build a local variable for better performance
95840 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
95841 :
95842 : // Iterate over the memory pools
95843 0 : bool done = false;
95844 0 : unsigned i=0;
95845 :
95846 : // find the first valid IR node, call visit function, and then leave
95847 0 : while ( done == false && i < SgOmpDistributeSimdStatement::pools.size() )
95848 : {
95849 : // objectArray[i] is a single memory pool
95850 : unsigned j=0;
95851 0 : while (done == false && j < SgOmpDistributeSimdStatement::pool_size)
95852 : {
95853 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
95854 : {
95855 0 : traversal.visit(&(objectArray[i][j]));
95856 0 : done = true;
95857 : }
95858 0 : j++;
95859 : }
95860 0 : i++;
95861 : }
95862 :
95863 : #if 0
95864 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
95865 : if (done == false)
95866 : {
95867 : printf ("No representative for SgOmpDistributeSimdStatement found in memory pools \n");
95868 : }
95869 : #endif
95870 : }
95871 0 : }
95872 :
95873 :
95874 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
95875 : // using values that overflow signed values of int.
95876 : size_t
95877 4 : SgOmpDistributeSimdStatement::numberOfNodes()
95878 : {
95879 : // This function traverses the memory pool for an IR node and
95880 : // counts the number of IR nodes of a particular Sage III IR
95881 : // nodes type.
95882 :
95883 4 : size_t count = 0;
95884 4 : if (SgOmpDistributeSimdStatement::pools.empty() == false)
95885 : {
95886 : // Generate an array of memory pools (this is actually a STL vector,
95887 : // but it is contiguious, so OK to treat this way).
95888 0 : SgOmpDistributeSimdStatement** objectArray = (SgOmpDistributeSimdStatement**) &(SgOmpDistributeSimdStatement::pools[0]);
95889 :
95890 : // Build a local variable for better performance (make it a loop invariant variable).
95891 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
95892 :
95893 : // Iterate over all of the memory pools for this IR node.
95894 0 : for (unsigned int i=0; i < SgOmpDistributeSimdStatement::pools.size(); i++)
95895 : {
95896 : // objectArray[i] is a single memory pool, iterate over all the
95897 : // IR nodes and only count those that are valid IR nodes used in
95898 : // the AST (i.e. allocated IR nodes).
95899 0 : for (unsigned j=0; j < SgOmpDistributeSimdStatement::pool_size; j++)
95900 : {
95901 : // This is indexing the STL vector of C/C++ style arrays as a doubly
95902 : // indexed array access. It is OK since we have leveraged the semantics
95903 : // of STL vector memory as contigous and cast the memory as an array
95904 : // of arrays to use the 2D array indexing. Hope this is not confusing,
95905 : // but it s very fast as an implementation.
95906 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
95907 : {
95908 0 : count++;
95909 : }
95910 : }
95911 : }
95912 : }
95913 :
95914 :
95915 :
95916 4 : return count;
95917 : }
95918 :
95919 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
95920 : // using values that overflow signed values of int.
95921 : size_t
95922 0 : SgOmpDistributeSimdStatement::memoryUsage()
95923 : {
95924 : // This function is required because we need the class name as a type when we call sizeof
95925 : // There might be another way to implement this if we have a traversal that only called a
95926 : // representative object (one call for each type of Sage IIIIR node).
95927 0 : size_t memory = numberOfNodes() * sizeof(SgOmpDistributeSimdStatement);
95928 :
95929 0 : return memory;
95930 : }
95931 :
95932 : /* #line 95933 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
95933 :
95934 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
95935 : void
95936 5342 : SgOmpDistributeParallelForStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
95937 : {
95938 : // This function traverses the memory pool for only a specific IR node
95939 : // and calls the visit function of the input class execute a traversal
95940 : // similar to the style of the attribute based traversals within ROSE.
95941 : // This traversal will visit ALL nodes of the AST where as the other
95942 : // attribute based traversals visit only the embedded tree within the AST.
95943 :
95944 : // Initialize array to the address of the first element of the STL vector
95945 : // (which is guaranteed to be contiguous storage).
95946 : // SgOmpDistributeParallelForStatement objectArray [] = *(Memory_Block_List.begin());
95947 5342 : if (SgOmpDistributeParallelForStatement::pools.empty() == false)
95948 : {
95949 : // Generate an array of memory pools
95950 7 : SgOmpDistributeParallelForStatement** objectArray = (SgOmpDistributeParallelForStatement**) &(SgOmpDistributeParallelForStatement::pools[0]);
95951 :
95952 : // Build a local variable for better performance
95953 7 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
95954 : #if 0
95955 : // Iterate over the memory pools
95956 : for (unsigned int i=0; i < SgOmpDistributeParallelForStatement::pools.size(); i++)
95957 : {
95958 : // objectArray[i] is a single memory pool
95959 : for (int j=0; j < SgOmpDistributeParallelForStatement::pool_size; j++)
95960 : {
95961 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
95962 : {
95963 : traversal.visit(&(objectArray[i][j]));
95964 : }
95965 : }
95966 : }
95967 : #else
95968 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
95969 : // compute the list first and then call the visit function on each list element.
95970 :
95971 : // printf ("Inside of SgOmpDistributeParallelForStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
95972 :
95973 14 : std::vector<SgOmpDistributeParallelForStatement*> nodeList;
95974 :
95975 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
95976 14 : for (unsigned int i=0; i < SgOmpDistributeParallelForStatement::pools.size(); i++)
95977 : {
95978 : // objectArray[i] is a single memory pool
95979 14007 : for (unsigned j=0; j < SgOmpDistributeParallelForStatement::pool_size; j++)
95980 : {
95981 14000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
95982 : {
95983 7 : nodeList.push_back(&(objectArray[i][j]));
95984 : }
95985 : }
95986 : }
95987 :
95988 : // Iterate over the saved list
95989 7 : size_t nodeListSize = nodeList.size();
95990 14 : for (size_t i=0; i < nodeListSize; i++)
95991 : {
95992 7 : ROSE_ASSERT(nodeList[i] != NULL);
95993 : #if 0
95994 : traversal.visit(nodeList[i]);
95995 : #else
95996 7 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
95997 : {
95998 7 : traversal.visit(nodeList[i]);
95999 : }
96000 : #endif
96001 : }
96002 : #endif
96003 : }
96004 :
96005 : // This should not be required since all previously static data members are
96006 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
96007 :
96008 5342 : }
96009 :
96010 :
96011 : void
96012 194 : SgOmpDistributeParallelForStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
96013 : {
96014 : // This function traverses the memory pool for an IR node and
96015 : // calls the function to execute the visitor object.
96016 :
96017 : // Initialize array to the address of the first element of the STL vector
96018 : // (which is guarenteed to be contiguous storage).
96019 : // SgOmpDistributeParallelForStatement objectArray [] = *(Memory_Block_List.begin());
96020 194 : if (SgOmpDistributeParallelForStatement::pools.empty() == false)
96021 : {
96022 : // Generate an array of memory pools
96023 0 : SgOmpDistributeParallelForStatement** objectArray = (SgOmpDistributeParallelForStatement**) &(SgOmpDistributeParallelForStatement::pools[0]);
96024 :
96025 : // Build a local variable for better performance
96026 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
96027 :
96028 : // Iterate over the memory pools
96029 0 : for (unsigned int i=0; i < SgOmpDistributeParallelForStatement::pools.size(); i++)
96030 : {
96031 : // objectArray[i] is a single memory pool
96032 0 : for (unsigned j=0; j < SgOmpDistributeParallelForStatement::pool_size; j++)
96033 : {
96034 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
96035 : {
96036 : // printf ("Found a valid SgOmpDistributeParallelForStatement object in the memory pool %d at position %d \n",i,j);
96037 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
96038 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
96039 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
96040 : }
96041 : else
96042 : {
96043 : // printf ("Found a INVALID SgOmpDistributeParallelForStatement object in the memory pool \n");
96044 : }
96045 : }
96046 : }
96047 : }
96048 :
96049 : // This should not be required since all previously static data members are
96050 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
96051 :
96052 194 : }
96053 :
96054 : void
96055 0 : SgOmpDistributeParallelForStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
96056 : {
96057 : // This function visits only a single IR node of the memory pool.
96058 : // it is typically called once for each type of IR node within
96059 : // the automatically generated function: traverseRepresentativeNodes().
96060 :
96061 : // Initialize array to the address of the first element of the STL vector
96062 : // (which is guarenteed to be contiguous storage).
96063 : // SgOmpDistributeParallelForStatement objectArray [] = *(Memory_Block_List.begin());
96064 0 : if (SgOmpDistributeParallelForStatement::pools.empty() == false)
96065 : {
96066 : // Generate an array of memory pools
96067 0 : SgOmpDistributeParallelForStatement** objectArray = (SgOmpDistributeParallelForStatement**) &(SgOmpDistributeParallelForStatement::pools[0]);
96068 :
96069 : // Build a local variable for better performance
96070 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
96071 :
96072 : // Iterate over the memory pools
96073 0 : bool done = false;
96074 0 : unsigned i=0;
96075 :
96076 : // find the first valid IR node, call visit function, and then leave
96077 0 : while ( done == false && i < SgOmpDistributeParallelForStatement::pools.size() )
96078 : {
96079 : // objectArray[i] is a single memory pool
96080 : unsigned j=0;
96081 0 : while (done == false && j < SgOmpDistributeParallelForStatement::pool_size)
96082 : {
96083 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
96084 : {
96085 0 : traversal.visit(&(objectArray[i][j]));
96086 0 : done = true;
96087 : }
96088 0 : j++;
96089 : }
96090 0 : i++;
96091 : }
96092 :
96093 : #if 0
96094 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
96095 : if (done == false)
96096 : {
96097 : printf ("No representative for SgOmpDistributeParallelForStatement found in memory pools \n");
96098 : }
96099 : #endif
96100 : }
96101 0 : }
96102 :
96103 :
96104 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
96105 : // using values that overflow signed values of int.
96106 : size_t
96107 4 : SgOmpDistributeParallelForStatement::numberOfNodes()
96108 : {
96109 : // This function traverses the memory pool for an IR node and
96110 : // counts the number of IR nodes of a particular Sage III IR
96111 : // nodes type.
96112 :
96113 4 : size_t count = 0;
96114 4 : if (SgOmpDistributeParallelForStatement::pools.empty() == false)
96115 : {
96116 : // Generate an array of memory pools (this is actually a STL vector,
96117 : // but it is contiguious, so OK to treat this way).
96118 0 : SgOmpDistributeParallelForStatement** objectArray = (SgOmpDistributeParallelForStatement**) &(SgOmpDistributeParallelForStatement::pools[0]);
96119 :
96120 : // Build a local variable for better performance (make it a loop invariant variable).
96121 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
96122 :
96123 : // Iterate over all of the memory pools for this IR node.
96124 0 : for (unsigned int i=0; i < SgOmpDistributeParallelForStatement::pools.size(); i++)
96125 : {
96126 : // objectArray[i] is a single memory pool, iterate over all the
96127 : // IR nodes and only count those that are valid IR nodes used in
96128 : // the AST (i.e. allocated IR nodes).
96129 0 : for (unsigned j=0; j < SgOmpDistributeParallelForStatement::pool_size; j++)
96130 : {
96131 : // This is indexing the STL vector of C/C++ style arrays as a doubly
96132 : // indexed array access. It is OK since we have leveraged the semantics
96133 : // of STL vector memory as contigous and cast the memory as an array
96134 : // of arrays to use the 2D array indexing. Hope this is not confusing,
96135 : // but it s very fast as an implementation.
96136 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
96137 : {
96138 0 : count++;
96139 : }
96140 : }
96141 : }
96142 : }
96143 :
96144 :
96145 :
96146 4 : return count;
96147 : }
96148 :
96149 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
96150 : // using values that overflow signed values of int.
96151 : size_t
96152 0 : SgOmpDistributeParallelForStatement::memoryUsage()
96153 : {
96154 : // This function is required because we need the class name as a type when we call sizeof
96155 : // There might be another way to implement this if we have a traversal that only called a
96156 : // representative object (one call for each type of Sage IIIIR node).
96157 0 : size_t memory = numberOfNodes() * sizeof(SgOmpDistributeParallelForStatement);
96158 :
96159 0 : return memory;
96160 : }
96161 :
96162 : /* #line 96163 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
96163 :
96164 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
96165 : void
96166 5342 : SgOmpDistributeParallelForSimdStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
96167 : {
96168 : // This function traverses the memory pool for only a specific IR node
96169 : // and calls the visit function of the input class execute a traversal
96170 : // similar to the style of the attribute based traversals within ROSE.
96171 : // This traversal will visit ALL nodes of the AST where as the other
96172 : // attribute based traversals visit only the embedded tree within the AST.
96173 :
96174 : // Initialize array to the address of the first element of the STL vector
96175 : // (which is guaranteed to be contiguous storage).
96176 : // SgOmpDistributeParallelForSimdStatement objectArray [] = *(Memory_Block_List.begin());
96177 5342 : if (SgOmpDistributeParallelForSimdStatement::pools.empty() == false)
96178 : {
96179 : // Generate an array of memory pools
96180 7 : SgOmpDistributeParallelForSimdStatement** objectArray = (SgOmpDistributeParallelForSimdStatement**) &(SgOmpDistributeParallelForSimdStatement::pools[0]);
96181 :
96182 : // Build a local variable for better performance
96183 7 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
96184 : #if 0
96185 : // Iterate over the memory pools
96186 : for (unsigned int i=0; i < SgOmpDistributeParallelForSimdStatement::pools.size(); i++)
96187 : {
96188 : // objectArray[i] is a single memory pool
96189 : for (int j=0; j < SgOmpDistributeParallelForSimdStatement::pool_size; j++)
96190 : {
96191 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
96192 : {
96193 : traversal.visit(&(objectArray[i][j]));
96194 : }
96195 : }
96196 : }
96197 : #else
96198 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
96199 : // compute the list first and then call the visit function on each list element.
96200 :
96201 : // printf ("Inside of SgOmpDistributeParallelForSimdStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
96202 :
96203 14 : std::vector<SgOmpDistributeParallelForSimdStatement*> nodeList;
96204 :
96205 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
96206 14 : for (unsigned int i=0; i < SgOmpDistributeParallelForSimdStatement::pools.size(); i++)
96207 : {
96208 : // objectArray[i] is a single memory pool
96209 14007 : for (unsigned j=0; j < SgOmpDistributeParallelForSimdStatement::pool_size; j++)
96210 : {
96211 14000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
96212 : {
96213 7 : nodeList.push_back(&(objectArray[i][j]));
96214 : }
96215 : }
96216 : }
96217 :
96218 : // Iterate over the saved list
96219 7 : size_t nodeListSize = nodeList.size();
96220 14 : for (size_t i=0; i < nodeListSize; i++)
96221 : {
96222 7 : ROSE_ASSERT(nodeList[i] != NULL);
96223 : #if 0
96224 : traversal.visit(nodeList[i]);
96225 : #else
96226 7 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
96227 : {
96228 7 : traversal.visit(nodeList[i]);
96229 : }
96230 : #endif
96231 : }
96232 : #endif
96233 : }
96234 :
96235 : // This should not be required since all previously static data members are
96236 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
96237 :
96238 5342 : }
96239 :
96240 :
96241 : void
96242 194 : SgOmpDistributeParallelForSimdStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
96243 : {
96244 : // This function traverses the memory pool for an IR node and
96245 : // calls the function to execute the visitor object.
96246 :
96247 : // Initialize array to the address of the first element of the STL vector
96248 : // (which is guarenteed to be contiguous storage).
96249 : // SgOmpDistributeParallelForSimdStatement objectArray [] = *(Memory_Block_List.begin());
96250 194 : if (SgOmpDistributeParallelForSimdStatement::pools.empty() == false)
96251 : {
96252 : // Generate an array of memory pools
96253 0 : SgOmpDistributeParallelForSimdStatement** objectArray = (SgOmpDistributeParallelForSimdStatement**) &(SgOmpDistributeParallelForSimdStatement::pools[0]);
96254 :
96255 : // Build a local variable for better performance
96256 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
96257 :
96258 : // Iterate over the memory pools
96259 0 : for (unsigned int i=0; i < SgOmpDistributeParallelForSimdStatement::pools.size(); i++)
96260 : {
96261 : // objectArray[i] is a single memory pool
96262 0 : for (unsigned j=0; j < SgOmpDistributeParallelForSimdStatement::pool_size; j++)
96263 : {
96264 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
96265 : {
96266 : // printf ("Found a valid SgOmpDistributeParallelForSimdStatement object in the memory pool %d at position %d \n",i,j);
96267 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
96268 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
96269 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
96270 : }
96271 : else
96272 : {
96273 : // printf ("Found a INVALID SgOmpDistributeParallelForSimdStatement object in the memory pool \n");
96274 : }
96275 : }
96276 : }
96277 : }
96278 :
96279 : // This should not be required since all previously static data members are
96280 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
96281 :
96282 194 : }
96283 :
96284 : void
96285 0 : SgOmpDistributeParallelForSimdStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
96286 : {
96287 : // This function visits only a single IR node of the memory pool.
96288 : // it is typically called once for each type of IR node within
96289 : // the automatically generated function: traverseRepresentativeNodes().
96290 :
96291 : // Initialize array to the address of the first element of the STL vector
96292 : // (which is guarenteed to be contiguous storage).
96293 : // SgOmpDistributeParallelForSimdStatement objectArray [] = *(Memory_Block_List.begin());
96294 0 : if (SgOmpDistributeParallelForSimdStatement::pools.empty() == false)
96295 : {
96296 : // Generate an array of memory pools
96297 0 : SgOmpDistributeParallelForSimdStatement** objectArray = (SgOmpDistributeParallelForSimdStatement**) &(SgOmpDistributeParallelForSimdStatement::pools[0]);
96298 :
96299 : // Build a local variable for better performance
96300 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
96301 :
96302 : // Iterate over the memory pools
96303 0 : bool done = false;
96304 0 : unsigned i=0;
96305 :
96306 : // find the first valid IR node, call visit function, and then leave
96307 0 : while ( done == false && i < SgOmpDistributeParallelForSimdStatement::pools.size() )
96308 : {
96309 : // objectArray[i] is a single memory pool
96310 : unsigned j=0;
96311 0 : while (done == false && j < SgOmpDistributeParallelForSimdStatement::pool_size)
96312 : {
96313 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
96314 : {
96315 0 : traversal.visit(&(objectArray[i][j]));
96316 0 : done = true;
96317 : }
96318 0 : j++;
96319 : }
96320 0 : i++;
96321 : }
96322 :
96323 : #if 0
96324 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
96325 : if (done == false)
96326 : {
96327 : printf ("No representative for SgOmpDistributeParallelForSimdStatement found in memory pools \n");
96328 : }
96329 : #endif
96330 : }
96331 0 : }
96332 :
96333 :
96334 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
96335 : // using values that overflow signed values of int.
96336 : size_t
96337 4 : SgOmpDistributeParallelForSimdStatement::numberOfNodes()
96338 : {
96339 : // This function traverses the memory pool for an IR node and
96340 : // counts the number of IR nodes of a particular Sage III IR
96341 : // nodes type.
96342 :
96343 4 : size_t count = 0;
96344 4 : if (SgOmpDistributeParallelForSimdStatement::pools.empty() == false)
96345 : {
96346 : // Generate an array of memory pools (this is actually a STL vector,
96347 : // but it is contiguious, so OK to treat this way).
96348 0 : SgOmpDistributeParallelForSimdStatement** objectArray = (SgOmpDistributeParallelForSimdStatement**) &(SgOmpDistributeParallelForSimdStatement::pools[0]);
96349 :
96350 : // Build a local variable for better performance (make it a loop invariant variable).
96351 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
96352 :
96353 : // Iterate over all of the memory pools for this IR node.
96354 0 : for (unsigned int i=0; i < SgOmpDistributeParallelForSimdStatement::pools.size(); i++)
96355 : {
96356 : // objectArray[i] is a single memory pool, iterate over all the
96357 : // IR nodes and only count those that are valid IR nodes used in
96358 : // the AST (i.e. allocated IR nodes).
96359 0 : for (unsigned j=0; j < SgOmpDistributeParallelForSimdStatement::pool_size; j++)
96360 : {
96361 : // This is indexing the STL vector of C/C++ style arrays as a doubly
96362 : // indexed array access. It is OK since we have leveraged the semantics
96363 : // of STL vector memory as contigous and cast the memory as an array
96364 : // of arrays to use the 2D array indexing. Hope this is not confusing,
96365 : // but it s very fast as an implementation.
96366 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
96367 : {
96368 0 : count++;
96369 : }
96370 : }
96371 : }
96372 : }
96373 :
96374 :
96375 :
96376 4 : return count;
96377 : }
96378 :
96379 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
96380 : // using values that overflow signed values of int.
96381 : size_t
96382 0 : SgOmpDistributeParallelForSimdStatement::memoryUsage()
96383 : {
96384 : // This function is required because we need the class name as a type when we call sizeof
96385 : // There might be another way to implement this if we have a traversal that only called a
96386 : // representative object (one call for each type of Sage IIIIR node).
96387 0 : size_t memory = numberOfNodes() * sizeof(SgOmpDistributeParallelForSimdStatement);
96388 :
96389 0 : return memory;
96390 : }
96391 :
96392 : /* #line 96393 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
96393 :
96394 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
96395 : void
96396 5342 : SgOmpTaskloopSimdStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
96397 : {
96398 : // This function traverses the memory pool for only a specific IR node
96399 : // and calls the visit function of the input class execute a traversal
96400 : // similar to the style of the attribute based traversals within ROSE.
96401 : // This traversal will visit ALL nodes of the AST where as the other
96402 : // attribute based traversals visit only the embedded tree within the AST.
96403 :
96404 : // Initialize array to the address of the first element of the STL vector
96405 : // (which is guaranteed to be contiguous storage).
96406 : // SgOmpTaskloopSimdStatement objectArray [] = *(Memory_Block_List.begin());
96407 5342 : if (SgOmpTaskloopSimdStatement::pools.empty() == false)
96408 : {
96409 : // Generate an array of memory pools
96410 7 : SgOmpTaskloopSimdStatement** objectArray = (SgOmpTaskloopSimdStatement**) &(SgOmpTaskloopSimdStatement::pools[0]);
96411 :
96412 : // Build a local variable for better performance
96413 7 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
96414 : #if 0
96415 : // Iterate over the memory pools
96416 : for (unsigned int i=0; i < SgOmpTaskloopSimdStatement::pools.size(); i++)
96417 : {
96418 : // objectArray[i] is a single memory pool
96419 : for (int j=0; j < SgOmpTaskloopSimdStatement::pool_size; j++)
96420 : {
96421 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
96422 : {
96423 : traversal.visit(&(objectArray[i][j]));
96424 : }
96425 : }
96426 : }
96427 : #else
96428 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
96429 : // compute the list first and then call the visit function on each list element.
96430 :
96431 : // printf ("Inside of SgOmpTaskloopSimdStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
96432 :
96433 14 : std::vector<SgOmpTaskloopSimdStatement*> nodeList;
96434 :
96435 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
96436 14 : for (unsigned int i=0; i < SgOmpTaskloopSimdStatement::pools.size(); i++)
96437 : {
96438 : // objectArray[i] is a single memory pool
96439 14007 : for (unsigned j=0; j < SgOmpTaskloopSimdStatement::pool_size; j++)
96440 : {
96441 14000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
96442 : {
96443 7 : nodeList.push_back(&(objectArray[i][j]));
96444 : }
96445 : }
96446 : }
96447 :
96448 : // Iterate over the saved list
96449 7 : size_t nodeListSize = nodeList.size();
96450 14 : for (size_t i=0; i < nodeListSize; i++)
96451 : {
96452 7 : ROSE_ASSERT(nodeList[i] != NULL);
96453 : #if 0
96454 : traversal.visit(nodeList[i]);
96455 : #else
96456 7 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
96457 : {
96458 7 : traversal.visit(nodeList[i]);
96459 : }
96460 : #endif
96461 : }
96462 : #endif
96463 : }
96464 :
96465 : // This should not be required since all previously static data members are
96466 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
96467 :
96468 5342 : }
96469 :
96470 :
96471 : void
96472 194 : SgOmpTaskloopSimdStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
96473 : {
96474 : // This function traverses the memory pool for an IR node and
96475 : // calls the function to execute the visitor object.
96476 :
96477 : // Initialize array to the address of the first element of the STL vector
96478 : // (which is guarenteed to be contiguous storage).
96479 : // SgOmpTaskloopSimdStatement objectArray [] = *(Memory_Block_List.begin());
96480 194 : if (SgOmpTaskloopSimdStatement::pools.empty() == false)
96481 : {
96482 : // Generate an array of memory pools
96483 0 : SgOmpTaskloopSimdStatement** objectArray = (SgOmpTaskloopSimdStatement**) &(SgOmpTaskloopSimdStatement::pools[0]);
96484 :
96485 : // Build a local variable for better performance
96486 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
96487 :
96488 : // Iterate over the memory pools
96489 0 : for (unsigned int i=0; i < SgOmpTaskloopSimdStatement::pools.size(); i++)
96490 : {
96491 : // objectArray[i] is a single memory pool
96492 0 : for (unsigned j=0; j < SgOmpTaskloopSimdStatement::pool_size; j++)
96493 : {
96494 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
96495 : {
96496 : // printf ("Found a valid SgOmpTaskloopSimdStatement object in the memory pool %d at position %d \n",i,j);
96497 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
96498 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
96499 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
96500 : }
96501 : else
96502 : {
96503 : // printf ("Found a INVALID SgOmpTaskloopSimdStatement object in the memory pool \n");
96504 : }
96505 : }
96506 : }
96507 : }
96508 :
96509 : // This should not be required since all previously static data members are
96510 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
96511 :
96512 194 : }
96513 :
96514 : void
96515 0 : SgOmpTaskloopSimdStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
96516 : {
96517 : // This function visits only a single IR node of the memory pool.
96518 : // it is typically called once for each type of IR node within
96519 : // the automatically generated function: traverseRepresentativeNodes().
96520 :
96521 : // Initialize array to the address of the first element of the STL vector
96522 : // (which is guarenteed to be contiguous storage).
96523 : // SgOmpTaskloopSimdStatement objectArray [] = *(Memory_Block_List.begin());
96524 0 : if (SgOmpTaskloopSimdStatement::pools.empty() == false)
96525 : {
96526 : // Generate an array of memory pools
96527 0 : SgOmpTaskloopSimdStatement** objectArray = (SgOmpTaskloopSimdStatement**) &(SgOmpTaskloopSimdStatement::pools[0]);
96528 :
96529 : // Build a local variable for better performance
96530 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
96531 :
96532 : // Iterate over the memory pools
96533 0 : bool done = false;
96534 0 : unsigned i=0;
96535 :
96536 : // find the first valid IR node, call visit function, and then leave
96537 0 : while ( done == false && i < SgOmpTaskloopSimdStatement::pools.size() )
96538 : {
96539 : // objectArray[i] is a single memory pool
96540 : unsigned j=0;
96541 0 : while (done == false && j < SgOmpTaskloopSimdStatement::pool_size)
96542 : {
96543 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
96544 : {
96545 0 : traversal.visit(&(objectArray[i][j]));
96546 0 : done = true;
96547 : }
96548 0 : j++;
96549 : }
96550 0 : i++;
96551 : }
96552 :
96553 : #if 0
96554 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
96555 : if (done == false)
96556 : {
96557 : printf ("No representative for SgOmpTaskloopSimdStatement found in memory pools \n");
96558 : }
96559 : #endif
96560 : }
96561 0 : }
96562 :
96563 :
96564 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
96565 : // using values that overflow signed values of int.
96566 : size_t
96567 4 : SgOmpTaskloopSimdStatement::numberOfNodes()
96568 : {
96569 : // This function traverses the memory pool for an IR node and
96570 : // counts the number of IR nodes of a particular Sage III IR
96571 : // nodes type.
96572 :
96573 4 : size_t count = 0;
96574 4 : if (SgOmpTaskloopSimdStatement::pools.empty() == false)
96575 : {
96576 : // Generate an array of memory pools (this is actually a STL vector,
96577 : // but it is contiguious, so OK to treat this way).
96578 0 : SgOmpTaskloopSimdStatement** objectArray = (SgOmpTaskloopSimdStatement**) &(SgOmpTaskloopSimdStatement::pools[0]);
96579 :
96580 : // Build a local variable for better performance (make it a loop invariant variable).
96581 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
96582 :
96583 : // Iterate over all of the memory pools for this IR node.
96584 0 : for (unsigned int i=0; i < SgOmpTaskloopSimdStatement::pools.size(); i++)
96585 : {
96586 : // objectArray[i] is a single memory pool, iterate over all the
96587 : // IR nodes and only count those that are valid IR nodes used in
96588 : // the AST (i.e. allocated IR nodes).
96589 0 : for (unsigned j=0; j < SgOmpTaskloopSimdStatement::pool_size; j++)
96590 : {
96591 : // This is indexing the STL vector of C/C++ style arrays as a doubly
96592 : // indexed array access. It is OK since we have leveraged the semantics
96593 : // of STL vector memory as contigous and cast the memory as an array
96594 : // of arrays to use the 2D array indexing. Hope this is not confusing,
96595 : // but it s very fast as an implementation.
96596 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
96597 : {
96598 0 : count++;
96599 : }
96600 : }
96601 : }
96602 : }
96603 :
96604 :
96605 :
96606 4 : return count;
96607 : }
96608 :
96609 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
96610 : // using values that overflow signed values of int.
96611 : size_t
96612 0 : SgOmpTaskloopSimdStatement::memoryUsage()
96613 : {
96614 : // This function is required because we need the class name as a type when we call sizeof
96615 : // There might be another way to implement this if we have a traversal that only called a
96616 : // representative object (one call for each type of Sage IIIIR node).
96617 0 : size_t memory = numberOfNodes() * sizeof(SgOmpTaskloopSimdStatement);
96618 :
96619 0 : return memory;
96620 : }
96621 :
96622 : /* #line 96623 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
96623 :
96624 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
96625 : void
96626 5342 : SgOmpMasterTaskloopSimdStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
96627 : {
96628 : // This function traverses the memory pool for only a specific IR node
96629 : // and calls the visit function of the input class execute a traversal
96630 : // similar to the style of the attribute based traversals within ROSE.
96631 : // This traversal will visit ALL nodes of the AST where as the other
96632 : // attribute based traversals visit only the embedded tree within the AST.
96633 :
96634 : // Initialize array to the address of the first element of the STL vector
96635 : // (which is guaranteed to be contiguous storage).
96636 : // SgOmpMasterTaskloopSimdStatement objectArray [] = *(Memory_Block_List.begin());
96637 5342 : if (SgOmpMasterTaskloopSimdStatement::pools.empty() == false)
96638 : {
96639 : // Generate an array of memory pools
96640 14 : SgOmpMasterTaskloopSimdStatement** objectArray = (SgOmpMasterTaskloopSimdStatement**) &(SgOmpMasterTaskloopSimdStatement::pools[0]);
96641 :
96642 : // Build a local variable for better performance
96643 14 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
96644 : #if 0
96645 : // Iterate over the memory pools
96646 : for (unsigned int i=0; i < SgOmpMasterTaskloopSimdStatement::pools.size(); i++)
96647 : {
96648 : // objectArray[i] is a single memory pool
96649 : for (int j=0; j < SgOmpMasterTaskloopSimdStatement::pool_size; j++)
96650 : {
96651 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
96652 : {
96653 : traversal.visit(&(objectArray[i][j]));
96654 : }
96655 : }
96656 : }
96657 : #else
96658 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
96659 : // compute the list first and then call the visit function on each list element.
96660 :
96661 : // printf ("Inside of SgOmpMasterTaskloopSimdStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
96662 :
96663 28 : std::vector<SgOmpMasterTaskloopSimdStatement*> nodeList;
96664 :
96665 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
96666 28 : for (unsigned int i=0; i < SgOmpMasterTaskloopSimdStatement::pools.size(); i++)
96667 : {
96668 : // objectArray[i] is a single memory pool
96669 28014 : for (unsigned j=0; j < SgOmpMasterTaskloopSimdStatement::pool_size; j++)
96670 : {
96671 28000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
96672 : {
96673 14 : nodeList.push_back(&(objectArray[i][j]));
96674 : }
96675 : }
96676 : }
96677 :
96678 : // Iterate over the saved list
96679 14 : size_t nodeListSize = nodeList.size();
96680 28 : for (size_t i=0; i < nodeListSize; i++)
96681 : {
96682 14 : ROSE_ASSERT(nodeList[i] != NULL);
96683 : #if 0
96684 : traversal.visit(nodeList[i]);
96685 : #else
96686 14 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
96687 : {
96688 14 : traversal.visit(nodeList[i]);
96689 : }
96690 : #endif
96691 : }
96692 : #endif
96693 : }
96694 :
96695 : // This should not be required since all previously static data members are
96696 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
96697 :
96698 5342 : }
96699 :
96700 :
96701 : void
96702 194 : SgOmpMasterTaskloopSimdStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
96703 : {
96704 : // This function traverses the memory pool for an IR node and
96705 : // calls the function to execute the visitor object.
96706 :
96707 : // Initialize array to the address of the first element of the STL vector
96708 : // (which is guarenteed to be contiguous storage).
96709 : // SgOmpMasterTaskloopSimdStatement objectArray [] = *(Memory_Block_List.begin());
96710 194 : if (SgOmpMasterTaskloopSimdStatement::pools.empty() == false)
96711 : {
96712 : // Generate an array of memory pools
96713 0 : SgOmpMasterTaskloopSimdStatement** objectArray = (SgOmpMasterTaskloopSimdStatement**) &(SgOmpMasterTaskloopSimdStatement::pools[0]);
96714 :
96715 : // Build a local variable for better performance
96716 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
96717 :
96718 : // Iterate over the memory pools
96719 0 : for (unsigned int i=0; i < SgOmpMasterTaskloopSimdStatement::pools.size(); i++)
96720 : {
96721 : // objectArray[i] is a single memory pool
96722 0 : for (unsigned j=0; j < SgOmpMasterTaskloopSimdStatement::pool_size; j++)
96723 : {
96724 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
96725 : {
96726 : // printf ("Found a valid SgOmpMasterTaskloopSimdStatement object in the memory pool %d at position %d \n",i,j);
96727 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
96728 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
96729 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
96730 : }
96731 : else
96732 : {
96733 : // printf ("Found a INVALID SgOmpMasterTaskloopSimdStatement object in the memory pool \n");
96734 : }
96735 : }
96736 : }
96737 : }
96738 :
96739 : // This should not be required since all previously static data members are
96740 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
96741 :
96742 194 : }
96743 :
96744 : void
96745 0 : SgOmpMasterTaskloopSimdStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
96746 : {
96747 : // This function visits only a single IR node of the memory pool.
96748 : // it is typically called once for each type of IR node within
96749 : // the automatically generated function: traverseRepresentativeNodes().
96750 :
96751 : // Initialize array to the address of the first element of the STL vector
96752 : // (which is guarenteed to be contiguous storage).
96753 : // SgOmpMasterTaskloopSimdStatement objectArray [] = *(Memory_Block_List.begin());
96754 0 : if (SgOmpMasterTaskloopSimdStatement::pools.empty() == false)
96755 : {
96756 : // Generate an array of memory pools
96757 0 : SgOmpMasterTaskloopSimdStatement** objectArray = (SgOmpMasterTaskloopSimdStatement**) &(SgOmpMasterTaskloopSimdStatement::pools[0]);
96758 :
96759 : // Build a local variable for better performance
96760 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
96761 :
96762 : // Iterate over the memory pools
96763 0 : bool done = false;
96764 0 : unsigned i=0;
96765 :
96766 : // find the first valid IR node, call visit function, and then leave
96767 0 : while ( done == false && i < SgOmpMasterTaskloopSimdStatement::pools.size() )
96768 : {
96769 : // objectArray[i] is a single memory pool
96770 : unsigned j=0;
96771 0 : while (done == false && j < SgOmpMasterTaskloopSimdStatement::pool_size)
96772 : {
96773 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
96774 : {
96775 0 : traversal.visit(&(objectArray[i][j]));
96776 0 : done = true;
96777 : }
96778 0 : j++;
96779 : }
96780 0 : i++;
96781 : }
96782 :
96783 : #if 0
96784 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
96785 : if (done == false)
96786 : {
96787 : printf ("No representative for SgOmpMasterTaskloopSimdStatement found in memory pools \n");
96788 : }
96789 : #endif
96790 : }
96791 0 : }
96792 :
96793 :
96794 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
96795 : // using values that overflow signed values of int.
96796 : size_t
96797 4 : SgOmpMasterTaskloopSimdStatement::numberOfNodes()
96798 : {
96799 : // This function traverses the memory pool for an IR node and
96800 : // counts the number of IR nodes of a particular Sage III IR
96801 : // nodes type.
96802 :
96803 4 : size_t count = 0;
96804 4 : if (SgOmpMasterTaskloopSimdStatement::pools.empty() == false)
96805 : {
96806 : // Generate an array of memory pools (this is actually a STL vector,
96807 : // but it is contiguious, so OK to treat this way).
96808 0 : SgOmpMasterTaskloopSimdStatement** objectArray = (SgOmpMasterTaskloopSimdStatement**) &(SgOmpMasterTaskloopSimdStatement::pools[0]);
96809 :
96810 : // Build a local variable for better performance (make it a loop invariant variable).
96811 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
96812 :
96813 : // Iterate over all of the memory pools for this IR node.
96814 0 : for (unsigned int i=0; i < SgOmpMasterTaskloopSimdStatement::pools.size(); i++)
96815 : {
96816 : // objectArray[i] is a single memory pool, iterate over all the
96817 : // IR nodes and only count those that are valid IR nodes used in
96818 : // the AST (i.e. allocated IR nodes).
96819 0 : for (unsigned j=0; j < SgOmpMasterTaskloopSimdStatement::pool_size; j++)
96820 : {
96821 : // This is indexing the STL vector of C/C++ style arrays as a doubly
96822 : // indexed array access. It is OK since we have leveraged the semantics
96823 : // of STL vector memory as contigous and cast the memory as an array
96824 : // of arrays to use the 2D array indexing. Hope this is not confusing,
96825 : // but it s very fast as an implementation.
96826 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
96827 : {
96828 0 : count++;
96829 : }
96830 : }
96831 : }
96832 : }
96833 :
96834 :
96835 :
96836 4 : return count;
96837 : }
96838 :
96839 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
96840 : // using values that overflow signed values of int.
96841 : size_t
96842 0 : SgOmpMasterTaskloopSimdStatement::memoryUsage()
96843 : {
96844 : // This function is required because we need the class name as a type when we call sizeof
96845 : // There might be another way to implement this if we have a traversal that only called a
96846 : // representative object (one call for each type of Sage IIIIR node).
96847 0 : size_t memory = numberOfNodes() * sizeof(SgOmpMasterTaskloopSimdStatement);
96848 :
96849 0 : return memory;
96850 : }
96851 :
96852 : /* #line 96853 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
96853 :
96854 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
96855 : void
96856 5342 : SgOmpParallelMasterTaskloopStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
96857 : {
96858 : // This function traverses the memory pool for only a specific IR node
96859 : // and calls the visit function of the input class execute a traversal
96860 : // similar to the style of the attribute based traversals within ROSE.
96861 : // This traversal will visit ALL nodes of the AST where as the other
96862 : // attribute based traversals visit only the embedded tree within the AST.
96863 :
96864 : // Initialize array to the address of the first element of the STL vector
96865 : // (which is guaranteed to be contiguous storage).
96866 : // SgOmpParallelMasterTaskloopStatement objectArray [] = *(Memory_Block_List.begin());
96867 5342 : if (SgOmpParallelMasterTaskloopStatement::pools.empty() == false)
96868 : {
96869 : // Generate an array of memory pools
96870 7 : SgOmpParallelMasterTaskloopStatement** objectArray = (SgOmpParallelMasterTaskloopStatement**) &(SgOmpParallelMasterTaskloopStatement::pools[0]);
96871 :
96872 : // Build a local variable for better performance
96873 7 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
96874 : #if 0
96875 : // Iterate over the memory pools
96876 : for (unsigned int i=0; i < SgOmpParallelMasterTaskloopStatement::pools.size(); i++)
96877 : {
96878 : // objectArray[i] is a single memory pool
96879 : for (int j=0; j < SgOmpParallelMasterTaskloopStatement::pool_size; j++)
96880 : {
96881 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
96882 : {
96883 : traversal.visit(&(objectArray[i][j]));
96884 : }
96885 : }
96886 : }
96887 : #else
96888 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
96889 : // compute the list first and then call the visit function on each list element.
96890 :
96891 : // printf ("Inside of SgOmpParallelMasterTaskloopStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
96892 :
96893 14 : std::vector<SgOmpParallelMasterTaskloopStatement*> nodeList;
96894 :
96895 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
96896 14 : for (unsigned int i=0; i < SgOmpParallelMasterTaskloopStatement::pools.size(); i++)
96897 : {
96898 : // objectArray[i] is a single memory pool
96899 14007 : for (unsigned j=0; j < SgOmpParallelMasterTaskloopStatement::pool_size; j++)
96900 : {
96901 14000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
96902 : {
96903 7 : nodeList.push_back(&(objectArray[i][j]));
96904 : }
96905 : }
96906 : }
96907 :
96908 : // Iterate over the saved list
96909 7 : size_t nodeListSize = nodeList.size();
96910 14 : for (size_t i=0; i < nodeListSize; i++)
96911 : {
96912 7 : ROSE_ASSERT(nodeList[i] != NULL);
96913 : #if 0
96914 : traversal.visit(nodeList[i]);
96915 : #else
96916 7 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
96917 : {
96918 7 : traversal.visit(nodeList[i]);
96919 : }
96920 : #endif
96921 : }
96922 : #endif
96923 : }
96924 :
96925 : // This should not be required since all previously static data members are
96926 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
96927 :
96928 5342 : }
96929 :
96930 :
96931 : void
96932 194 : SgOmpParallelMasterTaskloopStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
96933 : {
96934 : // This function traverses the memory pool for an IR node and
96935 : // calls the function to execute the visitor object.
96936 :
96937 : // Initialize array to the address of the first element of the STL vector
96938 : // (which is guarenteed to be contiguous storage).
96939 : // SgOmpParallelMasterTaskloopStatement objectArray [] = *(Memory_Block_List.begin());
96940 194 : if (SgOmpParallelMasterTaskloopStatement::pools.empty() == false)
96941 : {
96942 : // Generate an array of memory pools
96943 0 : SgOmpParallelMasterTaskloopStatement** objectArray = (SgOmpParallelMasterTaskloopStatement**) &(SgOmpParallelMasterTaskloopStatement::pools[0]);
96944 :
96945 : // Build a local variable for better performance
96946 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
96947 :
96948 : // Iterate over the memory pools
96949 0 : for (unsigned int i=0; i < SgOmpParallelMasterTaskloopStatement::pools.size(); i++)
96950 : {
96951 : // objectArray[i] is a single memory pool
96952 0 : for (unsigned j=0; j < SgOmpParallelMasterTaskloopStatement::pool_size; j++)
96953 : {
96954 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
96955 : {
96956 : // printf ("Found a valid SgOmpParallelMasterTaskloopStatement object in the memory pool %d at position %d \n",i,j);
96957 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
96958 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
96959 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
96960 : }
96961 : else
96962 : {
96963 : // printf ("Found a INVALID SgOmpParallelMasterTaskloopStatement object in the memory pool \n");
96964 : }
96965 : }
96966 : }
96967 : }
96968 :
96969 : // This should not be required since all previously static data members are
96970 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
96971 :
96972 194 : }
96973 :
96974 : void
96975 0 : SgOmpParallelMasterTaskloopStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
96976 : {
96977 : // This function visits only a single IR node of the memory pool.
96978 : // it is typically called once for each type of IR node within
96979 : // the automatically generated function: traverseRepresentativeNodes().
96980 :
96981 : // Initialize array to the address of the first element of the STL vector
96982 : // (which is guarenteed to be contiguous storage).
96983 : // SgOmpParallelMasterTaskloopStatement objectArray [] = *(Memory_Block_List.begin());
96984 0 : if (SgOmpParallelMasterTaskloopStatement::pools.empty() == false)
96985 : {
96986 : // Generate an array of memory pools
96987 0 : SgOmpParallelMasterTaskloopStatement** objectArray = (SgOmpParallelMasterTaskloopStatement**) &(SgOmpParallelMasterTaskloopStatement::pools[0]);
96988 :
96989 : // Build a local variable for better performance
96990 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
96991 :
96992 : // Iterate over the memory pools
96993 0 : bool done = false;
96994 0 : unsigned i=0;
96995 :
96996 : // find the first valid IR node, call visit function, and then leave
96997 0 : while ( done == false && i < SgOmpParallelMasterTaskloopStatement::pools.size() )
96998 : {
96999 : // objectArray[i] is a single memory pool
97000 : unsigned j=0;
97001 0 : while (done == false && j < SgOmpParallelMasterTaskloopStatement::pool_size)
97002 : {
97003 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
97004 : {
97005 0 : traversal.visit(&(objectArray[i][j]));
97006 0 : done = true;
97007 : }
97008 0 : j++;
97009 : }
97010 0 : i++;
97011 : }
97012 :
97013 : #if 0
97014 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
97015 : if (done == false)
97016 : {
97017 : printf ("No representative for SgOmpParallelMasterTaskloopStatement found in memory pools \n");
97018 : }
97019 : #endif
97020 : }
97021 0 : }
97022 :
97023 :
97024 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
97025 : // using values that overflow signed values of int.
97026 : size_t
97027 4 : SgOmpParallelMasterTaskloopStatement::numberOfNodes()
97028 : {
97029 : // This function traverses the memory pool for an IR node and
97030 : // counts the number of IR nodes of a particular Sage III IR
97031 : // nodes type.
97032 :
97033 4 : size_t count = 0;
97034 4 : if (SgOmpParallelMasterTaskloopStatement::pools.empty() == false)
97035 : {
97036 : // Generate an array of memory pools (this is actually a STL vector,
97037 : // but it is contiguious, so OK to treat this way).
97038 0 : SgOmpParallelMasterTaskloopStatement** objectArray = (SgOmpParallelMasterTaskloopStatement**) &(SgOmpParallelMasterTaskloopStatement::pools[0]);
97039 :
97040 : // Build a local variable for better performance (make it a loop invariant variable).
97041 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
97042 :
97043 : // Iterate over all of the memory pools for this IR node.
97044 0 : for (unsigned int i=0; i < SgOmpParallelMasterTaskloopStatement::pools.size(); i++)
97045 : {
97046 : // objectArray[i] is a single memory pool, iterate over all the
97047 : // IR nodes and only count those that are valid IR nodes used in
97048 : // the AST (i.e. allocated IR nodes).
97049 0 : for (unsigned j=0; j < SgOmpParallelMasterTaskloopStatement::pool_size; j++)
97050 : {
97051 : // This is indexing the STL vector of C/C++ style arrays as a doubly
97052 : // indexed array access. It is OK since we have leveraged the semantics
97053 : // of STL vector memory as contigous and cast the memory as an array
97054 : // of arrays to use the 2D array indexing. Hope this is not confusing,
97055 : // but it s very fast as an implementation.
97056 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
97057 : {
97058 0 : count++;
97059 : }
97060 : }
97061 : }
97062 : }
97063 :
97064 :
97065 :
97066 4 : return count;
97067 : }
97068 :
97069 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
97070 : // using values that overflow signed values of int.
97071 : size_t
97072 0 : SgOmpParallelMasterTaskloopStatement::memoryUsage()
97073 : {
97074 : // This function is required because we need the class name as a type when we call sizeof
97075 : // There might be another way to implement this if we have a traversal that only called a
97076 : // representative object (one call for each type of Sage IIIIR node).
97077 0 : size_t memory = numberOfNodes() * sizeof(SgOmpParallelMasterTaskloopStatement);
97078 :
97079 0 : return memory;
97080 : }
97081 :
97082 : /* #line 97083 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
97083 :
97084 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
97085 : void
97086 5342 : SgOmpParallelMasterTaskloopSimdStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
97087 : {
97088 : // This function traverses the memory pool for only a specific IR node
97089 : // and calls the visit function of the input class execute a traversal
97090 : // similar to the style of the attribute based traversals within ROSE.
97091 : // This traversal will visit ALL nodes of the AST where as the other
97092 : // attribute based traversals visit only the embedded tree within the AST.
97093 :
97094 : // Initialize array to the address of the first element of the STL vector
97095 : // (which is guaranteed to be contiguous storage).
97096 : // SgOmpParallelMasterTaskloopSimdStatement objectArray [] = *(Memory_Block_List.begin());
97097 5342 : if (SgOmpParallelMasterTaskloopSimdStatement::pools.empty() == false)
97098 : {
97099 : // Generate an array of memory pools
97100 7 : SgOmpParallelMasterTaskloopSimdStatement** objectArray = (SgOmpParallelMasterTaskloopSimdStatement**) &(SgOmpParallelMasterTaskloopSimdStatement::pools[0]);
97101 :
97102 : // Build a local variable for better performance
97103 7 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
97104 : #if 0
97105 : // Iterate over the memory pools
97106 : for (unsigned int i=0; i < SgOmpParallelMasterTaskloopSimdStatement::pools.size(); i++)
97107 : {
97108 : // objectArray[i] is a single memory pool
97109 : for (int j=0; j < SgOmpParallelMasterTaskloopSimdStatement::pool_size; j++)
97110 : {
97111 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
97112 : {
97113 : traversal.visit(&(objectArray[i][j]));
97114 : }
97115 : }
97116 : }
97117 : #else
97118 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
97119 : // compute the list first and then call the visit function on each list element.
97120 :
97121 : // printf ("Inside of SgOmpParallelMasterTaskloopSimdStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
97122 :
97123 14 : std::vector<SgOmpParallelMasterTaskloopSimdStatement*> nodeList;
97124 :
97125 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
97126 14 : for (unsigned int i=0; i < SgOmpParallelMasterTaskloopSimdStatement::pools.size(); i++)
97127 : {
97128 : // objectArray[i] is a single memory pool
97129 14007 : for (unsigned j=0; j < SgOmpParallelMasterTaskloopSimdStatement::pool_size; j++)
97130 : {
97131 14000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
97132 : {
97133 7 : nodeList.push_back(&(objectArray[i][j]));
97134 : }
97135 : }
97136 : }
97137 :
97138 : // Iterate over the saved list
97139 7 : size_t nodeListSize = nodeList.size();
97140 14 : for (size_t i=0; i < nodeListSize; i++)
97141 : {
97142 7 : ROSE_ASSERT(nodeList[i] != NULL);
97143 : #if 0
97144 : traversal.visit(nodeList[i]);
97145 : #else
97146 7 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
97147 : {
97148 7 : traversal.visit(nodeList[i]);
97149 : }
97150 : #endif
97151 : }
97152 : #endif
97153 : }
97154 :
97155 : // This should not be required since all previously static data members are
97156 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
97157 :
97158 5342 : }
97159 :
97160 :
97161 : void
97162 194 : SgOmpParallelMasterTaskloopSimdStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
97163 : {
97164 : // This function traverses the memory pool for an IR node and
97165 : // calls the function to execute the visitor object.
97166 :
97167 : // Initialize array to the address of the first element of the STL vector
97168 : // (which is guarenteed to be contiguous storage).
97169 : // SgOmpParallelMasterTaskloopSimdStatement objectArray [] = *(Memory_Block_List.begin());
97170 194 : if (SgOmpParallelMasterTaskloopSimdStatement::pools.empty() == false)
97171 : {
97172 : // Generate an array of memory pools
97173 0 : SgOmpParallelMasterTaskloopSimdStatement** objectArray = (SgOmpParallelMasterTaskloopSimdStatement**) &(SgOmpParallelMasterTaskloopSimdStatement::pools[0]);
97174 :
97175 : // Build a local variable for better performance
97176 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
97177 :
97178 : // Iterate over the memory pools
97179 0 : for (unsigned int i=0; i < SgOmpParallelMasterTaskloopSimdStatement::pools.size(); i++)
97180 : {
97181 : // objectArray[i] is a single memory pool
97182 0 : for (unsigned j=0; j < SgOmpParallelMasterTaskloopSimdStatement::pool_size; j++)
97183 : {
97184 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
97185 : {
97186 : // printf ("Found a valid SgOmpParallelMasterTaskloopSimdStatement object in the memory pool %d at position %d \n",i,j);
97187 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
97188 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
97189 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
97190 : }
97191 : else
97192 : {
97193 : // printf ("Found a INVALID SgOmpParallelMasterTaskloopSimdStatement object in the memory pool \n");
97194 : }
97195 : }
97196 : }
97197 : }
97198 :
97199 : // This should not be required since all previously static data members are
97200 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
97201 :
97202 194 : }
97203 :
97204 : void
97205 0 : SgOmpParallelMasterTaskloopSimdStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
97206 : {
97207 : // This function visits only a single IR node of the memory pool.
97208 : // it is typically called once for each type of IR node within
97209 : // the automatically generated function: traverseRepresentativeNodes().
97210 :
97211 : // Initialize array to the address of the first element of the STL vector
97212 : // (which is guarenteed to be contiguous storage).
97213 : // SgOmpParallelMasterTaskloopSimdStatement objectArray [] = *(Memory_Block_List.begin());
97214 0 : if (SgOmpParallelMasterTaskloopSimdStatement::pools.empty() == false)
97215 : {
97216 : // Generate an array of memory pools
97217 0 : SgOmpParallelMasterTaskloopSimdStatement** objectArray = (SgOmpParallelMasterTaskloopSimdStatement**) &(SgOmpParallelMasterTaskloopSimdStatement::pools[0]);
97218 :
97219 : // Build a local variable for better performance
97220 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
97221 :
97222 : // Iterate over the memory pools
97223 0 : bool done = false;
97224 0 : unsigned i=0;
97225 :
97226 : // find the first valid IR node, call visit function, and then leave
97227 0 : while ( done == false && i < SgOmpParallelMasterTaskloopSimdStatement::pools.size() )
97228 : {
97229 : // objectArray[i] is a single memory pool
97230 : unsigned j=0;
97231 0 : while (done == false && j < SgOmpParallelMasterTaskloopSimdStatement::pool_size)
97232 : {
97233 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
97234 : {
97235 0 : traversal.visit(&(objectArray[i][j]));
97236 0 : done = true;
97237 : }
97238 0 : j++;
97239 : }
97240 0 : i++;
97241 : }
97242 :
97243 : #if 0
97244 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
97245 : if (done == false)
97246 : {
97247 : printf ("No representative for SgOmpParallelMasterTaskloopSimdStatement found in memory pools \n");
97248 : }
97249 : #endif
97250 : }
97251 0 : }
97252 :
97253 :
97254 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
97255 : // using values that overflow signed values of int.
97256 : size_t
97257 4 : SgOmpParallelMasterTaskloopSimdStatement::numberOfNodes()
97258 : {
97259 : // This function traverses the memory pool for an IR node and
97260 : // counts the number of IR nodes of a particular Sage III IR
97261 : // nodes type.
97262 :
97263 4 : size_t count = 0;
97264 4 : if (SgOmpParallelMasterTaskloopSimdStatement::pools.empty() == false)
97265 : {
97266 : // Generate an array of memory pools (this is actually a STL vector,
97267 : // but it is contiguious, so OK to treat this way).
97268 0 : SgOmpParallelMasterTaskloopSimdStatement** objectArray = (SgOmpParallelMasterTaskloopSimdStatement**) &(SgOmpParallelMasterTaskloopSimdStatement::pools[0]);
97269 :
97270 : // Build a local variable for better performance (make it a loop invariant variable).
97271 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
97272 :
97273 : // Iterate over all of the memory pools for this IR node.
97274 0 : for (unsigned int i=0; i < SgOmpParallelMasterTaskloopSimdStatement::pools.size(); i++)
97275 : {
97276 : // objectArray[i] is a single memory pool, iterate over all the
97277 : // IR nodes and only count those that are valid IR nodes used in
97278 : // the AST (i.e. allocated IR nodes).
97279 0 : for (unsigned j=0; j < SgOmpParallelMasterTaskloopSimdStatement::pool_size; j++)
97280 : {
97281 : // This is indexing the STL vector of C/C++ style arrays as a doubly
97282 : // indexed array access. It is OK since we have leveraged the semantics
97283 : // of STL vector memory as contigous and cast the memory as an array
97284 : // of arrays to use the 2D array indexing. Hope this is not confusing,
97285 : // but it s very fast as an implementation.
97286 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
97287 : {
97288 0 : count++;
97289 : }
97290 : }
97291 : }
97292 : }
97293 :
97294 :
97295 :
97296 4 : return count;
97297 : }
97298 :
97299 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
97300 : // using values that overflow signed values of int.
97301 : size_t
97302 0 : SgOmpParallelMasterTaskloopSimdStatement::memoryUsage()
97303 : {
97304 : // This function is required because we need the class name as a type when we call sizeof
97305 : // There might be another way to implement this if we have a traversal that only called a
97306 : // representative object (one call for each type of Sage IIIIR node).
97307 0 : size_t memory = numberOfNodes() * sizeof(SgOmpParallelMasterTaskloopSimdStatement);
97308 :
97309 0 : return memory;
97310 : }
97311 :
97312 : /* #line 97313 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
97313 :
97314 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
97315 : void
97316 5342 : SgOmpTeamsDistributeStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
97317 : {
97318 : // This function traverses the memory pool for only a specific IR node
97319 : // and calls the visit function of the input class execute a traversal
97320 : // similar to the style of the attribute based traversals within ROSE.
97321 : // This traversal will visit ALL nodes of the AST where as the other
97322 : // attribute based traversals visit only the embedded tree within the AST.
97323 :
97324 : // Initialize array to the address of the first element of the STL vector
97325 : // (which is guaranteed to be contiguous storage).
97326 : // SgOmpTeamsDistributeStatement objectArray [] = *(Memory_Block_List.begin());
97327 5342 : if (SgOmpTeamsDistributeStatement::pools.empty() == false)
97328 : {
97329 : // Generate an array of memory pools
97330 7 : SgOmpTeamsDistributeStatement** objectArray = (SgOmpTeamsDistributeStatement**) &(SgOmpTeamsDistributeStatement::pools[0]);
97331 :
97332 : // Build a local variable for better performance
97333 7 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
97334 : #if 0
97335 : // Iterate over the memory pools
97336 : for (unsigned int i=0; i < SgOmpTeamsDistributeStatement::pools.size(); i++)
97337 : {
97338 : // objectArray[i] is a single memory pool
97339 : for (int j=0; j < SgOmpTeamsDistributeStatement::pool_size; j++)
97340 : {
97341 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
97342 : {
97343 : traversal.visit(&(objectArray[i][j]));
97344 : }
97345 : }
97346 : }
97347 : #else
97348 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
97349 : // compute the list first and then call the visit function on each list element.
97350 :
97351 : // printf ("Inside of SgOmpTeamsDistributeStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
97352 :
97353 14 : std::vector<SgOmpTeamsDistributeStatement*> nodeList;
97354 :
97355 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
97356 14 : for (unsigned int i=0; i < SgOmpTeamsDistributeStatement::pools.size(); i++)
97357 : {
97358 : // objectArray[i] is a single memory pool
97359 14007 : for (unsigned j=0; j < SgOmpTeamsDistributeStatement::pool_size; j++)
97360 : {
97361 14000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
97362 : {
97363 7 : nodeList.push_back(&(objectArray[i][j]));
97364 : }
97365 : }
97366 : }
97367 :
97368 : // Iterate over the saved list
97369 7 : size_t nodeListSize = nodeList.size();
97370 14 : for (size_t i=0; i < nodeListSize; i++)
97371 : {
97372 7 : ROSE_ASSERT(nodeList[i] != NULL);
97373 : #if 0
97374 : traversal.visit(nodeList[i]);
97375 : #else
97376 7 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
97377 : {
97378 7 : traversal.visit(nodeList[i]);
97379 : }
97380 : #endif
97381 : }
97382 : #endif
97383 : }
97384 :
97385 : // This should not be required since all previously static data members are
97386 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
97387 :
97388 5342 : }
97389 :
97390 :
97391 : void
97392 194 : SgOmpTeamsDistributeStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
97393 : {
97394 : // This function traverses the memory pool for an IR node and
97395 : // calls the function to execute the visitor object.
97396 :
97397 : // Initialize array to the address of the first element of the STL vector
97398 : // (which is guarenteed to be contiguous storage).
97399 : // SgOmpTeamsDistributeStatement objectArray [] = *(Memory_Block_List.begin());
97400 194 : if (SgOmpTeamsDistributeStatement::pools.empty() == false)
97401 : {
97402 : // Generate an array of memory pools
97403 0 : SgOmpTeamsDistributeStatement** objectArray = (SgOmpTeamsDistributeStatement**) &(SgOmpTeamsDistributeStatement::pools[0]);
97404 :
97405 : // Build a local variable for better performance
97406 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
97407 :
97408 : // Iterate over the memory pools
97409 0 : for (unsigned int i=0; i < SgOmpTeamsDistributeStatement::pools.size(); i++)
97410 : {
97411 : // objectArray[i] is a single memory pool
97412 0 : for (unsigned j=0; j < SgOmpTeamsDistributeStatement::pool_size; j++)
97413 : {
97414 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
97415 : {
97416 : // printf ("Found a valid SgOmpTeamsDistributeStatement object in the memory pool %d at position %d \n",i,j);
97417 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
97418 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
97419 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
97420 : }
97421 : else
97422 : {
97423 : // printf ("Found a INVALID SgOmpTeamsDistributeStatement object in the memory pool \n");
97424 : }
97425 : }
97426 : }
97427 : }
97428 :
97429 : // This should not be required since all previously static data members are
97430 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
97431 :
97432 194 : }
97433 :
97434 : void
97435 0 : SgOmpTeamsDistributeStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
97436 : {
97437 : // This function visits only a single IR node of the memory pool.
97438 : // it is typically called once for each type of IR node within
97439 : // the automatically generated function: traverseRepresentativeNodes().
97440 :
97441 : // Initialize array to the address of the first element of the STL vector
97442 : // (which is guarenteed to be contiguous storage).
97443 : // SgOmpTeamsDistributeStatement objectArray [] = *(Memory_Block_List.begin());
97444 0 : if (SgOmpTeamsDistributeStatement::pools.empty() == false)
97445 : {
97446 : // Generate an array of memory pools
97447 0 : SgOmpTeamsDistributeStatement** objectArray = (SgOmpTeamsDistributeStatement**) &(SgOmpTeamsDistributeStatement::pools[0]);
97448 :
97449 : // Build a local variable for better performance
97450 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
97451 :
97452 : // Iterate over the memory pools
97453 0 : bool done = false;
97454 0 : unsigned i=0;
97455 :
97456 : // find the first valid IR node, call visit function, and then leave
97457 0 : while ( done == false && i < SgOmpTeamsDistributeStatement::pools.size() )
97458 : {
97459 : // objectArray[i] is a single memory pool
97460 : unsigned j=0;
97461 0 : while (done == false && j < SgOmpTeamsDistributeStatement::pool_size)
97462 : {
97463 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
97464 : {
97465 0 : traversal.visit(&(objectArray[i][j]));
97466 0 : done = true;
97467 : }
97468 0 : j++;
97469 : }
97470 0 : i++;
97471 : }
97472 :
97473 : #if 0
97474 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
97475 : if (done == false)
97476 : {
97477 : printf ("No representative for SgOmpTeamsDistributeStatement found in memory pools \n");
97478 : }
97479 : #endif
97480 : }
97481 0 : }
97482 :
97483 :
97484 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
97485 : // using values that overflow signed values of int.
97486 : size_t
97487 4 : SgOmpTeamsDistributeStatement::numberOfNodes()
97488 : {
97489 : // This function traverses the memory pool for an IR node and
97490 : // counts the number of IR nodes of a particular Sage III IR
97491 : // nodes type.
97492 :
97493 4 : size_t count = 0;
97494 4 : if (SgOmpTeamsDistributeStatement::pools.empty() == false)
97495 : {
97496 : // Generate an array of memory pools (this is actually a STL vector,
97497 : // but it is contiguious, so OK to treat this way).
97498 0 : SgOmpTeamsDistributeStatement** objectArray = (SgOmpTeamsDistributeStatement**) &(SgOmpTeamsDistributeStatement::pools[0]);
97499 :
97500 : // Build a local variable for better performance (make it a loop invariant variable).
97501 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
97502 :
97503 : // Iterate over all of the memory pools for this IR node.
97504 0 : for (unsigned int i=0; i < SgOmpTeamsDistributeStatement::pools.size(); i++)
97505 : {
97506 : // objectArray[i] is a single memory pool, iterate over all the
97507 : // IR nodes and only count those that are valid IR nodes used in
97508 : // the AST (i.e. allocated IR nodes).
97509 0 : for (unsigned j=0; j < SgOmpTeamsDistributeStatement::pool_size; j++)
97510 : {
97511 : // This is indexing the STL vector of C/C++ style arrays as a doubly
97512 : // indexed array access. It is OK since we have leveraged the semantics
97513 : // of STL vector memory as contigous and cast the memory as an array
97514 : // of arrays to use the 2D array indexing. Hope this is not confusing,
97515 : // but it s very fast as an implementation.
97516 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
97517 : {
97518 0 : count++;
97519 : }
97520 : }
97521 : }
97522 : }
97523 :
97524 :
97525 :
97526 4 : return count;
97527 : }
97528 :
97529 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
97530 : // using values that overflow signed values of int.
97531 : size_t
97532 0 : SgOmpTeamsDistributeStatement::memoryUsage()
97533 : {
97534 : // This function is required because we need the class name as a type when we call sizeof
97535 : // There might be another way to implement this if we have a traversal that only called a
97536 : // representative object (one call for each type of Sage IIIIR node).
97537 0 : size_t memory = numberOfNodes() * sizeof(SgOmpTeamsDistributeStatement);
97538 :
97539 0 : return memory;
97540 : }
97541 :
97542 : /* #line 97543 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
97543 :
97544 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
97545 : void
97546 5342 : SgOmpTeamsDistributeSimdStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
97547 : {
97548 : // This function traverses the memory pool for only a specific IR node
97549 : // and calls the visit function of the input class execute a traversal
97550 : // similar to the style of the attribute based traversals within ROSE.
97551 : // This traversal will visit ALL nodes of the AST where as the other
97552 : // attribute based traversals visit only the embedded tree within the AST.
97553 :
97554 : // Initialize array to the address of the first element of the STL vector
97555 : // (which is guaranteed to be contiguous storage).
97556 : // SgOmpTeamsDistributeSimdStatement objectArray [] = *(Memory_Block_List.begin());
97557 5342 : if (SgOmpTeamsDistributeSimdStatement::pools.empty() == false)
97558 : {
97559 : // Generate an array of memory pools
97560 7 : SgOmpTeamsDistributeSimdStatement** objectArray = (SgOmpTeamsDistributeSimdStatement**) &(SgOmpTeamsDistributeSimdStatement::pools[0]);
97561 :
97562 : // Build a local variable for better performance
97563 7 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
97564 : #if 0
97565 : // Iterate over the memory pools
97566 : for (unsigned int i=0; i < SgOmpTeamsDistributeSimdStatement::pools.size(); i++)
97567 : {
97568 : // objectArray[i] is a single memory pool
97569 : for (int j=0; j < SgOmpTeamsDistributeSimdStatement::pool_size; j++)
97570 : {
97571 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
97572 : {
97573 : traversal.visit(&(objectArray[i][j]));
97574 : }
97575 : }
97576 : }
97577 : #else
97578 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
97579 : // compute the list first and then call the visit function on each list element.
97580 :
97581 : // printf ("Inside of SgOmpTeamsDistributeSimdStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
97582 :
97583 14 : std::vector<SgOmpTeamsDistributeSimdStatement*> nodeList;
97584 :
97585 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
97586 14 : for (unsigned int i=0; i < SgOmpTeamsDistributeSimdStatement::pools.size(); i++)
97587 : {
97588 : // objectArray[i] is a single memory pool
97589 14007 : for (unsigned j=0; j < SgOmpTeamsDistributeSimdStatement::pool_size; j++)
97590 : {
97591 14000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
97592 : {
97593 7 : nodeList.push_back(&(objectArray[i][j]));
97594 : }
97595 : }
97596 : }
97597 :
97598 : // Iterate over the saved list
97599 7 : size_t nodeListSize = nodeList.size();
97600 14 : for (size_t i=0; i < nodeListSize; i++)
97601 : {
97602 7 : ROSE_ASSERT(nodeList[i] != NULL);
97603 : #if 0
97604 : traversal.visit(nodeList[i]);
97605 : #else
97606 7 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
97607 : {
97608 7 : traversal.visit(nodeList[i]);
97609 : }
97610 : #endif
97611 : }
97612 : #endif
97613 : }
97614 :
97615 : // This should not be required since all previously static data members are
97616 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
97617 :
97618 5342 : }
97619 :
97620 :
97621 : void
97622 194 : SgOmpTeamsDistributeSimdStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
97623 : {
97624 : // This function traverses the memory pool for an IR node and
97625 : // calls the function to execute the visitor object.
97626 :
97627 : // Initialize array to the address of the first element of the STL vector
97628 : // (which is guarenteed to be contiguous storage).
97629 : // SgOmpTeamsDistributeSimdStatement objectArray [] = *(Memory_Block_List.begin());
97630 194 : if (SgOmpTeamsDistributeSimdStatement::pools.empty() == false)
97631 : {
97632 : // Generate an array of memory pools
97633 0 : SgOmpTeamsDistributeSimdStatement** objectArray = (SgOmpTeamsDistributeSimdStatement**) &(SgOmpTeamsDistributeSimdStatement::pools[0]);
97634 :
97635 : // Build a local variable for better performance
97636 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
97637 :
97638 : // Iterate over the memory pools
97639 0 : for (unsigned int i=0; i < SgOmpTeamsDistributeSimdStatement::pools.size(); i++)
97640 : {
97641 : // objectArray[i] is a single memory pool
97642 0 : for (unsigned j=0; j < SgOmpTeamsDistributeSimdStatement::pool_size; j++)
97643 : {
97644 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
97645 : {
97646 : // printf ("Found a valid SgOmpTeamsDistributeSimdStatement object in the memory pool %d at position %d \n",i,j);
97647 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
97648 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
97649 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
97650 : }
97651 : else
97652 : {
97653 : // printf ("Found a INVALID SgOmpTeamsDistributeSimdStatement object in the memory pool \n");
97654 : }
97655 : }
97656 : }
97657 : }
97658 :
97659 : // This should not be required since all previously static data members are
97660 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
97661 :
97662 194 : }
97663 :
97664 : void
97665 0 : SgOmpTeamsDistributeSimdStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
97666 : {
97667 : // This function visits only a single IR node of the memory pool.
97668 : // it is typically called once for each type of IR node within
97669 : // the automatically generated function: traverseRepresentativeNodes().
97670 :
97671 : // Initialize array to the address of the first element of the STL vector
97672 : // (which is guarenteed to be contiguous storage).
97673 : // SgOmpTeamsDistributeSimdStatement objectArray [] = *(Memory_Block_List.begin());
97674 0 : if (SgOmpTeamsDistributeSimdStatement::pools.empty() == false)
97675 : {
97676 : // Generate an array of memory pools
97677 0 : SgOmpTeamsDistributeSimdStatement** objectArray = (SgOmpTeamsDistributeSimdStatement**) &(SgOmpTeamsDistributeSimdStatement::pools[0]);
97678 :
97679 : // Build a local variable for better performance
97680 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
97681 :
97682 : // Iterate over the memory pools
97683 0 : bool done = false;
97684 0 : unsigned i=0;
97685 :
97686 : // find the first valid IR node, call visit function, and then leave
97687 0 : while ( done == false && i < SgOmpTeamsDistributeSimdStatement::pools.size() )
97688 : {
97689 : // objectArray[i] is a single memory pool
97690 : unsigned j=0;
97691 0 : while (done == false && j < SgOmpTeamsDistributeSimdStatement::pool_size)
97692 : {
97693 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
97694 : {
97695 0 : traversal.visit(&(objectArray[i][j]));
97696 0 : done = true;
97697 : }
97698 0 : j++;
97699 : }
97700 0 : i++;
97701 : }
97702 :
97703 : #if 0
97704 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
97705 : if (done == false)
97706 : {
97707 : printf ("No representative for SgOmpTeamsDistributeSimdStatement found in memory pools \n");
97708 : }
97709 : #endif
97710 : }
97711 0 : }
97712 :
97713 :
97714 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
97715 : // using values that overflow signed values of int.
97716 : size_t
97717 4 : SgOmpTeamsDistributeSimdStatement::numberOfNodes()
97718 : {
97719 : // This function traverses the memory pool for an IR node and
97720 : // counts the number of IR nodes of a particular Sage III IR
97721 : // nodes type.
97722 :
97723 4 : size_t count = 0;
97724 4 : if (SgOmpTeamsDistributeSimdStatement::pools.empty() == false)
97725 : {
97726 : // Generate an array of memory pools (this is actually a STL vector,
97727 : // but it is contiguious, so OK to treat this way).
97728 0 : SgOmpTeamsDistributeSimdStatement** objectArray = (SgOmpTeamsDistributeSimdStatement**) &(SgOmpTeamsDistributeSimdStatement::pools[0]);
97729 :
97730 : // Build a local variable for better performance (make it a loop invariant variable).
97731 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
97732 :
97733 : // Iterate over all of the memory pools for this IR node.
97734 0 : for (unsigned int i=0; i < SgOmpTeamsDistributeSimdStatement::pools.size(); i++)
97735 : {
97736 : // objectArray[i] is a single memory pool, iterate over all the
97737 : // IR nodes and only count those that are valid IR nodes used in
97738 : // the AST (i.e. allocated IR nodes).
97739 0 : for (unsigned j=0; j < SgOmpTeamsDistributeSimdStatement::pool_size; j++)
97740 : {
97741 : // This is indexing the STL vector of C/C++ style arrays as a doubly
97742 : // indexed array access. It is OK since we have leveraged the semantics
97743 : // of STL vector memory as contigous and cast the memory as an array
97744 : // of arrays to use the 2D array indexing. Hope this is not confusing,
97745 : // but it s very fast as an implementation.
97746 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
97747 : {
97748 0 : count++;
97749 : }
97750 : }
97751 : }
97752 : }
97753 :
97754 :
97755 :
97756 4 : return count;
97757 : }
97758 :
97759 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
97760 : // using values that overflow signed values of int.
97761 : size_t
97762 0 : SgOmpTeamsDistributeSimdStatement::memoryUsage()
97763 : {
97764 : // This function is required because we need the class name as a type when we call sizeof
97765 : // There might be another way to implement this if we have a traversal that only called a
97766 : // representative object (one call for each type of Sage IIIIR node).
97767 0 : size_t memory = numberOfNodes() * sizeof(SgOmpTeamsDistributeSimdStatement);
97768 :
97769 0 : return memory;
97770 : }
97771 :
97772 : /* #line 97773 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
97773 :
97774 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
97775 : void
97776 5342 : SgOmpTeamsDistributeParallelForStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
97777 : {
97778 : // This function traverses the memory pool for only a specific IR node
97779 : // and calls the visit function of the input class execute a traversal
97780 : // similar to the style of the attribute based traversals within ROSE.
97781 : // This traversal will visit ALL nodes of the AST where as the other
97782 : // attribute based traversals visit only the embedded tree within the AST.
97783 :
97784 : // Initialize array to the address of the first element of the STL vector
97785 : // (which is guaranteed to be contiguous storage).
97786 : // SgOmpTeamsDistributeParallelForStatement objectArray [] = *(Memory_Block_List.begin());
97787 5342 : if (SgOmpTeamsDistributeParallelForStatement::pools.empty() == false)
97788 : {
97789 : // Generate an array of memory pools
97790 7 : SgOmpTeamsDistributeParallelForStatement** objectArray = (SgOmpTeamsDistributeParallelForStatement**) &(SgOmpTeamsDistributeParallelForStatement::pools[0]);
97791 :
97792 : // Build a local variable for better performance
97793 7 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
97794 : #if 0
97795 : // Iterate over the memory pools
97796 : for (unsigned int i=0; i < SgOmpTeamsDistributeParallelForStatement::pools.size(); i++)
97797 : {
97798 : // objectArray[i] is a single memory pool
97799 : for (int j=0; j < SgOmpTeamsDistributeParallelForStatement::pool_size; j++)
97800 : {
97801 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
97802 : {
97803 : traversal.visit(&(objectArray[i][j]));
97804 : }
97805 : }
97806 : }
97807 : #else
97808 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
97809 : // compute the list first and then call the visit function on each list element.
97810 :
97811 : // printf ("Inside of SgOmpTeamsDistributeParallelForStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
97812 :
97813 14 : std::vector<SgOmpTeamsDistributeParallelForStatement*> nodeList;
97814 :
97815 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
97816 14 : for (unsigned int i=0; i < SgOmpTeamsDistributeParallelForStatement::pools.size(); i++)
97817 : {
97818 : // objectArray[i] is a single memory pool
97819 14007 : for (unsigned j=0; j < SgOmpTeamsDistributeParallelForStatement::pool_size; j++)
97820 : {
97821 14000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
97822 : {
97823 7 : nodeList.push_back(&(objectArray[i][j]));
97824 : }
97825 : }
97826 : }
97827 :
97828 : // Iterate over the saved list
97829 7 : size_t nodeListSize = nodeList.size();
97830 14 : for (size_t i=0; i < nodeListSize; i++)
97831 : {
97832 7 : ROSE_ASSERT(nodeList[i] != NULL);
97833 : #if 0
97834 : traversal.visit(nodeList[i]);
97835 : #else
97836 7 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
97837 : {
97838 7 : traversal.visit(nodeList[i]);
97839 : }
97840 : #endif
97841 : }
97842 : #endif
97843 : }
97844 :
97845 : // This should not be required since all previously static data members are
97846 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
97847 :
97848 5342 : }
97849 :
97850 :
97851 : void
97852 194 : SgOmpTeamsDistributeParallelForStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
97853 : {
97854 : // This function traverses the memory pool for an IR node and
97855 : // calls the function to execute the visitor object.
97856 :
97857 : // Initialize array to the address of the first element of the STL vector
97858 : // (which is guarenteed to be contiguous storage).
97859 : // SgOmpTeamsDistributeParallelForStatement objectArray [] = *(Memory_Block_List.begin());
97860 194 : if (SgOmpTeamsDistributeParallelForStatement::pools.empty() == false)
97861 : {
97862 : // Generate an array of memory pools
97863 0 : SgOmpTeamsDistributeParallelForStatement** objectArray = (SgOmpTeamsDistributeParallelForStatement**) &(SgOmpTeamsDistributeParallelForStatement::pools[0]);
97864 :
97865 : // Build a local variable for better performance
97866 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
97867 :
97868 : // Iterate over the memory pools
97869 0 : for (unsigned int i=0; i < SgOmpTeamsDistributeParallelForStatement::pools.size(); i++)
97870 : {
97871 : // objectArray[i] is a single memory pool
97872 0 : for (unsigned j=0; j < SgOmpTeamsDistributeParallelForStatement::pool_size; j++)
97873 : {
97874 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
97875 : {
97876 : // printf ("Found a valid SgOmpTeamsDistributeParallelForStatement object in the memory pool %d at position %d \n",i,j);
97877 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
97878 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
97879 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
97880 : }
97881 : else
97882 : {
97883 : // printf ("Found a INVALID SgOmpTeamsDistributeParallelForStatement object in the memory pool \n");
97884 : }
97885 : }
97886 : }
97887 : }
97888 :
97889 : // This should not be required since all previously static data members are
97890 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
97891 :
97892 194 : }
97893 :
97894 : void
97895 0 : SgOmpTeamsDistributeParallelForStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
97896 : {
97897 : // This function visits only a single IR node of the memory pool.
97898 : // it is typically called once for each type of IR node within
97899 : // the automatically generated function: traverseRepresentativeNodes().
97900 :
97901 : // Initialize array to the address of the first element of the STL vector
97902 : // (which is guarenteed to be contiguous storage).
97903 : // SgOmpTeamsDistributeParallelForStatement objectArray [] = *(Memory_Block_List.begin());
97904 0 : if (SgOmpTeamsDistributeParallelForStatement::pools.empty() == false)
97905 : {
97906 : // Generate an array of memory pools
97907 0 : SgOmpTeamsDistributeParallelForStatement** objectArray = (SgOmpTeamsDistributeParallelForStatement**) &(SgOmpTeamsDistributeParallelForStatement::pools[0]);
97908 :
97909 : // Build a local variable for better performance
97910 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
97911 :
97912 : // Iterate over the memory pools
97913 0 : bool done = false;
97914 0 : unsigned i=0;
97915 :
97916 : // find the first valid IR node, call visit function, and then leave
97917 0 : while ( done == false && i < SgOmpTeamsDistributeParallelForStatement::pools.size() )
97918 : {
97919 : // objectArray[i] is a single memory pool
97920 : unsigned j=0;
97921 0 : while (done == false && j < SgOmpTeamsDistributeParallelForStatement::pool_size)
97922 : {
97923 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
97924 : {
97925 0 : traversal.visit(&(objectArray[i][j]));
97926 0 : done = true;
97927 : }
97928 0 : j++;
97929 : }
97930 0 : i++;
97931 : }
97932 :
97933 : #if 0
97934 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
97935 : if (done == false)
97936 : {
97937 : printf ("No representative for SgOmpTeamsDistributeParallelForStatement found in memory pools \n");
97938 : }
97939 : #endif
97940 : }
97941 0 : }
97942 :
97943 :
97944 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
97945 : // using values that overflow signed values of int.
97946 : size_t
97947 4 : SgOmpTeamsDistributeParallelForStatement::numberOfNodes()
97948 : {
97949 : // This function traverses the memory pool for an IR node and
97950 : // counts the number of IR nodes of a particular Sage III IR
97951 : // nodes type.
97952 :
97953 4 : size_t count = 0;
97954 4 : if (SgOmpTeamsDistributeParallelForStatement::pools.empty() == false)
97955 : {
97956 : // Generate an array of memory pools (this is actually a STL vector,
97957 : // but it is contiguious, so OK to treat this way).
97958 0 : SgOmpTeamsDistributeParallelForStatement** objectArray = (SgOmpTeamsDistributeParallelForStatement**) &(SgOmpTeamsDistributeParallelForStatement::pools[0]);
97959 :
97960 : // Build a local variable for better performance (make it a loop invariant variable).
97961 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
97962 :
97963 : // Iterate over all of the memory pools for this IR node.
97964 0 : for (unsigned int i=0; i < SgOmpTeamsDistributeParallelForStatement::pools.size(); i++)
97965 : {
97966 : // objectArray[i] is a single memory pool, iterate over all the
97967 : // IR nodes and only count those that are valid IR nodes used in
97968 : // the AST (i.e. allocated IR nodes).
97969 0 : for (unsigned j=0; j < SgOmpTeamsDistributeParallelForStatement::pool_size; j++)
97970 : {
97971 : // This is indexing the STL vector of C/C++ style arrays as a doubly
97972 : // indexed array access. It is OK since we have leveraged the semantics
97973 : // of STL vector memory as contigous and cast the memory as an array
97974 : // of arrays to use the 2D array indexing. Hope this is not confusing,
97975 : // but it s very fast as an implementation.
97976 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
97977 : {
97978 0 : count++;
97979 : }
97980 : }
97981 : }
97982 : }
97983 :
97984 :
97985 :
97986 4 : return count;
97987 : }
97988 :
97989 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
97990 : // using values that overflow signed values of int.
97991 : size_t
97992 0 : SgOmpTeamsDistributeParallelForStatement::memoryUsage()
97993 : {
97994 : // This function is required because we need the class name as a type when we call sizeof
97995 : // There might be another way to implement this if we have a traversal that only called a
97996 : // representative object (one call for each type of Sage IIIIR node).
97997 0 : size_t memory = numberOfNodes() * sizeof(SgOmpTeamsDistributeParallelForStatement);
97998 :
97999 0 : return memory;
98000 : }
98001 :
98002 : /* #line 98003 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
98003 :
98004 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
98005 : void
98006 5342 : SgOmpTeamsDistributeParallelForSimdStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
98007 : {
98008 : // This function traverses the memory pool for only a specific IR node
98009 : // and calls the visit function of the input class execute a traversal
98010 : // similar to the style of the attribute based traversals within ROSE.
98011 : // This traversal will visit ALL nodes of the AST where as the other
98012 : // attribute based traversals visit only the embedded tree within the AST.
98013 :
98014 : // Initialize array to the address of the first element of the STL vector
98015 : // (which is guaranteed to be contiguous storage).
98016 : // SgOmpTeamsDistributeParallelForSimdStatement objectArray [] = *(Memory_Block_List.begin());
98017 5342 : if (SgOmpTeamsDistributeParallelForSimdStatement::pools.empty() == false)
98018 : {
98019 : // Generate an array of memory pools
98020 7 : SgOmpTeamsDistributeParallelForSimdStatement** objectArray = (SgOmpTeamsDistributeParallelForSimdStatement**) &(SgOmpTeamsDistributeParallelForSimdStatement::pools[0]);
98021 :
98022 : // Build a local variable for better performance
98023 7 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
98024 : #if 0
98025 : // Iterate over the memory pools
98026 : for (unsigned int i=0; i < SgOmpTeamsDistributeParallelForSimdStatement::pools.size(); i++)
98027 : {
98028 : // objectArray[i] is a single memory pool
98029 : for (int j=0; j < SgOmpTeamsDistributeParallelForSimdStatement::pool_size; j++)
98030 : {
98031 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
98032 : {
98033 : traversal.visit(&(objectArray[i][j]));
98034 : }
98035 : }
98036 : }
98037 : #else
98038 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
98039 : // compute the list first and then call the visit function on each list element.
98040 :
98041 : // printf ("Inside of SgOmpTeamsDistributeParallelForSimdStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
98042 :
98043 14 : std::vector<SgOmpTeamsDistributeParallelForSimdStatement*> nodeList;
98044 :
98045 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
98046 14 : for (unsigned int i=0; i < SgOmpTeamsDistributeParallelForSimdStatement::pools.size(); i++)
98047 : {
98048 : // objectArray[i] is a single memory pool
98049 14007 : for (unsigned j=0; j < SgOmpTeamsDistributeParallelForSimdStatement::pool_size; j++)
98050 : {
98051 14000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
98052 : {
98053 7 : nodeList.push_back(&(objectArray[i][j]));
98054 : }
98055 : }
98056 : }
98057 :
98058 : // Iterate over the saved list
98059 7 : size_t nodeListSize = nodeList.size();
98060 14 : for (size_t i=0; i < nodeListSize; i++)
98061 : {
98062 7 : ROSE_ASSERT(nodeList[i] != NULL);
98063 : #if 0
98064 : traversal.visit(nodeList[i]);
98065 : #else
98066 7 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
98067 : {
98068 7 : traversal.visit(nodeList[i]);
98069 : }
98070 : #endif
98071 : }
98072 : #endif
98073 : }
98074 :
98075 : // This should not be required since all previously static data members are
98076 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
98077 :
98078 5342 : }
98079 :
98080 :
98081 : void
98082 194 : SgOmpTeamsDistributeParallelForSimdStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
98083 : {
98084 : // This function traverses the memory pool for an IR node and
98085 : // calls the function to execute the visitor object.
98086 :
98087 : // Initialize array to the address of the first element of the STL vector
98088 : // (which is guarenteed to be contiguous storage).
98089 : // SgOmpTeamsDistributeParallelForSimdStatement objectArray [] = *(Memory_Block_List.begin());
98090 194 : if (SgOmpTeamsDistributeParallelForSimdStatement::pools.empty() == false)
98091 : {
98092 : // Generate an array of memory pools
98093 0 : SgOmpTeamsDistributeParallelForSimdStatement** objectArray = (SgOmpTeamsDistributeParallelForSimdStatement**) &(SgOmpTeamsDistributeParallelForSimdStatement::pools[0]);
98094 :
98095 : // Build a local variable for better performance
98096 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
98097 :
98098 : // Iterate over the memory pools
98099 0 : for (unsigned int i=0; i < SgOmpTeamsDistributeParallelForSimdStatement::pools.size(); i++)
98100 : {
98101 : // objectArray[i] is a single memory pool
98102 0 : for (unsigned j=0; j < SgOmpTeamsDistributeParallelForSimdStatement::pool_size; j++)
98103 : {
98104 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
98105 : {
98106 : // printf ("Found a valid SgOmpTeamsDistributeParallelForSimdStatement object in the memory pool %d at position %d \n",i,j);
98107 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
98108 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
98109 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
98110 : }
98111 : else
98112 : {
98113 : // printf ("Found a INVALID SgOmpTeamsDistributeParallelForSimdStatement object in the memory pool \n");
98114 : }
98115 : }
98116 : }
98117 : }
98118 :
98119 : // This should not be required since all previously static data members are
98120 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
98121 :
98122 194 : }
98123 :
98124 : void
98125 0 : SgOmpTeamsDistributeParallelForSimdStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
98126 : {
98127 : // This function visits only a single IR node of the memory pool.
98128 : // it is typically called once for each type of IR node within
98129 : // the automatically generated function: traverseRepresentativeNodes().
98130 :
98131 : // Initialize array to the address of the first element of the STL vector
98132 : // (which is guarenteed to be contiguous storage).
98133 : // SgOmpTeamsDistributeParallelForSimdStatement objectArray [] = *(Memory_Block_List.begin());
98134 0 : if (SgOmpTeamsDistributeParallelForSimdStatement::pools.empty() == false)
98135 : {
98136 : // Generate an array of memory pools
98137 0 : SgOmpTeamsDistributeParallelForSimdStatement** objectArray = (SgOmpTeamsDistributeParallelForSimdStatement**) &(SgOmpTeamsDistributeParallelForSimdStatement::pools[0]);
98138 :
98139 : // Build a local variable for better performance
98140 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
98141 :
98142 : // Iterate over the memory pools
98143 0 : bool done = false;
98144 0 : unsigned i=0;
98145 :
98146 : // find the first valid IR node, call visit function, and then leave
98147 0 : while ( done == false && i < SgOmpTeamsDistributeParallelForSimdStatement::pools.size() )
98148 : {
98149 : // objectArray[i] is a single memory pool
98150 : unsigned j=0;
98151 0 : while (done == false && j < SgOmpTeamsDistributeParallelForSimdStatement::pool_size)
98152 : {
98153 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
98154 : {
98155 0 : traversal.visit(&(objectArray[i][j]));
98156 0 : done = true;
98157 : }
98158 0 : j++;
98159 : }
98160 0 : i++;
98161 : }
98162 :
98163 : #if 0
98164 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
98165 : if (done == false)
98166 : {
98167 : printf ("No representative for SgOmpTeamsDistributeParallelForSimdStatement found in memory pools \n");
98168 : }
98169 : #endif
98170 : }
98171 0 : }
98172 :
98173 :
98174 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
98175 : // using values that overflow signed values of int.
98176 : size_t
98177 4 : SgOmpTeamsDistributeParallelForSimdStatement::numberOfNodes()
98178 : {
98179 : // This function traverses the memory pool for an IR node and
98180 : // counts the number of IR nodes of a particular Sage III IR
98181 : // nodes type.
98182 :
98183 4 : size_t count = 0;
98184 4 : if (SgOmpTeamsDistributeParallelForSimdStatement::pools.empty() == false)
98185 : {
98186 : // Generate an array of memory pools (this is actually a STL vector,
98187 : // but it is contiguious, so OK to treat this way).
98188 0 : SgOmpTeamsDistributeParallelForSimdStatement** objectArray = (SgOmpTeamsDistributeParallelForSimdStatement**) &(SgOmpTeamsDistributeParallelForSimdStatement::pools[0]);
98189 :
98190 : // Build a local variable for better performance (make it a loop invariant variable).
98191 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
98192 :
98193 : // Iterate over all of the memory pools for this IR node.
98194 0 : for (unsigned int i=0; i < SgOmpTeamsDistributeParallelForSimdStatement::pools.size(); i++)
98195 : {
98196 : // objectArray[i] is a single memory pool, iterate over all the
98197 : // IR nodes and only count those that are valid IR nodes used in
98198 : // the AST (i.e. allocated IR nodes).
98199 0 : for (unsigned j=0; j < SgOmpTeamsDistributeParallelForSimdStatement::pool_size; j++)
98200 : {
98201 : // This is indexing the STL vector of C/C++ style arrays as a doubly
98202 : // indexed array access. It is OK since we have leveraged the semantics
98203 : // of STL vector memory as contigous and cast the memory as an array
98204 : // of arrays to use the 2D array indexing. Hope this is not confusing,
98205 : // but it s very fast as an implementation.
98206 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
98207 : {
98208 0 : count++;
98209 : }
98210 : }
98211 : }
98212 : }
98213 :
98214 :
98215 :
98216 4 : return count;
98217 : }
98218 :
98219 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
98220 : // using values that overflow signed values of int.
98221 : size_t
98222 0 : SgOmpTeamsDistributeParallelForSimdStatement::memoryUsage()
98223 : {
98224 : // This function is required because we need the class name as a type when we call sizeof
98225 : // There might be another way to implement this if we have a traversal that only called a
98226 : // representative object (one call for each type of Sage IIIIR node).
98227 0 : size_t memory = numberOfNodes() * sizeof(SgOmpTeamsDistributeParallelForSimdStatement);
98228 :
98229 0 : return memory;
98230 : }
98231 :
98232 : /* #line 98233 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
98233 :
98234 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
98235 : void
98236 5342 : SgOmpTeamsLoopStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
98237 : {
98238 : // This function traverses the memory pool for only a specific IR node
98239 : // and calls the visit function of the input class execute a traversal
98240 : // similar to the style of the attribute based traversals within ROSE.
98241 : // This traversal will visit ALL nodes of the AST where as the other
98242 : // attribute based traversals visit only the embedded tree within the AST.
98243 :
98244 : // Initialize array to the address of the first element of the STL vector
98245 : // (which is guaranteed to be contiguous storage).
98246 : // SgOmpTeamsLoopStatement objectArray [] = *(Memory_Block_List.begin());
98247 5342 : if (SgOmpTeamsLoopStatement::pools.empty() == false)
98248 : {
98249 : // Generate an array of memory pools
98250 7 : SgOmpTeamsLoopStatement** objectArray = (SgOmpTeamsLoopStatement**) &(SgOmpTeamsLoopStatement::pools[0]);
98251 :
98252 : // Build a local variable for better performance
98253 7 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
98254 : #if 0
98255 : // Iterate over the memory pools
98256 : for (unsigned int i=0; i < SgOmpTeamsLoopStatement::pools.size(); i++)
98257 : {
98258 : // objectArray[i] is a single memory pool
98259 : for (int j=0; j < SgOmpTeamsLoopStatement::pool_size; j++)
98260 : {
98261 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
98262 : {
98263 : traversal.visit(&(objectArray[i][j]));
98264 : }
98265 : }
98266 : }
98267 : #else
98268 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
98269 : // compute the list first and then call the visit function on each list element.
98270 :
98271 : // printf ("Inside of SgOmpTeamsLoopStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
98272 :
98273 14 : std::vector<SgOmpTeamsLoopStatement*> nodeList;
98274 :
98275 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
98276 14 : for (unsigned int i=0; i < SgOmpTeamsLoopStatement::pools.size(); i++)
98277 : {
98278 : // objectArray[i] is a single memory pool
98279 14007 : for (unsigned j=0; j < SgOmpTeamsLoopStatement::pool_size; j++)
98280 : {
98281 14000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
98282 : {
98283 7 : nodeList.push_back(&(objectArray[i][j]));
98284 : }
98285 : }
98286 : }
98287 :
98288 : // Iterate over the saved list
98289 7 : size_t nodeListSize = nodeList.size();
98290 14 : for (size_t i=0; i < nodeListSize; i++)
98291 : {
98292 7 : ROSE_ASSERT(nodeList[i] != NULL);
98293 : #if 0
98294 : traversal.visit(nodeList[i]);
98295 : #else
98296 7 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
98297 : {
98298 7 : traversal.visit(nodeList[i]);
98299 : }
98300 : #endif
98301 : }
98302 : #endif
98303 : }
98304 :
98305 : // This should not be required since all previously static data members are
98306 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
98307 :
98308 5342 : }
98309 :
98310 :
98311 : void
98312 194 : SgOmpTeamsLoopStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
98313 : {
98314 : // This function traverses the memory pool for an IR node and
98315 : // calls the function to execute the visitor object.
98316 :
98317 : // Initialize array to the address of the first element of the STL vector
98318 : // (which is guarenteed to be contiguous storage).
98319 : // SgOmpTeamsLoopStatement objectArray [] = *(Memory_Block_List.begin());
98320 194 : if (SgOmpTeamsLoopStatement::pools.empty() == false)
98321 : {
98322 : // Generate an array of memory pools
98323 0 : SgOmpTeamsLoopStatement** objectArray = (SgOmpTeamsLoopStatement**) &(SgOmpTeamsLoopStatement::pools[0]);
98324 :
98325 : // Build a local variable for better performance
98326 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
98327 :
98328 : // Iterate over the memory pools
98329 0 : for (unsigned int i=0; i < SgOmpTeamsLoopStatement::pools.size(); i++)
98330 : {
98331 : // objectArray[i] is a single memory pool
98332 0 : for (unsigned j=0; j < SgOmpTeamsLoopStatement::pool_size; j++)
98333 : {
98334 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
98335 : {
98336 : // printf ("Found a valid SgOmpTeamsLoopStatement object in the memory pool %d at position %d \n",i,j);
98337 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
98338 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
98339 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
98340 : }
98341 : else
98342 : {
98343 : // printf ("Found a INVALID SgOmpTeamsLoopStatement object in the memory pool \n");
98344 : }
98345 : }
98346 : }
98347 : }
98348 :
98349 : // This should not be required since all previously static data members are
98350 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
98351 :
98352 194 : }
98353 :
98354 : void
98355 0 : SgOmpTeamsLoopStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
98356 : {
98357 : // This function visits only a single IR node of the memory pool.
98358 : // it is typically called once for each type of IR node within
98359 : // the automatically generated function: traverseRepresentativeNodes().
98360 :
98361 : // Initialize array to the address of the first element of the STL vector
98362 : // (which is guarenteed to be contiguous storage).
98363 : // SgOmpTeamsLoopStatement objectArray [] = *(Memory_Block_List.begin());
98364 0 : if (SgOmpTeamsLoopStatement::pools.empty() == false)
98365 : {
98366 : // Generate an array of memory pools
98367 0 : SgOmpTeamsLoopStatement** objectArray = (SgOmpTeamsLoopStatement**) &(SgOmpTeamsLoopStatement::pools[0]);
98368 :
98369 : // Build a local variable for better performance
98370 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
98371 :
98372 : // Iterate over the memory pools
98373 0 : bool done = false;
98374 0 : unsigned i=0;
98375 :
98376 : // find the first valid IR node, call visit function, and then leave
98377 0 : while ( done == false && i < SgOmpTeamsLoopStatement::pools.size() )
98378 : {
98379 : // objectArray[i] is a single memory pool
98380 : unsigned j=0;
98381 0 : while (done == false && j < SgOmpTeamsLoopStatement::pool_size)
98382 : {
98383 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
98384 : {
98385 0 : traversal.visit(&(objectArray[i][j]));
98386 0 : done = true;
98387 : }
98388 0 : j++;
98389 : }
98390 0 : i++;
98391 : }
98392 :
98393 : #if 0
98394 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
98395 : if (done == false)
98396 : {
98397 : printf ("No representative for SgOmpTeamsLoopStatement found in memory pools \n");
98398 : }
98399 : #endif
98400 : }
98401 0 : }
98402 :
98403 :
98404 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
98405 : // using values that overflow signed values of int.
98406 : size_t
98407 4 : SgOmpTeamsLoopStatement::numberOfNodes()
98408 : {
98409 : // This function traverses the memory pool for an IR node and
98410 : // counts the number of IR nodes of a particular Sage III IR
98411 : // nodes type.
98412 :
98413 4 : size_t count = 0;
98414 4 : if (SgOmpTeamsLoopStatement::pools.empty() == false)
98415 : {
98416 : // Generate an array of memory pools (this is actually a STL vector,
98417 : // but it is contiguious, so OK to treat this way).
98418 0 : SgOmpTeamsLoopStatement** objectArray = (SgOmpTeamsLoopStatement**) &(SgOmpTeamsLoopStatement::pools[0]);
98419 :
98420 : // Build a local variable for better performance (make it a loop invariant variable).
98421 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
98422 :
98423 : // Iterate over all of the memory pools for this IR node.
98424 0 : for (unsigned int i=0; i < SgOmpTeamsLoopStatement::pools.size(); i++)
98425 : {
98426 : // objectArray[i] is a single memory pool, iterate over all the
98427 : // IR nodes and only count those that are valid IR nodes used in
98428 : // the AST (i.e. allocated IR nodes).
98429 0 : for (unsigned j=0; j < SgOmpTeamsLoopStatement::pool_size; j++)
98430 : {
98431 : // This is indexing the STL vector of C/C++ style arrays as a doubly
98432 : // indexed array access. It is OK since we have leveraged the semantics
98433 : // of STL vector memory as contigous and cast the memory as an array
98434 : // of arrays to use the 2D array indexing. Hope this is not confusing,
98435 : // but it s very fast as an implementation.
98436 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
98437 : {
98438 0 : count++;
98439 : }
98440 : }
98441 : }
98442 : }
98443 :
98444 :
98445 :
98446 4 : return count;
98447 : }
98448 :
98449 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
98450 : // using values that overflow signed values of int.
98451 : size_t
98452 0 : SgOmpTeamsLoopStatement::memoryUsage()
98453 : {
98454 : // This function is required because we need the class name as a type when we call sizeof
98455 : // There might be another way to implement this if we have a traversal that only called a
98456 : // representative object (one call for each type of Sage IIIIR node).
98457 0 : size_t memory = numberOfNodes() * sizeof(SgOmpTeamsLoopStatement);
98458 :
98459 0 : return memory;
98460 : }
98461 :
98462 : /* #line 98463 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
98463 :
98464 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
98465 : void
98466 5342 : SgOmpForSimdStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
98467 : {
98468 : // This function traverses the memory pool for only a specific IR node
98469 : // and calls the visit function of the input class execute a traversal
98470 : // similar to the style of the attribute based traversals within ROSE.
98471 : // This traversal will visit ALL nodes of the AST where as the other
98472 : // attribute based traversals visit only the embedded tree within the AST.
98473 :
98474 : // Initialize array to the address of the first element of the STL vector
98475 : // (which is guaranteed to be contiguous storage).
98476 : // SgOmpForSimdStatement objectArray [] = *(Memory_Block_List.begin());
98477 5342 : if (SgOmpForSimdStatement::pools.empty() == false)
98478 : {
98479 : // Generate an array of memory pools
98480 7 : SgOmpForSimdStatement** objectArray = (SgOmpForSimdStatement**) &(SgOmpForSimdStatement::pools[0]);
98481 :
98482 : // Build a local variable for better performance
98483 7 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
98484 : #if 0
98485 : // Iterate over the memory pools
98486 : for (unsigned int i=0; i < SgOmpForSimdStatement::pools.size(); i++)
98487 : {
98488 : // objectArray[i] is a single memory pool
98489 : for (int j=0; j < SgOmpForSimdStatement::pool_size; j++)
98490 : {
98491 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
98492 : {
98493 : traversal.visit(&(objectArray[i][j]));
98494 : }
98495 : }
98496 : }
98497 : #else
98498 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
98499 : // compute the list first and then call the visit function on each list element.
98500 :
98501 : // printf ("Inside of SgOmpForSimdStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
98502 :
98503 14 : std::vector<SgOmpForSimdStatement*> nodeList;
98504 :
98505 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
98506 14 : for (unsigned int i=0; i < SgOmpForSimdStatement::pools.size(); i++)
98507 : {
98508 : // objectArray[i] is a single memory pool
98509 14007 : for (unsigned j=0; j < SgOmpForSimdStatement::pool_size; j++)
98510 : {
98511 14000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
98512 : {
98513 7 : nodeList.push_back(&(objectArray[i][j]));
98514 : }
98515 : }
98516 : }
98517 :
98518 : // Iterate over the saved list
98519 7 : size_t nodeListSize = nodeList.size();
98520 14 : for (size_t i=0; i < nodeListSize; i++)
98521 : {
98522 7 : ROSE_ASSERT(nodeList[i] != NULL);
98523 : #if 0
98524 : traversal.visit(nodeList[i]);
98525 : #else
98526 7 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
98527 : {
98528 7 : traversal.visit(nodeList[i]);
98529 : }
98530 : #endif
98531 : }
98532 : #endif
98533 : }
98534 :
98535 : // This should not be required since all previously static data members are
98536 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
98537 :
98538 5342 : }
98539 :
98540 :
98541 : void
98542 194 : SgOmpForSimdStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
98543 : {
98544 : // This function traverses the memory pool for an IR node and
98545 : // calls the function to execute the visitor object.
98546 :
98547 : // Initialize array to the address of the first element of the STL vector
98548 : // (which is guarenteed to be contiguous storage).
98549 : // SgOmpForSimdStatement objectArray [] = *(Memory_Block_List.begin());
98550 194 : if (SgOmpForSimdStatement::pools.empty() == false)
98551 : {
98552 : // Generate an array of memory pools
98553 0 : SgOmpForSimdStatement** objectArray = (SgOmpForSimdStatement**) &(SgOmpForSimdStatement::pools[0]);
98554 :
98555 : // Build a local variable for better performance
98556 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
98557 :
98558 : // Iterate over the memory pools
98559 0 : for (unsigned int i=0; i < SgOmpForSimdStatement::pools.size(); i++)
98560 : {
98561 : // objectArray[i] is a single memory pool
98562 0 : for (unsigned j=0; j < SgOmpForSimdStatement::pool_size; j++)
98563 : {
98564 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
98565 : {
98566 : // printf ("Found a valid SgOmpForSimdStatement object in the memory pool %d at position %d \n",i,j);
98567 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
98568 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
98569 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
98570 : }
98571 : else
98572 : {
98573 : // printf ("Found a INVALID SgOmpForSimdStatement object in the memory pool \n");
98574 : }
98575 : }
98576 : }
98577 : }
98578 :
98579 : // This should not be required since all previously static data members are
98580 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
98581 :
98582 194 : }
98583 :
98584 : void
98585 0 : SgOmpForSimdStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
98586 : {
98587 : // This function visits only a single IR node of the memory pool.
98588 : // it is typically called once for each type of IR node within
98589 : // the automatically generated function: traverseRepresentativeNodes().
98590 :
98591 : // Initialize array to the address of the first element of the STL vector
98592 : // (which is guarenteed to be contiguous storage).
98593 : // SgOmpForSimdStatement objectArray [] = *(Memory_Block_List.begin());
98594 0 : if (SgOmpForSimdStatement::pools.empty() == false)
98595 : {
98596 : // Generate an array of memory pools
98597 0 : SgOmpForSimdStatement** objectArray = (SgOmpForSimdStatement**) &(SgOmpForSimdStatement::pools[0]);
98598 :
98599 : // Build a local variable for better performance
98600 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
98601 :
98602 : // Iterate over the memory pools
98603 0 : bool done = false;
98604 0 : unsigned i=0;
98605 :
98606 : // find the first valid IR node, call visit function, and then leave
98607 0 : while ( done == false && i < SgOmpForSimdStatement::pools.size() )
98608 : {
98609 : // objectArray[i] is a single memory pool
98610 : unsigned j=0;
98611 0 : while (done == false && j < SgOmpForSimdStatement::pool_size)
98612 : {
98613 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
98614 : {
98615 0 : traversal.visit(&(objectArray[i][j]));
98616 0 : done = true;
98617 : }
98618 0 : j++;
98619 : }
98620 0 : i++;
98621 : }
98622 :
98623 : #if 0
98624 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
98625 : if (done == false)
98626 : {
98627 : printf ("No representative for SgOmpForSimdStatement found in memory pools \n");
98628 : }
98629 : #endif
98630 : }
98631 0 : }
98632 :
98633 :
98634 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
98635 : // using values that overflow signed values of int.
98636 : size_t
98637 4 : SgOmpForSimdStatement::numberOfNodes()
98638 : {
98639 : // This function traverses the memory pool for an IR node and
98640 : // counts the number of IR nodes of a particular Sage III IR
98641 : // nodes type.
98642 :
98643 4 : size_t count = 0;
98644 4 : if (SgOmpForSimdStatement::pools.empty() == false)
98645 : {
98646 : // Generate an array of memory pools (this is actually a STL vector,
98647 : // but it is contiguious, so OK to treat this way).
98648 0 : SgOmpForSimdStatement** objectArray = (SgOmpForSimdStatement**) &(SgOmpForSimdStatement::pools[0]);
98649 :
98650 : // Build a local variable for better performance (make it a loop invariant variable).
98651 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
98652 :
98653 : // Iterate over all of the memory pools for this IR node.
98654 0 : for (unsigned int i=0; i < SgOmpForSimdStatement::pools.size(); i++)
98655 : {
98656 : // objectArray[i] is a single memory pool, iterate over all the
98657 : // IR nodes and only count those that are valid IR nodes used in
98658 : // the AST (i.e. allocated IR nodes).
98659 0 : for (unsigned j=0; j < SgOmpForSimdStatement::pool_size; j++)
98660 : {
98661 : // This is indexing the STL vector of C/C++ style arrays as a doubly
98662 : // indexed array access. It is OK since we have leveraged the semantics
98663 : // of STL vector memory as contigous and cast the memory as an array
98664 : // of arrays to use the 2D array indexing. Hope this is not confusing,
98665 : // but it s very fast as an implementation.
98666 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
98667 : {
98668 0 : count++;
98669 : }
98670 : }
98671 : }
98672 : }
98673 :
98674 :
98675 :
98676 4 : return count;
98677 : }
98678 :
98679 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
98680 : // using values that overflow signed values of int.
98681 : size_t
98682 0 : SgOmpForSimdStatement::memoryUsage()
98683 : {
98684 : // This function is required because we need the class name as a type when we call sizeof
98685 : // There might be another way to implement this if we have a traversal that only called a
98686 : // representative object (one call for each type of Sage IIIIR node).
98687 0 : size_t memory = numberOfNodes() * sizeof(SgOmpForSimdStatement);
98688 :
98689 0 : return memory;
98690 : }
98691 :
98692 : /* #line 98693 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
98693 :
98694 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
98695 : void
98696 5342 : SgOmpCriticalStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
98697 : {
98698 : // This function traverses the memory pool for only a specific IR node
98699 : // and calls the visit function of the input class execute a traversal
98700 : // similar to the style of the attribute based traversals within ROSE.
98701 : // This traversal will visit ALL nodes of the AST where as the other
98702 : // attribute based traversals visit only the embedded tree within the AST.
98703 :
98704 : // Initialize array to the address of the first element of the STL vector
98705 : // (which is guaranteed to be contiguous storage).
98706 : // SgOmpCriticalStatement objectArray [] = *(Memory_Block_List.begin());
98707 5342 : if (SgOmpCriticalStatement::pools.empty() == false)
98708 : {
98709 : // Generate an array of memory pools
98710 210 : SgOmpCriticalStatement** objectArray = (SgOmpCriticalStatement**) &(SgOmpCriticalStatement::pools[0]);
98711 :
98712 : // Build a local variable for better performance
98713 210 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
98714 : #if 0
98715 : // Iterate over the memory pools
98716 : for (unsigned int i=0; i < SgOmpCriticalStatement::pools.size(); i++)
98717 : {
98718 : // objectArray[i] is a single memory pool
98719 : for (int j=0; j < SgOmpCriticalStatement::pool_size; j++)
98720 : {
98721 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
98722 : {
98723 : traversal.visit(&(objectArray[i][j]));
98724 : }
98725 : }
98726 : }
98727 : #else
98728 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
98729 : // compute the list first and then call the visit function on each list element.
98730 :
98731 : // printf ("Inside of SgOmpCriticalStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
98732 :
98733 420 : std::vector<SgOmpCriticalStatement*> nodeList;
98734 :
98735 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
98736 420 : for (unsigned int i=0; i < SgOmpCriticalStatement::pools.size(); i++)
98737 : {
98738 : // objectArray[i] is a single memory pool
98739 420210 : for (unsigned j=0; j < SgOmpCriticalStatement::pool_size; j++)
98740 : {
98741 420000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
98742 : {
98743 427 : nodeList.push_back(&(objectArray[i][j]));
98744 : }
98745 : }
98746 : }
98747 :
98748 : // Iterate over the saved list
98749 210 : size_t nodeListSize = nodeList.size();
98750 637 : for (size_t i=0; i < nodeListSize; i++)
98751 : {
98752 427 : ROSE_ASSERT(nodeList[i] != NULL);
98753 : #if 0
98754 : traversal.visit(nodeList[i]);
98755 : #else
98756 427 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
98757 : {
98758 427 : traversal.visit(nodeList[i]);
98759 : }
98760 : #endif
98761 : }
98762 : #endif
98763 : }
98764 :
98765 : // This should not be required since all previously static data members are
98766 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
98767 :
98768 5342 : }
98769 :
98770 :
98771 : void
98772 194 : SgOmpCriticalStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
98773 : {
98774 : // This function traverses the memory pool for an IR node and
98775 : // calls the function to execute the visitor object.
98776 :
98777 : // Initialize array to the address of the first element of the STL vector
98778 : // (which is guarenteed to be contiguous storage).
98779 : // SgOmpCriticalStatement objectArray [] = *(Memory_Block_List.begin());
98780 194 : if (SgOmpCriticalStatement::pools.empty() == false)
98781 : {
98782 : // Generate an array of memory pools
98783 0 : SgOmpCriticalStatement** objectArray = (SgOmpCriticalStatement**) &(SgOmpCriticalStatement::pools[0]);
98784 :
98785 : // Build a local variable for better performance
98786 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
98787 :
98788 : // Iterate over the memory pools
98789 0 : for (unsigned int i=0; i < SgOmpCriticalStatement::pools.size(); i++)
98790 : {
98791 : // objectArray[i] is a single memory pool
98792 0 : for (unsigned j=0; j < SgOmpCriticalStatement::pool_size; j++)
98793 : {
98794 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
98795 : {
98796 : // printf ("Found a valid SgOmpCriticalStatement object in the memory pool %d at position %d \n",i,j);
98797 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
98798 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
98799 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
98800 : }
98801 : else
98802 : {
98803 : // printf ("Found a INVALID SgOmpCriticalStatement object in the memory pool \n");
98804 : }
98805 : }
98806 : }
98807 : }
98808 :
98809 : // This should not be required since all previously static data members are
98810 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
98811 :
98812 194 : }
98813 :
98814 : void
98815 0 : SgOmpCriticalStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
98816 : {
98817 : // This function visits only a single IR node of the memory pool.
98818 : // it is typically called once for each type of IR node within
98819 : // the automatically generated function: traverseRepresentativeNodes().
98820 :
98821 : // Initialize array to the address of the first element of the STL vector
98822 : // (which is guarenteed to be contiguous storage).
98823 : // SgOmpCriticalStatement objectArray [] = *(Memory_Block_List.begin());
98824 0 : if (SgOmpCriticalStatement::pools.empty() == false)
98825 : {
98826 : // Generate an array of memory pools
98827 0 : SgOmpCriticalStatement** objectArray = (SgOmpCriticalStatement**) &(SgOmpCriticalStatement::pools[0]);
98828 :
98829 : // Build a local variable for better performance
98830 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
98831 :
98832 : // Iterate over the memory pools
98833 0 : bool done = false;
98834 0 : unsigned i=0;
98835 :
98836 : // find the first valid IR node, call visit function, and then leave
98837 0 : while ( done == false && i < SgOmpCriticalStatement::pools.size() )
98838 : {
98839 : // objectArray[i] is a single memory pool
98840 : unsigned j=0;
98841 0 : while (done == false && j < SgOmpCriticalStatement::pool_size)
98842 : {
98843 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
98844 : {
98845 0 : traversal.visit(&(objectArray[i][j]));
98846 0 : done = true;
98847 : }
98848 0 : j++;
98849 : }
98850 0 : i++;
98851 : }
98852 :
98853 : #if 0
98854 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
98855 : if (done == false)
98856 : {
98857 : printf ("No representative for SgOmpCriticalStatement found in memory pools \n");
98858 : }
98859 : #endif
98860 : }
98861 0 : }
98862 :
98863 :
98864 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
98865 : // using values that overflow signed values of int.
98866 : size_t
98867 4 : SgOmpCriticalStatement::numberOfNodes()
98868 : {
98869 : // This function traverses the memory pool for an IR node and
98870 : // counts the number of IR nodes of a particular Sage III IR
98871 : // nodes type.
98872 :
98873 4 : size_t count = 0;
98874 4 : if (SgOmpCriticalStatement::pools.empty() == false)
98875 : {
98876 : // Generate an array of memory pools (this is actually a STL vector,
98877 : // but it is contiguious, so OK to treat this way).
98878 0 : SgOmpCriticalStatement** objectArray = (SgOmpCriticalStatement**) &(SgOmpCriticalStatement::pools[0]);
98879 :
98880 : // Build a local variable for better performance (make it a loop invariant variable).
98881 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
98882 :
98883 : // Iterate over all of the memory pools for this IR node.
98884 0 : for (unsigned int i=0; i < SgOmpCriticalStatement::pools.size(); i++)
98885 : {
98886 : // objectArray[i] is a single memory pool, iterate over all the
98887 : // IR nodes and only count those that are valid IR nodes used in
98888 : // the AST (i.e. allocated IR nodes).
98889 0 : for (unsigned j=0; j < SgOmpCriticalStatement::pool_size; j++)
98890 : {
98891 : // This is indexing the STL vector of C/C++ style arrays as a doubly
98892 : // indexed array access. It is OK since we have leveraged the semantics
98893 : // of STL vector memory as contigous and cast the memory as an array
98894 : // of arrays to use the 2D array indexing. Hope this is not confusing,
98895 : // but it s very fast as an implementation.
98896 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
98897 : {
98898 0 : count++;
98899 : }
98900 : }
98901 : }
98902 : }
98903 :
98904 :
98905 :
98906 4 : return count;
98907 : }
98908 :
98909 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
98910 : // using values that overflow signed values of int.
98911 : size_t
98912 0 : SgOmpCriticalStatement::memoryUsage()
98913 : {
98914 : // This function is required because we need the class name as a type when we call sizeof
98915 : // There might be another way to implement this if we have a traversal that only called a
98916 : // representative object (one call for each type of Sage IIIIR node).
98917 0 : size_t memory = numberOfNodes() * sizeof(SgOmpCriticalStatement);
98918 :
98919 0 : return memory;
98920 : }
98921 :
98922 : /* #line 98923 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
98923 :
98924 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
98925 : void
98926 5342 : SgOmpDistributeStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
98927 : {
98928 : // This function traverses the memory pool for only a specific IR node
98929 : // and calls the visit function of the input class execute a traversal
98930 : // similar to the style of the attribute based traversals within ROSE.
98931 : // This traversal will visit ALL nodes of the AST where as the other
98932 : // attribute based traversals visit only the embedded tree within the AST.
98933 :
98934 : // Initialize array to the address of the first element of the STL vector
98935 : // (which is guaranteed to be contiguous storage).
98936 : // SgOmpDistributeStatement objectArray [] = *(Memory_Block_List.begin());
98937 5342 : if (SgOmpDistributeStatement::pools.empty() == false)
98938 : {
98939 : // Generate an array of memory pools
98940 14 : SgOmpDistributeStatement** objectArray = (SgOmpDistributeStatement**) &(SgOmpDistributeStatement::pools[0]);
98941 :
98942 : // Build a local variable for better performance
98943 14 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
98944 : #if 0
98945 : // Iterate over the memory pools
98946 : for (unsigned int i=0; i < SgOmpDistributeStatement::pools.size(); i++)
98947 : {
98948 : // objectArray[i] is a single memory pool
98949 : for (int j=0; j < SgOmpDistributeStatement::pool_size; j++)
98950 : {
98951 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
98952 : {
98953 : traversal.visit(&(objectArray[i][j]));
98954 : }
98955 : }
98956 : }
98957 : #else
98958 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
98959 : // compute the list first and then call the visit function on each list element.
98960 :
98961 : // printf ("Inside of SgOmpDistributeStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
98962 :
98963 28 : std::vector<SgOmpDistributeStatement*> nodeList;
98964 :
98965 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
98966 28 : for (unsigned int i=0; i < SgOmpDistributeStatement::pools.size(); i++)
98967 : {
98968 : // objectArray[i] is a single memory pool
98969 28014 : for (unsigned j=0; j < SgOmpDistributeStatement::pool_size; j++)
98970 : {
98971 28000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
98972 : {
98973 14 : nodeList.push_back(&(objectArray[i][j]));
98974 : }
98975 : }
98976 : }
98977 :
98978 : // Iterate over the saved list
98979 14 : size_t nodeListSize = nodeList.size();
98980 28 : for (size_t i=0; i < nodeListSize; i++)
98981 : {
98982 14 : ROSE_ASSERT(nodeList[i] != NULL);
98983 : #if 0
98984 : traversal.visit(nodeList[i]);
98985 : #else
98986 14 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
98987 : {
98988 14 : traversal.visit(nodeList[i]);
98989 : }
98990 : #endif
98991 : }
98992 : #endif
98993 : }
98994 :
98995 : // This should not be required since all previously static data members are
98996 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
98997 :
98998 5342 : }
98999 :
99000 :
99001 : void
99002 194 : SgOmpDistributeStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
99003 : {
99004 : // This function traverses the memory pool for an IR node and
99005 : // calls the function to execute the visitor object.
99006 :
99007 : // Initialize array to the address of the first element of the STL vector
99008 : // (which is guarenteed to be contiguous storage).
99009 : // SgOmpDistributeStatement objectArray [] = *(Memory_Block_List.begin());
99010 194 : if (SgOmpDistributeStatement::pools.empty() == false)
99011 : {
99012 : // Generate an array of memory pools
99013 0 : SgOmpDistributeStatement** objectArray = (SgOmpDistributeStatement**) &(SgOmpDistributeStatement::pools[0]);
99014 :
99015 : // Build a local variable for better performance
99016 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
99017 :
99018 : // Iterate over the memory pools
99019 0 : for (unsigned int i=0; i < SgOmpDistributeStatement::pools.size(); i++)
99020 : {
99021 : // objectArray[i] is a single memory pool
99022 0 : for (unsigned j=0; j < SgOmpDistributeStatement::pool_size; j++)
99023 : {
99024 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
99025 : {
99026 : // printf ("Found a valid SgOmpDistributeStatement object in the memory pool %d at position %d \n",i,j);
99027 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
99028 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
99029 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
99030 : }
99031 : else
99032 : {
99033 : // printf ("Found a INVALID SgOmpDistributeStatement object in the memory pool \n");
99034 : }
99035 : }
99036 : }
99037 : }
99038 :
99039 : // This should not be required since all previously static data members are
99040 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
99041 :
99042 194 : }
99043 :
99044 : void
99045 0 : SgOmpDistributeStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
99046 : {
99047 : // This function visits only a single IR node of the memory pool.
99048 : // it is typically called once for each type of IR node within
99049 : // the automatically generated function: traverseRepresentativeNodes().
99050 :
99051 : // Initialize array to the address of the first element of the STL vector
99052 : // (which is guarenteed to be contiguous storage).
99053 : // SgOmpDistributeStatement objectArray [] = *(Memory_Block_List.begin());
99054 0 : if (SgOmpDistributeStatement::pools.empty() == false)
99055 : {
99056 : // Generate an array of memory pools
99057 0 : SgOmpDistributeStatement** objectArray = (SgOmpDistributeStatement**) &(SgOmpDistributeStatement::pools[0]);
99058 :
99059 : // Build a local variable for better performance
99060 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
99061 :
99062 : // Iterate over the memory pools
99063 0 : bool done = false;
99064 0 : unsigned i=0;
99065 :
99066 : // find the first valid IR node, call visit function, and then leave
99067 0 : while ( done == false && i < SgOmpDistributeStatement::pools.size() )
99068 : {
99069 : // objectArray[i] is a single memory pool
99070 : unsigned j=0;
99071 0 : while (done == false && j < SgOmpDistributeStatement::pool_size)
99072 : {
99073 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
99074 : {
99075 0 : traversal.visit(&(objectArray[i][j]));
99076 0 : done = true;
99077 : }
99078 0 : j++;
99079 : }
99080 0 : i++;
99081 : }
99082 :
99083 : #if 0
99084 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
99085 : if (done == false)
99086 : {
99087 : printf ("No representative for SgOmpDistributeStatement found in memory pools \n");
99088 : }
99089 : #endif
99090 : }
99091 0 : }
99092 :
99093 :
99094 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
99095 : // using values that overflow signed values of int.
99096 : size_t
99097 4 : SgOmpDistributeStatement::numberOfNodes()
99098 : {
99099 : // This function traverses the memory pool for an IR node and
99100 : // counts the number of IR nodes of a particular Sage III IR
99101 : // nodes type.
99102 :
99103 4 : size_t count = 0;
99104 4 : if (SgOmpDistributeStatement::pools.empty() == false)
99105 : {
99106 : // Generate an array of memory pools (this is actually a STL vector,
99107 : // but it is contiguious, so OK to treat this way).
99108 0 : SgOmpDistributeStatement** objectArray = (SgOmpDistributeStatement**) &(SgOmpDistributeStatement::pools[0]);
99109 :
99110 : // Build a local variable for better performance (make it a loop invariant variable).
99111 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
99112 :
99113 : // Iterate over all of the memory pools for this IR node.
99114 0 : for (unsigned int i=0; i < SgOmpDistributeStatement::pools.size(); i++)
99115 : {
99116 : // objectArray[i] is a single memory pool, iterate over all the
99117 : // IR nodes and only count those that are valid IR nodes used in
99118 : // the AST (i.e. allocated IR nodes).
99119 0 : for (unsigned j=0; j < SgOmpDistributeStatement::pool_size; j++)
99120 : {
99121 : // This is indexing the STL vector of C/C++ style arrays as a doubly
99122 : // indexed array access. It is OK since we have leveraged the semantics
99123 : // of STL vector memory as contigous and cast the memory as an array
99124 : // of arrays to use the 2D array indexing. Hope this is not confusing,
99125 : // but it s very fast as an implementation.
99126 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
99127 : {
99128 0 : count++;
99129 : }
99130 : }
99131 : }
99132 : }
99133 :
99134 :
99135 :
99136 4 : return count;
99137 : }
99138 :
99139 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
99140 : // using values that overflow signed values of int.
99141 : size_t
99142 0 : SgOmpDistributeStatement::memoryUsage()
99143 : {
99144 : // This function is required because we need the class name as a type when we call sizeof
99145 : // There might be another way to implement this if we have a traversal that only called a
99146 : // representative object (one call for each type of Sage IIIIR node).
99147 0 : size_t memory = numberOfNodes() * sizeof(SgOmpDistributeStatement);
99148 :
99149 0 : return memory;
99150 : }
99151 :
99152 : /* #line 99153 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
99153 :
99154 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
99155 : void
99156 5342 : SgOmpUnrollStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
99157 : {
99158 : // This function traverses the memory pool for only a specific IR node
99159 : // and calls the visit function of the input class execute a traversal
99160 : // similar to the style of the attribute based traversals within ROSE.
99161 : // This traversal will visit ALL nodes of the AST where as the other
99162 : // attribute based traversals visit only the embedded tree within the AST.
99163 :
99164 : // Initialize array to the address of the first element of the STL vector
99165 : // (which is guaranteed to be contiguous storage).
99166 : // SgOmpUnrollStatement objectArray [] = *(Memory_Block_List.begin());
99167 5342 : if (SgOmpUnrollStatement::pools.empty() == false)
99168 : {
99169 : // Generate an array of memory pools
99170 0 : SgOmpUnrollStatement** objectArray = (SgOmpUnrollStatement**) &(SgOmpUnrollStatement::pools[0]);
99171 :
99172 : // Build a local variable for better performance
99173 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
99174 : #if 0
99175 : // Iterate over the memory pools
99176 : for (unsigned int i=0; i < SgOmpUnrollStatement::pools.size(); i++)
99177 : {
99178 : // objectArray[i] is a single memory pool
99179 : for (int j=0; j < SgOmpUnrollStatement::pool_size; j++)
99180 : {
99181 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
99182 : {
99183 : traversal.visit(&(objectArray[i][j]));
99184 : }
99185 : }
99186 : }
99187 : #else
99188 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
99189 : // compute the list first and then call the visit function on each list element.
99190 :
99191 : // printf ("Inside of SgOmpUnrollStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
99192 :
99193 0 : std::vector<SgOmpUnrollStatement*> nodeList;
99194 :
99195 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
99196 0 : for (unsigned int i=0; i < SgOmpUnrollStatement::pools.size(); i++)
99197 : {
99198 : // objectArray[i] is a single memory pool
99199 0 : for (unsigned j=0; j < SgOmpUnrollStatement::pool_size; j++)
99200 : {
99201 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
99202 : {
99203 0 : nodeList.push_back(&(objectArray[i][j]));
99204 : }
99205 : }
99206 : }
99207 :
99208 : // Iterate over the saved list
99209 0 : size_t nodeListSize = nodeList.size();
99210 0 : for (size_t i=0; i < nodeListSize; i++)
99211 : {
99212 0 : ROSE_ASSERT(nodeList[i] != NULL);
99213 : #if 0
99214 : traversal.visit(nodeList[i]);
99215 : #else
99216 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
99217 : {
99218 0 : traversal.visit(nodeList[i]);
99219 : }
99220 : #endif
99221 : }
99222 : #endif
99223 : }
99224 :
99225 : // This should not be required since all previously static data members are
99226 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
99227 :
99228 5342 : }
99229 :
99230 :
99231 : void
99232 194 : SgOmpUnrollStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
99233 : {
99234 : // This function traverses the memory pool for an IR node and
99235 : // calls the function to execute the visitor object.
99236 :
99237 : // Initialize array to the address of the first element of the STL vector
99238 : // (which is guarenteed to be contiguous storage).
99239 : // SgOmpUnrollStatement objectArray [] = *(Memory_Block_List.begin());
99240 194 : if (SgOmpUnrollStatement::pools.empty() == false)
99241 : {
99242 : // Generate an array of memory pools
99243 0 : SgOmpUnrollStatement** objectArray = (SgOmpUnrollStatement**) &(SgOmpUnrollStatement::pools[0]);
99244 :
99245 : // Build a local variable for better performance
99246 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
99247 :
99248 : // Iterate over the memory pools
99249 0 : for (unsigned int i=0; i < SgOmpUnrollStatement::pools.size(); i++)
99250 : {
99251 : // objectArray[i] is a single memory pool
99252 0 : for (unsigned j=0; j < SgOmpUnrollStatement::pool_size; j++)
99253 : {
99254 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
99255 : {
99256 : // printf ("Found a valid SgOmpUnrollStatement object in the memory pool %d at position %d \n",i,j);
99257 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
99258 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
99259 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
99260 : }
99261 : else
99262 : {
99263 : // printf ("Found a INVALID SgOmpUnrollStatement object in the memory pool \n");
99264 : }
99265 : }
99266 : }
99267 : }
99268 :
99269 : // This should not be required since all previously static data members are
99270 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
99271 :
99272 194 : }
99273 :
99274 : void
99275 0 : SgOmpUnrollStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
99276 : {
99277 : // This function visits only a single IR node of the memory pool.
99278 : // it is typically called once for each type of IR node within
99279 : // the automatically generated function: traverseRepresentativeNodes().
99280 :
99281 : // Initialize array to the address of the first element of the STL vector
99282 : // (which is guarenteed to be contiguous storage).
99283 : // SgOmpUnrollStatement objectArray [] = *(Memory_Block_List.begin());
99284 0 : if (SgOmpUnrollStatement::pools.empty() == false)
99285 : {
99286 : // Generate an array of memory pools
99287 0 : SgOmpUnrollStatement** objectArray = (SgOmpUnrollStatement**) &(SgOmpUnrollStatement::pools[0]);
99288 :
99289 : // Build a local variable for better performance
99290 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
99291 :
99292 : // Iterate over the memory pools
99293 0 : bool done = false;
99294 0 : unsigned i=0;
99295 :
99296 : // find the first valid IR node, call visit function, and then leave
99297 0 : while ( done == false && i < SgOmpUnrollStatement::pools.size() )
99298 : {
99299 : // objectArray[i] is a single memory pool
99300 : unsigned j=0;
99301 0 : while (done == false && j < SgOmpUnrollStatement::pool_size)
99302 : {
99303 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
99304 : {
99305 0 : traversal.visit(&(objectArray[i][j]));
99306 0 : done = true;
99307 : }
99308 0 : j++;
99309 : }
99310 0 : i++;
99311 : }
99312 :
99313 : #if 0
99314 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
99315 : if (done == false)
99316 : {
99317 : printf ("No representative for SgOmpUnrollStatement found in memory pools \n");
99318 : }
99319 : #endif
99320 : }
99321 0 : }
99322 :
99323 :
99324 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
99325 : // using values that overflow signed values of int.
99326 : size_t
99327 4 : SgOmpUnrollStatement::numberOfNodes()
99328 : {
99329 : // This function traverses the memory pool for an IR node and
99330 : // counts the number of IR nodes of a particular Sage III IR
99331 : // nodes type.
99332 :
99333 4 : size_t count = 0;
99334 4 : if (SgOmpUnrollStatement::pools.empty() == false)
99335 : {
99336 : // Generate an array of memory pools (this is actually a STL vector,
99337 : // but it is contiguious, so OK to treat this way).
99338 0 : SgOmpUnrollStatement** objectArray = (SgOmpUnrollStatement**) &(SgOmpUnrollStatement::pools[0]);
99339 :
99340 : // Build a local variable for better performance (make it a loop invariant variable).
99341 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
99342 :
99343 : // Iterate over all of the memory pools for this IR node.
99344 0 : for (unsigned int i=0; i < SgOmpUnrollStatement::pools.size(); i++)
99345 : {
99346 : // objectArray[i] is a single memory pool, iterate over all the
99347 : // IR nodes and only count those that are valid IR nodes used in
99348 : // the AST (i.e. allocated IR nodes).
99349 0 : for (unsigned j=0; j < SgOmpUnrollStatement::pool_size; j++)
99350 : {
99351 : // This is indexing the STL vector of C/C++ style arrays as a doubly
99352 : // indexed array access. It is OK since we have leveraged the semantics
99353 : // of STL vector memory as contigous and cast the memory as an array
99354 : // of arrays to use the 2D array indexing. Hope this is not confusing,
99355 : // but it s very fast as an implementation.
99356 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
99357 : {
99358 0 : count++;
99359 : }
99360 : }
99361 : }
99362 : }
99363 :
99364 :
99365 :
99366 4 : return count;
99367 : }
99368 :
99369 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
99370 : // using values that overflow signed values of int.
99371 : size_t
99372 0 : SgOmpUnrollStatement::memoryUsage()
99373 : {
99374 : // This function is required because we need the class name as a type when we call sizeof
99375 : // There might be another way to implement this if we have a traversal that only called a
99376 : // representative object (one call for each type of Sage IIIIR node).
99377 0 : size_t memory = numberOfNodes() * sizeof(SgOmpUnrollStatement);
99378 :
99379 0 : return memory;
99380 : }
99381 :
99382 : /* #line 99383 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
99383 :
99384 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
99385 : void
99386 5342 : SgOmpTileStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
99387 : {
99388 : // This function traverses the memory pool for only a specific IR node
99389 : // and calls the visit function of the input class execute a traversal
99390 : // similar to the style of the attribute based traversals within ROSE.
99391 : // This traversal will visit ALL nodes of the AST where as the other
99392 : // attribute based traversals visit only the embedded tree within the AST.
99393 :
99394 : // Initialize array to the address of the first element of the STL vector
99395 : // (which is guaranteed to be contiguous storage).
99396 : // SgOmpTileStatement objectArray [] = *(Memory_Block_List.begin());
99397 5342 : if (SgOmpTileStatement::pools.empty() == false)
99398 : {
99399 : // Generate an array of memory pools
99400 0 : SgOmpTileStatement** objectArray = (SgOmpTileStatement**) &(SgOmpTileStatement::pools[0]);
99401 :
99402 : // Build a local variable for better performance
99403 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
99404 : #if 0
99405 : // Iterate over the memory pools
99406 : for (unsigned int i=0; i < SgOmpTileStatement::pools.size(); i++)
99407 : {
99408 : // objectArray[i] is a single memory pool
99409 : for (int j=0; j < SgOmpTileStatement::pool_size; j++)
99410 : {
99411 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
99412 : {
99413 : traversal.visit(&(objectArray[i][j]));
99414 : }
99415 : }
99416 : }
99417 : #else
99418 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
99419 : // compute the list first and then call the visit function on each list element.
99420 :
99421 : // printf ("Inside of SgOmpTileStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
99422 :
99423 0 : std::vector<SgOmpTileStatement*> nodeList;
99424 :
99425 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
99426 0 : for (unsigned int i=0; i < SgOmpTileStatement::pools.size(); i++)
99427 : {
99428 : // objectArray[i] is a single memory pool
99429 0 : for (unsigned j=0; j < SgOmpTileStatement::pool_size; j++)
99430 : {
99431 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
99432 : {
99433 0 : nodeList.push_back(&(objectArray[i][j]));
99434 : }
99435 : }
99436 : }
99437 :
99438 : // Iterate over the saved list
99439 0 : size_t nodeListSize = nodeList.size();
99440 0 : for (size_t i=0; i < nodeListSize; i++)
99441 : {
99442 0 : ROSE_ASSERT(nodeList[i] != NULL);
99443 : #if 0
99444 : traversal.visit(nodeList[i]);
99445 : #else
99446 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
99447 : {
99448 0 : traversal.visit(nodeList[i]);
99449 : }
99450 : #endif
99451 : }
99452 : #endif
99453 : }
99454 :
99455 : // This should not be required since all previously static data members are
99456 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
99457 :
99458 5342 : }
99459 :
99460 :
99461 : void
99462 194 : SgOmpTileStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
99463 : {
99464 : // This function traverses the memory pool for an IR node and
99465 : // calls the function to execute the visitor object.
99466 :
99467 : // Initialize array to the address of the first element of the STL vector
99468 : // (which is guarenteed to be contiguous storage).
99469 : // SgOmpTileStatement objectArray [] = *(Memory_Block_List.begin());
99470 194 : if (SgOmpTileStatement::pools.empty() == false)
99471 : {
99472 : // Generate an array of memory pools
99473 0 : SgOmpTileStatement** objectArray = (SgOmpTileStatement**) &(SgOmpTileStatement::pools[0]);
99474 :
99475 : // Build a local variable for better performance
99476 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
99477 :
99478 : // Iterate over the memory pools
99479 0 : for (unsigned int i=0; i < SgOmpTileStatement::pools.size(); i++)
99480 : {
99481 : // objectArray[i] is a single memory pool
99482 0 : for (unsigned j=0; j < SgOmpTileStatement::pool_size; j++)
99483 : {
99484 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
99485 : {
99486 : // printf ("Found a valid SgOmpTileStatement object in the memory pool %d at position %d \n",i,j);
99487 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
99488 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
99489 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
99490 : }
99491 : else
99492 : {
99493 : // printf ("Found a INVALID SgOmpTileStatement object in the memory pool \n");
99494 : }
99495 : }
99496 : }
99497 : }
99498 :
99499 : // This should not be required since all previously static data members are
99500 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
99501 :
99502 194 : }
99503 :
99504 : void
99505 0 : SgOmpTileStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
99506 : {
99507 : // This function visits only a single IR node of the memory pool.
99508 : // it is typically called once for each type of IR node within
99509 : // the automatically generated function: traverseRepresentativeNodes().
99510 :
99511 : // Initialize array to the address of the first element of the STL vector
99512 : // (which is guarenteed to be contiguous storage).
99513 : // SgOmpTileStatement objectArray [] = *(Memory_Block_List.begin());
99514 0 : if (SgOmpTileStatement::pools.empty() == false)
99515 : {
99516 : // Generate an array of memory pools
99517 0 : SgOmpTileStatement** objectArray = (SgOmpTileStatement**) &(SgOmpTileStatement::pools[0]);
99518 :
99519 : // Build a local variable for better performance
99520 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
99521 :
99522 : // Iterate over the memory pools
99523 0 : bool done = false;
99524 0 : unsigned i=0;
99525 :
99526 : // find the first valid IR node, call visit function, and then leave
99527 0 : while ( done == false && i < SgOmpTileStatement::pools.size() )
99528 : {
99529 : // objectArray[i] is a single memory pool
99530 : unsigned j=0;
99531 0 : while (done == false && j < SgOmpTileStatement::pool_size)
99532 : {
99533 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
99534 : {
99535 0 : traversal.visit(&(objectArray[i][j]));
99536 0 : done = true;
99537 : }
99538 0 : j++;
99539 : }
99540 0 : i++;
99541 : }
99542 :
99543 : #if 0
99544 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
99545 : if (done == false)
99546 : {
99547 : printf ("No representative for SgOmpTileStatement found in memory pools \n");
99548 : }
99549 : #endif
99550 : }
99551 0 : }
99552 :
99553 :
99554 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
99555 : // using values that overflow signed values of int.
99556 : size_t
99557 4 : SgOmpTileStatement::numberOfNodes()
99558 : {
99559 : // This function traverses the memory pool for an IR node and
99560 : // counts the number of IR nodes of a particular Sage III IR
99561 : // nodes type.
99562 :
99563 4 : size_t count = 0;
99564 4 : if (SgOmpTileStatement::pools.empty() == false)
99565 : {
99566 : // Generate an array of memory pools (this is actually a STL vector,
99567 : // but it is contiguious, so OK to treat this way).
99568 0 : SgOmpTileStatement** objectArray = (SgOmpTileStatement**) &(SgOmpTileStatement::pools[0]);
99569 :
99570 : // Build a local variable for better performance (make it a loop invariant variable).
99571 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
99572 :
99573 : // Iterate over all of the memory pools for this IR node.
99574 0 : for (unsigned int i=0; i < SgOmpTileStatement::pools.size(); i++)
99575 : {
99576 : // objectArray[i] is a single memory pool, iterate over all the
99577 : // IR nodes and only count those that are valid IR nodes used in
99578 : // the AST (i.e. allocated IR nodes).
99579 0 : for (unsigned j=0; j < SgOmpTileStatement::pool_size; j++)
99580 : {
99581 : // This is indexing the STL vector of C/C++ style arrays as a doubly
99582 : // indexed array access. It is OK since we have leveraged the semantics
99583 : // of STL vector memory as contigous and cast the memory as an array
99584 : // of arrays to use the 2D array indexing. Hope this is not confusing,
99585 : // but it s very fast as an implementation.
99586 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
99587 : {
99588 0 : count++;
99589 : }
99590 : }
99591 : }
99592 : }
99593 :
99594 :
99595 :
99596 4 : return count;
99597 : }
99598 :
99599 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
99600 : // using values that overflow signed values of int.
99601 : size_t
99602 0 : SgOmpTileStatement::memoryUsage()
99603 : {
99604 : // This function is required because we need the class name as a type when we call sizeof
99605 : // There might be another way to implement this if we have a traversal that only called a
99606 : // representative object (one call for each type of Sage IIIIR node).
99607 0 : size_t memory = numberOfNodes() * sizeof(SgOmpTileStatement);
99608 :
99609 0 : return memory;
99610 : }
99611 :
99612 : /* #line 99613 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
99613 :
99614 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
99615 : void
99616 5342 : SgUpirLoopStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
99617 : {
99618 : // This function traverses the memory pool for only a specific IR node
99619 : // and calls the visit function of the input class execute a traversal
99620 : // similar to the style of the attribute based traversals within ROSE.
99621 : // This traversal will visit ALL nodes of the AST where as the other
99622 : // attribute based traversals visit only the embedded tree within the AST.
99623 :
99624 : // Initialize array to the address of the first element of the STL vector
99625 : // (which is guaranteed to be contiguous storage).
99626 : // SgUpirLoopStatement objectArray [] = *(Memory_Block_List.begin());
99627 5342 : if (SgUpirLoopStatement::pools.empty() == false)
99628 : {
99629 : // Generate an array of memory pools
99630 637 : SgUpirLoopStatement** objectArray = (SgUpirLoopStatement**) &(SgUpirLoopStatement::pools[0]);
99631 :
99632 : // Build a local variable for better performance
99633 637 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
99634 : #if 0
99635 : // Iterate over the memory pools
99636 : for (unsigned int i=0; i < SgUpirLoopStatement::pools.size(); i++)
99637 : {
99638 : // objectArray[i] is a single memory pool
99639 : for (int j=0; j < SgUpirLoopStatement::pool_size; j++)
99640 : {
99641 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
99642 : {
99643 : traversal.visit(&(objectArray[i][j]));
99644 : }
99645 : }
99646 : }
99647 : #else
99648 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
99649 : // compute the list first and then call the visit function on each list element.
99650 :
99651 : // printf ("Inside of SgUpirLoopStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
99652 :
99653 1274 : std::vector<SgUpirLoopStatement*> nodeList;
99654 :
99655 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
99656 1274 : for (unsigned int i=0; i < SgUpirLoopStatement::pools.size(); i++)
99657 : {
99658 : // objectArray[i] is a single memory pool
99659 1274640 : for (unsigned j=0; j < SgUpirLoopStatement::pool_size; j++)
99660 : {
99661 1274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
99662 : {
99663 1393 : nodeList.push_back(&(objectArray[i][j]));
99664 : }
99665 : }
99666 : }
99667 :
99668 : // Iterate over the saved list
99669 637 : size_t nodeListSize = nodeList.size();
99670 2030 : for (size_t i=0; i < nodeListSize; i++)
99671 : {
99672 1393 : ROSE_ASSERT(nodeList[i] != NULL);
99673 : #if 0
99674 : traversal.visit(nodeList[i]);
99675 : #else
99676 1393 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
99677 : {
99678 1393 : traversal.visit(nodeList[i]);
99679 : }
99680 : #endif
99681 : }
99682 : #endif
99683 : }
99684 :
99685 : // This should not be required since all previously static data members are
99686 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
99687 :
99688 5342 : }
99689 :
99690 :
99691 : void
99692 194 : SgUpirLoopStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
99693 : {
99694 : // This function traverses the memory pool for an IR node and
99695 : // calls the function to execute the visitor object.
99696 :
99697 : // Initialize array to the address of the first element of the STL vector
99698 : // (which is guarenteed to be contiguous storage).
99699 : // SgUpirLoopStatement objectArray [] = *(Memory_Block_List.begin());
99700 194 : if (SgUpirLoopStatement::pools.empty() == false)
99701 : {
99702 : // Generate an array of memory pools
99703 0 : SgUpirLoopStatement** objectArray = (SgUpirLoopStatement**) &(SgUpirLoopStatement::pools[0]);
99704 :
99705 : // Build a local variable for better performance
99706 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
99707 :
99708 : // Iterate over the memory pools
99709 0 : for (unsigned int i=0; i < SgUpirLoopStatement::pools.size(); i++)
99710 : {
99711 : // objectArray[i] is a single memory pool
99712 0 : for (unsigned j=0; j < SgUpirLoopStatement::pool_size; j++)
99713 : {
99714 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
99715 : {
99716 : // printf ("Found a valid SgUpirLoopStatement object in the memory pool %d at position %d \n",i,j);
99717 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
99718 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
99719 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
99720 : }
99721 : else
99722 : {
99723 : // printf ("Found a INVALID SgUpirLoopStatement object in the memory pool \n");
99724 : }
99725 : }
99726 : }
99727 : }
99728 :
99729 : // This should not be required since all previously static data members are
99730 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
99731 :
99732 194 : }
99733 :
99734 : void
99735 0 : SgUpirLoopStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
99736 : {
99737 : // This function visits only a single IR node of the memory pool.
99738 : // it is typically called once for each type of IR node within
99739 : // the automatically generated function: traverseRepresentativeNodes().
99740 :
99741 : // Initialize array to the address of the first element of the STL vector
99742 : // (which is guarenteed to be contiguous storage).
99743 : // SgUpirLoopStatement objectArray [] = *(Memory_Block_List.begin());
99744 0 : if (SgUpirLoopStatement::pools.empty() == false)
99745 : {
99746 : // Generate an array of memory pools
99747 0 : SgUpirLoopStatement** objectArray = (SgUpirLoopStatement**) &(SgUpirLoopStatement::pools[0]);
99748 :
99749 : // Build a local variable for better performance
99750 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
99751 :
99752 : // Iterate over the memory pools
99753 0 : bool done = false;
99754 0 : unsigned i=0;
99755 :
99756 : // find the first valid IR node, call visit function, and then leave
99757 0 : while ( done == false && i < SgUpirLoopStatement::pools.size() )
99758 : {
99759 : // objectArray[i] is a single memory pool
99760 : unsigned j=0;
99761 0 : while (done == false && j < SgUpirLoopStatement::pool_size)
99762 : {
99763 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
99764 : {
99765 0 : traversal.visit(&(objectArray[i][j]));
99766 0 : done = true;
99767 : }
99768 0 : j++;
99769 : }
99770 0 : i++;
99771 : }
99772 :
99773 : #if 0
99774 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
99775 : if (done == false)
99776 : {
99777 : printf ("No representative for SgUpirLoopStatement found in memory pools \n");
99778 : }
99779 : #endif
99780 : }
99781 0 : }
99782 :
99783 :
99784 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
99785 : // using values that overflow signed values of int.
99786 : size_t
99787 4 : SgUpirLoopStatement::numberOfNodes()
99788 : {
99789 : // This function traverses the memory pool for an IR node and
99790 : // counts the number of IR nodes of a particular Sage III IR
99791 : // nodes type.
99792 :
99793 4 : size_t count = 0;
99794 4 : if (SgUpirLoopStatement::pools.empty() == false)
99795 : {
99796 : // Generate an array of memory pools (this is actually a STL vector,
99797 : // but it is contiguious, so OK to treat this way).
99798 0 : SgUpirLoopStatement** objectArray = (SgUpirLoopStatement**) &(SgUpirLoopStatement::pools[0]);
99799 :
99800 : // Build a local variable for better performance (make it a loop invariant variable).
99801 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
99802 :
99803 : // Iterate over all of the memory pools for this IR node.
99804 0 : for (unsigned int i=0; i < SgUpirLoopStatement::pools.size(); i++)
99805 : {
99806 : // objectArray[i] is a single memory pool, iterate over all the
99807 : // IR nodes and only count those that are valid IR nodes used in
99808 : // the AST (i.e. allocated IR nodes).
99809 0 : for (unsigned j=0; j < SgUpirLoopStatement::pool_size; j++)
99810 : {
99811 : // This is indexing the STL vector of C/C++ style arrays as a doubly
99812 : // indexed array access. It is OK since we have leveraged the semantics
99813 : // of STL vector memory as contigous and cast the memory as an array
99814 : // of arrays to use the 2D array indexing. Hope this is not confusing,
99815 : // but it s very fast as an implementation.
99816 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
99817 : {
99818 0 : count++;
99819 : }
99820 : }
99821 : }
99822 : }
99823 :
99824 :
99825 :
99826 4 : return count;
99827 : }
99828 :
99829 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
99830 : // using values that overflow signed values of int.
99831 : size_t
99832 0 : SgUpirLoopStatement::memoryUsage()
99833 : {
99834 : // This function is required because we need the class name as a type when we call sizeof
99835 : // There might be another way to implement this if we have a traversal that only called a
99836 : // representative object (one call for each type of Sage IIIIR node).
99837 0 : size_t memory = numberOfNodes() * sizeof(SgUpirLoopStatement);
99838 :
99839 0 : return memory;
99840 : }
99841 :
99842 : /* #line 99843 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
99843 :
99844 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
99845 : void
99846 5342 : SgUpirFieldStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
99847 : {
99848 : // This function traverses the memory pool for only a specific IR node
99849 : // and calls the visit function of the input class execute a traversal
99850 : // similar to the style of the attribute based traversals within ROSE.
99851 : // This traversal will visit ALL nodes of the AST where as the other
99852 : // attribute based traversals visit only the embedded tree within the AST.
99853 :
99854 : // Initialize array to the address of the first element of the STL vector
99855 : // (which is guaranteed to be contiguous storage).
99856 : // SgUpirFieldStatement objectArray [] = *(Memory_Block_List.begin());
99857 5342 : if (SgUpirFieldStatement::pools.empty() == false)
99858 : {
99859 : // Generate an array of memory pools
99860 0 : SgUpirFieldStatement** objectArray = (SgUpirFieldStatement**) &(SgUpirFieldStatement::pools[0]);
99861 :
99862 : // Build a local variable for better performance
99863 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
99864 : #if 0
99865 : // Iterate over the memory pools
99866 : for (unsigned int i=0; i < SgUpirFieldStatement::pools.size(); i++)
99867 : {
99868 : // objectArray[i] is a single memory pool
99869 : for (int j=0; j < SgUpirFieldStatement::pool_size; j++)
99870 : {
99871 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
99872 : {
99873 : traversal.visit(&(objectArray[i][j]));
99874 : }
99875 : }
99876 : }
99877 : #else
99878 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
99879 : // compute the list first and then call the visit function on each list element.
99880 :
99881 : // printf ("Inside of SgUpirFieldStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
99882 :
99883 0 : std::vector<SgUpirFieldStatement*> nodeList;
99884 :
99885 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
99886 0 : for (unsigned int i=0; i < SgUpirFieldStatement::pools.size(); i++)
99887 : {
99888 : // objectArray[i] is a single memory pool
99889 0 : for (unsigned j=0; j < SgUpirFieldStatement::pool_size; j++)
99890 : {
99891 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
99892 : {
99893 0 : nodeList.push_back(&(objectArray[i][j]));
99894 : }
99895 : }
99896 : }
99897 :
99898 : // Iterate over the saved list
99899 0 : size_t nodeListSize = nodeList.size();
99900 0 : for (size_t i=0; i < nodeListSize; i++)
99901 : {
99902 0 : ROSE_ASSERT(nodeList[i] != NULL);
99903 : #if 0
99904 : traversal.visit(nodeList[i]);
99905 : #else
99906 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
99907 : {
99908 0 : traversal.visit(nodeList[i]);
99909 : }
99910 : #endif
99911 : }
99912 : #endif
99913 : }
99914 :
99915 : // This should not be required since all previously static data members are
99916 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
99917 :
99918 5342 : }
99919 :
99920 :
99921 : void
99922 194 : SgUpirFieldStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
99923 : {
99924 : // This function traverses the memory pool for an IR node and
99925 : // calls the function to execute the visitor object.
99926 :
99927 : // Initialize array to the address of the first element of the STL vector
99928 : // (which is guarenteed to be contiguous storage).
99929 : // SgUpirFieldStatement objectArray [] = *(Memory_Block_List.begin());
99930 194 : if (SgUpirFieldStatement::pools.empty() == false)
99931 : {
99932 : // Generate an array of memory pools
99933 0 : SgUpirFieldStatement** objectArray = (SgUpirFieldStatement**) &(SgUpirFieldStatement::pools[0]);
99934 :
99935 : // Build a local variable for better performance
99936 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
99937 :
99938 : // Iterate over the memory pools
99939 0 : for (unsigned int i=0; i < SgUpirFieldStatement::pools.size(); i++)
99940 : {
99941 : // objectArray[i] is a single memory pool
99942 0 : for (unsigned j=0; j < SgUpirFieldStatement::pool_size; j++)
99943 : {
99944 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
99945 : {
99946 : // printf ("Found a valid SgUpirFieldStatement object in the memory pool %d at position %d \n",i,j);
99947 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
99948 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
99949 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
99950 : }
99951 : else
99952 : {
99953 : // printf ("Found a INVALID SgUpirFieldStatement object in the memory pool \n");
99954 : }
99955 : }
99956 : }
99957 : }
99958 :
99959 : // This should not be required since all previously static data members are
99960 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
99961 :
99962 194 : }
99963 :
99964 : void
99965 0 : SgUpirFieldStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
99966 : {
99967 : // This function visits only a single IR node of the memory pool.
99968 : // it is typically called once for each type of IR node within
99969 : // the automatically generated function: traverseRepresentativeNodes().
99970 :
99971 : // Initialize array to the address of the first element of the STL vector
99972 : // (which is guarenteed to be contiguous storage).
99973 : // SgUpirFieldStatement objectArray [] = *(Memory_Block_List.begin());
99974 0 : if (SgUpirFieldStatement::pools.empty() == false)
99975 : {
99976 : // Generate an array of memory pools
99977 0 : SgUpirFieldStatement** objectArray = (SgUpirFieldStatement**) &(SgUpirFieldStatement::pools[0]);
99978 :
99979 : // Build a local variable for better performance
99980 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
99981 :
99982 : // Iterate over the memory pools
99983 0 : bool done = false;
99984 0 : unsigned i=0;
99985 :
99986 : // find the first valid IR node, call visit function, and then leave
99987 0 : while ( done == false && i < SgUpirFieldStatement::pools.size() )
99988 : {
99989 : // objectArray[i] is a single memory pool
99990 : unsigned j=0;
99991 0 : while (done == false && j < SgUpirFieldStatement::pool_size)
99992 : {
99993 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
99994 : {
99995 0 : traversal.visit(&(objectArray[i][j]));
99996 0 : done = true;
99997 : }
99998 0 : j++;
99999 : }
100000 0 : i++;
100001 : }
100002 :
100003 : #if 0
100004 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
100005 : if (done == false)
100006 : {
100007 : printf ("No representative for SgUpirFieldStatement found in memory pools \n");
100008 : }
100009 : #endif
100010 : }
100011 0 : }
100012 :
100013 :
100014 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
100015 : // using values that overflow signed values of int.
100016 : size_t
100017 4 : SgUpirFieldStatement::numberOfNodes()
100018 : {
100019 : // This function traverses the memory pool for an IR node and
100020 : // counts the number of IR nodes of a particular Sage III IR
100021 : // nodes type.
100022 :
100023 4 : size_t count = 0;
100024 4 : if (SgUpirFieldStatement::pools.empty() == false)
100025 : {
100026 : // Generate an array of memory pools (this is actually a STL vector,
100027 : // but it is contiguious, so OK to treat this way).
100028 0 : SgUpirFieldStatement** objectArray = (SgUpirFieldStatement**) &(SgUpirFieldStatement::pools[0]);
100029 :
100030 : // Build a local variable for better performance (make it a loop invariant variable).
100031 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
100032 :
100033 : // Iterate over all of the memory pools for this IR node.
100034 0 : for (unsigned int i=0; i < SgUpirFieldStatement::pools.size(); i++)
100035 : {
100036 : // objectArray[i] is a single memory pool, iterate over all the
100037 : // IR nodes and only count those that are valid IR nodes used in
100038 : // the AST (i.e. allocated IR nodes).
100039 0 : for (unsigned j=0; j < SgUpirFieldStatement::pool_size; j++)
100040 : {
100041 : // This is indexing the STL vector of C/C++ style arrays as a doubly
100042 : // indexed array access. It is OK since we have leveraged the semantics
100043 : // of STL vector memory as contigous and cast the memory as an array
100044 : // of arrays to use the 2D array indexing. Hope this is not confusing,
100045 : // but it s very fast as an implementation.
100046 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
100047 : {
100048 0 : count++;
100049 : }
100050 : }
100051 : }
100052 : }
100053 :
100054 :
100055 :
100056 4 : return count;
100057 : }
100058 :
100059 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
100060 : // using values that overflow signed values of int.
100061 : size_t
100062 0 : SgUpirFieldStatement::memoryUsage()
100063 : {
100064 : // This function is required because we need the class name as a type when we call sizeof
100065 : // There might be another way to implement this if we have a traversal that only called a
100066 : // representative object (one call for each type of Sage IIIIR node).
100067 0 : size_t memory = numberOfNodes() * sizeof(SgUpirFieldStatement);
100068 :
100069 0 : return memory;
100070 : }
100071 :
100072 : /* #line 100073 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
100073 :
100074 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
100075 : void
100076 5342 : SgOmpCancelStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
100077 : {
100078 : // This function traverses the memory pool for only a specific IR node
100079 : // and calls the visit function of the input class execute a traversal
100080 : // similar to the style of the attribute based traversals within ROSE.
100081 : // This traversal will visit ALL nodes of the AST where as the other
100082 : // attribute based traversals visit only the embedded tree within the AST.
100083 :
100084 : // Initialize array to the address of the first element of the STL vector
100085 : // (which is guaranteed to be contiguous storage).
100086 : // SgOmpCancelStatement objectArray [] = *(Memory_Block_List.begin());
100087 5342 : if (SgOmpCancelStatement::pools.empty() == false)
100088 : {
100089 : // Generate an array of memory pools
100090 7 : SgOmpCancelStatement** objectArray = (SgOmpCancelStatement**) &(SgOmpCancelStatement::pools[0]);
100091 :
100092 : // Build a local variable for better performance
100093 7 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
100094 : #if 0
100095 : // Iterate over the memory pools
100096 : for (unsigned int i=0; i < SgOmpCancelStatement::pools.size(); i++)
100097 : {
100098 : // objectArray[i] is a single memory pool
100099 : for (int j=0; j < SgOmpCancelStatement::pool_size; j++)
100100 : {
100101 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
100102 : {
100103 : traversal.visit(&(objectArray[i][j]));
100104 : }
100105 : }
100106 : }
100107 : #else
100108 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
100109 : // compute the list first and then call the visit function on each list element.
100110 :
100111 : // printf ("Inside of SgOmpCancelStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
100112 :
100113 14 : std::vector<SgOmpCancelStatement*> nodeList;
100114 :
100115 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
100116 14 : for (unsigned int i=0; i < SgOmpCancelStatement::pools.size(); i++)
100117 : {
100118 : // objectArray[i] is a single memory pool
100119 14007 : for (unsigned j=0; j < SgOmpCancelStatement::pool_size; j++)
100120 : {
100121 14000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
100122 : {
100123 7 : nodeList.push_back(&(objectArray[i][j]));
100124 : }
100125 : }
100126 : }
100127 :
100128 : // Iterate over the saved list
100129 7 : size_t nodeListSize = nodeList.size();
100130 14 : for (size_t i=0; i < nodeListSize; i++)
100131 : {
100132 7 : ROSE_ASSERT(nodeList[i] != NULL);
100133 : #if 0
100134 : traversal.visit(nodeList[i]);
100135 : #else
100136 7 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
100137 : {
100138 7 : traversal.visit(nodeList[i]);
100139 : }
100140 : #endif
100141 : }
100142 : #endif
100143 : }
100144 :
100145 : // This should not be required since all previously static data members are
100146 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
100147 :
100148 5342 : }
100149 :
100150 :
100151 : void
100152 194 : SgOmpCancelStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
100153 : {
100154 : // This function traverses the memory pool for an IR node and
100155 : // calls the function to execute the visitor object.
100156 :
100157 : // Initialize array to the address of the first element of the STL vector
100158 : // (which is guarenteed to be contiguous storage).
100159 : // SgOmpCancelStatement objectArray [] = *(Memory_Block_List.begin());
100160 194 : if (SgOmpCancelStatement::pools.empty() == false)
100161 : {
100162 : // Generate an array of memory pools
100163 0 : SgOmpCancelStatement** objectArray = (SgOmpCancelStatement**) &(SgOmpCancelStatement::pools[0]);
100164 :
100165 : // Build a local variable for better performance
100166 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
100167 :
100168 : // Iterate over the memory pools
100169 0 : for (unsigned int i=0; i < SgOmpCancelStatement::pools.size(); i++)
100170 : {
100171 : // objectArray[i] is a single memory pool
100172 0 : for (unsigned j=0; j < SgOmpCancelStatement::pool_size; j++)
100173 : {
100174 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
100175 : {
100176 : // printf ("Found a valid SgOmpCancelStatement object in the memory pool %d at position %d \n",i,j);
100177 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
100178 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
100179 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
100180 : }
100181 : else
100182 : {
100183 : // printf ("Found a INVALID SgOmpCancelStatement object in the memory pool \n");
100184 : }
100185 : }
100186 : }
100187 : }
100188 :
100189 : // This should not be required since all previously static data members are
100190 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
100191 :
100192 194 : }
100193 :
100194 : void
100195 0 : SgOmpCancelStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
100196 : {
100197 : // This function visits only a single IR node of the memory pool.
100198 : // it is typically called once for each type of IR node within
100199 : // the automatically generated function: traverseRepresentativeNodes().
100200 :
100201 : // Initialize array to the address of the first element of the STL vector
100202 : // (which is guarenteed to be contiguous storage).
100203 : // SgOmpCancelStatement objectArray [] = *(Memory_Block_List.begin());
100204 0 : if (SgOmpCancelStatement::pools.empty() == false)
100205 : {
100206 : // Generate an array of memory pools
100207 0 : SgOmpCancelStatement** objectArray = (SgOmpCancelStatement**) &(SgOmpCancelStatement::pools[0]);
100208 :
100209 : // Build a local variable for better performance
100210 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
100211 :
100212 : // Iterate over the memory pools
100213 0 : bool done = false;
100214 0 : unsigned i=0;
100215 :
100216 : // find the first valid IR node, call visit function, and then leave
100217 0 : while ( done == false && i < SgOmpCancelStatement::pools.size() )
100218 : {
100219 : // objectArray[i] is a single memory pool
100220 : unsigned j=0;
100221 0 : while (done == false && j < SgOmpCancelStatement::pool_size)
100222 : {
100223 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
100224 : {
100225 0 : traversal.visit(&(objectArray[i][j]));
100226 0 : done = true;
100227 : }
100228 0 : j++;
100229 : }
100230 0 : i++;
100231 : }
100232 :
100233 : #if 0
100234 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
100235 : if (done == false)
100236 : {
100237 : printf ("No representative for SgOmpCancelStatement found in memory pools \n");
100238 : }
100239 : #endif
100240 : }
100241 0 : }
100242 :
100243 :
100244 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
100245 : // using values that overflow signed values of int.
100246 : size_t
100247 4 : SgOmpCancelStatement::numberOfNodes()
100248 : {
100249 : // This function traverses the memory pool for an IR node and
100250 : // counts the number of IR nodes of a particular Sage III IR
100251 : // nodes type.
100252 :
100253 4 : size_t count = 0;
100254 4 : if (SgOmpCancelStatement::pools.empty() == false)
100255 : {
100256 : // Generate an array of memory pools (this is actually a STL vector,
100257 : // but it is contiguious, so OK to treat this way).
100258 0 : SgOmpCancelStatement** objectArray = (SgOmpCancelStatement**) &(SgOmpCancelStatement::pools[0]);
100259 :
100260 : // Build a local variable for better performance (make it a loop invariant variable).
100261 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
100262 :
100263 : // Iterate over all of the memory pools for this IR node.
100264 0 : for (unsigned int i=0; i < SgOmpCancelStatement::pools.size(); i++)
100265 : {
100266 : // objectArray[i] is a single memory pool, iterate over all the
100267 : // IR nodes and only count those that are valid IR nodes used in
100268 : // the AST (i.e. allocated IR nodes).
100269 0 : for (unsigned j=0; j < SgOmpCancelStatement::pool_size; j++)
100270 : {
100271 : // This is indexing the STL vector of C/C++ style arrays as a doubly
100272 : // indexed array access. It is OK since we have leveraged the semantics
100273 : // of STL vector memory as contigous and cast the memory as an array
100274 : // of arrays to use the 2D array indexing. Hope this is not confusing,
100275 : // but it s very fast as an implementation.
100276 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
100277 : {
100278 0 : count++;
100279 : }
100280 : }
100281 : }
100282 : }
100283 :
100284 :
100285 :
100286 4 : return count;
100287 : }
100288 :
100289 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
100290 : // using values that overflow signed values of int.
100291 : size_t
100292 0 : SgOmpCancelStatement::memoryUsage()
100293 : {
100294 : // This function is required because we need the class name as a type when we call sizeof
100295 : // There might be another way to implement this if we have a traversal that only called a
100296 : // representative object (one call for each type of Sage IIIIR node).
100297 0 : size_t memory = numberOfNodes() * sizeof(SgOmpCancelStatement);
100298 :
100299 0 : return memory;
100300 : }
100301 :
100302 : /* #line 100303 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
100303 :
100304 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
100305 : void
100306 5342 : SgOmpCancellationPointStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
100307 : {
100308 : // This function traverses the memory pool for only a specific IR node
100309 : // and calls the visit function of the input class execute a traversal
100310 : // similar to the style of the attribute based traversals within ROSE.
100311 : // This traversal will visit ALL nodes of the AST where as the other
100312 : // attribute based traversals visit only the embedded tree within the AST.
100313 :
100314 : // Initialize array to the address of the first element of the STL vector
100315 : // (which is guaranteed to be contiguous storage).
100316 : // SgOmpCancellationPointStatement objectArray [] = *(Memory_Block_List.begin());
100317 5342 : if (SgOmpCancellationPointStatement::pools.empty() == false)
100318 : {
100319 : // Generate an array of memory pools
100320 7 : SgOmpCancellationPointStatement** objectArray = (SgOmpCancellationPointStatement**) &(SgOmpCancellationPointStatement::pools[0]);
100321 :
100322 : // Build a local variable for better performance
100323 7 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
100324 : #if 0
100325 : // Iterate over the memory pools
100326 : for (unsigned int i=0; i < SgOmpCancellationPointStatement::pools.size(); i++)
100327 : {
100328 : // objectArray[i] is a single memory pool
100329 : for (int j=0; j < SgOmpCancellationPointStatement::pool_size; j++)
100330 : {
100331 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
100332 : {
100333 : traversal.visit(&(objectArray[i][j]));
100334 : }
100335 : }
100336 : }
100337 : #else
100338 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
100339 : // compute the list first and then call the visit function on each list element.
100340 :
100341 : // printf ("Inside of SgOmpCancellationPointStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
100342 :
100343 14 : std::vector<SgOmpCancellationPointStatement*> nodeList;
100344 :
100345 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
100346 14 : for (unsigned int i=0; i < SgOmpCancellationPointStatement::pools.size(); i++)
100347 : {
100348 : // objectArray[i] is a single memory pool
100349 14007 : for (unsigned j=0; j < SgOmpCancellationPointStatement::pool_size; j++)
100350 : {
100351 14000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
100352 : {
100353 7 : nodeList.push_back(&(objectArray[i][j]));
100354 : }
100355 : }
100356 : }
100357 :
100358 : // Iterate over the saved list
100359 7 : size_t nodeListSize = nodeList.size();
100360 14 : for (size_t i=0; i < nodeListSize; i++)
100361 : {
100362 7 : ROSE_ASSERT(nodeList[i] != NULL);
100363 : #if 0
100364 : traversal.visit(nodeList[i]);
100365 : #else
100366 7 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
100367 : {
100368 7 : traversal.visit(nodeList[i]);
100369 : }
100370 : #endif
100371 : }
100372 : #endif
100373 : }
100374 :
100375 : // This should not be required since all previously static data members are
100376 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
100377 :
100378 5342 : }
100379 :
100380 :
100381 : void
100382 194 : SgOmpCancellationPointStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
100383 : {
100384 : // This function traverses the memory pool for an IR node and
100385 : // calls the function to execute the visitor object.
100386 :
100387 : // Initialize array to the address of the first element of the STL vector
100388 : // (which is guarenteed to be contiguous storage).
100389 : // SgOmpCancellationPointStatement objectArray [] = *(Memory_Block_List.begin());
100390 194 : if (SgOmpCancellationPointStatement::pools.empty() == false)
100391 : {
100392 : // Generate an array of memory pools
100393 0 : SgOmpCancellationPointStatement** objectArray = (SgOmpCancellationPointStatement**) &(SgOmpCancellationPointStatement::pools[0]);
100394 :
100395 : // Build a local variable for better performance
100396 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
100397 :
100398 : // Iterate over the memory pools
100399 0 : for (unsigned int i=0; i < SgOmpCancellationPointStatement::pools.size(); i++)
100400 : {
100401 : // objectArray[i] is a single memory pool
100402 0 : for (unsigned j=0; j < SgOmpCancellationPointStatement::pool_size; j++)
100403 : {
100404 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
100405 : {
100406 : // printf ("Found a valid SgOmpCancellationPointStatement object in the memory pool %d at position %d \n",i,j);
100407 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
100408 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
100409 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
100410 : }
100411 : else
100412 : {
100413 : // printf ("Found a INVALID SgOmpCancellationPointStatement object in the memory pool \n");
100414 : }
100415 : }
100416 : }
100417 : }
100418 :
100419 : // This should not be required since all previously static data members are
100420 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
100421 :
100422 194 : }
100423 :
100424 : void
100425 0 : SgOmpCancellationPointStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
100426 : {
100427 : // This function visits only a single IR node of the memory pool.
100428 : // it is typically called once for each type of IR node within
100429 : // the automatically generated function: traverseRepresentativeNodes().
100430 :
100431 : // Initialize array to the address of the first element of the STL vector
100432 : // (which is guarenteed to be contiguous storage).
100433 : // SgOmpCancellationPointStatement objectArray [] = *(Memory_Block_List.begin());
100434 0 : if (SgOmpCancellationPointStatement::pools.empty() == false)
100435 : {
100436 : // Generate an array of memory pools
100437 0 : SgOmpCancellationPointStatement** objectArray = (SgOmpCancellationPointStatement**) &(SgOmpCancellationPointStatement::pools[0]);
100438 :
100439 : // Build a local variable for better performance
100440 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
100441 :
100442 : // Iterate over the memory pools
100443 0 : bool done = false;
100444 0 : unsigned i=0;
100445 :
100446 : // find the first valid IR node, call visit function, and then leave
100447 0 : while ( done == false && i < SgOmpCancellationPointStatement::pools.size() )
100448 : {
100449 : // objectArray[i] is a single memory pool
100450 : unsigned j=0;
100451 0 : while (done == false && j < SgOmpCancellationPointStatement::pool_size)
100452 : {
100453 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
100454 : {
100455 0 : traversal.visit(&(objectArray[i][j]));
100456 0 : done = true;
100457 : }
100458 0 : j++;
100459 : }
100460 0 : i++;
100461 : }
100462 :
100463 : #if 0
100464 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
100465 : if (done == false)
100466 : {
100467 : printf ("No representative for SgOmpCancellationPointStatement found in memory pools \n");
100468 : }
100469 : #endif
100470 : }
100471 0 : }
100472 :
100473 :
100474 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
100475 : // using values that overflow signed values of int.
100476 : size_t
100477 4 : SgOmpCancellationPointStatement::numberOfNodes()
100478 : {
100479 : // This function traverses the memory pool for an IR node and
100480 : // counts the number of IR nodes of a particular Sage III IR
100481 : // nodes type.
100482 :
100483 4 : size_t count = 0;
100484 4 : if (SgOmpCancellationPointStatement::pools.empty() == false)
100485 : {
100486 : // Generate an array of memory pools (this is actually a STL vector,
100487 : // but it is contiguious, so OK to treat this way).
100488 0 : SgOmpCancellationPointStatement** objectArray = (SgOmpCancellationPointStatement**) &(SgOmpCancellationPointStatement::pools[0]);
100489 :
100490 : // Build a local variable for better performance (make it a loop invariant variable).
100491 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
100492 :
100493 : // Iterate over all of the memory pools for this IR node.
100494 0 : for (unsigned int i=0; i < SgOmpCancellationPointStatement::pools.size(); i++)
100495 : {
100496 : // objectArray[i] is a single memory pool, iterate over all the
100497 : // IR nodes and only count those that are valid IR nodes used in
100498 : // the AST (i.e. allocated IR nodes).
100499 0 : for (unsigned j=0; j < SgOmpCancellationPointStatement::pool_size; j++)
100500 : {
100501 : // This is indexing the STL vector of C/C++ style arrays as a doubly
100502 : // indexed array access. It is OK since we have leveraged the semantics
100503 : // of STL vector memory as contigous and cast the memory as an array
100504 : // of arrays to use the 2D array indexing. Hope this is not confusing,
100505 : // but it s very fast as an implementation.
100506 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
100507 : {
100508 0 : count++;
100509 : }
100510 : }
100511 : }
100512 : }
100513 :
100514 :
100515 :
100516 4 : return count;
100517 : }
100518 :
100519 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
100520 : // using values that overflow signed values of int.
100521 : size_t
100522 0 : SgOmpCancellationPointStatement::memoryUsage()
100523 : {
100524 : // This function is required because we need the class name as a type when we call sizeof
100525 : // There might be another way to implement this if we have a traversal that only called a
100526 : // representative object (one call for each type of Sage IIIIR node).
100527 0 : size_t memory = numberOfNodes() * sizeof(SgOmpCancellationPointStatement);
100528 :
100529 0 : return memory;
100530 : }
100531 :
100532 : /* #line 100533 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
100533 :
100534 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
100535 : void
100536 5342 : SgOmpTargetUpdateStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
100537 : {
100538 : // This function traverses the memory pool for only a specific IR node
100539 : // and calls the visit function of the input class execute a traversal
100540 : // similar to the style of the attribute based traversals within ROSE.
100541 : // This traversal will visit ALL nodes of the AST where as the other
100542 : // attribute based traversals visit only the embedded tree within the AST.
100543 :
100544 : // Initialize array to the address of the first element of the STL vector
100545 : // (which is guaranteed to be contiguous storage).
100546 : // SgOmpTargetUpdateStatement objectArray [] = *(Memory_Block_List.begin());
100547 5342 : if (SgOmpTargetUpdateStatement::pools.empty() == false)
100548 : {
100549 : // Generate an array of memory pools
100550 35 : SgOmpTargetUpdateStatement** objectArray = (SgOmpTargetUpdateStatement**) &(SgOmpTargetUpdateStatement::pools[0]);
100551 :
100552 : // Build a local variable for better performance
100553 35 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
100554 : #if 0
100555 : // Iterate over the memory pools
100556 : for (unsigned int i=0; i < SgOmpTargetUpdateStatement::pools.size(); i++)
100557 : {
100558 : // objectArray[i] is a single memory pool
100559 : for (int j=0; j < SgOmpTargetUpdateStatement::pool_size; j++)
100560 : {
100561 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
100562 : {
100563 : traversal.visit(&(objectArray[i][j]));
100564 : }
100565 : }
100566 : }
100567 : #else
100568 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
100569 : // compute the list first and then call the visit function on each list element.
100570 :
100571 : // printf ("Inside of SgOmpTargetUpdateStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
100572 :
100573 70 : std::vector<SgOmpTargetUpdateStatement*> nodeList;
100574 :
100575 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
100576 70 : for (unsigned int i=0; i < SgOmpTargetUpdateStatement::pools.size(); i++)
100577 : {
100578 : // objectArray[i] is a single memory pool
100579 70035 : for (unsigned j=0; j < SgOmpTargetUpdateStatement::pool_size; j++)
100580 : {
100581 70000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
100582 : {
100583 35 : nodeList.push_back(&(objectArray[i][j]));
100584 : }
100585 : }
100586 : }
100587 :
100588 : // Iterate over the saved list
100589 35 : size_t nodeListSize = nodeList.size();
100590 70 : for (size_t i=0; i < nodeListSize; i++)
100591 : {
100592 35 : ROSE_ASSERT(nodeList[i] != NULL);
100593 : #if 0
100594 : traversal.visit(nodeList[i]);
100595 : #else
100596 35 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
100597 : {
100598 35 : traversal.visit(nodeList[i]);
100599 : }
100600 : #endif
100601 : }
100602 : #endif
100603 : }
100604 :
100605 : // This should not be required since all previously static data members are
100606 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
100607 :
100608 5342 : }
100609 :
100610 :
100611 : void
100612 194 : SgOmpTargetUpdateStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
100613 : {
100614 : // This function traverses the memory pool for an IR node and
100615 : // calls the function to execute the visitor object.
100616 :
100617 : // Initialize array to the address of the first element of the STL vector
100618 : // (which is guarenteed to be contiguous storage).
100619 : // SgOmpTargetUpdateStatement objectArray [] = *(Memory_Block_List.begin());
100620 194 : if (SgOmpTargetUpdateStatement::pools.empty() == false)
100621 : {
100622 : // Generate an array of memory pools
100623 0 : SgOmpTargetUpdateStatement** objectArray = (SgOmpTargetUpdateStatement**) &(SgOmpTargetUpdateStatement::pools[0]);
100624 :
100625 : // Build a local variable for better performance
100626 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
100627 :
100628 : // Iterate over the memory pools
100629 0 : for (unsigned int i=0; i < SgOmpTargetUpdateStatement::pools.size(); i++)
100630 : {
100631 : // objectArray[i] is a single memory pool
100632 0 : for (unsigned j=0; j < SgOmpTargetUpdateStatement::pool_size; j++)
100633 : {
100634 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
100635 : {
100636 : // printf ("Found a valid SgOmpTargetUpdateStatement object in the memory pool %d at position %d \n",i,j);
100637 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
100638 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
100639 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
100640 : }
100641 : else
100642 : {
100643 : // printf ("Found a INVALID SgOmpTargetUpdateStatement object in the memory pool \n");
100644 : }
100645 : }
100646 : }
100647 : }
100648 :
100649 : // This should not be required since all previously static data members are
100650 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
100651 :
100652 194 : }
100653 :
100654 : void
100655 0 : SgOmpTargetUpdateStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
100656 : {
100657 : // This function visits only a single IR node of the memory pool.
100658 : // it is typically called once for each type of IR node within
100659 : // the automatically generated function: traverseRepresentativeNodes().
100660 :
100661 : // Initialize array to the address of the first element of the STL vector
100662 : // (which is guarenteed to be contiguous storage).
100663 : // SgOmpTargetUpdateStatement objectArray [] = *(Memory_Block_List.begin());
100664 0 : if (SgOmpTargetUpdateStatement::pools.empty() == false)
100665 : {
100666 : // Generate an array of memory pools
100667 0 : SgOmpTargetUpdateStatement** objectArray = (SgOmpTargetUpdateStatement**) &(SgOmpTargetUpdateStatement::pools[0]);
100668 :
100669 : // Build a local variable for better performance
100670 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
100671 :
100672 : // Iterate over the memory pools
100673 0 : bool done = false;
100674 0 : unsigned i=0;
100675 :
100676 : // find the first valid IR node, call visit function, and then leave
100677 0 : while ( done == false && i < SgOmpTargetUpdateStatement::pools.size() )
100678 : {
100679 : // objectArray[i] is a single memory pool
100680 : unsigned j=0;
100681 0 : while (done == false && j < SgOmpTargetUpdateStatement::pool_size)
100682 : {
100683 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
100684 : {
100685 0 : traversal.visit(&(objectArray[i][j]));
100686 0 : done = true;
100687 : }
100688 0 : j++;
100689 : }
100690 0 : i++;
100691 : }
100692 :
100693 : #if 0
100694 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
100695 : if (done == false)
100696 : {
100697 : printf ("No representative for SgOmpTargetUpdateStatement found in memory pools \n");
100698 : }
100699 : #endif
100700 : }
100701 0 : }
100702 :
100703 :
100704 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
100705 : // using values that overflow signed values of int.
100706 : size_t
100707 4 : SgOmpTargetUpdateStatement::numberOfNodes()
100708 : {
100709 : // This function traverses the memory pool for an IR node and
100710 : // counts the number of IR nodes of a particular Sage III IR
100711 : // nodes type.
100712 :
100713 4 : size_t count = 0;
100714 4 : if (SgOmpTargetUpdateStatement::pools.empty() == false)
100715 : {
100716 : // Generate an array of memory pools (this is actually a STL vector,
100717 : // but it is contiguious, so OK to treat this way).
100718 0 : SgOmpTargetUpdateStatement** objectArray = (SgOmpTargetUpdateStatement**) &(SgOmpTargetUpdateStatement::pools[0]);
100719 :
100720 : // Build a local variable for better performance (make it a loop invariant variable).
100721 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
100722 :
100723 : // Iterate over all of the memory pools for this IR node.
100724 0 : for (unsigned int i=0; i < SgOmpTargetUpdateStatement::pools.size(); i++)
100725 : {
100726 : // objectArray[i] is a single memory pool, iterate over all the
100727 : // IR nodes and only count those that are valid IR nodes used in
100728 : // the AST (i.e. allocated IR nodes).
100729 0 : for (unsigned j=0; j < SgOmpTargetUpdateStatement::pool_size; j++)
100730 : {
100731 : // This is indexing the STL vector of C/C++ style arrays as a doubly
100732 : // indexed array access. It is OK since we have leveraged the semantics
100733 : // of STL vector memory as contigous and cast the memory as an array
100734 : // of arrays to use the 2D array indexing. Hope this is not confusing,
100735 : // but it s very fast as an implementation.
100736 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
100737 : {
100738 0 : count++;
100739 : }
100740 : }
100741 : }
100742 : }
100743 :
100744 :
100745 :
100746 4 : return count;
100747 : }
100748 :
100749 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
100750 : // using values that overflow signed values of int.
100751 : size_t
100752 0 : SgOmpTargetUpdateStatement::memoryUsage()
100753 : {
100754 : // This function is required because we need the class name as a type when we call sizeof
100755 : // There might be another way to implement this if we have a traversal that only called a
100756 : // representative object (one call for each type of Sage IIIIR node).
100757 0 : size_t memory = numberOfNodes() * sizeof(SgOmpTargetUpdateStatement);
100758 :
100759 0 : return memory;
100760 : }
100761 :
100762 : /* #line 100763 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
100763 :
100764 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
100765 : void
100766 5342 : SgOmpFlushStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
100767 : {
100768 : // This function traverses the memory pool for only a specific IR node
100769 : // and calls the visit function of the input class execute a traversal
100770 : // similar to the style of the attribute based traversals within ROSE.
100771 : // This traversal will visit ALL nodes of the AST where as the other
100772 : // attribute based traversals visit only the embedded tree within the AST.
100773 :
100774 : // Initialize array to the address of the first element of the STL vector
100775 : // (which is guaranteed to be contiguous storage).
100776 : // SgOmpFlushStatement objectArray [] = *(Memory_Block_List.begin());
100777 5342 : if (SgOmpFlushStatement::pools.empty() == false)
100778 : {
100779 : // Generate an array of memory pools
100780 28 : SgOmpFlushStatement** objectArray = (SgOmpFlushStatement**) &(SgOmpFlushStatement::pools[0]);
100781 :
100782 : // Build a local variable for better performance
100783 28 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
100784 : #if 0
100785 : // Iterate over the memory pools
100786 : for (unsigned int i=0; i < SgOmpFlushStatement::pools.size(); i++)
100787 : {
100788 : // objectArray[i] is a single memory pool
100789 : for (int j=0; j < SgOmpFlushStatement::pool_size; j++)
100790 : {
100791 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
100792 : {
100793 : traversal.visit(&(objectArray[i][j]));
100794 : }
100795 : }
100796 : }
100797 : #else
100798 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
100799 : // compute the list first and then call the visit function on each list element.
100800 :
100801 : // printf ("Inside of SgOmpFlushStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
100802 :
100803 56 : std::vector<SgOmpFlushStatement*> nodeList;
100804 :
100805 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
100806 56 : for (unsigned int i=0; i < SgOmpFlushStatement::pools.size(); i++)
100807 : {
100808 : // objectArray[i] is a single memory pool
100809 56028 : for (unsigned j=0; j < SgOmpFlushStatement::pool_size; j++)
100810 : {
100811 56000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
100812 : {
100813 63 : nodeList.push_back(&(objectArray[i][j]));
100814 : }
100815 : }
100816 : }
100817 :
100818 : // Iterate over the saved list
100819 28 : size_t nodeListSize = nodeList.size();
100820 91 : for (size_t i=0; i < nodeListSize; i++)
100821 : {
100822 63 : ROSE_ASSERT(nodeList[i] != NULL);
100823 : #if 0
100824 : traversal.visit(nodeList[i]);
100825 : #else
100826 63 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
100827 : {
100828 63 : traversal.visit(nodeList[i]);
100829 : }
100830 : #endif
100831 : }
100832 : #endif
100833 : }
100834 :
100835 : // This should not be required since all previously static data members are
100836 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
100837 :
100838 5342 : }
100839 :
100840 :
100841 : void
100842 194 : SgOmpFlushStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
100843 : {
100844 : // This function traverses the memory pool for an IR node and
100845 : // calls the function to execute the visitor object.
100846 :
100847 : // Initialize array to the address of the first element of the STL vector
100848 : // (which is guarenteed to be contiguous storage).
100849 : // SgOmpFlushStatement objectArray [] = *(Memory_Block_List.begin());
100850 194 : if (SgOmpFlushStatement::pools.empty() == false)
100851 : {
100852 : // Generate an array of memory pools
100853 0 : SgOmpFlushStatement** objectArray = (SgOmpFlushStatement**) &(SgOmpFlushStatement::pools[0]);
100854 :
100855 : // Build a local variable for better performance
100856 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
100857 :
100858 : // Iterate over the memory pools
100859 0 : for (unsigned int i=0; i < SgOmpFlushStatement::pools.size(); i++)
100860 : {
100861 : // objectArray[i] is a single memory pool
100862 0 : for (unsigned j=0; j < SgOmpFlushStatement::pool_size; j++)
100863 : {
100864 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
100865 : {
100866 : // printf ("Found a valid SgOmpFlushStatement object in the memory pool %d at position %d \n",i,j);
100867 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
100868 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
100869 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
100870 : }
100871 : else
100872 : {
100873 : // printf ("Found a INVALID SgOmpFlushStatement object in the memory pool \n");
100874 : }
100875 : }
100876 : }
100877 : }
100878 :
100879 : // This should not be required since all previously static data members are
100880 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
100881 :
100882 194 : }
100883 :
100884 : void
100885 0 : SgOmpFlushStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
100886 : {
100887 : // This function visits only a single IR node of the memory pool.
100888 : // it is typically called once for each type of IR node within
100889 : // the automatically generated function: traverseRepresentativeNodes().
100890 :
100891 : // Initialize array to the address of the first element of the STL vector
100892 : // (which is guarenteed to be contiguous storage).
100893 : // SgOmpFlushStatement objectArray [] = *(Memory_Block_List.begin());
100894 0 : if (SgOmpFlushStatement::pools.empty() == false)
100895 : {
100896 : // Generate an array of memory pools
100897 0 : SgOmpFlushStatement** objectArray = (SgOmpFlushStatement**) &(SgOmpFlushStatement::pools[0]);
100898 :
100899 : // Build a local variable for better performance
100900 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
100901 :
100902 : // Iterate over the memory pools
100903 0 : bool done = false;
100904 0 : unsigned i=0;
100905 :
100906 : // find the first valid IR node, call visit function, and then leave
100907 0 : while ( done == false && i < SgOmpFlushStatement::pools.size() )
100908 : {
100909 : // objectArray[i] is a single memory pool
100910 : unsigned j=0;
100911 0 : while (done == false && j < SgOmpFlushStatement::pool_size)
100912 : {
100913 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
100914 : {
100915 0 : traversal.visit(&(objectArray[i][j]));
100916 0 : done = true;
100917 : }
100918 0 : j++;
100919 : }
100920 0 : i++;
100921 : }
100922 :
100923 : #if 0
100924 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
100925 : if (done == false)
100926 : {
100927 : printf ("No representative for SgOmpFlushStatement found in memory pools \n");
100928 : }
100929 : #endif
100930 : }
100931 0 : }
100932 :
100933 :
100934 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
100935 : // using values that overflow signed values of int.
100936 : size_t
100937 4 : SgOmpFlushStatement::numberOfNodes()
100938 : {
100939 : // This function traverses the memory pool for an IR node and
100940 : // counts the number of IR nodes of a particular Sage III IR
100941 : // nodes type.
100942 :
100943 4 : size_t count = 0;
100944 4 : if (SgOmpFlushStatement::pools.empty() == false)
100945 : {
100946 : // Generate an array of memory pools (this is actually a STL vector,
100947 : // but it is contiguious, so OK to treat this way).
100948 0 : SgOmpFlushStatement** objectArray = (SgOmpFlushStatement**) &(SgOmpFlushStatement::pools[0]);
100949 :
100950 : // Build a local variable for better performance (make it a loop invariant variable).
100951 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
100952 :
100953 : // Iterate over all of the memory pools for this IR node.
100954 0 : for (unsigned int i=0; i < SgOmpFlushStatement::pools.size(); i++)
100955 : {
100956 : // objectArray[i] is a single memory pool, iterate over all the
100957 : // IR nodes and only count those that are valid IR nodes used in
100958 : // the AST (i.e. allocated IR nodes).
100959 0 : for (unsigned j=0; j < SgOmpFlushStatement::pool_size; j++)
100960 : {
100961 : // This is indexing the STL vector of C/C++ style arrays as a doubly
100962 : // indexed array access. It is OK since we have leveraged the semantics
100963 : // of STL vector memory as contigous and cast the memory as an array
100964 : // of arrays to use the 2D array indexing. Hope this is not confusing,
100965 : // but it s very fast as an implementation.
100966 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
100967 : {
100968 0 : count++;
100969 : }
100970 : }
100971 : }
100972 : }
100973 :
100974 :
100975 :
100976 4 : return count;
100977 : }
100978 :
100979 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
100980 : // using values that overflow signed values of int.
100981 : size_t
100982 0 : SgOmpFlushStatement::memoryUsage()
100983 : {
100984 : // This function is required because we need the class name as a type when we call sizeof
100985 : // There might be another way to implement this if we have a traversal that only called a
100986 : // representative object (one call for each type of Sage IIIIR node).
100987 0 : size_t memory = numberOfNodes() * sizeof(SgOmpFlushStatement);
100988 :
100989 0 : return memory;
100990 : }
100991 :
100992 : /* #line 100993 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
100993 :
100994 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
100995 : void
100996 5342 : SgOmpAllocateStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
100997 : {
100998 : // This function traverses the memory pool for only a specific IR node
100999 : // and calls the visit function of the input class execute a traversal
101000 : // similar to the style of the attribute based traversals within ROSE.
101001 : // This traversal will visit ALL nodes of the AST where as the other
101002 : // attribute based traversals visit only the embedded tree within the AST.
101003 :
101004 : // Initialize array to the address of the first element of the STL vector
101005 : // (which is guaranteed to be contiguous storage).
101006 : // SgOmpAllocateStatement objectArray [] = *(Memory_Block_List.begin());
101007 5342 : if (SgOmpAllocateStatement::pools.empty() == false)
101008 : {
101009 : // Generate an array of memory pools
101010 7 : SgOmpAllocateStatement** objectArray = (SgOmpAllocateStatement**) &(SgOmpAllocateStatement::pools[0]);
101011 :
101012 : // Build a local variable for better performance
101013 7 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
101014 : #if 0
101015 : // Iterate over the memory pools
101016 : for (unsigned int i=0; i < SgOmpAllocateStatement::pools.size(); i++)
101017 : {
101018 : // objectArray[i] is a single memory pool
101019 : for (int j=0; j < SgOmpAllocateStatement::pool_size; j++)
101020 : {
101021 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
101022 : {
101023 : traversal.visit(&(objectArray[i][j]));
101024 : }
101025 : }
101026 : }
101027 : #else
101028 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
101029 : // compute the list first and then call the visit function on each list element.
101030 :
101031 : // printf ("Inside of SgOmpAllocateStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
101032 :
101033 14 : std::vector<SgOmpAllocateStatement*> nodeList;
101034 :
101035 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
101036 14 : for (unsigned int i=0; i < SgOmpAllocateStatement::pools.size(); i++)
101037 : {
101038 : // objectArray[i] is a single memory pool
101039 14007 : for (unsigned j=0; j < SgOmpAllocateStatement::pool_size; j++)
101040 : {
101041 14000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
101042 : {
101043 7 : nodeList.push_back(&(objectArray[i][j]));
101044 : }
101045 : }
101046 : }
101047 :
101048 : // Iterate over the saved list
101049 7 : size_t nodeListSize = nodeList.size();
101050 14 : for (size_t i=0; i < nodeListSize; i++)
101051 : {
101052 7 : ROSE_ASSERT(nodeList[i] != NULL);
101053 : #if 0
101054 : traversal.visit(nodeList[i]);
101055 : #else
101056 7 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
101057 : {
101058 7 : traversal.visit(nodeList[i]);
101059 : }
101060 : #endif
101061 : }
101062 : #endif
101063 : }
101064 :
101065 : // This should not be required since all previously static data members are
101066 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
101067 :
101068 5342 : }
101069 :
101070 :
101071 : void
101072 194 : SgOmpAllocateStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
101073 : {
101074 : // This function traverses the memory pool for an IR node and
101075 : // calls the function to execute the visitor object.
101076 :
101077 : // Initialize array to the address of the first element of the STL vector
101078 : // (which is guarenteed to be contiguous storage).
101079 : // SgOmpAllocateStatement objectArray [] = *(Memory_Block_List.begin());
101080 194 : if (SgOmpAllocateStatement::pools.empty() == false)
101081 : {
101082 : // Generate an array of memory pools
101083 0 : SgOmpAllocateStatement** objectArray = (SgOmpAllocateStatement**) &(SgOmpAllocateStatement::pools[0]);
101084 :
101085 : // Build a local variable for better performance
101086 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
101087 :
101088 : // Iterate over the memory pools
101089 0 : for (unsigned int i=0; i < SgOmpAllocateStatement::pools.size(); i++)
101090 : {
101091 : // objectArray[i] is a single memory pool
101092 0 : for (unsigned j=0; j < SgOmpAllocateStatement::pool_size; j++)
101093 : {
101094 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
101095 : {
101096 : // printf ("Found a valid SgOmpAllocateStatement object in the memory pool %d at position %d \n",i,j);
101097 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
101098 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
101099 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
101100 : }
101101 : else
101102 : {
101103 : // printf ("Found a INVALID SgOmpAllocateStatement object in the memory pool \n");
101104 : }
101105 : }
101106 : }
101107 : }
101108 :
101109 : // This should not be required since all previously static data members are
101110 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
101111 :
101112 194 : }
101113 :
101114 : void
101115 0 : SgOmpAllocateStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
101116 : {
101117 : // This function visits only a single IR node of the memory pool.
101118 : // it is typically called once for each type of IR node within
101119 : // the automatically generated function: traverseRepresentativeNodes().
101120 :
101121 : // Initialize array to the address of the first element of the STL vector
101122 : // (which is guarenteed to be contiguous storage).
101123 : // SgOmpAllocateStatement objectArray [] = *(Memory_Block_List.begin());
101124 0 : if (SgOmpAllocateStatement::pools.empty() == false)
101125 : {
101126 : // Generate an array of memory pools
101127 0 : SgOmpAllocateStatement** objectArray = (SgOmpAllocateStatement**) &(SgOmpAllocateStatement::pools[0]);
101128 :
101129 : // Build a local variable for better performance
101130 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
101131 :
101132 : // Iterate over the memory pools
101133 0 : bool done = false;
101134 0 : unsigned i=0;
101135 :
101136 : // find the first valid IR node, call visit function, and then leave
101137 0 : while ( done == false && i < SgOmpAllocateStatement::pools.size() )
101138 : {
101139 : // objectArray[i] is a single memory pool
101140 : unsigned j=0;
101141 0 : while (done == false && j < SgOmpAllocateStatement::pool_size)
101142 : {
101143 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
101144 : {
101145 0 : traversal.visit(&(objectArray[i][j]));
101146 0 : done = true;
101147 : }
101148 0 : j++;
101149 : }
101150 0 : i++;
101151 : }
101152 :
101153 : #if 0
101154 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
101155 : if (done == false)
101156 : {
101157 : printf ("No representative for SgOmpAllocateStatement found in memory pools \n");
101158 : }
101159 : #endif
101160 : }
101161 0 : }
101162 :
101163 :
101164 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
101165 : // using values that overflow signed values of int.
101166 : size_t
101167 4 : SgOmpAllocateStatement::numberOfNodes()
101168 : {
101169 : // This function traverses the memory pool for an IR node and
101170 : // counts the number of IR nodes of a particular Sage III IR
101171 : // nodes type.
101172 :
101173 4 : size_t count = 0;
101174 4 : if (SgOmpAllocateStatement::pools.empty() == false)
101175 : {
101176 : // Generate an array of memory pools (this is actually a STL vector,
101177 : // but it is contiguious, so OK to treat this way).
101178 0 : SgOmpAllocateStatement** objectArray = (SgOmpAllocateStatement**) &(SgOmpAllocateStatement::pools[0]);
101179 :
101180 : // Build a local variable for better performance (make it a loop invariant variable).
101181 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
101182 :
101183 : // Iterate over all of the memory pools for this IR node.
101184 0 : for (unsigned int i=0; i < SgOmpAllocateStatement::pools.size(); i++)
101185 : {
101186 : // objectArray[i] is a single memory pool, iterate over all the
101187 : // IR nodes and only count those that are valid IR nodes used in
101188 : // the AST (i.e. allocated IR nodes).
101189 0 : for (unsigned j=0; j < SgOmpAllocateStatement::pool_size; j++)
101190 : {
101191 : // This is indexing the STL vector of C/C++ style arrays as a doubly
101192 : // indexed array access. It is OK since we have leveraged the semantics
101193 : // of STL vector memory as contigous and cast the memory as an array
101194 : // of arrays to use the 2D array indexing. Hope this is not confusing,
101195 : // but it s very fast as an implementation.
101196 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
101197 : {
101198 0 : count++;
101199 : }
101200 : }
101201 : }
101202 : }
101203 :
101204 :
101205 :
101206 4 : return count;
101207 : }
101208 :
101209 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
101210 : // using values that overflow signed values of int.
101211 : size_t
101212 0 : SgOmpAllocateStatement::memoryUsage()
101213 : {
101214 : // This function is required because we need the class name as a type when we call sizeof
101215 : // There might be another way to implement this if we have a traversal that only called a
101216 : // representative object (one call for each type of Sage IIIIR node).
101217 0 : size_t memory = numberOfNodes() * sizeof(SgOmpAllocateStatement);
101218 :
101219 0 : return memory;
101220 : }
101221 :
101222 : /* #line 101223 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
101223 :
101224 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
101225 : void
101226 5342 : SgOmpOrderedDependStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
101227 : {
101228 : // This function traverses the memory pool for only a specific IR node
101229 : // and calls the visit function of the input class execute a traversal
101230 : // similar to the style of the attribute based traversals within ROSE.
101231 : // This traversal will visit ALL nodes of the AST where as the other
101232 : // attribute based traversals visit only the embedded tree within the AST.
101233 :
101234 : // Initialize array to the address of the first element of the STL vector
101235 : // (which is guaranteed to be contiguous storage).
101236 : // SgOmpOrderedDependStatement objectArray [] = *(Memory_Block_List.begin());
101237 5342 : if (SgOmpOrderedDependStatement::pools.empty() == false)
101238 : {
101239 : // Generate an array of memory pools
101240 7 : SgOmpOrderedDependStatement** objectArray = (SgOmpOrderedDependStatement**) &(SgOmpOrderedDependStatement::pools[0]);
101241 :
101242 : // Build a local variable for better performance
101243 7 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
101244 : #if 0
101245 : // Iterate over the memory pools
101246 : for (unsigned int i=0; i < SgOmpOrderedDependStatement::pools.size(); i++)
101247 : {
101248 : // objectArray[i] is a single memory pool
101249 : for (int j=0; j < SgOmpOrderedDependStatement::pool_size; j++)
101250 : {
101251 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
101252 : {
101253 : traversal.visit(&(objectArray[i][j]));
101254 : }
101255 : }
101256 : }
101257 : #else
101258 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
101259 : // compute the list first and then call the visit function on each list element.
101260 :
101261 : // printf ("Inside of SgOmpOrderedDependStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
101262 :
101263 14 : std::vector<SgOmpOrderedDependStatement*> nodeList;
101264 :
101265 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
101266 14 : for (unsigned int i=0; i < SgOmpOrderedDependStatement::pools.size(); i++)
101267 : {
101268 : // objectArray[i] is a single memory pool
101269 14007 : for (unsigned j=0; j < SgOmpOrderedDependStatement::pool_size; j++)
101270 : {
101271 14000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
101272 : {
101273 14 : nodeList.push_back(&(objectArray[i][j]));
101274 : }
101275 : }
101276 : }
101277 :
101278 : // Iterate over the saved list
101279 7 : size_t nodeListSize = nodeList.size();
101280 21 : for (size_t i=0; i < nodeListSize; i++)
101281 : {
101282 14 : ROSE_ASSERT(nodeList[i] != NULL);
101283 : #if 0
101284 : traversal.visit(nodeList[i]);
101285 : #else
101286 14 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
101287 : {
101288 14 : traversal.visit(nodeList[i]);
101289 : }
101290 : #endif
101291 : }
101292 : #endif
101293 : }
101294 :
101295 : // This should not be required since all previously static data members are
101296 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
101297 :
101298 5342 : }
101299 :
101300 :
101301 : void
101302 194 : SgOmpOrderedDependStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
101303 : {
101304 : // This function traverses the memory pool for an IR node and
101305 : // calls the function to execute the visitor object.
101306 :
101307 : // Initialize array to the address of the first element of the STL vector
101308 : // (which is guarenteed to be contiguous storage).
101309 : // SgOmpOrderedDependStatement objectArray [] = *(Memory_Block_List.begin());
101310 194 : if (SgOmpOrderedDependStatement::pools.empty() == false)
101311 : {
101312 : // Generate an array of memory pools
101313 0 : SgOmpOrderedDependStatement** objectArray = (SgOmpOrderedDependStatement**) &(SgOmpOrderedDependStatement::pools[0]);
101314 :
101315 : // Build a local variable for better performance
101316 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
101317 :
101318 : // Iterate over the memory pools
101319 0 : for (unsigned int i=0; i < SgOmpOrderedDependStatement::pools.size(); i++)
101320 : {
101321 : // objectArray[i] is a single memory pool
101322 0 : for (unsigned j=0; j < SgOmpOrderedDependStatement::pool_size; j++)
101323 : {
101324 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
101325 : {
101326 : // printf ("Found a valid SgOmpOrderedDependStatement object in the memory pool %d at position %d \n",i,j);
101327 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
101328 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
101329 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
101330 : }
101331 : else
101332 : {
101333 : // printf ("Found a INVALID SgOmpOrderedDependStatement object in the memory pool \n");
101334 : }
101335 : }
101336 : }
101337 : }
101338 :
101339 : // This should not be required since all previously static data members are
101340 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
101341 :
101342 194 : }
101343 :
101344 : void
101345 0 : SgOmpOrderedDependStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
101346 : {
101347 : // This function visits only a single IR node of the memory pool.
101348 : // it is typically called once for each type of IR node within
101349 : // the automatically generated function: traverseRepresentativeNodes().
101350 :
101351 : // Initialize array to the address of the first element of the STL vector
101352 : // (which is guarenteed to be contiguous storage).
101353 : // SgOmpOrderedDependStatement objectArray [] = *(Memory_Block_List.begin());
101354 0 : if (SgOmpOrderedDependStatement::pools.empty() == false)
101355 : {
101356 : // Generate an array of memory pools
101357 0 : SgOmpOrderedDependStatement** objectArray = (SgOmpOrderedDependStatement**) &(SgOmpOrderedDependStatement::pools[0]);
101358 :
101359 : // Build a local variable for better performance
101360 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
101361 :
101362 : // Iterate over the memory pools
101363 0 : bool done = false;
101364 0 : unsigned i=0;
101365 :
101366 : // find the first valid IR node, call visit function, and then leave
101367 0 : while ( done == false && i < SgOmpOrderedDependStatement::pools.size() )
101368 : {
101369 : // objectArray[i] is a single memory pool
101370 : unsigned j=0;
101371 0 : while (done == false && j < SgOmpOrderedDependStatement::pool_size)
101372 : {
101373 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
101374 : {
101375 0 : traversal.visit(&(objectArray[i][j]));
101376 0 : done = true;
101377 : }
101378 0 : j++;
101379 : }
101380 0 : i++;
101381 : }
101382 :
101383 : #if 0
101384 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
101385 : if (done == false)
101386 : {
101387 : printf ("No representative for SgOmpOrderedDependStatement found in memory pools \n");
101388 : }
101389 : #endif
101390 : }
101391 0 : }
101392 :
101393 :
101394 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
101395 : // using values that overflow signed values of int.
101396 : size_t
101397 4 : SgOmpOrderedDependStatement::numberOfNodes()
101398 : {
101399 : // This function traverses the memory pool for an IR node and
101400 : // counts the number of IR nodes of a particular Sage III IR
101401 : // nodes type.
101402 :
101403 4 : size_t count = 0;
101404 4 : if (SgOmpOrderedDependStatement::pools.empty() == false)
101405 : {
101406 : // Generate an array of memory pools (this is actually a STL vector,
101407 : // but it is contiguious, so OK to treat this way).
101408 0 : SgOmpOrderedDependStatement** objectArray = (SgOmpOrderedDependStatement**) &(SgOmpOrderedDependStatement::pools[0]);
101409 :
101410 : // Build a local variable for better performance (make it a loop invariant variable).
101411 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
101412 :
101413 : // Iterate over all of the memory pools for this IR node.
101414 0 : for (unsigned int i=0; i < SgOmpOrderedDependStatement::pools.size(); i++)
101415 : {
101416 : // objectArray[i] is a single memory pool, iterate over all the
101417 : // IR nodes and only count those that are valid IR nodes used in
101418 : // the AST (i.e. allocated IR nodes).
101419 0 : for (unsigned j=0; j < SgOmpOrderedDependStatement::pool_size; j++)
101420 : {
101421 : // This is indexing the STL vector of C/C++ style arrays as a doubly
101422 : // indexed array access. It is OK since we have leveraged the semantics
101423 : // of STL vector memory as contigous and cast the memory as an array
101424 : // of arrays to use the 2D array indexing. Hope this is not confusing,
101425 : // but it s very fast as an implementation.
101426 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
101427 : {
101428 0 : count++;
101429 : }
101430 : }
101431 : }
101432 : }
101433 :
101434 :
101435 :
101436 4 : return count;
101437 : }
101438 :
101439 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
101440 : // using values that overflow signed values of int.
101441 : size_t
101442 0 : SgOmpOrderedDependStatement::memoryUsage()
101443 : {
101444 : // This function is required because we need the class name as a type when we call sizeof
101445 : // There might be another way to implement this if we have a traversal that only called a
101446 : // representative object (one call for each type of Sage IIIIR node).
101447 0 : size_t memory = numberOfNodes() * sizeof(SgOmpOrderedDependStatement);
101448 :
101449 0 : return memory;
101450 : }
101451 :
101452 : /* #line 101453 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
101453 :
101454 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
101455 : void
101456 5342 : SgUpirSyncStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
101457 : {
101458 : // This function traverses the memory pool for only a specific IR node
101459 : // and calls the visit function of the input class execute a traversal
101460 : // similar to the style of the attribute based traversals within ROSE.
101461 : // This traversal will visit ALL nodes of the AST where as the other
101462 : // attribute based traversals visit only the embedded tree within the AST.
101463 :
101464 : // Initialize array to the address of the first element of the STL vector
101465 : // (which is guaranteed to be contiguous storage).
101466 : // SgUpirSyncStatement objectArray [] = *(Memory_Block_List.begin());
101467 5342 : if (SgUpirSyncStatement::pools.empty() == false)
101468 : {
101469 : // Generate an array of memory pools
101470 0 : SgUpirSyncStatement** objectArray = (SgUpirSyncStatement**) &(SgUpirSyncStatement::pools[0]);
101471 :
101472 : // Build a local variable for better performance
101473 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
101474 : #if 0
101475 : // Iterate over the memory pools
101476 : for (unsigned int i=0; i < SgUpirSyncStatement::pools.size(); i++)
101477 : {
101478 : // objectArray[i] is a single memory pool
101479 : for (int j=0; j < SgUpirSyncStatement::pool_size; j++)
101480 : {
101481 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
101482 : {
101483 : traversal.visit(&(objectArray[i][j]));
101484 : }
101485 : }
101486 : }
101487 : #else
101488 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
101489 : // compute the list first and then call the visit function on each list element.
101490 :
101491 : // printf ("Inside of SgUpirSyncStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
101492 :
101493 0 : std::vector<SgUpirSyncStatement*> nodeList;
101494 :
101495 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
101496 0 : for (unsigned int i=0; i < SgUpirSyncStatement::pools.size(); i++)
101497 : {
101498 : // objectArray[i] is a single memory pool
101499 0 : for (unsigned j=0; j < SgUpirSyncStatement::pool_size; j++)
101500 : {
101501 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
101502 : {
101503 0 : nodeList.push_back(&(objectArray[i][j]));
101504 : }
101505 : }
101506 : }
101507 :
101508 : // Iterate over the saved list
101509 0 : size_t nodeListSize = nodeList.size();
101510 0 : for (size_t i=0; i < nodeListSize; i++)
101511 : {
101512 0 : ROSE_ASSERT(nodeList[i] != NULL);
101513 : #if 0
101514 : traversal.visit(nodeList[i]);
101515 : #else
101516 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
101517 : {
101518 0 : traversal.visit(nodeList[i]);
101519 : }
101520 : #endif
101521 : }
101522 : #endif
101523 : }
101524 :
101525 : // This should not be required since all previously static data members are
101526 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
101527 :
101528 5342 : }
101529 :
101530 :
101531 : void
101532 194 : SgUpirSyncStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
101533 : {
101534 : // This function traverses the memory pool for an IR node and
101535 : // calls the function to execute the visitor object.
101536 :
101537 : // Initialize array to the address of the first element of the STL vector
101538 : // (which is guarenteed to be contiguous storage).
101539 : // SgUpirSyncStatement objectArray [] = *(Memory_Block_List.begin());
101540 194 : if (SgUpirSyncStatement::pools.empty() == false)
101541 : {
101542 : // Generate an array of memory pools
101543 0 : SgUpirSyncStatement** objectArray = (SgUpirSyncStatement**) &(SgUpirSyncStatement::pools[0]);
101544 :
101545 : // Build a local variable for better performance
101546 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
101547 :
101548 : // Iterate over the memory pools
101549 0 : for (unsigned int i=0; i < SgUpirSyncStatement::pools.size(); i++)
101550 : {
101551 : // objectArray[i] is a single memory pool
101552 0 : for (unsigned j=0; j < SgUpirSyncStatement::pool_size; j++)
101553 : {
101554 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
101555 : {
101556 : // printf ("Found a valid SgUpirSyncStatement object in the memory pool %d at position %d \n",i,j);
101557 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
101558 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
101559 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
101560 : }
101561 : else
101562 : {
101563 : // printf ("Found a INVALID SgUpirSyncStatement object in the memory pool \n");
101564 : }
101565 : }
101566 : }
101567 : }
101568 :
101569 : // This should not be required since all previously static data members are
101570 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
101571 :
101572 194 : }
101573 :
101574 : void
101575 0 : SgUpirSyncStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
101576 : {
101577 : // This function visits only a single IR node of the memory pool.
101578 : // it is typically called once for each type of IR node within
101579 : // the automatically generated function: traverseRepresentativeNodes().
101580 :
101581 : // Initialize array to the address of the first element of the STL vector
101582 : // (which is guarenteed to be contiguous storage).
101583 : // SgUpirSyncStatement objectArray [] = *(Memory_Block_List.begin());
101584 0 : if (SgUpirSyncStatement::pools.empty() == false)
101585 : {
101586 : // Generate an array of memory pools
101587 0 : SgUpirSyncStatement** objectArray = (SgUpirSyncStatement**) &(SgUpirSyncStatement::pools[0]);
101588 :
101589 : // Build a local variable for better performance
101590 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
101591 :
101592 : // Iterate over the memory pools
101593 0 : bool done = false;
101594 0 : unsigned i=0;
101595 :
101596 : // find the first valid IR node, call visit function, and then leave
101597 0 : while ( done == false && i < SgUpirSyncStatement::pools.size() )
101598 : {
101599 : // objectArray[i] is a single memory pool
101600 : unsigned j=0;
101601 0 : while (done == false && j < SgUpirSyncStatement::pool_size)
101602 : {
101603 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
101604 : {
101605 0 : traversal.visit(&(objectArray[i][j]));
101606 0 : done = true;
101607 : }
101608 0 : j++;
101609 : }
101610 0 : i++;
101611 : }
101612 :
101613 : #if 0
101614 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
101615 : if (done == false)
101616 : {
101617 : printf ("No representative for SgUpirSyncStatement found in memory pools \n");
101618 : }
101619 : #endif
101620 : }
101621 0 : }
101622 :
101623 :
101624 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
101625 : // using values that overflow signed values of int.
101626 : size_t
101627 4 : SgUpirSyncStatement::numberOfNodes()
101628 : {
101629 : // This function traverses the memory pool for an IR node and
101630 : // counts the number of IR nodes of a particular Sage III IR
101631 : // nodes type.
101632 :
101633 4 : size_t count = 0;
101634 4 : if (SgUpirSyncStatement::pools.empty() == false)
101635 : {
101636 : // Generate an array of memory pools (this is actually a STL vector,
101637 : // but it is contiguious, so OK to treat this way).
101638 0 : SgUpirSyncStatement** objectArray = (SgUpirSyncStatement**) &(SgUpirSyncStatement::pools[0]);
101639 :
101640 : // Build a local variable for better performance (make it a loop invariant variable).
101641 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
101642 :
101643 : // Iterate over all of the memory pools for this IR node.
101644 0 : for (unsigned int i=0; i < SgUpirSyncStatement::pools.size(); i++)
101645 : {
101646 : // objectArray[i] is a single memory pool, iterate over all the
101647 : // IR nodes and only count those that are valid IR nodes used in
101648 : // the AST (i.e. allocated IR nodes).
101649 0 : for (unsigned j=0; j < SgUpirSyncStatement::pool_size; j++)
101650 : {
101651 : // This is indexing the STL vector of C/C++ style arrays as a doubly
101652 : // indexed array access. It is OK since we have leveraged the semantics
101653 : // of STL vector memory as contigous and cast the memory as an array
101654 : // of arrays to use the 2D array indexing. Hope this is not confusing,
101655 : // but it s very fast as an implementation.
101656 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
101657 : {
101658 0 : count++;
101659 : }
101660 : }
101661 : }
101662 : }
101663 :
101664 :
101665 :
101666 4 : return count;
101667 : }
101668 :
101669 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
101670 : // using values that overflow signed values of int.
101671 : size_t
101672 0 : SgUpirSyncStatement::memoryUsage()
101673 : {
101674 : // This function is required because we need the class name as a type when we call sizeof
101675 : // There might be another way to implement this if we have a traversal that only called a
101676 : // representative object (one call for each type of Sage IIIIR node).
101677 0 : size_t memory = numberOfNodes() * sizeof(SgUpirSyncStatement);
101678 :
101679 0 : return memory;
101680 : }
101681 :
101682 : /* #line 101683 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
101683 :
101684 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
101685 : void
101686 5342 : SgUpirLoopParallelStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
101687 : {
101688 : // This function traverses the memory pool for only a specific IR node
101689 : // and calls the visit function of the input class execute a traversal
101690 : // similar to the style of the attribute based traversals within ROSE.
101691 : // This traversal will visit ALL nodes of the AST where as the other
101692 : // attribute based traversals visit only the embedded tree within the AST.
101693 :
101694 : // Initialize array to the address of the first element of the STL vector
101695 : // (which is guaranteed to be contiguous storage).
101696 : // SgUpirLoopParallelStatement objectArray [] = *(Memory_Block_List.begin());
101697 5342 : if (SgUpirLoopParallelStatement::pools.empty() == false)
101698 : {
101699 : // Generate an array of memory pools
101700 637 : SgUpirLoopParallelStatement** objectArray = (SgUpirLoopParallelStatement**) &(SgUpirLoopParallelStatement::pools[0]);
101701 :
101702 : // Build a local variable for better performance
101703 637 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
101704 : #if 0
101705 : // Iterate over the memory pools
101706 : for (unsigned int i=0; i < SgUpirLoopParallelStatement::pools.size(); i++)
101707 : {
101708 : // objectArray[i] is a single memory pool
101709 : for (int j=0; j < SgUpirLoopParallelStatement::pool_size; j++)
101710 : {
101711 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
101712 : {
101713 : traversal.visit(&(objectArray[i][j]));
101714 : }
101715 : }
101716 : }
101717 : #else
101718 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
101719 : // compute the list first and then call the visit function on each list element.
101720 :
101721 : // printf ("Inside of SgUpirLoopParallelStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
101722 :
101723 1274 : std::vector<SgUpirLoopParallelStatement*> nodeList;
101724 :
101725 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
101726 1274 : for (unsigned int i=0; i < SgUpirLoopParallelStatement::pools.size(); i++)
101727 : {
101728 : // objectArray[i] is a single memory pool
101729 1274640 : for (unsigned j=0; j < SgUpirLoopParallelStatement::pool_size; j++)
101730 : {
101731 1274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
101732 : {
101733 1393 : nodeList.push_back(&(objectArray[i][j]));
101734 : }
101735 : }
101736 : }
101737 :
101738 : // Iterate over the saved list
101739 637 : size_t nodeListSize = nodeList.size();
101740 2030 : for (size_t i=0; i < nodeListSize; i++)
101741 : {
101742 1393 : ROSE_ASSERT(nodeList[i] != NULL);
101743 : #if 0
101744 : traversal.visit(nodeList[i]);
101745 : #else
101746 1393 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
101747 : {
101748 1393 : traversal.visit(nodeList[i]);
101749 : }
101750 : #endif
101751 : }
101752 : #endif
101753 : }
101754 :
101755 : // This should not be required since all previously static data members are
101756 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
101757 :
101758 5342 : }
101759 :
101760 :
101761 : void
101762 194 : SgUpirLoopParallelStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
101763 : {
101764 : // This function traverses the memory pool for an IR node and
101765 : // calls the function to execute the visitor object.
101766 :
101767 : // Initialize array to the address of the first element of the STL vector
101768 : // (which is guarenteed to be contiguous storage).
101769 : // SgUpirLoopParallelStatement objectArray [] = *(Memory_Block_List.begin());
101770 194 : if (SgUpirLoopParallelStatement::pools.empty() == false)
101771 : {
101772 : // Generate an array of memory pools
101773 0 : SgUpirLoopParallelStatement** objectArray = (SgUpirLoopParallelStatement**) &(SgUpirLoopParallelStatement::pools[0]);
101774 :
101775 : // Build a local variable for better performance
101776 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
101777 :
101778 : // Iterate over the memory pools
101779 0 : for (unsigned int i=0; i < SgUpirLoopParallelStatement::pools.size(); i++)
101780 : {
101781 : // objectArray[i] is a single memory pool
101782 0 : for (unsigned j=0; j < SgUpirLoopParallelStatement::pool_size; j++)
101783 : {
101784 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
101785 : {
101786 : // printf ("Found a valid SgUpirLoopParallelStatement object in the memory pool %d at position %d \n",i,j);
101787 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
101788 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
101789 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
101790 : }
101791 : else
101792 : {
101793 : // printf ("Found a INVALID SgUpirLoopParallelStatement object in the memory pool \n");
101794 : }
101795 : }
101796 : }
101797 : }
101798 :
101799 : // This should not be required since all previously static data members are
101800 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
101801 :
101802 194 : }
101803 :
101804 : void
101805 0 : SgUpirLoopParallelStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
101806 : {
101807 : // This function visits only a single IR node of the memory pool.
101808 : // it is typically called once for each type of IR node within
101809 : // the automatically generated function: traverseRepresentativeNodes().
101810 :
101811 : // Initialize array to the address of the first element of the STL vector
101812 : // (which is guarenteed to be contiguous storage).
101813 : // SgUpirLoopParallelStatement objectArray [] = *(Memory_Block_List.begin());
101814 0 : if (SgUpirLoopParallelStatement::pools.empty() == false)
101815 : {
101816 : // Generate an array of memory pools
101817 0 : SgUpirLoopParallelStatement** objectArray = (SgUpirLoopParallelStatement**) &(SgUpirLoopParallelStatement::pools[0]);
101818 :
101819 : // Build a local variable for better performance
101820 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
101821 :
101822 : // Iterate over the memory pools
101823 0 : bool done = false;
101824 0 : unsigned i=0;
101825 :
101826 : // find the first valid IR node, call visit function, and then leave
101827 0 : while ( done == false && i < SgUpirLoopParallelStatement::pools.size() )
101828 : {
101829 : // objectArray[i] is a single memory pool
101830 : unsigned j=0;
101831 0 : while (done == false && j < SgUpirLoopParallelStatement::pool_size)
101832 : {
101833 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
101834 : {
101835 0 : traversal.visit(&(objectArray[i][j]));
101836 0 : done = true;
101837 : }
101838 0 : j++;
101839 : }
101840 0 : i++;
101841 : }
101842 :
101843 : #if 0
101844 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
101845 : if (done == false)
101846 : {
101847 : printf ("No representative for SgUpirLoopParallelStatement found in memory pools \n");
101848 : }
101849 : #endif
101850 : }
101851 0 : }
101852 :
101853 :
101854 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
101855 : // using values that overflow signed values of int.
101856 : size_t
101857 4 : SgUpirLoopParallelStatement::numberOfNodes()
101858 : {
101859 : // This function traverses the memory pool for an IR node and
101860 : // counts the number of IR nodes of a particular Sage III IR
101861 : // nodes type.
101862 :
101863 4 : size_t count = 0;
101864 4 : if (SgUpirLoopParallelStatement::pools.empty() == false)
101865 : {
101866 : // Generate an array of memory pools (this is actually a STL vector,
101867 : // but it is contiguious, so OK to treat this way).
101868 0 : SgUpirLoopParallelStatement** objectArray = (SgUpirLoopParallelStatement**) &(SgUpirLoopParallelStatement::pools[0]);
101869 :
101870 : // Build a local variable for better performance (make it a loop invariant variable).
101871 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
101872 :
101873 : // Iterate over all of the memory pools for this IR node.
101874 0 : for (unsigned int i=0; i < SgUpirLoopParallelStatement::pools.size(); i++)
101875 : {
101876 : // objectArray[i] is a single memory pool, iterate over all the
101877 : // IR nodes and only count those that are valid IR nodes used in
101878 : // the AST (i.e. allocated IR nodes).
101879 0 : for (unsigned j=0; j < SgUpirLoopParallelStatement::pool_size; j++)
101880 : {
101881 : // This is indexing the STL vector of C/C++ style arrays as a doubly
101882 : // indexed array access. It is OK since we have leveraged the semantics
101883 : // of STL vector memory as contigous and cast the memory as an array
101884 : // of arrays to use the 2D array indexing. Hope this is not confusing,
101885 : // but it s very fast as an implementation.
101886 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
101887 : {
101888 0 : count++;
101889 : }
101890 : }
101891 : }
101892 : }
101893 :
101894 :
101895 :
101896 4 : return count;
101897 : }
101898 :
101899 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
101900 : // using values that overflow signed values of int.
101901 : size_t
101902 0 : SgUpirLoopParallelStatement::memoryUsage()
101903 : {
101904 : // This function is required because we need the class name as a type when we call sizeof
101905 : // There might be another way to implement this if we have a traversal that only called a
101906 : // representative object (one call for each type of Sage IIIIR node).
101907 0 : size_t memory = numberOfNodes() * sizeof(SgUpirLoopParallelStatement);
101908 :
101909 0 : return memory;
101910 : }
101911 :
101912 : /* #line 101913 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
101913 :
101914 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
101915 : void
101916 5342 : SgUpirWorksharingStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
101917 : {
101918 : // This function traverses the memory pool for only a specific IR node
101919 : // and calls the visit function of the input class execute a traversal
101920 : // similar to the style of the attribute based traversals within ROSE.
101921 : // This traversal will visit ALL nodes of the AST where as the other
101922 : // attribute based traversals visit only the embedded tree within the AST.
101923 :
101924 : // Initialize array to the address of the first element of the STL vector
101925 : // (which is guaranteed to be contiguous storage).
101926 : // SgUpirWorksharingStatement objectArray [] = *(Memory_Block_List.begin());
101927 5342 : if (SgUpirWorksharingStatement::pools.empty() == false)
101928 : {
101929 : // Generate an array of memory pools
101930 602 : SgUpirWorksharingStatement** objectArray = (SgUpirWorksharingStatement**) &(SgUpirWorksharingStatement::pools[0]);
101931 :
101932 : // Build a local variable for better performance
101933 602 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
101934 : #if 0
101935 : // Iterate over the memory pools
101936 : for (unsigned int i=0; i < SgUpirWorksharingStatement::pools.size(); i++)
101937 : {
101938 : // objectArray[i] is a single memory pool
101939 : for (int j=0; j < SgUpirWorksharingStatement::pool_size; j++)
101940 : {
101941 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
101942 : {
101943 : traversal.visit(&(objectArray[i][j]));
101944 : }
101945 : }
101946 : }
101947 : #else
101948 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
101949 : // compute the list first and then call the visit function on each list element.
101950 :
101951 : // printf ("Inside of SgUpirWorksharingStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
101952 :
101953 1204 : std::vector<SgUpirWorksharingStatement*> nodeList;
101954 :
101955 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
101956 1204 : for (unsigned int i=0; i < SgUpirWorksharingStatement::pools.size(); i++)
101957 : {
101958 : // objectArray[i] is a single memory pool
101959 1204600 : for (unsigned j=0; j < SgUpirWorksharingStatement::pool_size; j++)
101960 : {
101961 1204000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
101962 : {
101963 1295 : nodeList.push_back(&(objectArray[i][j]));
101964 : }
101965 : }
101966 : }
101967 :
101968 : // Iterate over the saved list
101969 602 : size_t nodeListSize = nodeList.size();
101970 1897 : for (size_t i=0; i < nodeListSize; i++)
101971 : {
101972 1295 : ROSE_ASSERT(nodeList[i] != NULL);
101973 : #if 0
101974 : traversal.visit(nodeList[i]);
101975 : #else
101976 1295 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
101977 : {
101978 1295 : traversal.visit(nodeList[i]);
101979 : }
101980 : #endif
101981 : }
101982 : #endif
101983 : }
101984 :
101985 : // This should not be required since all previously static data members are
101986 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
101987 :
101988 5342 : }
101989 :
101990 :
101991 : void
101992 194 : SgUpirWorksharingStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
101993 : {
101994 : // This function traverses the memory pool for an IR node and
101995 : // calls the function to execute the visitor object.
101996 :
101997 : // Initialize array to the address of the first element of the STL vector
101998 : // (which is guarenteed to be contiguous storage).
101999 : // SgUpirWorksharingStatement objectArray [] = *(Memory_Block_List.begin());
102000 194 : if (SgUpirWorksharingStatement::pools.empty() == false)
102001 : {
102002 : // Generate an array of memory pools
102003 0 : SgUpirWorksharingStatement** objectArray = (SgUpirWorksharingStatement**) &(SgUpirWorksharingStatement::pools[0]);
102004 :
102005 : // Build a local variable for better performance
102006 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
102007 :
102008 : // Iterate over the memory pools
102009 0 : for (unsigned int i=0; i < SgUpirWorksharingStatement::pools.size(); i++)
102010 : {
102011 : // objectArray[i] is a single memory pool
102012 0 : for (unsigned j=0; j < SgUpirWorksharingStatement::pool_size; j++)
102013 : {
102014 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
102015 : {
102016 : // printf ("Found a valid SgUpirWorksharingStatement object in the memory pool %d at position %d \n",i,j);
102017 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
102018 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
102019 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
102020 : }
102021 : else
102022 : {
102023 : // printf ("Found a INVALID SgUpirWorksharingStatement object in the memory pool \n");
102024 : }
102025 : }
102026 : }
102027 : }
102028 :
102029 : // This should not be required since all previously static data members are
102030 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
102031 :
102032 194 : }
102033 :
102034 : void
102035 0 : SgUpirWorksharingStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
102036 : {
102037 : // This function visits only a single IR node of the memory pool.
102038 : // it is typically called once for each type of IR node within
102039 : // the automatically generated function: traverseRepresentativeNodes().
102040 :
102041 : // Initialize array to the address of the first element of the STL vector
102042 : // (which is guarenteed to be contiguous storage).
102043 : // SgUpirWorksharingStatement objectArray [] = *(Memory_Block_List.begin());
102044 0 : if (SgUpirWorksharingStatement::pools.empty() == false)
102045 : {
102046 : // Generate an array of memory pools
102047 0 : SgUpirWorksharingStatement** objectArray = (SgUpirWorksharingStatement**) &(SgUpirWorksharingStatement::pools[0]);
102048 :
102049 : // Build a local variable for better performance
102050 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
102051 :
102052 : // Iterate over the memory pools
102053 0 : bool done = false;
102054 0 : unsigned i=0;
102055 :
102056 : // find the first valid IR node, call visit function, and then leave
102057 0 : while ( done == false && i < SgUpirWorksharingStatement::pools.size() )
102058 : {
102059 : // objectArray[i] is a single memory pool
102060 : unsigned j=0;
102061 0 : while (done == false && j < SgUpirWorksharingStatement::pool_size)
102062 : {
102063 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
102064 : {
102065 0 : traversal.visit(&(objectArray[i][j]));
102066 0 : done = true;
102067 : }
102068 0 : j++;
102069 : }
102070 0 : i++;
102071 : }
102072 :
102073 : #if 0
102074 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
102075 : if (done == false)
102076 : {
102077 : printf ("No representative for SgUpirWorksharingStatement found in memory pools \n");
102078 : }
102079 : #endif
102080 : }
102081 0 : }
102082 :
102083 :
102084 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
102085 : // using values that overflow signed values of int.
102086 : size_t
102087 4 : SgUpirWorksharingStatement::numberOfNodes()
102088 : {
102089 : // This function traverses the memory pool for an IR node and
102090 : // counts the number of IR nodes of a particular Sage III IR
102091 : // nodes type.
102092 :
102093 4 : size_t count = 0;
102094 4 : if (SgUpirWorksharingStatement::pools.empty() == false)
102095 : {
102096 : // Generate an array of memory pools (this is actually a STL vector,
102097 : // but it is contiguious, so OK to treat this way).
102098 0 : SgUpirWorksharingStatement** objectArray = (SgUpirWorksharingStatement**) &(SgUpirWorksharingStatement::pools[0]);
102099 :
102100 : // Build a local variable for better performance (make it a loop invariant variable).
102101 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
102102 :
102103 : // Iterate over all of the memory pools for this IR node.
102104 0 : for (unsigned int i=0; i < SgUpirWorksharingStatement::pools.size(); i++)
102105 : {
102106 : // objectArray[i] is a single memory pool, iterate over all the
102107 : // IR nodes and only count those that are valid IR nodes used in
102108 : // the AST (i.e. allocated IR nodes).
102109 0 : for (unsigned j=0; j < SgUpirWorksharingStatement::pool_size; j++)
102110 : {
102111 : // This is indexing the STL vector of C/C++ style arrays as a doubly
102112 : // indexed array access. It is OK since we have leveraged the semantics
102113 : // of STL vector memory as contigous and cast the memory as an array
102114 : // of arrays to use the 2D array indexing. Hope this is not confusing,
102115 : // but it s very fast as an implementation.
102116 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
102117 : {
102118 0 : count++;
102119 : }
102120 : }
102121 : }
102122 : }
102123 :
102124 :
102125 :
102126 4 : return count;
102127 : }
102128 :
102129 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
102130 : // using values that overflow signed values of int.
102131 : size_t
102132 0 : SgUpirWorksharingStatement::memoryUsage()
102133 : {
102134 : // This function is required because we need the class name as a type when we call sizeof
102135 : // There might be another way to implement this if we have a traversal that only called a
102136 : // representative object (one call for each type of Sage IIIIR node).
102137 0 : size_t memory = numberOfNodes() * sizeof(SgUpirWorksharingStatement);
102138 :
102139 0 : return memory;
102140 : }
102141 :
102142 : /* #line 102143 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
102143 :
102144 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
102145 : void
102146 5342 : SgUpirSimdStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
102147 : {
102148 : // This function traverses the memory pool for only a specific IR node
102149 : // and calls the visit function of the input class execute a traversal
102150 : // similar to the style of the attribute based traversals within ROSE.
102151 : // This traversal will visit ALL nodes of the AST where as the other
102152 : // attribute based traversals visit only the embedded tree within the AST.
102153 :
102154 : // Initialize array to the address of the first element of the STL vector
102155 : // (which is guaranteed to be contiguous storage).
102156 : // SgUpirSimdStatement objectArray [] = *(Memory_Block_List.begin());
102157 5342 : if (SgUpirSimdStatement::pools.empty() == false)
102158 : {
102159 : // Generate an array of memory pools
102160 42 : SgUpirSimdStatement** objectArray = (SgUpirSimdStatement**) &(SgUpirSimdStatement::pools[0]);
102161 :
102162 : // Build a local variable for better performance
102163 42 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
102164 : #if 0
102165 : // Iterate over the memory pools
102166 : for (unsigned int i=0; i < SgUpirSimdStatement::pools.size(); i++)
102167 : {
102168 : // objectArray[i] is a single memory pool
102169 : for (int j=0; j < SgUpirSimdStatement::pool_size; j++)
102170 : {
102171 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
102172 : {
102173 : traversal.visit(&(objectArray[i][j]));
102174 : }
102175 : }
102176 : }
102177 : #else
102178 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
102179 : // compute the list first and then call the visit function on each list element.
102180 :
102181 : // printf ("Inside of SgUpirSimdStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
102182 :
102183 84 : std::vector<SgUpirSimdStatement*> nodeList;
102184 :
102185 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
102186 84 : for (unsigned int i=0; i < SgUpirSimdStatement::pools.size(); i++)
102187 : {
102188 : // objectArray[i] is a single memory pool
102189 84042 : for (unsigned j=0; j < SgUpirSimdStatement::pool_size; j++)
102190 : {
102191 84000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
102192 : {
102193 98 : nodeList.push_back(&(objectArray[i][j]));
102194 : }
102195 : }
102196 : }
102197 :
102198 : // Iterate over the saved list
102199 42 : size_t nodeListSize = nodeList.size();
102200 140 : for (size_t i=0; i < nodeListSize; i++)
102201 : {
102202 98 : ROSE_ASSERT(nodeList[i] != NULL);
102203 : #if 0
102204 : traversal.visit(nodeList[i]);
102205 : #else
102206 98 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
102207 : {
102208 98 : traversal.visit(nodeList[i]);
102209 : }
102210 : #endif
102211 : }
102212 : #endif
102213 : }
102214 :
102215 : // This should not be required since all previously static data members are
102216 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
102217 :
102218 5342 : }
102219 :
102220 :
102221 : void
102222 194 : SgUpirSimdStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
102223 : {
102224 : // This function traverses the memory pool for an IR node and
102225 : // calls the function to execute the visitor object.
102226 :
102227 : // Initialize array to the address of the first element of the STL vector
102228 : // (which is guarenteed to be contiguous storage).
102229 : // SgUpirSimdStatement objectArray [] = *(Memory_Block_List.begin());
102230 194 : if (SgUpirSimdStatement::pools.empty() == false)
102231 : {
102232 : // Generate an array of memory pools
102233 0 : SgUpirSimdStatement** objectArray = (SgUpirSimdStatement**) &(SgUpirSimdStatement::pools[0]);
102234 :
102235 : // Build a local variable for better performance
102236 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
102237 :
102238 : // Iterate over the memory pools
102239 0 : for (unsigned int i=0; i < SgUpirSimdStatement::pools.size(); i++)
102240 : {
102241 : // objectArray[i] is a single memory pool
102242 0 : for (unsigned j=0; j < SgUpirSimdStatement::pool_size; j++)
102243 : {
102244 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
102245 : {
102246 : // printf ("Found a valid SgUpirSimdStatement object in the memory pool %d at position %d \n",i,j);
102247 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
102248 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
102249 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
102250 : }
102251 : else
102252 : {
102253 : // printf ("Found a INVALID SgUpirSimdStatement object in the memory pool \n");
102254 : }
102255 : }
102256 : }
102257 : }
102258 :
102259 : // This should not be required since all previously static data members are
102260 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
102261 :
102262 194 : }
102263 :
102264 : void
102265 0 : SgUpirSimdStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
102266 : {
102267 : // This function visits only a single IR node of the memory pool.
102268 : // it is typically called once for each type of IR node within
102269 : // the automatically generated function: traverseRepresentativeNodes().
102270 :
102271 : // Initialize array to the address of the first element of the STL vector
102272 : // (which is guarenteed to be contiguous storage).
102273 : // SgUpirSimdStatement objectArray [] = *(Memory_Block_List.begin());
102274 0 : if (SgUpirSimdStatement::pools.empty() == false)
102275 : {
102276 : // Generate an array of memory pools
102277 0 : SgUpirSimdStatement** objectArray = (SgUpirSimdStatement**) &(SgUpirSimdStatement::pools[0]);
102278 :
102279 : // Build a local variable for better performance
102280 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
102281 :
102282 : // Iterate over the memory pools
102283 0 : bool done = false;
102284 0 : unsigned i=0;
102285 :
102286 : // find the first valid IR node, call visit function, and then leave
102287 0 : while ( done == false && i < SgUpirSimdStatement::pools.size() )
102288 : {
102289 : // objectArray[i] is a single memory pool
102290 : unsigned j=0;
102291 0 : while (done == false && j < SgUpirSimdStatement::pool_size)
102292 : {
102293 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
102294 : {
102295 0 : traversal.visit(&(objectArray[i][j]));
102296 0 : done = true;
102297 : }
102298 0 : j++;
102299 : }
102300 0 : i++;
102301 : }
102302 :
102303 : #if 0
102304 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
102305 : if (done == false)
102306 : {
102307 : printf ("No representative for SgUpirSimdStatement found in memory pools \n");
102308 : }
102309 : #endif
102310 : }
102311 0 : }
102312 :
102313 :
102314 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
102315 : // using values that overflow signed values of int.
102316 : size_t
102317 4 : SgUpirSimdStatement::numberOfNodes()
102318 : {
102319 : // This function traverses the memory pool for an IR node and
102320 : // counts the number of IR nodes of a particular Sage III IR
102321 : // nodes type.
102322 :
102323 4 : size_t count = 0;
102324 4 : if (SgUpirSimdStatement::pools.empty() == false)
102325 : {
102326 : // Generate an array of memory pools (this is actually a STL vector,
102327 : // but it is contiguious, so OK to treat this way).
102328 0 : SgUpirSimdStatement** objectArray = (SgUpirSimdStatement**) &(SgUpirSimdStatement::pools[0]);
102329 :
102330 : // Build a local variable for better performance (make it a loop invariant variable).
102331 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
102332 :
102333 : // Iterate over all of the memory pools for this IR node.
102334 0 : for (unsigned int i=0; i < SgUpirSimdStatement::pools.size(); i++)
102335 : {
102336 : // objectArray[i] is a single memory pool, iterate over all the
102337 : // IR nodes and only count those that are valid IR nodes used in
102338 : // the AST (i.e. allocated IR nodes).
102339 0 : for (unsigned j=0; j < SgUpirSimdStatement::pool_size; j++)
102340 : {
102341 : // This is indexing the STL vector of C/C++ style arrays as a doubly
102342 : // indexed array access. It is OK since we have leveraged the semantics
102343 : // of STL vector memory as contigous and cast the memory as an array
102344 : // of arrays to use the 2D array indexing. Hope this is not confusing,
102345 : // but it s very fast as an implementation.
102346 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
102347 : {
102348 0 : count++;
102349 : }
102350 : }
102351 : }
102352 : }
102353 :
102354 :
102355 :
102356 4 : return count;
102357 : }
102358 :
102359 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
102360 : // using values that overflow signed values of int.
102361 : size_t
102362 0 : SgUpirSimdStatement::memoryUsage()
102363 : {
102364 : // This function is required because we need the class name as a type when we call sizeof
102365 : // There might be another way to implement this if we have a traversal that only called a
102366 : // representative object (one call for each type of Sage IIIIR node).
102367 0 : size_t memory = numberOfNodes() * sizeof(SgUpirSimdStatement);
102368 :
102369 0 : return memory;
102370 : }
102371 :
102372 : /* #line 102373 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
102373 :
102374 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
102375 : void
102376 5342 : SgOmpDeclareMapperStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
102377 : {
102378 : // This function traverses the memory pool for only a specific IR node
102379 : // and calls the visit function of the input class execute a traversal
102380 : // similar to the style of the attribute based traversals within ROSE.
102381 : // This traversal will visit ALL nodes of the AST where as the other
102382 : // attribute based traversals visit only the embedded tree within the AST.
102383 :
102384 : // Initialize array to the address of the first element of the STL vector
102385 : // (which is guaranteed to be contiguous storage).
102386 : // SgOmpDeclareMapperStatement objectArray [] = *(Memory_Block_List.begin());
102387 5342 : if (SgOmpDeclareMapperStatement::pools.empty() == false)
102388 : {
102389 : // Generate an array of memory pools
102390 0 : SgOmpDeclareMapperStatement** objectArray = (SgOmpDeclareMapperStatement**) &(SgOmpDeclareMapperStatement::pools[0]);
102391 :
102392 : // Build a local variable for better performance
102393 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
102394 : #if 0
102395 : // Iterate over the memory pools
102396 : for (unsigned int i=0; i < SgOmpDeclareMapperStatement::pools.size(); i++)
102397 : {
102398 : // objectArray[i] is a single memory pool
102399 : for (int j=0; j < SgOmpDeclareMapperStatement::pool_size; j++)
102400 : {
102401 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
102402 : {
102403 : traversal.visit(&(objectArray[i][j]));
102404 : }
102405 : }
102406 : }
102407 : #else
102408 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
102409 : // compute the list first and then call the visit function on each list element.
102410 :
102411 : // printf ("Inside of SgOmpDeclareMapperStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
102412 :
102413 0 : std::vector<SgOmpDeclareMapperStatement*> nodeList;
102414 :
102415 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
102416 0 : for (unsigned int i=0; i < SgOmpDeclareMapperStatement::pools.size(); i++)
102417 : {
102418 : // objectArray[i] is a single memory pool
102419 0 : for (unsigned j=0; j < SgOmpDeclareMapperStatement::pool_size; j++)
102420 : {
102421 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
102422 : {
102423 0 : nodeList.push_back(&(objectArray[i][j]));
102424 : }
102425 : }
102426 : }
102427 :
102428 : // Iterate over the saved list
102429 0 : size_t nodeListSize = nodeList.size();
102430 0 : for (size_t i=0; i < nodeListSize; i++)
102431 : {
102432 0 : ROSE_ASSERT(nodeList[i] != NULL);
102433 : #if 0
102434 : traversal.visit(nodeList[i]);
102435 : #else
102436 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
102437 : {
102438 0 : traversal.visit(nodeList[i]);
102439 : }
102440 : #endif
102441 : }
102442 : #endif
102443 : }
102444 :
102445 : // This should not be required since all previously static data members are
102446 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
102447 :
102448 5342 : }
102449 :
102450 :
102451 : void
102452 194 : SgOmpDeclareMapperStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
102453 : {
102454 : // This function traverses the memory pool for an IR node and
102455 : // calls the function to execute the visitor object.
102456 :
102457 : // Initialize array to the address of the first element of the STL vector
102458 : // (which is guarenteed to be contiguous storage).
102459 : // SgOmpDeclareMapperStatement objectArray [] = *(Memory_Block_List.begin());
102460 194 : if (SgOmpDeclareMapperStatement::pools.empty() == false)
102461 : {
102462 : // Generate an array of memory pools
102463 0 : SgOmpDeclareMapperStatement** objectArray = (SgOmpDeclareMapperStatement**) &(SgOmpDeclareMapperStatement::pools[0]);
102464 :
102465 : // Build a local variable for better performance
102466 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
102467 :
102468 : // Iterate over the memory pools
102469 0 : for (unsigned int i=0; i < SgOmpDeclareMapperStatement::pools.size(); i++)
102470 : {
102471 : // objectArray[i] is a single memory pool
102472 0 : for (unsigned j=0; j < SgOmpDeclareMapperStatement::pool_size; j++)
102473 : {
102474 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
102475 : {
102476 : // printf ("Found a valid SgOmpDeclareMapperStatement object in the memory pool %d at position %d \n",i,j);
102477 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
102478 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
102479 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
102480 : }
102481 : else
102482 : {
102483 : // printf ("Found a INVALID SgOmpDeclareMapperStatement object in the memory pool \n");
102484 : }
102485 : }
102486 : }
102487 : }
102488 :
102489 : // This should not be required since all previously static data members are
102490 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
102491 :
102492 194 : }
102493 :
102494 : void
102495 0 : SgOmpDeclareMapperStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
102496 : {
102497 : // This function visits only a single IR node of the memory pool.
102498 : // it is typically called once for each type of IR node within
102499 : // the automatically generated function: traverseRepresentativeNodes().
102500 :
102501 : // Initialize array to the address of the first element of the STL vector
102502 : // (which is guarenteed to be contiguous storage).
102503 : // SgOmpDeclareMapperStatement objectArray [] = *(Memory_Block_List.begin());
102504 0 : if (SgOmpDeclareMapperStatement::pools.empty() == false)
102505 : {
102506 : // Generate an array of memory pools
102507 0 : SgOmpDeclareMapperStatement** objectArray = (SgOmpDeclareMapperStatement**) &(SgOmpDeclareMapperStatement::pools[0]);
102508 :
102509 : // Build a local variable for better performance
102510 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
102511 :
102512 : // Iterate over the memory pools
102513 0 : bool done = false;
102514 0 : unsigned i=0;
102515 :
102516 : // find the first valid IR node, call visit function, and then leave
102517 0 : while ( done == false && i < SgOmpDeclareMapperStatement::pools.size() )
102518 : {
102519 : // objectArray[i] is a single memory pool
102520 : unsigned j=0;
102521 0 : while (done == false && j < SgOmpDeclareMapperStatement::pool_size)
102522 : {
102523 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
102524 : {
102525 0 : traversal.visit(&(objectArray[i][j]));
102526 0 : done = true;
102527 : }
102528 0 : j++;
102529 : }
102530 0 : i++;
102531 : }
102532 :
102533 : #if 0
102534 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
102535 : if (done == false)
102536 : {
102537 : printf ("No representative for SgOmpDeclareMapperStatement found in memory pools \n");
102538 : }
102539 : #endif
102540 : }
102541 0 : }
102542 :
102543 :
102544 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
102545 : // using values that overflow signed values of int.
102546 : size_t
102547 4 : SgOmpDeclareMapperStatement::numberOfNodes()
102548 : {
102549 : // This function traverses the memory pool for an IR node and
102550 : // counts the number of IR nodes of a particular Sage III IR
102551 : // nodes type.
102552 :
102553 4 : size_t count = 0;
102554 4 : if (SgOmpDeclareMapperStatement::pools.empty() == false)
102555 : {
102556 : // Generate an array of memory pools (this is actually a STL vector,
102557 : // but it is contiguious, so OK to treat this way).
102558 0 : SgOmpDeclareMapperStatement** objectArray = (SgOmpDeclareMapperStatement**) &(SgOmpDeclareMapperStatement::pools[0]);
102559 :
102560 : // Build a local variable for better performance (make it a loop invariant variable).
102561 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
102562 :
102563 : // Iterate over all of the memory pools for this IR node.
102564 0 : for (unsigned int i=0; i < SgOmpDeclareMapperStatement::pools.size(); i++)
102565 : {
102566 : // objectArray[i] is a single memory pool, iterate over all the
102567 : // IR nodes and only count those that are valid IR nodes used in
102568 : // the AST (i.e. allocated IR nodes).
102569 0 : for (unsigned j=0; j < SgOmpDeclareMapperStatement::pool_size; j++)
102570 : {
102571 : // This is indexing the STL vector of C/C++ style arrays as a doubly
102572 : // indexed array access. It is OK since we have leveraged the semantics
102573 : // of STL vector memory as contigous and cast the memory as an array
102574 : // of arrays to use the 2D array indexing. Hope this is not confusing,
102575 : // but it s very fast as an implementation.
102576 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
102577 : {
102578 0 : count++;
102579 : }
102580 : }
102581 : }
102582 : }
102583 :
102584 :
102585 :
102586 4 : return count;
102587 : }
102588 :
102589 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
102590 : // using values that overflow signed values of int.
102591 : size_t
102592 0 : SgOmpDeclareMapperStatement::memoryUsage()
102593 : {
102594 : // This function is required because we need the class name as a type when we call sizeof
102595 : // There might be another way to implement this if we have a traversal that only called a
102596 : // representative object (one call for each type of Sage IIIIR node).
102597 0 : size_t memory = numberOfNodes() * sizeof(SgOmpDeclareMapperStatement);
102598 :
102599 0 : return memory;
102600 : }
102601 :
102602 : /* #line 102603 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
102603 :
102604 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
102605 : void
102606 5342 : SgSequenceStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
102607 : {
102608 : // This function traverses the memory pool for only a specific IR node
102609 : // and calls the visit function of the input class execute a traversal
102610 : // similar to the style of the attribute based traversals within ROSE.
102611 : // This traversal will visit ALL nodes of the AST where as the other
102612 : // attribute based traversals visit only the embedded tree within the AST.
102613 :
102614 : // Initialize array to the address of the first element of the STL vector
102615 : // (which is guaranteed to be contiguous storage).
102616 : // SgSequenceStatement objectArray [] = *(Memory_Block_List.begin());
102617 5342 : if (SgSequenceStatement::pools.empty() == false)
102618 : {
102619 : // Generate an array of memory pools
102620 0 : SgSequenceStatement** objectArray = (SgSequenceStatement**) &(SgSequenceStatement::pools[0]);
102621 :
102622 : // Build a local variable for better performance
102623 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
102624 : #if 0
102625 : // Iterate over the memory pools
102626 : for (unsigned int i=0; i < SgSequenceStatement::pools.size(); i++)
102627 : {
102628 : // objectArray[i] is a single memory pool
102629 : for (int j=0; j < SgSequenceStatement::pool_size; j++)
102630 : {
102631 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
102632 : {
102633 : traversal.visit(&(objectArray[i][j]));
102634 : }
102635 : }
102636 : }
102637 : #else
102638 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
102639 : // compute the list first and then call the visit function on each list element.
102640 :
102641 : // printf ("Inside of SgSequenceStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
102642 :
102643 0 : std::vector<SgSequenceStatement*> nodeList;
102644 :
102645 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
102646 0 : for (unsigned int i=0; i < SgSequenceStatement::pools.size(); i++)
102647 : {
102648 : // objectArray[i] is a single memory pool
102649 0 : for (unsigned j=0; j < SgSequenceStatement::pool_size; j++)
102650 : {
102651 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
102652 : {
102653 0 : nodeList.push_back(&(objectArray[i][j]));
102654 : }
102655 : }
102656 : }
102657 :
102658 : // Iterate over the saved list
102659 0 : size_t nodeListSize = nodeList.size();
102660 0 : for (size_t i=0; i < nodeListSize; i++)
102661 : {
102662 0 : ROSE_ASSERT(nodeList[i] != NULL);
102663 : #if 0
102664 : traversal.visit(nodeList[i]);
102665 : #else
102666 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
102667 : {
102668 0 : traversal.visit(nodeList[i]);
102669 : }
102670 : #endif
102671 : }
102672 : #endif
102673 : }
102674 :
102675 : // This should not be required since all previously static data members are
102676 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
102677 :
102678 5342 : }
102679 :
102680 :
102681 : void
102682 194 : SgSequenceStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
102683 : {
102684 : // This function traverses the memory pool for an IR node and
102685 : // calls the function to execute the visitor object.
102686 :
102687 : // Initialize array to the address of the first element of the STL vector
102688 : // (which is guarenteed to be contiguous storage).
102689 : // SgSequenceStatement objectArray [] = *(Memory_Block_List.begin());
102690 194 : if (SgSequenceStatement::pools.empty() == false)
102691 : {
102692 : // Generate an array of memory pools
102693 0 : SgSequenceStatement** objectArray = (SgSequenceStatement**) &(SgSequenceStatement::pools[0]);
102694 :
102695 : // Build a local variable for better performance
102696 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
102697 :
102698 : // Iterate over the memory pools
102699 0 : for (unsigned int i=0; i < SgSequenceStatement::pools.size(); i++)
102700 : {
102701 : // objectArray[i] is a single memory pool
102702 0 : for (unsigned j=0; j < SgSequenceStatement::pool_size; j++)
102703 : {
102704 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
102705 : {
102706 : // printf ("Found a valid SgSequenceStatement object in the memory pool %d at position %d \n",i,j);
102707 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
102708 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
102709 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
102710 : }
102711 : else
102712 : {
102713 : // printf ("Found a INVALID SgSequenceStatement object in the memory pool \n");
102714 : }
102715 : }
102716 : }
102717 : }
102718 :
102719 : // This should not be required since all previously static data members are
102720 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
102721 :
102722 194 : }
102723 :
102724 : void
102725 0 : SgSequenceStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
102726 : {
102727 : // This function visits only a single IR node of the memory pool.
102728 : // it is typically called once for each type of IR node within
102729 : // the automatically generated function: traverseRepresentativeNodes().
102730 :
102731 : // Initialize array to the address of the first element of the STL vector
102732 : // (which is guarenteed to be contiguous storage).
102733 : // SgSequenceStatement objectArray [] = *(Memory_Block_List.begin());
102734 0 : if (SgSequenceStatement::pools.empty() == false)
102735 : {
102736 : // Generate an array of memory pools
102737 0 : SgSequenceStatement** objectArray = (SgSequenceStatement**) &(SgSequenceStatement::pools[0]);
102738 :
102739 : // Build a local variable for better performance
102740 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
102741 :
102742 : // Iterate over the memory pools
102743 0 : bool done = false;
102744 0 : unsigned i=0;
102745 :
102746 : // find the first valid IR node, call visit function, and then leave
102747 0 : while ( done == false && i < SgSequenceStatement::pools.size() )
102748 : {
102749 : // objectArray[i] is a single memory pool
102750 : unsigned j=0;
102751 0 : while (done == false && j < SgSequenceStatement::pool_size)
102752 : {
102753 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
102754 : {
102755 0 : traversal.visit(&(objectArray[i][j]));
102756 0 : done = true;
102757 : }
102758 0 : j++;
102759 : }
102760 0 : i++;
102761 : }
102762 :
102763 : #if 0
102764 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
102765 : if (done == false)
102766 : {
102767 : printf ("No representative for SgSequenceStatement found in memory pools \n");
102768 : }
102769 : #endif
102770 : }
102771 0 : }
102772 :
102773 :
102774 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
102775 : // using values that overflow signed values of int.
102776 : size_t
102777 4 : SgSequenceStatement::numberOfNodes()
102778 : {
102779 : // This function traverses the memory pool for an IR node and
102780 : // counts the number of IR nodes of a particular Sage III IR
102781 : // nodes type.
102782 :
102783 4 : size_t count = 0;
102784 4 : if (SgSequenceStatement::pools.empty() == false)
102785 : {
102786 : // Generate an array of memory pools (this is actually a STL vector,
102787 : // but it is contiguious, so OK to treat this way).
102788 0 : SgSequenceStatement** objectArray = (SgSequenceStatement**) &(SgSequenceStatement::pools[0]);
102789 :
102790 : // Build a local variable for better performance (make it a loop invariant variable).
102791 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
102792 :
102793 : // Iterate over all of the memory pools for this IR node.
102794 0 : for (unsigned int i=0; i < SgSequenceStatement::pools.size(); i++)
102795 : {
102796 : // objectArray[i] is a single memory pool, iterate over all the
102797 : // IR nodes and only count those that are valid IR nodes used in
102798 : // the AST (i.e. allocated IR nodes).
102799 0 : for (unsigned j=0; j < SgSequenceStatement::pool_size; j++)
102800 : {
102801 : // This is indexing the STL vector of C/C++ style arrays as a doubly
102802 : // indexed array access. It is OK since we have leveraged the semantics
102803 : // of STL vector memory as contigous and cast the memory as an array
102804 : // of arrays to use the 2D array indexing. Hope this is not confusing,
102805 : // but it s very fast as an implementation.
102806 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
102807 : {
102808 0 : count++;
102809 : }
102810 : }
102811 : }
102812 : }
102813 :
102814 :
102815 :
102816 4 : return count;
102817 : }
102818 :
102819 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
102820 : // using values that overflow signed values of int.
102821 : size_t
102822 0 : SgSequenceStatement::memoryUsage()
102823 : {
102824 : // This function is required because we need the class name as a type when we call sizeof
102825 : // There might be another way to implement this if we have a traversal that only called a
102826 : // representative object (one call for each type of Sage IIIIR node).
102827 0 : size_t memory = numberOfNodes() * sizeof(SgSequenceStatement);
102828 :
102829 0 : return memory;
102830 : }
102831 :
102832 : /* #line 102833 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
102833 :
102834 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
102835 : void
102836 5342 : SgWithStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
102837 : {
102838 : // This function traverses the memory pool for only a specific IR node
102839 : // and calls the visit function of the input class execute a traversal
102840 : // similar to the style of the attribute based traversals within ROSE.
102841 : // This traversal will visit ALL nodes of the AST where as the other
102842 : // attribute based traversals visit only the embedded tree within the AST.
102843 :
102844 : // Initialize array to the address of the first element of the STL vector
102845 : // (which is guaranteed to be contiguous storage).
102846 : // SgWithStatement objectArray [] = *(Memory_Block_List.begin());
102847 5342 : if (SgWithStatement::pools.empty() == false)
102848 : {
102849 : // Generate an array of memory pools
102850 0 : SgWithStatement** objectArray = (SgWithStatement**) &(SgWithStatement::pools[0]);
102851 :
102852 : // Build a local variable for better performance
102853 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
102854 : #if 0
102855 : // Iterate over the memory pools
102856 : for (unsigned int i=0; i < SgWithStatement::pools.size(); i++)
102857 : {
102858 : // objectArray[i] is a single memory pool
102859 : for (int j=0; j < SgWithStatement::pool_size; j++)
102860 : {
102861 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
102862 : {
102863 : traversal.visit(&(objectArray[i][j]));
102864 : }
102865 : }
102866 : }
102867 : #else
102868 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
102869 : // compute the list first and then call the visit function on each list element.
102870 :
102871 : // printf ("Inside of SgWithStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
102872 :
102873 0 : std::vector<SgWithStatement*> nodeList;
102874 :
102875 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
102876 0 : for (unsigned int i=0; i < SgWithStatement::pools.size(); i++)
102877 : {
102878 : // objectArray[i] is a single memory pool
102879 0 : for (unsigned j=0; j < SgWithStatement::pool_size; j++)
102880 : {
102881 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
102882 : {
102883 0 : nodeList.push_back(&(objectArray[i][j]));
102884 : }
102885 : }
102886 : }
102887 :
102888 : // Iterate over the saved list
102889 0 : size_t nodeListSize = nodeList.size();
102890 0 : for (size_t i=0; i < nodeListSize; i++)
102891 : {
102892 0 : ROSE_ASSERT(nodeList[i] != NULL);
102893 : #if 0
102894 : traversal.visit(nodeList[i]);
102895 : #else
102896 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
102897 : {
102898 0 : traversal.visit(nodeList[i]);
102899 : }
102900 : #endif
102901 : }
102902 : #endif
102903 : }
102904 :
102905 : // This should not be required since all previously static data members are
102906 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
102907 :
102908 5342 : }
102909 :
102910 :
102911 : void
102912 194 : SgWithStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
102913 : {
102914 : // This function traverses the memory pool for an IR node and
102915 : // calls the function to execute the visitor object.
102916 :
102917 : // Initialize array to the address of the first element of the STL vector
102918 : // (which is guarenteed to be contiguous storage).
102919 : // SgWithStatement objectArray [] = *(Memory_Block_List.begin());
102920 194 : if (SgWithStatement::pools.empty() == false)
102921 : {
102922 : // Generate an array of memory pools
102923 0 : SgWithStatement** objectArray = (SgWithStatement**) &(SgWithStatement::pools[0]);
102924 :
102925 : // Build a local variable for better performance
102926 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
102927 :
102928 : // Iterate over the memory pools
102929 0 : for (unsigned int i=0; i < SgWithStatement::pools.size(); i++)
102930 : {
102931 : // objectArray[i] is a single memory pool
102932 0 : for (unsigned j=0; j < SgWithStatement::pool_size; j++)
102933 : {
102934 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
102935 : {
102936 : // printf ("Found a valid SgWithStatement object in the memory pool %d at position %d \n",i,j);
102937 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
102938 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
102939 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
102940 : }
102941 : else
102942 : {
102943 : // printf ("Found a INVALID SgWithStatement object in the memory pool \n");
102944 : }
102945 : }
102946 : }
102947 : }
102948 :
102949 : // This should not be required since all previously static data members are
102950 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
102951 :
102952 194 : }
102953 :
102954 : void
102955 0 : SgWithStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
102956 : {
102957 : // This function visits only a single IR node of the memory pool.
102958 : // it is typically called once for each type of IR node within
102959 : // the automatically generated function: traverseRepresentativeNodes().
102960 :
102961 : // Initialize array to the address of the first element of the STL vector
102962 : // (which is guarenteed to be contiguous storage).
102963 : // SgWithStatement objectArray [] = *(Memory_Block_List.begin());
102964 0 : if (SgWithStatement::pools.empty() == false)
102965 : {
102966 : // Generate an array of memory pools
102967 0 : SgWithStatement** objectArray = (SgWithStatement**) &(SgWithStatement::pools[0]);
102968 :
102969 : // Build a local variable for better performance
102970 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
102971 :
102972 : // Iterate over the memory pools
102973 0 : bool done = false;
102974 0 : unsigned i=0;
102975 :
102976 : // find the first valid IR node, call visit function, and then leave
102977 0 : while ( done == false && i < SgWithStatement::pools.size() )
102978 : {
102979 : // objectArray[i] is a single memory pool
102980 : unsigned j=0;
102981 0 : while (done == false && j < SgWithStatement::pool_size)
102982 : {
102983 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
102984 : {
102985 0 : traversal.visit(&(objectArray[i][j]));
102986 0 : done = true;
102987 : }
102988 0 : j++;
102989 : }
102990 0 : i++;
102991 : }
102992 :
102993 : #if 0
102994 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
102995 : if (done == false)
102996 : {
102997 : printf ("No representative for SgWithStatement found in memory pools \n");
102998 : }
102999 : #endif
103000 : }
103001 0 : }
103002 :
103003 :
103004 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
103005 : // using values that overflow signed values of int.
103006 : size_t
103007 4 : SgWithStatement::numberOfNodes()
103008 : {
103009 : // This function traverses the memory pool for an IR node and
103010 : // counts the number of IR nodes of a particular Sage III IR
103011 : // nodes type.
103012 :
103013 4 : size_t count = 0;
103014 4 : if (SgWithStatement::pools.empty() == false)
103015 : {
103016 : // Generate an array of memory pools (this is actually a STL vector,
103017 : // but it is contiguious, so OK to treat this way).
103018 0 : SgWithStatement** objectArray = (SgWithStatement**) &(SgWithStatement::pools[0]);
103019 :
103020 : // Build a local variable for better performance (make it a loop invariant variable).
103021 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
103022 :
103023 : // Iterate over all of the memory pools for this IR node.
103024 0 : for (unsigned int i=0; i < SgWithStatement::pools.size(); i++)
103025 : {
103026 : // objectArray[i] is a single memory pool, iterate over all the
103027 : // IR nodes and only count those that are valid IR nodes used in
103028 : // the AST (i.e. allocated IR nodes).
103029 0 : for (unsigned j=0; j < SgWithStatement::pool_size; j++)
103030 : {
103031 : // This is indexing the STL vector of C/C++ style arrays as a doubly
103032 : // indexed array access. It is OK since we have leveraged the semantics
103033 : // of STL vector memory as contigous and cast the memory as an array
103034 : // of arrays to use the 2D array indexing. Hope this is not confusing,
103035 : // but it s very fast as an implementation.
103036 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
103037 : {
103038 0 : count++;
103039 : }
103040 : }
103041 : }
103042 : }
103043 :
103044 :
103045 :
103046 4 : return count;
103047 : }
103048 :
103049 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
103050 : // using values that overflow signed values of int.
103051 : size_t
103052 0 : SgWithStatement::memoryUsage()
103053 : {
103054 : // This function is required because we need the class name as a type when we call sizeof
103055 : // There might be another way to implement this if we have a traversal that only called a
103056 : // representative object (one call for each type of Sage IIIIR node).
103057 0 : size_t memory = numberOfNodes() * sizeof(SgWithStatement);
103058 :
103059 0 : return memory;
103060 : }
103061 :
103062 : /* #line 103063 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
103063 :
103064 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
103065 : void
103066 5342 : SgPassStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
103067 : {
103068 : // This function traverses the memory pool for only a specific IR node
103069 : // and calls the visit function of the input class execute a traversal
103070 : // similar to the style of the attribute based traversals within ROSE.
103071 : // This traversal will visit ALL nodes of the AST where as the other
103072 : // attribute based traversals visit only the embedded tree within the AST.
103073 :
103074 : // Initialize array to the address of the first element of the STL vector
103075 : // (which is guaranteed to be contiguous storage).
103076 : // SgPassStatement objectArray [] = *(Memory_Block_List.begin());
103077 5342 : if (SgPassStatement::pools.empty() == false)
103078 : {
103079 : // Generate an array of memory pools
103080 0 : SgPassStatement** objectArray = (SgPassStatement**) &(SgPassStatement::pools[0]);
103081 :
103082 : // Build a local variable for better performance
103083 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
103084 : #if 0
103085 : // Iterate over the memory pools
103086 : for (unsigned int i=0; i < SgPassStatement::pools.size(); i++)
103087 : {
103088 : // objectArray[i] is a single memory pool
103089 : for (int j=0; j < SgPassStatement::pool_size; j++)
103090 : {
103091 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
103092 : {
103093 : traversal.visit(&(objectArray[i][j]));
103094 : }
103095 : }
103096 : }
103097 : #else
103098 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
103099 : // compute the list first and then call the visit function on each list element.
103100 :
103101 : // printf ("Inside of SgPassStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
103102 :
103103 0 : std::vector<SgPassStatement*> nodeList;
103104 :
103105 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
103106 0 : for (unsigned int i=0; i < SgPassStatement::pools.size(); i++)
103107 : {
103108 : // objectArray[i] is a single memory pool
103109 0 : for (unsigned j=0; j < SgPassStatement::pool_size; j++)
103110 : {
103111 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
103112 : {
103113 0 : nodeList.push_back(&(objectArray[i][j]));
103114 : }
103115 : }
103116 : }
103117 :
103118 : // Iterate over the saved list
103119 0 : size_t nodeListSize = nodeList.size();
103120 0 : for (size_t i=0; i < nodeListSize; i++)
103121 : {
103122 0 : ROSE_ASSERT(nodeList[i] != NULL);
103123 : #if 0
103124 : traversal.visit(nodeList[i]);
103125 : #else
103126 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
103127 : {
103128 0 : traversal.visit(nodeList[i]);
103129 : }
103130 : #endif
103131 : }
103132 : #endif
103133 : }
103134 :
103135 : // This should not be required since all previously static data members are
103136 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
103137 :
103138 5342 : }
103139 :
103140 :
103141 : void
103142 194 : SgPassStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
103143 : {
103144 : // This function traverses the memory pool for an IR node and
103145 : // calls the function to execute the visitor object.
103146 :
103147 : // Initialize array to the address of the first element of the STL vector
103148 : // (which is guarenteed to be contiguous storage).
103149 : // SgPassStatement objectArray [] = *(Memory_Block_List.begin());
103150 194 : if (SgPassStatement::pools.empty() == false)
103151 : {
103152 : // Generate an array of memory pools
103153 0 : SgPassStatement** objectArray = (SgPassStatement**) &(SgPassStatement::pools[0]);
103154 :
103155 : // Build a local variable for better performance
103156 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
103157 :
103158 : // Iterate over the memory pools
103159 0 : for (unsigned int i=0; i < SgPassStatement::pools.size(); i++)
103160 : {
103161 : // objectArray[i] is a single memory pool
103162 0 : for (unsigned j=0; j < SgPassStatement::pool_size; j++)
103163 : {
103164 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
103165 : {
103166 : // printf ("Found a valid SgPassStatement object in the memory pool %d at position %d \n",i,j);
103167 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
103168 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
103169 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
103170 : }
103171 : else
103172 : {
103173 : // printf ("Found a INVALID SgPassStatement object in the memory pool \n");
103174 : }
103175 : }
103176 : }
103177 : }
103178 :
103179 : // This should not be required since all previously static data members are
103180 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
103181 :
103182 194 : }
103183 :
103184 : void
103185 0 : SgPassStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
103186 : {
103187 : // This function visits only a single IR node of the memory pool.
103188 : // it is typically called once for each type of IR node within
103189 : // the automatically generated function: traverseRepresentativeNodes().
103190 :
103191 : // Initialize array to the address of the first element of the STL vector
103192 : // (which is guarenteed to be contiguous storage).
103193 : // SgPassStatement objectArray [] = *(Memory_Block_List.begin());
103194 0 : if (SgPassStatement::pools.empty() == false)
103195 : {
103196 : // Generate an array of memory pools
103197 0 : SgPassStatement** objectArray = (SgPassStatement**) &(SgPassStatement::pools[0]);
103198 :
103199 : // Build a local variable for better performance
103200 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
103201 :
103202 : // Iterate over the memory pools
103203 0 : bool done = false;
103204 0 : unsigned i=0;
103205 :
103206 : // find the first valid IR node, call visit function, and then leave
103207 0 : while ( done == false && i < SgPassStatement::pools.size() )
103208 : {
103209 : // objectArray[i] is a single memory pool
103210 : unsigned j=0;
103211 0 : while (done == false && j < SgPassStatement::pool_size)
103212 : {
103213 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
103214 : {
103215 0 : traversal.visit(&(objectArray[i][j]));
103216 0 : done = true;
103217 : }
103218 0 : j++;
103219 : }
103220 0 : i++;
103221 : }
103222 :
103223 : #if 0
103224 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
103225 : if (done == false)
103226 : {
103227 : printf ("No representative for SgPassStatement found in memory pools \n");
103228 : }
103229 : #endif
103230 : }
103231 0 : }
103232 :
103233 :
103234 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
103235 : // using values that overflow signed values of int.
103236 : size_t
103237 4 : SgPassStatement::numberOfNodes()
103238 : {
103239 : // This function traverses the memory pool for an IR node and
103240 : // counts the number of IR nodes of a particular Sage III IR
103241 : // nodes type.
103242 :
103243 4 : size_t count = 0;
103244 4 : if (SgPassStatement::pools.empty() == false)
103245 : {
103246 : // Generate an array of memory pools (this is actually a STL vector,
103247 : // but it is contiguious, so OK to treat this way).
103248 0 : SgPassStatement** objectArray = (SgPassStatement**) &(SgPassStatement::pools[0]);
103249 :
103250 : // Build a local variable for better performance (make it a loop invariant variable).
103251 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
103252 :
103253 : // Iterate over all of the memory pools for this IR node.
103254 0 : for (unsigned int i=0; i < SgPassStatement::pools.size(); i++)
103255 : {
103256 : // objectArray[i] is a single memory pool, iterate over all the
103257 : // IR nodes and only count those that are valid IR nodes used in
103258 : // the AST (i.e. allocated IR nodes).
103259 0 : for (unsigned j=0; j < SgPassStatement::pool_size; j++)
103260 : {
103261 : // This is indexing the STL vector of C/C++ style arrays as a doubly
103262 : // indexed array access. It is OK since we have leveraged the semantics
103263 : // of STL vector memory as contigous and cast the memory as an array
103264 : // of arrays to use the 2D array indexing. Hope this is not confusing,
103265 : // but it s very fast as an implementation.
103266 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
103267 : {
103268 0 : count++;
103269 : }
103270 : }
103271 : }
103272 : }
103273 :
103274 :
103275 :
103276 4 : return count;
103277 : }
103278 :
103279 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
103280 : // using values that overflow signed values of int.
103281 : size_t
103282 0 : SgPassStatement::memoryUsage()
103283 : {
103284 : // This function is required because we need the class name as a type when we call sizeof
103285 : // There might be another way to implement this if we have a traversal that only called a
103286 : // representative object (one call for each type of Sage IIIIR node).
103287 0 : size_t memory = numberOfNodes() * sizeof(SgPassStatement);
103288 :
103289 0 : return memory;
103290 : }
103291 :
103292 : /* #line 103293 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
103293 :
103294 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
103295 : void
103296 5342 : SgAssertStmt::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
103297 : {
103298 : // This function traverses the memory pool for only a specific IR node
103299 : // and calls the visit function of the input class execute a traversal
103300 : // similar to the style of the attribute based traversals within ROSE.
103301 : // This traversal will visit ALL nodes of the AST where as the other
103302 : // attribute based traversals visit only the embedded tree within the AST.
103303 :
103304 : // Initialize array to the address of the first element of the STL vector
103305 : // (which is guaranteed to be contiguous storage).
103306 : // SgAssertStmt objectArray [] = *(Memory_Block_List.begin());
103307 5342 : if (SgAssertStmt::pools.empty() == false)
103308 : {
103309 : // Generate an array of memory pools
103310 0 : SgAssertStmt** objectArray = (SgAssertStmt**) &(SgAssertStmt::pools[0]);
103311 :
103312 : // Build a local variable for better performance
103313 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
103314 : #if 0
103315 : // Iterate over the memory pools
103316 : for (unsigned int i=0; i < SgAssertStmt::pools.size(); i++)
103317 : {
103318 : // objectArray[i] is a single memory pool
103319 : for (int j=0; j < SgAssertStmt::pool_size; j++)
103320 : {
103321 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
103322 : {
103323 : traversal.visit(&(objectArray[i][j]));
103324 : }
103325 : }
103326 : }
103327 : #else
103328 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
103329 : // compute the list first and then call the visit function on each list element.
103330 :
103331 : // printf ("Inside of SgAssertStmt::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
103332 :
103333 0 : std::vector<SgAssertStmt*> nodeList;
103334 :
103335 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
103336 0 : for (unsigned int i=0; i < SgAssertStmt::pools.size(); i++)
103337 : {
103338 : // objectArray[i] is a single memory pool
103339 0 : for (unsigned j=0; j < SgAssertStmt::pool_size; j++)
103340 : {
103341 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
103342 : {
103343 0 : nodeList.push_back(&(objectArray[i][j]));
103344 : }
103345 : }
103346 : }
103347 :
103348 : // Iterate over the saved list
103349 0 : size_t nodeListSize = nodeList.size();
103350 0 : for (size_t i=0; i < nodeListSize; i++)
103351 : {
103352 0 : ROSE_ASSERT(nodeList[i] != NULL);
103353 : #if 0
103354 : traversal.visit(nodeList[i]);
103355 : #else
103356 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
103357 : {
103358 0 : traversal.visit(nodeList[i]);
103359 : }
103360 : #endif
103361 : }
103362 : #endif
103363 : }
103364 :
103365 : // This should not be required since all previously static data members are
103366 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
103367 :
103368 5342 : }
103369 :
103370 :
103371 : void
103372 194 : SgAssertStmt::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
103373 : {
103374 : // This function traverses the memory pool for an IR node and
103375 : // calls the function to execute the visitor object.
103376 :
103377 : // Initialize array to the address of the first element of the STL vector
103378 : // (which is guarenteed to be contiguous storage).
103379 : // SgAssertStmt objectArray [] = *(Memory_Block_List.begin());
103380 194 : if (SgAssertStmt::pools.empty() == false)
103381 : {
103382 : // Generate an array of memory pools
103383 0 : SgAssertStmt** objectArray = (SgAssertStmt**) &(SgAssertStmt::pools[0]);
103384 :
103385 : // Build a local variable for better performance
103386 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
103387 :
103388 : // Iterate over the memory pools
103389 0 : for (unsigned int i=0; i < SgAssertStmt::pools.size(); i++)
103390 : {
103391 : // objectArray[i] is a single memory pool
103392 0 : for (unsigned j=0; j < SgAssertStmt::pool_size; j++)
103393 : {
103394 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
103395 : {
103396 : // printf ("Found a valid SgAssertStmt object in the memory pool %d at position %d \n",i,j);
103397 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
103398 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
103399 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
103400 : }
103401 : else
103402 : {
103403 : // printf ("Found a INVALID SgAssertStmt object in the memory pool \n");
103404 : }
103405 : }
103406 : }
103407 : }
103408 :
103409 : // This should not be required since all previously static data members are
103410 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
103411 :
103412 194 : }
103413 :
103414 : void
103415 0 : SgAssertStmt::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
103416 : {
103417 : // This function visits only a single IR node of the memory pool.
103418 : // it is typically called once for each type of IR node within
103419 : // the automatically generated function: traverseRepresentativeNodes().
103420 :
103421 : // Initialize array to the address of the first element of the STL vector
103422 : // (which is guarenteed to be contiguous storage).
103423 : // SgAssertStmt objectArray [] = *(Memory_Block_List.begin());
103424 0 : if (SgAssertStmt::pools.empty() == false)
103425 : {
103426 : // Generate an array of memory pools
103427 0 : SgAssertStmt** objectArray = (SgAssertStmt**) &(SgAssertStmt::pools[0]);
103428 :
103429 : // Build a local variable for better performance
103430 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
103431 :
103432 : // Iterate over the memory pools
103433 0 : bool done = false;
103434 0 : unsigned i=0;
103435 :
103436 : // find the first valid IR node, call visit function, and then leave
103437 0 : while ( done == false && i < SgAssertStmt::pools.size() )
103438 : {
103439 : // objectArray[i] is a single memory pool
103440 : unsigned j=0;
103441 0 : while (done == false && j < SgAssertStmt::pool_size)
103442 : {
103443 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
103444 : {
103445 0 : traversal.visit(&(objectArray[i][j]));
103446 0 : done = true;
103447 : }
103448 0 : j++;
103449 : }
103450 0 : i++;
103451 : }
103452 :
103453 : #if 0
103454 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
103455 : if (done == false)
103456 : {
103457 : printf ("No representative for SgAssertStmt found in memory pools \n");
103458 : }
103459 : #endif
103460 : }
103461 0 : }
103462 :
103463 :
103464 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
103465 : // using values that overflow signed values of int.
103466 : size_t
103467 4 : SgAssertStmt::numberOfNodes()
103468 : {
103469 : // This function traverses the memory pool for an IR node and
103470 : // counts the number of IR nodes of a particular Sage III IR
103471 : // nodes type.
103472 :
103473 4 : size_t count = 0;
103474 4 : if (SgAssertStmt::pools.empty() == false)
103475 : {
103476 : // Generate an array of memory pools (this is actually a STL vector,
103477 : // but it is contiguious, so OK to treat this way).
103478 0 : SgAssertStmt** objectArray = (SgAssertStmt**) &(SgAssertStmt::pools[0]);
103479 :
103480 : // Build a local variable for better performance (make it a loop invariant variable).
103481 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
103482 :
103483 : // Iterate over all of the memory pools for this IR node.
103484 0 : for (unsigned int i=0; i < SgAssertStmt::pools.size(); i++)
103485 : {
103486 : // objectArray[i] is a single memory pool, iterate over all the
103487 : // IR nodes and only count those that are valid IR nodes used in
103488 : // the AST (i.e. allocated IR nodes).
103489 0 : for (unsigned j=0; j < SgAssertStmt::pool_size; j++)
103490 : {
103491 : // This is indexing the STL vector of C/C++ style arrays as a doubly
103492 : // indexed array access. It is OK since we have leveraged the semantics
103493 : // of STL vector memory as contigous and cast the memory as an array
103494 : // of arrays to use the 2D array indexing. Hope this is not confusing,
103495 : // but it s very fast as an implementation.
103496 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
103497 : {
103498 0 : count++;
103499 : }
103500 : }
103501 : }
103502 : }
103503 :
103504 :
103505 :
103506 4 : return count;
103507 : }
103508 :
103509 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
103510 : // using values that overflow signed values of int.
103511 : size_t
103512 0 : SgAssertStmt::memoryUsage()
103513 : {
103514 : // This function is required because we need the class name as a type when we call sizeof
103515 : // There might be another way to implement this if we have a traversal that only called a
103516 : // representative object (one call for each type of Sage IIIIR node).
103517 0 : size_t memory = numberOfNodes() * sizeof(SgAssertStmt);
103518 :
103519 0 : return memory;
103520 : }
103521 :
103522 : /* #line 103523 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
103523 :
103524 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
103525 : void
103526 5342 : SgExecStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
103527 : {
103528 : // This function traverses the memory pool for only a specific IR node
103529 : // and calls the visit function of the input class execute a traversal
103530 : // similar to the style of the attribute based traversals within ROSE.
103531 : // This traversal will visit ALL nodes of the AST where as the other
103532 : // attribute based traversals visit only the embedded tree within the AST.
103533 :
103534 : // Initialize array to the address of the first element of the STL vector
103535 : // (which is guaranteed to be contiguous storage).
103536 : // SgExecStatement objectArray [] = *(Memory_Block_List.begin());
103537 5342 : if (SgExecStatement::pools.empty() == false)
103538 : {
103539 : // Generate an array of memory pools
103540 0 : SgExecStatement** objectArray = (SgExecStatement**) &(SgExecStatement::pools[0]);
103541 :
103542 : // Build a local variable for better performance
103543 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
103544 : #if 0
103545 : // Iterate over the memory pools
103546 : for (unsigned int i=0; i < SgExecStatement::pools.size(); i++)
103547 : {
103548 : // objectArray[i] is a single memory pool
103549 : for (int j=0; j < SgExecStatement::pool_size; j++)
103550 : {
103551 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
103552 : {
103553 : traversal.visit(&(objectArray[i][j]));
103554 : }
103555 : }
103556 : }
103557 : #else
103558 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
103559 : // compute the list first and then call the visit function on each list element.
103560 :
103561 : // printf ("Inside of SgExecStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
103562 :
103563 0 : std::vector<SgExecStatement*> nodeList;
103564 :
103565 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
103566 0 : for (unsigned int i=0; i < SgExecStatement::pools.size(); i++)
103567 : {
103568 : // objectArray[i] is a single memory pool
103569 0 : for (unsigned j=0; j < SgExecStatement::pool_size; j++)
103570 : {
103571 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
103572 : {
103573 0 : nodeList.push_back(&(objectArray[i][j]));
103574 : }
103575 : }
103576 : }
103577 :
103578 : // Iterate over the saved list
103579 0 : size_t nodeListSize = nodeList.size();
103580 0 : for (size_t i=0; i < nodeListSize; i++)
103581 : {
103582 0 : ROSE_ASSERT(nodeList[i] != NULL);
103583 : #if 0
103584 : traversal.visit(nodeList[i]);
103585 : #else
103586 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
103587 : {
103588 0 : traversal.visit(nodeList[i]);
103589 : }
103590 : #endif
103591 : }
103592 : #endif
103593 : }
103594 :
103595 : // This should not be required since all previously static data members are
103596 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
103597 :
103598 5342 : }
103599 :
103600 :
103601 : void
103602 194 : SgExecStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
103603 : {
103604 : // This function traverses the memory pool for an IR node and
103605 : // calls the function to execute the visitor object.
103606 :
103607 : // Initialize array to the address of the first element of the STL vector
103608 : // (which is guarenteed to be contiguous storage).
103609 : // SgExecStatement objectArray [] = *(Memory_Block_List.begin());
103610 194 : if (SgExecStatement::pools.empty() == false)
103611 : {
103612 : // Generate an array of memory pools
103613 0 : SgExecStatement** objectArray = (SgExecStatement**) &(SgExecStatement::pools[0]);
103614 :
103615 : // Build a local variable for better performance
103616 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
103617 :
103618 : // Iterate over the memory pools
103619 0 : for (unsigned int i=0; i < SgExecStatement::pools.size(); i++)
103620 : {
103621 : // objectArray[i] is a single memory pool
103622 0 : for (unsigned j=0; j < SgExecStatement::pool_size; j++)
103623 : {
103624 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
103625 : {
103626 : // printf ("Found a valid SgExecStatement object in the memory pool %d at position %d \n",i,j);
103627 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
103628 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
103629 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
103630 : }
103631 : else
103632 : {
103633 : // printf ("Found a INVALID SgExecStatement object in the memory pool \n");
103634 : }
103635 : }
103636 : }
103637 : }
103638 :
103639 : // This should not be required since all previously static data members are
103640 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
103641 :
103642 194 : }
103643 :
103644 : void
103645 0 : SgExecStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
103646 : {
103647 : // This function visits only a single IR node of the memory pool.
103648 : // it is typically called once for each type of IR node within
103649 : // the automatically generated function: traverseRepresentativeNodes().
103650 :
103651 : // Initialize array to the address of the first element of the STL vector
103652 : // (which is guarenteed to be contiguous storage).
103653 : // SgExecStatement objectArray [] = *(Memory_Block_List.begin());
103654 0 : if (SgExecStatement::pools.empty() == false)
103655 : {
103656 : // Generate an array of memory pools
103657 0 : SgExecStatement** objectArray = (SgExecStatement**) &(SgExecStatement::pools[0]);
103658 :
103659 : // Build a local variable for better performance
103660 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
103661 :
103662 : // Iterate over the memory pools
103663 0 : bool done = false;
103664 0 : unsigned i=0;
103665 :
103666 : // find the first valid IR node, call visit function, and then leave
103667 0 : while ( done == false && i < SgExecStatement::pools.size() )
103668 : {
103669 : // objectArray[i] is a single memory pool
103670 : unsigned j=0;
103671 0 : while (done == false && j < SgExecStatement::pool_size)
103672 : {
103673 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
103674 : {
103675 0 : traversal.visit(&(objectArray[i][j]));
103676 0 : done = true;
103677 : }
103678 0 : j++;
103679 : }
103680 0 : i++;
103681 : }
103682 :
103683 : #if 0
103684 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
103685 : if (done == false)
103686 : {
103687 : printf ("No representative for SgExecStatement found in memory pools \n");
103688 : }
103689 : #endif
103690 : }
103691 0 : }
103692 :
103693 :
103694 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
103695 : // using values that overflow signed values of int.
103696 : size_t
103697 4 : SgExecStatement::numberOfNodes()
103698 : {
103699 : // This function traverses the memory pool for an IR node and
103700 : // counts the number of IR nodes of a particular Sage III IR
103701 : // nodes type.
103702 :
103703 4 : size_t count = 0;
103704 4 : if (SgExecStatement::pools.empty() == false)
103705 : {
103706 : // Generate an array of memory pools (this is actually a STL vector,
103707 : // but it is contiguious, so OK to treat this way).
103708 0 : SgExecStatement** objectArray = (SgExecStatement**) &(SgExecStatement::pools[0]);
103709 :
103710 : // Build a local variable for better performance (make it a loop invariant variable).
103711 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
103712 :
103713 : // Iterate over all of the memory pools for this IR node.
103714 0 : for (unsigned int i=0; i < SgExecStatement::pools.size(); i++)
103715 : {
103716 : // objectArray[i] is a single memory pool, iterate over all the
103717 : // IR nodes and only count those that are valid IR nodes used in
103718 : // the AST (i.e. allocated IR nodes).
103719 0 : for (unsigned j=0; j < SgExecStatement::pool_size; j++)
103720 : {
103721 : // This is indexing the STL vector of C/C++ style arrays as a doubly
103722 : // indexed array access. It is OK since we have leveraged the semantics
103723 : // of STL vector memory as contigous and cast the memory as an array
103724 : // of arrays to use the 2D array indexing. Hope this is not confusing,
103725 : // but it s very fast as an implementation.
103726 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
103727 : {
103728 0 : count++;
103729 : }
103730 : }
103731 : }
103732 : }
103733 :
103734 :
103735 :
103736 4 : return count;
103737 : }
103738 :
103739 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
103740 : // using values that overflow signed values of int.
103741 : size_t
103742 0 : SgExecStatement::memoryUsage()
103743 : {
103744 : // This function is required because we need the class name as a type when we call sizeof
103745 : // There might be another way to implement this if we have a traversal that only called a
103746 : // representative object (one call for each type of Sage IIIIR node).
103747 0 : size_t memory = numberOfNodes() * sizeof(SgExecStatement);
103748 :
103749 0 : return memory;
103750 : }
103751 :
103752 : /* #line 103753 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
103753 :
103754 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
103755 : void
103756 5342 : SgImageControlStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
103757 : {
103758 : // This function traverses the memory pool for only a specific IR node
103759 : // and calls the visit function of the input class execute a traversal
103760 : // similar to the style of the attribute based traversals within ROSE.
103761 : // This traversal will visit ALL nodes of the AST where as the other
103762 : // attribute based traversals visit only the embedded tree within the AST.
103763 :
103764 : // Initialize array to the address of the first element of the STL vector
103765 : // (which is guaranteed to be contiguous storage).
103766 : // SgImageControlStatement objectArray [] = *(Memory_Block_List.begin());
103767 5342 : if (SgImageControlStatement::pools.empty() == false)
103768 : {
103769 : // Generate an array of memory pools
103770 0 : SgImageControlStatement** objectArray = (SgImageControlStatement**) &(SgImageControlStatement::pools[0]);
103771 :
103772 : // Build a local variable for better performance
103773 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
103774 : #if 0
103775 : // Iterate over the memory pools
103776 : for (unsigned int i=0; i < SgImageControlStatement::pools.size(); i++)
103777 : {
103778 : // objectArray[i] is a single memory pool
103779 : for (int j=0; j < SgImageControlStatement::pool_size; j++)
103780 : {
103781 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
103782 : {
103783 : traversal.visit(&(objectArray[i][j]));
103784 : }
103785 : }
103786 : }
103787 : #else
103788 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
103789 : // compute the list first and then call the visit function on each list element.
103790 :
103791 : // printf ("Inside of SgImageControlStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
103792 :
103793 0 : std::vector<SgImageControlStatement*> nodeList;
103794 :
103795 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
103796 0 : for (unsigned int i=0; i < SgImageControlStatement::pools.size(); i++)
103797 : {
103798 : // objectArray[i] is a single memory pool
103799 0 : for (unsigned j=0; j < SgImageControlStatement::pool_size; j++)
103800 : {
103801 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
103802 : {
103803 0 : nodeList.push_back(&(objectArray[i][j]));
103804 : }
103805 : }
103806 : }
103807 :
103808 : // Iterate over the saved list
103809 0 : size_t nodeListSize = nodeList.size();
103810 0 : for (size_t i=0; i < nodeListSize; i++)
103811 : {
103812 0 : ROSE_ASSERT(nodeList[i] != NULL);
103813 : #if 0
103814 : traversal.visit(nodeList[i]);
103815 : #else
103816 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
103817 : {
103818 0 : traversal.visit(nodeList[i]);
103819 : }
103820 : #endif
103821 : }
103822 : #endif
103823 : }
103824 :
103825 : // This should not be required since all previously static data members are
103826 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
103827 :
103828 5342 : }
103829 :
103830 :
103831 : void
103832 194 : SgImageControlStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
103833 : {
103834 : // This function traverses the memory pool for an IR node and
103835 : // calls the function to execute the visitor object.
103836 :
103837 : // Initialize array to the address of the first element of the STL vector
103838 : // (which is guarenteed to be contiguous storage).
103839 : // SgImageControlStatement objectArray [] = *(Memory_Block_List.begin());
103840 194 : if (SgImageControlStatement::pools.empty() == false)
103841 : {
103842 : // Generate an array of memory pools
103843 0 : SgImageControlStatement** objectArray = (SgImageControlStatement**) &(SgImageControlStatement::pools[0]);
103844 :
103845 : // Build a local variable for better performance
103846 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
103847 :
103848 : // Iterate over the memory pools
103849 0 : for (unsigned int i=0; i < SgImageControlStatement::pools.size(); i++)
103850 : {
103851 : // objectArray[i] is a single memory pool
103852 0 : for (unsigned j=0; j < SgImageControlStatement::pool_size; j++)
103853 : {
103854 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
103855 : {
103856 : // printf ("Found a valid SgImageControlStatement object in the memory pool %d at position %d \n",i,j);
103857 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
103858 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
103859 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
103860 : }
103861 : else
103862 : {
103863 : // printf ("Found a INVALID SgImageControlStatement object in the memory pool \n");
103864 : }
103865 : }
103866 : }
103867 : }
103868 :
103869 : // This should not be required since all previously static data members are
103870 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
103871 :
103872 194 : }
103873 :
103874 : void
103875 0 : SgImageControlStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
103876 : {
103877 : // This function visits only a single IR node of the memory pool.
103878 : // it is typically called once for each type of IR node within
103879 : // the automatically generated function: traverseRepresentativeNodes().
103880 :
103881 : // Initialize array to the address of the first element of the STL vector
103882 : // (which is guarenteed to be contiguous storage).
103883 : // SgImageControlStatement objectArray [] = *(Memory_Block_List.begin());
103884 0 : if (SgImageControlStatement::pools.empty() == false)
103885 : {
103886 : // Generate an array of memory pools
103887 0 : SgImageControlStatement** objectArray = (SgImageControlStatement**) &(SgImageControlStatement::pools[0]);
103888 :
103889 : // Build a local variable for better performance
103890 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
103891 :
103892 : // Iterate over the memory pools
103893 0 : bool done = false;
103894 0 : unsigned i=0;
103895 :
103896 : // find the first valid IR node, call visit function, and then leave
103897 0 : while ( done == false && i < SgImageControlStatement::pools.size() )
103898 : {
103899 : // objectArray[i] is a single memory pool
103900 : unsigned j=0;
103901 0 : while (done == false && j < SgImageControlStatement::pool_size)
103902 : {
103903 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
103904 : {
103905 0 : traversal.visit(&(objectArray[i][j]));
103906 0 : done = true;
103907 : }
103908 0 : j++;
103909 : }
103910 0 : i++;
103911 : }
103912 :
103913 : #if 0
103914 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
103915 : if (done == false)
103916 : {
103917 : printf ("No representative for SgImageControlStatement found in memory pools \n");
103918 : }
103919 : #endif
103920 : }
103921 0 : }
103922 :
103923 :
103924 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
103925 : // using values that overflow signed values of int.
103926 : size_t
103927 4 : SgImageControlStatement::numberOfNodes()
103928 : {
103929 : // This function traverses the memory pool for an IR node and
103930 : // counts the number of IR nodes of a particular Sage III IR
103931 : // nodes type.
103932 :
103933 4 : size_t count = 0;
103934 4 : if (SgImageControlStatement::pools.empty() == false)
103935 : {
103936 : // Generate an array of memory pools (this is actually a STL vector,
103937 : // but it is contiguious, so OK to treat this way).
103938 0 : SgImageControlStatement** objectArray = (SgImageControlStatement**) &(SgImageControlStatement::pools[0]);
103939 :
103940 : // Build a local variable for better performance (make it a loop invariant variable).
103941 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
103942 :
103943 : // Iterate over all of the memory pools for this IR node.
103944 0 : for (unsigned int i=0; i < SgImageControlStatement::pools.size(); i++)
103945 : {
103946 : // objectArray[i] is a single memory pool, iterate over all the
103947 : // IR nodes and only count those that are valid IR nodes used in
103948 : // the AST (i.e. allocated IR nodes).
103949 0 : for (unsigned j=0; j < SgImageControlStatement::pool_size; j++)
103950 : {
103951 : // This is indexing the STL vector of C/C++ style arrays as a doubly
103952 : // indexed array access. It is OK since we have leveraged the semantics
103953 : // of STL vector memory as contigous and cast the memory as an array
103954 : // of arrays to use the 2D array indexing. Hope this is not confusing,
103955 : // but it s very fast as an implementation.
103956 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
103957 : {
103958 0 : count++;
103959 : }
103960 : }
103961 : }
103962 : }
103963 :
103964 :
103965 :
103966 4 : return count;
103967 : }
103968 :
103969 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
103970 : // using values that overflow signed values of int.
103971 : size_t
103972 0 : SgImageControlStatement::memoryUsage()
103973 : {
103974 : // This function is required because we need the class name as a type when we call sizeof
103975 : // There might be another way to implement this if we have a traversal that only called a
103976 : // representative object (one call for each type of Sage IIIIR node).
103977 0 : size_t memory = numberOfNodes() * sizeof(SgImageControlStatement);
103978 :
103979 0 : return memory;
103980 : }
103981 :
103982 : /* #line 103983 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
103983 :
103984 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
103985 : void
103986 5342 : SgSyncAllStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
103987 : {
103988 : // This function traverses the memory pool for only a specific IR node
103989 : // and calls the visit function of the input class execute a traversal
103990 : // similar to the style of the attribute based traversals within ROSE.
103991 : // This traversal will visit ALL nodes of the AST where as the other
103992 : // attribute based traversals visit only the embedded tree within the AST.
103993 :
103994 : // Initialize array to the address of the first element of the STL vector
103995 : // (which is guaranteed to be contiguous storage).
103996 : // SgSyncAllStatement objectArray [] = *(Memory_Block_List.begin());
103997 5342 : if (SgSyncAllStatement::pools.empty() == false)
103998 : {
103999 : // Generate an array of memory pools
104000 0 : SgSyncAllStatement** objectArray = (SgSyncAllStatement**) &(SgSyncAllStatement::pools[0]);
104001 :
104002 : // Build a local variable for better performance
104003 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
104004 : #if 0
104005 : // Iterate over the memory pools
104006 : for (unsigned int i=0; i < SgSyncAllStatement::pools.size(); i++)
104007 : {
104008 : // objectArray[i] is a single memory pool
104009 : for (int j=0; j < SgSyncAllStatement::pool_size; j++)
104010 : {
104011 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
104012 : {
104013 : traversal.visit(&(objectArray[i][j]));
104014 : }
104015 : }
104016 : }
104017 : #else
104018 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
104019 : // compute the list first and then call the visit function on each list element.
104020 :
104021 : // printf ("Inside of SgSyncAllStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
104022 :
104023 0 : std::vector<SgSyncAllStatement*> nodeList;
104024 :
104025 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
104026 0 : for (unsigned int i=0; i < SgSyncAllStatement::pools.size(); i++)
104027 : {
104028 : // objectArray[i] is a single memory pool
104029 0 : for (unsigned j=0; j < SgSyncAllStatement::pool_size; j++)
104030 : {
104031 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
104032 : {
104033 0 : nodeList.push_back(&(objectArray[i][j]));
104034 : }
104035 : }
104036 : }
104037 :
104038 : // Iterate over the saved list
104039 0 : size_t nodeListSize = nodeList.size();
104040 0 : for (size_t i=0; i < nodeListSize; i++)
104041 : {
104042 0 : ROSE_ASSERT(nodeList[i] != NULL);
104043 : #if 0
104044 : traversal.visit(nodeList[i]);
104045 : #else
104046 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
104047 : {
104048 0 : traversal.visit(nodeList[i]);
104049 : }
104050 : #endif
104051 : }
104052 : #endif
104053 : }
104054 :
104055 : // This should not be required since all previously static data members are
104056 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
104057 :
104058 5342 : }
104059 :
104060 :
104061 : void
104062 194 : SgSyncAllStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
104063 : {
104064 : // This function traverses the memory pool for an IR node and
104065 : // calls the function to execute the visitor object.
104066 :
104067 : // Initialize array to the address of the first element of the STL vector
104068 : // (which is guarenteed to be contiguous storage).
104069 : // SgSyncAllStatement objectArray [] = *(Memory_Block_List.begin());
104070 194 : if (SgSyncAllStatement::pools.empty() == false)
104071 : {
104072 : // Generate an array of memory pools
104073 0 : SgSyncAllStatement** objectArray = (SgSyncAllStatement**) &(SgSyncAllStatement::pools[0]);
104074 :
104075 : // Build a local variable for better performance
104076 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
104077 :
104078 : // Iterate over the memory pools
104079 0 : for (unsigned int i=0; i < SgSyncAllStatement::pools.size(); i++)
104080 : {
104081 : // objectArray[i] is a single memory pool
104082 0 : for (unsigned j=0; j < SgSyncAllStatement::pool_size; j++)
104083 : {
104084 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
104085 : {
104086 : // printf ("Found a valid SgSyncAllStatement object in the memory pool %d at position %d \n",i,j);
104087 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
104088 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
104089 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
104090 : }
104091 : else
104092 : {
104093 : // printf ("Found a INVALID SgSyncAllStatement object in the memory pool \n");
104094 : }
104095 : }
104096 : }
104097 : }
104098 :
104099 : // This should not be required since all previously static data members are
104100 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
104101 :
104102 194 : }
104103 :
104104 : void
104105 0 : SgSyncAllStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
104106 : {
104107 : // This function visits only a single IR node of the memory pool.
104108 : // it is typically called once for each type of IR node within
104109 : // the automatically generated function: traverseRepresentativeNodes().
104110 :
104111 : // Initialize array to the address of the first element of the STL vector
104112 : // (which is guarenteed to be contiguous storage).
104113 : // SgSyncAllStatement objectArray [] = *(Memory_Block_List.begin());
104114 0 : if (SgSyncAllStatement::pools.empty() == false)
104115 : {
104116 : // Generate an array of memory pools
104117 0 : SgSyncAllStatement** objectArray = (SgSyncAllStatement**) &(SgSyncAllStatement::pools[0]);
104118 :
104119 : // Build a local variable for better performance
104120 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
104121 :
104122 : // Iterate over the memory pools
104123 0 : bool done = false;
104124 0 : unsigned i=0;
104125 :
104126 : // find the first valid IR node, call visit function, and then leave
104127 0 : while ( done == false && i < SgSyncAllStatement::pools.size() )
104128 : {
104129 : // objectArray[i] is a single memory pool
104130 : unsigned j=0;
104131 0 : while (done == false && j < SgSyncAllStatement::pool_size)
104132 : {
104133 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
104134 : {
104135 0 : traversal.visit(&(objectArray[i][j]));
104136 0 : done = true;
104137 : }
104138 0 : j++;
104139 : }
104140 0 : i++;
104141 : }
104142 :
104143 : #if 0
104144 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
104145 : if (done == false)
104146 : {
104147 : printf ("No representative for SgSyncAllStatement found in memory pools \n");
104148 : }
104149 : #endif
104150 : }
104151 0 : }
104152 :
104153 :
104154 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
104155 : // using values that overflow signed values of int.
104156 : size_t
104157 4 : SgSyncAllStatement::numberOfNodes()
104158 : {
104159 : // This function traverses the memory pool for an IR node and
104160 : // counts the number of IR nodes of a particular Sage III IR
104161 : // nodes type.
104162 :
104163 4 : size_t count = 0;
104164 4 : if (SgSyncAllStatement::pools.empty() == false)
104165 : {
104166 : // Generate an array of memory pools (this is actually a STL vector,
104167 : // but it is contiguious, so OK to treat this way).
104168 0 : SgSyncAllStatement** objectArray = (SgSyncAllStatement**) &(SgSyncAllStatement::pools[0]);
104169 :
104170 : // Build a local variable for better performance (make it a loop invariant variable).
104171 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
104172 :
104173 : // Iterate over all of the memory pools for this IR node.
104174 0 : for (unsigned int i=0; i < SgSyncAllStatement::pools.size(); i++)
104175 : {
104176 : // objectArray[i] is a single memory pool, iterate over all the
104177 : // IR nodes and only count those that are valid IR nodes used in
104178 : // the AST (i.e. allocated IR nodes).
104179 0 : for (unsigned j=0; j < SgSyncAllStatement::pool_size; j++)
104180 : {
104181 : // This is indexing the STL vector of C/C++ style arrays as a doubly
104182 : // indexed array access. It is OK since we have leveraged the semantics
104183 : // of STL vector memory as contigous and cast the memory as an array
104184 : // of arrays to use the 2D array indexing. Hope this is not confusing,
104185 : // but it s very fast as an implementation.
104186 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
104187 : {
104188 0 : count++;
104189 : }
104190 : }
104191 : }
104192 : }
104193 :
104194 :
104195 :
104196 4 : return count;
104197 : }
104198 :
104199 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
104200 : // using values that overflow signed values of int.
104201 : size_t
104202 0 : SgSyncAllStatement::memoryUsage()
104203 : {
104204 : // This function is required because we need the class name as a type when we call sizeof
104205 : // There might be another way to implement this if we have a traversal that only called a
104206 : // representative object (one call for each type of Sage IIIIR node).
104207 0 : size_t memory = numberOfNodes() * sizeof(SgSyncAllStatement);
104208 :
104209 0 : return memory;
104210 : }
104211 :
104212 : /* #line 104213 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
104213 :
104214 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
104215 : void
104216 5342 : SgSyncImagesStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
104217 : {
104218 : // This function traverses the memory pool for only a specific IR node
104219 : // and calls the visit function of the input class execute a traversal
104220 : // similar to the style of the attribute based traversals within ROSE.
104221 : // This traversal will visit ALL nodes of the AST where as the other
104222 : // attribute based traversals visit only the embedded tree within the AST.
104223 :
104224 : // Initialize array to the address of the first element of the STL vector
104225 : // (which is guaranteed to be contiguous storage).
104226 : // SgSyncImagesStatement objectArray [] = *(Memory_Block_List.begin());
104227 5342 : if (SgSyncImagesStatement::pools.empty() == false)
104228 : {
104229 : // Generate an array of memory pools
104230 0 : SgSyncImagesStatement** objectArray = (SgSyncImagesStatement**) &(SgSyncImagesStatement::pools[0]);
104231 :
104232 : // Build a local variable for better performance
104233 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
104234 : #if 0
104235 : // Iterate over the memory pools
104236 : for (unsigned int i=0; i < SgSyncImagesStatement::pools.size(); i++)
104237 : {
104238 : // objectArray[i] is a single memory pool
104239 : for (int j=0; j < SgSyncImagesStatement::pool_size; j++)
104240 : {
104241 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
104242 : {
104243 : traversal.visit(&(objectArray[i][j]));
104244 : }
104245 : }
104246 : }
104247 : #else
104248 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
104249 : // compute the list first and then call the visit function on each list element.
104250 :
104251 : // printf ("Inside of SgSyncImagesStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
104252 :
104253 0 : std::vector<SgSyncImagesStatement*> nodeList;
104254 :
104255 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
104256 0 : for (unsigned int i=0; i < SgSyncImagesStatement::pools.size(); i++)
104257 : {
104258 : // objectArray[i] is a single memory pool
104259 0 : for (unsigned j=0; j < SgSyncImagesStatement::pool_size; j++)
104260 : {
104261 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
104262 : {
104263 0 : nodeList.push_back(&(objectArray[i][j]));
104264 : }
104265 : }
104266 : }
104267 :
104268 : // Iterate over the saved list
104269 0 : size_t nodeListSize = nodeList.size();
104270 0 : for (size_t i=0; i < nodeListSize; i++)
104271 : {
104272 0 : ROSE_ASSERT(nodeList[i] != NULL);
104273 : #if 0
104274 : traversal.visit(nodeList[i]);
104275 : #else
104276 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
104277 : {
104278 0 : traversal.visit(nodeList[i]);
104279 : }
104280 : #endif
104281 : }
104282 : #endif
104283 : }
104284 :
104285 : // This should not be required since all previously static data members are
104286 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
104287 :
104288 5342 : }
104289 :
104290 :
104291 : void
104292 194 : SgSyncImagesStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
104293 : {
104294 : // This function traverses the memory pool for an IR node and
104295 : // calls the function to execute the visitor object.
104296 :
104297 : // Initialize array to the address of the first element of the STL vector
104298 : // (which is guarenteed to be contiguous storage).
104299 : // SgSyncImagesStatement objectArray [] = *(Memory_Block_List.begin());
104300 194 : if (SgSyncImagesStatement::pools.empty() == false)
104301 : {
104302 : // Generate an array of memory pools
104303 0 : SgSyncImagesStatement** objectArray = (SgSyncImagesStatement**) &(SgSyncImagesStatement::pools[0]);
104304 :
104305 : // Build a local variable for better performance
104306 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
104307 :
104308 : // Iterate over the memory pools
104309 0 : for (unsigned int i=0; i < SgSyncImagesStatement::pools.size(); i++)
104310 : {
104311 : // objectArray[i] is a single memory pool
104312 0 : for (unsigned j=0; j < SgSyncImagesStatement::pool_size; j++)
104313 : {
104314 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
104315 : {
104316 : // printf ("Found a valid SgSyncImagesStatement object in the memory pool %d at position %d \n",i,j);
104317 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
104318 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
104319 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
104320 : }
104321 : else
104322 : {
104323 : // printf ("Found a INVALID SgSyncImagesStatement object in the memory pool \n");
104324 : }
104325 : }
104326 : }
104327 : }
104328 :
104329 : // This should not be required since all previously static data members are
104330 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
104331 :
104332 194 : }
104333 :
104334 : void
104335 0 : SgSyncImagesStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
104336 : {
104337 : // This function visits only a single IR node of the memory pool.
104338 : // it is typically called once for each type of IR node within
104339 : // the automatically generated function: traverseRepresentativeNodes().
104340 :
104341 : // Initialize array to the address of the first element of the STL vector
104342 : // (which is guarenteed to be contiguous storage).
104343 : // SgSyncImagesStatement objectArray [] = *(Memory_Block_List.begin());
104344 0 : if (SgSyncImagesStatement::pools.empty() == false)
104345 : {
104346 : // Generate an array of memory pools
104347 0 : SgSyncImagesStatement** objectArray = (SgSyncImagesStatement**) &(SgSyncImagesStatement::pools[0]);
104348 :
104349 : // Build a local variable for better performance
104350 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
104351 :
104352 : // Iterate over the memory pools
104353 0 : bool done = false;
104354 0 : unsigned i=0;
104355 :
104356 : // find the first valid IR node, call visit function, and then leave
104357 0 : while ( done == false && i < SgSyncImagesStatement::pools.size() )
104358 : {
104359 : // objectArray[i] is a single memory pool
104360 : unsigned j=0;
104361 0 : while (done == false && j < SgSyncImagesStatement::pool_size)
104362 : {
104363 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
104364 : {
104365 0 : traversal.visit(&(objectArray[i][j]));
104366 0 : done = true;
104367 : }
104368 0 : j++;
104369 : }
104370 0 : i++;
104371 : }
104372 :
104373 : #if 0
104374 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
104375 : if (done == false)
104376 : {
104377 : printf ("No representative for SgSyncImagesStatement found in memory pools \n");
104378 : }
104379 : #endif
104380 : }
104381 0 : }
104382 :
104383 :
104384 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
104385 : // using values that overflow signed values of int.
104386 : size_t
104387 4 : SgSyncImagesStatement::numberOfNodes()
104388 : {
104389 : // This function traverses the memory pool for an IR node and
104390 : // counts the number of IR nodes of a particular Sage III IR
104391 : // nodes type.
104392 :
104393 4 : size_t count = 0;
104394 4 : if (SgSyncImagesStatement::pools.empty() == false)
104395 : {
104396 : // Generate an array of memory pools (this is actually a STL vector,
104397 : // but it is contiguious, so OK to treat this way).
104398 0 : SgSyncImagesStatement** objectArray = (SgSyncImagesStatement**) &(SgSyncImagesStatement::pools[0]);
104399 :
104400 : // Build a local variable for better performance (make it a loop invariant variable).
104401 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
104402 :
104403 : // Iterate over all of the memory pools for this IR node.
104404 0 : for (unsigned int i=0; i < SgSyncImagesStatement::pools.size(); i++)
104405 : {
104406 : // objectArray[i] is a single memory pool, iterate over all the
104407 : // IR nodes and only count those that are valid IR nodes used in
104408 : // the AST (i.e. allocated IR nodes).
104409 0 : for (unsigned j=0; j < SgSyncImagesStatement::pool_size; j++)
104410 : {
104411 : // This is indexing the STL vector of C/C++ style arrays as a doubly
104412 : // indexed array access. It is OK since we have leveraged the semantics
104413 : // of STL vector memory as contigous and cast the memory as an array
104414 : // of arrays to use the 2D array indexing. Hope this is not confusing,
104415 : // but it s very fast as an implementation.
104416 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
104417 : {
104418 0 : count++;
104419 : }
104420 : }
104421 : }
104422 : }
104423 :
104424 :
104425 :
104426 4 : return count;
104427 : }
104428 :
104429 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
104430 : // using values that overflow signed values of int.
104431 : size_t
104432 0 : SgSyncImagesStatement::memoryUsage()
104433 : {
104434 : // This function is required because we need the class name as a type when we call sizeof
104435 : // There might be another way to implement this if we have a traversal that only called a
104436 : // representative object (one call for each type of Sage IIIIR node).
104437 0 : size_t memory = numberOfNodes() * sizeof(SgSyncImagesStatement);
104438 :
104439 0 : return memory;
104440 : }
104441 :
104442 : /* #line 104443 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
104443 :
104444 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
104445 : void
104446 5342 : SgSyncMemoryStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
104447 : {
104448 : // This function traverses the memory pool for only a specific IR node
104449 : // and calls the visit function of the input class execute a traversal
104450 : // similar to the style of the attribute based traversals within ROSE.
104451 : // This traversal will visit ALL nodes of the AST where as the other
104452 : // attribute based traversals visit only the embedded tree within the AST.
104453 :
104454 : // Initialize array to the address of the first element of the STL vector
104455 : // (which is guaranteed to be contiguous storage).
104456 : // SgSyncMemoryStatement objectArray [] = *(Memory_Block_List.begin());
104457 5342 : if (SgSyncMemoryStatement::pools.empty() == false)
104458 : {
104459 : // Generate an array of memory pools
104460 0 : SgSyncMemoryStatement** objectArray = (SgSyncMemoryStatement**) &(SgSyncMemoryStatement::pools[0]);
104461 :
104462 : // Build a local variable for better performance
104463 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
104464 : #if 0
104465 : // Iterate over the memory pools
104466 : for (unsigned int i=0; i < SgSyncMemoryStatement::pools.size(); i++)
104467 : {
104468 : // objectArray[i] is a single memory pool
104469 : for (int j=0; j < SgSyncMemoryStatement::pool_size; j++)
104470 : {
104471 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
104472 : {
104473 : traversal.visit(&(objectArray[i][j]));
104474 : }
104475 : }
104476 : }
104477 : #else
104478 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
104479 : // compute the list first and then call the visit function on each list element.
104480 :
104481 : // printf ("Inside of SgSyncMemoryStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
104482 :
104483 0 : std::vector<SgSyncMemoryStatement*> nodeList;
104484 :
104485 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
104486 0 : for (unsigned int i=0; i < SgSyncMemoryStatement::pools.size(); i++)
104487 : {
104488 : // objectArray[i] is a single memory pool
104489 0 : for (unsigned j=0; j < SgSyncMemoryStatement::pool_size; j++)
104490 : {
104491 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
104492 : {
104493 0 : nodeList.push_back(&(objectArray[i][j]));
104494 : }
104495 : }
104496 : }
104497 :
104498 : // Iterate over the saved list
104499 0 : size_t nodeListSize = nodeList.size();
104500 0 : for (size_t i=0; i < nodeListSize; i++)
104501 : {
104502 0 : ROSE_ASSERT(nodeList[i] != NULL);
104503 : #if 0
104504 : traversal.visit(nodeList[i]);
104505 : #else
104506 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
104507 : {
104508 0 : traversal.visit(nodeList[i]);
104509 : }
104510 : #endif
104511 : }
104512 : #endif
104513 : }
104514 :
104515 : // This should not be required since all previously static data members are
104516 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
104517 :
104518 5342 : }
104519 :
104520 :
104521 : void
104522 194 : SgSyncMemoryStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
104523 : {
104524 : // This function traverses the memory pool for an IR node and
104525 : // calls the function to execute the visitor object.
104526 :
104527 : // Initialize array to the address of the first element of the STL vector
104528 : // (which is guarenteed to be contiguous storage).
104529 : // SgSyncMemoryStatement objectArray [] = *(Memory_Block_List.begin());
104530 194 : if (SgSyncMemoryStatement::pools.empty() == false)
104531 : {
104532 : // Generate an array of memory pools
104533 0 : SgSyncMemoryStatement** objectArray = (SgSyncMemoryStatement**) &(SgSyncMemoryStatement::pools[0]);
104534 :
104535 : // Build a local variable for better performance
104536 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
104537 :
104538 : // Iterate over the memory pools
104539 0 : for (unsigned int i=0; i < SgSyncMemoryStatement::pools.size(); i++)
104540 : {
104541 : // objectArray[i] is a single memory pool
104542 0 : for (unsigned j=0; j < SgSyncMemoryStatement::pool_size; j++)
104543 : {
104544 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
104545 : {
104546 : // printf ("Found a valid SgSyncMemoryStatement object in the memory pool %d at position %d \n",i,j);
104547 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
104548 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
104549 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
104550 : }
104551 : else
104552 : {
104553 : // printf ("Found a INVALID SgSyncMemoryStatement object in the memory pool \n");
104554 : }
104555 : }
104556 : }
104557 : }
104558 :
104559 : // This should not be required since all previously static data members are
104560 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
104561 :
104562 194 : }
104563 :
104564 : void
104565 0 : SgSyncMemoryStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
104566 : {
104567 : // This function visits only a single IR node of the memory pool.
104568 : // it is typically called once for each type of IR node within
104569 : // the automatically generated function: traverseRepresentativeNodes().
104570 :
104571 : // Initialize array to the address of the first element of the STL vector
104572 : // (which is guarenteed to be contiguous storage).
104573 : // SgSyncMemoryStatement objectArray [] = *(Memory_Block_List.begin());
104574 0 : if (SgSyncMemoryStatement::pools.empty() == false)
104575 : {
104576 : // Generate an array of memory pools
104577 0 : SgSyncMemoryStatement** objectArray = (SgSyncMemoryStatement**) &(SgSyncMemoryStatement::pools[0]);
104578 :
104579 : // Build a local variable for better performance
104580 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
104581 :
104582 : // Iterate over the memory pools
104583 0 : bool done = false;
104584 0 : unsigned i=0;
104585 :
104586 : // find the first valid IR node, call visit function, and then leave
104587 0 : while ( done == false && i < SgSyncMemoryStatement::pools.size() )
104588 : {
104589 : // objectArray[i] is a single memory pool
104590 : unsigned j=0;
104591 0 : while (done == false && j < SgSyncMemoryStatement::pool_size)
104592 : {
104593 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
104594 : {
104595 0 : traversal.visit(&(objectArray[i][j]));
104596 0 : done = true;
104597 : }
104598 0 : j++;
104599 : }
104600 0 : i++;
104601 : }
104602 :
104603 : #if 0
104604 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
104605 : if (done == false)
104606 : {
104607 : printf ("No representative for SgSyncMemoryStatement found in memory pools \n");
104608 : }
104609 : #endif
104610 : }
104611 0 : }
104612 :
104613 :
104614 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
104615 : // using values that overflow signed values of int.
104616 : size_t
104617 4 : SgSyncMemoryStatement::numberOfNodes()
104618 : {
104619 : // This function traverses the memory pool for an IR node and
104620 : // counts the number of IR nodes of a particular Sage III IR
104621 : // nodes type.
104622 :
104623 4 : size_t count = 0;
104624 4 : if (SgSyncMemoryStatement::pools.empty() == false)
104625 : {
104626 : // Generate an array of memory pools (this is actually a STL vector,
104627 : // but it is contiguious, so OK to treat this way).
104628 0 : SgSyncMemoryStatement** objectArray = (SgSyncMemoryStatement**) &(SgSyncMemoryStatement::pools[0]);
104629 :
104630 : // Build a local variable for better performance (make it a loop invariant variable).
104631 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
104632 :
104633 : // Iterate over all of the memory pools for this IR node.
104634 0 : for (unsigned int i=0; i < SgSyncMemoryStatement::pools.size(); i++)
104635 : {
104636 : // objectArray[i] is a single memory pool, iterate over all the
104637 : // IR nodes and only count those that are valid IR nodes used in
104638 : // the AST (i.e. allocated IR nodes).
104639 0 : for (unsigned j=0; j < SgSyncMemoryStatement::pool_size; j++)
104640 : {
104641 : // This is indexing the STL vector of C/C++ style arrays as a doubly
104642 : // indexed array access. It is OK since we have leveraged the semantics
104643 : // of STL vector memory as contigous and cast the memory as an array
104644 : // of arrays to use the 2D array indexing. Hope this is not confusing,
104645 : // but it s very fast as an implementation.
104646 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
104647 : {
104648 0 : count++;
104649 : }
104650 : }
104651 : }
104652 : }
104653 :
104654 :
104655 :
104656 4 : return count;
104657 : }
104658 :
104659 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
104660 : // using values that overflow signed values of int.
104661 : size_t
104662 0 : SgSyncMemoryStatement::memoryUsage()
104663 : {
104664 : // This function is required because we need the class name as a type when we call sizeof
104665 : // There might be another way to implement this if we have a traversal that only called a
104666 : // representative object (one call for each type of Sage IIIIR node).
104667 0 : size_t memory = numberOfNodes() * sizeof(SgSyncMemoryStatement);
104668 :
104669 0 : return memory;
104670 : }
104671 :
104672 : /* #line 104673 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
104673 :
104674 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
104675 : void
104676 5342 : SgSyncTeamStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
104677 : {
104678 : // This function traverses the memory pool for only a specific IR node
104679 : // and calls the visit function of the input class execute a traversal
104680 : // similar to the style of the attribute based traversals within ROSE.
104681 : // This traversal will visit ALL nodes of the AST where as the other
104682 : // attribute based traversals visit only the embedded tree within the AST.
104683 :
104684 : // Initialize array to the address of the first element of the STL vector
104685 : // (which is guaranteed to be contiguous storage).
104686 : // SgSyncTeamStatement objectArray [] = *(Memory_Block_List.begin());
104687 5342 : if (SgSyncTeamStatement::pools.empty() == false)
104688 : {
104689 : // Generate an array of memory pools
104690 0 : SgSyncTeamStatement** objectArray = (SgSyncTeamStatement**) &(SgSyncTeamStatement::pools[0]);
104691 :
104692 : // Build a local variable for better performance
104693 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
104694 : #if 0
104695 : // Iterate over the memory pools
104696 : for (unsigned int i=0; i < SgSyncTeamStatement::pools.size(); i++)
104697 : {
104698 : // objectArray[i] is a single memory pool
104699 : for (int j=0; j < SgSyncTeamStatement::pool_size; j++)
104700 : {
104701 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
104702 : {
104703 : traversal.visit(&(objectArray[i][j]));
104704 : }
104705 : }
104706 : }
104707 : #else
104708 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
104709 : // compute the list first and then call the visit function on each list element.
104710 :
104711 : // printf ("Inside of SgSyncTeamStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
104712 :
104713 0 : std::vector<SgSyncTeamStatement*> nodeList;
104714 :
104715 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
104716 0 : for (unsigned int i=0; i < SgSyncTeamStatement::pools.size(); i++)
104717 : {
104718 : // objectArray[i] is a single memory pool
104719 0 : for (unsigned j=0; j < SgSyncTeamStatement::pool_size; j++)
104720 : {
104721 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
104722 : {
104723 0 : nodeList.push_back(&(objectArray[i][j]));
104724 : }
104725 : }
104726 : }
104727 :
104728 : // Iterate over the saved list
104729 0 : size_t nodeListSize = nodeList.size();
104730 0 : for (size_t i=0; i < nodeListSize; i++)
104731 : {
104732 0 : ROSE_ASSERT(nodeList[i] != NULL);
104733 : #if 0
104734 : traversal.visit(nodeList[i]);
104735 : #else
104736 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
104737 : {
104738 0 : traversal.visit(nodeList[i]);
104739 : }
104740 : #endif
104741 : }
104742 : #endif
104743 : }
104744 :
104745 : // This should not be required since all previously static data members are
104746 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
104747 :
104748 5342 : }
104749 :
104750 :
104751 : void
104752 194 : SgSyncTeamStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
104753 : {
104754 : // This function traverses the memory pool for an IR node and
104755 : // calls the function to execute the visitor object.
104756 :
104757 : // Initialize array to the address of the first element of the STL vector
104758 : // (which is guarenteed to be contiguous storage).
104759 : // SgSyncTeamStatement objectArray [] = *(Memory_Block_List.begin());
104760 194 : if (SgSyncTeamStatement::pools.empty() == false)
104761 : {
104762 : // Generate an array of memory pools
104763 0 : SgSyncTeamStatement** objectArray = (SgSyncTeamStatement**) &(SgSyncTeamStatement::pools[0]);
104764 :
104765 : // Build a local variable for better performance
104766 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
104767 :
104768 : // Iterate over the memory pools
104769 0 : for (unsigned int i=0; i < SgSyncTeamStatement::pools.size(); i++)
104770 : {
104771 : // objectArray[i] is a single memory pool
104772 0 : for (unsigned j=0; j < SgSyncTeamStatement::pool_size; j++)
104773 : {
104774 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
104775 : {
104776 : // printf ("Found a valid SgSyncTeamStatement object in the memory pool %d at position %d \n",i,j);
104777 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
104778 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
104779 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
104780 : }
104781 : else
104782 : {
104783 : // printf ("Found a INVALID SgSyncTeamStatement object in the memory pool \n");
104784 : }
104785 : }
104786 : }
104787 : }
104788 :
104789 : // This should not be required since all previously static data members are
104790 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
104791 :
104792 194 : }
104793 :
104794 : void
104795 0 : SgSyncTeamStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
104796 : {
104797 : // This function visits only a single IR node of the memory pool.
104798 : // it is typically called once for each type of IR node within
104799 : // the automatically generated function: traverseRepresentativeNodes().
104800 :
104801 : // Initialize array to the address of the first element of the STL vector
104802 : // (which is guarenteed to be contiguous storage).
104803 : // SgSyncTeamStatement objectArray [] = *(Memory_Block_List.begin());
104804 0 : if (SgSyncTeamStatement::pools.empty() == false)
104805 : {
104806 : // Generate an array of memory pools
104807 0 : SgSyncTeamStatement** objectArray = (SgSyncTeamStatement**) &(SgSyncTeamStatement::pools[0]);
104808 :
104809 : // Build a local variable for better performance
104810 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
104811 :
104812 : // Iterate over the memory pools
104813 0 : bool done = false;
104814 0 : unsigned i=0;
104815 :
104816 : // find the first valid IR node, call visit function, and then leave
104817 0 : while ( done == false && i < SgSyncTeamStatement::pools.size() )
104818 : {
104819 : // objectArray[i] is a single memory pool
104820 : unsigned j=0;
104821 0 : while (done == false && j < SgSyncTeamStatement::pool_size)
104822 : {
104823 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
104824 : {
104825 0 : traversal.visit(&(objectArray[i][j]));
104826 0 : done = true;
104827 : }
104828 0 : j++;
104829 : }
104830 0 : i++;
104831 : }
104832 :
104833 : #if 0
104834 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
104835 : if (done == false)
104836 : {
104837 : printf ("No representative for SgSyncTeamStatement found in memory pools \n");
104838 : }
104839 : #endif
104840 : }
104841 0 : }
104842 :
104843 :
104844 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
104845 : // using values that overflow signed values of int.
104846 : size_t
104847 4 : SgSyncTeamStatement::numberOfNodes()
104848 : {
104849 : // This function traverses the memory pool for an IR node and
104850 : // counts the number of IR nodes of a particular Sage III IR
104851 : // nodes type.
104852 :
104853 4 : size_t count = 0;
104854 4 : if (SgSyncTeamStatement::pools.empty() == false)
104855 : {
104856 : // Generate an array of memory pools (this is actually a STL vector,
104857 : // but it is contiguious, so OK to treat this way).
104858 0 : SgSyncTeamStatement** objectArray = (SgSyncTeamStatement**) &(SgSyncTeamStatement::pools[0]);
104859 :
104860 : // Build a local variable for better performance (make it a loop invariant variable).
104861 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
104862 :
104863 : // Iterate over all of the memory pools for this IR node.
104864 0 : for (unsigned int i=0; i < SgSyncTeamStatement::pools.size(); i++)
104865 : {
104866 : // objectArray[i] is a single memory pool, iterate over all the
104867 : // IR nodes and only count those that are valid IR nodes used in
104868 : // the AST (i.e. allocated IR nodes).
104869 0 : for (unsigned j=0; j < SgSyncTeamStatement::pool_size; j++)
104870 : {
104871 : // This is indexing the STL vector of C/C++ style arrays as a doubly
104872 : // indexed array access. It is OK since we have leveraged the semantics
104873 : // of STL vector memory as contigous and cast the memory as an array
104874 : // of arrays to use the 2D array indexing. Hope this is not confusing,
104875 : // but it s very fast as an implementation.
104876 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
104877 : {
104878 0 : count++;
104879 : }
104880 : }
104881 : }
104882 : }
104883 :
104884 :
104885 :
104886 4 : return count;
104887 : }
104888 :
104889 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
104890 : // using values that overflow signed values of int.
104891 : size_t
104892 0 : SgSyncTeamStatement::memoryUsage()
104893 : {
104894 : // This function is required because we need the class name as a type when we call sizeof
104895 : // There might be another way to implement this if we have a traversal that only called a
104896 : // representative object (one call for each type of Sage IIIIR node).
104897 0 : size_t memory = numberOfNodes() * sizeof(SgSyncTeamStatement);
104898 :
104899 0 : return memory;
104900 : }
104901 :
104902 : /* #line 104903 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
104903 :
104904 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
104905 : void
104906 5342 : SgLockStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
104907 : {
104908 : // This function traverses the memory pool for only a specific IR node
104909 : // and calls the visit function of the input class execute a traversal
104910 : // similar to the style of the attribute based traversals within ROSE.
104911 : // This traversal will visit ALL nodes of the AST where as the other
104912 : // attribute based traversals visit only the embedded tree within the AST.
104913 :
104914 : // Initialize array to the address of the first element of the STL vector
104915 : // (which is guaranteed to be contiguous storage).
104916 : // SgLockStatement objectArray [] = *(Memory_Block_List.begin());
104917 5342 : if (SgLockStatement::pools.empty() == false)
104918 : {
104919 : // Generate an array of memory pools
104920 0 : SgLockStatement** objectArray = (SgLockStatement**) &(SgLockStatement::pools[0]);
104921 :
104922 : // Build a local variable for better performance
104923 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
104924 : #if 0
104925 : // Iterate over the memory pools
104926 : for (unsigned int i=0; i < SgLockStatement::pools.size(); i++)
104927 : {
104928 : // objectArray[i] is a single memory pool
104929 : for (int j=0; j < SgLockStatement::pool_size; j++)
104930 : {
104931 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
104932 : {
104933 : traversal.visit(&(objectArray[i][j]));
104934 : }
104935 : }
104936 : }
104937 : #else
104938 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
104939 : // compute the list first and then call the visit function on each list element.
104940 :
104941 : // printf ("Inside of SgLockStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
104942 :
104943 0 : std::vector<SgLockStatement*> nodeList;
104944 :
104945 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
104946 0 : for (unsigned int i=0; i < SgLockStatement::pools.size(); i++)
104947 : {
104948 : // objectArray[i] is a single memory pool
104949 0 : for (unsigned j=0; j < SgLockStatement::pool_size; j++)
104950 : {
104951 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
104952 : {
104953 0 : nodeList.push_back(&(objectArray[i][j]));
104954 : }
104955 : }
104956 : }
104957 :
104958 : // Iterate over the saved list
104959 0 : size_t nodeListSize = nodeList.size();
104960 0 : for (size_t i=0; i < nodeListSize; i++)
104961 : {
104962 0 : ROSE_ASSERT(nodeList[i] != NULL);
104963 : #if 0
104964 : traversal.visit(nodeList[i]);
104965 : #else
104966 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
104967 : {
104968 0 : traversal.visit(nodeList[i]);
104969 : }
104970 : #endif
104971 : }
104972 : #endif
104973 : }
104974 :
104975 : // This should not be required since all previously static data members are
104976 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
104977 :
104978 5342 : }
104979 :
104980 :
104981 : void
104982 194 : SgLockStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
104983 : {
104984 : // This function traverses the memory pool for an IR node and
104985 : // calls the function to execute the visitor object.
104986 :
104987 : // Initialize array to the address of the first element of the STL vector
104988 : // (which is guarenteed to be contiguous storage).
104989 : // SgLockStatement objectArray [] = *(Memory_Block_List.begin());
104990 194 : if (SgLockStatement::pools.empty() == false)
104991 : {
104992 : // Generate an array of memory pools
104993 0 : SgLockStatement** objectArray = (SgLockStatement**) &(SgLockStatement::pools[0]);
104994 :
104995 : // Build a local variable for better performance
104996 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
104997 :
104998 : // Iterate over the memory pools
104999 0 : for (unsigned int i=0; i < SgLockStatement::pools.size(); i++)
105000 : {
105001 : // objectArray[i] is a single memory pool
105002 0 : for (unsigned j=0; j < SgLockStatement::pool_size; j++)
105003 : {
105004 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
105005 : {
105006 : // printf ("Found a valid SgLockStatement object in the memory pool %d at position %d \n",i,j);
105007 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
105008 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
105009 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
105010 : }
105011 : else
105012 : {
105013 : // printf ("Found a INVALID SgLockStatement object in the memory pool \n");
105014 : }
105015 : }
105016 : }
105017 : }
105018 :
105019 : // This should not be required since all previously static data members are
105020 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
105021 :
105022 194 : }
105023 :
105024 : void
105025 0 : SgLockStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
105026 : {
105027 : // This function visits only a single IR node of the memory pool.
105028 : // it is typically called once for each type of IR node within
105029 : // the automatically generated function: traverseRepresentativeNodes().
105030 :
105031 : // Initialize array to the address of the first element of the STL vector
105032 : // (which is guarenteed to be contiguous storage).
105033 : // SgLockStatement objectArray [] = *(Memory_Block_List.begin());
105034 0 : if (SgLockStatement::pools.empty() == false)
105035 : {
105036 : // Generate an array of memory pools
105037 0 : SgLockStatement** objectArray = (SgLockStatement**) &(SgLockStatement::pools[0]);
105038 :
105039 : // Build a local variable for better performance
105040 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
105041 :
105042 : // Iterate over the memory pools
105043 0 : bool done = false;
105044 0 : unsigned i=0;
105045 :
105046 : // find the first valid IR node, call visit function, and then leave
105047 0 : while ( done == false && i < SgLockStatement::pools.size() )
105048 : {
105049 : // objectArray[i] is a single memory pool
105050 : unsigned j=0;
105051 0 : while (done == false && j < SgLockStatement::pool_size)
105052 : {
105053 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
105054 : {
105055 0 : traversal.visit(&(objectArray[i][j]));
105056 0 : done = true;
105057 : }
105058 0 : j++;
105059 : }
105060 0 : i++;
105061 : }
105062 :
105063 : #if 0
105064 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
105065 : if (done == false)
105066 : {
105067 : printf ("No representative for SgLockStatement found in memory pools \n");
105068 : }
105069 : #endif
105070 : }
105071 0 : }
105072 :
105073 :
105074 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
105075 : // using values that overflow signed values of int.
105076 : size_t
105077 4 : SgLockStatement::numberOfNodes()
105078 : {
105079 : // This function traverses the memory pool for an IR node and
105080 : // counts the number of IR nodes of a particular Sage III IR
105081 : // nodes type.
105082 :
105083 4 : size_t count = 0;
105084 4 : if (SgLockStatement::pools.empty() == false)
105085 : {
105086 : // Generate an array of memory pools (this is actually a STL vector,
105087 : // but it is contiguious, so OK to treat this way).
105088 0 : SgLockStatement** objectArray = (SgLockStatement**) &(SgLockStatement::pools[0]);
105089 :
105090 : // Build a local variable for better performance (make it a loop invariant variable).
105091 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
105092 :
105093 : // Iterate over all of the memory pools for this IR node.
105094 0 : for (unsigned int i=0; i < SgLockStatement::pools.size(); i++)
105095 : {
105096 : // objectArray[i] is a single memory pool, iterate over all the
105097 : // IR nodes and only count those that are valid IR nodes used in
105098 : // the AST (i.e. allocated IR nodes).
105099 0 : for (unsigned j=0; j < SgLockStatement::pool_size; j++)
105100 : {
105101 : // This is indexing the STL vector of C/C++ style arrays as a doubly
105102 : // indexed array access. It is OK since we have leveraged the semantics
105103 : // of STL vector memory as contigous and cast the memory as an array
105104 : // of arrays to use the 2D array indexing. Hope this is not confusing,
105105 : // but it s very fast as an implementation.
105106 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
105107 : {
105108 0 : count++;
105109 : }
105110 : }
105111 : }
105112 : }
105113 :
105114 :
105115 :
105116 4 : return count;
105117 : }
105118 :
105119 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
105120 : // using values that overflow signed values of int.
105121 : size_t
105122 0 : SgLockStatement::memoryUsage()
105123 : {
105124 : // This function is required because we need the class name as a type when we call sizeof
105125 : // There might be another way to implement this if we have a traversal that only called a
105126 : // representative object (one call for each type of Sage IIIIR node).
105127 0 : size_t memory = numberOfNodes() * sizeof(SgLockStatement);
105128 :
105129 0 : return memory;
105130 : }
105131 :
105132 : /* #line 105133 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
105133 :
105134 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
105135 : void
105136 5342 : SgUnlockStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
105137 : {
105138 : // This function traverses the memory pool for only a specific IR node
105139 : // and calls the visit function of the input class execute a traversal
105140 : // similar to the style of the attribute based traversals within ROSE.
105141 : // This traversal will visit ALL nodes of the AST where as the other
105142 : // attribute based traversals visit only the embedded tree within the AST.
105143 :
105144 : // Initialize array to the address of the first element of the STL vector
105145 : // (which is guaranteed to be contiguous storage).
105146 : // SgUnlockStatement objectArray [] = *(Memory_Block_List.begin());
105147 5342 : if (SgUnlockStatement::pools.empty() == false)
105148 : {
105149 : // Generate an array of memory pools
105150 0 : SgUnlockStatement** objectArray = (SgUnlockStatement**) &(SgUnlockStatement::pools[0]);
105151 :
105152 : // Build a local variable for better performance
105153 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
105154 : #if 0
105155 : // Iterate over the memory pools
105156 : for (unsigned int i=0; i < SgUnlockStatement::pools.size(); i++)
105157 : {
105158 : // objectArray[i] is a single memory pool
105159 : for (int j=0; j < SgUnlockStatement::pool_size; j++)
105160 : {
105161 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
105162 : {
105163 : traversal.visit(&(objectArray[i][j]));
105164 : }
105165 : }
105166 : }
105167 : #else
105168 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
105169 : // compute the list first and then call the visit function on each list element.
105170 :
105171 : // printf ("Inside of SgUnlockStatement::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
105172 :
105173 0 : std::vector<SgUnlockStatement*> nodeList;
105174 :
105175 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
105176 0 : for (unsigned int i=0; i < SgUnlockStatement::pools.size(); i++)
105177 : {
105178 : // objectArray[i] is a single memory pool
105179 0 : for (unsigned j=0; j < SgUnlockStatement::pool_size; j++)
105180 : {
105181 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
105182 : {
105183 0 : nodeList.push_back(&(objectArray[i][j]));
105184 : }
105185 : }
105186 : }
105187 :
105188 : // Iterate over the saved list
105189 0 : size_t nodeListSize = nodeList.size();
105190 0 : for (size_t i=0; i < nodeListSize; i++)
105191 : {
105192 0 : ROSE_ASSERT(nodeList[i] != NULL);
105193 : #if 0
105194 : traversal.visit(nodeList[i]);
105195 : #else
105196 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
105197 : {
105198 0 : traversal.visit(nodeList[i]);
105199 : }
105200 : #endif
105201 : }
105202 : #endif
105203 : }
105204 :
105205 : // This should not be required since all previously static data members are
105206 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
105207 :
105208 5342 : }
105209 :
105210 :
105211 : void
105212 194 : SgUnlockStatement::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
105213 : {
105214 : // This function traverses the memory pool for an IR node and
105215 : // calls the function to execute the visitor object.
105216 :
105217 : // Initialize array to the address of the first element of the STL vector
105218 : // (which is guarenteed to be contiguous storage).
105219 : // SgUnlockStatement objectArray [] = *(Memory_Block_List.begin());
105220 194 : if (SgUnlockStatement::pools.empty() == false)
105221 : {
105222 : // Generate an array of memory pools
105223 0 : SgUnlockStatement** objectArray = (SgUnlockStatement**) &(SgUnlockStatement::pools[0]);
105224 :
105225 : // Build a local variable for better performance
105226 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
105227 :
105228 : // Iterate over the memory pools
105229 0 : for (unsigned int i=0; i < SgUnlockStatement::pools.size(); i++)
105230 : {
105231 : // objectArray[i] is a single memory pool
105232 0 : for (unsigned j=0; j < SgUnlockStatement::pool_size; j++)
105233 : {
105234 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
105235 : {
105236 : // printf ("Found a valid SgUnlockStatement object in the memory pool %d at position %d \n",i,j);
105237 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
105238 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
105239 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
105240 : }
105241 : else
105242 : {
105243 : // printf ("Found a INVALID SgUnlockStatement object in the memory pool \n");
105244 : }
105245 : }
105246 : }
105247 : }
105248 :
105249 : // This should not be required since all previously static data members are
105250 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
105251 :
105252 194 : }
105253 :
105254 : void
105255 0 : SgUnlockStatement::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
105256 : {
105257 : // This function visits only a single IR node of the memory pool.
105258 : // it is typically called once for each type of IR node within
105259 : // the automatically generated function: traverseRepresentativeNodes().
105260 :
105261 : // Initialize array to the address of the first element of the STL vector
105262 : // (which is guarenteed to be contiguous storage).
105263 : // SgUnlockStatement objectArray [] = *(Memory_Block_List.begin());
105264 0 : if (SgUnlockStatement::pools.empty() == false)
105265 : {
105266 : // Generate an array of memory pools
105267 0 : SgUnlockStatement** objectArray = (SgUnlockStatement**) &(SgUnlockStatement::pools[0]);
105268 :
105269 : // Build a local variable for better performance
105270 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
105271 :
105272 : // Iterate over the memory pools
105273 0 : bool done = false;
105274 0 : unsigned i=0;
105275 :
105276 : // find the first valid IR node, call visit function, and then leave
105277 0 : while ( done == false && i < SgUnlockStatement::pools.size() )
105278 : {
105279 : // objectArray[i] is a single memory pool
105280 : unsigned j=0;
105281 0 : while (done == false && j < SgUnlockStatement::pool_size)
105282 : {
105283 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
105284 : {
105285 0 : traversal.visit(&(objectArray[i][j]));
105286 0 : done = true;
105287 : }
105288 0 : j++;
105289 : }
105290 0 : i++;
105291 : }
105292 :
105293 : #if 0
105294 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
105295 : if (done == false)
105296 : {
105297 : printf ("No representative for SgUnlockStatement found in memory pools \n");
105298 : }
105299 : #endif
105300 : }
105301 0 : }
105302 :
105303 :
105304 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
105305 : // using values that overflow signed values of int.
105306 : size_t
105307 4 : SgUnlockStatement::numberOfNodes()
105308 : {
105309 : // This function traverses the memory pool for an IR node and
105310 : // counts the number of IR nodes of a particular Sage III IR
105311 : // nodes type.
105312 :
105313 4 : size_t count = 0;
105314 4 : if (SgUnlockStatement::pools.empty() == false)
105315 : {
105316 : // Generate an array of memory pools (this is actually a STL vector,
105317 : // but it is contiguious, so OK to treat this way).
105318 0 : SgUnlockStatement** objectArray = (SgUnlockStatement**) &(SgUnlockStatement::pools[0]);
105319 :
105320 : // Build a local variable for better performance (make it a loop invariant variable).
105321 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
105322 :
105323 : // Iterate over all of the memory pools for this IR node.
105324 0 : for (unsigned int i=0; i < SgUnlockStatement::pools.size(); i++)
105325 : {
105326 : // objectArray[i] is a single memory pool, iterate over all the
105327 : // IR nodes and only count those that are valid IR nodes used in
105328 : // the AST (i.e. allocated IR nodes).
105329 0 : for (unsigned j=0; j < SgUnlockStatement::pool_size; j++)
105330 : {
105331 : // This is indexing the STL vector of C/C++ style arrays as a doubly
105332 : // indexed array access. It is OK since we have leveraged the semantics
105333 : // of STL vector memory as contigous and cast the memory as an array
105334 : // of arrays to use the 2D array indexing. Hope this is not confusing,
105335 : // but it s very fast as an implementation.
105336 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
105337 : {
105338 0 : count++;
105339 : }
105340 : }
105341 : }
105342 : }
105343 :
105344 :
105345 :
105346 4 : return count;
105347 : }
105348 :
105349 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
105350 : // using values that overflow signed values of int.
105351 : size_t
105352 0 : SgUnlockStatement::memoryUsage()
105353 : {
105354 : // This function is required because we need the class name as a type when we call sizeof
105355 : // There might be another way to implement this if we have a traversal that only called a
105356 : // representative object (one call for each type of Sage IIIIR node).
105357 0 : size_t memory = numberOfNodes() * sizeof(SgUnlockStatement);
105358 :
105359 0 : return memory;
105360 : }
105361 :
105362 : /* #line 105363 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
105363 :
105364 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
105365 : void
105366 5342 : SgExpression::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
105367 : {
105368 : // This function traverses the memory pool for only a specific IR node
105369 : // and calls the visit function of the input class execute a traversal
105370 : // similar to the style of the attribute based traversals within ROSE.
105371 : // This traversal will visit ALL nodes of the AST where as the other
105372 : // attribute based traversals visit only the embedded tree within the AST.
105373 :
105374 : // Initialize array to the address of the first element of the STL vector
105375 : // (which is guaranteed to be contiguous storage).
105376 : // SgExpression objectArray [] = *(Memory_Block_List.begin());
105377 5342 : if (SgExpression::pools.empty() == false)
105378 : {
105379 : // Generate an array of memory pools
105380 0 : SgExpression** objectArray = (SgExpression**) &(SgExpression::pools[0]);
105381 :
105382 : // Build a local variable for better performance
105383 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
105384 : #if 0
105385 : // Iterate over the memory pools
105386 : for (unsigned int i=0; i < SgExpression::pools.size(); i++)
105387 : {
105388 : // objectArray[i] is a single memory pool
105389 : for (int j=0; j < SgExpression::pool_size; j++)
105390 : {
105391 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
105392 : {
105393 : traversal.visit(&(objectArray[i][j]));
105394 : }
105395 : }
105396 : }
105397 : #else
105398 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
105399 : // compute the list first and then call the visit function on each list element.
105400 :
105401 : // printf ("Inside of SgExpression::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
105402 :
105403 0 : std::vector<SgExpression*> nodeList;
105404 :
105405 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
105406 0 : for (unsigned int i=0; i < SgExpression::pools.size(); i++)
105407 : {
105408 : // objectArray[i] is a single memory pool
105409 0 : for (unsigned j=0; j < SgExpression::pool_size; j++)
105410 : {
105411 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
105412 : {
105413 0 : nodeList.push_back(&(objectArray[i][j]));
105414 : }
105415 : }
105416 : }
105417 :
105418 : // Iterate over the saved list
105419 0 : size_t nodeListSize = nodeList.size();
105420 0 : for (size_t i=0; i < nodeListSize; i++)
105421 : {
105422 0 : ROSE_ASSERT(nodeList[i] != NULL);
105423 : #if 0
105424 : traversal.visit(nodeList[i]);
105425 : #else
105426 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
105427 : {
105428 0 : traversal.visit(nodeList[i]);
105429 : }
105430 : #endif
105431 : }
105432 : #endif
105433 : }
105434 :
105435 : // This should not be required since all previously static data members are
105436 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
105437 :
105438 5342 : }
105439 :
105440 :
105441 : void
105442 194 : SgExpression::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
105443 : {
105444 : // This function traverses the memory pool for an IR node and
105445 : // calls the function to execute the visitor object.
105446 :
105447 : // Initialize array to the address of the first element of the STL vector
105448 : // (which is guarenteed to be contiguous storage).
105449 : // SgExpression objectArray [] = *(Memory_Block_List.begin());
105450 194 : if (SgExpression::pools.empty() == false)
105451 : {
105452 : // Generate an array of memory pools
105453 0 : SgExpression** objectArray = (SgExpression**) &(SgExpression::pools[0]);
105454 :
105455 : // Build a local variable for better performance
105456 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
105457 :
105458 : // Iterate over the memory pools
105459 0 : for (unsigned int i=0; i < SgExpression::pools.size(); i++)
105460 : {
105461 : // objectArray[i] is a single memory pool
105462 0 : for (unsigned j=0; j < SgExpression::pool_size; j++)
105463 : {
105464 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
105465 : {
105466 : // printf ("Found a valid SgExpression object in the memory pool %d at position %d \n",i,j);
105467 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
105468 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
105469 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
105470 : }
105471 : else
105472 : {
105473 : // printf ("Found a INVALID SgExpression object in the memory pool \n");
105474 : }
105475 : }
105476 : }
105477 : }
105478 :
105479 : // This should not be required since all previously static data members are
105480 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
105481 :
105482 194 : }
105483 :
105484 : void
105485 0 : SgExpression::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
105486 : {
105487 : // This function visits only a single IR node of the memory pool.
105488 : // it is typically called once for each type of IR node within
105489 : // the automatically generated function: traverseRepresentativeNodes().
105490 :
105491 : // Initialize array to the address of the first element of the STL vector
105492 : // (which is guarenteed to be contiguous storage).
105493 : // SgExpression objectArray [] = *(Memory_Block_List.begin());
105494 0 : if (SgExpression::pools.empty() == false)
105495 : {
105496 : // Generate an array of memory pools
105497 0 : SgExpression** objectArray = (SgExpression**) &(SgExpression::pools[0]);
105498 :
105499 : // Build a local variable for better performance
105500 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
105501 :
105502 : // Iterate over the memory pools
105503 0 : bool done = false;
105504 0 : unsigned i=0;
105505 :
105506 : // find the first valid IR node, call visit function, and then leave
105507 0 : while ( done == false && i < SgExpression::pools.size() )
105508 : {
105509 : // objectArray[i] is a single memory pool
105510 : unsigned j=0;
105511 0 : while (done == false && j < SgExpression::pool_size)
105512 : {
105513 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
105514 : {
105515 0 : traversal.visit(&(objectArray[i][j]));
105516 0 : done = true;
105517 : }
105518 0 : j++;
105519 : }
105520 0 : i++;
105521 : }
105522 :
105523 : #if 0
105524 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
105525 : if (done == false)
105526 : {
105527 : printf ("No representative for SgExpression found in memory pools \n");
105528 : }
105529 : #endif
105530 : }
105531 0 : }
105532 :
105533 :
105534 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
105535 : // using values that overflow signed values of int.
105536 : size_t
105537 4 : SgExpression::numberOfNodes()
105538 : {
105539 : // This function traverses the memory pool for an IR node and
105540 : // counts the number of IR nodes of a particular Sage III IR
105541 : // nodes type.
105542 :
105543 4 : size_t count = 0;
105544 4 : if (SgExpression::pools.empty() == false)
105545 : {
105546 : // Generate an array of memory pools (this is actually a STL vector,
105547 : // but it is contiguious, so OK to treat this way).
105548 0 : SgExpression** objectArray = (SgExpression**) &(SgExpression::pools[0]);
105549 :
105550 : // Build a local variable for better performance (make it a loop invariant variable).
105551 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
105552 :
105553 : // Iterate over all of the memory pools for this IR node.
105554 0 : for (unsigned int i=0; i < SgExpression::pools.size(); i++)
105555 : {
105556 : // objectArray[i] is a single memory pool, iterate over all the
105557 : // IR nodes and only count those that are valid IR nodes used in
105558 : // the AST (i.e. allocated IR nodes).
105559 0 : for (unsigned j=0; j < SgExpression::pool_size; j++)
105560 : {
105561 : // This is indexing the STL vector of C/C++ style arrays as a doubly
105562 : // indexed array access. It is OK since we have leveraged the semantics
105563 : // of STL vector memory as contigous and cast the memory as an array
105564 : // of arrays to use the 2D array indexing. Hope this is not confusing,
105565 : // but it s very fast as an implementation.
105566 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
105567 : {
105568 0 : count++;
105569 : }
105570 : }
105571 : }
105572 : }
105573 :
105574 :
105575 :
105576 4 : return count;
105577 : }
105578 :
105579 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
105580 : // using values that overflow signed values of int.
105581 : size_t
105582 0 : SgExpression::memoryUsage()
105583 : {
105584 : // This function is required because we need the class name as a type when we call sizeof
105585 : // There might be another way to implement this if we have a traversal that only called a
105586 : // representative object (one call for each type of Sage IIIIR node).
105587 0 : size_t memory = numberOfNodes() * sizeof(SgExpression);
105588 :
105589 0 : return memory;
105590 : }
105591 :
105592 : /* #line 105593 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
105593 :
105594 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
105595 : void
105596 5342 : SgUnaryOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
105597 : {
105598 : // This function traverses the memory pool for only a specific IR node
105599 : // and calls the visit function of the input class execute a traversal
105600 : // similar to the style of the attribute based traversals within ROSE.
105601 : // This traversal will visit ALL nodes of the AST where as the other
105602 : // attribute based traversals visit only the embedded tree within the AST.
105603 :
105604 : // Initialize array to the address of the first element of the STL vector
105605 : // (which is guaranteed to be contiguous storage).
105606 : // SgUnaryOp objectArray [] = *(Memory_Block_List.begin());
105607 5342 : if (SgUnaryOp::pools.empty() == false)
105608 : {
105609 : // Generate an array of memory pools
105610 0 : SgUnaryOp** objectArray = (SgUnaryOp**) &(SgUnaryOp::pools[0]);
105611 :
105612 : // Build a local variable for better performance
105613 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
105614 : #if 0
105615 : // Iterate over the memory pools
105616 : for (unsigned int i=0; i < SgUnaryOp::pools.size(); i++)
105617 : {
105618 : // objectArray[i] is a single memory pool
105619 : for (int j=0; j < SgUnaryOp::pool_size; j++)
105620 : {
105621 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
105622 : {
105623 : traversal.visit(&(objectArray[i][j]));
105624 : }
105625 : }
105626 : }
105627 : #else
105628 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
105629 : // compute the list first and then call the visit function on each list element.
105630 :
105631 : // printf ("Inside of SgUnaryOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
105632 :
105633 0 : std::vector<SgUnaryOp*> nodeList;
105634 :
105635 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
105636 0 : for (unsigned int i=0; i < SgUnaryOp::pools.size(); i++)
105637 : {
105638 : // objectArray[i] is a single memory pool
105639 0 : for (unsigned j=0; j < SgUnaryOp::pool_size; j++)
105640 : {
105641 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
105642 : {
105643 0 : nodeList.push_back(&(objectArray[i][j]));
105644 : }
105645 : }
105646 : }
105647 :
105648 : // Iterate over the saved list
105649 0 : size_t nodeListSize = nodeList.size();
105650 0 : for (size_t i=0; i < nodeListSize; i++)
105651 : {
105652 0 : ROSE_ASSERT(nodeList[i] != NULL);
105653 : #if 0
105654 : traversal.visit(nodeList[i]);
105655 : #else
105656 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
105657 : {
105658 0 : traversal.visit(nodeList[i]);
105659 : }
105660 : #endif
105661 : }
105662 : #endif
105663 : }
105664 :
105665 : // This should not be required since all previously static data members are
105666 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
105667 :
105668 5342 : }
105669 :
105670 :
105671 : void
105672 194 : SgUnaryOp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
105673 : {
105674 : // This function traverses the memory pool for an IR node and
105675 : // calls the function to execute the visitor object.
105676 :
105677 : // Initialize array to the address of the first element of the STL vector
105678 : // (which is guarenteed to be contiguous storage).
105679 : // SgUnaryOp objectArray [] = *(Memory_Block_List.begin());
105680 194 : if (SgUnaryOp::pools.empty() == false)
105681 : {
105682 : // Generate an array of memory pools
105683 0 : SgUnaryOp** objectArray = (SgUnaryOp**) &(SgUnaryOp::pools[0]);
105684 :
105685 : // Build a local variable for better performance
105686 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
105687 :
105688 : // Iterate over the memory pools
105689 0 : for (unsigned int i=0; i < SgUnaryOp::pools.size(); i++)
105690 : {
105691 : // objectArray[i] is a single memory pool
105692 0 : for (unsigned j=0; j < SgUnaryOp::pool_size; j++)
105693 : {
105694 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
105695 : {
105696 : // printf ("Found a valid SgUnaryOp object in the memory pool %d at position %d \n",i,j);
105697 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
105698 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
105699 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
105700 : }
105701 : else
105702 : {
105703 : // printf ("Found a INVALID SgUnaryOp object in the memory pool \n");
105704 : }
105705 : }
105706 : }
105707 : }
105708 :
105709 : // This should not be required since all previously static data members are
105710 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
105711 :
105712 194 : }
105713 :
105714 : void
105715 0 : SgUnaryOp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
105716 : {
105717 : // This function visits only a single IR node of the memory pool.
105718 : // it is typically called once for each type of IR node within
105719 : // the automatically generated function: traverseRepresentativeNodes().
105720 :
105721 : // Initialize array to the address of the first element of the STL vector
105722 : // (which is guarenteed to be contiguous storage).
105723 : // SgUnaryOp objectArray [] = *(Memory_Block_List.begin());
105724 0 : if (SgUnaryOp::pools.empty() == false)
105725 : {
105726 : // Generate an array of memory pools
105727 0 : SgUnaryOp** objectArray = (SgUnaryOp**) &(SgUnaryOp::pools[0]);
105728 :
105729 : // Build a local variable for better performance
105730 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
105731 :
105732 : // Iterate over the memory pools
105733 0 : bool done = false;
105734 0 : unsigned i=0;
105735 :
105736 : // find the first valid IR node, call visit function, and then leave
105737 0 : while ( done == false && i < SgUnaryOp::pools.size() )
105738 : {
105739 : // objectArray[i] is a single memory pool
105740 : unsigned j=0;
105741 0 : while (done == false && j < SgUnaryOp::pool_size)
105742 : {
105743 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
105744 : {
105745 0 : traversal.visit(&(objectArray[i][j]));
105746 0 : done = true;
105747 : }
105748 0 : j++;
105749 : }
105750 0 : i++;
105751 : }
105752 :
105753 : #if 0
105754 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
105755 : if (done == false)
105756 : {
105757 : printf ("No representative for SgUnaryOp found in memory pools \n");
105758 : }
105759 : #endif
105760 : }
105761 0 : }
105762 :
105763 :
105764 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
105765 : // using values that overflow signed values of int.
105766 : size_t
105767 4 : SgUnaryOp::numberOfNodes()
105768 : {
105769 : // This function traverses the memory pool for an IR node and
105770 : // counts the number of IR nodes of a particular Sage III IR
105771 : // nodes type.
105772 :
105773 4 : size_t count = 0;
105774 4 : if (SgUnaryOp::pools.empty() == false)
105775 : {
105776 : // Generate an array of memory pools (this is actually a STL vector,
105777 : // but it is contiguious, so OK to treat this way).
105778 0 : SgUnaryOp** objectArray = (SgUnaryOp**) &(SgUnaryOp::pools[0]);
105779 :
105780 : // Build a local variable for better performance (make it a loop invariant variable).
105781 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
105782 :
105783 : // Iterate over all of the memory pools for this IR node.
105784 0 : for (unsigned int i=0; i < SgUnaryOp::pools.size(); i++)
105785 : {
105786 : // objectArray[i] is a single memory pool, iterate over all the
105787 : // IR nodes and only count those that are valid IR nodes used in
105788 : // the AST (i.e. allocated IR nodes).
105789 0 : for (unsigned j=0; j < SgUnaryOp::pool_size; j++)
105790 : {
105791 : // This is indexing the STL vector of C/C++ style arrays as a doubly
105792 : // indexed array access. It is OK since we have leveraged the semantics
105793 : // of STL vector memory as contigous and cast the memory as an array
105794 : // of arrays to use the 2D array indexing. Hope this is not confusing,
105795 : // but it s very fast as an implementation.
105796 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
105797 : {
105798 0 : count++;
105799 : }
105800 : }
105801 : }
105802 : }
105803 :
105804 :
105805 :
105806 4 : return count;
105807 : }
105808 :
105809 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
105810 : // using values that overflow signed values of int.
105811 : size_t
105812 0 : SgUnaryOp::memoryUsage()
105813 : {
105814 : // This function is required because we need the class name as a type when we call sizeof
105815 : // There might be another way to implement this if we have a traversal that only called a
105816 : // representative object (one call for each type of Sage IIIIR node).
105817 0 : size_t memory = numberOfNodes() * sizeof(SgUnaryOp);
105818 :
105819 0 : return memory;
105820 : }
105821 :
105822 : /* #line 105823 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
105823 :
105824 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
105825 : void
105826 5342 : SgExpressionRoot::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
105827 : {
105828 : // This function traverses the memory pool for only a specific IR node
105829 : // and calls the visit function of the input class execute a traversal
105830 : // similar to the style of the attribute based traversals within ROSE.
105831 : // This traversal will visit ALL nodes of the AST where as the other
105832 : // attribute based traversals visit only the embedded tree within the AST.
105833 :
105834 : // Initialize array to the address of the first element of the STL vector
105835 : // (which is guaranteed to be contiguous storage).
105836 : // SgExpressionRoot objectArray [] = *(Memory_Block_List.begin());
105837 5342 : if (SgExpressionRoot::pools.empty() == false)
105838 : {
105839 : // Generate an array of memory pools
105840 0 : SgExpressionRoot** objectArray = (SgExpressionRoot**) &(SgExpressionRoot::pools[0]);
105841 :
105842 : // Build a local variable for better performance
105843 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
105844 : #if 0
105845 : // Iterate over the memory pools
105846 : for (unsigned int i=0; i < SgExpressionRoot::pools.size(); i++)
105847 : {
105848 : // objectArray[i] is a single memory pool
105849 : for (int j=0; j < SgExpressionRoot::pool_size; j++)
105850 : {
105851 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
105852 : {
105853 : traversal.visit(&(objectArray[i][j]));
105854 : }
105855 : }
105856 : }
105857 : #else
105858 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
105859 : // compute the list first and then call the visit function on each list element.
105860 :
105861 : // printf ("Inside of SgExpressionRoot::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
105862 :
105863 0 : std::vector<SgExpressionRoot*> nodeList;
105864 :
105865 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
105866 0 : for (unsigned int i=0; i < SgExpressionRoot::pools.size(); i++)
105867 : {
105868 : // objectArray[i] is a single memory pool
105869 0 : for (unsigned j=0; j < SgExpressionRoot::pool_size; j++)
105870 : {
105871 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
105872 : {
105873 0 : nodeList.push_back(&(objectArray[i][j]));
105874 : }
105875 : }
105876 : }
105877 :
105878 : // Iterate over the saved list
105879 0 : size_t nodeListSize = nodeList.size();
105880 0 : for (size_t i=0; i < nodeListSize; i++)
105881 : {
105882 0 : ROSE_ASSERT(nodeList[i] != NULL);
105883 : #if 0
105884 : traversal.visit(nodeList[i]);
105885 : #else
105886 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
105887 : {
105888 0 : traversal.visit(nodeList[i]);
105889 : }
105890 : #endif
105891 : }
105892 : #endif
105893 : }
105894 :
105895 : // This should not be required since all previously static data members are
105896 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
105897 :
105898 5342 : }
105899 :
105900 :
105901 : void
105902 194 : SgExpressionRoot::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
105903 : {
105904 : // This function traverses the memory pool for an IR node and
105905 : // calls the function to execute the visitor object.
105906 :
105907 : // Initialize array to the address of the first element of the STL vector
105908 : // (which is guarenteed to be contiguous storage).
105909 : // SgExpressionRoot objectArray [] = *(Memory_Block_List.begin());
105910 194 : if (SgExpressionRoot::pools.empty() == false)
105911 : {
105912 : // Generate an array of memory pools
105913 0 : SgExpressionRoot** objectArray = (SgExpressionRoot**) &(SgExpressionRoot::pools[0]);
105914 :
105915 : // Build a local variable for better performance
105916 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
105917 :
105918 : // Iterate over the memory pools
105919 0 : for (unsigned int i=0; i < SgExpressionRoot::pools.size(); i++)
105920 : {
105921 : // objectArray[i] is a single memory pool
105922 0 : for (unsigned j=0; j < SgExpressionRoot::pool_size; j++)
105923 : {
105924 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
105925 : {
105926 : // printf ("Found a valid SgExpressionRoot object in the memory pool %d at position %d \n",i,j);
105927 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
105928 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
105929 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
105930 : }
105931 : else
105932 : {
105933 : // printf ("Found a INVALID SgExpressionRoot object in the memory pool \n");
105934 : }
105935 : }
105936 : }
105937 : }
105938 :
105939 : // This should not be required since all previously static data members are
105940 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
105941 :
105942 194 : }
105943 :
105944 : void
105945 0 : SgExpressionRoot::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
105946 : {
105947 : // This function visits only a single IR node of the memory pool.
105948 : // it is typically called once for each type of IR node within
105949 : // the automatically generated function: traverseRepresentativeNodes().
105950 :
105951 : // Initialize array to the address of the first element of the STL vector
105952 : // (which is guarenteed to be contiguous storage).
105953 : // SgExpressionRoot objectArray [] = *(Memory_Block_List.begin());
105954 0 : if (SgExpressionRoot::pools.empty() == false)
105955 : {
105956 : // Generate an array of memory pools
105957 0 : SgExpressionRoot** objectArray = (SgExpressionRoot**) &(SgExpressionRoot::pools[0]);
105958 :
105959 : // Build a local variable for better performance
105960 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
105961 :
105962 : // Iterate over the memory pools
105963 0 : bool done = false;
105964 0 : unsigned i=0;
105965 :
105966 : // find the first valid IR node, call visit function, and then leave
105967 0 : while ( done == false && i < SgExpressionRoot::pools.size() )
105968 : {
105969 : // objectArray[i] is a single memory pool
105970 : unsigned j=0;
105971 0 : while (done == false && j < SgExpressionRoot::pool_size)
105972 : {
105973 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
105974 : {
105975 0 : traversal.visit(&(objectArray[i][j]));
105976 0 : done = true;
105977 : }
105978 0 : j++;
105979 : }
105980 0 : i++;
105981 : }
105982 :
105983 : #if 0
105984 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
105985 : if (done == false)
105986 : {
105987 : printf ("No representative for SgExpressionRoot found in memory pools \n");
105988 : }
105989 : #endif
105990 : }
105991 0 : }
105992 :
105993 :
105994 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
105995 : // using values that overflow signed values of int.
105996 : size_t
105997 4 : SgExpressionRoot::numberOfNodes()
105998 : {
105999 : // This function traverses the memory pool for an IR node and
106000 : // counts the number of IR nodes of a particular Sage III IR
106001 : // nodes type.
106002 :
106003 4 : size_t count = 0;
106004 4 : if (SgExpressionRoot::pools.empty() == false)
106005 : {
106006 : // Generate an array of memory pools (this is actually a STL vector,
106007 : // but it is contiguious, so OK to treat this way).
106008 0 : SgExpressionRoot** objectArray = (SgExpressionRoot**) &(SgExpressionRoot::pools[0]);
106009 :
106010 : // Build a local variable for better performance (make it a loop invariant variable).
106011 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
106012 :
106013 : // Iterate over all of the memory pools for this IR node.
106014 0 : for (unsigned int i=0; i < SgExpressionRoot::pools.size(); i++)
106015 : {
106016 : // objectArray[i] is a single memory pool, iterate over all the
106017 : // IR nodes and only count those that are valid IR nodes used in
106018 : // the AST (i.e. allocated IR nodes).
106019 0 : for (unsigned j=0; j < SgExpressionRoot::pool_size; j++)
106020 : {
106021 : // This is indexing the STL vector of C/C++ style arrays as a doubly
106022 : // indexed array access. It is OK since we have leveraged the semantics
106023 : // of STL vector memory as contigous and cast the memory as an array
106024 : // of arrays to use the 2D array indexing. Hope this is not confusing,
106025 : // but it s very fast as an implementation.
106026 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
106027 : {
106028 0 : count++;
106029 : }
106030 : }
106031 : }
106032 : }
106033 :
106034 :
106035 :
106036 4 : return count;
106037 : }
106038 :
106039 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
106040 : // using values that overflow signed values of int.
106041 : size_t
106042 0 : SgExpressionRoot::memoryUsage()
106043 : {
106044 : // This function is required because we need the class name as a type when we call sizeof
106045 : // There might be another way to implement this if we have a traversal that only called a
106046 : // representative object (one call for each type of Sage IIIIR node).
106047 0 : size_t memory = numberOfNodes() * sizeof(SgExpressionRoot);
106048 :
106049 0 : return memory;
106050 : }
106051 :
106052 : /* #line 106053 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
106053 :
106054 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
106055 : void
106056 5342 : SgMinusOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
106057 : {
106058 : // This function traverses the memory pool for only a specific IR node
106059 : // and calls the visit function of the input class execute a traversal
106060 : // similar to the style of the attribute based traversals within ROSE.
106061 : // This traversal will visit ALL nodes of the AST where as the other
106062 : // attribute based traversals visit only the embedded tree within the AST.
106063 :
106064 : // Initialize array to the address of the first element of the STL vector
106065 : // (which is guaranteed to be contiguous storage).
106066 : // SgMinusOp objectArray [] = *(Memory_Block_List.begin());
106067 5342 : if (SgMinusOp::pools.empty() == false)
106068 : {
106069 : // Generate an array of memory pools
106070 681 : SgMinusOp** objectArray = (SgMinusOp**) &(SgMinusOp::pools[0]);
106071 :
106072 : // Build a local variable for better performance
106073 681 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
106074 : #if 0
106075 : // Iterate over the memory pools
106076 : for (unsigned int i=0; i < SgMinusOp::pools.size(); i++)
106077 : {
106078 : // objectArray[i] is a single memory pool
106079 : for (int j=0; j < SgMinusOp::pool_size; j++)
106080 : {
106081 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
106082 : {
106083 : traversal.visit(&(objectArray[i][j]));
106084 : }
106085 : }
106086 : }
106087 : #else
106088 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
106089 : // compute the list first and then call the visit function on each list element.
106090 :
106091 : // printf ("Inside of SgMinusOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
106092 :
106093 1362 : std::vector<SgMinusOp*> nodeList;
106094 :
106095 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
106096 1362 : for (unsigned int i=0; i < SgMinusOp::pools.size(); i++)
106097 : {
106098 : // objectArray[i] is a single memory pool
106099 1362680 : for (unsigned j=0; j < SgMinusOp::pool_size; j++)
106100 : {
106101 1362000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
106102 : {
106103 8160 : nodeList.push_back(&(objectArray[i][j]));
106104 : }
106105 : }
106106 : }
106107 :
106108 : // Iterate over the saved list
106109 681 : size_t nodeListSize = nodeList.size();
106110 8841 : for (size_t i=0; i < nodeListSize; i++)
106111 : {
106112 8160 : ROSE_ASSERT(nodeList[i] != NULL);
106113 : #if 0
106114 : traversal.visit(nodeList[i]);
106115 : #else
106116 8160 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
106117 : {
106118 8160 : traversal.visit(nodeList[i]);
106119 : }
106120 : #endif
106121 : }
106122 : #endif
106123 : }
106124 :
106125 : // This should not be required since all previously static data members are
106126 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
106127 :
106128 5342 : }
106129 :
106130 :
106131 : void
106132 194 : SgMinusOp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
106133 : {
106134 : // This function traverses the memory pool for an IR node and
106135 : // calls the function to execute the visitor object.
106136 :
106137 : // Initialize array to the address of the first element of the STL vector
106138 : // (which is guarenteed to be contiguous storage).
106139 : // SgMinusOp objectArray [] = *(Memory_Block_List.begin());
106140 194 : if (SgMinusOp::pools.empty() == false)
106141 : {
106142 : // Generate an array of memory pools
106143 150 : SgMinusOp** objectArray = (SgMinusOp**) &(SgMinusOp::pools[0]);
106144 :
106145 : // Build a local variable for better performance
106146 150 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
106147 :
106148 : // Iterate over the memory pools
106149 300 : for (unsigned int i=0; i < SgMinusOp::pools.size(); i++)
106150 : {
106151 : // objectArray[i] is a single memory pool
106152 300150 : for (unsigned j=0; j < SgMinusOp::pool_size; j++)
106153 : {
106154 300000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
106155 : {
106156 : // printf ("Found a valid SgMinusOp object in the memory pool %d at position %d \n",i,j);
106157 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
106158 7928 : objectArray[i][j].executeVisitorMemberFunction(visitor);
106159 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
106160 : }
106161 : else
106162 : {
106163 : // printf ("Found a INVALID SgMinusOp object in the memory pool \n");
106164 : }
106165 : }
106166 : }
106167 : }
106168 :
106169 : // This should not be required since all previously static data members are
106170 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
106171 :
106172 194 : }
106173 :
106174 : void
106175 0 : SgMinusOp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
106176 : {
106177 : // This function visits only a single IR node of the memory pool.
106178 : // it is typically called once for each type of IR node within
106179 : // the automatically generated function: traverseRepresentativeNodes().
106180 :
106181 : // Initialize array to the address of the first element of the STL vector
106182 : // (which is guarenteed to be contiguous storage).
106183 : // SgMinusOp objectArray [] = *(Memory_Block_List.begin());
106184 0 : if (SgMinusOp::pools.empty() == false)
106185 : {
106186 : // Generate an array of memory pools
106187 0 : SgMinusOp** objectArray = (SgMinusOp**) &(SgMinusOp::pools[0]);
106188 :
106189 : // Build a local variable for better performance
106190 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
106191 :
106192 : // Iterate over the memory pools
106193 0 : bool done = false;
106194 0 : unsigned i=0;
106195 :
106196 : // find the first valid IR node, call visit function, and then leave
106197 0 : while ( done == false && i < SgMinusOp::pools.size() )
106198 : {
106199 : // objectArray[i] is a single memory pool
106200 : unsigned j=0;
106201 0 : while (done == false && j < SgMinusOp::pool_size)
106202 : {
106203 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
106204 : {
106205 0 : traversal.visit(&(objectArray[i][j]));
106206 0 : done = true;
106207 : }
106208 0 : j++;
106209 : }
106210 0 : i++;
106211 : }
106212 :
106213 : #if 0
106214 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
106215 : if (done == false)
106216 : {
106217 : printf ("No representative for SgMinusOp found in memory pools \n");
106218 : }
106219 : #endif
106220 : }
106221 0 : }
106222 :
106223 :
106224 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
106225 : // using values that overflow signed values of int.
106226 : size_t
106227 4 : SgMinusOp::numberOfNodes()
106228 : {
106229 : // This function traverses the memory pool for an IR node and
106230 : // counts the number of IR nodes of a particular Sage III IR
106231 : // nodes type.
106232 :
106233 4 : size_t count = 0;
106234 4 : if (SgMinusOp::pools.empty() == false)
106235 : {
106236 : // Generate an array of memory pools (this is actually a STL vector,
106237 : // but it is contiguious, so OK to treat this way).
106238 1 : SgMinusOp** objectArray = (SgMinusOp**) &(SgMinusOp::pools[0]);
106239 :
106240 : // Build a local variable for better performance (make it a loop invariant variable).
106241 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
106242 :
106243 : // Iterate over all of the memory pools for this IR node.
106244 2 : for (unsigned int i=0; i < SgMinusOp::pools.size(); i++)
106245 : {
106246 : // objectArray[i] is a single memory pool, iterate over all the
106247 : // IR nodes and only count those that are valid IR nodes used in
106248 : // the AST (i.e. allocated IR nodes).
106249 2001 : for (unsigned j=0; j < SgMinusOp::pool_size; j++)
106250 : {
106251 : // This is indexing the STL vector of C/C++ style arrays as a doubly
106252 : // indexed array access. It is OK since we have leveraged the semantics
106253 : // of STL vector memory as contigous and cast the memory as an array
106254 : // of arrays to use the 2D array indexing. Hope this is not confusing,
106255 : // but it s very fast as an implementation.
106256 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
106257 : {
106258 57 : count++;
106259 : }
106260 : }
106261 : }
106262 : }
106263 :
106264 :
106265 :
106266 4 : return count;
106267 : }
106268 :
106269 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
106270 : // using values that overflow signed values of int.
106271 : size_t
106272 0 : SgMinusOp::memoryUsage()
106273 : {
106274 : // This function is required because we need the class name as a type when we call sizeof
106275 : // There might be another way to implement this if we have a traversal that only called a
106276 : // representative object (one call for each type of Sage IIIIR node).
106277 0 : size_t memory = numberOfNodes() * sizeof(SgMinusOp);
106278 :
106279 0 : return memory;
106280 : }
106281 :
106282 : /* #line 106283 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
106283 :
106284 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
106285 : void
106286 5342 : SgUnaryAddOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
106287 : {
106288 : // This function traverses the memory pool for only a specific IR node
106289 : // and calls the visit function of the input class execute a traversal
106290 : // similar to the style of the attribute based traversals within ROSE.
106291 : // This traversal will visit ALL nodes of the AST where as the other
106292 : // attribute based traversals visit only the embedded tree within the AST.
106293 :
106294 : // Initialize array to the address of the first element of the STL vector
106295 : // (which is guaranteed to be contiguous storage).
106296 : // SgUnaryAddOp objectArray [] = *(Memory_Block_List.begin());
106297 5342 : if (SgUnaryAddOp::pools.empty() == false)
106298 : {
106299 : // Generate an array of memory pools
106300 9 : SgUnaryAddOp** objectArray = (SgUnaryAddOp**) &(SgUnaryAddOp::pools[0]);
106301 :
106302 : // Build a local variable for better performance
106303 9 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
106304 : #if 0
106305 : // Iterate over the memory pools
106306 : for (unsigned int i=0; i < SgUnaryAddOp::pools.size(); i++)
106307 : {
106308 : // objectArray[i] is a single memory pool
106309 : for (int j=0; j < SgUnaryAddOp::pool_size; j++)
106310 : {
106311 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
106312 : {
106313 : traversal.visit(&(objectArray[i][j]));
106314 : }
106315 : }
106316 : }
106317 : #else
106318 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
106319 : // compute the list first and then call the visit function on each list element.
106320 :
106321 : // printf ("Inside of SgUnaryAddOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
106322 :
106323 18 : std::vector<SgUnaryAddOp*> nodeList;
106324 :
106325 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
106326 18 : for (unsigned int i=0; i < SgUnaryAddOp::pools.size(); i++)
106327 : {
106328 : // objectArray[i] is a single memory pool
106329 18009 : for (unsigned j=0; j < SgUnaryAddOp::pool_size; j++)
106330 : {
106331 18000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
106332 : {
106333 9 : nodeList.push_back(&(objectArray[i][j]));
106334 : }
106335 : }
106336 : }
106337 :
106338 : // Iterate over the saved list
106339 9 : size_t nodeListSize = nodeList.size();
106340 18 : for (size_t i=0; i < nodeListSize; i++)
106341 : {
106342 9 : ROSE_ASSERT(nodeList[i] != NULL);
106343 : #if 0
106344 : traversal.visit(nodeList[i]);
106345 : #else
106346 9 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
106347 : {
106348 9 : traversal.visit(nodeList[i]);
106349 : }
106350 : #endif
106351 : }
106352 : #endif
106353 : }
106354 :
106355 : // This should not be required since all previously static data members are
106356 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
106357 :
106358 5342 : }
106359 :
106360 :
106361 : void
106362 194 : SgUnaryAddOp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
106363 : {
106364 : // This function traverses the memory pool for an IR node and
106365 : // calls the function to execute the visitor object.
106366 :
106367 : // Initialize array to the address of the first element of the STL vector
106368 : // (which is guarenteed to be contiguous storage).
106369 : // SgUnaryAddOp objectArray [] = *(Memory_Block_List.begin());
106370 194 : if (SgUnaryAddOp::pools.empty() == false)
106371 : {
106372 : // Generate an array of memory pools
106373 18 : SgUnaryAddOp** objectArray = (SgUnaryAddOp**) &(SgUnaryAddOp::pools[0]);
106374 :
106375 : // Build a local variable for better performance
106376 18 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
106377 :
106378 : // Iterate over the memory pools
106379 36 : for (unsigned int i=0; i < SgUnaryAddOp::pools.size(); i++)
106380 : {
106381 : // objectArray[i] is a single memory pool
106382 36018 : for (unsigned j=0; j < SgUnaryAddOp::pool_size; j++)
106383 : {
106384 36000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
106385 : {
106386 : // printf ("Found a valid SgUnaryAddOp object in the memory pool %d at position %d \n",i,j);
106387 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
106388 18 : objectArray[i][j].executeVisitorMemberFunction(visitor);
106389 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
106390 : }
106391 : else
106392 : {
106393 : // printf ("Found a INVALID SgUnaryAddOp object in the memory pool \n");
106394 : }
106395 : }
106396 : }
106397 : }
106398 :
106399 : // This should not be required since all previously static data members are
106400 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
106401 :
106402 194 : }
106403 :
106404 : void
106405 0 : SgUnaryAddOp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
106406 : {
106407 : // This function visits only a single IR node of the memory pool.
106408 : // it is typically called once for each type of IR node within
106409 : // the automatically generated function: traverseRepresentativeNodes().
106410 :
106411 : // Initialize array to the address of the first element of the STL vector
106412 : // (which is guarenteed to be contiguous storage).
106413 : // SgUnaryAddOp objectArray [] = *(Memory_Block_List.begin());
106414 0 : if (SgUnaryAddOp::pools.empty() == false)
106415 : {
106416 : // Generate an array of memory pools
106417 0 : SgUnaryAddOp** objectArray = (SgUnaryAddOp**) &(SgUnaryAddOp::pools[0]);
106418 :
106419 : // Build a local variable for better performance
106420 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
106421 :
106422 : // Iterate over the memory pools
106423 0 : bool done = false;
106424 0 : unsigned i=0;
106425 :
106426 : // find the first valid IR node, call visit function, and then leave
106427 0 : while ( done == false && i < SgUnaryAddOp::pools.size() )
106428 : {
106429 : // objectArray[i] is a single memory pool
106430 : unsigned j=0;
106431 0 : while (done == false && j < SgUnaryAddOp::pool_size)
106432 : {
106433 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
106434 : {
106435 0 : traversal.visit(&(objectArray[i][j]));
106436 0 : done = true;
106437 : }
106438 0 : j++;
106439 : }
106440 0 : i++;
106441 : }
106442 :
106443 : #if 0
106444 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
106445 : if (done == false)
106446 : {
106447 : printf ("No representative for SgUnaryAddOp found in memory pools \n");
106448 : }
106449 : #endif
106450 : }
106451 0 : }
106452 :
106453 :
106454 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
106455 : // using values that overflow signed values of int.
106456 : size_t
106457 4 : SgUnaryAddOp::numberOfNodes()
106458 : {
106459 : // This function traverses the memory pool for an IR node and
106460 : // counts the number of IR nodes of a particular Sage III IR
106461 : // nodes type.
106462 :
106463 4 : size_t count = 0;
106464 4 : if (SgUnaryAddOp::pools.empty() == false)
106465 : {
106466 : // Generate an array of memory pools (this is actually a STL vector,
106467 : // but it is contiguious, so OK to treat this way).
106468 0 : SgUnaryAddOp** objectArray = (SgUnaryAddOp**) &(SgUnaryAddOp::pools[0]);
106469 :
106470 : // Build a local variable for better performance (make it a loop invariant variable).
106471 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
106472 :
106473 : // Iterate over all of the memory pools for this IR node.
106474 0 : for (unsigned int i=0; i < SgUnaryAddOp::pools.size(); i++)
106475 : {
106476 : // objectArray[i] is a single memory pool, iterate over all the
106477 : // IR nodes and only count those that are valid IR nodes used in
106478 : // the AST (i.e. allocated IR nodes).
106479 0 : for (unsigned j=0; j < SgUnaryAddOp::pool_size; j++)
106480 : {
106481 : // This is indexing the STL vector of C/C++ style arrays as a doubly
106482 : // indexed array access. It is OK since we have leveraged the semantics
106483 : // of STL vector memory as contigous and cast the memory as an array
106484 : // of arrays to use the 2D array indexing. Hope this is not confusing,
106485 : // but it s very fast as an implementation.
106486 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
106487 : {
106488 0 : count++;
106489 : }
106490 : }
106491 : }
106492 : }
106493 :
106494 :
106495 :
106496 4 : return count;
106497 : }
106498 :
106499 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
106500 : // using values that overflow signed values of int.
106501 : size_t
106502 0 : SgUnaryAddOp::memoryUsage()
106503 : {
106504 : // This function is required because we need the class name as a type when we call sizeof
106505 : // There might be another way to implement this if we have a traversal that only called a
106506 : // representative object (one call for each type of Sage IIIIR node).
106507 0 : size_t memory = numberOfNodes() * sizeof(SgUnaryAddOp);
106508 :
106509 0 : return memory;
106510 : }
106511 :
106512 : /* #line 106513 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
106513 :
106514 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
106515 : void
106516 5342 : SgNotOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
106517 : {
106518 : // This function traverses the memory pool for only a specific IR node
106519 : // and calls the visit function of the input class execute a traversal
106520 : // similar to the style of the attribute based traversals within ROSE.
106521 : // This traversal will visit ALL nodes of the AST where as the other
106522 : // attribute based traversals visit only the embedded tree within the AST.
106523 :
106524 : // Initialize array to the address of the first element of the STL vector
106525 : // (which is guaranteed to be contiguous storage).
106526 : // SgNotOp objectArray [] = *(Memory_Block_List.begin());
106527 5342 : if (SgNotOp::pools.empty() == false)
106528 : {
106529 : // Generate an array of memory pools
106530 243 : SgNotOp** objectArray = (SgNotOp**) &(SgNotOp::pools[0]);
106531 :
106532 : // Build a local variable for better performance
106533 243 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
106534 : #if 0
106535 : // Iterate over the memory pools
106536 : for (unsigned int i=0; i < SgNotOp::pools.size(); i++)
106537 : {
106538 : // objectArray[i] is a single memory pool
106539 : for (int j=0; j < SgNotOp::pool_size; j++)
106540 : {
106541 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
106542 : {
106543 : traversal.visit(&(objectArray[i][j]));
106544 : }
106545 : }
106546 : }
106547 : #else
106548 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
106549 : // compute the list first and then call the visit function on each list element.
106550 :
106551 : // printf ("Inside of SgNotOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
106552 :
106553 486 : std::vector<SgNotOp*> nodeList;
106554 :
106555 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
106556 486 : for (unsigned int i=0; i < SgNotOp::pools.size(); i++)
106557 : {
106558 : // objectArray[i] is a single memory pool
106559 486243 : for (unsigned j=0; j < SgNotOp::pool_size; j++)
106560 : {
106561 486000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
106562 : {
106563 29936 : nodeList.push_back(&(objectArray[i][j]));
106564 : }
106565 : }
106566 : }
106567 :
106568 : // Iterate over the saved list
106569 243 : size_t nodeListSize = nodeList.size();
106570 30179 : for (size_t i=0; i < nodeListSize; i++)
106571 : {
106572 29936 : ROSE_ASSERT(nodeList[i] != NULL);
106573 : #if 0
106574 : traversal.visit(nodeList[i]);
106575 : #else
106576 29936 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
106577 : {
106578 29936 : traversal.visit(nodeList[i]);
106579 : }
106580 : #endif
106581 : }
106582 : #endif
106583 : }
106584 :
106585 : // This should not be required since all previously static data members are
106586 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
106587 :
106588 5342 : }
106589 :
106590 :
106591 : void
106592 194 : SgNotOp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
106593 : {
106594 : // This function traverses the memory pool for an IR node and
106595 : // calls the function to execute the visitor object.
106596 :
106597 : // Initialize array to the address of the first element of the STL vector
106598 : // (which is guarenteed to be contiguous storage).
106599 : // SgNotOp objectArray [] = *(Memory_Block_List.begin());
106600 194 : if (SgNotOp::pools.empty() == false)
106601 : {
106602 : // Generate an array of memory pools
106603 137 : SgNotOp** objectArray = (SgNotOp**) &(SgNotOp::pools[0]);
106604 :
106605 : // Build a local variable for better performance
106606 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
106607 :
106608 : // Iterate over the memory pools
106609 274 : for (unsigned int i=0; i < SgNotOp::pools.size(); i++)
106610 : {
106611 : // objectArray[i] is a single memory pool
106612 274137 : for (unsigned j=0; j < SgNotOp::pool_size; j++)
106613 : {
106614 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
106615 : {
106616 : // printf ("Found a valid SgNotOp object in the memory pool %d at position %d \n",i,j);
106617 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
106618 30583 : objectArray[i][j].executeVisitorMemberFunction(visitor);
106619 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
106620 : }
106621 : else
106622 : {
106623 : // printf ("Found a INVALID SgNotOp object in the memory pool \n");
106624 : }
106625 : }
106626 : }
106627 : }
106628 :
106629 : // This should not be required since all previously static data members are
106630 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
106631 :
106632 194 : }
106633 :
106634 : void
106635 0 : SgNotOp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
106636 : {
106637 : // This function visits only a single IR node of the memory pool.
106638 : // it is typically called once for each type of IR node within
106639 : // the automatically generated function: traverseRepresentativeNodes().
106640 :
106641 : // Initialize array to the address of the first element of the STL vector
106642 : // (which is guarenteed to be contiguous storage).
106643 : // SgNotOp objectArray [] = *(Memory_Block_List.begin());
106644 0 : if (SgNotOp::pools.empty() == false)
106645 : {
106646 : // Generate an array of memory pools
106647 0 : SgNotOp** objectArray = (SgNotOp**) &(SgNotOp::pools[0]);
106648 :
106649 : // Build a local variable for better performance
106650 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
106651 :
106652 : // Iterate over the memory pools
106653 0 : bool done = false;
106654 0 : unsigned i=0;
106655 :
106656 : // find the first valid IR node, call visit function, and then leave
106657 0 : while ( done == false && i < SgNotOp::pools.size() )
106658 : {
106659 : // objectArray[i] is a single memory pool
106660 : unsigned j=0;
106661 0 : while (done == false && j < SgNotOp::pool_size)
106662 : {
106663 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
106664 : {
106665 0 : traversal.visit(&(objectArray[i][j]));
106666 0 : done = true;
106667 : }
106668 0 : j++;
106669 : }
106670 0 : i++;
106671 : }
106672 :
106673 : #if 0
106674 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
106675 : if (done == false)
106676 : {
106677 : printf ("No representative for SgNotOp found in memory pools \n");
106678 : }
106679 : #endif
106680 : }
106681 0 : }
106682 :
106683 :
106684 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
106685 : // using values that overflow signed values of int.
106686 : size_t
106687 4 : SgNotOp::numberOfNodes()
106688 : {
106689 : // This function traverses the memory pool for an IR node and
106690 : // counts the number of IR nodes of a particular Sage III IR
106691 : // nodes type.
106692 :
106693 4 : size_t count = 0;
106694 4 : if (SgNotOp::pools.empty() == false)
106695 : {
106696 : // Generate an array of memory pools (this is actually a STL vector,
106697 : // but it is contiguious, so OK to treat this way).
106698 1 : SgNotOp** objectArray = (SgNotOp**) &(SgNotOp::pools[0]);
106699 :
106700 : // Build a local variable for better performance (make it a loop invariant variable).
106701 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
106702 :
106703 : // Iterate over all of the memory pools for this IR node.
106704 2 : for (unsigned int i=0; i < SgNotOp::pools.size(); i++)
106705 : {
106706 : // objectArray[i] is a single memory pool, iterate over all the
106707 : // IR nodes and only count those that are valid IR nodes used in
106708 : // the AST (i.e. allocated IR nodes).
106709 2001 : for (unsigned j=0; j < SgNotOp::pool_size; j++)
106710 : {
106711 : // This is indexing the STL vector of C/C++ style arrays as a doubly
106712 : // indexed array access. It is OK since we have leveraged the semantics
106713 : // of STL vector memory as contigous and cast the memory as an array
106714 : // of arrays to use the 2D array indexing. Hope this is not confusing,
106715 : // but it s very fast as an implementation.
106716 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
106717 : {
106718 220 : count++;
106719 : }
106720 : }
106721 : }
106722 : }
106723 :
106724 :
106725 :
106726 4 : return count;
106727 : }
106728 :
106729 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
106730 : // using values that overflow signed values of int.
106731 : size_t
106732 0 : SgNotOp::memoryUsage()
106733 : {
106734 : // This function is required because we need the class name as a type when we call sizeof
106735 : // There might be another way to implement this if we have a traversal that only called a
106736 : // representative object (one call for each type of Sage IIIIR node).
106737 0 : size_t memory = numberOfNodes() * sizeof(SgNotOp);
106738 :
106739 0 : return memory;
106740 : }
106741 :
106742 : /* #line 106743 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
106743 :
106744 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
106745 : void
106746 5342 : SgPointerDerefExp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
106747 : {
106748 : // This function traverses the memory pool for only a specific IR node
106749 : // and calls the visit function of the input class execute a traversal
106750 : // similar to the style of the attribute based traversals within ROSE.
106751 : // This traversal will visit ALL nodes of the AST where as the other
106752 : // attribute based traversals visit only the embedded tree within the AST.
106753 :
106754 : // Initialize array to the address of the first element of the STL vector
106755 : // (which is guaranteed to be contiguous storage).
106756 : // SgPointerDerefExp objectArray [] = *(Memory_Block_List.begin());
106757 5342 : if (SgPointerDerefExp::pools.empty() == false)
106758 : {
106759 : // Generate an array of memory pools
106760 273 : SgPointerDerefExp** objectArray = (SgPointerDerefExp**) &(SgPointerDerefExp::pools[0]);
106761 :
106762 : // Build a local variable for better performance
106763 273 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
106764 : #if 0
106765 : // Iterate over the memory pools
106766 : for (unsigned int i=0; i < SgPointerDerefExp::pools.size(); i++)
106767 : {
106768 : // objectArray[i] is a single memory pool
106769 : for (int j=0; j < SgPointerDerefExp::pool_size; j++)
106770 : {
106771 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
106772 : {
106773 : traversal.visit(&(objectArray[i][j]));
106774 : }
106775 : }
106776 : }
106777 : #else
106778 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
106779 : // compute the list first and then call the visit function on each list element.
106780 :
106781 : // printf ("Inside of SgPointerDerefExp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
106782 :
106783 546 : std::vector<SgPointerDerefExp*> nodeList;
106784 :
106785 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
106786 546 : for (unsigned int i=0; i < SgPointerDerefExp::pools.size(); i++)
106787 : {
106788 : // objectArray[i] is a single memory pool
106789 546273 : for (unsigned j=0; j < SgPointerDerefExp::pool_size; j++)
106790 : {
106791 546000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
106792 : {
106793 50448 : nodeList.push_back(&(objectArray[i][j]));
106794 : }
106795 : }
106796 : }
106797 :
106798 : // Iterate over the saved list
106799 273 : size_t nodeListSize = nodeList.size();
106800 50721 : for (size_t i=0; i < nodeListSize; i++)
106801 : {
106802 50448 : ROSE_ASSERT(nodeList[i] != NULL);
106803 : #if 0
106804 : traversal.visit(nodeList[i]);
106805 : #else
106806 50448 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
106807 : {
106808 50448 : traversal.visit(nodeList[i]);
106809 : }
106810 : #endif
106811 : }
106812 : #endif
106813 : }
106814 :
106815 : // This should not be required since all previously static data members are
106816 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
106817 :
106818 5342 : }
106819 :
106820 :
106821 : void
106822 194 : SgPointerDerefExp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
106823 : {
106824 : // This function traverses the memory pool for an IR node and
106825 : // calls the function to execute the visitor object.
106826 :
106827 : // Initialize array to the address of the first element of the STL vector
106828 : // (which is guarenteed to be contiguous storage).
106829 : // SgPointerDerefExp objectArray [] = *(Memory_Block_List.begin());
106830 194 : if (SgPointerDerefExp::pools.empty() == false)
106831 : {
106832 : // Generate an array of memory pools
106833 137 : SgPointerDerefExp** objectArray = (SgPointerDerefExp**) &(SgPointerDerefExp::pools[0]);
106834 :
106835 : // Build a local variable for better performance
106836 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
106837 :
106838 : // Iterate over the memory pools
106839 274 : for (unsigned int i=0; i < SgPointerDerefExp::pools.size(); i++)
106840 : {
106841 : // objectArray[i] is a single memory pool
106842 274137 : for (unsigned j=0; j < SgPointerDerefExp::pool_size; j++)
106843 : {
106844 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
106845 : {
106846 : // printf ("Found a valid SgPointerDerefExp object in the memory pool %d at position %d \n",i,j);
106847 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
106848 54533 : objectArray[i][j].executeVisitorMemberFunction(visitor);
106849 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
106850 : }
106851 : else
106852 : {
106853 : // printf ("Found a INVALID SgPointerDerefExp object in the memory pool \n");
106854 : }
106855 : }
106856 : }
106857 : }
106858 :
106859 : // This should not be required since all previously static data members are
106860 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
106861 :
106862 194 : }
106863 :
106864 : void
106865 0 : SgPointerDerefExp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
106866 : {
106867 : // This function visits only a single IR node of the memory pool.
106868 : // it is typically called once for each type of IR node within
106869 : // the automatically generated function: traverseRepresentativeNodes().
106870 :
106871 : // Initialize array to the address of the first element of the STL vector
106872 : // (which is guarenteed to be contiguous storage).
106873 : // SgPointerDerefExp objectArray [] = *(Memory_Block_List.begin());
106874 0 : if (SgPointerDerefExp::pools.empty() == false)
106875 : {
106876 : // Generate an array of memory pools
106877 0 : SgPointerDerefExp** objectArray = (SgPointerDerefExp**) &(SgPointerDerefExp::pools[0]);
106878 :
106879 : // Build a local variable for better performance
106880 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
106881 :
106882 : // Iterate over the memory pools
106883 0 : bool done = false;
106884 0 : unsigned i=0;
106885 :
106886 : // find the first valid IR node, call visit function, and then leave
106887 0 : while ( done == false && i < SgPointerDerefExp::pools.size() )
106888 : {
106889 : // objectArray[i] is a single memory pool
106890 : unsigned j=0;
106891 0 : while (done == false && j < SgPointerDerefExp::pool_size)
106892 : {
106893 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
106894 : {
106895 0 : traversal.visit(&(objectArray[i][j]));
106896 0 : done = true;
106897 : }
106898 0 : j++;
106899 : }
106900 0 : i++;
106901 : }
106902 :
106903 : #if 0
106904 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
106905 : if (done == false)
106906 : {
106907 : printf ("No representative for SgPointerDerefExp found in memory pools \n");
106908 : }
106909 : #endif
106910 : }
106911 0 : }
106912 :
106913 :
106914 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
106915 : // using values that overflow signed values of int.
106916 : size_t
106917 4 : SgPointerDerefExp::numberOfNodes()
106918 : {
106919 : // This function traverses the memory pool for an IR node and
106920 : // counts the number of IR nodes of a particular Sage III IR
106921 : // nodes type.
106922 :
106923 4 : size_t count = 0;
106924 4 : if (SgPointerDerefExp::pools.empty() == false)
106925 : {
106926 : // Generate an array of memory pools (this is actually a STL vector,
106927 : // but it is contiguious, so OK to treat this way).
106928 1 : SgPointerDerefExp** objectArray = (SgPointerDerefExp**) &(SgPointerDerefExp::pools[0]);
106929 :
106930 : // Build a local variable for better performance (make it a loop invariant variable).
106931 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
106932 :
106933 : // Iterate over all of the memory pools for this IR node.
106934 2 : for (unsigned int i=0; i < SgPointerDerefExp::pools.size(); i++)
106935 : {
106936 : // objectArray[i] is a single memory pool, iterate over all the
106937 : // IR nodes and only count those that are valid IR nodes used in
106938 : // the AST (i.e. allocated IR nodes).
106939 2001 : for (unsigned j=0; j < SgPointerDerefExp::pool_size; j++)
106940 : {
106941 : // This is indexing the STL vector of C/C++ style arrays as a doubly
106942 : // indexed array access. It is OK since we have leveraged the semantics
106943 : // of STL vector memory as contigous and cast the memory as an array
106944 : // of arrays to use the 2D array indexing. Hope this is not confusing,
106945 : // but it s very fast as an implementation.
106946 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
106947 : {
106948 384 : count++;
106949 : }
106950 : }
106951 : }
106952 : }
106953 :
106954 :
106955 :
106956 4 : return count;
106957 : }
106958 :
106959 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
106960 : // using values that overflow signed values of int.
106961 : size_t
106962 0 : SgPointerDerefExp::memoryUsage()
106963 : {
106964 : // This function is required because we need the class name as a type when we call sizeof
106965 : // There might be another way to implement this if we have a traversal that only called a
106966 : // representative object (one call for each type of Sage IIIIR node).
106967 0 : size_t memory = numberOfNodes() * sizeof(SgPointerDerefExp);
106968 :
106969 0 : return memory;
106970 : }
106971 :
106972 : /* #line 106973 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
106973 :
106974 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
106975 : void
106976 5342 : SgAddressOfOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
106977 : {
106978 : // This function traverses the memory pool for only a specific IR node
106979 : // and calls the visit function of the input class execute a traversal
106980 : // similar to the style of the attribute based traversals within ROSE.
106981 : // This traversal will visit ALL nodes of the AST where as the other
106982 : // attribute based traversals visit only the embedded tree within the AST.
106983 :
106984 : // Initialize array to the address of the first element of the STL vector
106985 : // (which is guaranteed to be contiguous storage).
106986 : // SgAddressOfOp objectArray [] = *(Memory_Block_List.begin());
106987 5342 : if (SgAddressOfOp::pools.empty() == false)
106988 : {
106989 : // Generate an array of memory pools
106990 573 : SgAddressOfOp** objectArray = (SgAddressOfOp**) &(SgAddressOfOp::pools[0]);
106991 :
106992 : // Build a local variable for better performance
106993 573 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
106994 : #if 0
106995 : // Iterate over the memory pools
106996 : for (unsigned int i=0; i < SgAddressOfOp::pools.size(); i++)
106997 : {
106998 : // objectArray[i] is a single memory pool
106999 : for (int j=0; j < SgAddressOfOp::pool_size; j++)
107000 : {
107001 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
107002 : {
107003 : traversal.visit(&(objectArray[i][j]));
107004 : }
107005 : }
107006 : }
107007 : #else
107008 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
107009 : // compute the list first and then call the visit function on each list element.
107010 :
107011 : // printf ("Inside of SgAddressOfOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
107012 :
107013 1146 : std::vector<SgAddressOfOp*> nodeList;
107014 :
107015 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
107016 1146 : for (unsigned int i=0; i < SgAddressOfOp::pools.size(); i++)
107017 : {
107018 : // objectArray[i] is a single memory pool
107019 1146570 : for (unsigned j=0; j < SgAddressOfOp::pool_size; j++)
107020 : {
107021 1146000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
107022 : {
107023 11154 : nodeList.push_back(&(objectArray[i][j]));
107024 : }
107025 : }
107026 : }
107027 :
107028 : // Iterate over the saved list
107029 573 : size_t nodeListSize = nodeList.size();
107030 11727 : for (size_t i=0; i < nodeListSize; i++)
107031 : {
107032 11154 : ROSE_ASSERT(nodeList[i] != NULL);
107033 : #if 0
107034 : traversal.visit(nodeList[i]);
107035 : #else
107036 11154 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
107037 : {
107038 11154 : traversal.visit(nodeList[i]);
107039 : }
107040 : #endif
107041 : }
107042 : #endif
107043 : }
107044 :
107045 : // This should not be required since all previously static data members are
107046 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
107047 :
107048 5342 : }
107049 :
107050 :
107051 : void
107052 194 : SgAddressOfOp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
107053 : {
107054 : // This function traverses the memory pool for an IR node and
107055 : // calls the function to execute the visitor object.
107056 :
107057 : // Initialize array to the address of the first element of the STL vector
107058 : // (which is guarenteed to be contiguous storage).
107059 : // SgAddressOfOp objectArray [] = *(Memory_Block_List.begin());
107060 194 : if (SgAddressOfOp::pools.empty() == false)
107061 : {
107062 : // Generate an array of memory pools
107063 137 : SgAddressOfOp** objectArray = (SgAddressOfOp**) &(SgAddressOfOp::pools[0]);
107064 :
107065 : // Build a local variable for better performance
107066 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
107067 :
107068 : // Iterate over the memory pools
107069 274 : for (unsigned int i=0; i < SgAddressOfOp::pools.size(); i++)
107070 : {
107071 : // objectArray[i] is a single memory pool
107072 274137 : for (unsigned j=0; j < SgAddressOfOp::pool_size; j++)
107073 : {
107074 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
107075 : {
107076 : // printf ("Found a valid SgAddressOfOp object in the memory pool %d at position %d \n",i,j);
107077 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
107078 11649 : objectArray[i][j].executeVisitorMemberFunction(visitor);
107079 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
107080 : }
107081 : else
107082 : {
107083 : // printf ("Found a INVALID SgAddressOfOp object in the memory pool \n");
107084 : }
107085 : }
107086 : }
107087 : }
107088 :
107089 : // This should not be required since all previously static data members are
107090 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
107091 :
107092 194 : }
107093 :
107094 : void
107095 0 : SgAddressOfOp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
107096 : {
107097 : // This function visits only a single IR node of the memory pool.
107098 : // it is typically called once for each type of IR node within
107099 : // the automatically generated function: traverseRepresentativeNodes().
107100 :
107101 : // Initialize array to the address of the first element of the STL vector
107102 : // (which is guarenteed to be contiguous storage).
107103 : // SgAddressOfOp objectArray [] = *(Memory_Block_List.begin());
107104 0 : if (SgAddressOfOp::pools.empty() == false)
107105 : {
107106 : // Generate an array of memory pools
107107 0 : SgAddressOfOp** objectArray = (SgAddressOfOp**) &(SgAddressOfOp::pools[0]);
107108 :
107109 : // Build a local variable for better performance
107110 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
107111 :
107112 : // Iterate over the memory pools
107113 0 : bool done = false;
107114 0 : unsigned i=0;
107115 :
107116 : // find the first valid IR node, call visit function, and then leave
107117 0 : while ( done == false && i < SgAddressOfOp::pools.size() )
107118 : {
107119 : // objectArray[i] is a single memory pool
107120 : unsigned j=0;
107121 0 : while (done == false && j < SgAddressOfOp::pool_size)
107122 : {
107123 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
107124 : {
107125 0 : traversal.visit(&(objectArray[i][j]));
107126 0 : done = true;
107127 : }
107128 0 : j++;
107129 : }
107130 0 : i++;
107131 : }
107132 :
107133 : #if 0
107134 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
107135 : if (done == false)
107136 : {
107137 : printf ("No representative for SgAddressOfOp found in memory pools \n");
107138 : }
107139 : #endif
107140 : }
107141 0 : }
107142 :
107143 :
107144 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
107145 : // using values that overflow signed values of int.
107146 : size_t
107147 4 : SgAddressOfOp::numberOfNodes()
107148 : {
107149 : // This function traverses the memory pool for an IR node and
107150 : // counts the number of IR nodes of a particular Sage III IR
107151 : // nodes type.
107152 :
107153 4 : size_t count = 0;
107154 4 : if (SgAddressOfOp::pools.empty() == false)
107155 : {
107156 : // Generate an array of memory pools (this is actually a STL vector,
107157 : // but it is contiguious, so OK to treat this way).
107158 1 : SgAddressOfOp** objectArray = (SgAddressOfOp**) &(SgAddressOfOp::pools[0]);
107159 :
107160 : // Build a local variable for better performance (make it a loop invariant variable).
107161 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
107162 :
107163 : // Iterate over all of the memory pools for this IR node.
107164 2 : for (unsigned int i=0; i < SgAddressOfOp::pools.size(); i++)
107165 : {
107166 : // objectArray[i] is a single memory pool, iterate over all the
107167 : // IR nodes and only count those that are valid IR nodes used in
107168 : // the AST (i.e. allocated IR nodes).
107169 2001 : for (unsigned j=0; j < SgAddressOfOp::pool_size; j++)
107170 : {
107171 : // This is indexing the STL vector of C/C++ style arrays as a doubly
107172 : // indexed array access. It is OK since we have leveraged the semantics
107173 : // of STL vector memory as contigous and cast the memory as an array
107174 : // of arrays to use the 2D array indexing. Hope this is not confusing,
107175 : // but it s very fast as an implementation.
107176 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
107177 : {
107178 84 : count++;
107179 : }
107180 : }
107181 : }
107182 : }
107183 :
107184 :
107185 :
107186 4 : return count;
107187 : }
107188 :
107189 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
107190 : // using values that overflow signed values of int.
107191 : size_t
107192 0 : SgAddressOfOp::memoryUsage()
107193 : {
107194 : // This function is required because we need the class name as a type when we call sizeof
107195 : // There might be another way to implement this if we have a traversal that only called a
107196 : // representative object (one call for each type of Sage IIIIR node).
107197 0 : size_t memory = numberOfNodes() * sizeof(SgAddressOfOp);
107198 :
107199 0 : return memory;
107200 : }
107201 :
107202 : /* #line 107203 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
107203 :
107204 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
107205 : void
107206 5342 : SgMinusMinusOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
107207 : {
107208 : // This function traverses the memory pool for only a specific IR node
107209 : // and calls the visit function of the input class execute a traversal
107210 : // similar to the style of the attribute based traversals within ROSE.
107211 : // This traversal will visit ALL nodes of the AST where as the other
107212 : // attribute based traversals visit only the embedded tree within the AST.
107213 :
107214 : // Initialize array to the address of the first element of the STL vector
107215 : // (which is guaranteed to be contiguous storage).
107216 : // SgMinusMinusOp objectArray [] = *(Memory_Block_List.begin());
107217 5342 : if (SgMinusMinusOp::pools.empty() == false)
107218 : {
107219 : // Generate an array of memory pools
107220 265 : SgMinusMinusOp** objectArray = (SgMinusMinusOp**) &(SgMinusMinusOp::pools[0]);
107221 :
107222 : // Build a local variable for better performance
107223 265 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
107224 : #if 0
107225 : // Iterate over the memory pools
107226 : for (unsigned int i=0; i < SgMinusMinusOp::pools.size(); i++)
107227 : {
107228 : // objectArray[i] is a single memory pool
107229 : for (int j=0; j < SgMinusMinusOp::pool_size; j++)
107230 : {
107231 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
107232 : {
107233 : traversal.visit(&(objectArray[i][j]));
107234 : }
107235 : }
107236 : }
107237 : #else
107238 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
107239 : // compute the list first and then call the visit function on each list element.
107240 :
107241 : // printf ("Inside of SgMinusMinusOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
107242 :
107243 530 : std::vector<SgMinusMinusOp*> nodeList;
107244 :
107245 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
107246 530 : for (unsigned int i=0; i < SgMinusMinusOp::pools.size(); i++)
107247 : {
107248 : // objectArray[i] is a single memory pool
107249 530265 : for (unsigned j=0; j < SgMinusMinusOp::pool_size; j++)
107250 : {
107251 530000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
107252 : {
107253 7244 : nodeList.push_back(&(objectArray[i][j]));
107254 : }
107255 : }
107256 : }
107257 :
107258 : // Iterate over the saved list
107259 265 : size_t nodeListSize = nodeList.size();
107260 7509 : for (size_t i=0; i < nodeListSize; i++)
107261 : {
107262 7244 : ROSE_ASSERT(nodeList[i] != NULL);
107263 : #if 0
107264 : traversal.visit(nodeList[i]);
107265 : #else
107266 7244 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
107267 : {
107268 7244 : traversal.visit(nodeList[i]);
107269 : }
107270 : #endif
107271 : }
107272 : #endif
107273 : }
107274 :
107275 : // This should not be required since all previously static data members are
107276 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
107277 :
107278 5342 : }
107279 :
107280 :
107281 : void
107282 194 : SgMinusMinusOp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
107283 : {
107284 : // This function traverses the memory pool for an IR node and
107285 : // calls the function to execute the visitor object.
107286 :
107287 : // Initialize array to the address of the first element of the STL vector
107288 : // (which is guarenteed to be contiguous storage).
107289 : // SgMinusMinusOp objectArray [] = *(Memory_Block_List.begin());
107290 194 : if (SgMinusMinusOp::pools.empty() == false)
107291 : {
107292 : // Generate an array of memory pools
107293 142 : SgMinusMinusOp** objectArray = (SgMinusMinusOp**) &(SgMinusMinusOp::pools[0]);
107294 :
107295 : // Build a local variable for better performance
107296 142 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
107297 :
107298 : // Iterate over the memory pools
107299 284 : for (unsigned int i=0; i < SgMinusMinusOp::pools.size(); i++)
107300 : {
107301 : // objectArray[i] is a single memory pool
107302 284142 : for (unsigned j=0; j < SgMinusMinusOp::pool_size; j++)
107303 : {
107304 284000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
107305 : {
107306 : // printf ("Found a valid SgMinusMinusOp object in the memory pool %d at position %d \n",i,j);
107307 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
107308 6860 : objectArray[i][j].executeVisitorMemberFunction(visitor);
107309 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
107310 : }
107311 : else
107312 : {
107313 : // printf ("Found a INVALID SgMinusMinusOp object in the memory pool \n");
107314 : }
107315 : }
107316 : }
107317 : }
107318 :
107319 : // This should not be required since all previously static data members are
107320 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
107321 :
107322 194 : }
107323 :
107324 : void
107325 0 : SgMinusMinusOp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
107326 : {
107327 : // This function visits only a single IR node of the memory pool.
107328 : // it is typically called once for each type of IR node within
107329 : // the automatically generated function: traverseRepresentativeNodes().
107330 :
107331 : // Initialize array to the address of the first element of the STL vector
107332 : // (which is guarenteed to be contiguous storage).
107333 : // SgMinusMinusOp objectArray [] = *(Memory_Block_List.begin());
107334 0 : if (SgMinusMinusOp::pools.empty() == false)
107335 : {
107336 : // Generate an array of memory pools
107337 0 : SgMinusMinusOp** objectArray = (SgMinusMinusOp**) &(SgMinusMinusOp::pools[0]);
107338 :
107339 : // Build a local variable for better performance
107340 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
107341 :
107342 : // Iterate over the memory pools
107343 0 : bool done = false;
107344 0 : unsigned i=0;
107345 :
107346 : // find the first valid IR node, call visit function, and then leave
107347 0 : while ( done == false && i < SgMinusMinusOp::pools.size() )
107348 : {
107349 : // objectArray[i] is a single memory pool
107350 : unsigned j=0;
107351 0 : while (done == false && j < SgMinusMinusOp::pool_size)
107352 : {
107353 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
107354 : {
107355 0 : traversal.visit(&(objectArray[i][j]));
107356 0 : done = true;
107357 : }
107358 0 : j++;
107359 : }
107360 0 : i++;
107361 : }
107362 :
107363 : #if 0
107364 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
107365 : if (done == false)
107366 : {
107367 : printf ("No representative for SgMinusMinusOp found in memory pools \n");
107368 : }
107369 : #endif
107370 : }
107371 0 : }
107372 :
107373 :
107374 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
107375 : // using values that overflow signed values of int.
107376 : size_t
107377 4 : SgMinusMinusOp::numberOfNodes()
107378 : {
107379 : // This function traverses the memory pool for an IR node and
107380 : // counts the number of IR nodes of a particular Sage III IR
107381 : // nodes type.
107382 :
107383 4 : size_t count = 0;
107384 4 : if (SgMinusMinusOp::pools.empty() == false)
107385 : {
107386 : // Generate an array of memory pools (this is actually a STL vector,
107387 : // but it is contiguious, so OK to treat this way).
107388 1 : SgMinusMinusOp** objectArray = (SgMinusMinusOp**) &(SgMinusMinusOp::pools[0]);
107389 :
107390 : // Build a local variable for better performance (make it a loop invariant variable).
107391 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
107392 :
107393 : // Iterate over all of the memory pools for this IR node.
107394 2 : for (unsigned int i=0; i < SgMinusMinusOp::pools.size(); i++)
107395 : {
107396 : // objectArray[i] is a single memory pool, iterate over all the
107397 : // IR nodes and only count those that are valid IR nodes used in
107398 : // the AST (i.e. allocated IR nodes).
107399 2001 : for (unsigned j=0; j < SgMinusMinusOp::pool_size; j++)
107400 : {
107401 : // This is indexing the STL vector of C/C++ style arrays as a doubly
107402 : // indexed array access. It is OK since we have leveraged the semantics
107403 : // of STL vector memory as contigous and cast the memory as an array
107404 : // of arrays to use the 2D array indexing. Hope this is not confusing,
107405 : // but it s very fast as an implementation.
107406 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
107407 : {
107408 48 : count++;
107409 : }
107410 : }
107411 : }
107412 : }
107413 :
107414 :
107415 :
107416 4 : return count;
107417 : }
107418 :
107419 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
107420 : // using values that overflow signed values of int.
107421 : size_t
107422 0 : SgMinusMinusOp::memoryUsage()
107423 : {
107424 : // This function is required because we need the class name as a type when we call sizeof
107425 : // There might be another way to implement this if we have a traversal that only called a
107426 : // representative object (one call for each type of Sage IIIIR node).
107427 0 : size_t memory = numberOfNodes() * sizeof(SgMinusMinusOp);
107428 :
107429 0 : return memory;
107430 : }
107431 :
107432 : /* #line 107433 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
107433 :
107434 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
107435 : void
107436 5342 : SgPlusPlusOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
107437 : {
107438 : // This function traverses the memory pool for only a specific IR node
107439 : // and calls the visit function of the input class execute a traversal
107440 : // similar to the style of the attribute based traversals within ROSE.
107441 : // This traversal will visit ALL nodes of the AST where as the other
107442 : // attribute based traversals visit only the embedded tree within the AST.
107443 :
107444 : // Initialize array to the address of the first element of the STL vector
107445 : // (which is guaranteed to be contiguous storage).
107446 : // SgPlusPlusOp objectArray [] = *(Memory_Block_List.begin());
107447 5342 : if (SgPlusPlusOp::pools.empty() == false)
107448 : {
107449 : // Generate an array of memory pools
107450 2501 : SgPlusPlusOp** objectArray = (SgPlusPlusOp**) &(SgPlusPlusOp::pools[0]);
107451 :
107452 : // Build a local variable for better performance
107453 2501 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
107454 : #if 0
107455 : // Iterate over the memory pools
107456 : for (unsigned int i=0; i < SgPlusPlusOp::pools.size(); i++)
107457 : {
107458 : // objectArray[i] is a single memory pool
107459 : for (int j=0; j < SgPlusPlusOp::pool_size; j++)
107460 : {
107461 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
107462 : {
107463 : traversal.visit(&(objectArray[i][j]));
107464 : }
107465 : }
107466 : }
107467 : #else
107468 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
107469 : // compute the list first and then call the visit function on each list element.
107470 :
107471 : // printf ("Inside of SgPlusPlusOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
107472 :
107473 5002 : std::vector<SgPlusPlusOp*> nodeList;
107474 :
107475 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
107476 5002 : for (unsigned int i=0; i < SgPlusPlusOp::pools.size(); i++)
107477 : {
107478 : // objectArray[i] is a single memory pool
107479 5004500 : for (unsigned j=0; j < SgPlusPlusOp::pool_size; j++)
107480 : {
107481 5002000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
107482 : {
107483 26790 : nodeList.push_back(&(objectArray[i][j]));
107484 : }
107485 : }
107486 : }
107487 :
107488 : // Iterate over the saved list
107489 2501 : size_t nodeListSize = nodeList.size();
107490 29291 : for (size_t i=0; i < nodeListSize; i++)
107491 : {
107492 26790 : ROSE_ASSERT(nodeList[i] != NULL);
107493 : #if 0
107494 : traversal.visit(nodeList[i]);
107495 : #else
107496 26790 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
107497 : {
107498 26790 : traversal.visit(nodeList[i]);
107499 : }
107500 : #endif
107501 : }
107502 : #endif
107503 : }
107504 :
107505 : // This should not be required since all previously static data members are
107506 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
107507 :
107508 5342 : }
107509 :
107510 :
107511 : void
107512 194 : SgPlusPlusOp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
107513 : {
107514 : // This function traverses the memory pool for an IR node and
107515 : // calls the function to execute the visitor object.
107516 :
107517 : // Initialize array to the address of the first element of the STL vector
107518 : // (which is guarenteed to be contiguous storage).
107519 : // SgPlusPlusOp objectArray [] = *(Memory_Block_List.begin());
107520 194 : if (SgPlusPlusOp::pools.empty() == false)
107521 : {
107522 : // Generate an array of memory pools
107523 160 : SgPlusPlusOp** objectArray = (SgPlusPlusOp**) &(SgPlusPlusOp::pools[0]);
107524 :
107525 : // Build a local variable for better performance
107526 160 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
107527 :
107528 : // Iterate over the memory pools
107529 320 : for (unsigned int i=0; i < SgPlusPlusOp::pools.size(); i++)
107530 : {
107531 : // objectArray[i] is a single memory pool
107532 320160 : for (unsigned j=0; j < SgPlusPlusOp::pool_size; j++)
107533 : {
107534 320000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
107535 : {
107536 : // printf ("Found a valid SgPlusPlusOp object in the memory pool %d at position %d \n",i,j);
107537 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
107538 18932 : objectArray[i][j].executeVisitorMemberFunction(visitor);
107539 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
107540 : }
107541 : else
107542 : {
107543 : // printf ("Found a INVALID SgPlusPlusOp object in the memory pool \n");
107544 : }
107545 : }
107546 : }
107547 : }
107548 :
107549 : // This should not be required since all previously static data members are
107550 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
107551 :
107552 194 : }
107553 :
107554 : void
107555 0 : SgPlusPlusOp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
107556 : {
107557 : // This function visits only a single IR node of the memory pool.
107558 : // it is typically called once for each type of IR node within
107559 : // the automatically generated function: traverseRepresentativeNodes().
107560 :
107561 : // Initialize array to the address of the first element of the STL vector
107562 : // (which is guarenteed to be contiguous storage).
107563 : // SgPlusPlusOp objectArray [] = *(Memory_Block_List.begin());
107564 0 : if (SgPlusPlusOp::pools.empty() == false)
107565 : {
107566 : // Generate an array of memory pools
107567 0 : SgPlusPlusOp** objectArray = (SgPlusPlusOp**) &(SgPlusPlusOp::pools[0]);
107568 :
107569 : // Build a local variable for better performance
107570 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
107571 :
107572 : // Iterate over the memory pools
107573 0 : bool done = false;
107574 0 : unsigned i=0;
107575 :
107576 : // find the first valid IR node, call visit function, and then leave
107577 0 : while ( done == false && i < SgPlusPlusOp::pools.size() )
107578 : {
107579 : // objectArray[i] is a single memory pool
107580 : unsigned j=0;
107581 0 : while (done == false && j < SgPlusPlusOp::pool_size)
107582 : {
107583 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
107584 : {
107585 0 : traversal.visit(&(objectArray[i][j]));
107586 0 : done = true;
107587 : }
107588 0 : j++;
107589 : }
107590 0 : i++;
107591 : }
107592 :
107593 : #if 0
107594 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
107595 : if (done == false)
107596 : {
107597 : printf ("No representative for SgPlusPlusOp found in memory pools \n");
107598 : }
107599 : #endif
107600 : }
107601 0 : }
107602 :
107603 :
107604 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
107605 : // using values that overflow signed values of int.
107606 : size_t
107607 4 : SgPlusPlusOp::numberOfNodes()
107608 : {
107609 : // This function traverses the memory pool for an IR node and
107610 : // counts the number of IR nodes of a particular Sage III IR
107611 : // nodes type.
107612 :
107613 4 : size_t count = 0;
107614 4 : if (SgPlusPlusOp::pools.empty() == false)
107615 : {
107616 : // Generate an array of memory pools (this is actually a STL vector,
107617 : // but it is contiguious, so OK to treat this way).
107618 1 : SgPlusPlusOp** objectArray = (SgPlusPlusOp**) &(SgPlusPlusOp::pools[0]);
107619 :
107620 : // Build a local variable for better performance (make it a loop invariant variable).
107621 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
107622 :
107623 : // Iterate over all of the memory pools for this IR node.
107624 2 : for (unsigned int i=0; i < SgPlusPlusOp::pools.size(); i++)
107625 : {
107626 : // objectArray[i] is a single memory pool, iterate over all the
107627 : // IR nodes and only count those that are valid IR nodes used in
107628 : // the AST (i.e. allocated IR nodes).
107629 2001 : for (unsigned j=0; j < SgPlusPlusOp::pool_size; j++)
107630 : {
107631 : // This is indexing the STL vector of C/C++ style arrays as a doubly
107632 : // indexed array access. It is OK since we have leveraged the semantics
107633 : // of STL vector memory as contigous and cast the memory as an array
107634 : // of arrays to use the 2D array indexing. Hope this is not confusing,
107635 : // but it s very fast as an implementation.
107636 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
107637 : {
107638 131 : count++;
107639 : }
107640 : }
107641 : }
107642 : }
107643 :
107644 :
107645 :
107646 4 : return count;
107647 : }
107648 :
107649 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
107650 : // using values that overflow signed values of int.
107651 : size_t
107652 0 : SgPlusPlusOp::memoryUsage()
107653 : {
107654 : // This function is required because we need the class name as a type when we call sizeof
107655 : // There might be another way to implement this if we have a traversal that only called a
107656 : // representative object (one call for each type of Sage IIIIR node).
107657 0 : size_t memory = numberOfNodes() * sizeof(SgPlusPlusOp);
107658 :
107659 0 : return memory;
107660 : }
107661 :
107662 : /* #line 107663 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
107663 :
107664 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
107665 : void
107666 5342 : SgBitComplementOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
107667 : {
107668 : // This function traverses the memory pool for only a specific IR node
107669 : // and calls the visit function of the input class execute a traversal
107670 : // similar to the style of the attribute based traversals within ROSE.
107671 : // This traversal will visit ALL nodes of the AST where as the other
107672 : // attribute based traversals visit only the embedded tree within the AST.
107673 :
107674 : // Initialize array to the address of the first element of the STL vector
107675 : // (which is guaranteed to be contiguous storage).
107676 : // SgBitComplementOp objectArray [] = *(Memory_Block_List.begin());
107677 5342 : if (SgBitComplementOp::pools.empty() == false)
107678 : {
107679 : // Generate an array of memory pools
107680 138 : SgBitComplementOp** objectArray = (SgBitComplementOp**) &(SgBitComplementOp::pools[0]);
107681 :
107682 : // Build a local variable for better performance
107683 138 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
107684 : #if 0
107685 : // Iterate over the memory pools
107686 : for (unsigned int i=0; i < SgBitComplementOp::pools.size(); i++)
107687 : {
107688 : // objectArray[i] is a single memory pool
107689 : for (int j=0; j < SgBitComplementOp::pool_size; j++)
107690 : {
107691 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
107692 : {
107693 : traversal.visit(&(objectArray[i][j]));
107694 : }
107695 : }
107696 : }
107697 : #else
107698 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
107699 : // compute the list first and then call the visit function on each list element.
107700 :
107701 : // printf ("Inside of SgBitComplementOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
107702 :
107703 276 : std::vector<SgBitComplementOp*> nodeList;
107704 :
107705 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
107706 276 : for (unsigned int i=0; i < SgBitComplementOp::pools.size(); i++)
107707 : {
107708 : // objectArray[i] is a single memory pool
107709 276138 : for (unsigned j=0; j < SgBitComplementOp::pool_size; j++)
107710 : {
107711 276000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
107712 : {
107713 1983 : nodeList.push_back(&(objectArray[i][j]));
107714 : }
107715 : }
107716 : }
107717 :
107718 : // Iterate over the saved list
107719 138 : size_t nodeListSize = nodeList.size();
107720 2121 : for (size_t i=0; i < nodeListSize; i++)
107721 : {
107722 1983 : ROSE_ASSERT(nodeList[i] != NULL);
107723 : #if 0
107724 : traversal.visit(nodeList[i]);
107725 : #else
107726 1983 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
107727 : {
107728 1983 : traversal.visit(nodeList[i]);
107729 : }
107730 : #endif
107731 : }
107732 : #endif
107733 : }
107734 :
107735 : // This should not be required since all previously static data members are
107736 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
107737 :
107738 5342 : }
107739 :
107740 :
107741 : void
107742 194 : SgBitComplementOp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
107743 : {
107744 : // This function traverses the memory pool for an IR node and
107745 : // calls the function to execute the visitor object.
107746 :
107747 : // Initialize array to the address of the first element of the STL vector
107748 : // (which is guarenteed to be contiguous storage).
107749 : // SgBitComplementOp objectArray [] = *(Memory_Block_List.begin());
107750 194 : if (SgBitComplementOp::pools.empty() == false)
107751 : {
107752 : // Generate an array of memory pools
107753 137 : SgBitComplementOp** objectArray = (SgBitComplementOp**) &(SgBitComplementOp::pools[0]);
107754 :
107755 : // Build a local variable for better performance
107756 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
107757 :
107758 : // Iterate over the memory pools
107759 274 : for (unsigned int i=0; i < SgBitComplementOp::pools.size(); i++)
107760 : {
107761 : // objectArray[i] is a single memory pool
107762 274137 : for (unsigned j=0; j < SgBitComplementOp::pool_size; j++)
107763 : {
107764 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
107765 : {
107766 : // printf ("Found a valid SgBitComplementOp object in the memory pool %d at position %d \n",i,j);
107767 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
107768 1669 : objectArray[i][j].executeVisitorMemberFunction(visitor);
107769 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
107770 : }
107771 : else
107772 : {
107773 : // printf ("Found a INVALID SgBitComplementOp object in the memory pool \n");
107774 : }
107775 : }
107776 : }
107777 : }
107778 :
107779 : // This should not be required since all previously static data members are
107780 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
107781 :
107782 194 : }
107783 :
107784 : void
107785 0 : SgBitComplementOp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
107786 : {
107787 : // This function visits only a single IR node of the memory pool.
107788 : // it is typically called once for each type of IR node within
107789 : // the automatically generated function: traverseRepresentativeNodes().
107790 :
107791 : // Initialize array to the address of the first element of the STL vector
107792 : // (which is guarenteed to be contiguous storage).
107793 : // SgBitComplementOp objectArray [] = *(Memory_Block_List.begin());
107794 0 : if (SgBitComplementOp::pools.empty() == false)
107795 : {
107796 : // Generate an array of memory pools
107797 0 : SgBitComplementOp** objectArray = (SgBitComplementOp**) &(SgBitComplementOp::pools[0]);
107798 :
107799 : // Build a local variable for better performance
107800 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
107801 :
107802 : // Iterate over the memory pools
107803 0 : bool done = false;
107804 0 : unsigned i=0;
107805 :
107806 : // find the first valid IR node, call visit function, and then leave
107807 0 : while ( done == false && i < SgBitComplementOp::pools.size() )
107808 : {
107809 : // objectArray[i] is a single memory pool
107810 : unsigned j=0;
107811 0 : while (done == false && j < SgBitComplementOp::pool_size)
107812 : {
107813 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
107814 : {
107815 0 : traversal.visit(&(objectArray[i][j]));
107816 0 : done = true;
107817 : }
107818 0 : j++;
107819 : }
107820 0 : i++;
107821 : }
107822 :
107823 : #if 0
107824 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
107825 : if (done == false)
107826 : {
107827 : printf ("No representative for SgBitComplementOp found in memory pools \n");
107828 : }
107829 : #endif
107830 : }
107831 0 : }
107832 :
107833 :
107834 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
107835 : // using values that overflow signed values of int.
107836 : size_t
107837 4 : SgBitComplementOp::numberOfNodes()
107838 : {
107839 : // This function traverses the memory pool for an IR node and
107840 : // counts the number of IR nodes of a particular Sage III IR
107841 : // nodes type.
107842 :
107843 4 : size_t count = 0;
107844 4 : if (SgBitComplementOp::pools.empty() == false)
107845 : {
107846 : // Generate an array of memory pools (this is actually a STL vector,
107847 : // but it is contiguious, so OK to treat this way).
107848 1 : SgBitComplementOp** objectArray = (SgBitComplementOp**) &(SgBitComplementOp::pools[0]);
107849 :
107850 : // Build a local variable for better performance (make it a loop invariant variable).
107851 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
107852 :
107853 : // Iterate over all of the memory pools for this IR node.
107854 2 : for (unsigned int i=0; i < SgBitComplementOp::pools.size(); i++)
107855 : {
107856 : // objectArray[i] is a single memory pool, iterate over all the
107857 : // IR nodes and only count those that are valid IR nodes used in
107858 : // the AST (i.e. allocated IR nodes).
107859 2001 : for (unsigned j=0; j < SgBitComplementOp::pool_size; j++)
107860 : {
107861 : // This is indexing the STL vector of C/C++ style arrays as a doubly
107862 : // indexed array access. It is OK since we have leveraged the semantics
107863 : // of STL vector memory as contigous and cast the memory as an array
107864 : // of arrays to use the 2D array indexing. Hope this is not confusing,
107865 : // but it s very fast as an implementation.
107866 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
107867 : {
107868 11 : count++;
107869 : }
107870 : }
107871 : }
107872 : }
107873 :
107874 :
107875 :
107876 4 : return count;
107877 : }
107878 :
107879 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
107880 : // using values that overflow signed values of int.
107881 : size_t
107882 0 : SgBitComplementOp::memoryUsage()
107883 : {
107884 : // This function is required because we need the class name as a type when we call sizeof
107885 : // There might be another way to implement this if we have a traversal that only called a
107886 : // representative object (one call for each type of Sage IIIIR node).
107887 0 : size_t memory = numberOfNodes() * sizeof(SgBitComplementOp);
107888 :
107889 0 : return memory;
107890 : }
107891 :
107892 : /* #line 107893 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
107893 :
107894 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
107895 : void
107896 5342 : SgCastExp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
107897 : {
107898 : // This function traverses the memory pool for only a specific IR node
107899 : // and calls the visit function of the input class execute a traversal
107900 : // similar to the style of the attribute based traversals within ROSE.
107901 : // This traversal will visit ALL nodes of the AST where as the other
107902 : // attribute based traversals visit only the embedded tree within the AST.
107903 :
107904 : // Initialize array to the address of the first element of the STL vector
107905 : // (which is guaranteed to be contiguous storage).
107906 : // SgCastExp objectArray [] = *(Memory_Block_List.begin());
107907 5342 : if (SgCastExp::pools.empty() == false)
107908 : {
107909 : // Generate an array of memory pools
107910 3235 : SgCastExp** objectArray = (SgCastExp**) &(SgCastExp::pools[0]);
107911 :
107912 : // Build a local variable for better performance
107913 3235 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
107914 : #if 0
107915 : // Iterate over the memory pools
107916 : for (unsigned int i=0; i < SgCastExp::pools.size(); i++)
107917 : {
107918 : // objectArray[i] is a single memory pool
107919 : for (int j=0; j < SgCastExp::pool_size; j++)
107920 : {
107921 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
107922 : {
107923 : traversal.visit(&(objectArray[i][j]));
107924 : }
107925 : }
107926 : }
107927 : #else
107928 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
107929 : // compute the list first and then call the visit function on each list element.
107930 :
107931 : // printf ("Inside of SgCastExp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
107932 :
107933 6470 : std::vector<SgCastExp*> nodeList;
107934 :
107935 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
107936 6586 : for (unsigned int i=0; i < SgCastExp::pools.size(); i++)
107937 : {
107938 : // objectArray[i] is a single memory pool
107939 6705350 : for (unsigned j=0; j < SgCastExp::pool_size; j++)
107940 : {
107941 6702000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
107942 : {
107943 355637 : nodeList.push_back(&(objectArray[i][j]));
107944 : }
107945 : }
107946 : }
107947 :
107948 : // Iterate over the saved list
107949 3235 : size_t nodeListSize = nodeList.size();
107950 358872 : for (size_t i=0; i < nodeListSize; i++)
107951 : {
107952 355637 : ROSE_ASSERT(nodeList[i] != NULL);
107953 : #if 0
107954 : traversal.visit(nodeList[i]);
107955 : #else
107956 355637 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
107957 : {
107958 355637 : traversal.visit(nodeList[i]);
107959 : }
107960 : #endif
107961 : }
107962 : #endif
107963 : }
107964 :
107965 : // This should not be required since all previously static data members are
107966 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
107967 :
107968 5342 : }
107969 :
107970 :
107971 : void
107972 194 : SgCastExp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
107973 : {
107974 : // This function traverses the memory pool for an IR node and
107975 : // calls the function to execute the visitor object.
107976 :
107977 : // Initialize array to the address of the first element of the STL vector
107978 : // (which is guarenteed to be contiguous storage).
107979 : // SgCastExp objectArray [] = *(Memory_Block_List.begin());
107980 194 : if (SgCastExp::pools.empty() == false)
107981 : {
107982 : // Generate an array of memory pools
107983 190 : SgCastExp** objectArray = (SgCastExp**) &(SgCastExp::pools[0]);
107984 :
107985 : // Build a local variable for better performance
107986 190 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
107987 :
107988 : // Iterate over the memory pools
107989 518 : for (unsigned int i=0; i < SgCastExp::pools.size(); i++)
107990 : {
107991 : // objectArray[i] is a single memory pool
107992 656328 : for (unsigned j=0; j < SgCastExp::pool_size; j++)
107993 : {
107994 656000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
107995 : {
107996 : // printf ("Found a valid SgCastExp object in the memory pool %d at position %d \n",i,j);
107997 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
107998 317934 : objectArray[i][j].executeVisitorMemberFunction(visitor);
107999 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
108000 : }
108001 : else
108002 : {
108003 : // printf ("Found a INVALID SgCastExp object in the memory pool \n");
108004 : }
108005 : }
108006 : }
108007 : }
108008 :
108009 : // This should not be required since all previously static data members are
108010 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
108011 :
108012 194 : }
108013 :
108014 : void
108015 0 : SgCastExp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
108016 : {
108017 : // This function visits only a single IR node of the memory pool.
108018 : // it is typically called once for each type of IR node within
108019 : // the automatically generated function: traverseRepresentativeNodes().
108020 :
108021 : // Initialize array to the address of the first element of the STL vector
108022 : // (which is guarenteed to be contiguous storage).
108023 : // SgCastExp objectArray [] = *(Memory_Block_List.begin());
108024 0 : if (SgCastExp::pools.empty() == false)
108025 : {
108026 : // Generate an array of memory pools
108027 0 : SgCastExp** objectArray = (SgCastExp**) &(SgCastExp::pools[0]);
108028 :
108029 : // Build a local variable for better performance
108030 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
108031 :
108032 : // Iterate over the memory pools
108033 0 : bool done = false;
108034 0 : unsigned i=0;
108035 :
108036 : // find the first valid IR node, call visit function, and then leave
108037 0 : while ( done == false && i < SgCastExp::pools.size() )
108038 : {
108039 : // objectArray[i] is a single memory pool
108040 : unsigned j=0;
108041 0 : while (done == false && j < SgCastExp::pool_size)
108042 : {
108043 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
108044 : {
108045 0 : traversal.visit(&(objectArray[i][j]));
108046 0 : done = true;
108047 : }
108048 0 : j++;
108049 : }
108050 0 : i++;
108051 : }
108052 :
108053 : #if 0
108054 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
108055 : if (done == false)
108056 : {
108057 : printf ("No representative for SgCastExp found in memory pools \n");
108058 : }
108059 : #endif
108060 : }
108061 0 : }
108062 :
108063 :
108064 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
108065 : // using values that overflow signed values of int.
108066 : size_t
108067 4 : SgCastExp::numberOfNodes()
108068 : {
108069 : // This function traverses the memory pool for an IR node and
108070 : // counts the number of IR nodes of a particular Sage III IR
108071 : // nodes type.
108072 :
108073 4 : size_t count = 0;
108074 4 : if (SgCastExp::pools.empty() == false)
108075 : {
108076 : // Generate an array of memory pools (this is actually a STL vector,
108077 : // but it is contiguious, so OK to treat this way).
108078 2 : SgCastExp** objectArray = (SgCastExp**) &(SgCastExp::pools[0]);
108079 :
108080 : // Build a local variable for better performance (make it a loop invariant variable).
108081 2 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
108082 :
108083 : // Iterate over all of the memory pools for this IR node.
108084 5 : for (unsigned int i=0; i < SgCastExp::pools.size(); i++)
108085 : {
108086 : // objectArray[i] is a single memory pool, iterate over all the
108087 : // IR nodes and only count those that are valid IR nodes used in
108088 : // the AST (i.e. allocated IR nodes).
108089 6003 : for (unsigned j=0; j < SgCastExp::pool_size; j++)
108090 : {
108091 : // This is indexing the STL vector of C/C++ style arrays as a doubly
108092 : // indexed array access. It is OK since we have leveraged the semantics
108093 : // of STL vector memory as contigous and cast the memory as an array
108094 : // of arrays to use the 2D array indexing. Hope this is not confusing,
108095 : // but it s very fast as an implementation.
108096 6000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
108097 : {
108098 2261 : count++;
108099 : }
108100 : }
108101 : }
108102 : }
108103 :
108104 :
108105 :
108106 4 : return count;
108107 : }
108108 :
108109 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
108110 : // using values that overflow signed values of int.
108111 : size_t
108112 0 : SgCastExp::memoryUsage()
108113 : {
108114 : // This function is required because we need the class name as a type when we call sizeof
108115 : // There might be another way to implement this if we have a traversal that only called a
108116 : // representative object (one call for each type of Sage IIIIR node).
108117 0 : size_t memory = numberOfNodes() * sizeof(SgCastExp);
108118 :
108119 0 : return memory;
108120 : }
108121 :
108122 : /* #line 108123 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
108123 :
108124 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
108125 : void
108126 5342 : SgThrowOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
108127 : {
108128 : // This function traverses the memory pool for only a specific IR node
108129 : // and calls the visit function of the input class execute a traversal
108130 : // similar to the style of the attribute based traversals within ROSE.
108131 : // This traversal will visit ALL nodes of the AST where as the other
108132 : // attribute based traversals visit only the embedded tree within the AST.
108133 :
108134 : // Initialize array to the address of the first element of the STL vector
108135 : // (which is guaranteed to be contiguous storage).
108136 : // SgThrowOp objectArray [] = *(Memory_Block_List.begin());
108137 5342 : if (SgThrowOp::pools.empty() == false)
108138 : {
108139 : // Generate an array of memory pools
108140 138 : SgThrowOp** objectArray = (SgThrowOp**) &(SgThrowOp::pools[0]);
108141 :
108142 : // Build a local variable for better performance
108143 138 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
108144 : #if 0
108145 : // Iterate over the memory pools
108146 : for (unsigned int i=0; i < SgThrowOp::pools.size(); i++)
108147 : {
108148 : // objectArray[i] is a single memory pool
108149 : for (int j=0; j < SgThrowOp::pool_size; j++)
108150 : {
108151 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
108152 : {
108153 : traversal.visit(&(objectArray[i][j]));
108154 : }
108155 : }
108156 : }
108157 : #else
108158 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
108159 : // compute the list first and then call the visit function on each list element.
108160 :
108161 : // printf ("Inside of SgThrowOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
108162 :
108163 276 : std::vector<SgThrowOp*> nodeList;
108164 :
108165 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
108166 276 : for (unsigned int i=0; i < SgThrowOp::pools.size(); i++)
108167 : {
108168 : // objectArray[i] is a single memory pool
108169 276138 : for (unsigned j=0; j < SgThrowOp::pool_size; j++)
108170 : {
108171 276000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
108172 : {
108173 6826 : nodeList.push_back(&(objectArray[i][j]));
108174 : }
108175 : }
108176 : }
108177 :
108178 : // Iterate over the saved list
108179 138 : size_t nodeListSize = nodeList.size();
108180 6964 : for (size_t i=0; i < nodeListSize; i++)
108181 : {
108182 6826 : ROSE_ASSERT(nodeList[i] != NULL);
108183 : #if 0
108184 : traversal.visit(nodeList[i]);
108185 : #else
108186 6826 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
108187 : {
108188 6826 : traversal.visit(nodeList[i]);
108189 : }
108190 : #endif
108191 : }
108192 : #endif
108193 : }
108194 :
108195 : // This should not be required since all previously static data members are
108196 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
108197 :
108198 5342 : }
108199 :
108200 :
108201 : void
108202 194 : SgThrowOp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
108203 : {
108204 : // This function traverses the memory pool for an IR node and
108205 : // calls the function to execute the visitor object.
108206 :
108207 : // Initialize array to the address of the first element of the STL vector
108208 : // (which is guarenteed to be contiguous storage).
108209 : // SgThrowOp objectArray [] = *(Memory_Block_List.begin());
108210 194 : if (SgThrowOp::pools.empty() == false)
108211 : {
108212 : // Generate an array of memory pools
108213 137 : SgThrowOp** objectArray = (SgThrowOp**) &(SgThrowOp::pools[0]);
108214 :
108215 : // Build a local variable for better performance
108216 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
108217 :
108218 : // Iterate over the memory pools
108219 274 : for (unsigned int i=0; i < SgThrowOp::pools.size(); i++)
108220 : {
108221 : // objectArray[i] is a single memory pool
108222 274137 : for (unsigned j=0; j < SgThrowOp::pool_size; j++)
108223 : {
108224 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
108225 : {
108226 : // printf ("Found a valid SgThrowOp object in the memory pool %d at position %d \n",i,j);
108227 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
108228 7574 : objectArray[i][j].executeVisitorMemberFunction(visitor);
108229 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
108230 : }
108231 : else
108232 : {
108233 : // printf ("Found a INVALID SgThrowOp object in the memory pool \n");
108234 : }
108235 : }
108236 : }
108237 : }
108238 :
108239 : // This should not be required since all previously static data members are
108240 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
108241 :
108242 194 : }
108243 :
108244 : void
108245 0 : SgThrowOp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
108246 : {
108247 : // This function visits only a single IR node of the memory pool.
108248 : // it is typically called once for each type of IR node within
108249 : // the automatically generated function: traverseRepresentativeNodes().
108250 :
108251 : // Initialize array to the address of the first element of the STL vector
108252 : // (which is guarenteed to be contiguous storage).
108253 : // SgThrowOp objectArray [] = *(Memory_Block_List.begin());
108254 0 : if (SgThrowOp::pools.empty() == false)
108255 : {
108256 : // Generate an array of memory pools
108257 0 : SgThrowOp** objectArray = (SgThrowOp**) &(SgThrowOp::pools[0]);
108258 :
108259 : // Build a local variable for better performance
108260 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
108261 :
108262 : // Iterate over the memory pools
108263 0 : bool done = false;
108264 0 : unsigned i=0;
108265 :
108266 : // find the first valid IR node, call visit function, and then leave
108267 0 : while ( done == false && i < SgThrowOp::pools.size() )
108268 : {
108269 : // objectArray[i] is a single memory pool
108270 : unsigned j=0;
108271 0 : while (done == false && j < SgThrowOp::pool_size)
108272 : {
108273 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
108274 : {
108275 0 : traversal.visit(&(objectArray[i][j]));
108276 0 : done = true;
108277 : }
108278 0 : j++;
108279 : }
108280 0 : i++;
108281 : }
108282 :
108283 : #if 0
108284 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
108285 : if (done == false)
108286 : {
108287 : printf ("No representative for SgThrowOp found in memory pools \n");
108288 : }
108289 : #endif
108290 : }
108291 0 : }
108292 :
108293 :
108294 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
108295 : // using values that overflow signed values of int.
108296 : size_t
108297 4 : SgThrowOp::numberOfNodes()
108298 : {
108299 : // This function traverses the memory pool for an IR node and
108300 : // counts the number of IR nodes of a particular Sage III IR
108301 : // nodes type.
108302 :
108303 4 : size_t count = 0;
108304 4 : if (SgThrowOp::pools.empty() == false)
108305 : {
108306 : // Generate an array of memory pools (this is actually a STL vector,
108307 : // but it is contiguious, so OK to treat this way).
108308 1 : SgThrowOp** objectArray = (SgThrowOp**) &(SgThrowOp::pools[0]);
108309 :
108310 : // Build a local variable for better performance (make it a loop invariant variable).
108311 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
108312 :
108313 : // Iterate over all of the memory pools for this IR node.
108314 2 : for (unsigned int i=0; i < SgThrowOp::pools.size(); i++)
108315 : {
108316 : // objectArray[i] is a single memory pool, iterate over all the
108317 : // IR nodes and only count those that are valid IR nodes used in
108318 : // the AST (i.e. allocated IR nodes).
108319 2001 : for (unsigned j=0; j < SgThrowOp::pool_size; j++)
108320 : {
108321 : // This is indexing the STL vector of C/C++ style arrays as a doubly
108322 : // indexed array access. It is OK since we have leveraged the semantics
108323 : // of STL vector memory as contigous and cast the memory as an array
108324 : // of arrays to use the 2D array indexing. Hope this is not confusing,
108325 : // but it s very fast as an implementation.
108326 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
108327 : {
108328 52 : count++;
108329 : }
108330 : }
108331 : }
108332 : }
108333 :
108334 :
108335 :
108336 4 : return count;
108337 : }
108338 :
108339 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
108340 : // using values that overflow signed values of int.
108341 : size_t
108342 0 : SgThrowOp::memoryUsage()
108343 : {
108344 : // This function is required because we need the class name as a type when we call sizeof
108345 : // There might be another way to implement this if we have a traversal that only called a
108346 : // representative object (one call for each type of Sage IIIIR node).
108347 0 : size_t memory = numberOfNodes() * sizeof(SgThrowOp);
108348 :
108349 0 : return memory;
108350 : }
108351 :
108352 : /* #line 108353 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
108353 :
108354 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
108355 : void
108356 5342 : SgRealPartOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
108357 : {
108358 : // This function traverses the memory pool for only a specific IR node
108359 : // and calls the visit function of the input class execute a traversal
108360 : // similar to the style of the attribute based traversals within ROSE.
108361 : // This traversal will visit ALL nodes of the AST where as the other
108362 : // attribute based traversals visit only the embedded tree within the AST.
108363 :
108364 : // Initialize array to the address of the first element of the STL vector
108365 : // (which is guaranteed to be contiguous storage).
108366 : // SgRealPartOp objectArray [] = *(Memory_Block_List.begin());
108367 5342 : if (SgRealPartOp::pools.empty() == false)
108368 : {
108369 : // Generate an array of memory pools
108370 0 : SgRealPartOp** objectArray = (SgRealPartOp**) &(SgRealPartOp::pools[0]);
108371 :
108372 : // Build a local variable for better performance
108373 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
108374 : #if 0
108375 : // Iterate over the memory pools
108376 : for (unsigned int i=0; i < SgRealPartOp::pools.size(); i++)
108377 : {
108378 : // objectArray[i] is a single memory pool
108379 : for (int j=0; j < SgRealPartOp::pool_size; j++)
108380 : {
108381 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
108382 : {
108383 : traversal.visit(&(objectArray[i][j]));
108384 : }
108385 : }
108386 : }
108387 : #else
108388 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
108389 : // compute the list first and then call the visit function on each list element.
108390 :
108391 : // printf ("Inside of SgRealPartOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
108392 :
108393 0 : std::vector<SgRealPartOp*> nodeList;
108394 :
108395 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
108396 0 : for (unsigned int i=0; i < SgRealPartOp::pools.size(); i++)
108397 : {
108398 : // objectArray[i] is a single memory pool
108399 0 : for (unsigned j=0; j < SgRealPartOp::pool_size; j++)
108400 : {
108401 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
108402 : {
108403 0 : nodeList.push_back(&(objectArray[i][j]));
108404 : }
108405 : }
108406 : }
108407 :
108408 : // Iterate over the saved list
108409 0 : size_t nodeListSize = nodeList.size();
108410 0 : for (size_t i=0; i < nodeListSize; i++)
108411 : {
108412 0 : ROSE_ASSERT(nodeList[i] != NULL);
108413 : #if 0
108414 : traversal.visit(nodeList[i]);
108415 : #else
108416 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
108417 : {
108418 0 : traversal.visit(nodeList[i]);
108419 : }
108420 : #endif
108421 : }
108422 : #endif
108423 : }
108424 :
108425 : // This should not be required since all previously static data members are
108426 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
108427 :
108428 5342 : }
108429 :
108430 :
108431 : void
108432 194 : SgRealPartOp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
108433 : {
108434 : // This function traverses the memory pool for an IR node and
108435 : // calls the function to execute the visitor object.
108436 :
108437 : // Initialize array to the address of the first element of the STL vector
108438 : // (which is guarenteed to be contiguous storage).
108439 : // SgRealPartOp objectArray [] = *(Memory_Block_List.begin());
108440 194 : if (SgRealPartOp::pools.empty() == false)
108441 : {
108442 : // Generate an array of memory pools
108443 0 : SgRealPartOp** objectArray = (SgRealPartOp**) &(SgRealPartOp::pools[0]);
108444 :
108445 : // Build a local variable for better performance
108446 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
108447 :
108448 : // Iterate over the memory pools
108449 0 : for (unsigned int i=0; i < SgRealPartOp::pools.size(); i++)
108450 : {
108451 : // objectArray[i] is a single memory pool
108452 0 : for (unsigned j=0; j < SgRealPartOp::pool_size; j++)
108453 : {
108454 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
108455 : {
108456 : // printf ("Found a valid SgRealPartOp object in the memory pool %d at position %d \n",i,j);
108457 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
108458 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
108459 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
108460 : }
108461 : else
108462 : {
108463 : // printf ("Found a INVALID SgRealPartOp object in the memory pool \n");
108464 : }
108465 : }
108466 : }
108467 : }
108468 :
108469 : // This should not be required since all previously static data members are
108470 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
108471 :
108472 194 : }
108473 :
108474 : void
108475 0 : SgRealPartOp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
108476 : {
108477 : // This function visits only a single IR node of the memory pool.
108478 : // it is typically called once for each type of IR node within
108479 : // the automatically generated function: traverseRepresentativeNodes().
108480 :
108481 : // Initialize array to the address of the first element of the STL vector
108482 : // (which is guarenteed to be contiguous storage).
108483 : // SgRealPartOp objectArray [] = *(Memory_Block_List.begin());
108484 0 : if (SgRealPartOp::pools.empty() == false)
108485 : {
108486 : // Generate an array of memory pools
108487 0 : SgRealPartOp** objectArray = (SgRealPartOp**) &(SgRealPartOp::pools[0]);
108488 :
108489 : // Build a local variable for better performance
108490 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
108491 :
108492 : // Iterate over the memory pools
108493 0 : bool done = false;
108494 0 : unsigned i=0;
108495 :
108496 : // find the first valid IR node, call visit function, and then leave
108497 0 : while ( done == false && i < SgRealPartOp::pools.size() )
108498 : {
108499 : // objectArray[i] is a single memory pool
108500 : unsigned j=0;
108501 0 : while (done == false && j < SgRealPartOp::pool_size)
108502 : {
108503 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
108504 : {
108505 0 : traversal.visit(&(objectArray[i][j]));
108506 0 : done = true;
108507 : }
108508 0 : j++;
108509 : }
108510 0 : i++;
108511 : }
108512 :
108513 : #if 0
108514 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
108515 : if (done == false)
108516 : {
108517 : printf ("No representative for SgRealPartOp found in memory pools \n");
108518 : }
108519 : #endif
108520 : }
108521 0 : }
108522 :
108523 :
108524 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
108525 : // using values that overflow signed values of int.
108526 : size_t
108527 4 : SgRealPartOp::numberOfNodes()
108528 : {
108529 : // This function traverses the memory pool for an IR node and
108530 : // counts the number of IR nodes of a particular Sage III IR
108531 : // nodes type.
108532 :
108533 4 : size_t count = 0;
108534 4 : if (SgRealPartOp::pools.empty() == false)
108535 : {
108536 : // Generate an array of memory pools (this is actually a STL vector,
108537 : // but it is contiguious, so OK to treat this way).
108538 0 : SgRealPartOp** objectArray = (SgRealPartOp**) &(SgRealPartOp::pools[0]);
108539 :
108540 : // Build a local variable for better performance (make it a loop invariant variable).
108541 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
108542 :
108543 : // Iterate over all of the memory pools for this IR node.
108544 0 : for (unsigned int i=0; i < SgRealPartOp::pools.size(); i++)
108545 : {
108546 : // objectArray[i] is a single memory pool, iterate over all the
108547 : // IR nodes and only count those that are valid IR nodes used in
108548 : // the AST (i.e. allocated IR nodes).
108549 0 : for (unsigned j=0; j < SgRealPartOp::pool_size; j++)
108550 : {
108551 : // This is indexing the STL vector of C/C++ style arrays as a doubly
108552 : // indexed array access. It is OK since we have leveraged the semantics
108553 : // of STL vector memory as contigous and cast the memory as an array
108554 : // of arrays to use the 2D array indexing. Hope this is not confusing,
108555 : // but it s very fast as an implementation.
108556 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
108557 : {
108558 0 : count++;
108559 : }
108560 : }
108561 : }
108562 : }
108563 :
108564 :
108565 :
108566 4 : return count;
108567 : }
108568 :
108569 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
108570 : // using values that overflow signed values of int.
108571 : size_t
108572 0 : SgRealPartOp::memoryUsage()
108573 : {
108574 : // This function is required because we need the class name as a type when we call sizeof
108575 : // There might be another way to implement this if we have a traversal that only called a
108576 : // representative object (one call for each type of Sage IIIIR node).
108577 0 : size_t memory = numberOfNodes() * sizeof(SgRealPartOp);
108578 :
108579 0 : return memory;
108580 : }
108581 :
108582 : /* #line 108583 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
108583 :
108584 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
108585 : void
108586 5342 : SgImagPartOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
108587 : {
108588 : // This function traverses the memory pool for only a specific IR node
108589 : // and calls the visit function of the input class execute a traversal
108590 : // similar to the style of the attribute based traversals within ROSE.
108591 : // This traversal will visit ALL nodes of the AST where as the other
108592 : // attribute based traversals visit only the embedded tree within the AST.
108593 :
108594 : // Initialize array to the address of the first element of the STL vector
108595 : // (which is guaranteed to be contiguous storage).
108596 : // SgImagPartOp objectArray [] = *(Memory_Block_List.begin());
108597 5342 : if (SgImagPartOp::pools.empty() == false)
108598 : {
108599 : // Generate an array of memory pools
108600 0 : SgImagPartOp** objectArray = (SgImagPartOp**) &(SgImagPartOp::pools[0]);
108601 :
108602 : // Build a local variable for better performance
108603 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
108604 : #if 0
108605 : // Iterate over the memory pools
108606 : for (unsigned int i=0; i < SgImagPartOp::pools.size(); i++)
108607 : {
108608 : // objectArray[i] is a single memory pool
108609 : for (int j=0; j < SgImagPartOp::pool_size; j++)
108610 : {
108611 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
108612 : {
108613 : traversal.visit(&(objectArray[i][j]));
108614 : }
108615 : }
108616 : }
108617 : #else
108618 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
108619 : // compute the list first and then call the visit function on each list element.
108620 :
108621 : // printf ("Inside of SgImagPartOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
108622 :
108623 0 : std::vector<SgImagPartOp*> nodeList;
108624 :
108625 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
108626 0 : for (unsigned int i=0; i < SgImagPartOp::pools.size(); i++)
108627 : {
108628 : // objectArray[i] is a single memory pool
108629 0 : for (unsigned j=0; j < SgImagPartOp::pool_size; j++)
108630 : {
108631 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
108632 : {
108633 0 : nodeList.push_back(&(objectArray[i][j]));
108634 : }
108635 : }
108636 : }
108637 :
108638 : // Iterate over the saved list
108639 0 : size_t nodeListSize = nodeList.size();
108640 0 : for (size_t i=0; i < nodeListSize; i++)
108641 : {
108642 0 : ROSE_ASSERT(nodeList[i] != NULL);
108643 : #if 0
108644 : traversal.visit(nodeList[i]);
108645 : #else
108646 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
108647 : {
108648 0 : traversal.visit(nodeList[i]);
108649 : }
108650 : #endif
108651 : }
108652 : #endif
108653 : }
108654 :
108655 : // This should not be required since all previously static data members are
108656 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
108657 :
108658 5342 : }
108659 :
108660 :
108661 : void
108662 194 : SgImagPartOp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
108663 : {
108664 : // This function traverses the memory pool for an IR node and
108665 : // calls the function to execute the visitor object.
108666 :
108667 : // Initialize array to the address of the first element of the STL vector
108668 : // (which is guarenteed to be contiguous storage).
108669 : // SgImagPartOp objectArray [] = *(Memory_Block_List.begin());
108670 194 : if (SgImagPartOp::pools.empty() == false)
108671 : {
108672 : // Generate an array of memory pools
108673 0 : SgImagPartOp** objectArray = (SgImagPartOp**) &(SgImagPartOp::pools[0]);
108674 :
108675 : // Build a local variable for better performance
108676 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
108677 :
108678 : // Iterate over the memory pools
108679 0 : for (unsigned int i=0; i < SgImagPartOp::pools.size(); i++)
108680 : {
108681 : // objectArray[i] is a single memory pool
108682 0 : for (unsigned j=0; j < SgImagPartOp::pool_size; j++)
108683 : {
108684 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
108685 : {
108686 : // printf ("Found a valid SgImagPartOp object in the memory pool %d at position %d \n",i,j);
108687 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
108688 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
108689 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
108690 : }
108691 : else
108692 : {
108693 : // printf ("Found a INVALID SgImagPartOp object in the memory pool \n");
108694 : }
108695 : }
108696 : }
108697 : }
108698 :
108699 : // This should not be required since all previously static data members are
108700 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
108701 :
108702 194 : }
108703 :
108704 : void
108705 0 : SgImagPartOp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
108706 : {
108707 : // This function visits only a single IR node of the memory pool.
108708 : // it is typically called once for each type of IR node within
108709 : // the automatically generated function: traverseRepresentativeNodes().
108710 :
108711 : // Initialize array to the address of the first element of the STL vector
108712 : // (which is guarenteed to be contiguous storage).
108713 : // SgImagPartOp objectArray [] = *(Memory_Block_List.begin());
108714 0 : if (SgImagPartOp::pools.empty() == false)
108715 : {
108716 : // Generate an array of memory pools
108717 0 : SgImagPartOp** objectArray = (SgImagPartOp**) &(SgImagPartOp::pools[0]);
108718 :
108719 : // Build a local variable for better performance
108720 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
108721 :
108722 : // Iterate over the memory pools
108723 0 : bool done = false;
108724 0 : unsigned i=0;
108725 :
108726 : // find the first valid IR node, call visit function, and then leave
108727 0 : while ( done == false && i < SgImagPartOp::pools.size() )
108728 : {
108729 : // objectArray[i] is a single memory pool
108730 : unsigned j=0;
108731 0 : while (done == false && j < SgImagPartOp::pool_size)
108732 : {
108733 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
108734 : {
108735 0 : traversal.visit(&(objectArray[i][j]));
108736 0 : done = true;
108737 : }
108738 0 : j++;
108739 : }
108740 0 : i++;
108741 : }
108742 :
108743 : #if 0
108744 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
108745 : if (done == false)
108746 : {
108747 : printf ("No representative for SgImagPartOp found in memory pools \n");
108748 : }
108749 : #endif
108750 : }
108751 0 : }
108752 :
108753 :
108754 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
108755 : // using values that overflow signed values of int.
108756 : size_t
108757 4 : SgImagPartOp::numberOfNodes()
108758 : {
108759 : // This function traverses the memory pool for an IR node and
108760 : // counts the number of IR nodes of a particular Sage III IR
108761 : // nodes type.
108762 :
108763 4 : size_t count = 0;
108764 4 : if (SgImagPartOp::pools.empty() == false)
108765 : {
108766 : // Generate an array of memory pools (this is actually a STL vector,
108767 : // but it is contiguious, so OK to treat this way).
108768 0 : SgImagPartOp** objectArray = (SgImagPartOp**) &(SgImagPartOp::pools[0]);
108769 :
108770 : // Build a local variable for better performance (make it a loop invariant variable).
108771 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
108772 :
108773 : // Iterate over all of the memory pools for this IR node.
108774 0 : for (unsigned int i=0; i < SgImagPartOp::pools.size(); i++)
108775 : {
108776 : // objectArray[i] is a single memory pool, iterate over all the
108777 : // IR nodes and only count those that are valid IR nodes used in
108778 : // the AST (i.e. allocated IR nodes).
108779 0 : for (unsigned j=0; j < SgImagPartOp::pool_size; j++)
108780 : {
108781 : // This is indexing the STL vector of C/C++ style arrays as a doubly
108782 : // indexed array access. It is OK since we have leveraged the semantics
108783 : // of STL vector memory as contigous and cast the memory as an array
108784 : // of arrays to use the 2D array indexing. Hope this is not confusing,
108785 : // but it s very fast as an implementation.
108786 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
108787 : {
108788 0 : count++;
108789 : }
108790 : }
108791 : }
108792 : }
108793 :
108794 :
108795 :
108796 4 : return count;
108797 : }
108798 :
108799 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
108800 : // using values that overflow signed values of int.
108801 : size_t
108802 0 : SgImagPartOp::memoryUsage()
108803 : {
108804 : // This function is required because we need the class name as a type when we call sizeof
108805 : // There might be another way to implement this if we have a traversal that only called a
108806 : // representative object (one call for each type of Sage IIIIR node).
108807 0 : size_t memory = numberOfNodes() * sizeof(SgImagPartOp);
108808 :
108809 0 : return memory;
108810 : }
108811 :
108812 : /* #line 108813 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
108813 :
108814 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
108815 : void
108816 5342 : SgConjugateOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
108817 : {
108818 : // This function traverses the memory pool for only a specific IR node
108819 : // and calls the visit function of the input class execute a traversal
108820 : // similar to the style of the attribute based traversals within ROSE.
108821 : // This traversal will visit ALL nodes of the AST where as the other
108822 : // attribute based traversals visit only the embedded tree within the AST.
108823 :
108824 : // Initialize array to the address of the first element of the STL vector
108825 : // (which is guaranteed to be contiguous storage).
108826 : // SgConjugateOp objectArray [] = *(Memory_Block_List.begin());
108827 5342 : if (SgConjugateOp::pools.empty() == false)
108828 : {
108829 : // Generate an array of memory pools
108830 0 : SgConjugateOp** objectArray = (SgConjugateOp**) &(SgConjugateOp::pools[0]);
108831 :
108832 : // Build a local variable for better performance
108833 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
108834 : #if 0
108835 : // Iterate over the memory pools
108836 : for (unsigned int i=0; i < SgConjugateOp::pools.size(); i++)
108837 : {
108838 : // objectArray[i] is a single memory pool
108839 : for (int j=0; j < SgConjugateOp::pool_size; j++)
108840 : {
108841 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
108842 : {
108843 : traversal.visit(&(objectArray[i][j]));
108844 : }
108845 : }
108846 : }
108847 : #else
108848 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
108849 : // compute the list first and then call the visit function on each list element.
108850 :
108851 : // printf ("Inside of SgConjugateOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
108852 :
108853 0 : std::vector<SgConjugateOp*> nodeList;
108854 :
108855 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
108856 0 : for (unsigned int i=0; i < SgConjugateOp::pools.size(); i++)
108857 : {
108858 : // objectArray[i] is a single memory pool
108859 0 : for (unsigned j=0; j < SgConjugateOp::pool_size; j++)
108860 : {
108861 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
108862 : {
108863 0 : nodeList.push_back(&(objectArray[i][j]));
108864 : }
108865 : }
108866 : }
108867 :
108868 : // Iterate over the saved list
108869 0 : size_t nodeListSize = nodeList.size();
108870 0 : for (size_t i=0; i < nodeListSize; i++)
108871 : {
108872 0 : ROSE_ASSERT(nodeList[i] != NULL);
108873 : #if 0
108874 : traversal.visit(nodeList[i]);
108875 : #else
108876 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
108877 : {
108878 0 : traversal.visit(nodeList[i]);
108879 : }
108880 : #endif
108881 : }
108882 : #endif
108883 : }
108884 :
108885 : // This should not be required since all previously static data members are
108886 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
108887 :
108888 5342 : }
108889 :
108890 :
108891 : void
108892 194 : SgConjugateOp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
108893 : {
108894 : // This function traverses the memory pool for an IR node and
108895 : // calls the function to execute the visitor object.
108896 :
108897 : // Initialize array to the address of the first element of the STL vector
108898 : // (which is guarenteed to be contiguous storage).
108899 : // SgConjugateOp objectArray [] = *(Memory_Block_List.begin());
108900 194 : if (SgConjugateOp::pools.empty() == false)
108901 : {
108902 : // Generate an array of memory pools
108903 0 : SgConjugateOp** objectArray = (SgConjugateOp**) &(SgConjugateOp::pools[0]);
108904 :
108905 : // Build a local variable for better performance
108906 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
108907 :
108908 : // Iterate over the memory pools
108909 0 : for (unsigned int i=0; i < SgConjugateOp::pools.size(); i++)
108910 : {
108911 : // objectArray[i] is a single memory pool
108912 0 : for (unsigned j=0; j < SgConjugateOp::pool_size; j++)
108913 : {
108914 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
108915 : {
108916 : // printf ("Found a valid SgConjugateOp object in the memory pool %d at position %d \n",i,j);
108917 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
108918 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
108919 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
108920 : }
108921 : else
108922 : {
108923 : // printf ("Found a INVALID SgConjugateOp object in the memory pool \n");
108924 : }
108925 : }
108926 : }
108927 : }
108928 :
108929 : // This should not be required since all previously static data members are
108930 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
108931 :
108932 194 : }
108933 :
108934 : void
108935 0 : SgConjugateOp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
108936 : {
108937 : // This function visits only a single IR node of the memory pool.
108938 : // it is typically called once for each type of IR node within
108939 : // the automatically generated function: traverseRepresentativeNodes().
108940 :
108941 : // Initialize array to the address of the first element of the STL vector
108942 : // (which is guarenteed to be contiguous storage).
108943 : // SgConjugateOp objectArray [] = *(Memory_Block_List.begin());
108944 0 : if (SgConjugateOp::pools.empty() == false)
108945 : {
108946 : // Generate an array of memory pools
108947 0 : SgConjugateOp** objectArray = (SgConjugateOp**) &(SgConjugateOp::pools[0]);
108948 :
108949 : // Build a local variable for better performance
108950 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
108951 :
108952 : // Iterate over the memory pools
108953 0 : bool done = false;
108954 0 : unsigned i=0;
108955 :
108956 : // find the first valid IR node, call visit function, and then leave
108957 0 : while ( done == false && i < SgConjugateOp::pools.size() )
108958 : {
108959 : // objectArray[i] is a single memory pool
108960 : unsigned j=0;
108961 0 : while (done == false && j < SgConjugateOp::pool_size)
108962 : {
108963 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
108964 : {
108965 0 : traversal.visit(&(objectArray[i][j]));
108966 0 : done = true;
108967 : }
108968 0 : j++;
108969 : }
108970 0 : i++;
108971 : }
108972 :
108973 : #if 0
108974 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
108975 : if (done == false)
108976 : {
108977 : printf ("No representative for SgConjugateOp found in memory pools \n");
108978 : }
108979 : #endif
108980 : }
108981 0 : }
108982 :
108983 :
108984 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
108985 : // using values that overflow signed values of int.
108986 : size_t
108987 4 : SgConjugateOp::numberOfNodes()
108988 : {
108989 : // This function traverses the memory pool for an IR node and
108990 : // counts the number of IR nodes of a particular Sage III IR
108991 : // nodes type.
108992 :
108993 4 : size_t count = 0;
108994 4 : if (SgConjugateOp::pools.empty() == false)
108995 : {
108996 : // Generate an array of memory pools (this is actually a STL vector,
108997 : // but it is contiguious, so OK to treat this way).
108998 0 : SgConjugateOp** objectArray = (SgConjugateOp**) &(SgConjugateOp::pools[0]);
108999 :
109000 : // Build a local variable for better performance (make it a loop invariant variable).
109001 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
109002 :
109003 : // Iterate over all of the memory pools for this IR node.
109004 0 : for (unsigned int i=0; i < SgConjugateOp::pools.size(); i++)
109005 : {
109006 : // objectArray[i] is a single memory pool, iterate over all the
109007 : // IR nodes and only count those that are valid IR nodes used in
109008 : // the AST (i.e. allocated IR nodes).
109009 0 : for (unsigned j=0; j < SgConjugateOp::pool_size; j++)
109010 : {
109011 : // This is indexing the STL vector of C/C++ style arrays as a doubly
109012 : // indexed array access. It is OK since we have leveraged the semantics
109013 : // of STL vector memory as contigous and cast the memory as an array
109014 : // of arrays to use the 2D array indexing. Hope this is not confusing,
109015 : // but it s very fast as an implementation.
109016 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
109017 : {
109018 0 : count++;
109019 : }
109020 : }
109021 : }
109022 : }
109023 :
109024 :
109025 :
109026 4 : return count;
109027 : }
109028 :
109029 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
109030 : // using values that overflow signed values of int.
109031 : size_t
109032 0 : SgConjugateOp::memoryUsage()
109033 : {
109034 : // This function is required because we need the class name as a type when we call sizeof
109035 : // There might be another way to implement this if we have a traversal that only called a
109036 : // representative object (one call for each type of Sage IIIIR node).
109037 0 : size_t memory = numberOfNodes() * sizeof(SgConjugateOp);
109038 :
109039 0 : return memory;
109040 : }
109041 :
109042 : /* #line 109043 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
109043 :
109044 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
109045 : void
109046 5342 : SgUserDefinedUnaryOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
109047 : {
109048 : // This function traverses the memory pool for only a specific IR node
109049 : // and calls the visit function of the input class execute a traversal
109050 : // similar to the style of the attribute based traversals within ROSE.
109051 : // This traversal will visit ALL nodes of the AST where as the other
109052 : // attribute based traversals visit only the embedded tree within the AST.
109053 :
109054 : // Initialize array to the address of the first element of the STL vector
109055 : // (which is guaranteed to be contiguous storage).
109056 : // SgUserDefinedUnaryOp objectArray [] = *(Memory_Block_List.begin());
109057 5342 : if (SgUserDefinedUnaryOp::pools.empty() == false)
109058 : {
109059 : // Generate an array of memory pools
109060 0 : SgUserDefinedUnaryOp** objectArray = (SgUserDefinedUnaryOp**) &(SgUserDefinedUnaryOp::pools[0]);
109061 :
109062 : // Build a local variable for better performance
109063 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
109064 : #if 0
109065 : // Iterate over the memory pools
109066 : for (unsigned int i=0; i < SgUserDefinedUnaryOp::pools.size(); i++)
109067 : {
109068 : // objectArray[i] is a single memory pool
109069 : for (int j=0; j < SgUserDefinedUnaryOp::pool_size; j++)
109070 : {
109071 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
109072 : {
109073 : traversal.visit(&(objectArray[i][j]));
109074 : }
109075 : }
109076 : }
109077 : #else
109078 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
109079 : // compute the list first and then call the visit function on each list element.
109080 :
109081 : // printf ("Inside of SgUserDefinedUnaryOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
109082 :
109083 0 : std::vector<SgUserDefinedUnaryOp*> nodeList;
109084 :
109085 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
109086 0 : for (unsigned int i=0; i < SgUserDefinedUnaryOp::pools.size(); i++)
109087 : {
109088 : // objectArray[i] is a single memory pool
109089 0 : for (unsigned j=0; j < SgUserDefinedUnaryOp::pool_size; j++)
109090 : {
109091 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
109092 : {
109093 0 : nodeList.push_back(&(objectArray[i][j]));
109094 : }
109095 : }
109096 : }
109097 :
109098 : // Iterate over the saved list
109099 0 : size_t nodeListSize = nodeList.size();
109100 0 : for (size_t i=0; i < nodeListSize; i++)
109101 : {
109102 0 : ROSE_ASSERT(nodeList[i] != NULL);
109103 : #if 0
109104 : traversal.visit(nodeList[i]);
109105 : #else
109106 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
109107 : {
109108 0 : traversal.visit(nodeList[i]);
109109 : }
109110 : #endif
109111 : }
109112 : #endif
109113 : }
109114 :
109115 : // This should not be required since all previously static data members are
109116 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
109117 :
109118 5342 : }
109119 :
109120 :
109121 : void
109122 194 : SgUserDefinedUnaryOp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
109123 : {
109124 : // This function traverses the memory pool for an IR node and
109125 : // calls the function to execute the visitor object.
109126 :
109127 : // Initialize array to the address of the first element of the STL vector
109128 : // (which is guarenteed to be contiguous storage).
109129 : // SgUserDefinedUnaryOp objectArray [] = *(Memory_Block_List.begin());
109130 194 : if (SgUserDefinedUnaryOp::pools.empty() == false)
109131 : {
109132 : // Generate an array of memory pools
109133 0 : SgUserDefinedUnaryOp** objectArray = (SgUserDefinedUnaryOp**) &(SgUserDefinedUnaryOp::pools[0]);
109134 :
109135 : // Build a local variable for better performance
109136 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
109137 :
109138 : // Iterate over the memory pools
109139 0 : for (unsigned int i=0; i < SgUserDefinedUnaryOp::pools.size(); i++)
109140 : {
109141 : // objectArray[i] is a single memory pool
109142 0 : for (unsigned j=0; j < SgUserDefinedUnaryOp::pool_size; j++)
109143 : {
109144 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
109145 : {
109146 : // printf ("Found a valid SgUserDefinedUnaryOp object in the memory pool %d at position %d \n",i,j);
109147 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
109148 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
109149 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
109150 : }
109151 : else
109152 : {
109153 : // printf ("Found a INVALID SgUserDefinedUnaryOp object in the memory pool \n");
109154 : }
109155 : }
109156 : }
109157 : }
109158 :
109159 : // This should not be required since all previously static data members are
109160 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
109161 :
109162 194 : }
109163 :
109164 : void
109165 0 : SgUserDefinedUnaryOp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
109166 : {
109167 : // This function visits only a single IR node of the memory pool.
109168 : // it is typically called once for each type of IR node within
109169 : // the automatically generated function: traverseRepresentativeNodes().
109170 :
109171 : // Initialize array to the address of the first element of the STL vector
109172 : // (which is guarenteed to be contiguous storage).
109173 : // SgUserDefinedUnaryOp objectArray [] = *(Memory_Block_List.begin());
109174 0 : if (SgUserDefinedUnaryOp::pools.empty() == false)
109175 : {
109176 : // Generate an array of memory pools
109177 0 : SgUserDefinedUnaryOp** objectArray = (SgUserDefinedUnaryOp**) &(SgUserDefinedUnaryOp::pools[0]);
109178 :
109179 : // Build a local variable for better performance
109180 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
109181 :
109182 : // Iterate over the memory pools
109183 0 : bool done = false;
109184 0 : unsigned i=0;
109185 :
109186 : // find the first valid IR node, call visit function, and then leave
109187 0 : while ( done == false && i < SgUserDefinedUnaryOp::pools.size() )
109188 : {
109189 : // objectArray[i] is a single memory pool
109190 : unsigned j=0;
109191 0 : while (done == false && j < SgUserDefinedUnaryOp::pool_size)
109192 : {
109193 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
109194 : {
109195 0 : traversal.visit(&(objectArray[i][j]));
109196 0 : done = true;
109197 : }
109198 0 : j++;
109199 : }
109200 0 : i++;
109201 : }
109202 :
109203 : #if 0
109204 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
109205 : if (done == false)
109206 : {
109207 : printf ("No representative for SgUserDefinedUnaryOp found in memory pools \n");
109208 : }
109209 : #endif
109210 : }
109211 0 : }
109212 :
109213 :
109214 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
109215 : // using values that overflow signed values of int.
109216 : size_t
109217 4 : SgUserDefinedUnaryOp::numberOfNodes()
109218 : {
109219 : // This function traverses the memory pool for an IR node and
109220 : // counts the number of IR nodes of a particular Sage III IR
109221 : // nodes type.
109222 :
109223 4 : size_t count = 0;
109224 4 : if (SgUserDefinedUnaryOp::pools.empty() == false)
109225 : {
109226 : // Generate an array of memory pools (this is actually a STL vector,
109227 : // but it is contiguious, so OK to treat this way).
109228 0 : SgUserDefinedUnaryOp** objectArray = (SgUserDefinedUnaryOp**) &(SgUserDefinedUnaryOp::pools[0]);
109229 :
109230 : // Build a local variable for better performance (make it a loop invariant variable).
109231 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
109232 :
109233 : // Iterate over all of the memory pools for this IR node.
109234 0 : for (unsigned int i=0; i < SgUserDefinedUnaryOp::pools.size(); i++)
109235 : {
109236 : // objectArray[i] is a single memory pool, iterate over all the
109237 : // IR nodes and only count those that are valid IR nodes used in
109238 : // the AST (i.e. allocated IR nodes).
109239 0 : for (unsigned j=0; j < SgUserDefinedUnaryOp::pool_size; j++)
109240 : {
109241 : // This is indexing the STL vector of C/C++ style arrays as a doubly
109242 : // indexed array access. It is OK since we have leveraged the semantics
109243 : // of STL vector memory as contigous and cast the memory as an array
109244 : // of arrays to use the 2D array indexing. Hope this is not confusing,
109245 : // but it s very fast as an implementation.
109246 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
109247 : {
109248 0 : count++;
109249 : }
109250 : }
109251 : }
109252 : }
109253 :
109254 :
109255 :
109256 4 : return count;
109257 : }
109258 :
109259 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
109260 : // using values that overflow signed values of int.
109261 : size_t
109262 0 : SgUserDefinedUnaryOp::memoryUsage()
109263 : {
109264 : // This function is required because we need the class name as a type when we call sizeof
109265 : // There might be another way to implement this if we have a traversal that only called a
109266 : // representative object (one call for each type of Sage IIIIR node).
109267 0 : size_t memory = numberOfNodes() * sizeof(SgUserDefinedUnaryOp);
109268 :
109269 0 : return memory;
109270 : }
109271 :
109272 : /* #line 109273 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
109273 :
109274 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
109275 : void
109276 5342 : SgMatrixTransposeOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
109277 : {
109278 : // This function traverses the memory pool for only a specific IR node
109279 : // and calls the visit function of the input class execute a traversal
109280 : // similar to the style of the attribute based traversals within ROSE.
109281 : // This traversal will visit ALL nodes of the AST where as the other
109282 : // attribute based traversals visit only the embedded tree within the AST.
109283 :
109284 : // Initialize array to the address of the first element of the STL vector
109285 : // (which is guaranteed to be contiguous storage).
109286 : // SgMatrixTransposeOp objectArray [] = *(Memory_Block_List.begin());
109287 5342 : if (SgMatrixTransposeOp::pools.empty() == false)
109288 : {
109289 : // Generate an array of memory pools
109290 0 : SgMatrixTransposeOp** objectArray = (SgMatrixTransposeOp**) &(SgMatrixTransposeOp::pools[0]);
109291 :
109292 : // Build a local variable for better performance
109293 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
109294 : #if 0
109295 : // Iterate over the memory pools
109296 : for (unsigned int i=0; i < SgMatrixTransposeOp::pools.size(); i++)
109297 : {
109298 : // objectArray[i] is a single memory pool
109299 : for (int j=0; j < SgMatrixTransposeOp::pool_size; j++)
109300 : {
109301 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
109302 : {
109303 : traversal.visit(&(objectArray[i][j]));
109304 : }
109305 : }
109306 : }
109307 : #else
109308 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
109309 : // compute the list first and then call the visit function on each list element.
109310 :
109311 : // printf ("Inside of SgMatrixTransposeOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
109312 :
109313 0 : std::vector<SgMatrixTransposeOp*> nodeList;
109314 :
109315 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
109316 0 : for (unsigned int i=0; i < SgMatrixTransposeOp::pools.size(); i++)
109317 : {
109318 : // objectArray[i] is a single memory pool
109319 0 : for (unsigned j=0; j < SgMatrixTransposeOp::pool_size; j++)
109320 : {
109321 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
109322 : {
109323 0 : nodeList.push_back(&(objectArray[i][j]));
109324 : }
109325 : }
109326 : }
109327 :
109328 : // Iterate over the saved list
109329 0 : size_t nodeListSize = nodeList.size();
109330 0 : for (size_t i=0; i < nodeListSize; i++)
109331 : {
109332 0 : ROSE_ASSERT(nodeList[i] != NULL);
109333 : #if 0
109334 : traversal.visit(nodeList[i]);
109335 : #else
109336 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
109337 : {
109338 0 : traversal.visit(nodeList[i]);
109339 : }
109340 : #endif
109341 : }
109342 : #endif
109343 : }
109344 :
109345 : // This should not be required since all previously static data members are
109346 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
109347 :
109348 5342 : }
109349 :
109350 :
109351 : void
109352 194 : SgMatrixTransposeOp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
109353 : {
109354 : // This function traverses the memory pool for an IR node and
109355 : // calls the function to execute the visitor object.
109356 :
109357 : // Initialize array to the address of the first element of the STL vector
109358 : // (which is guarenteed to be contiguous storage).
109359 : // SgMatrixTransposeOp objectArray [] = *(Memory_Block_List.begin());
109360 194 : if (SgMatrixTransposeOp::pools.empty() == false)
109361 : {
109362 : // Generate an array of memory pools
109363 0 : SgMatrixTransposeOp** objectArray = (SgMatrixTransposeOp**) &(SgMatrixTransposeOp::pools[0]);
109364 :
109365 : // Build a local variable for better performance
109366 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
109367 :
109368 : // Iterate over the memory pools
109369 0 : for (unsigned int i=0; i < SgMatrixTransposeOp::pools.size(); i++)
109370 : {
109371 : // objectArray[i] is a single memory pool
109372 0 : for (unsigned j=0; j < SgMatrixTransposeOp::pool_size; j++)
109373 : {
109374 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
109375 : {
109376 : // printf ("Found a valid SgMatrixTransposeOp object in the memory pool %d at position %d \n",i,j);
109377 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
109378 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
109379 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
109380 : }
109381 : else
109382 : {
109383 : // printf ("Found a INVALID SgMatrixTransposeOp object in the memory pool \n");
109384 : }
109385 : }
109386 : }
109387 : }
109388 :
109389 : // This should not be required since all previously static data members are
109390 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
109391 :
109392 194 : }
109393 :
109394 : void
109395 0 : SgMatrixTransposeOp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
109396 : {
109397 : // This function visits only a single IR node of the memory pool.
109398 : // it is typically called once for each type of IR node within
109399 : // the automatically generated function: traverseRepresentativeNodes().
109400 :
109401 : // Initialize array to the address of the first element of the STL vector
109402 : // (which is guarenteed to be contiguous storage).
109403 : // SgMatrixTransposeOp objectArray [] = *(Memory_Block_List.begin());
109404 0 : if (SgMatrixTransposeOp::pools.empty() == false)
109405 : {
109406 : // Generate an array of memory pools
109407 0 : SgMatrixTransposeOp** objectArray = (SgMatrixTransposeOp**) &(SgMatrixTransposeOp::pools[0]);
109408 :
109409 : // Build a local variable for better performance
109410 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
109411 :
109412 : // Iterate over the memory pools
109413 0 : bool done = false;
109414 0 : unsigned i=0;
109415 :
109416 : // find the first valid IR node, call visit function, and then leave
109417 0 : while ( done == false && i < SgMatrixTransposeOp::pools.size() )
109418 : {
109419 : // objectArray[i] is a single memory pool
109420 : unsigned j=0;
109421 0 : while (done == false && j < SgMatrixTransposeOp::pool_size)
109422 : {
109423 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
109424 : {
109425 0 : traversal.visit(&(objectArray[i][j]));
109426 0 : done = true;
109427 : }
109428 0 : j++;
109429 : }
109430 0 : i++;
109431 : }
109432 :
109433 : #if 0
109434 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
109435 : if (done == false)
109436 : {
109437 : printf ("No representative for SgMatrixTransposeOp found in memory pools \n");
109438 : }
109439 : #endif
109440 : }
109441 0 : }
109442 :
109443 :
109444 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
109445 : // using values that overflow signed values of int.
109446 : size_t
109447 4 : SgMatrixTransposeOp::numberOfNodes()
109448 : {
109449 : // This function traverses the memory pool for an IR node and
109450 : // counts the number of IR nodes of a particular Sage III IR
109451 : // nodes type.
109452 :
109453 4 : size_t count = 0;
109454 4 : if (SgMatrixTransposeOp::pools.empty() == false)
109455 : {
109456 : // Generate an array of memory pools (this is actually a STL vector,
109457 : // but it is contiguious, so OK to treat this way).
109458 0 : SgMatrixTransposeOp** objectArray = (SgMatrixTransposeOp**) &(SgMatrixTransposeOp::pools[0]);
109459 :
109460 : // Build a local variable for better performance (make it a loop invariant variable).
109461 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
109462 :
109463 : // Iterate over all of the memory pools for this IR node.
109464 0 : for (unsigned int i=0; i < SgMatrixTransposeOp::pools.size(); i++)
109465 : {
109466 : // objectArray[i] is a single memory pool, iterate over all the
109467 : // IR nodes and only count those that are valid IR nodes used in
109468 : // the AST (i.e. allocated IR nodes).
109469 0 : for (unsigned j=0; j < SgMatrixTransposeOp::pool_size; j++)
109470 : {
109471 : // This is indexing the STL vector of C/C++ style arrays as a doubly
109472 : // indexed array access. It is OK since we have leveraged the semantics
109473 : // of STL vector memory as contigous and cast the memory as an array
109474 : // of arrays to use the 2D array indexing. Hope this is not confusing,
109475 : // but it s very fast as an implementation.
109476 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
109477 : {
109478 0 : count++;
109479 : }
109480 : }
109481 : }
109482 : }
109483 :
109484 :
109485 :
109486 4 : return count;
109487 : }
109488 :
109489 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
109490 : // using values that overflow signed values of int.
109491 : size_t
109492 0 : SgMatrixTransposeOp::memoryUsage()
109493 : {
109494 : // This function is required because we need the class name as a type when we call sizeof
109495 : // There might be another way to implement this if we have a traversal that only called a
109496 : // representative object (one call for each type of Sage IIIIR node).
109497 0 : size_t memory = numberOfNodes() * sizeof(SgMatrixTransposeOp);
109498 :
109499 0 : return memory;
109500 : }
109501 :
109502 : /* #line 109503 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
109503 :
109504 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
109505 : void
109506 5342 : SgBinaryOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
109507 : {
109508 : // This function traverses the memory pool for only a specific IR node
109509 : // and calls the visit function of the input class execute a traversal
109510 : // similar to the style of the attribute based traversals within ROSE.
109511 : // This traversal will visit ALL nodes of the AST where as the other
109512 : // attribute based traversals visit only the embedded tree within the AST.
109513 :
109514 : // Initialize array to the address of the first element of the STL vector
109515 : // (which is guaranteed to be contiguous storage).
109516 : // SgBinaryOp objectArray [] = *(Memory_Block_List.begin());
109517 5342 : if (SgBinaryOp::pools.empty() == false)
109518 : {
109519 : // Generate an array of memory pools
109520 0 : SgBinaryOp** objectArray = (SgBinaryOp**) &(SgBinaryOp::pools[0]);
109521 :
109522 : // Build a local variable for better performance
109523 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
109524 : #if 0
109525 : // Iterate over the memory pools
109526 : for (unsigned int i=0; i < SgBinaryOp::pools.size(); i++)
109527 : {
109528 : // objectArray[i] is a single memory pool
109529 : for (int j=0; j < SgBinaryOp::pool_size; j++)
109530 : {
109531 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
109532 : {
109533 : traversal.visit(&(objectArray[i][j]));
109534 : }
109535 : }
109536 : }
109537 : #else
109538 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
109539 : // compute the list first and then call the visit function on each list element.
109540 :
109541 : // printf ("Inside of SgBinaryOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
109542 :
109543 0 : std::vector<SgBinaryOp*> nodeList;
109544 :
109545 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
109546 0 : for (unsigned int i=0; i < SgBinaryOp::pools.size(); i++)
109547 : {
109548 : // objectArray[i] is a single memory pool
109549 0 : for (unsigned j=0; j < SgBinaryOp::pool_size; j++)
109550 : {
109551 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
109552 : {
109553 0 : nodeList.push_back(&(objectArray[i][j]));
109554 : }
109555 : }
109556 : }
109557 :
109558 : // Iterate over the saved list
109559 0 : size_t nodeListSize = nodeList.size();
109560 0 : for (size_t i=0; i < nodeListSize; i++)
109561 : {
109562 0 : ROSE_ASSERT(nodeList[i] != NULL);
109563 : #if 0
109564 : traversal.visit(nodeList[i]);
109565 : #else
109566 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
109567 : {
109568 0 : traversal.visit(nodeList[i]);
109569 : }
109570 : #endif
109571 : }
109572 : #endif
109573 : }
109574 :
109575 : // This should not be required since all previously static data members are
109576 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
109577 :
109578 5342 : }
109579 :
109580 :
109581 : void
109582 194 : SgBinaryOp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
109583 : {
109584 : // This function traverses the memory pool for an IR node and
109585 : // calls the function to execute the visitor object.
109586 :
109587 : // Initialize array to the address of the first element of the STL vector
109588 : // (which is guarenteed to be contiguous storage).
109589 : // SgBinaryOp objectArray [] = *(Memory_Block_List.begin());
109590 194 : if (SgBinaryOp::pools.empty() == false)
109591 : {
109592 : // Generate an array of memory pools
109593 0 : SgBinaryOp** objectArray = (SgBinaryOp**) &(SgBinaryOp::pools[0]);
109594 :
109595 : // Build a local variable for better performance
109596 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
109597 :
109598 : // Iterate over the memory pools
109599 0 : for (unsigned int i=0; i < SgBinaryOp::pools.size(); i++)
109600 : {
109601 : // objectArray[i] is a single memory pool
109602 0 : for (unsigned j=0; j < SgBinaryOp::pool_size; j++)
109603 : {
109604 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
109605 : {
109606 : // printf ("Found a valid SgBinaryOp object in the memory pool %d at position %d \n",i,j);
109607 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
109608 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
109609 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
109610 : }
109611 : else
109612 : {
109613 : // printf ("Found a INVALID SgBinaryOp object in the memory pool \n");
109614 : }
109615 : }
109616 : }
109617 : }
109618 :
109619 : // This should not be required since all previously static data members are
109620 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
109621 :
109622 194 : }
109623 :
109624 : void
109625 0 : SgBinaryOp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
109626 : {
109627 : // This function visits only a single IR node of the memory pool.
109628 : // it is typically called once for each type of IR node within
109629 : // the automatically generated function: traverseRepresentativeNodes().
109630 :
109631 : // Initialize array to the address of the first element of the STL vector
109632 : // (which is guarenteed to be contiguous storage).
109633 : // SgBinaryOp objectArray [] = *(Memory_Block_List.begin());
109634 0 : if (SgBinaryOp::pools.empty() == false)
109635 : {
109636 : // Generate an array of memory pools
109637 0 : SgBinaryOp** objectArray = (SgBinaryOp**) &(SgBinaryOp::pools[0]);
109638 :
109639 : // Build a local variable for better performance
109640 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
109641 :
109642 : // Iterate over the memory pools
109643 0 : bool done = false;
109644 0 : unsigned i=0;
109645 :
109646 : // find the first valid IR node, call visit function, and then leave
109647 0 : while ( done == false && i < SgBinaryOp::pools.size() )
109648 : {
109649 : // objectArray[i] is a single memory pool
109650 : unsigned j=0;
109651 0 : while (done == false && j < SgBinaryOp::pool_size)
109652 : {
109653 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
109654 : {
109655 0 : traversal.visit(&(objectArray[i][j]));
109656 0 : done = true;
109657 : }
109658 0 : j++;
109659 : }
109660 0 : i++;
109661 : }
109662 :
109663 : #if 0
109664 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
109665 : if (done == false)
109666 : {
109667 : printf ("No representative for SgBinaryOp found in memory pools \n");
109668 : }
109669 : #endif
109670 : }
109671 0 : }
109672 :
109673 :
109674 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
109675 : // using values that overflow signed values of int.
109676 : size_t
109677 4 : SgBinaryOp::numberOfNodes()
109678 : {
109679 : // This function traverses the memory pool for an IR node and
109680 : // counts the number of IR nodes of a particular Sage III IR
109681 : // nodes type.
109682 :
109683 4 : size_t count = 0;
109684 4 : if (SgBinaryOp::pools.empty() == false)
109685 : {
109686 : // Generate an array of memory pools (this is actually a STL vector,
109687 : // but it is contiguious, so OK to treat this way).
109688 0 : SgBinaryOp** objectArray = (SgBinaryOp**) &(SgBinaryOp::pools[0]);
109689 :
109690 : // Build a local variable for better performance (make it a loop invariant variable).
109691 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
109692 :
109693 : // Iterate over all of the memory pools for this IR node.
109694 0 : for (unsigned int i=0; i < SgBinaryOp::pools.size(); i++)
109695 : {
109696 : // objectArray[i] is a single memory pool, iterate over all the
109697 : // IR nodes and only count those that are valid IR nodes used in
109698 : // the AST (i.e. allocated IR nodes).
109699 0 : for (unsigned j=0; j < SgBinaryOp::pool_size; j++)
109700 : {
109701 : // This is indexing the STL vector of C/C++ style arrays as a doubly
109702 : // indexed array access. It is OK since we have leveraged the semantics
109703 : // of STL vector memory as contigous and cast the memory as an array
109704 : // of arrays to use the 2D array indexing. Hope this is not confusing,
109705 : // but it s very fast as an implementation.
109706 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
109707 : {
109708 0 : count++;
109709 : }
109710 : }
109711 : }
109712 : }
109713 :
109714 :
109715 :
109716 4 : return count;
109717 : }
109718 :
109719 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
109720 : // using values that overflow signed values of int.
109721 : size_t
109722 0 : SgBinaryOp::memoryUsage()
109723 : {
109724 : // This function is required because we need the class name as a type when we call sizeof
109725 : // There might be another way to implement this if we have a traversal that only called a
109726 : // representative object (one call for each type of Sage IIIIR node).
109727 0 : size_t memory = numberOfNodes() * sizeof(SgBinaryOp);
109728 :
109729 0 : return memory;
109730 : }
109731 :
109732 : /* #line 109733 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
109733 :
109734 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
109735 : void
109736 5342 : SgArrowExp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
109737 : {
109738 : // This function traverses the memory pool for only a specific IR node
109739 : // and calls the visit function of the input class execute a traversal
109740 : // similar to the style of the attribute based traversals within ROSE.
109741 : // This traversal will visit ALL nodes of the AST where as the other
109742 : // attribute based traversals visit only the embedded tree within the AST.
109743 :
109744 : // Initialize array to the address of the first element of the STL vector
109745 : // (which is guaranteed to be contiguous storage).
109746 : // SgArrowExp objectArray [] = *(Memory_Block_List.begin());
109747 5342 : if (SgArrowExp::pools.empty() == false)
109748 : {
109749 : // Generate an array of memory pools
109750 190 : SgArrowExp** objectArray = (SgArrowExp**) &(SgArrowExp::pools[0]);
109751 :
109752 : // Build a local variable for better performance
109753 190 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
109754 : #if 0
109755 : // Iterate over the memory pools
109756 : for (unsigned int i=0; i < SgArrowExp::pools.size(); i++)
109757 : {
109758 : // objectArray[i] is a single memory pool
109759 : for (int j=0; j < SgArrowExp::pool_size; j++)
109760 : {
109761 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
109762 : {
109763 : traversal.visit(&(objectArray[i][j]));
109764 : }
109765 : }
109766 : }
109767 : #else
109768 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
109769 : // compute the list first and then call the visit function on each list element.
109770 :
109771 : // printf ("Inside of SgArrowExp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
109772 :
109773 380 : std::vector<SgArrowExp*> nodeList;
109774 :
109775 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
109776 381 : for (unsigned int i=0; i < SgArrowExp::pools.size(); i++)
109777 : {
109778 : // objectArray[i] is a single memory pool
109779 382191 : for (unsigned j=0; j < SgArrowExp::pool_size; j++)
109780 : {
109781 382000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
109782 : {
109783 163089 : nodeList.push_back(&(objectArray[i][j]));
109784 : }
109785 : }
109786 : }
109787 :
109788 : // Iterate over the saved list
109789 190 : size_t nodeListSize = nodeList.size();
109790 163279 : for (size_t i=0; i < nodeListSize; i++)
109791 : {
109792 163089 : ROSE_ASSERT(nodeList[i] != NULL);
109793 : #if 0
109794 : traversal.visit(nodeList[i]);
109795 : #else
109796 163089 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
109797 : {
109798 163089 : traversal.visit(nodeList[i]);
109799 : }
109800 : #endif
109801 : }
109802 : #endif
109803 : }
109804 :
109805 : // This should not be required since all previously static data members are
109806 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
109807 :
109808 5342 : }
109809 :
109810 :
109811 : void
109812 194 : SgArrowExp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
109813 : {
109814 : // This function traverses the memory pool for an IR node and
109815 : // calls the function to execute the visitor object.
109816 :
109817 : // Initialize array to the address of the first element of the STL vector
109818 : // (which is guarenteed to be contiguous storage).
109819 : // SgArrowExp objectArray [] = *(Memory_Block_List.begin());
109820 194 : if (SgArrowExp::pools.empty() == false)
109821 : {
109822 : // Generate an array of memory pools
109823 137 : SgArrowExp** objectArray = (SgArrowExp**) &(SgArrowExp::pools[0]);
109824 :
109825 : // Build a local variable for better performance
109826 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
109827 :
109828 : // Iterate over the memory pools
109829 275 : for (unsigned int i=0; i < SgArrowExp::pools.size(); i++)
109830 : {
109831 : // objectArray[i] is a single memory pool
109832 276138 : for (unsigned j=0; j < SgArrowExp::pool_size; j++)
109833 : {
109834 276000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
109835 : {
109836 : // printf ("Found a valid SgArrowExp object in the memory pool %d at position %d \n",i,j);
109837 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
109838 180989 : objectArray[i][j].executeVisitorMemberFunction(visitor);
109839 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
109840 : }
109841 : else
109842 : {
109843 : // printf ("Found a INVALID SgArrowExp object in the memory pool \n");
109844 : }
109845 : }
109846 : }
109847 : }
109848 :
109849 : // This should not be required since all previously static data members are
109850 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
109851 :
109852 194 : }
109853 :
109854 : void
109855 0 : SgArrowExp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
109856 : {
109857 : // This function visits only a single IR node of the memory pool.
109858 : // it is typically called once for each type of IR node within
109859 : // the automatically generated function: traverseRepresentativeNodes().
109860 :
109861 : // Initialize array to the address of the first element of the STL vector
109862 : // (which is guarenteed to be contiguous storage).
109863 : // SgArrowExp objectArray [] = *(Memory_Block_List.begin());
109864 0 : if (SgArrowExp::pools.empty() == false)
109865 : {
109866 : // Generate an array of memory pools
109867 0 : SgArrowExp** objectArray = (SgArrowExp**) &(SgArrowExp::pools[0]);
109868 :
109869 : // Build a local variable for better performance
109870 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
109871 :
109872 : // Iterate over the memory pools
109873 0 : bool done = false;
109874 0 : unsigned i=0;
109875 :
109876 : // find the first valid IR node, call visit function, and then leave
109877 0 : while ( done == false && i < SgArrowExp::pools.size() )
109878 : {
109879 : // objectArray[i] is a single memory pool
109880 : unsigned j=0;
109881 0 : while (done == false && j < SgArrowExp::pool_size)
109882 : {
109883 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
109884 : {
109885 0 : traversal.visit(&(objectArray[i][j]));
109886 0 : done = true;
109887 : }
109888 0 : j++;
109889 : }
109890 0 : i++;
109891 : }
109892 :
109893 : #if 0
109894 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
109895 : if (done == false)
109896 : {
109897 : printf ("No representative for SgArrowExp found in memory pools \n");
109898 : }
109899 : #endif
109900 : }
109901 0 : }
109902 :
109903 :
109904 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
109905 : // using values that overflow signed values of int.
109906 : size_t
109907 4 : SgArrowExp::numberOfNodes()
109908 : {
109909 : // This function traverses the memory pool for an IR node and
109910 : // counts the number of IR nodes of a particular Sage III IR
109911 : // nodes type.
109912 :
109913 4 : size_t count = 0;
109914 4 : if (SgArrowExp::pools.empty() == false)
109915 : {
109916 : // Generate an array of memory pools (this is actually a STL vector,
109917 : // but it is contiguious, so OK to treat this way).
109918 1 : SgArrowExp** objectArray = (SgArrowExp**) &(SgArrowExp::pools[0]);
109919 :
109920 : // Build a local variable for better performance (make it a loop invariant variable).
109921 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
109922 :
109923 : // Iterate over all of the memory pools for this IR node.
109924 2 : for (unsigned int i=0; i < SgArrowExp::pools.size(); i++)
109925 : {
109926 : // objectArray[i] is a single memory pool, iterate over all the
109927 : // IR nodes and only count those that are valid IR nodes used in
109928 : // the AST (i.e. allocated IR nodes).
109929 2001 : for (unsigned j=0; j < SgArrowExp::pool_size; j++)
109930 : {
109931 : // This is indexing the STL vector of C/C++ style arrays as a doubly
109932 : // indexed array access. It is OK since we have leveraged the semantics
109933 : // of STL vector memory as contigous and cast the memory as an array
109934 : // of arrays to use the 2D array indexing. Hope this is not confusing,
109935 : // but it s very fast as an implementation.
109936 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
109937 : {
109938 1254 : count++;
109939 : }
109940 : }
109941 : }
109942 : }
109943 :
109944 :
109945 :
109946 4 : return count;
109947 : }
109948 :
109949 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
109950 : // using values that overflow signed values of int.
109951 : size_t
109952 0 : SgArrowExp::memoryUsage()
109953 : {
109954 : // This function is required because we need the class name as a type when we call sizeof
109955 : // There might be another way to implement this if we have a traversal that only called a
109956 : // representative object (one call for each type of Sage IIIIR node).
109957 0 : size_t memory = numberOfNodes() * sizeof(SgArrowExp);
109958 :
109959 0 : return memory;
109960 : }
109961 :
109962 : /* #line 109963 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
109963 :
109964 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
109965 : void
109966 5342 : SgDotExp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
109967 : {
109968 : // This function traverses the memory pool for only a specific IR node
109969 : // and calls the visit function of the input class execute a traversal
109970 : // similar to the style of the attribute based traversals within ROSE.
109971 : // This traversal will visit ALL nodes of the AST where as the other
109972 : // attribute based traversals visit only the embedded tree within the AST.
109973 :
109974 : // Initialize array to the address of the first element of the STL vector
109975 : // (which is guaranteed to be contiguous storage).
109976 : // SgDotExp objectArray [] = *(Memory_Block_List.begin());
109977 5342 : if (SgDotExp::pools.empty() == false)
109978 : {
109979 : // Generate an array of memory pools
109980 393 : SgDotExp** objectArray = (SgDotExp**) &(SgDotExp::pools[0]);
109981 :
109982 : // Build a local variable for better performance
109983 393 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
109984 : #if 0
109985 : // Iterate over the memory pools
109986 : for (unsigned int i=0; i < SgDotExp::pools.size(); i++)
109987 : {
109988 : // objectArray[i] is a single memory pool
109989 : for (int j=0; j < SgDotExp::pool_size; j++)
109990 : {
109991 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
109992 : {
109993 : traversal.visit(&(objectArray[i][j]));
109994 : }
109995 : }
109996 : }
109997 : #else
109998 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
109999 : // compute the list first and then call the visit function on each list element.
110000 :
110001 : // printf ("Inside of SgDotExp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
110002 :
110003 786 : std::vector<SgDotExp*> nodeList;
110004 :
110005 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
110006 786 : for (unsigned int i=0; i < SgDotExp::pools.size(); i++)
110007 : {
110008 : // objectArray[i] is a single memory pool
110009 786393 : for (unsigned j=0; j < SgDotExp::pool_size; j++)
110010 : {
110011 786000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
110012 : {
110013 116062 : nodeList.push_back(&(objectArray[i][j]));
110014 : }
110015 : }
110016 : }
110017 :
110018 : // Iterate over the saved list
110019 393 : size_t nodeListSize = nodeList.size();
110020 116455 : for (size_t i=0; i < nodeListSize; i++)
110021 : {
110022 116062 : ROSE_ASSERT(nodeList[i] != NULL);
110023 : #if 0
110024 : traversal.visit(nodeList[i]);
110025 : #else
110026 116062 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
110027 : {
110028 116062 : traversal.visit(nodeList[i]);
110029 : }
110030 : #endif
110031 : }
110032 : #endif
110033 : }
110034 :
110035 : // This should not be required since all previously static data members are
110036 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
110037 :
110038 5342 : }
110039 :
110040 :
110041 : void
110042 194 : SgDotExp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
110043 : {
110044 : // This function traverses the memory pool for an IR node and
110045 : // calls the function to execute the visitor object.
110046 :
110047 : // Initialize array to the address of the first element of the STL vector
110048 : // (which is guarenteed to be contiguous storage).
110049 : // SgDotExp objectArray [] = *(Memory_Block_List.begin());
110050 194 : if (SgDotExp::pools.empty() == false)
110051 : {
110052 : // Generate an array of memory pools
110053 137 : SgDotExp** objectArray = (SgDotExp**) &(SgDotExp::pools[0]);
110054 :
110055 : // Build a local variable for better performance
110056 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
110057 :
110058 : // Iterate over the memory pools
110059 274 : for (unsigned int i=0; i < SgDotExp::pools.size(); i++)
110060 : {
110061 : // objectArray[i] is a single memory pool
110062 274137 : for (unsigned j=0; j < SgDotExp::pool_size; j++)
110063 : {
110064 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
110065 : {
110066 : // printf ("Found a valid SgDotExp object in the memory pool %d at position %d \n",i,j);
110067 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
110068 121974 : objectArray[i][j].executeVisitorMemberFunction(visitor);
110069 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
110070 : }
110071 : else
110072 : {
110073 : // printf ("Found a INVALID SgDotExp object in the memory pool \n");
110074 : }
110075 : }
110076 : }
110077 : }
110078 :
110079 : // This should not be required since all previously static data members are
110080 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
110081 :
110082 194 : }
110083 :
110084 : void
110085 0 : SgDotExp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
110086 : {
110087 : // This function visits only a single IR node of the memory pool.
110088 : // it is typically called once for each type of IR node within
110089 : // the automatically generated function: traverseRepresentativeNodes().
110090 :
110091 : // Initialize array to the address of the first element of the STL vector
110092 : // (which is guarenteed to be contiguous storage).
110093 : // SgDotExp objectArray [] = *(Memory_Block_List.begin());
110094 0 : if (SgDotExp::pools.empty() == false)
110095 : {
110096 : // Generate an array of memory pools
110097 0 : SgDotExp** objectArray = (SgDotExp**) &(SgDotExp::pools[0]);
110098 :
110099 : // Build a local variable for better performance
110100 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
110101 :
110102 : // Iterate over the memory pools
110103 0 : bool done = false;
110104 0 : unsigned i=0;
110105 :
110106 : // find the first valid IR node, call visit function, and then leave
110107 0 : while ( done == false && i < SgDotExp::pools.size() )
110108 : {
110109 : // objectArray[i] is a single memory pool
110110 : unsigned j=0;
110111 0 : while (done == false && j < SgDotExp::pool_size)
110112 : {
110113 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
110114 : {
110115 0 : traversal.visit(&(objectArray[i][j]));
110116 0 : done = true;
110117 : }
110118 0 : j++;
110119 : }
110120 0 : i++;
110121 : }
110122 :
110123 : #if 0
110124 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
110125 : if (done == false)
110126 : {
110127 : printf ("No representative for SgDotExp found in memory pools \n");
110128 : }
110129 : #endif
110130 : }
110131 0 : }
110132 :
110133 :
110134 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
110135 : // using values that overflow signed values of int.
110136 : size_t
110137 4 : SgDotExp::numberOfNodes()
110138 : {
110139 : // This function traverses the memory pool for an IR node and
110140 : // counts the number of IR nodes of a particular Sage III IR
110141 : // nodes type.
110142 :
110143 4 : size_t count = 0;
110144 4 : if (SgDotExp::pools.empty() == false)
110145 : {
110146 : // Generate an array of memory pools (this is actually a STL vector,
110147 : // but it is contiguious, so OK to treat this way).
110148 1 : SgDotExp** objectArray = (SgDotExp**) &(SgDotExp::pools[0]);
110149 :
110150 : // Build a local variable for better performance (make it a loop invariant variable).
110151 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
110152 :
110153 : // Iterate over all of the memory pools for this IR node.
110154 2 : for (unsigned int i=0; i < SgDotExp::pools.size(); i++)
110155 : {
110156 : // objectArray[i] is a single memory pool, iterate over all the
110157 : // IR nodes and only count those that are valid IR nodes used in
110158 : // the AST (i.e. allocated IR nodes).
110159 2001 : for (unsigned j=0; j < SgDotExp::pool_size; j++)
110160 : {
110161 : // This is indexing the STL vector of C/C++ style arrays as a doubly
110162 : // indexed array access. It is OK since we have leveraged the semantics
110163 : // of STL vector memory as contigous and cast the memory as an array
110164 : // of arrays to use the 2D array indexing. Hope this is not confusing,
110165 : // but it s very fast as an implementation.
110166 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
110167 : {
110168 816 : count++;
110169 : }
110170 : }
110171 : }
110172 : }
110173 :
110174 :
110175 :
110176 4 : return count;
110177 : }
110178 :
110179 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
110180 : // using values that overflow signed values of int.
110181 : size_t
110182 0 : SgDotExp::memoryUsage()
110183 : {
110184 : // This function is required because we need the class name as a type when we call sizeof
110185 : // There might be another way to implement this if we have a traversal that only called a
110186 : // representative object (one call for each type of Sage IIIIR node).
110187 0 : size_t memory = numberOfNodes() * sizeof(SgDotExp);
110188 :
110189 0 : return memory;
110190 : }
110191 :
110192 : /* #line 110193 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
110193 :
110194 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
110195 : void
110196 5342 : SgDotStarOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
110197 : {
110198 : // This function traverses the memory pool for only a specific IR node
110199 : // and calls the visit function of the input class execute a traversal
110200 : // similar to the style of the attribute based traversals within ROSE.
110201 : // This traversal will visit ALL nodes of the AST where as the other
110202 : // attribute based traversals visit only the embedded tree within the AST.
110203 :
110204 : // Initialize array to the address of the first element of the STL vector
110205 : // (which is guaranteed to be contiguous storage).
110206 : // SgDotStarOp objectArray [] = *(Memory_Block_List.begin());
110207 5342 : if (SgDotStarOp::pools.empty() == false)
110208 : {
110209 : // Generate an array of memory pools
110210 138 : SgDotStarOp** objectArray = (SgDotStarOp**) &(SgDotStarOp::pools[0]);
110211 :
110212 : // Build a local variable for better performance
110213 138 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
110214 : #if 0
110215 : // Iterate over the memory pools
110216 : for (unsigned int i=0; i < SgDotStarOp::pools.size(); i++)
110217 : {
110218 : // objectArray[i] is a single memory pool
110219 : for (int j=0; j < SgDotStarOp::pool_size; j++)
110220 : {
110221 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
110222 : {
110223 : traversal.visit(&(objectArray[i][j]));
110224 : }
110225 : }
110226 : }
110227 : #else
110228 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
110229 : // compute the list first and then call the visit function on each list element.
110230 :
110231 : // printf ("Inside of SgDotStarOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
110232 :
110233 276 : std::vector<SgDotStarOp*> nodeList;
110234 :
110235 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
110236 276 : for (unsigned int i=0; i < SgDotStarOp::pools.size(); i++)
110237 : {
110238 : // objectArray[i] is a single memory pool
110239 276138 : for (unsigned j=0; j < SgDotStarOp::pool_size; j++)
110240 : {
110241 276000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
110242 : {
110243 1564 : nodeList.push_back(&(objectArray[i][j]));
110244 : }
110245 : }
110246 : }
110247 :
110248 : // Iterate over the saved list
110249 138 : size_t nodeListSize = nodeList.size();
110250 1702 : for (size_t i=0; i < nodeListSize; i++)
110251 : {
110252 1564 : ROSE_ASSERT(nodeList[i] != NULL);
110253 : #if 0
110254 : traversal.visit(nodeList[i]);
110255 : #else
110256 1564 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
110257 : {
110258 1564 : traversal.visit(nodeList[i]);
110259 : }
110260 : #endif
110261 : }
110262 : #endif
110263 : }
110264 :
110265 : // This should not be required since all previously static data members are
110266 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
110267 :
110268 5342 : }
110269 :
110270 :
110271 : void
110272 194 : SgDotStarOp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
110273 : {
110274 : // This function traverses the memory pool for an IR node and
110275 : // calls the function to execute the visitor object.
110276 :
110277 : // Initialize array to the address of the first element of the STL vector
110278 : // (which is guarenteed to be contiguous storage).
110279 : // SgDotStarOp objectArray [] = *(Memory_Block_List.begin());
110280 194 : if (SgDotStarOp::pools.empty() == false)
110281 : {
110282 : // Generate an array of memory pools
110283 137 : SgDotStarOp** objectArray = (SgDotStarOp**) &(SgDotStarOp::pools[0]);
110284 :
110285 : // Build a local variable for better performance
110286 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
110287 :
110288 : // Iterate over the memory pools
110289 274 : for (unsigned int i=0; i < SgDotStarOp::pools.size(); i++)
110290 : {
110291 : // objectArray[i] is a single memory pool
110292 274137 : for (unsigned j=0; j < SgDotStarOp::pool_size; j++)
110293 : {
110294 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
110295 : {
110296 : // printf ("Found a valid SgDotStarOp object in the memory pool %d at position %d \n",i,j);
110297 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
110298 1644 : objectArray[i][j].executeVisitorMemberFunction(visitor);
110299 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
110300 : }
110301 : else
110302 : {
110303 : // printf ("Found a INVALID SgDotStarOp object in the memory pool \n");
110304 : }
110305 : }
110306 : }
110307 : }
110308 :
110309 : // This should not be required since all previously static data members are
110310 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
110311 :
110312 194 : }
110313 :
110314 : void
110315 0 : SgDotStarOp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
110316 : {
110317 : // This function visits only a single IR node of the memory pool.
110318 : // it is typically called once for each type of IR node within
110319 : // the automatically generated function: traverseRepresentativeNodes().
110320 :
110321 : // Initialize array to the address of the first element of the STL vector
110322 : // (which is guarenteed to be contiguous storage).
110323 : // SgDotStarOp objectArray [] = *(Memory_Block_List.begin());
110324 0 : if (SgDotStarOp::pools.empty() == false)
110325 : {
110326 : // Generate an array of memory pools
110327 0 : SgDotStarOp** objectArray = (SgDotStarOp**) &(SgDotStarOp::pools[0]);
110328 :
110329 : // Build a local variable for better performance
110330 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
110331 :
110332 : // Iterate over the memory pools
110333 0 : bool done = false;
110334 0 : unsigned i=0;
110335 :
110336 : // find the first valid IR node, call visit function, and then leave
110337 0 : while ( done == false && i < SgDotStarOp::pools.size() )
110338 : {
110339 : // objectArray[i] is a single memory pool
110340 : unsigned j=0;
110341 0 : while (done == false && j < SgDotStarOp::pool_size)
110342 : {
110343 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
110344 : {
110345 0 : traversal.visit(&(objectArray[i][j]));
110346 0 : done = true;
110347 : }
110348 0 : j++;
110349 : }
110350 0 : i++;
110351 : }
110352 :
110353 : #if 0
110354 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
110355 : if (done == false)
110356 : {
110357 : printf ("No representative for SgDotStarOp found in memory pools \n");
110358 : }
110359 : #endif
110360 : }
110361 0 : }
110362 :
110363 :
110364 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
110365 : // using values that overflow signed values of int.
110366 : size_t
110367 4 : SgDotStarOp::numberOfNodes()
110368 : {
110369 : // This function traverses the memory pool for an IR node and
110370 : // counts the number of IR nodes of a particular Sage III IR
110371 : // nodes type.
110372 :
110373 4 : size_t count = 0;
110374 4 : if (SgDotStarOp::pools.empty() == false)
110375 : {
110376 : // Generate an array of memory pools (this is actually a STL vector,
110377 : // but it is contiguious, so OK to treat this way).
110378 1 : SgDotStarOp** objectArray = (SgDotStarOp**) &(SgDotStarOp::pools[0]);
110379 :
110380 : // Build a local variable for better performance (make it a loop invariant variable).
110381 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
110382 :
110383 : // Iterate over all of the memory pools for this IR node.
110384 2 : for (unsigned int i=0; i < SgDotStarOp::pools.size(); i++)
110385 : {
110386 : // objectArray[i] is a single memory pool, iterate over all the
110387 : // IR nodes and only count those that are valid IR nodes used in
110388 : // the AST (i.e. allocated IR nodes).
110389 2001 : for (unsigned j=0; j < SgDotStarOp::pool_size; j++)
110390 : {
110391 : // This is indexing the STL vector of C/C++ style arrays as a doubly
110392 : // indexed array access. It is OK since we have leveraged the semantics
110393 : // of STL vector memory as contigous and cast the memory as an array
110394 : // of arrays to use the 2D array indexing. Hope this is not confusing,
110395 : // but it s very fast as an implementation.
110396 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
110397 : {
110398 12 : count++;
110399 : }
110400 : }
110401 : }
110402 : }
110403 :
110404 :
110405 :
110406 4 : return count;
110407 : }
110408 :
110409 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
110410 : // using values that overflow signed values of int.
110411 : size_t
110412 0 : SgDotStarOp::memoryUsage()
110413 : {
110414 : // This function is required because we need the class name as a type when we call sizeof
110415 : // There might be another way to implement this if we have a traversal that only called a
110416 : // representative object (one call for each type of Sage IIIIR node).
110417 0 : size_t memory = numberOfNodes() * sizeof(SgDotStarOp);
110418 :
110419 0 : return memory;
110420 : }
110421 :
110422 : /* #line 110423 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
110423 :
110424 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
110425 : void
110426 5342 : SgArrowStarOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
110427 : {
110428 : // This function traverses the memory pool for only a specific IR node
110429 : // and calls the visit function of the input class execute a traversal
110430 : // similar to the style of the attribute based traversals within ROSE.
110431 : // This traversal will visit ALL nodes of the AST where as the other
110432 : // attribute based traversals visit only the embedded tree within the AST.
110433 :
110434 : // Initialize array to the address of the first element of the STL vector
110435 : // (which is guaranteed to be contiguous storage).
110436 : // SgArrowStarOp objectArray [] = *(Memory_Block_List.begin());
110437 5342 : if (SgArrowStarOp::pools.empty() == false)
110438 : {
110439 : // Generate an array of memory pools
110440 115 : SgArrowStarOp** objectArray = (SgArrowStarOp**) &(SgArrowStarOp::pools[0]);
110441 :
110442 : // Build a local variable for better performance
110443 115 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
110444 : #if 0
110445 : // Iterate over the memory pools
110446 : for (unsigned int i=0; i < SgArrowStarOp::pools.size(); i++)
110447 : {
110448 : // objectArray[i] is a single memory pool
110449 : for (int j=0; j < SgArrowStarOp::pool_size; j++)
110450 : {
110451 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
110452 : {
110453 : traversal.visit(&(objectArray[i][j]));
110454 : }
110455 : }
110456 : }
110457 : #else
110458 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
110459 : // compute the list first and then call the visit function on each list element.
110460 :
110461 : // printf ("Inside of SgArrowStarOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
110462 :
110463 230 : std::vector<SgArrowStarOp*> nodeList;
110464 :
110465 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
110466 230 : for (unsigned int i=0; i < SgArrowStarOp::pools.size(); i++)
110467 : {
110468 : // objectArray[i] is a single memory pool
110469 230115 : for (unsigned j=0; j < SgArrowStarOp::pool_size; j++)
110470 : {
110471 230000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
110472 : {
110473 460 : nodeList.push_back(&(objectArray[i][j]));
110474 : }
110475 : }
110476 : }
110477 :
110478 : // Iterate over the saved list
110479 115 : size_t nodeListSize = nodeList.size();
110480 575 : for (size_t i=0; i < nodeListSize; i++)
110481 : {
110482 460 : ROSE_ASSERT(nodeList[i] != NULL);
110483 : #if 0
110484 : traversal.visit(nodeList[i]);
110485 : #else
110486 460 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
110487 : {
110488 460 : traversal.visit(nodeList[i]);
110489 : }
110490 : #endif
110491 : }
110492 : #endif
110493 : }
110494 :
110495 : // This should not be required since all previously static data members are
110496 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
110497 :
110498 5342 : }
110499 :
110500 :
110501 : void
110502 194 : SgArrowStarOp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
110503 : {
110504 : // This function traverses the memory pool for an IR node and
110505 : // calls the function to execute the visitor object.
110506 :
110507 : // Initialize array to the address of the first element of the STL vector
110508 : // (which is guarenteed to be contiguous storage).
110509 : // SgArrowStarOp objectArray [] = *(Memory_Block_List.begin());
110510 194 : if (SgArrowStarOp::pools.empty() == false)
110511 : {
110512 : // Generate an array of memory pools
110513 137 : SgArrowStarOp** objectArray = (SgArrowStarOp**) &(SgArrowStarOp::pools[0]);
110514 :
110515 : // Build a local variable for better performance
110516 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
110517 :
110518 : // Iterate over the memory pools
110519 274 : for (unsigned int i=0; i < SgArrowStarOp::pools.size(); i++)
110520 : {
110521 : // objectArray[i] is a single memory pool
110522 274137 : for (unsigned j=0; j < SgArrowStarOp::pool_size; j++)
110523 : {
110524 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
110525 : {
110526 : // printf ("Found a valid SgArrowStarOp object in the memory pool %d at position %d \n",i,j);
110527 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
110528 548 : objectArray[i][j].executeVisitorMemberFunction(visitor);
110529 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
110530 : }
110531 : else
110532 : {
110533 : // printf ("Found a INVALID SgArrowStarOp object in the memory pool \n");
110534 : }
110535 : }
110536 : }
110537 : }
110538 :
110539 : // This should not be required since all previously static data members are
110540 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
110541 :
110542 194 : }
110543 :
110544 : void
110545 0 : SgArrowStarOp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
110546 : {
110547 : // This function visits only a single IR node of the memory pool.
110548 : // it is typically called once for each type of IR node within
110549 : // the automatically generated function: traverseRepresentativeNodes().
110550 :
110551 : // Initialize array to the address of the first element of the STL vector
110552 : // (which is guarenteed to be contiguous storage).
110553 : // SgArrowStarOp objectArray [] = *(Memory_Block_List.begin());
110554 0 : if (SgArrowStarOp::pools.empty() == false)
110555 : {
110556 : // Generate an array of memory pools
110557 0 : SgArrowStarOp** objectArray = (SgArrowStarOp**) &(SgArrowStarOp::pools[0]);
110558 :
110559 : // Build a local variable for better performance
110560 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
110561 :
110562 : // Iterate over the memory pools
110563 0 : bool done = false;
110564 0 : unsigned i=0;
110565 :
110566 : // find the first valid IR node, call visit function, and then leave
110567 0 : while ( done == false && i < SgArrowStarOp::pools.size() )
110568 : {
110569 : // objectArray[i] is a single memory pool
110570 : unsigned j=0;
110571 0 : while (done == false && j < SgArrowStarOp::pool_size)
110572 : {
110573 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
110574 : {
110575 0 : traversal.visit(&(objectArray[i][j]));
110576 0 : done = true;
110577 : }
110578 0 : j++;
110579 : }
110580 0 : i++;
110581 : }
110582 :
110583 : #if 0
110584 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
110585 : if (done == false)
110586 : {
110587 : printf ("No representative for SgArrowStarOp found in memory pools \n");
110588 : }
110589 : #endif
110590 : }
110591 0 : }
110592 :
110593 :
110594 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
110595 : // using values that overflow signed values of int.
110596 : size_t
110597 4 : SgArrowStarOp::numberOfNodes()
110598 : {
110599 : // This function traverses the memory pool for an IR node and
110600 : // counts the number of IR nodes of a particular Sage III IR
110601 : // nodes type.
110602 :
110603 4 : size_t count = 0;
110604 4 : if (SgArrowStarOp::pools.empty() == false)
110605 : {
110606 : // Generate an array of memory pools (this is actually a STL vector,
110607 : // but it is contiguious, so OK to treat this way).
110608 1 : SgArrowStarOp** objectArray = (SgArrowStarOp**) &(SgArrowStarOp::pools[0]);
110609 :
110610 : // Build a local variable for better performance (make it a loop invariant variable).
110611 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
110612 :
110613 : // Iterate over all of the memory pools for this IR node.
110614 2 : for (unsigned int i=0; i < SgArrowStarOp::pools.size(); i++)
110615 : {
110616 : // objectArray[i] is a single memory pool, iterate over all the
110617 : // IR nodes and only count those that are valid IR nodes used in
110618 : // the AST (i.e. allocated IR nodes).
110619 2001 : for (unsigned j=0; j < SgArrowStarOp::pool_size; j++)
110620 : {
110621 : // This is indexing the STL vector of C/C++ style arrays as a doubly
110622 : // indexed array access. It is OK since we have leveraged the semantics
110623 : // of STL vector memory as contigous and cast the memory as an array
110624 : // of arrays to use the 2D array indexing. Hope this is not confusing,
110625 : // but it s very fast as an implementation.
110626 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
110627 : {
110628 4 : count++;
110629 : }
110630 : }
110631 : }
110632 : }
110633 :
110634 :
110635 :
110636 4 : return count;
110637 : }
110638 :
110639 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
110640 : // using values that overflow signed values of int.
110641 : size_t
110642 0 : SgArrowStarOp::memoryUsage()
110643 : {
110644 : // This function is required because we need the class name as a type when we call sizeof
110645 : // There might be another way to implement this if we have a traversal that only called a
110646 : // representative object (one call for each type of Sage IIIIR node).
110647 0 : size_t memory = numberOfNodes() * sizeof(SgArrowStarOp);
110648 :
110649 0 : return memory;
110650 : }
110651 :
110652 : /* #line 110653 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
110653 :
110654 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
110655 : void
110656 5342 : SgEqualityOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
110657 : {
110658 : // This function traverses the memory pool for only a specific IR node
110659 : // and calls the visit function of the input class execute a traversal
110660 : // similar to the style of the attribute based traversals within ROSE.
110661 : // This traversal will visit ALL nodes of the AST where as the other
110662 : // attribute based traversals visit only the embedded tree within the AST.
110663 :
110664 : // Initialize array to the address of the first element of the STL vector
110665 : // (which is guaranteed to be contiguous storage).
110666 : // SgEqualityOp objectArray [] = *(Memory_Block_List.begin());
110667 5342 : if (SgEqualityOp::pools.empty() == false)
110668 : {
110669 : // Generate an array of memory pools
110670 1111 : SgEqualityOp** objectArray = (SgEqualityOp**) &(SgEqualityOp::pools[0]);
110671 :
110672 : // Build a local variable for better performance
110673 1111 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
110674 : #if 0
110675 : // Iterate over the memory pools
110676 : for (unsigned int i=0; i < SgEqualityOp::pools.size(); i++)
110677 : {
110678 : // objectArray[i] is a single memory pool
110679 : for (int j=0; j < SgEqualityOp::pool_size; j++)
110680 : {
110681 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
110682 : {
110683 : traversal.visit(&(objectArray[i][j]));
110684 : }
110685 : }
110686 : }
110687 : #else
110688 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
110689 : // compute the list first and then call the visit function on each list element.
110690 :
110691 : // printf ("Inside of SgEqualityOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
110692 :
110693 2222 : std::vector<SgEqualityOp*> nodeList;
110694 :
110695 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
110696 2222 : for (unsigned int i=0; i < SgEqualityOp::pools.size(); i++)
110697 : {
110698 : // objectArray[i] is a single memory pool
110699 2223110 : for (unsigned j=0; j < SgEqualityOp::pool_size; j++)
110700 : {
110701 2222000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
110702 : {
110703 33213 : nodeList.push_back(&(objectArray[i][j]));
110704 : }
110705 : }
110706 : }
110707 :
110708 : // Iterate over the saved list
110709 1111 : size_t nodeListSize = nodeList.size();
110710 34324 : for (size_t i=0; i < nodeListSize; i++)
110711 : {
110712 33213 : ROSE_ASSERT(nodeList[i] != NULL);
110713 : #if 0
110714 : traversal.visit(nodeList[i]);
110715 : #else
110716 33213 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
110717 : {
110718 33213 : traversal.visit(nodeList[i]);
110719 : }
110720 : #endif
110721 : }
110722 : #endif
110723 : }
110724 :
110725 : // This should not be required since all previously static data members are
110726 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
110727 :
110728 5342 : }
110729 :
110730 :
110731 : void
110732 194 : SgEqualityOp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
110733 : {
110734 : // This function traverses the memory pool for an IR node and
110735 : // calls the function to execute the visitor object.
110736 :
110737 : // Initialize array to the address of the first element of the STL vector
110738 : // (which is guarenteed to be contiguous storage).
110739 : // SgEqualityOp objectArray [] = *(Memory_Block_List.begin());
110740 194 : if (SgEqualityOp::pools.empty() == false)
110741 : {
110742 : // Generate an array of memory pools
110743 170 : SgEqualityOp** objectArray = (SgEqualityOp**) &(SgEqualityOp::pools[0]);
110744 :
110745 : // Build a local variable for better performance
110746 170 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
110747 :
110748 : // Iterate over the memory pools
110749 340 : for (unsigned int i=0; i < SgEqualityOp::pools.size(); i++)
110750 : {
110751 : // objectArray[i] is a single memory pool
110752 340170 : for (unsigned j=0; j < SgEqualityOp::pool_size; j++)
110753 : {
110754 340000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
110755 : {
110756 : // printf ("Found a valid SgEqualityOp object in the memory pool %d at position %d \n",i,j);
110757 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
110758 35174 : objectArray[i][j].executeVisitorMemberFunction(visitor);
110759 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
110760 : }
110761 : else
110762 : {
110763 : // printf ("Found a INVALID SgEqualityOp object in the memory pool \n");
110764 : }
110765 : }
110766 : }
110767 : }
110768 :
110769 : // This should not be required since all previously static data members are
110770 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
110771 :
110772 194 : }
110773 :
110774 : void
110775 0 : SgEqualityOp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
110776 : {
110777 : // This function visits only a single IR node of the memory pool.
110778 : // it is typically called once for each type of IR node within
110779 : // the automatically generated function: traverseRepresentativeNodes().
110780 :
110781 : // Initialize array to the address of the first element of the STL vector
110782 : // (which is guarenteed to be contiguous storage).
110783 : // SgEqualityOp objectArray [] = *(Memory_Block_List.begin());
110784 0 : if (SgEqualityOp::pools.empty() == false)
110785 : {
110786 : // Generate an array of memory pools
110787 0 : SgEqualityOp** objectArray = (SgEqualityOp**) &(SgEqualityOp::pools[0]);
110788 :
110789 : // Build a local variable for better performance
110790 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
110791 :
110792 : // Iterate over the memory pools
110793 0 : bool done = false;
110794 0 : unsigned i=0;
110795 :
110796 : // find the first valid IR node, call visit function, and then leave
110797 0 : while ( done == false && i < SgEqualityOp::pools.size() )
110798 : {
110799 : // objectArray[i] is a single memory pool
110800 : unsigned j=0;
110801 0 : while (done == false && j < SgEqualityOp::pool_size)
110802 : {
110803 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
110804 : {
110805 0 : traversal.visit(&(objectArray[i][j]));
110806 0 : done = true;
110807 : }
110808 0 : j++;
110809 : }
110810 0 : i++;
110811 : }
110812 :
110813 : #if 0
110814 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
110815 : if (done == false)
110816 : {
110817 : printf ("No representative for SgEqualityOp found in memory pools \n");
110818 : }
110819 : #endif
110820 : }
110821 0 : }
110822 :
110823 :
110824 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
110825 : // using values that overflow signed values of int.
110826 : size_t
110827 4 : SgEqualityOp::numberOfNodes()
110828 : {
110829 : // This function traverses the memory pool for an IR node and
110830 : // counts the number of IR nodes of a particular Sage III IR
110831 : // nodes type.
110832 :
110833 4 : size_t count = 0;
110834 4 : if (SgEqualityOp::pools.empty() == false)
110835 : {
110836 : // Generate an array of memory pools (this is actually a STL vector,
110837 : // but it is contiguious, so OK to treat this way).
110838 1 : SgEqualityOp** objectArray = (SgEqualityOp**) &(SgEqualityOp::pools[0]);
110839 :
110840 : // Build a local variable for better performance (make it a loop invariant variable).
110841 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
110842 :
110843 : // Iterate over all of the memory pools for this IR node.
110844 2 : for (unsigned int i=0; i < SgEqualityOp::pools.size(); i++)
110845 : {
110846 : // objectArray[i] is a single memory pool, iterate over all the
110847 : // IR nodes and only count those that are valid IR nodes used in
110848 : // the AST (i.e. allocated IR nodes).
110849 2001 : for (unsigned j=0; j < SgEqualityOp::pool_size; j++)
110850 : {
110851 : // This is indexing the STL vector of C/C++ style arrays as a doubly
110852 : // indexed array access. It is OK since we have leveraged the semantics
110853 : // of STL vector memory as contigous and cast the memory as an array
110854 : // of arrays to use the 2D array indexing. Hope this is not confusing,
110855 : // but it s very fast as an implementation.
110856 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
110857 : {
110858 250 : count++;
110859 : }
110860 : }
110861 : }
110862 : }
110863 :
110864 :
110865 :
110866 4 : return count;
110867 : }
110868 :
110869 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
110870 : // using values that overflow signed values of int.
110871 : size_t
110872 0 : SgEqualityOp::memoryUsage()
110873 : {
110874 : // This function is required because we need the class name as a type when we call sizeof
110875 : // There might be another way to implement this if we have a traversal that only called a
110876 : // representative object (one call for each type of Sage IIIIR node).
110877 0 : size_t memory = numberOfNodes() * sizeof(SgEqualityOp);
110878 :
110879 0 : return memory;
110880 : }
110881 :
110882 : /* #line 110883 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
110883 :
110884 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
110885 : void
110886 5342 : SgLessThanOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
110887 : {
110888 : // This function traverses the memory pool for only a specific IR node
110889 : // and calls the visit function of the input class execute a traversal
110890 : // similar to the style of the attribute based traversals within ROSE.
110891 : // This traversal will visit ALL nodes of the AST where as the other
110892 : // attribute based traversals visit only the embedded tree within the AST.
110893 :
110894 : // Initialize array to the address of the first element of the STL vector
110895 : // (which is guaranteed to be contiguous storage).
110896 : // SgLessThanOp objectArray [] = *(Memory_Block_List.begin());
110897 5342 : if (SgLessThanOp::pools.empty() == false)
110898 : {
110899 : // Generate an array of memory pools
110900 2241 : SgLessThanOp** objectArray = (SgLessThanOp**) &(SgLessThanOp::pools[0]);
110901 :
110902 : // Build a local variable for better performance
110903 2241 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
110904 : #if 0
110905 : // Iterate over the memory pools
110906 : for (unsigned int i=0; i < SgLessThanOp::pools.size(); i++)
110907 : {
110908 : // objectArray[i] is a single memory pool
110909 : for (int j=0; j < SgLessThanOp::pool_size; j++)
110910 : {
110911 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
110912 : {
110913 : traversal.visit(&(objectArray[i][j]));
110914 : }
110915 : }
110916 : }
110917 : #else
110918 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
110919 : // compute the list first and then call the visit function on each list element.
110920 :
110921 : // printf ("Inside of SgLessThanOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
110922 :
110923 4482 : std::vector<SgLessThanOp*> nodeList;
110924 :
110925 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
110926 4482 : for (unsigned int i=0; i < SgLessThanOp::pools.size(); i++)
110927 : {
110928 : // objectArray[i] is a single memory pool
110929 4484240 : for (unsigned j=0; j < SgLessThanOp::pool_size; j++)
110930 : {
110931 4482000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
110932 : {
110933 32171 : nodeList.push_back(&(objectArray[i][j]));
110934 : }
110935 : }
110936 : }
110937 :
110938 : // Iterate over the saved list
110939 2241 : size_t nodeListSize = nodeList.size();
110940 34412 : for (size_t i=0; i < nodeListSize; i++)
110941 : {
110942 32171 : ROSE_ASSERT(nodeList[i] != NULL);
110943 : #if 0
110944 : traversal.visit(nodeList[i]);
110945 : #else
110946 32171 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
110947 : {
110948 32171 : traversal.visit(nodeList[i]);
110949 : }
110950 : #endif
110951 : }
110952 : #endif
110953 : }
110954 :
110955 : // This should not be required since all previously static data members are
110956 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
110957 :
110958 5342 : }
110959 :
110960 :
110961 : void
110962 194 : SgLessThanOp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
110963 : {
110964 : // This function traverses the memory pool for an IR node and
110965 : // calls the function to execute the visitor object.
110966 :
110967 : // Initialize array to the address of the first element of the STL vector
110968 : // (which is guarenteed to be contiguous storage).
110969 : // SgLessThanOp objectArray [] = *(Memory_Block_List.begin());
110970 194 : if (SgLessThanOp::pools.empty() == false)
110971 : {
110972 : // Generate an array of memory pools
110973 190 : SgLessThanOp** objectArray = (SgLessThanOp**) &(SgLessThanOp::pools[0]);
110974 :
110975 : // Build a local variable for better performance
110976 190 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
110977 :
110978 : // Iterate over the memory pools
110979 380 : for (unsigned int i=0; i < SgLessThanOp::pools.size(); i++)
110980 : {
110981 : // objectArray[i] is a single memory pool
110982 380190 : for (unsigned j=0; j < SgLessThanOp::pool_size; j++)
110983 : {
110984 380000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
110985 : {
110986 : // printf ("Found a valid SgLessThanOp object in the memory pool %d at position %d \n",i,j);
110987 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
110988 19162 : objectArray[i][j].executeVisitorMemberFunction(visitor);
110989 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
110990 : }
110991 : else
110992 : {
110993 : // printf ("Found a INVALID SgLessThanOp object in the memory pool \n");
110994 : }
110995 : }
110996 : }
110997 : }
110998 :
110999 : // This should not be required since all previously static data members are
111000 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
111001 :
111002 194 : }
111003 :
111004 : void
111005 0 : SgLessThanOp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
111006 : {
111007 : // This function visits only a single IR node of the memory pool.
111008 : // it is typically called once for each type of IR node within
111009 : // the automatically generated function: traverseRepresentativeNodes().
111010 :
111011 : // Initialize array to the address of the first element of the STL vector
111012 : // (which is guarenteed to be contiguous storage).
111013 : // SgLessThanOp objectArray [] = *(Memory_Block_List.begin());
111014 0 : if (SgLessThanOp::pools.empty() == false)
111015 : {
111016 : // Generate an array of memory pools
111017 0 : SgLessThanOp** objectArray = (SgLessThanOp**) &(SgLessThanOp::pools[0]);
111018 :
111019 : // Build a local variable for better performance
111020 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
111021 :
111022 : // Iterate over the memory pools
111023 0 : bool done = false;
111024 0 : unsigned i=0;
111025 :
111026 : // find the first valid IR node, call visit function, and then leave
111027 0 : while ( done == false && i < SgLessThanOp::pools.size() )
111028 : {
111029 : // objectArray[i] is a single memory pool
111030 : unsigned j=0;
111031 0 : while (done == false && j < SgLessThanOp::pool_size)
111032 : {
111033 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
111034 : {
111035 0 : traversal.visit(&(objectArray[i][j]));
111036 0 : done = true;
111037 : }
111038 0 : j++;
111039 : }
111040 0 : i++;
111041 : }
111042 :
111043 : #if 0
111044 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
111045 : if (done == false)
111046 : {
111047 : printf ("No representative for SgLessThanOp found in memory pools \n");
111048 : }
111049 : #endif
111050 : }
111051 0 : }
111052 :
111053 :
111054 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
111055 : // using values that overflow signed values of int.
111056 : size_t
111057 4 : SgLessThanOp::numberOfNodes()
111058 : {
111059 : // This function traverses the memory pool for an IR node and
111060 : // counts the number of IR nodes of a particular Sage III IR
111061 : // nodes type.
111062 :
111063 4 : size_t count = 0;
111064 4 : if (SgLessThanOp::pools.empty() == false)
111065 : {
111066 : // Generate an array of memory pools (this is actually a STL vector,
111067 : // but it is contiguious, so OK to treat this way).
111068 1 : SgLessThanOp** objectArray = (SgLessThanOp**) &(SgLessThanOp::pools[0]);
111069 :
111070 : // Build a local variable for better performance (make it a loop invariant variable).
111071 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
111072 :
111073 : // Iterate over all of the memory pools for this IR node.
111074 2 : for (unsigned int i=0; i < SgLessThanOp::pools.size(); i++)
111075 : {
111076 : // objectArray[i] is a single memory pool, iterate over all the
111077 : // IR nodes and only count those that are valid IR nodes used in
111078 : // the AST (i.e. allocated IR nodes).
111079 2001 : for (unsigned j=0; j < SgLessThanOp::pool_size; j++)
111080 : {
111081 : // This is indexing the STL vector of C/C++ style arrays as a doubly
111082 : // indexed array access. It is OK since we have leveraged the semantics
111083 : // of STL vector memory as contigous and cast the memory as an array
111084 : // of arrays to use the 2D array indexing. Hope this is not confusing,
111085 : // but it s very fast as an implementation.
111086 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
111087 : {
111088 136 : count++;
111089 : }
111090 : }
111091 : }
111092 : }
111093 :
111094 :
111095 :
111096 4 : return count;
111097 : }
111098 :
111099 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
111100 : // using values that overflow signed values of int.
111101 : size_t
111102 0 : SgLessThanOp::memoryUsage()
111103 : {
111104 : // This function is required because we need the class name as a type when we call sizeof
111105 : // There might be another way to implement this if we have a traversal that only called a
111106 : // representative object (one call for each type of Sage IIIIR node).
111107 0 : size_t memory = numberOfNodes() * sizeof(SgLessThanOp);
111108 :
111109 0 : return memory;
111110 : }
111111 :
111112 : /* #line 111113 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
111113 :
111114 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
111115 : void
111116 5342 : SgGreaterThanOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
111117 : {
111118 : // This function traverses the memory pool for only a specific IR node
111119 : // and calls the visit function of the input class execute a traversal
111120 : // similar to the style of the attribute based traversals within ROSE.
111121 : // This traversal will visit ALL nodes of the AST where as the other
111122 : // attribute based traversals visit only the embedded tree within the AST.
111123 :
111124 : // Initialize array to the address of the first element of the STL vector
111125 : // (which is guaranteed to be contiguous storage).
111126 : // SgGreaterThanOp objectArray [] = *(Memory_Block_List.begin());
111127 5342 : if (SgGreaterThanOp::pools.empty() == false)
111128 : {
111129 : // Generate an array of memory pools
111130 475 : SgGreaterThanOp** objectArray = (SgGreaterThanOp**) &(SgGreaterThanOp::pools[0]);
111131 :
111132 : // Build a local variable for better performance
111133 475 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
111134 : #if 0
111135 : // Iterate over the memory pools
111136 : for (unsigned int i=0; i < SgGreaterThanOp::pools.size(); i++)
111137 : {
111138 : // objectArray[i] is a single memory pool
111139 : for (int j=0; j < SgGreaterThanOp::pool_size; j++)
111140 : {
111141 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
111142 : {
111143 : traversal.visit(&(objectArray[i][j]));
111144 : }
111145 : }
111146 : }
111147 : #else
111148 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
111149 : // compute the list first and then call the visit function on each list element.
111150 :
111151 : // printf ("Inside of SgGreaterThanOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
111152 :
111153 950 : std::vector<SgGreaterThanOp*> nodeList;
111154 :
111155 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
111156 950 : for (unsigned int i=0; i < SgGreaterThanOp::pools.size(); i++)
111157 : {
111158 : // objectArray[i] is a single memory pool
111159 950475 : for (unsigned j=0; j < SgGreaterThanOp::pool_size; j++)
111160 : {
111161 950000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
111162 : {
111163 14471 : nodeList.push_back(&(objectArray[i][j]));
111164 : }
111165 : }
111166 : }
111167 :
111168 : // Iterate over the saved list
111169 475 : size_t nodeListSize = nodeList.size();
111170 14946 : for (size_t i=0; i < nodeListSize; i++)
111171 : {
111172 14471 : ROSE_ASSERT(nodeList[i] != NULL);
111173 : #if 0
111174 : traversal.visit(nodeList[i]);
111175 : #else
111176 14471 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
111177 : {
111178 14471 : traversal.visit(nodeList[i]);
111179 : }
111180 : #endif
111181 : }
111182 : #endif
111183 : }
111184 :
111185 : // This should not be required since all previously static data members are
111186 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
111187 :
111188 5342 : }
111189 :
111190 :
111191 : void
111192 194 : SgGreaterThanOp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
111193 : {
111194 : // This function traverses the memory pool for an IR node and
111195 : // calls the function to execute the visitor object.
111196 :
111197 : // Initialize array to the address of the first element of the STL vector
111198 : // (which is guarenteed to be contiguous storage).
111199 : // SgGreaterThanOp objectArray [] = *(Memory_Block_List.begin());
111200 194 : if (SgGreaterThanOp::pools.empty() == false)
111201 : {
111202 : // Generate an array of memory pools
111203 150 : SgGreaterThanOp** objectArray = (SgGreaterThanOp**) &(SgGreaterThanOp::pools[0]);
111204 :
111205 : // Build a local variable for better performance
111206 150 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
111207 :
111208 : // Iterate over the memory pools
111209 300 : for (unsigned int i=0; i < SgGreaterThanOp::pools.size(); i++)
111210 : {
111211 : // objectArray[i] is a single memory pool
111212 300150 : for (unsigned j=0; j < SgGreaterThanOp::pool_size; j++)
111213 : {
111214 300000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
111215 : {
111216 : // printf ("Found a valid SgGreaterThanOp object in the memory pool %d at position %d \n",i,j);
111217 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
111218 15499 : objectArray[i][j].executeVisitorMemberFunction(visitor);
111219 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
111220 : }
111221 : else
111222 : {
111223 : // printf ("Found a INVALID SgGreaterThanOp object in the memory pool \n");
111224 : }
111225 : }
111226 : }
111227 : }
111228 :
111229 : // This should not be required since all previously static data members are
111230 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
111231 :
111232 194 : }
111233 :
111234 : void
111235 0 : SgGreaterThanOp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
111236 : {
111237 : // This function visits only a single IR node of the memory pool.
111238 : // it is typically called once for each type of IR node within
111239 : // the automatically generated function: traverseRepresentativeNodes().
111240 :
111241 : // Initialize array to the address of the first element of the STL vector
111242 : // (which is guarenteed to be contiguous storage).
111243 : // SgGreaterThanOp objectArray [] = *(Memory_Block_List.begin());
111244 0 : if (SgGreaterThanOp::pools.empty() == false)
111245 : {
111246 : // Generate an array of memory pools
111247 0 : SgGreaterThanOp** objectArray = (SgGreaterThanOp**) &(SgGreaterThanOp::pools[0]);
111248 :
111249 : // Build a local variable for better performance
111250 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
111251 :
111252 : // Iterate over the memory pools
111253 0 : bool done = false;
111254 0 : unsigned i=0;
111255 :
111256 : // find the first valid IR node, call visit function, and then leave
111257 0 : while ( done == false && i < SgGreaterThanOp::pools.size() )
111258 : {
111259 : // objectArray[i] is a single memory pool
111260 : unsigned j=0;
111261 0 : while (done == false && j < SgGreaterThanOp::pool_size)
111262 : {
111263 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
111264 : {
111265 0 : traversal.visit(&(objectArray[i][j]));
111266 0 : done = true;
111267 : }
111268 0 : j++;
111269 : }
111270 0 : i++;
111271 : }
111272 :
111273 : #if 0
111274 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
111275 : if (done == false)
111276 : {
111277 : printf ("No representative for SgGreaterThanOp found in memory pools \n");
111278 : }
111279 : #endif
111280 : }
111281 0 : }
111282 :
111283 :
111284 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
111285 : // using values that overflow signed values of int.
111286 : size_t
111287 4 : SgGreaterThanOp::numberOfNodes()
111288 : {
111289 : // This function traverses the memory pool for an IR node and
111290 : // counts the number of IR nodes of a particular Sage III IR
111291 : // nodes type.
111292 :
111293 4 : size_t count = 0;
111294 4 : if (SgGreaterThanOp::pools.empty() == false)
111295 : {
111296 : // Generate an array of memory pools (this is actually a STL vector,
111297 : // but it is contiguious, so OK to treat this way).
111298 1 : SgGreaterThanOp** objectArray = (SgGreaterThanOp**) &(SgGreaterThanOp::pools[0]);
111299 :
111300 : // Build a local variable for better performance (make it a loop invariant variable).
111301 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
111302 :
111303 : // Iterate over all of the memory pools for this IR node.
111304 2 : for (unsigned int i=0; i < SgGreaterThanOp::pools.size(); i++)
111305 : {
111306 : // objectArray[i] is a single memory pool, iterate over all the
111307 : // IR nodes and only count those that are valid IR nodes used in
111308 : // the AST (i.e. allocated IR nodes).
111309 2001 : for (unsigned j=0; j < SgGreaterThanOp::pool_size; j++)
111310 : {
111311 : // This is indexing the STL vector of C/C++ style arrays as a doubly
111312 : // indexed array access. It is OK since we have leveraged the semantics
111313 : // of STL vector memory as contigous and cast the memory as an array
111314 : // of arrays to use the 2D array indexing. Hope this is not confusing,
111315 : // but it s very fast as an implementation.
111316 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
111317 : {
111318 108 : count++;
111319 : }
111320 : }
111321 : }
111322 : }
111323 :
111324 :
111325 :
111326 4 : return count;
111327 : }
111328 :
111329 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
111330 : // using values that overflow signed values of int.
111331 : size_t
111332 0 : SgGreaterThanOp::memoryUsage()
111333 : {
111334 : // This function is required because we need the class name as a type when we call sizeof
111335 : // There might be another way to implement this if we have a traversal that only called a
111336 : // representative object (one call for each type of Sage IIIIR node).
111337 0 : size_t memory = numberOfNodes() * sizeof(SgGreaterThanOp);
111338 :
111339 0 : return memory;
111340 : }
111341 :
111342 : /* #line 111343 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
111343 :
111344 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
111345 : void
111346 5342 : SgNotEqualOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
111347 : {
111348 : // This function traverses the memory pool for only a specific IR node
111349 : // and calls the visit function of the input class execute a traversal
111350 : // similar to the style of the attribute based traversals within ROSE.
111351 : // This traversal will visit ALL nodes of the AST where as the other
111352 : // attribute based traversals visit only the embedded tree within the AST.
111353 :
111354 : // Initialize array to the address of the first element of the STL vector
111355 : // (which is guaranteed to be contiguous storage).
111356 : // SgNotEqualOp objectArray [] = *(Memory_Block_List.begin());
111357 5342 : if (SgNotEqualOp::pools.empty() == false)
111358 : {
111359 : // Generate an array of memory pools
111360 620 : SgNotEqualOp** objectArray = (SgNotEqualOp**) &(SgNotEqualOp::pools[0]);
111361 :
111362 : // Build a local variable for better performance
111363 620 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
111364 : #if 0
111365 : // Iterate over the memory pools
111366 : for (unsigned int i=0; i < SgNotEqualOp::pools.size(); i++)
111367 : {
111368 : // objectArray[i] is a single memory pool
111369 : for (int j=0; j < SgNotEqualOp::pool_size; j++)
111370 : {
111371 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
111372 : {
111373 : traversal.visit(&(objectArray[i][j]));
111374 : }
111375 : }
111376 : }
111377 : #else
111378 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
111379 : // compute the list first and then call the visit function on each list element.
111380 :
111381 : // printf ("Inside of SgNotEqualOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
111382 :
111383 1240 : std::vector<SgNotEqualOp*> nodeList;
111384 :
111385 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
111386 1240 : for (unsigned int i=0; i < SgNotEqualOp::pools.size(); i++)
111387 : {
111388 : // objectArray[i] is a single memory pool
111389 1240620 : for (unsigned j=0; j < SgNotEqualOp::pool_size; j++)
111390 : {
111391 1240000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
111392 : {
111393 14947 : nodeList.push_back(&(objectArray[i][j]));
111394 : }
111395 : }
111396 : }
111397 :
111398 : // Iterate over the saved list
111399 620 : size_t nodeListSize = nodeList.size();
111400 15567 : for (size_t i=0; i < nodeListSize; i++)
111401 : {
111402 14947 : ROSE_ASSERT(nodeList[i] != NULL);
111403 : #if 0
111404 : traversal.visit(nodeList[i]);
111405 : #else
111406 14947 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
111407 : {
111408 14947 : traversal.visit(nodeList[i]);
111409 : }
111410 : #endif
111411 : }
111412 : #endif
111413 : }
111414 :
111415 : // This should not be required since all previously static data members are
111416 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
111417 :
111418 5342 : }
111419 :
111420 :
111421 : void
111422 194 : SgNotEqualOp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
111423 : {
111424 : // This function traverses the memory pool for an IR node and
111425 : // calls the function to execute the visitor object.
111426 :
111427 : // Initialize array to the address of the first element of the STL vector
111428 : // (which is guarenteed to be contiguous storage).
111429 : // SgNotEqualOp objectArray [] = *(Memory_Block_List.begin());
111430 194 : if (SgNotEqualOp::pools.empty() == false)
111431 : {
111432 : // Generate an array of memory pools
111433 137 : SgNotEqualOp** objectArray = (SgNotEqualOp**) &(SgNotEqualOp::pools[0]);
111434 :
111435 : // Build a local variable for better performance
111436 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
111437 :
111438 : // Iterate over the memory pools
111439 274 : for (unsigned int i=0; i < SgNotEqualOp::pools.size(); i++)
111440 : {
111441 : // objectArray[i] is a single memory pool
111442 274137 : for (unsigned j=0; j < SgNotEqualOp::pool_size; j++)
111443 : {
111444 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
111445 : {
111446 : // printf ("Found a valid SgNotEqualOp object in the memory pool %d at position %d \n",i,j);
111447 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
111448 14594 : objectArray[i][j].executeVisitorMemberFunction(visitor);
111449 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
111450 : }
111451 : else
111452 : {
111453 : // printf ("Found a INVALID SgNotEqualOp object in the memory pool \n");
111454 : }
111455 : }
111456 : }
111457 : }
111458 :
111459 : // This should not be required since all previously static data members are
111460 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
111461 :
111462 194 : }
111463 :
111464 : void
111465 0 : SgNotEqualOp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
111466 : {
111467 : // This function visits only a single IR node of the memory pool.
111468 : // it is typically called once for each type of IR node within
111469 : // the automatically generated function: traverseRepresentativeNodes().
111470 :
111471 : // Initialize array to the address of the first element of the STL vector
111472 : // (which is guarenteed to be contiguous storage).
111473 : // SgNotEqualOp objectArray [] = *(Memory_Block_List.begin());
111474 0 : if (SgNotEqualOp::pools.empty() == false)
111475 : {
111476 : // Generate an array of memory pools
111477 0 : SgNotEqualOp** objectArray = (SgNotEqualOp**) &(SgNotEqualOp::pools[0]);
111478 :
111479 : // Build a local variable for better performance
111480 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
111481 :
111482 : // Iterate over the memory pools
111483 0 : bool done = false;
111484 0 : unsigned i=0;
111485 :
111486 : // find the first valid IR node, call visit function, and then leave
111487 0 : while ( done == false && i < SgNotEqualOp::pools.size() )
111488 : {
111489 : // objectArray[i] is a single memory pool
111490 : unsigned j=0;
111491 0 : while (done == false && j < SgNotEqualOp::pool_size)
111492 : {
111493 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
111494 : {
111495 0 : traversal.visit(&(objectArray[i][j]));
111496 0 : done = true;
111497 : }
111498 0 : j++;
111499 : }
111500 0 : i++;
111501 : }
111502 :
111503 : #if 0
111504 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
111505 : if (done == false)
111506 : {
111507 : printf ("No representative for SgNotEqualOp found in memory pools \n");
111508 : }
111509 : #endif
111510 : }
111511 0 : }
111512 :
111513 :
111514 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
111515 : // using values that overflow signed values of int.
111516 : size_t
111517 4 : SgNotEqualOp::numberOfNodes()
111518 : {
111519 : // This function traverses the memory pool for an IR node and
111520 : // counts the number of IR nodes of a particular Sage III IR
111521 : // nodes type.
111522 :
111523 4 : size_t count = 0;
111524 4 : if (SgNotEqualOp::pools.empty() == false)
111525 : {
111526 : // Generate an array of memory pools (this is actually a STL vector,
111527 : // but it is contiguious, so OK to treat this way).
111528 1 : SgNotEqualOp** objectArray = (SgNotEqualOp**) &(SgNotEqualOp::pools[0]);
111529 :
111530 : // Build a local variable for better performance (make it a loop invariant variable).
111531 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
111532 :
111533 : // Iterate over all of the memory pools for this IR node.
111534 2 : for (unsigned int i=0; i < SgNotEqualOp::pools.size(); i++)
111535 : {
111536 : // objectArray[i] is a single memory pool, iterate over all the
111537 : // IR nodes and only count those that are valid IR nodes used in
111538 : // the AST (i.e. allocated IR nodes).
111539 2001 : for (unsigned j=0; j < SgNotEqualOp::pool_size; j++)
111540 : {
111541 : // This is indexing the STL vector of C/C++ style arrays as a doubly
111542 : // indexed array access. It is OK since we have leveraged the semantics
111543 : // of STL vector memory as contigous and cast the memory as an array
111544 : // of arrays to use the 2D array indexing. Hope this is not confusing,
111545 : // but it s very fast as an implementation.
111546 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
111547 : {
111548 95 : count++;
111549 : }
111550 : }
111551 : }
111552 : }
111553 :
111554 :
111555 :
111556 4 : return count;
111557 : }
111558 :
111559 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
111560 : // using values that overflow signed values of int.
111561 : size_t
111562 0 : SgNotEqualOp::memoryUsage()
111563 : {
111564 : // This function is required because we need the class name as a type when we call sizeof
111565 : // There might be another way to implement this if we have a traversal that only called a
111566 : // representative object (one call for each type of Sage IIIIR node).
111567 0 : size_t memory = numberOfNodes() * sizeof(SgNotEqualOp);
111568 :
111569 0 : return memory;
111570 : }
111571 :
111572 : /* #line 111573 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
111573 :
111574 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
111575 : void
111576 5342 : SgLessOrEqualOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
111577 : {
111578 : // This function traverses the memory pool for only a specific IR node
111579 : // and calls the visit function of the input class execute a traversal
111580 : // similar to the style of the attribute based traversals within ROSE.
111581 : // This traversal will visit ALL nodes of the AST where as the other
111582 : // attribute based traversals visit only the embedded tree within the AST.
111583 :
111584 : // Initialize array to the address of the first element of the STL vector
111585 : // (which is guaranteed to be contiguous storage).
111586 : // SgLessOrEqualOp objectArray [] = *(Memory_Block_List.begin());
111587 5342 : if (SgLessOrEqualOp::pools.empty() == false)
111588 : {
111589 : // Generate an array of memory pools
111590 587 : SgLessOrEqualOp** objectArray = (SgLessOrEqualOp**) &(SgLessOrEqualOp::pools[0]);
111591 :
111592 : // Build a local variable for better performance
111593 587 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
111594 : #if 0
111595 : // Iterate over the memory pools
111596 : for (unsigned int i=0; i < SgLessOrEqualOp::pools.size(); i++)
111597 : {
111598 : // objectArray[i] is a single memory pool
111599 : for (int j=0; j < SgLessOrEqualOp::pool_size; j++)
111600 : {
111601 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
111602 : {
111603 : traversal.visit(&(objectArray[i][j]));
111604 : }
111605 : }
111606 : }
111607 : #else
111608 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
111609 : // compute the list first and then call the visit function on each list element.
111610 :
111611 : // printf ("Inside of SgLessOrEqualOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
111612 :
111613 1174 : std::vector<SgLessOrEqualOp*> nodeList;
111614 :
111615 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
111616 1174 : for (unsigned int i=0; i < SgLessOrEqualOp::pools.size(); i++)
111617 : {
111618 : // objectArray[i] is a single memory pool
111619 1174590 : for (unsigned j=0; j < SgLessOrEqualOp::pool_size; j++)
111620 : {
111621 1174000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
111622 : {
111623 4549 : nodeList.push_back(&(objectArray[i][j]));
111624 : }
111625 : }
111626 : }
111627 :
111628 : // Iterate over the saved list
111629 587 : size_t nodeListSize = nodeList.size();
111630 5136 : for (size_t i=0; i < nodeListSize; i++)
111631 : {
111632 4549 : ROSE_ASSERT(nodeList[i] != NULL);
111633 : #if 0
111634 : traversal.visit(nodeList[i]);
111635 : #else
111636 4549 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
111637 : {
111638 4549 : traversal.visit(nodeList[i]);
111639 : }
111640 : #endif
111641 : }
111642 : #endif
111643 : }
111644 :
111645 : // This should not be required since all previously static data members are
111646 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
111647 :
111648 5342 : }
111649 :
111650 :
111651 : void
111652 194 : SgLessOrEqualOp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
111653 : {
111654 : // This function traverses the memory pool for an IR node and
111655 : // calls the function to execute the visitor object.
111656 :
111657 : // Initialize array to the address of the first element of the STL vector
111658 : // (which is guarenteed to be contiguous storage).
111659 : // SgLessOrEqualOp objectArray [] = *(Memory_Block_List.begin());
111660 194 : if (SgLessOrEqualOp::pools.empty() == false)
111661 : {
111662 : // Generate an array of memory pools
111663 186 : SgLessOrEqualOp** objectArray = (SgLessOrEqualOp**) &(SgLessOrEqualOp::pools[0]);
111664 :
111665 : // Build a local variable for better performance
111666 186 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
111667 :
111668 : // Iterate over the memory pools
111669 372 : for (unsigned int i=0; i < SgLessOrEqualOp::pools.size(); i++)
111670 : {
111671 : // objectArray[i] is a single memory pool
111672 372186 : for (unsigned j=0; j < SgLessOrEqualOp::pool_size; j++)
111673 : {
111674 372000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
111675 : {
111676 : // printf ("Found a valid SgLessOrEqualOp object in the memory pool %d at position %d \n",i,j);
111677 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
111678 4383 : objectArray[i][j].executeVisitorMemberFunction(visitor);
111679 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
111680 : }
111681 : else
111682 : {
111683 : // printf ("Found a INVALID SgLessOrEqualOp object in the memory pool \n");
111684 : }
111685 : }
111686 : }
111687 : }
111688 :
111689 : // This should not be required since all previously static data members are
111690 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
111691 :
111692 194 : }
111693 :
111694 : void
111695 0 : SgLessOrEqualOp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
111696 : {
111697 : // This function visits only a single IR node of the memory pool.
111698 : // it is typically called once for each type of IR node within
111699 : // the automatically generated function: traverseRepresentativeNodes().
111700 :
111701 : // Initialize array to the address of the first element of the STL vector
111702 : // (which is guarenteed to be contiguous storage).
111703 : // SgLessOrEqualOp objectArray [] = *(Memory_Block_List.begin());
111704 0 : if (SgLessOrEqualOp::pools.empty() == false)
111705 : {
111706 : // Generate an array of memory pools
111707 0 : SgLessOrEqualOp** objectArray = (SgLessOrEqualOp**) &(SgLessOrEqualOp::pools[0]);
111708 :
111709 : // Build a local variable for better performance
111710 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
111711 :
111712 : // Iterate over the memory pools
111713 0 : bool done = false;
111714 0 : unsigned i=0;
111715 :
111716 : // find the first valid IR node, call visit function, and then leave
111717 0 : while ( done == false && i < SgLessOrEqualOp::pools.size() )
111718 : {
111719 : // objectArray[i] is a single memory pool
111720 : unsigned j=0;
111721 0 : while (done == false && j < SgLessOrEqualOp::pool_size)
111722 : {
111723 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
111724 : {
111725 0 : traversal.visit(&(objectArray[i][j]));
111726 0 : done = true;
111727 : }
111728 0 : j++;
111729 : }
111730 0 : i++;
111731 : }
111732 :
111733 : #if 0
111734 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
111735 : if (done == false)
111736 : {
111737 : printf ("No representative for SgLessOrEqualOp found in memory pools \n");
111738 : }
111739 : #endif
111740 : }
111741 0 : }
111742 :
111743 :
111744 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
111745 : // using values that overflow signed values of int.
111746 : size_t
111747 4 : SgLessOrEqualOp::numberOfNodes()
111748 : {
111749 : // This function traverses the memory pool for an IR node and
111750 : // counts the number of IR nodes of a particular Sage III IR
111751 : // nodes type.
111752 :
111753 4 : size_t count = 0;
111754 4 : if (SgLessOrEqualOp::pools.empty() == false)
111755 : {
111756 : // Generate an array of memory pools (this is actually a STL vector,
111757 : // but it is contiguious, so OK to treat this way).
111758 1 : SgLessOrEqualOp** objectArray = (SgLessOrEqualOp**) &(SgLessOrEqualOp::pools[0]);
111759 :
111760 : // Build a local variable for better performance (make it a loop invariant variable).
111761 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
111762 :
111763 : // Iterate over all of the memory pools for this IR node.
111764 2 : for (unsigned int i=0; i < SgLessOrEqualOp::pools.size(); i++)
111765 : {
111766 : // objectArray[i] is a single memory pool, iterate over all the
111767 : // IR nodes and only count those that are valid IR nodes used in
111768 : // the AST (i.e. allocated IR nodes).
111769 2001 : for (unsigned j=0; j < SgLessOrEqualOp::pool_size; j++)
111770 : {
111771 : // This is indexing the STL vector of C/C++ style arrays as a doubly
111772 : // indexed array access. It is OK since we have leveraged the semantics
111773 : // of STL vector memory as contigous and cast the memory as an array
111774 : // of arrays to use the 2D array indexing. Hope this is not confusing,
111775 : // but it s very fast as an implementation.
111776 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
111777 : {
111778 31 : count++;
111779 : }
111780 : }
111781 : }
111782 : }
111783 :
111784 :
111785 :
111786 4 : return count;
111787 : }
111788 :
111789 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
111790 : // using values that overflow signed values of int.
111791 : size_t
111792 0 : SgLessOrEqualOp::memoryUsage()
111793 : {
111794 : // This function is required because we need the class name as a type when we call sizeof
111795 : // There might be another way to implement this if we have a traversal that only called a
111796 : // representative object (one call for each type of Sage IIIIR node).
111797 0 : size_t memory = numberOfNodes() * sizeof(SgLessOrEqualOp);
111798 :
111799 0 : return memory;
111800 : }
111801 :
111802 : /* #line 111803 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
111803 :
111804 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
111805 : void
111806 5342 : SgGreaterOrEqualOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
111807 : {
111808 : // This function traverses the memory pool for only a specific IR node
111809 : // and calls the visit function of the input class execute a traversal
111810 : // similar to the style of the attribute based traversals within ROSE.
111811 : // This traversal will visit ALL nodes of the AST where as the other
111812 : // attribute based traversals visit only the embedded tree within the AST.
111813 :
111814 : // Initialize array to the address of the first element of the STL vector
111815 : // (which is guaranteed to be contiguous storage).
111816 : // SgGreaterOrEqualOp objectArray [] = *(Memory_Block_List.begin());
111817 5342 : if (SgGreaterOrEqualOp::pools.empty() == false)
111818 : {
111819 : // Generate an array of memory pools
111820 363 : SgGreaterOrEqualOp** objectArray = (SgGreaterOrEqualOp**) &(SgGreaterOrEqualOp::pools[0]);
111821 :
111822 : // Build a local variable for better performance
111823 363 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
111824 : #if 0
111825 : // Iterate over the memory pools
111826 : for (unsigned int i=0; i < SgGreaterOrEqualOp::pools.size(); i++)
111827 : {
111828 : // objectArray[i] is a single memory pool
111829 : for (int j=0; j < SgGreaterOrEqualOp::pool_size; j++)
111830 : {
111831 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
111832 : {
111833 : traversal.visit(&(objectArray[i][j]));
111834 : }
111835 : }
111836 : }
111837 : #else
111838 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
111839 : // compute the list first and then call the visit function on each list element.
111840 :
111841 : // printf ("Inside of SgGreaterOrEqualOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
111842 :
111843 726 : std::vector<SgGreaterOrEqualOp*> nodeList;
111844 :
111845 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
111846 726 : for (unsigned int i=0; i < SgGreaterOrEqualOp::pools.size(); i++)
111847 : {
111848 : // objectArray[i] is a single memory pool
111849 726363 : for (unsigned j=0; j < SgGreaterOrEqualOp::pool_size; j++)
111850 : {
111851 726000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
111852 : {
111853 3945 : nodeList.push_back(&(objectArray[i][j]));
111854 : }
111855 : }
111856 : }
111857 :
111858 : // Iterate over the saved list
111859 363 : size_t nodeListSize = nodeList.size();
111860 4308 : for (size_t i=0; i < nodeListSize; i++)
111861 : {
111862 3945 : ROSE_ASSERT(nodeList[i] != NULL);
111863 : #if 0
111864 : traversal.visit(nodeList[i]);
111865 : #else
111866 3945 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
111867 : {
111868 3945 : traversal.visit(nodeList[i]);
111869 : }
111870 : #endif
111871 : }
111872 : #endif
111873 : }
111874 :
111875 : // This should not be required since all previously static data members are
111876 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
111877 :
111878 5342 : }
111879 :
111880 :
111881 : void
111882 194 : SgGreaterOrEqualOp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
111883 : {
111884 : // This function traverses the memory pool for an IR node and
111885 : // calls the function to execute the visitor object.
111886 :
111887 : // Initialize array to the address of the first element of the STL vector
111888 : // (which is guarenteed to be contiguous storage).
111889 : // SgGreaterOrEqualOp objectArray [] = *(Memory_Block_List.begin());
111890 194 : if (SgGreaterOrEqualOp::pools.empty() == false)
111891 : {
111892 : // Generate an array of memory pools
111893 150 : SgGreaterOrEqualOp** objectArray = (SgGreaterOrEqualOp**) &(SgGreaterOrEqualOp::pools[0]);
111894 :
111895 : // Build a local variable for better performance
111896 150 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
111897 :
111898 : // Iterate over the memory pools
111899 300 : for (unsigned int i=0; i < SgGreaterOrEqualOp::pools.size(); i++)
111900 : {
111901 : // objectArray[i] is a single memory pool
111902 300150 : for (unsigned j=0; j < SgGreaterOrEqualOp::pool_size; j++)
111903 : {
111904 300000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
111905 : {
111906 : // printf ("Found a valid SgGreaterOrEqualOp object in the memory pool %d at position %d \n",i,j);
111907 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
111908 4068 : objectArray[i][j].executeVisitorMemberFunction(visitor);
111909 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
111910 : }
111911 : else
111912 : {
111913 : // printf ("Found a INVALID SgGreaterOrEqualOp object in the memory pool \n");
111914 : }
111915 : }
111916 : }
111917 : }
111918 :
111919 : // This should not be required since all previously static data members are
111920 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
111921 :
111922 194 : }
111923 :
111924 : void
111925 0 : SgGreaterOrEqualOp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
111926 : {
111927 : // This function visits only a single IR node of the memory pool.
111928 : // it is typically called once for each type of IR node within
111929 : // the automatically generated function: traverseRepresentativeNodes().
111930 :
111931 : // Initialize array to the address of the first element of the STL vector
111932 : // (which is guarenteed to be contiguous storage).
111933 : // SgGreaterOrEqualOp objectArray [] = *(Memory_Block_List.begin());
111934 0 : if (SgGreaterOrEqualOp::pools.empty() == false)
111935 : {
111936 : // Generate an array of memory pools
111937 0 : SgGreaterOrEqualOp** objectArray = (SgGreaterOrEqualOp**) &(SgGreaterOrEqualOp::pools[0]);
111938 :
111939 : // Build a local variable for better performance
111940 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
111941 :
111942 : // Iterate over the memory pools
111943 0 : bool done = false;
111944 0 : unsigned i=0;
111945 :
111946 : // find the first valid IR node, call visit function, and then leave
111947 0 : while ( done == false && i < SgGreaterOrEqualOp::pools.size() )
111948 : {
111949 : // objectArray[i] is a single memory pool
111950 : unsigned j=0;
111951 0 : while (done == false && j < SgGreaterOrEqualOp::pool_size)
111952 : {
111953 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
111954 : {
111955 0 : traversal.visit(&(objectArray[i][j]));
111956 0 : done = true;
111957 : }
111958 0 : j++;
111959 : }
111960 0 : i++;
111961 : }
111962 :
111963 : #if 0
111964 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
111965 : if (done == false)
111966 : {
111967 : printf ("No representative for SgGreaterOrEqualOp found in memory pools \n");
111968 : }
111969 : #endif
111970 : }
111971 0 : }
111972 :
111973 :
111974 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
111975 : // using values that overflow signed values of int.
111976 : size_t
111977 4 : SgGreaterOrEqualOp::numberOfNodes()
111978 : {
111979 : // This function traverses the memory pool for an IR node and
111980 : // counts the number of IR nodes of a particular Sage III IR
111981 : // nodes type.
111982 :
111983 4 : size_t count = 0;
111984 4 : if (SgGreaterOrEqualOp::pools.empty() == false)
111985 : {
111986 : // Generate an array of memory pools (this is actually a STL vector,
111987 : // but it is contiguious, so OK to treat this way).
111988 1 : SgGreaterOrEqualOp** objectArray = (SgGreaterOrEqualOp**) &(SgGreaterOrEqualOp::pools[0]);
111989 :
111990 : // Build a local variable for better performance (make it a loop invariant variable).
111991 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
111992 :
111993 : // Iterate over all of the memory pools for this IR node.
111994 2 : for (unsigned int i=0; i < SgGreaterOrEqualOp::pools.size(); i++)
111995 : {
111996 : // objectArray[i] is a single memory pool, iterate over all the
111997 : // IR nodes and only count those that are valid IR nodes used in
111998 : // the AST (i.e. allocated IR nodes).
111999 2001 : for (unsigned j=0; j < SgGreaterOrEqualOp::pool_size; j++)
112000 : {
112001 : // This is indexing the STL vector of C/C++ style arrays as a doubly
112002 : // indexed array access. It is OK since we have leveraged the semantics
112003 : // of STL vector memory as contigous and cast the memory as an array
112004 : // of arrays to use the 2D array indexing. Hope this is not confusing,
112005 : // but it s very fast as an implementation.
112006 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
112007 : {
112008 28 : count++;
112009 : }
112010 : }
112011 : }
112012 : }
112013 :
112014 :
112015 :
112016 4 : return count;
112017 : }
112018 :
112019 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
112020 : // using values that overflow signed values of int.
112021 : size_t
112022 0 : SgGreaterOrEqualOp::memoryUsage()
112023 : {
112024 : // This function is required because we need the class name as a type when we call sizeof
112025 : // There might be another way to implement this if we have a traversal that only called a
112026 : // representative object (one call for each type of Sage IIIIR node).
112027 0 : size_t memory = numberOfNodes() * sizeof(SgGreaterOrEqualOp);
112028 :
112029 0 : return memory;
112030 : }
112031 :
112032 : /* #line 112033 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
112033 :
112034 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
112035 : void
112036 5342 : SgAddOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
112037 : {
112038 : // This function traverses the memory pool for only a specific IR node
112039 : // and calls the visit function of the input class execute a traversal
112040 : // similar to the style of the attribute based traversals within ROSE.
112041 : // This traversal will visit ALL nodes of the AST where as the other
112042 : // attribute based traversals visit only the embedded tree within the AST.
112043 :
112044 : // Initialize array to the address of the first element of the STL vector
112045 : // (which is guaranteed to be contiguous storage).
112046 : // SgAddOp objectArray [] = *(Memory_Block_List.begin());
112047 5342 : if (SgAddOp::pools.empty() == false)
112048 : {
112049 : // Generate an array of memory pools
112050 1829 : SgAddOp** objectArray = (SgAddOp**) &(SgAddOp::pools[0]);
112051 :
112052 : // Build a local variable for better performance
112053 1829 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
112054 : #if 0
112055 : // Iterate over the memory pools
112056 : for (unsigned int i=0; i < SgAddOp::pools.size(); i++)
112057 : {
112058 : // objectArray[i] is a single memory pool
112059 : for (int j=0; j < SgAddOp::pool_size; j++)
112060 : {
112061 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
112062 : {
112063 : traversal.visit(&(objectArray[i][j]));
112064 : }
112065 : }
112066 : }
112067 : #else
112068 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
112069 : // compute the list first and then call the visit function on each list element.
112070 :
112071 : // printf ("Inside of SgAddOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
112072 :
112073 3658 : std::vector<SgAddOp*> nodeList;
112074 :
112075 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
112076 3658 : for (unsigned int i=0; i < SgAddOp::pools.size(); i++)
112077 : {
112078 : // objectArray[i] is a single memory pool
112079 3659830 : for (unsigned j=0; j < SgAddOp::pool_size; j++)
112080 : {
112081 3658000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
112082 : {
112083 34330 : nodeList.push_back(&(objectArray[i][j]));
112084 : }
112085 : }
112086 : }
112087 :
112088 : // Iterate over the saved list
112089 1829 : size_t nodeListSize = nodeList.size();
112090 36159 : for (size_t i=0; i < nodeListSize; i++)
112091 : {
112092 34330 : ROSE_ASSERT(nodeList[i] != NULL);
112093 : #if 0
112094 : traversal.visit(nodeList[i]);
112095 : #else
112096 34330 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
112097 : {
112098 34330 : traversal.visit(nodeList[i]);
112099 : }
112100 : #endif
112101 : }
112102 : #endif
112103 : }
112104 :
112105 : // This should not be required since all previously static data members are
112106 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
112107 :
112108 5342 : }
112109 :
112110 :
112111 : void
112112 194 : SgAddOp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
112113 : {
112114 : // This function traverses the memory pool for an IR node and
112115 : // calls the function to execute the visitor object.
112116 :
112117 : // Initialize array to the address of the first element of the STL vector
112118 : // (which is guarenteed to be contiguous storage).
112119 : // SgAddOp objectArray [] = *(Memory_Block_List.begin());
112120 194 : if (SgAddOp::pools.empty() == false)
112121 : {
112122 : // Generate an array of memory pools
112123 192 : SgAddOp** objectArray = (SgAddOp**) &(SgAddOp::pools[0]);
112124 :
112125 : // Build a local variable for better performance
112126 192 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
112127 :
112128 : // Iterate over the memory pools
112129 384 : for (unsigned int i=0; i < SgAddOp::pools.size(); i++)
112130 : {
112131 : // objectArray[i] is a single memory pool
112132 384192 : for (unsigned j=0; j < SgAddOp::pool_size; j++)
112133 : {
112134 384000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
112135 : {
112136 : // printf ("Found a valid SgAddOp object in the memory pool %d at position %d \n",i,j);
112137 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
112138 27993 : objectArray[i][j].executeVisitorMemberFunction(visitor);
112139 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
112140 : }
112141 : else
112142 : {
112143 : // printf ("Found a INVALID SgAddOp object in the memory pool \n");
112144 : }
112145 : }
112146 : }
112147 : }
112148 :
112149 : // This should not be required since all previously static data members are
112150 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
112151 :
112152 194 : }
112153 :
112154 : void
112155 0 : SgAddOp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
112156 : {
112157 : // This function visits only a single IR node of the memory pool.
112158 : // it is typically called once for each type of IR node within
112159 : // the automatically generated function: traverseRepresentativeNodes().
112160 :
112161 : // Initialize array to the address of the first element of the STL vector
112162 : // (which is guarenteed to be contiguous storage).
112163 : // SgAddOp objectArray [] = *(Memory_Block_List.begin());
112164 0 : if (SgAddOp::pools.empty() == false)
112165 : {
112166 : // Generate an array of memory pools
112167 0 : SgAddOp** objectArray = (SgAddOp**) &(SgAddOp::pools[0]);
112168 :
112169 : // Build a local variable for better performance
112170 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
112171 :
112172 : // Iterate over the memory pools
112173 0 : bool done = false;
112174 0 : unsigned i=0;
112175 :
112176 : // find the first valid IR node, call visit function, and then leave
112177 0 : while ( done == false && i < SgAddOp::pools.size() )
112178 : {
112179 : // objectArray[i] is a single memory pool
112180 : unsigned j=0;
112181 0 : while (done == false && j < SgAddOp::pool_size)
112182 : {
112183 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
112184 : {
112185 0 : traversal.visit(&(objectArray[i][j]));
112186 0 : done = true;
112187 : }
112188 0 : j++;
112189 : }
112190 0 : i++;
112191 : }
112192 :
112193 : #if 0
112194 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
112195 : if (done == false)
112196 : {
112197 : printf ("No representative for SgAddOp found in memory pools \n");
112198 : }
112199 : #endif
112200 : }
112201 0 : }
112202 :
112203 :
112204 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
112205 : // using values that overflow signed values of int.
112206 : size_t
112207 4 : SgAddOp::numberOfNodes()
112208 : {
112209 : // This function traverses the memory pool for an IR node and
112210 : // counts the number of IR nodes of a particular Sage III IR
112211 : // nodes type.
112212 :
112213 4 : size_t count = 0;
112214 4 : if (SgAddOp::pools.empty() == false)
112215 : {
112216 : // Generate an array of memory pools (this is actually a STL vector,
112217 : // but it is contiguious, so OK to treat this way).
112218 2 : SgAddOp** objectArray = (SgAddOp**) &(SgAddOp::pools[0]);
112219 :
112220 : // Build a local variable for better performance (make it a loop invariant variable).
112221 2 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
112222 :
112223 : // Iterate over all of the memory pools for this IR node.
112224 4 : for (unsigned int i=0; i < SgAddOp::pools.size(); i++)
112225 : {
112226 : // objectArray[i] is a single memory pool, iterate over all the
112227 : // IR nodes and only count those that are valid IR nodes used in
112228 : // the AST (i.e. allocated IR nodes).
112229 4002 : for (unsigned j=0; j < SgAddOp::pool_size; j++)
112230 : {
112231 : // This is indexing the STL vector of C/C++ style arrays as a doubly
112232 : // indexed array access. It is OK since we have leveraged the semantics
112233 : // of STL vector memory as contigous and cast the memory as an array
112234 : // of arrays to use the 2D array indexing. Hope this is not confusing,
112235 : // but it s very fast as an implementation.
112236 4000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
112237 : {
112238 192 : count++;
112239 : }
112240 : }
112241 : }
112242 : }
112243 :
112244 :
112245 :
112246 4 : return count;
112247 : }
112248 :
112249 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
112250 : // using values that overflow signed values of int.
112251 : size_t
112252 0 : SgAddOp::memoryUsage()
112253 : {
112254 : // This function is required because we need the class name as a type when we call sizeof
112255 : // There might be another way to implement this if we have a traversal that only called a
112256 : // representative object (one call for each type of Sage IIIIR node).
112257 0 : size_t memory = numberOfNodes() * sizeof(SgAddOp);
112258 :
112259 0 : return memory;
112260 : }
112261 :
112262 : /* #line 112263 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
112263 :
112264 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
112265 : void
112266 5342 : SgSubtractOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
112267 : {
112268 : // This function traverses the memory pool for only a specific IR node
112269 : // and calls the visit function of the input class execute a traversal
112270 : // similar to the style of the attribute based traversals within ROSE.
112271 : // This traversal will visit ALL nodes of the AST where as the other
112272 : // attribute based traversals visit only the embedded tree within the AST.
112273 :
112274 : // Initialize array to the address of the first element of the STL vector
112275 : // (which is guaranteed to be contiguous storage).
112276 : // SgSubtractOp objectArray [] = *(Memory_Block_List.begin());
112277 5342 : if (SgSubtractOp::pools.empty() == false)
112278 : {
112279 : // Generate an array of memory pools
112280 2735 : SgSubtractOp** objectArray = (SgSubtractOp**) &(SgSubtractOp::pools[0]);
112281 :
112282 : // Build a local variable for better performance
112283 2735 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
112284 : #if 0
112285 : // Iterate over the memory pools
112286 : for (unsigned int i=0; i < SgSubtractOp::pools.size(); i++)
112287 : {
112288 : // objectArray[i] is a single memory pool
112289 : for (int j=0; j < SgSubtractOp::pool_size; j++)
112290 : {
112291 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
112292 : {
112293 : traversal.visit(&(objectArray[i][j]));
112294 : }
112295 : }
112296 : }
112297 : #else
112298 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
112299 : // compute the list first and then call the visit function on each list element.
112300 :
112301 : // printf ("Inside of SgSubtractOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
112302 :
112303 5470 : std::vector<SgSubtractOp*> nodeList;
112304 :
112305 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
112306 5470 : for (unsigned int i=0; i < SgSubtractOp::pools.size(); i++)
112307 : {
112308 : // objectArray[i] is a single memory pool
112309 5472740 : for (unsigned j=0; j < SgSubtractOp::pool_size; j++)
112310 : {
112311 5470000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
112312 : {
112313 37215 : nodeList.push_back(&(objectArray[i][j]));
112314 : }
112315 : }
112316 : }
112317 :
112318 : // Iterate over the saved list
112319 2735 : size_t nodeListSize = nodeList.size();
112320 39950 : for (size_t i=0; i < nodeListSize; i++)
112321 : {
112322 37215 : ROSE_ASSERT(nodeList[i] != NULL);
112323 : #if 0
112324 : traversal.visit(nodeList[i]);
112325 : #else
112326 37215 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
112327 : {
112328 37215 : traversal.visit(nodeList[i]);
112329 : }
112330 : #endif
112331 : }
112332 : #endif
112333 : }
112334 :
112335 : // This should not be required since all previously static data members are
112336 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
112337 :
112338 5342 : }
112339 :
112340 :
112341 : void
112342 194 : SgSubtractOp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
112343 : {
112344 : // This function traverses the memory pool for an IR node and
112345 : // calls the function to execute the visitor object.
112346 :
112347 : // Initialize array to the address of the first element of the STL vector
112348 : // (which is guarenteed to be contiguous storage).
112349 : // SgSubtractOp objectArray [] = *(Memory_Block_List.begin());
112350 194 : if (SgSubtractOp::pools.empty() == false)
112351 : {
112352 : // Generate an array of memory pools
112353 188 : SgSubtractOp** objectArray = (SgSubtractOp**) &(SgSubtractOp::pools[0]);
112354 :
112355 : // Build a local variable for better performance
112356 188 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
112357 :
112358 : // Iterate over the memory pools
112359 376 : for (unsigned int i=0; i < SgSubtractOp::pools.size(); i++)
112360 : {
112361 : // objectArray[i] is a single memory pool
112362 376188 : for (unsigned j=0; j < SgSubtractOp::pool_size; j++)
112363 : {
112364 376000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
112365 : {
112366 : // printf ("Found a valid SgSubtractOp object in the memory pool %d at position %d \n",i,j);
112367 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
112368 30246 : objectArray[i][j].executeVisitorMemberFunction(visitor);
112369 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
112370 : }
112371 : else
112372 : {
112373 : // printf ("Found a INVALID SgSubtractOp object in the memory pool \n");
112374 : }
112375 : }
112376 : }
112377 : }
112378 :
112379 : // This should not be required since all previously static data members are
112380 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
112381 :
112382 194 : }
112383 :
112384 : void
112385 0 : SgSubtractOp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
112386 : {
112387 : // This function visits only a single IR node of the memory pool.
112388 : // it is typically called once for each type of IR node within
112389 : // the automatically generated function: traverseRepresentativeNodes().
112390 :
112391 : // Initialize array to the address of the first element of the STL vector
112392 : // (which is guarenteed to be contiguous storage).
112393 : // SgSubtractOp objectArray [] = *(Memory_Block_List.begin());
112394 0 : if (SgSubtractOp::pools.empty() == false)
112395 : {
112396 : // Generate an array of memory pools
112397 0 : SgSubtractOp** objectArray = (SgSubtractOp**) &(SgSubtractOp::pools[0]);
112398 :
112399 : // Build a local variable for better performance
112400 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
112401 :
112402 : // Iterate over the memory pools
112403 0 : bool done = false;
112404 0 : unsigned i=0;
112405 :
112406 : // find the first valid IR node, call visit function, and then leave
112407 0 : while ( done == false && i < SgSubtractOp::pools.size() )
112408 : {
112409 : // objectArray[i] is a single memory pool
112410 : unsigned j=0;
112411 0 : while (done == false && j < SgSubtractOp::pool_size)
112412 : {
112413 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
112414 : {
112415 0 : traversal.visit(&(objectArray[i][j]));
112416 0 : done = true;
112417 : }
112418 0 : j++;
112419 : }
112420 0 : i++;
112421 : }
112422 :
112423 : #if 0
112424 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
112425 : if (done == false)
112426 : {
112427 : printf ("No representative for SgSubtractOp found in memory pools \n");
112428 : }
112429 : #endif
112430 : }
112431 0 : }
112432 :
112433 :
112434 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
112435 : // using values that overflow signed values of int.
112436 : size_t
112437 4 : SgSubtractOp::numberOfNodes()
112438 : {
112439 : // This function traverses the memory pool for an IR node and
112440 : // counts the number of IR nodes of a particular Sage III IR
112441 : // nodes type.
112442 :
112443 4 : size_t count = 0;
112444 4 : if (SgSubtractOp::pools.empty() == false)
112445 : {
112446 : // Generate an array of memory pools (this is actually a STL vector,
112447 : // but it is contiguious, so OK to treat this way).
112448 2 : SgSubtractOp** objectArray = (SgSubtractOp**) &(SgSubtractOp::pools[0]);
112449 :
112450 : // Build a local variable for better performance (make it a loop invariant variable).
112451 2 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
112452 :
112453 : // Iterate over all of the memory pools for this IR node.
112454 4 : for (unsigned int i=0; i < SgSubtractOp::pools.size(); i++)
112455 : {
112456 : // objectArray[i] is a single memory pool, iterate over all the
112457 : // IR nodes and only count those that are valid IR nodes used in
112458 : // the AST (i.e. allocated IR nodes).
112459 4002 : for (unsigned j=0; j < SgSubtractOp::pool_size; j++)
112460 : {
112461 : // This is indexing the STL vector of C/C++ style arrays as a doubly
112462 : // indexed array access. It is OK since we have leveraged the semantics
112463 : // of STL vector memory as contigous and cast the memory as an array
112464 : // of arrays to use the 2D array indexing. Hope this is not confusing,
112465 : // but it s very fast as an implementation.
112466 4000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
112467 : {
112468 211 : count++;
112469 : }
112470 : }
112471 : }
112472 : }
112473 :
112474 :
112475 :
112476 4 : return count;
112477 : }
112478 :
112479 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
112480 : // using values that overflow signed values of int.
112481 : size_t
112482 0 : SgSubtractOp::memoryUsage()
112483 : {
112484 : // This function is required because we need the class name as a type when we call sizeof
112485 : // There might be another way to implement this if we have a traversal that only called a
112486 : // representative object (one call for each type of Sage IIIIR node).
112487 0 : size_t memory = numberOfNodes() * sizeof(SgSubtractOp);
112488 :
112489 0 : return memory;
112490 : }
112491 :
112492 : /* #line 112493 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
112493 :
112494 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
112495 : void
112496 5342 : SgMultiplyOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
112497 : {
112498 : // This function traverses the memory pool for only a specific IR node
112499 : // and calls the visit function of the input class execute a traversal
112500 : // similar to the style of the attribute based traversals within ROSE.
112501 : // This traversal will visit ALL nodes of the AST where as the other
112502 : // attribute based traversals visit only the embedded tree within the AST.
112503 :
112504 : // Initialize array to the address of the first element of the STL vector
112505 : // (which is guaranteed to be contiguous storage).
112506 : // SgMultiplyOp objectArray [] = *(Memory_Block_List.begin());
112507 5342 : if (SgMultiplyOp::pools.empty() == false)
112508 : {
112509 : // Generate an array of memory pools
112510 3156 : SgMultiplyOp** objectArray = (SgMultiplyOp**) &(SgMultiplyOp::pools[0]);
112511 :
112512 : // Build a local variable for better performance
112513 3156 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
112514 : #if 0
112515 : // Iterate over the memory pools
112516 : for (unsigned int i=0; i < SgMultiplyOp::pools.size(); i++)
112517 : {
112518 : // objectArray[i] is a single memory pool
112519 : for (int j=0; j < SgMultiplyOp::pool_size; j++)
112520 : {
112521 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
112522 : {
112523 : traversal.visit(&(objectArray[i][j]));
112524 : }
112525 : }
112526 : }
112527 : #else
112528 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
112529 : // compute the list first and then call the visit function on each list element.
112530 :
112531 : // printf ("Inside of SgMultiplyOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
112532 :
112533 6312 : std::vector<SgMultiplyOp*> nodeList;
112534 :
112535 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
112536 6312 : for (unsigned int i=0; i < SgMultiplyOp::pools.size(); i++)
112537 : {
112538 : // objectArray[i] is a single memory pool
112539 6315160 : for (unsigned j=0; j < SgMultiplyOp::pool_size; j++)
112540 : {
112541 6312000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
112542 : {
112543 26250 : nodeList.push_back(&(objectArray[i][j]));
112544 : }
112545 : }
112546 : }
112547 :
112548 : // Iterate over the saved list
112549 3156 : size_t nodeListSize = nodeList.size();
112550 29406 : for (size_t i=0; i < nodeListSize; i++)
112551 : {
112552 26250 : ROSE_ASSERT(nodeList[i] != NULL);
112553 : #if 0
112554 : traversal.visit(nodeList[i]);
112555 : #else
112556 26250 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
112557 : {
112558 26250 : traversal.visit(nodeList[i]);
112559 : }
112560 : #endif
112561 : }
112562 : #endif
112563 : }
112564 :
112565 : // This should not be required since all previously static data members are
112566 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
112567 :
112568 5342 : }
112569 :
112570 :
112571 : void
112572 194 : SgMultiplyOp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
112573 : {
112574 : // This function traverses the memory pool for an IR node and
112575 : // calls the function to execute the visitor object.
112576 :
112577 : // Initialize array to the address of the first element of the STL vector
112578 : // (which is guarenteed to be contiguous storage).
112579 : // SgMultiplyOp objectArray [] = *(Memory_Block_List.begin());
112580 194 : if (SgMultiplyOp::pools.empty() == false)
112581 : {
112582 : // Generate an array of memory pools
112583 173 : SgMultiplyOp** objectArray = (SgMultiplyOp**) &(SgMultiplyOp::pools[0]);
112584 :
112585 : // Build a local variable for better performance
112586 173 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
112587 :
112588 : // Iterate over the memory pools
112589 346 : for (unsigned int i=0; i < SgMultiplyOp::pools.size(); i++)
112590 : {
112591 : // objectArray[i] is a single memory pool
112592 346173 : for (unsigned j=0; j < SgMultiplyOp::pool_size; j++)
112593 : {
112594 346000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
112595 : {
112596 : // printf ("Found a valid SgMultiplyOp object in the memory pool %d at position %d \n",i,j);
112597 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
112598 8899 : objectArray[i][j].executeVisitorMemberFunction(visitor);
112599 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
112600 : }
112601 : else
112602 : {
112603 : // printf ("Found a INVALID SgMultiplyOp object in the memory pool \n");
112604 : }
112605 : }
112606 : }
112607 : }
112608 :
112609 : // This should not be required since all previously static data members are
112610 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
112611 :
112612 194 : }
112613 :
112614 : void
112615 0 : SgMultiplyOp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
112616 : {
112617 : // This function visits only a single IR node of the memory pool.
112618 : // it is typically called once for each type of IR node within
112619 : // the automatically generated function: traverseRepresentativeNodes().
112620 :
112621 : // Initialize array to the address of the first element of the STL vector
112622 : // (which is guarenteed to be contiguous storage).
112623 : // SgMultiplyOp objectArray [] = *(Memory_Block_List.begin());
112624 0 : if (SgMultiplyOp::pools.empty() == false)
112625 : {
112626 : // Generate an array of memory pools
112627 0 : SgMultiplyOp** objectArray = (SgMultiplyOp**) &(SgMultiplyOp::pools[0]);
112628 :
112629 : // Build a local variable for better performance
112630 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
112631 :
112632 : // Iterate over the memory pools
112633 0 : bool done = false;
112634 0 : unsigned i=0;
112635 :
112636 : // find the first valid IR node, call visit function, and then leave
112637 0 : while ( done == false && i < SgMultiplyOp::pools.size() )
112638 : {
112639 : // objectArray[i] is a single memory pool
112640 : unsigned j=0;
112641 0 : while (done == false && j < SgMultiplyOp::pool_size)
112642 : {
112643 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
112644 : {
112645 0 : traversal.visit(&(objectArray[i][j]));
112646 0 : done = true;
112647 : }
112648 0 : j++;
112649 : }
112650 0 : i++;
112651 : }
112652 :
112653 : #if 0
112654 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
112655 : if (done == false)
112656 : {
112657 : printf ("No representative for SgMultiplyOp found in memory pools \n");
112658 : }
112659 : #endif
112660 : }
112661 0 : }
112662 :
112663 :
112664 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
112665 : // using values that overflow signed values of int.
112666 : size_t
112667 4 : SgMultiplyOp::numberOfNodes()
112668 : {
112669 : // This function traverses the memory pool for an IR node and
112670 : // counts the number of IR nodes of a particular Sage III IR
112671 : // nodes type.
112672 :
112673 4 : size_t count = 0;
112674 4 : if (SgMultiplyOp::pools.empty() == false)
112675 : {
112676 : // Generate an array of memory pools (this is actually a STL vector,
112677 : // but it is contiguious, so OK to treat this way).
112678 2 : SgMultiplyOp** objectArray = (SgMultiplyOp**) &(SgMultiplyOp::pools[0]);
112679 :
112680 : // Build a local variable for better performance (make it a loop invariant variable).
112681 2 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
112682 :
112683 : // Iterate over all of the memory pools for this IR node.
112684 4 : for (unsigned int i=0; i < SgMultiplyOp::pools.size(); i++)
112685 : {
112686 : // objectArray[i] is a single memory pool, iterate over all the
112687 : // IR nodes and only count those that are valid IR nodes used in
112688 : // the AST (i.e. allocated IR nodes).
112689 4002 : for (unsigned j=0; j < SgMultiplyOp::pool_size; j++)
112690 : {
112691 : // This is indexing the STL vector of C/C++ style arrays as a doubly
112692 : // indexed array access. It is OK since we have leveraged the semantics
112693 : // of STL vector memory as contigous and cast the memory as an array
112694 : // of arrays to use the 2D array indexing. Hope this is not confusing,
112695 : // but it s very fast as an implementation.
112696 4000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
112697 : {
112698 65 : count++;
112699 : }
112700 : }
112701 : }
112702 : }
112703 :
112704 :
112705 :
112706 4 : return count;
112707 : }
112708 :
112709 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
112710 : // using values that overflow signed values of int.
112711 : size_t
112712 0 : SgMultiplyOp::memoryUsage()
112713 : {
112714 : // This function is required because we need the class name as a type when we call sizeof
112715 : // There might be another way to implement this if we have a traversal that only called a
112716 : // representative object (one call for each type of Sage IIIIR node).
112717 0 : size_t memory = numberOfNodes() * sizeof(SgMultiplyOp);
112718 :
112719 0 : return memory;
112720 : }
112721 :
112722 : /* #line 112723 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
112723 :
112724 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
112725 : void
112726 5342 : SgDivideOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
112727 : {
112728 : // This function traverses the memory pool for only a specific IR node
112729 : // and calls the visit function of the input class execute a traversal
112730 : // similar to the style of the attribute based traversals within ROSE.
112731 : // This traversal will visit ALL nodes of the AST where as the other
112732 : // attribute based traversals visit only the embedded tree within the AST.
112733 :
112734 : // Initialize array to the address of the first element of the STL vector
112735 : // (which is guaranteed to be contiguous storage).
112736 : // SgDivideOp objectArray [] = *(Memory_Block_List.begin());
112737 5342 : if (SgDivideOp::pools.empty() == false)
112738 : {
112739 : // Generate an array of memory pools
112740 2753 : SgDivideOp** objectArray = (SgDivideOp**) &(SgDivideOp::pools[0]);
112741 :
112742 : // Build a local variable for better performance
112743 2753 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
112744 : #if 0
112745 : // Iterate over the memory pools
112746 : for (unsigned int i=0; i < SgDivideOp::pools.size(); i++)
112747 : {
112748 : // objectArray[i] is a single memory pool
112749 : for (int j=0; j < SgDivideOp::pool_size; j++)
112750 : {
112751 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
112752 : {
112753 : traversal.visit(&(objectArray[i][j]));
112754 : }
112755 : }
112756 : }
112757 : #else
112758 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
112759 : // compute the list first and then call the visit function on each list element.
112760 :
112761 : // printf ("Inside of SgDivideOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
112762 :
112763 5506 : std::vector<SgDivideOp*> nodeList;
112764 :
112765 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
112766 5506 : for (unsigned int i=0; i < SgDivideOp::pools.size(); i++)
112767 : {
112768 : // objectArray[i] is a single memory pool
112769 5508750 : for (unsigned j=0; j < SgDivideOp::pool_size; j++)
112770 : {
112771 5506000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
112772 : {
112773 14497 : nodeList.push_back(&(objectArray[i][j]));
112774 : }
112775 : }
112776 : }
112777 :
112778 : // Iterate over the saved list
112779 2753 : size_t nodeListSize = nodeList.size();
112780 17250 : for (size_t i=0; i < nodeListSize; i++)
112781 : {
112782 14497 : ROSE_ASSERT(nodeList[i] != NULL);
112783 : #if 0
112784 : traversal.visit(nodeList[i]);
112785 : #else
112786 14497 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
112787 : {
112788 14497 : traversal.visit(nodeList[i]);
112789 : }
112790 : #endif
112791 : }
112792 : #endif
112793 : }
112794 :
112795 : // This should not be required since all previously static data members are
112796 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
112797 :
112798 5342 : }
112799 :
112800 :
112801 : void
112802 194 : SgDivideOp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
112803 : {
112804 : // This function traverses the memory pool for an IR node and
112805 : // calls the function to execute the visitor object.
112806 :
112807 : // Initialize array to the address of the first element of the STL vector
112808 : // (which is guarenteed to be contiguous storage).
112809 : // SgDivideOp objectArray [] = *(Memory_Block_List.begin());
112810 194 : if (SgDivideOp::pools.empty() == false)
112811 : {
112812 : // Generate an array of memory pools
112813 170 : SgDivideOp** objectArray = (SgDivideOp**) &(SgDivideOp::pools[0]);
112814 :
112815 : // Build a local variable for better performance
112816 170 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
112817 :
112818 : // Iterate over the memory pools
112819 340 : for (unsigned int i=0; i < SgDivideOp::pools.size(); i++)
112820 : {
112821 : // objectArray[i] is a single memory pool
112822 340170 : for (unsigned j=0; j < SgDivideOp::pool_size; j++)
112823 : {
112824 340000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
112825 : {
112826 : // printf ("Found a valid SgDivideOp object in the memory pool %d at position %d \n",i,j);
112827 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
112828 5351 : objectArray[i][j].executeVisitorMemberFunction(visitor);
112829 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
112830 : }
112831 : else
112832 : {
112833 : // printf ("Found a INVALID SgDivideOp object in the memory pool \n");
112834 : }
112835 : }
112836 : }
112837 : }
112838 :
112839 : // This should not be required since all previously static data members are
112840 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
112841 :
112842 194 : }
112843 :
112844 : void
112845 0 : SgDivideOp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
112846 : {
112847 : // This function visits only a single IR node of the memory pool.
112848 : // it is typically called once for each type of IR node within
112849 : // the automatically generated function: traverseRepresentativeNodes().
112850 :
112851 : // Initialize array to the address of the first element of the STL vector
112852 : // (which is guarenteed to be contiguous storage).
112853 : // SgDivideOp objectArray [] = *(Memory_Block_List.begin());
112854 0 : if (SgDivideOp::pools.empty() == false)
112855 : {
112856 : // Generate an array of memory pools
112857 0 : SgDivideOp** objectArray = (SgDivideOp**) &(SgDivideOp::pools[0]);
112858 :
112859 : // Build a local variable for better performance
112860 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
112861 :
112862 : // Iterate over the memory pools
112863 0 : bool done = false;
112864 0 : unsigned i=0;
112865 :
112866 : // find the first valid IR node, call visit function, and then leave
112867 0 : while ( done == false && i < SgDivideOp::pools.size() )
112868 : {
112869 : // objectArray[i] is a single memory pool
112870 : unsigned j=0;
112871 0 : while (done == false && j < SgDivideOp::pool_size)
112872 : {
112873 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
112874 : {
112875 0 : traversal.visit(&(objectArray[i][j]));
112876 0 : done = true;
112877 : }
112878 0 : j++;
112879 : }
112880 0 : i++;
112881 : }
112882 :
112883 : #if 0
112884 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
112885 : if (done == false)
112886 : {
112887 : printf ("No representative for SgDivideOp found in memory pools \n");
112888 : }
112889 : #endif
112890 : }
112891 0 : }
112892 :
112893 :
112894 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
112895 : // using values that overflow signed values of int.
112896 : size_t
112897 4 : SgDivideOp::numberOfNodes()
112898 : {
112899 : // This function traverses the memory pool for an IR node and
112900 : // counts the number of IR nodes of a particular Sage III IR
112901 : // nodes type.
112902 :
112903 4 : size_t count = 0;
112904 4 : if (SgDivideOp::pools.empty() == false)
112905 : {
112906 : // Generate an array of memory pools (this is actually a STL vector,
112907 : // but it is contiguious, so OK to treat this way).
112908 1 : SgDivideOp** objectArray = (SgDivideOp**) &(SgDivideOp::pools[0]);
112909 :
112910 : // Build a local variable for better performance (make it a loop invariant variable).
112911 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
112912 :
112913 : // Iterate over all of the memory pools for this IR node.
112914 2 : for (unsigned int i=0; i < SgDivideOp::pools.size(); i++)
112915 : {
112916 : // objectArray[i] is a single memory pool, iterate over all the
112917 : // IR nodes and only count those that are valid IR nodes used in
112918 : // the AST (i.e. allocated IR nodes).
112919 2001 : for (unsigned j=0; j < SgDivideOp::pool_size; j++)
112920 : {
112921 : // This is indexing the STL vector of C/C++ style arrays as a doubly
112922 : // indexed array access. It is OK since we have leveraged the semantics
112923 : // of STL vector memory as contigous and cast the memory as an array
112924 : // of arrays to use the 2D array indexing. Hope this is not confusing,
112925 : // but it s very fast as an implementation.
112926 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
112927 : {
112928 37 : count++;
112929 : }
112930 : }
112931 : }
112932 : }
112933 :
112934 :
112935 :
112936 4 : return count;
112937 : }
112938 :
112939 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
112940 : // using values that overflow signed values of int.
112941 : size_t
112942 0 : SgDivideOp::memoryUsage()
112943 : {
112944 : // This function is required because we need the class name as a type when we call sizeof
112945 : // There might be another way to implement this if we have a traversal that only called a
112946 : // representative object (one call for each type of Sage IIIIR node).
112947 0 : size_t memory = numberOfNodes() * sizeof(SgDivideOp);
112948 :
112949 0 : return memory;
112950 : }
112951 :
112952 : /* #line 112953 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
112953 :
112954 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
112955 : void
112956 5342 : SgIntegerDivideOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
112957 : {
112958 : // This function traverses the memory pool for only a specific IR node
112959 : // and calls the visit function of the input class execute a traversal
112960 : // similar to the style of the attribute based traversals within ROSE.
112961 : // This traversal will visit ALL nodes of the AST where as the other
112962 : // attribute based traversals visit only the embedded tree within the AST.
112963 :
112964 : // Initialize array to the address of the first element of the STL vector
112965 : // (which is guaranteed to be contiguous storage).
112966 : // SgIntegerDivideOp objectArray [] = *(Memory_Block_List.begin());
112967 5342 : if (SgIntegerDivideOp::pools.empty() == false)
112968 : {
112969 : // Generate an array of memory pools
112970 0 : SgIntegerDivideOp** objectArray = (SgIntegerDivideOp**) &(SgIntegerDivideOp::pools[0]);
112971 :
112972 : // Build a local variable for better performance
112973 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
112974 : #if 0
112975 : // Iterate over the memory pools
112976 : for (unsigned int i=0; i < SgIntegerDivideOp::pools.size(); i++)
112977 : {
112978 : // objectArray[i] is a single memory pool
112979 : for (int j=0; j < SgIntegerDivideOp::pool_size; j++)
112980 : {
112981 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
112982 : {
112983 : traversal.visit(&(objectArray[i][j]));
112984 : }
112985 : }
112986 : }
112987 : #else
112988 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
112989 : // compute the list first and then call the visit function on each list element.
112990 :
112991 : // printf ("Inside of SgIntegerDivideOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
112992 :
112993 0 : std::vector<SgIntegerDivideOp*> nodeList;
112994 :
112995 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
112996 0 : for (unsigned int i=0; i < SgIntegerDivideOp::pools.size(); i++)
112997 : {
112998 : // objectArray[i] is a single memory pool
112999 0 : for (unsigned j=0; j < SgIntegerDivideOp::pool_size; j++)
113000 : {
113001 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
113002 : {
113003 0 : nodeList.push_back(&(objectArray[i][j]));
113004 : }
113005 : }
113006 : }
113007 :
113008 : // Iterate over the saved list
113009 0 : size_t nodeListSize = nodeList.size();
113010 0 : for (size_t i=0; i < nodeListSize; i++)
113011 : {
113012 0 : ROSE_ASSERT(nodeList[i] != NULL);
113013 : #if 0
113014 : traversal.visit(nodeList[i]);
113015 : #else
113016 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
113017 : {
113018 0 : traversal.visit(nodeList[i]);
113019 : }
113020 : #endif
113021 : }
113022 : #endif
113023 : }
113024 :
113025 : // This should not be required since all previously static data members are
113026 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
113027 :
113028 5342 : }
113029 :
113030 :
113031 : void
113032 194 : SgIntegerDivideOp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
113033 : {
113034 : // This function traverses the memory pool for an IR node and
113035 : // calls the function to execute the visitor object.
113036 :
113037 : // Initialize array to the address of the first element of the STL vector
113038 : // (which is guarenteed to be contiguous storage).
113039 : // SgIntegerDivideOp objectArray [] = *(Memory_Block_List.begin());
113040 194 : if (SgIntegerDivideOp::pools.empty() == false)
113041 : {
113042 : // Generate an array of memory pools
113043 0 : SgIntegerDivideOp** objectArray = (SgIntegerDivideOp**) &(SgIntegerDivideOp::pools[0]);
113044 :
113045 : // Build a local variable for better performance
113046 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
113047 :
113048 : // Iterate over the memory pools
113049 0 : for (unsigned int i=0; i < SgIntegerDivideOp::pools.size(); i++)
113050 : {
113051 : // objectArray[i] is a single memory pool
113052 0 : for (unsigned j=0; j < SgIntegerDivideOp::pool_size; j++)
113053 : {
113054 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
113055 : {
113056 : // printf ("Found a valid SgIntegerDivideOp object in the memory pool %d at position %d \n",i,j);
113057 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
113058 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
113059 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
113060 : }
113061 : else
113062 : {
113063 : // printf ("Found a INVALID SgIntegerDivideOp object in the memory pool \n");
113064 : }
113065 : }
113066 : }
113067 : }
113068 :
113069 : // This should not be required since all previously static data members are
113070 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
113071 :
113072 194 : }
113073 :
113074 : void
113075 0 : SgIntegerDivideOp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
113076 : {
113077 : // This function visits only a single IR node of the memory pool.
113078 : // it is typically called once for each type of IR node within
113079 : // the automatically generated function: traverseRepresentativeNodes().
113080 :
113081 : // Initialize array to the address of the first element of the STL vector
113082 : // (which is guarenteed to be contiguous storage).
113083 : // SgIntegerDivideOp objectArray [] = *(Memory_Block_List.begin());
113084 0 : if (SgIntegerDivideOp::pools.empty() == false)
113085 : {
113086 : // Generate an array of memory pools
113087 0 : SgIntegerDivideOp** objectArray = (SgIntegerDivideOp**) &(SgIntegerDivideOp::pools[0]);
113088 :
113089 : // Build a local variable for better performance
113090 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
113091 :
113092 : // Iterate over the memory pools
113093 0 : bool done = false;
113094 0 : unsigned i=0;
113095 :
113096 : // find the first valid IR node, call visit function, and then leave
113097 0 : while ( done == false && i < SgIntegerDivideOp::pools.size() )
113098 : {
113099 : // objectArray[i] is a single memory pool
113100 : unsigned j=0;
113101 0 : while (done == false && j < SgIntegerDivideOp::pool_size)
113102 : {
113103 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
113104 : {
113105 0 : traversal.visit(&(objectArray[i][j]));
113106 0 : done = true;
113107 : }
113108 0 : j++;
113109 : }
113110 0 : i++;
113111 : }
113112 :
113113 : #if 0
113114 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
113115 : if (done == false)
113116 : {
113117 : printf ("No representative for SgIntegerDivideOp found in memory pools \n");
113118 : }
113119 : #endif
113120 : }
113121 0 : }
113122 :
113123 :
113124 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
113125 : // using values that overflow signed values of int.
113126 : size_t
113127 4 : SgIntegerDivideOp::numberOfNodes()
113128 : {
113129 : // This function traverses the memory pool for an IR node and
113130 : // counts the number of IR nodes of a particular Sage III IR
113131 : // nodes type.
113132 :
113133 4 : size_t count = 0;
113134 4 : if (SgIntegerDivideOp::pools.empty() == false)
113135 : {
113136 : // Generate an array of memory pools (this is actually a STL vector,
113137 : // but it is contiguious, so OK to treat this way).
113138 0 : SgIntegerDivideOp** objectArray = (SgIntegerDivideOp**) &(SgIntegerDivideOp::pools[0]);
113139 :
113140 : // Build a local variable for better performance (make it a loop invariant variable).
113141 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
113142 :
113143 : // Iterate over all of the memory pools for this IR node.
113144 0 : for (unsigned int i=0; i < SgIntegerDivideOp::pools.size(); i++)
113145 : {
113146 : // objectArray[i] is a single memory pool, iterate over all the
113147 : // IR nodes and only count those that are valid IR nodes used in
113148 : // the AST (i.e. allocated IR nodes).
113149 0 : for (unsigned j=0; j < SgIntegerDivideOp::pool_size; j++)
113150 : {
113151 : // This is indexing the STL vector of C/C++ style arrays as a doubly
113152 : // indexed array access. It is OK since we have leveraged the semantics
113153 : // of STL vector memory as contigous and cast the memory as an array
113154 : // of arrays to use the 2D array indexing. Hope this is not confusing,
113155 : // but it s very fast as an implementation.
113156 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
113157 : {
113158 0 : count++;
113159 : }
113160 : }
113161 : }
113162 : }
113163 :
113164 :
113165 :
113166 4 : return count;
113167 : }
113168 :
113169 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
113170 : // using values that overflow signed values of int.
113171 : size_t
113172 0 : SgIntegerDivideOp::memoryUsage()
113173 : {
113174 : // This function is required because we need the class name as a type when we call sizeof
113175 : // There might be another way to implement this if we have a traversal that only called a
113176 : // representative object (one call for each type of Sage IIIIR node).
113177 0 : size_t memory = numberOfNodes() * sizeof(SgIntegerDivideOp);
113178 :
113179 0 : return memory;
113180 : }
113181 :
113182 : /* #line 113183 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
113183 :
113184 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
113185 : void
113186 5342 : SgModOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
113187 : {
113188 : // This function traverses the memory pool for only a specific IR node
113189 : // and calls the visit function of the input class execute a traversal
113190 : // similar to the style of the attribute based traversals within ROSE.
113191 : // This traversal will visit ALL nodes of the AST where as the other
113192 : // attribute based traversals visit only the embedded tree within the AST.
113193 :
113194 : // Initialize array to the address of the first element of the STL vector
113195 : // (which is guaranteed to be contiguous storage).
113196 : // SgModOp objectArray [] = *(Memory_Block_List.begin());
113197 5342 : if (SgModOp::pools.empty() == false)
113198 : {
113199 : // Generate an array of memory pools
113200 363 : SgModOp** objectArray = (SgModOp**) &(SgModOp::pools[0]);
113201 :
113202 : // Build a local variable for better performance
113203 363 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
113204 : #if 0
113205 : // Iterate over the memory pools
113206 : for (unsigned int i=0; i < SgModOp::pools.size(); i++)
113207 : {
113208 : // objectArray[i] is a single memory pool
113209 : for (int j=0; j < SgModOp::pool_size; j++)
113210 : {
113211 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
113212 : {
113213 : traversal.visit(&(objectArray[i][j]));
113214 : }
113215 : }
113216 : }
113217 : #else
113218 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
113219 : // compute the list first and then call the visit function on each list element.
113220 :
113221 : // printf ("Inside of SgModOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
113222 :
113223 726 : std::vector<SgModOp*> nodeList;
113224 :
113225 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
113226 726 : for (unsigned int i=0; i < SgModOp::pools.size(); i++)
113227 : {
113228 : // objectArray[i] is a single memory pool
113229 726363 : for (unsigned j=0; j < SgModOp::pool_size; j++)
113230 : {
113231 726000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
113232 : {
113233 1071 : nodeList.push_back(&(objectArray[i][j]));
113234 : }
113235 : }
113236 : }
113237 :
113238 : // Iterate over the saved list
113239 363 : size_t nodeListSize = nodeList.size();
113240 1434 : for (size_t i=0; i < nodeListSize; i++)
113241 : {
113242 1071 : ROSE_ASSERT(nodeList[i] != NULL);
113243 : #if 0
113244 : traversal.visit(nodeList[i]);
113245 : #else
113246 1071 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
113247 : {
113248 1071 : traversal.visit(nodeList[i]);
113249 : }
113250 : #endif
113251 : }
113252 : #endif
113253 : }
113254 :
113255 : // This should not be required since all previously static data members are
113256 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
113257 :
113258 5342 : }
113259 :
113260 :
113261 : void
113262 194 : SgModOp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
113263 : {
113264 : // This function traverses the memory pool for an IR node and
113265 : // calls the function to execute the visitor object.
113266 :
113267 : // Initialize array to the address of the first element of the STL vector
113268 : // (which is guarenteed to be contiguous storage).
113269 : // SgModOp objectArray [] = *(Memory_Block_List.begin());
113270 194 : if (SgModOp::pools.empty() == false)
113271 : {
113272 : // Generate an array of memory pools
113273 170 : SgModOp** objectArray = (SgModOp**) &(SgModOp::pools[0]);
113274 :
113275 : // Build a local variable for better performance
113276 170 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
113277 :
113278 : // Iterate over the memory pools
113279 340 : for (unsigned int i=0; i < SgModOp::pools.size(); i++)
113280 : {
113281 : // objectArray[i] is a single memory pool
113282 340170 : for (unsigned j=0; j < SgModOp::pool_size; j++)
113283 : {
113284 340000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
113285 : {
113286 : // printf ("Found a valid SgModOp object in the memory pool %d at position %d \n",i,j);
113287 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
113288 822 : objectArray[i][j].executeVisitorMemberFunction(visitor);
113289 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
113290 : }
113291 : else
113292 : {
113293 : // printf ("Found a INVALID SgModOp object in the memory pool \n");
113294 : }
113295 : }
113296 : }
113297 : }
113298 :
113299 : // This should not be required since all previously static data members are
113300 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
113301 :
113302 194 : }
113303 :
113304 : void
113305 0 : SgModOp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
113306 : {
113307 : // This function visits only a single IR node of the memory pool.
113308 : // it is typically called once for each type of IR node within
113309 : // the automatically generated function: traverseRepresentativeNodes().
113310 :
113311 : // Initialize array to the address of the first element of the STL vector
113312 : // (which is guarenteed to be contiguous storage).
113313 : // SgModOp objectArray [] = *(Memory_Block_List.begin());
113314 0 : if (SgModOp::pools.empty() == false)
113315 : {
113316 : // Generate an array of memory pools
113317 0 : SgModOp** objectArray = (SgModOp**) &(SgModOp::pools[0]);
113318 :
113319 : // Build a local variable for better performance
113320 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
113321 :
113322 : // Iterate over the memory pools
113323 0 : bool done = false;
113324 0 : unsigned i=0;
113325 :
113326 : // find the first valid IR node, call visit function, and then leave
113327 0 : while ( done == false && i < SgModOp::pools.size() )
113328 : {
113329 : // objectArray[i] is a single memory pool
113330 : unsigned j=0;
113331 0 : while (done == false && j < SgModOp::pool_size)
113332 : {
113333 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
113334 : {
113335 0 : traversal.visit(&(objectArray[i][j]));
113336 0 : done = true;
113337 : }
113338 0 : j++;
113339 : }
113340 0 : i++;
113341 : }
113342 :
113343 : #if 0
113344 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
113345 : if (done == false)
113346 : {
113347 : printf ("No representative for SgModOp found in memory pools \n");
113348 : }
113349 : #endif
113350 : }
113351 0 : }
113352 :
113353 :
113354 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
113355 : // using values that overflow signed values of int.
113356 : size_t
113357 4 : SgModOp::numberOfNodes()
113358 : {
113359 : // This function traverses the memory pool for an IR node and
113360 : // counts the number of IR nodes of a particular Sage III IR
113361 : // nodes type.
113362 :
113363 4 : size_t count = 0;
113364 4 : if (SgModOp::pools.empty() == false)
113365 : {
113366 : // Generate an array of memory pools (this is actually a STL vector,
113367 : // but it is contiguious, so OK to treat this way).
113368 1 : SgModOp** objectArray = (SgModOp**) &(SgModOp::pools[0]);
113369 :
113370 : // Build a local variable for better performance (make it a loop invariant variable).
113371 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
113372 :
113373 : // Iterate over all of the memory pools for this IR node.
113374 2 : for (unsigned int i=0; i < SgModOp::pools.size(); i++)
113375 : {
113376 : // objectArray[i] is a single memory pool, iterate over all the
113377 : // IR nodes and only count those that are valid IR nodes used in
113378 : // the AST (i.e. allocated IR nodes).
113379 2001 : for (unsigned j=0; j < SgModOp::pool_size; j++)
113380 : {
113381 : // This is indexing the STL vector of C/C++ style arrays as a doubly
113382 : // indexed array access. It is OK since we have leveraged the semantics
113383 : // of STL vector memory as contigous and cast the memory as an array
113384 : // of arrays to use the 2D array indexing. Hope this is not confusing,
113385 : // but it s very fast as an implementation.
113386 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
113387 : {
113388 5 : count++;
113389 : }
113390 : }
113391 : }
113392 : }
113393 :
113394 :
113395 :
113396 4 : return count;
113397 : }
113398 :
113399 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
113400 : // using values that overflow signed values of int.
113401 : size_t
113402 0 : SgModOp::memoryUsage()
113403 : {
113404 : // This function is required because we need the class name as a type when we call sizeof
113405 : // There might be another way to implement this if we have a traversal that only called a
113406 : // representative object (one call for each type of Sage IIIIR node).
113407 0 : size_t memory = numberOfNodes() * sizeof(SgModOp);
113408 :
113409 0 : return memory;
113410 : }
113411 :
113412 : /* #line 113413 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
113413 :
113414 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
113415 : void
113416 5342 : SgAndOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
113417 : {
113418 : // This function traverses the memory pool for only a specific IR node
113419 : // and calls the visit function of the input class execute a traversal
113420 : // similar to the style of the attribute based traversals within ROSE.
113421 : // This traversal will visit ALL nodes of the AST where as the other
113422 : // attribute based traversals visit only the embedded tree within the AST.
113423 :
113424 : // Initialize array to the address of the first element of the STL vector
113425 : // (which is guaranteed to be contiguous storage).
113426 : // SgAndOp objectArray [] = *(Memory_Block_List.begin());
113427 5342 : if (SgAndOp::pools.empty() == false)
113428 : {
113429 : // Generate an array of memory pools
113430 423 : SgAndOp** objectArray = (SgAndOp**) &(SgAndOp::pools[0]);
113431 :
113432 : // Build a local variable for better performance
113433 423 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
113434 : #if 0
113435 : // Iterate over the memory pools
113436 : for (unsigned int i=0; i < SgAndOp::pools.size(); i++)
113437 : {
113438 : // objectArray[i] is a single memory pool
113439 : for (int j=0; j < SgAndOp::pool_size; j++)
113440 : {
113441 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
113442 : {
113443 : traversal.visit(&(objectArray[i][j]));
113444 : }
113445 : }
113446 : }
113447 : #else
113448 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
113449 : // compute the list first and then call the visit function on each list element.
113450 :
113451 : // printf ("Inside of SgAndOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
113452 :
113453 846 : std::vector<SgAndOp*> nodeList;
113454 :
113455 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
113456 846 : for (unsigned int i=0; i < SgAndOp::pools.size(); i++)
113457 : {
113458 : // objectArray[i] is a single memory pool
113459 846423 : for (unsigned j=0; j < SgAndOp::pool_size; j++)
113460 : {
113461 846000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
113462 : {
113463 22430 : nodeList.push_back(&(objectArray[i][j]));
113464 : }
113465 : }
113466 : }
113467 :
113468 : // Iterate over the saved list
113469 423 : size_t nodeListSize = nodeList.size();
113470 22853 : for (size_t i=0; i < nodeListSize; i++)
113471 : {
113472 22430 : ROSE_ASSERT(nodeList[i] != NULL);
113473 : #if 0
113474 : traversal.visit(nodeList[i]);
113475 : #else
113476 22430 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
113477 : {
113478 22430 : traversal.visit(nodeList[i]);
113479 : }
113480 : #endif
113481 : }
113482 : #endif
113483 : }
113484 :
113485 : // This should not be required since all previously static data members are
113486 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
113487 :
113488 5342 : }
113489 :
113490 :
113491 : void
113492 194 : SgAndOp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
113493 : {
113494 : // This function traverses the memory pool for an IR node and
113495 : // calls the function to execute the visitor object.
113496 :
113497 : // Initialize array to the address of the first element of the STL vector
113498 : // (which is guarenteed to be contiguous storage).
113499 : // SgAndOp objectArray [] = *(Memory_Block_List.begin());
113500 194 : if (SgAndOp::pools.empty() == false)
113501 : {
113502 : // Generate an array of memory pools
113503 137 : SgAndOp** objectArray = (SgAndOp**) &(SgAndOp::pools[0]);
113504 :
113505 : // Build a local variable for better performance
113506 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
113507 :
113508 : // Iterate over the memory pools
113509 274 : for (unsigned int i=0; i < SgAndOp::pools.size(); i++)
113510 : {
113511 : // objectArray[i] is a single memory pool
113512 274137 : for (unsigned j=0; j < SgAndOp::pool_size; j++)
113513 : {
113514 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
113515 : {
113516 : // printf ("Found a valid SgAndOp object in the memory pool %d at position %d \n",i,j);
113517 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
113518 24153 : objectArray[i][j].executeVisitorMemberFunction(visitor);
113519 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
113520 : }
113521 : else
113522 : {
113523 : // printf ("Found a INVALID SgAndOp object in the memory pool \n");
113524 : }
113525 : }
113526 : }
113527 : }
113528 :
113529 : // This should not be required since all previously static data members are
113530 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
113531 :
113532 194 : }
113533 :
113534 : void
113535 0 : SgAndOp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
113536 : {
113537 : // This function visits only a single IR node of the memory pool.
113538 : // it is typically called once for each type of IR node within
113539 : // the automatically generated function: traverseRepresentativeNodes().
113540 :
113541 : // Initialize array to the address of the first element of the STL vector
113542 : // (which is guarenteed to be contiguous storage).
113543 : // SgAndOp objectArray [] = *(Memory_Block_List.begin());
113544 0 : if (SgAndOp::pools.empty() == false)
113545 : {
113546 : // Generate an array of memory pools
113547 0 : SgAndOp** objectArray = (SgAndOp**) &(SgAndOp::pools[0]);
113548 :
113549 : // Build a local variable for better performance
113550 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
113551 :
113552 : // Iterate over the memory pools
113553 0 : bool done = false;
113554 0 : unsigned i=0;
113555 :
113556 : // find the first valid IR node, call visit function, and then leave
113557 0 : while ( done == false && i < SgAndOp::pools.size() )
113558 : {
113559 : // objectArray[i] is a single memory pool
113560 : unsigned j=0;
113561 0 : while (done == false && j < SgAndOp::pool_size)
113562 : {
113563 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
113564 : {
113565 0 : traversal.visit(&(objectArray[i][j]));
113566 0 : done = true;
113567 : }
113568 0 : j++;
113569 : }
113570 0 : i++;
113571 : }
113572 :
113573 : #if 0
113574 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
113575 : if (done == false)
113576 : {
113577 : printf ("No representative for SgAndOp found in memory pools \n");
113578 : }
113579 : #endif
113580 : }
113581 0 : }
113582 :
113583 :
113584 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
113585 : // using values that overflow signed values of int.
113586 : size_t
113587 4 : SgAndOp::numberOfNodes()
113588 : {
113589 : // This function traverses the memory pool for an IR node and
113590 : // counts the number of IR nodes of a particular Sage III IR
113591 : // nodes type.
113592 :
113593 4 : size_t count = 0;
113594 4 : if (SgAndOp::pools.empty() == false)
113595 : {
113596 : // Generate an array of memory pools (this is actually a STL vector,
113597 : // but it is contiguious, so OK to treat this way).
113598 1 : SgAndOp** objectArray = (SgAndOp**) &(SgAndOp::pools[0]);
113599 :
113600 : // Build a local variable for better performance (make it a loop invariant variable).
113601 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
113602 :
113603 : // Iterate over all of the memory pools for this IR node.
113604 2 : for (unsigned int i=0; i < SgAndOp::pools.size(); i++)
113605 : {
113606 : // objectArray[i] is a single memory pool, iterate over all the
113607 : // IR nodes and only count those that are valid IR nodes used in
113608 : // the AST (i.e. allocated IR nodes).
113609 2001 : for (unsigned j=0; j < SgAndOp::pool_size; j++)
113610 : {
113611 : // This is indexing the STL vector of C/C++ style arrays as a doubly
113612 : // indexed array access. It is OK since we have leveraged the semantics
113613 : // of STL vector memory as contigous and cast the memory as an array
113614 : // of arrays to use the 2D array indexing. Hope this is not confusing,
113615 : // but it s very fast as an implementation.
113616 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
113617 : {
113618 173 : count++;
113619 : }
113620 : }
113621 : }
113622 : }
113623 :
113624 :
113625 :
113626 4 : return count;
113627 : }
113628 :
113629 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
113630 : // using values that overflow signed values of int.
113631 : size_t
113632 0 : SgAndOp::memoryUsage()
113633 : {
113634 : // This function is required because we need the class name as a type when we call sizeof
113635 : // There might be another way to implement this if we have a traversal that only called a
113636 : // representative object (one call for each type of Sage IIIIR node).
113637 0 : size_t memory = numberOfNodes() * sizeof(SgAndOp);
113638 :
113639 0 : return memory;
113640 : }
113641 :
113642 : /* #line 113643 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
113643 :
113644 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
113645 : void
113646 5342 : SgOrOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
113647 : {
113648 : // This function traverses the memory pool for only a specific IR node
113649 : // and calls the visit function of the input class execute a traversal
113650 : // similar to the style of the attribute based traversals within ROSE.
113651 : // This traversal will visit ALL nodes of the AST where as the other
113652 : // attribute based traversals visit only the embedded tree within the AST.
113653 :
113654 : // Initialize array to the address of the first element of the STL vector
113655 : // (which is guaranteed to be contiguous storage).
113656 : // SgOrOp objectArray [] = *(Memory_Block_List.begin());
113657 5342 : if (SgOrOp::pools.empty() == false)
113658 : {
113659 : // Generate an array of memory pools
113660 198 : SgOrOp** objectArray = (SgOrOp**) &(SgOrOp::pools[0]);
113661 :
113662 : // Build a local variable for better performance
113663 198 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
113664 : #if 0
113665 : // Iterate over the memory pools
113666 : for (unsigned int i=0; i < SgOrOp::pools.size(); i++)
113667 : {
113668 : // objectArray[i] is a single memory pool
113669 : for (int j=0; j < SgOrOp::pool_size; j++)
113670 : {
113671 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
113672 : {
113673 : traversal.visit(&(objectArray[i][j]));
113674 : }
113675 : }
113676 : }
113677 : #else
113678 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
113679 : // compute the list first and then call the visit function on each list element.
113680 :
113681 : // printf ("Inside of SgOrOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
113682 :
113683 396 : std::vector<SgOrOp*> nodeList;
113684 :
113685 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
113686 396 : for (unsigned int i=0; i < SgOrOp::pools.size(); i++)
113687 : {
113688 : // objectArray[i] is a single memory pool
113689 396198 : for (unsigned j=0; j < SgOrOp::pool_size; j++)
113690 : {
113691 396000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
113692 : {
113693 10269 : nodeList.push_back(&(objectArray[i][j]));
113694 : }
113695 : }
113696 : }
113697 :
113698 : // Iterate over the saved list
113699 198 : size_t nodeListSize = nodeList.size();
113700 10467 : for (size_t i=0; i < nodeListSize; i++)
113701 : {
113702 10269 : ROSE_ASSERT(nodeList[i] != NULL);
113703 : #if 0
113704 : traversal.visit(nodeList[i]);
113705 : #else
113706 10269 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
113707 : {
113708 10269 : traversal.visit(nodeList[i]);
113709 : }
113710 : #endif
113711 : }
113712 : #endif
113713 : }
113714 :
113715 : // This should not be required since all previously static data members are
113716 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
113717 :
113718 5342 : }
113719 :
113720 :
113721 : void
113722 194 : SgOrOp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
113723 : {
113724 : // This function traverses the memory pool for an IR node and
113725 : // calls the function to execute the visitor object.
113726 :
113727 : // Initialize array to the address of the first element of the STL vector
113728 : // (which is guarenteed to be contiguous storage).
113729 : // SgOrOp objectArray [] = *(Memory_Block_List.begin());
113730 194 : if (SgOrOp::pools.empty() == false)
113731 : {
113732 : // Generate an array of memory pools
113733 137 : SgOrOp** objectArray = (SgOrOp**) &(SgOrOp::pools[0]);
113734 :
113735 : // Build a local variable for better performance
113736 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
113737 :
113738 : // Iterate over the memory pools
113739 274 : for (unsigned int i=0; i < SgOrOp::pools.size(); i++)
113740 : {
113741 : // objectArray[i] is a single memory pool
113742 274137 : for (unsigned j=0; j < SgOrOp::pool_size; j++)
113743 : {
113744 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
113745 : {
113746 : // printf ("Found a valid SgOrOp object in the memory pool %d at position %d \n",i,j);
113747 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
113748 11571 : objectArray[i][j].executeVisitorMemberFunction(visitor);
113749 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
113750 : }
113751 : else
113752 : {
113753 : // printf ("Found a INVALID SgOrOp object in the memory pool \n");
113754 : }
113755 : }
113756 : }
113757 : }
113758 :
113759 : // This should not be required since all previously static data members are
113760 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
113761 :
113762 194 : }
113763 :
113764 : void
113765 0 : SgOrOp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
113766 : {
113767 : // This function visits only a single IR node of the memory pool.
113768 : // it is typically called once for each type of IR node within
113769 : // the automatically generated function: traverseRepresentativeNodes().
113770 :
113771 : // Initialize array to the address of the first element of the STL vector
113772 : // (which is guarenteed to be contiguous storage).
113773 : // SgOrOp objectArray [] = *(Memory_Block_List.begin());
113774 0 : if (SgOrOp::pools.empty() == false)
113775 : {
113776 : // Generate an array of memory pools
113777 0 : SgOrOp** objectArray = (SgOrOp**) &(SgOrOp::pools[0]);
113778 :
113779 : // Build a local variable for better performance
113780 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
113781 :
113782 : // Iterate over the memory pools
113783 0 : bool done = false;
113784 0 : unsigned i=0;
113785 :
113786 : // find the first valid IR node, call visit function, and then leave
113787 0 : while ( done == false && i < SgOrOp::pools.size() )
113788 : {
113789 : // objectArray[i] is a single memory pool
113790 : unsigned j=0;
113791 0 : while (done == false && j < SgOrOp::pool_size)
113792 : {
113793 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
113794 : {
113795 0 : traversal.visit(&(objectArray[i][j]));
113796 0 : done = true;
113797 : }
113798 0 : j++;
113799 : }
113800 0 : i++;
113801 : }
113802 :
113803 : #if 0
113804 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
113805 : if (done == false)
113806 : {
113807 : printf ("No representative for SgOrOp found in memory pools \n");
113808 : }
113809 : #endif
113810 : }
113811 0 : }
113812 :
113813 :
113814 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
113815 : // using values that overflow signed values of int.
113816 : size_t
113817 4 : SgOrOp::numberOfNodes()
113818 : {
113819 : // This function traverses the memory pool for an IR node and
113820 : // counts the number of IR nodes of a particular Sage III IR
113821 : // nodes type.
113822 :
113823 4 : size_t count = 0;
113824 4 : if (SgOrOp::pools.empty() == false)
113825 : {
113826 : // Generate an array of memory pools (this is actually a STL vector,
113827 : // but it is contiguious, so OK to treat this way).
113828 1 : SgOrOp** objectArray = (SgOrOp**) &(SgOrOp::pools[0]);
113829 :
113830 : // Build a local variable for better performance (make it a loop invariant variable).
113831 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
113832 :
113833 : // Iterate over all of the memory pools for this IR node.
113834 2 : for (unsigned int i=0; i < SgOrOp::pools.size(); i++)
113835 : {
113836 : // objectArray[i] is a single memory pool, iterate over all the
113837 : // IR nodes and only count those that are valid IR nodes used in
113838 : // the AST (i.e. allocated IR nodes).
113839 2001 : for (unsigned j=0; j < SgOrOp::pool_size; j++)
113840 : {
113841 : // This is indexing the STL vector of C/C++ style arrays as a doubly
113842 : // indexed array access. It is OK since we have leveraged the semantics
113843 : // of STL vector memory as contigous and cast the memory as an array
113844 : // of arrays to use the 2D array indexing. Hope this is not confusing,
113845 : // but it s very fast as an implementation.
113846 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
113847 : {
113848 83 : count++;
113849 : }
113850 : }
113851 : }
113852 : }
113853 :
113854 :
113855 :
113856 4 : return count;
113857 : }
113858 :
113859 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
113860 : // using values that overflow signed values of int.
113861 : size_t
113862 0 : SgOrOp::memoryUsage()
113863 : {
113864 : // This function is required because we need the class name as a type when we call sizeof
113865 : // There might be another way to implement this if we have a traversal that only called a
113866 : // representative object (one call for each type of Sage IIIIR node).
113867 0 : size_t memory = numberOfNodes() * sizeof(SgOrOp);
113868 :
113869 0 : return memory;
113870 : }
113871 :
113872 : /* #line 113873 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
113873 :
113874 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
113875 : void
113876 5342 : SgBitXorOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
113877 : {
113878 : // This function traverses the memory pool for only a specific IR node
113879 : // and calls the visit function of the input class execute a traversal
113880 : // similar to the style of the attribute based traversals within ROSE.
113881 : // This traversal will visit ALL nodes of the AST where as the other
113882 : // attribute based traversals visit only the embedded tree within the AST.
113883 :
113884 : // Initialize array to the address of the first element of the STL vector
113885 : // (which is guaranteed to be contiguous storage).
113886 : // SgBitXorOp objectArray [] = *(Memory_Block_List.begin());
113887 5342 : if (SgBitXorOp::pools.empty() == false)
113888 : {
113889 : // Generate an array of memory pools
113890 145 : SgBitXorOp** objectArray = (SgBitXorOp**) &(SgBitXorOp::pools[0]);
113891 :
113892 : // Build a local variable for better performance
113893 145 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
113894 : #if 0
113895 : // Iterate over the memory pools
113896 : for (unsigned int i=0; i < SgBitXorOp::pools.size(); i++)
113897 : {
113898 : // objectArray[i] is a single memory pool
113899 : for (int j=0; j < SgBitXorOp::pool_size; j++)
113900 : {
113901 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
113902 : {
113903 : traversal.visit(&(objectArray[i][j]));
113904 : }
113905 : }
113906 : }
113907 : #else
113908 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
113909 : // compute the list first and then call the visit function on each list element.
113910 :
113911 : // printf ("Inside of SgBitXorOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
113912 :
113913 290 : std::vector<SgBitXorOp*> nodeList;
113914 :
113915 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
113916 290 : for (unsigned int i=0; i < SgBitXorOp::pools.size(); i++)
113917 : {
113918 : // objectArray[i] is a single memory pool
113919 290145 : for (unsigned j=0; j < SgBitXorOp::pool_size; j++)
113920 : {
113921 290000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
113922 : {
113923 750 : nodeList.push_back(&(objectArray[i][j]));
113924 : }
113925 : }
113926 : }
113927 :
113928 : // Iterate over the saved list
113929 145 : size_t nodeListSize = nodeList.size();
113930 895 : for (size_t i=0; i < nodeListSize; i++)
113931 : {
113932 750 : ROSE_ASSERT(nodeList[i] != NULL);
113933 : #if 0
113934 : traversal.visit(nodeList[i]);
113935 : #else
113936 750 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
113937 : {
113938 750 : traversal.visit(nodeList[i]);
113939 : }
113940 : #endif
113941 : }
113942 : #endif
113943 : }
113944 :
113945 : // This should not be required since all previously static data members are
113946 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
113947 :
113948 5342 : }
113949 :
113950 :
113951 : void
113952 194 : SgBitXorOp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
113953 : {
113954 : // This function traverses the memory pool for an IR node and
113955 : // calls the function to execute the visitor object.
113956 :
113957 : // Initialize array to the address of the first element of the STL vector
113958 : // (which is guarenteed to be contiguous storage).
113959 : // SgBitXorOp objectArray [] = *(Memory_Block_List.begin());
113960 194 : if (SgBitXorOp::pools.empty() == false)
113961 : {
113962 : // Generate an array of memory pools
113963 137 : SgBitXorOp** objectArray = (SgBitXorOp**) &(SgBitXorOp::pools[0]);
113964 :
113965 : // Build a local variable for better performance
113966 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
113967 :
113968 : // Iterate over the memory pools
113969 274 : for (unsigned int i=0; i < SgBitXorOp::pools.size(); i++)
113970 : {
113971 : // objectArray[i] is a single memory pool
113972 274137 : for (unsigned j=0; j < SgBitXorOp::pool_size; j++)
113973 : {
113974 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
113975 : {
113976 : // printf ("Found a valid SgBitXorOp object in the memory pool %d at position %d \n",i,j);
113977 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
113978 822 : objectArray[i][j].executeVisitorMemberFunction(visitor);
113979 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
113980 : }
113981 : else
113982 : {
113983 : // printf ("Found a INVALID SgBitXorOp object in the memory pool \n");
113984 : }
113985 : }
113986 : }
113987 : }
113988 :
113989 : // This should not be required since all previously static data members are
113990 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
113991 :
113992 194 : }
113993 :
113994 : void
113995 0 : SgBitXorOp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
113996 : {
113997 : // This function visits only a single IR node of the memory pool.
113998 : // it is typically called once for each type of IR node within
113999 : // the automatically generated function: traverseRepresentativeNodes().
114000 :
114001 : // Initialize array to the address of the first element of the STL vector
114002 : // (which is guarenteed to be contiguous storage).
114003 : // SgBitXorOp objectArray [] = *(Memory_Block_List.begin());
114004 0 : if (SgBitXorOp::pools.empty() == false)
114005 : {
114006 : // Generate an array of memory pools
114007 0 : SgBitXorOp** objectArray = (SgBitXorOp**) &(SgBitXorOp::pools[0]);
114008 :
114009 : // Build a local variable for better performance
114010 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
114011 :
114012 : // Iterate over the memory pools
114013 0 : bool done = false;
114014 0 : unsigned i=0;
114015 :
114016 : // find the first valid IR node, call visit function, and then leave
114017 0 : while ( done == false && i < SgBitXorOp::pools.size() )
114018 : {
114019 : // objectArray[i] is a single memory pool
114020 : unsigned j=0;
114021 0 : while (done == false && j < SgBitXorOp::pool_size)
114022 : {
114023 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
114024 : {
114025 0 : traversal.visit(&(objectArray[i][j]));
114026 0 : done = true;
114027 : }
114028 0 : j++;
114029 : }
114030 0 : i++;
114031 : }
114032 :
114033 : #if 0
114034 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
114035 : if (done == false)
114036 : {
114037 : printf ("No representative for SgBitXorOp found in memory pools \n");
114038 : }
114039 : #endif
114040 : }
114041 0 : }
114042 :
114043 :
114044 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
114045 : // using values that overflow signed values of int.
114046 : size_t
114047 4 : SgBitXorOp::numberOfNodes()
114048 : {
114049 : // This function traverses the memory pool for an IR node and
114050 : // counts the number of IR nodes of a particular Sage III IR
114051 : // nodes type.
114052 :
114053 4 : size_t count = 0;
114054 4 : if (SgBitXorOp::pools.empty() == false)
114055 : {
114056 : // Generate an array of memory pools (this is actually a STL vector,
114057 : // but it is contiguious, so OK to treat this way).
114058 1 : SgBitXorOp** objectArray = (SgBitXorOp**) &(SgBitXorOp::pools[0]);
114059 :
114060 : // Build a local variable for better performance (make it a loop invariant variable).
114061 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
114062 :
114063 : // Iterate over all of the memory pools for this IR node.
114064 2 : for (unsigned int i=0; i < SgBitXorOp::pools.size(); i++)
114065 : {
114066 : // objectArray[i] is a single memory pool, iterate over all the
114067 : // IR nodes and only count those that are valid IR nodes used in
114068 : // the AST (i.e. allocated IR nodes).
114069 2001 : for (unsigned j=0; j < SgBitXorOp::pool_size; j++)
114070 : {
114071 : // This is indexing the STL vector of C/C++ style arrays as a doubly
114072 : // indexed array access. It is OK since we have leveraged the semantics
114073 : // of STL vector memory as contigous and cast the memory as an array
114074 : // of arrays to use the 2D array indexing. Hope this is not confusing,
114075 : // but it s very fast as an implementation.
114076 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
114077 : {
114078 6 : count++;
114079 : }
114080 : }
114081 : }
114082 : }
114083 :
114084 :
114085 :
114086 4 : return count;
114087 : }
114088 :
114089 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
114090 : // using values that overflow signed values of int.
114091 : size_t
114092 0 : SgBitXorOp::memoryUsage()
114093 : {
114094 : // This function is required because we need the class name as a type when we call sizeof
114095 : // There might be another way to implement this if we have a traversal that only called a
114096 : // representative object (one call for each type of Sage IIIIR node).
114097 0 : size_t memory = numberOfNodes() * sizeof(SgBitXorOp);
114098 :
114099 0 : return memory;
114100 : }
114101 :
114102 : /* #line 114103 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
114103 :
114104 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
114105 : void
114106 5342 : SgBitAndOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
114107 : {
114108 : // This function traverses the memory pool for only a specific IR node
114109 : // and calls the visit function of the input class execute a traversal
114110 : // similar to the style of the attribute based traversals within ROSE.
114111 : // This traversal will visit ALL nodes of the AST where as the other
114112 : // attribute based traversals visit only the embedded tree within the AST.
114113 :
114114 : // Initialize array to the address of the first element of the STL vector
114115 : // (which is guaranteed to be contiguous storage).
114116 : // SgBitAndOp objectArray [] = *(Memory_Block_List.begin());
114117 5342 : if (SgBitAndOp::pools.empty() == false)
114118 : {
114119 : // Generate an array of memory pools
114120 168 : SgBitAndOp** objectArray = (SgBitAndOp**) &(SgBitAndOp::pools[0]);
114121 :
114122 : // Build a local variable for better performance
114123 168 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
114124 : #if 0
114125 : // Iterate over the memory pools
114126 : for (unsigned int i=0; i < SgBitAndOp::pools.size(); i++)
114127 : {
114128 : // objectArray[i] is a single memory pool
114129 : for (int j=0; j < SgBitAndOp::pool_size; j++)
114130 : {
114131 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
114132 : {
114133 : traversal.visit(&(objectArray[i][j]));
114134 : }
114135 : }
114136 : }
114137 : #else
114138 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
114139 : // compute the list first and then call the visit function on each list element.
114140 :
114141 : // printf ("Inside of SgBitAndOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
114142 :
114143 336 : std::vector<SgBitAndOp*> nodeList;
114144 :
114145 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
114146 336 : for (unsigned int i=0; i < SgBitAndOp::pools.size(); i++)
114147 : {
114148 : // objectArray[i] is a single memory pool
114149 336168 : for (unsigned j=0; j < SgBitAndOp::pool_size; j++)
114150 : {
114151 336000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
114152 : {
114153 2488 : nodeList.push_back(&(objectArray[i][j]));
114154 : }
114155 : }
114156 : }
114157 :
114158 : // Iterate over the saved list
114159 168 : size_t nodeListSize = nodeList.size();
114160 2656 : for (size_t i=0; i < nodeListSize; i++)
114161 : {
114162 2488 : ROSE_ASSERT(nodeList[i] != NULL);
114163 : #if 0
114164 : traversal.visit(nodeList[i]);
114165 : #else
114166 2488 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
114167 : {
114168 2488 : traversal.visit(nodeList[i]);
114169 : }
114170 : #endif
114171 : }
114172 : #endif
114173 : }
114174 :
114175 : // This should not be required since all previously static data members are
114176 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
114177 :
114178 5342 : }
114179 :
114180 :
114181 : void
114182 194 : SgBitAndOp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
114183 : {
114184 : // This function traverses the memory pool for an IR node and
114185 : // calls the function to execute the visitor object.
114186 :
114187 : // Initialize array to the address of the first element of the STL vector
114188 : // (which is guarenteed to be contiguous storage).
114189 : // SgBitAndOp objectArray [] = *(Memory_Block_List.begin());
114190 194 : if (SgBitAndOp::pools.empty() == false)
114191 : {
114192 : // Generate an array of memory pools
114193 137 : SgBitAndOp** objectArray = (SgBitAndOp**) &(SgBitAndOp::pools[0]);
114194 :
114195 : // Build a local variable for better performance
114196 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
114197 :
114198 : // Iterate over the memory pools
114199 274 : for (unsigned int i=0; i < SgBitAndOp::pools.size(); i++)
114200 : {
114201 : // objectArray[i] is a single memory pool
114202 274137 : for (unsigned j=0; j < SgBitAndOp::pool_size; j++)
114203 : {
114204 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
114205 : {
114206 : // printf ("Found a valid SgBitAndOp object in the memory pool %d at position %d \n",i,j);
114207 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
114208 2780 : objectArray[i][j].executeVisitorMemberFunction(visitor);
114209 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
114210 : }
114211 : else
114212 : {
114213 : // printf ("Found a INVALID SgBitAndOp object in the memory pool \n");
114214 : }
114215 : }
114216 : }
114217 : }
114218 :
114219 : // This should not be required since all previously static data members are
114220 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
114221 :
114222 194 : }
114223 :
114224 : void
114225 0 : SgBitAndOp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
114226 : {
114227 : // This function visits only a single IR node of the memory pool.
114228 : // it is typically called once for each type of IR node within
114229 : // the automatically generated function: traverseRepresentativeNodes().
114230 :
114231 : // Initialize array to the address of the first element of the STL vector
114232 : // (which is guarenteed to be contiguous storage).
114233 : // SgBitAndOp objectArray [] = *(Memory_Block_List.begin());
114234 0 : if (SgBitAndOp::pools.empty() == false)
114235 : {
114236 : // Generate an array of memory pools
114237 0 : SgBitAndOp** objectArray = (SgBitAndOp**) &(SgBitAndOp::pools[0]);
114238 :
114239 : // Build a local variable for better performance
114240 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
114241 :
114242 : // Iterate over the memory pools
114243 0 : bool done = false;
114244 0 : unsigned i=0;
114245 :
114246 : // find the first valid IR node, call visit function, and then leave
114247 0 : while ( done == false && i < SgBitAndOp::pools.size() )
114248 : {
114249 : // objectArray[i] is a single memory pool
114250 : unsigned j=0;
114251 0 : while (done == false && j < SgBitAndOp::pool_size)
114252 : {
114253 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
114254 : {
114255 0 : traversal.visit(&(objectArray[i][j]));
114256 0 : done = true;
114257 : }
114258 0 : j++;
114259 : }
114260 0 : i++;
114261 : }
114262 :
114263 : #if 0
114264 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
114265 : if (done == false)
114266 : {
114267 : printf ("No representative for SgBitAndOp found in memory pools \n");
114268 : }
114269 : #endif
114270 : }
114271 0 : }
114272 :
114273 :
114274 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
114275 : // using values that overflow signed values of int.
114276 : size_t
114277 4 : SgBitAndOp::numberOfNodes()
114278 : {
114279 : // This function traverses the memory pool for an IR node and
114280 : // counts the number of IR nodes of a particular Sage III IR
114281 : // nodes type.
114282 :
114283 4 : size_t count = 0;
114284 4 : if (SgBitAndOp::pools.empty() == false)
114285 : {
114286 : // Generate an array of memory pools (this is actually a STL vector,
114287 : // but it is contiguious, so OK to treat this way).
114288 1 : SgBitAndOp** objectArray = (SgBitAndOp**) &(SgBitAndOp::pools[0]);
114289 :
114290 : // Build a local variable for better performance (make it a loop invariant variable).
114291 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
114292 :
114293 : // Iterate over all of the memory pools for this IR node.
114294 2 : for (unsigned int i=0; i < SgBitAndOp::pools.size(); i++)
114295 : {
114296 : // objectArray[i] is a single memory pool, iterate over all the
114297 : // IR nodes and only count those that are valid IR nodes used in
114298 : // the AST (i.e. allocated IR nodes).
114299 2001 : for (unsigned j=0; j < SgBitAndOp::pool_size; j++)
114300 : {
114301 : // This is indexing the STL vector of C/C++ style arrays as a doubly
114302 : // indexed array access. It is OK since we have leveraged the semantics
114303 : // of STL vector memory as contigous and cast the memory as an array
114304 : // of arrays to use the 2D array indexing. Hope this is not confusing,
114305 : // but it s very fast as an implementation.
114306 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
114307 : {
114308 20 : count++;
114309 : }
114310 : }
114311 : }
114312 : }
114313 :
114314 :
114315 :
114316 4 : return count;
114317 : }
114318 :
114319 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
114320 : // using values that overflow signed values of int.
114321 : size_t
114322 0 : SgBitAndOp::memoryUsage()
114323 : {
114324 : // This function is required because we need the class name as a type when we call sizeof
114325 : // There might be another way to implement this if we have a traversal that only called a
114326 : // representative object (one call for each type of Sage IIIIR node).
114327 0 : size_t memory = numberOfNodes() * sizeof(SgBitAndOp);
114328 :
114329 0 : return memory;
114330 : }
114331 :
114332 : /* #line 114333 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
114333 :
114334 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
114335 : void
114336 5342 : SgBitOrOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
114337 : {
114338 : // This function traverses the memory pool for only a specific IR node
114339 : // and calls the visit function of the input class execute a traversal
114340 : // similar to the style of the attribute based traversals within ROSE.
114341 : // This traversal will visit ALL nodes of the AST where as the other
114342 : // attribute based traversals visit only the embedded tree within the AST.
114343 :
114344 : // Initialize array to the address of the first element of the STL vector
114345 : // (which is guaranteed to be contiguous storage).
114346 : // SgBitOrOp objectArray [] = *(Memory_Block_List.begin());
114347 5342 : if (SgBitOrOp::pools.empty() == false)
114348 : {
114349 : // Generate an array of memory pools
114350 145 : SgBitOrOp** objectArray = (SgBitOrOp**) &(SgBitOrOp::pools[0]);
114351 :
114352 : // Build a local variable for better performance
114353 145 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
114354 : #if 0
114355 : // Iterate over the memory pools
114356 : for (unsigned int i=0; i < SgBitOrOp::pools.size(); i++)
114357 : {
114358 : // objectArray[i] is a single memory pool
114359 : for (int j=0; j < SgBitOrOp::pool_size; j++)
114360 : {
114361 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
114362 : {
114363 : traversal.visit(&(objectArray[i][j]));
114364 : }
114365 : }
114366 : }
114367 : #else
114368 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
114369 : // compute the list first and then call the visit function on each list element.
114370 :
114371 : // printf ("Inside of SgBitOrOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
114372 :
114373 290 : std::vector<SgBitOrOp*> nodeList;
114374 :
114375 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
114376 290 : for (unsigned int i=0; i < SgBitOrOp::pools.size(); i++)
114377 : {
114378 : // objectArray[i] is a single memory pool
114379 290145 : for (unsigned j=0; j < SgBitOrOp::pool_size; j++)
114380 : {
114381 290000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
114382 : {
114383 2865 : nodeList.push_back(&(objectArray[i][j]));
114384 : }
114385 : }
114386 : }
114387 :
114388 : // Iterate over the saved list
114389 145 : size_t nodeListSize = nodeList.size();
114390 3010 : for (size_t i=0; i < nodeListSize; i++)
114391 : {
114392 2865 : ROSE_ASSERT(nodeList[i] != NULL);
114393 : #if 0
114394 : traversal.visit(nodeList[i]);
114395 : #else
114396 2865 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
114397 : {
114398 2865 : traversal.visit(nodeList[i]);
114399 : }
114400 : #endif
114401 : }
114402 : #endif
114403 : }
114404 :
114405 : // This should not be required since all previously static data members are
114406 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
114407 :
114408 5342 : }
114409 :
114410 :
114411 : void
114412 194 : SgBitOrOp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
114413 : {
114414 : // This function traverses the memory pool for an IR node and
114415 : // calls the function to execute the visitor object.
114416 :
114417 : // Initialize array to the address of the first element of the STL vector
114418 : // (which is guarenteed to be contiguous storage).
114419 : // SgBitOrOp objectArray [] = *(Memory_Block_List.begin());
114420 194 : if (SgBitOrOp::pools.empty() == false)
114421 : {
114422 : // Generate an array of memory pools
114423 137 : SgBitOrOp** objectArray = (SgBitOrOp**) &(SgBitOrOp::pools[0]);
114424 :
114425 : // Build a local variable for better performance
114426 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
114427 :
114428 : // Iterate over the memory pools
114429 274 : for (unsigned int i=0; i < SgBitOrOp::pools.size(); i++)
114430 : {
114431 : // objectArray[i] is a single memory pool
114432 274137 : for (unsigned j=0; j < SgBitOrOp::pool_size; j++)
114433 : {
114434 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
114435 : {
114436 : // printf ("Found a valid SgBitOrOp object in the memory pool %d at position %d \n",i,j);
114437 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
114438 2055 : objectArray[i][j].executeVisitorMemberFunction(visitor);
114439 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
114440 : }
114441 : else
114442 : {
114443 : // printf ("Found a INVALID SgBitOrOp object in the memory pool \n");
114444 : }
114445 : }
114446 : }
114447 : }
114448 :
114449 : // This should not be required since all previously static data members are
114450 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
114451 :
114452 194 : }
114453 :
114454 : void
114455 0 : SgBitOrOp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
114456 : {
114457 : // This function visits only a single IR node of the memory pool.
114458 : // it is typically called once for each type of IR node within
114459 : // the automatically generated function: traverseRepresentativeNodes().
114460 :
114461 : // Initialize array to the address of the first element of the STL vector
114462 : // (which is guarenteed to be contiguous storage).
114463 : // SgBitOrOp objectArray [] = *(Memory_Block_List.begin());
114464 0 : if (SgBitOrOp::pools.empty() == false)
114465 : {
114466 : // Generate an array of memory pools
114467 0 : SgBitOrOp** objectArray = (SgBitOrOp**) &(SgBitOrOp::pools[0]);
114468 :
114469 : // Build a local variable for better performance
114470 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
114471 :
114472 : // Iterate over the memory pools
114473 0 : bool done = false;
114474 0 : unsigned i=0;
114475 :
114476 : // find the first valid IR node, call visit function, and then leave
114477 0 : while ( done == false && i < SgBitOrOp::pools.size() )
114478 : {
114479 : // objectArray[i] is a single memory pool
114480 : unsigned j=0;
114481 0 : while (done == false && j < SgBitOrOp::pool_size)
114482 : {
114483 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
114484 : {
114485 0 : traversal.visit(&(objectArray[i][j]));
114486 0 : done = true;
114487 : }
114488 0 : j++;
114489 : }
114490 0 : i++;
114491 : }
114492 :
114493 : #if 0
114494 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
114495 : if (done == false)
114496 : {
114497 : printf ("No representative for SgBitOrOp found in memory pools \n");
114498 : }
114499 : #endif
114500 : }
114501 0 : }
114502 :
114503 :
114504 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
114505 : // using values that overflow signed values of int.
114506 : size_t
114507 4 : SgBitOrOp::numberOfNodes()
114508 : {
114509 : // This function traverses the memory pool for an IR node and
114510 : // counts the number of IR nodes of a particular Sage III IR
114511 : // nodes type.
114512 :
114513 4 : size_t count = 0;
114514 4 : if (SgBitOrOp::pools.empty() == false)
114515 : {
114516 : // Generate an array of memory pools (this is actually a STL vector,
114517 : // but it is contiguious, so OK to treat this way).
114518 1 : SgBitOrOp** objectArray = (SgBitOrOp**) &(SgBitOrOp::pools[0]);
114519 :
114520 : // Build a local variable for better performance (make it a loop invariant variable).
114521 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
114522 :
114523 : // Iterate over all of the memory pools for this IR node.
114524 2 : for (unsigned int i=0; i < SgBitOrOp::pools.size(); i++)
114525 : {
114526 : // objectArray[i] is a single memory pool, iterate over all the
114527 : // IR nodes and only count those that are valid IR nodes used in
114528 : // the AST (i.e. allocated IR nodes).
114529 2001 : for (unsigned j=0; j < SgBitOrOp::pool_size; j++)
114530 : {
114531 : // This is indexing the STL vector of C/C++ style arrays as a doubly
114532 : // indexed array access. It is OK since we have leveraged the semantics
114533 : // of STL vector memory as contigous and cast the memory as an array
114534 : // of arrays to use the 2D array indexing. Hope this is not confusing,
114535 : // but it s very fast as an implementation.
114536 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
114537 : {
114538 15 : count++;
114539 : }
114540 : }
114541 : }
114542 : }
114543 :
114544 :
114545 :
114546 4 : return count;
114547 : }
114548 :
114549 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
114550 : // using values that overflow signed values of int.
114551 : size_t
114552 0 : SgBitOrOp::memoryUsage()
114553 : {
114554 : // This function is required because we need the class name as a type when we call sizeof
114555 : // There might be another way to implement this if we have a traversal that only called a
114556 : // representative object (one call for each type of Sage IIIIR node).
114557 0 : size_t memory = numberOfNodes() * sizeof(SgBitOrOp);
114558 :
114559 0 : return memory;
114560 : }
114561 :
114562 : /* #line 114563 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
114563 :
114564 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
114565 : void
114566 5342 : SgBitEqvOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
114567 : {
114568 : // This function traverses the memory pool for only a specific IR node
114569 : // and calls the visit function of the input class execute a traversal
114570 : // similar to the style of the attribute based traversals within ROSE.
114571 : // This traversal will visit ALL nodes of the AST where as the other
114572 : // attribute based traversals visit only the embedded tree within the AST.
114573 :
114574 : // Initialize array to the address of the first element of the STL vector
114575 : // (which is guaranteed to be contiguous storage).
114576 : // SgBitEqvOp objectArray [] = *(Memory_Block_List.begin());
114577 5342 : if (SgBitEqvOp::pools.empty() == false)
114578 : {
114579 : // Generate an array of memory pools
114580 0 : SgBitEqvOp** objectArray = (SgBitEqvOp**) &(SgBitEqvOp::pools[0]);
114581 :
114582 : // Build a local variable for better performance
114583 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
114584 : #if 0
114585 : // Iterate over the memory pools
114586 : for (unsigned int i=0; i < SgBitEqvOp::pools.size(); i++)
114587 : {
114588 : // objectArray[i] is a single memory pool
114589 : for (int j=0; j < SgBitEqvOp::pool_size; j++)
114590 : {
114591 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
114592 : {
114593 : traversal.visit(&(objectArray[i][j]));
114594 : }
114595 : }
114596 : }
114597 : #else
114598 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
114599 : // compute the list first and then call the visit function on each list element.
114600 :
114601 : // printf ("Inside of SgBitEqvOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
114602 :
114603 0 : std::vector<SgBitEqvOp*> nodeList;
114604 :
114605 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
114606 0 : for (unsigned int i=0; i < SgBitEqvOp::pools.size(); i++)
114607 : {
114608 : // objectArray[i] is a single memory pool
114609 0 : for (unsigned j=0; j < SgBitEqvOp::pool_size; j++)
114610 : {
114611 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
114612 : {
114613 0 : nodeList.push_back(&(objectArray[i][j]));
114614 : }
114615 : }
114616 : }
114617 :
114618 : // Iterate over the saved list
114619 0 : size_t nodeListSize = nodeList.size();
114620 0 : for (size_t i=0; i < nodeListSize; i++)
114621 : {
114622 0 : ROSE_ASSERT(nodeList[i] != NULL);
114623 : #if 0
114624 : traversal.visit(nodeList[i]);
114625 : #else
114626 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
114627 : {
114628 0 : traversal.visit(nodeList[i]);
114629 : }
114630 : #endif
114631 : }
114632 : #endif
114633 : }
114634 :
114635 : // This should not be required since all previously static data members are
114636 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
114637 :
114638 5342 : }
114639 :
114640 :
114641 : void
114642 194 : SgBitEqvOp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
114643 : {
114644 : // This function traverses the memory pool for an IR node and
114645 : // calls the function to execute the visitor object.
114646 :
114647 : // Initialize array to the address of the first element of the STL vector
114648 : // (which is guarenteed to be contiguous storage).
114649 : // SgBitEqvOp objectArray [] = *(Memory_Block_List.begin());
114650 194 : if (SgBitEqvOp::pools.empty() == false)
114651 : {
114652 : // Generate an array of memory pools
114653 0 : SgBitEqvOp** objectArray = (SgBitEqvOp**) &(SgBitEqvOp::pools[0]);
114654 :
114655 : // Build a local variable for better performance
114656 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
114657 :
114658 : // Iterate over the memory pools
114659 0 : for (unsigned int i=0; i < SgBitEqvOp::pools.size(); i++)
114660 : {
114661 : // objectArray[i] is a single memory pool
114662 0 : for (unsigned j=0; j < SgBitEqvOp::pool_size; j++)
114663 : {
114664 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
114665 : {
114666 : // printf ("Found a valid SgBitEqvOp object in the memory pool %d at position %d \n",i,j);
114667 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
114668 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
114669 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
114670 : }
114671 : else
114672 : {
114673 : // printf ("Found a INVALID SgBitEqvOp object in the memory pool \n");
114674 : }
114675 : }
114676 : }
114677 : }
114678 :
114679 : // This should not be required since all previously static data members are
114680 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
114681 :
114682 194 : }
114683 :
114684 : void
114685 0 : SgBitEqvOp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
114686 : {
114687 : // This function visits only a single IR node of the memory pool.
114688 : // it is typically called once for each type of IR node within
114689 : // the automatically generated function: traverseRepresentativeNodes().
114690 :
114691 : // Initialize array to the address of the first element of the STL vector
114692 : // (which is guarenteed to be contiguous storage).
114693 : // SgBitEqvOp objectArray [] = *(Memory_Block_List.begin());
114694 0 : if (SgBitEqvOp::pools.empty() == false)
114695 : {
114696 : // Generate an array of memory pools
114697 0 : SgBitEqvOp** objectArray = (SgBitEqvOp**) &(SgBitEqvOp::pools[0]);
114698 :
114699 : // Build a local variable for better performance
114700 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
114701 :
114702 : // Iterate over the memory pools
114703 0 : bool done = false;
114704 0 : unsigned i=0;
114705 :
114706 : // find the first valid IR node, call visit function, and then leave
114707 0 : while ( done == false && i < SgBitEqvOp::pools.size() )
114708 : {
114709 : // objectArray[i] is a single memory pool
114710 : unsigned j=0;
114711 0 : while (done == false && j < SgBitEqvOp::pool_size)
114712 : {
114713 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
114714 : {
114715 0 : traversal.visit(&(objectArray[i][j]));
114716 0 : done = true;
114717 : }
114718 0 : j++;
114719 : }
114720 0 : i++;
114721 : }
114722 :
114723 : #if 0
114724 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
114725 : if (done == false)
114726 : {
114727 : printf ("No representative for SgBitEqvOp found in memory pools \n");
114728 : }
114729 : #endif
114730 : }
114731 0 : }
114732 :
114733 :
114734 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
114735 : // using values that overflow signed values of int.
114736 : size_t
114737 4 : SgBitEqvOp::numberOfNodes()
114738 : {
114739 : // This function traverses the memory pool for an IR node and
114740 : // counts the number of IR nodes of a particular Sage III IR
114741 : // nodes type.
114742 :
114743 4 : size_t count = 0;
114744 4 : if (SgBitEqvOp::pools.empty() == false)
114745 : {
114746 : // Generate an array of memory pools (this is actually a STL vector,
114747 : // but it is contiguious, so OK to treat this way).
114748 0 : SgBitEqvOp** objectArray = (SgBitEqvOp**) &(SgBitEqvOp::pools[0]);
114749 :
114750 : // Build a local variable for better performance (make it a loop invariant variable).
114751 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
114752 :
114753 : // Iterate over all of the memory pools for this IR node.
114754 0 : for (unsigned int i=0; i < SgBitEqvOp::pools.size(); i++)
114755 : {
114756 : // objectArray[i] is a single memory pool, iterate over all the
114757 : // IR nodes and only count those that are valid IR nodes used in
114758 : // the AST (i.e. allocated IR nodes).
114759 0 : for (unsigned j=0; j < SgBitEqvOp::pool_size; j++)
114760 : {
114761 : // This is indexing the STL vector of C/C++ style arrays as a doubly
114762 : // indexed array access. It is OK since we have leveraged the semantics
114763 : // of STL vector memory as contigous and cast the memory as an array
114764 : // of arrays to use the 2D array indexing. Hope this is not confusing,
114765 : // but it s very fast as an implementation.
114766 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
114767 : {
114768 0 : count++;
114769 : }
114770 : }
114771 : }
114772 : }
114773 :
114774 :
114775 :
114776 4 : return count;
114777 : }
114778 :
114779 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
114780 : // using values that overflow signed values of int.
114781 : size_t
114782 0 : SgBitEqvOp::memoryUsage()
114783 : {
114784 : // This function is required because we need the class name as a type when we call sizeof
114785 : // There might be another way to implement this if we have a traversal that only called a
114786 : // representative object (one call for each type of Sage IIIIR node).
114787 0 : size_t memory = numberOfNodes() * sizeof(SgBitEqvOp);
114788 :
114789 0 : return memory;
114790 : }
114791 :
114792 : /* #line 114793 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
114793 :
114794 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
114795 : void
114796 5342 : SgCommaOpExp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
114797 : {
114798 : // This function traverses the memory pool for only a specific IR node
114799 : // and calls the visit function of the input class execute a traversal
114800 : // similar to the style of the attribute based traversals within ROSE.
114801 : // This traversal will visit ALL nodes of the AST where as the other
114802 : // attribute based traversals visit only the embedded tree within the AST.
114803 :
114804 : // Initialize array to the address of the first element of the STL vector
114805 : // (which is guaranteed to be contiguous storage).
114806 : // SgCommaOpExp objectArray [] = *(Memory_Block_List.begin());
114807 5342 : if (SgCommaOpExp::pools.empty() == false)
114808 : {
114809 : // Generate an array of memory pools
114810 603 : SgCommaOpExp** objectArray = (SgCommaOpExp**) &(SgCommaOpExp::pools[0]);
114811 :
114812 : // Build a local variable for better performance
114813 603 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
114814 : #if 0
114815 : // Iterate over the memory pools
114816 : for (unsigned int i=0; i < SgCommaOpExp::pools.size(); i++)
114817 : {
114818 : // objectArray[i] is a single memory pool
114819 : for (int j=0; j < SgCommaOpExp::pool_size; j++)
114820 : {
114821 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
114822 : {
114823 : traversal.visit(&(objectArray[i][j]));
114824 : }
114825 : }
114826 : }
114827 : #else
114828 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
114829 : // compute the list first and then call the visit function on each list element.
114830 :
114831 : // printf ("Inside of SgCommaOpExp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
114832 :
114833 1206 : std::vector<SgCommaOpExp*> nodeList;
114834 :
114835 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
114836 1206 : for (unsigned int i=0; i < SgCommaOpExp::pools.size(); i++)
114837 : {
114838 : // objectArray[i] is a single memory pool
114839 1206600 : for (unsigned j=0; j < SgCommaOpExp::pool_size; j++)
114840 : {
114841 1206000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
114842 : {
114843 3699 : nodeList.push_back(&(objectArray[i][j]));
114844 : }
114845 : }
114846 : }
114847 :
114848 : // Iterate over the saved list
114849 603 : size_t nodeListSize = nodeList.size();
114850 4302 : for (size_t i=0; i < nodeListSize; i++)
114851 : {
114852 3699 : ROSE_ASSERT(nodeList[i] != NULL);
114853 : #if 0
114854 : traversal.visit(nodeList[i]);
114855 : #else
114856 3699 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
114857 : {
114858 3699 : traversal.visit(nodeList[i]);
114859 : }
114860 : #endif
114861 : }
114862 : #endif
114863 : }
114864 :
114865 : // This should not be required since all previously static data members are
114866 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
114867 :
114868 5342 : }
114869 :
114870 :
114871 : void
114872 194 : SgCommaOpExp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
114873 : {
114874 : // This function traverses the memory pool for an IR node and
114875 : // calls the function to execute the visitor object.
114876 :
114877 : // Initialize array to the address of the first element of the STL vector
114878 : // (which is guarenteed to be contiguous storage).
114879 : // SgCommaOpExp objectArray [] = *(Memory_Block_List.begin());
114880 194 : if (SgCommaOpExp::pools.empty() == false)
114881 : {
114882 : // Generate an array of memory pools
114883 139 : SgCommaOpExp** objectArray = (SgCommaOpExp**) &(SgCommaOpExp::pools[0]);
114884 :
114885 : // Build a local variable for better performance
114886 139 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
114887 :
114888 : // Iterate over the memory pools
114889 278 : for (unsigned int i=0; i < SgCommaOpExp::pools.size(); i++)
114890 : {
114891 : // objectArray[i] is a single memory pool
114892 278139 : for (unsigned j=0; j < SgCommaOpExp::pool_size; j++)
114893 : {
114894 278000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
114895 : {
114896 : // printf ("Found a valid SgCommaOpExp object in the memory pool %d at position %d \n",i,j);
114897 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
114898 2466 : objectArray[i][j].executeVisitorMemberFunction(visitor);
114899 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
114900 : }
114901 : else
114902 : {
114903 : // printf ("Found a INVALID SgCommaOpExp object in the memory pool \n");
114904 : }
114905 : }
114906 : }
114907 : }
114908 :
114909 : // This should not be required since all previously static data members are
114910 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
114911 :
114912 194 : }
114913 :
114914 : void
114915 0 : SgCommaOpExp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
114916 : {
114917 : // This function visits only a single IR node of the memory pool.
114918 : // it is typically called once for each type of IR node within
114919 : // the automatically generated function: traverseRepresentativeNodes().
114920 :
114921 : // Initialize array to the address of the first element of the STL vector
114922 : // (which is guarenteed to be contiguous storage).
114923 : // SgCommaOpExp objectArray [] = *(Memory_Block_List.begin());
114924 0 : if (SgCommaOpExp::pools.empty() == false)
114925 : {
114926 : // Generate an array of memory pools
114927 0 : SgCommaOpExp** objectArray = (SgCommaOpExp**) &(SgCommaOpExp::pools[0]);
114928 :
114929 : // Build a local variable for better performance
114930 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
114931 :
114932 : // Iterate over the memory pools
114933 0 : bool done = false;
114934 0 : unsigned i=0;
114935 :
114936 : // find the first valid IR node, call visit function, and then leave
114937 0 : while ( done == false && i < SgCommaOpExp::pools.size() )
114938 : {
114939 : // objectArray[i] is a single memory pool
114940 : unsigned j=0;
114941 0 : while (done == false && j < SgCommaOpExp::pool_size)
114942 : {
114943 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
114944 : {
114945 0 : traversal.visit(&(objectArray[i][j]));
114946 0 : done = true;
114947 : }
114948 0 : j++;
114949 : }
114950 0 : i++;
114951 : }
114952 :
114953 : #if 0
114954 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
114955 : if (done == false)
114956 : {
114957 : printf ("No representative for SgCommaOpExp found in memory pools \n");
114958 : }
114959 : #endif
114960 : }
114961 0 : }
114962 :
114963 :
114964 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
114965 : // using values that overflow signed values of int.
114966 : size_t
114967 4 : SgCommaOpExp::numberOfNodes()
114968 : {
114969 : // This function traverses the memory pool for an IR node and
114970 : // counts the number of IR nodes of a particular Sage III IR
114971 : // nodes type.
114972 :
114973 4 : size_t count = 0;
114974 4 : if (SgCommaOpExp::pools.empty() == false)
114975 : {
114976 : // Generate an array of memory pools (this is actually a STL vector,
114977 : // but it is contiguious, so OK to treat this way).
114978 1 : SgCommaOpExp** objectArray = (SgCommaOpExp**) &(SgCommaOpExp::pools[0]);
114979 :
114980 : // Build a local variable for better performance (make it a loop invariant variable).
114981 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
114982 :
114983 : // Iterate over all of the memory pools for this IR node.
114984 2 : for (unsigned int i=0; i < SgCommaOpExp::pools.size(); i++)
114985 : {
114986 : // objectArray[i] is a single memory pool, iterate over all the
114987 : // IR nodes and only count those that are valid IR nodes used in
114988 : // the AST (i.e. allocated IR nodes).
114989 2001 : for (unsigned j=0; j < SgCommaOpExp::pool_size; j++)
114990 : {
114991 : // This is indexing the STL vector of C/C++ style arrays as a doubly
114992 : // indexed array access. It is OK since we have leveraged the semantics
114993 : // of STL vector memory as contigous and cast the memory as an array
114994 : // of arrays to use the 2D array indexing. Hope this is not confusing,
114995 : // but it s very fast as an implementation.
114996 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
114997 : {
114998 16 : count++;
114999 : }
115000 : }
115001 : }
115002 : }
115003 :
115004 :
115005 :
115006 4 : return count;
115007 : }
115008 :
115009 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
115010 : // using values that overflow signed values of int.
115011 : size_t
115012 0 : SgCommaOpExp::memoryUsage()
115013 : {
115014 : // This function is required because we need the class name as a type when we call sizeof
115015 : // There might be another way to implement this if we have a traversal that only called a
115016 : // representative object (one call for each type of Sage IIIIR node).
115017 0 : size_t memory = numberOfNodes() * sizeof(SgCommaOpExp);
115018 :
115019 0 : return memory;
115020 : }
115021 :
115022 : /* #line 115023 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
115023 :
115024 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
115025 : void
115026 5342 : SgLshiftOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
115027 : {
115028 : // This function traverses the memory pool for only a specific IR node
115029 : // and calls the visit function of the input class execute a traversal
115030 : // similar to the style of the attribute based traversals within ROSE.
115031 : // This traversal will visit ALL nodes of the AST where as the other
115032 : // attribute based traversals visit only the embedded tree within the AST.
115033 :
115034 : // Initialize array to the address of the first element of the STL vector
115035 : // (which is guaranteed to be contiguous storage).
115036 : // SgLshiftOp objectArray [] = *(Memory_Block_List.begin());
115037 5342 : if (SgLshiftOp::pools.empty() == false)
115038 : {
115039 : // Generate an array of memory pools
115040 168 : SgLshiftOp** objectArray = (SgLshiftOp**) &(SgLshiftOp::pools[0]);
115041 :
115042 : // Build a local variable for better performance
115043 168 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
115044 : #if 0
115045 : // Iterate over the memory pools
115046 : for (unsigned int i=0; i < SgLshiftOp::pools.size(); i++)
115047 : {
115048 : // objectArray[i] is a single memory pool
115049 : for (int j=0; j < SgLshiftOp::pool_size; j++)
115050 : {
115051 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
115052 : {
115053 : traversal.visit(&(objectArray[i][j]));
115054 : }
115055 : }
115056 : }
115057 : #else
115058 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
115059 : // compute the list first and then call the visit function on each list element.
115060 :
115061 : // printf ("Inside of SgLshiftOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
115062 :
115063 336 : std::vector<SgLshiftOp*> nodeList;
115064 :
115065 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
115066 336 : for (unsigned int i=0; i < SgLshiftOp::pools.size(); i++)
115067 : {
115068 : // objectArray[i] is a single memory pool
115069 336168 : for (unsigned j=0; j < SgLshiftOp::pool_size; j++)
115070 : {
115071 336000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
115072 : {
115073 26715 : nodeList.push_back(&(objectArray[i][j]));
115074 : }
115075 : }
115076 : }
115077 :
115078 : // Iterate over the saved list
115079 168 : size_t nodeListSize = nodeList.size();
115080 26883 : for (size_t i=0; i < nodeListSize; i++)
115081 : {
115082 26715 : ROSE_ASSERT(nodeList[i] != NULL);
115083 : #if 0
115084 : traversal.visit(nodeList[i]);
115085 : #else
115086 26715 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
115087 : {
115088 26715 : traversal.visit(nodeList[i]);
115089 : }
115090 : #endif
115091 : }
115092 : #endif
115093 : }
115094 :
115095 : // This should not be required since all previously static data members are
115096 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
115097 :
115098 5342 : }
115099 :
115100 :
115101 : void
115102 194 : SgLshiftOp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
115103 : {
115104 : // This function traverses the memory pool for an IR node and
115105 : // calls the function to execute the visitor object.
115106 :
115107 : // Initialize array to the address of the first element of the STL vector
115108 : // (which is guarenteed to be contiguous storage).
115109 : // SgLshiftOp objectArray [] = *(Memory_Block_List.begin());
115110 194 : if (SgLshiftOp::pools.empty() == false)
115111 : {
115112 : // Generate an array of memory pools
115113 137 : SgLshiftOp** objectArray = (SgLshiftOp**) &(SgLshiftOp::pools[0]);
115114 :
115115 : // Build a local variable for better performance
115116 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
115117 :
115118 : // Iterate over the memory pools
115119 274 : for (unsigned int i=0; i < SgLshiftOp::pools.size(); i++)
115120 : {
115121 : // objectArray[i] is a single memory pool
115122 274137 : for (unsigned j=0; j < SgLshiftOp::pool_size; j++)
115123 : {
115124 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
115125 : {
115126 : // printf ("Found a valid SgLshiftOp object in the memory pool %d at position %d \n",i,j);
115127 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
115128 3771 : objectArray[i][j].executeVisitorMemberFunction(visitor);
115129 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
115130 : }
115131 : else
115132 : {
115133 : // printf ("Found a INVALID SgLshiftOp object in the memory pool \n");
115134 : }
115135 : }
115136 : }
115137 : }
115138 :
115139 : // This should not be required since all previously static data members are
115140 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
115141 :
115142 194 : }
115143 :
115144 : void
115145 0 : SgLshiftOp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
115146 : {
115147 : // This function visits only a single IR node of the memory pool.
115148 : // it is typically called once for each type of IR node within
115149 : // the automatically generated function: traverseRepresentativeNodes().
115150 :
115151 : // Initialize array to the address of the first element of the STL vector
115152 : // (which is guarenteed to be contiguous storage).
115153 : // SgLshiftOp objectArray [] = *(Memory_Block_List.begin());
115154 0 : if (SgLshiftOp::pools.empty() == false)
115155 : {
115156 : // Generate an array of memory pools
115157 0 : SgLshiftOp** objectArray = (SgLshiftOp**) &(SgLshiftOp::pools[0]);
115158 :
115159 : // Build a local variable for better performance
115160 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
115161 :
115162 : // Iterate over the memory pools
115163 0 : bool done = false;
115164 0 : unsigned i=0;
115165 :
115166 : // find the first valid IR node, call visit function, and then leave
115167 0 : while ( done == false && i < SgLshiftOp::pools.size() )
115168 : {
115169 : // objectArray[i] is a single memory pool
115170 : unsigned j=0;
115171 0 : while (done == false && j < SgLshiftOp::pool_size)
115172 : {
115173 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
115174 : {
115175 0 : traversal.visit(&(objectArray[i][j]));
115176 0 : done = true;
115177 : }
115178 0 : j++;
115179 : }
115180 0 : i++;
115181 : }
115182 :
115183 : #if 0
115184 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
115185 : if (done == false)
115186 : {
115187 : printf ("No representative for SgLshiftOp found in memory pools \n");
115188 : }
115189 : #endif
115190 : }
115191 0 : }
115192 :
115193 :
115194 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
115195 : // using values that overflow signed values of int.
115196 : size_t
115197 4 : SgLshiftOp::numberOfNodes()
115198 : {
115199 : // This function traverses the memory pool for an IR node and
115200 : // counts the number of IR nodes of a particular Sage III IR
115201 : // nodes type.
115202 :
115203 4 : size_t count = 0;
115204 4 : if (SgLshiftOp::pools.empty() == false)
115205 : {
115206 : // Generate an array of memory pools (this is actually a STL vector,
115207 : // but it is contiguious, so OK to treat this way).
115208 1 : SgLshiftOp** objectArray = (SgLshiftOp**) &(SgLshiftOp::pools[0]);
115209 :
115210 : // Build a local variable for better performance (make it a loop invariant variable).
115211 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
115212 :
115213 : // Iterate over all of the memory pools for this IR node.
115214 2 : for (unsigned int i=0; i < SgLshiftOp::pools.size(); i++)
115215 : {
115216 : // objectArray[i] is a single memory pool, iterate over all the
115217 : // IR nodes and only count those that are valid IR nodes used in
115218 : // the AST (i.e. allocated IR nodes).
115219 2001 : for (unsigned j=0; j < SgLshiftOp::pool_size; j++)
115220 : {
115221 : // This is indexing the STL vector of C/C++ style arrays as a doubly
115222 : // indexed array access. It is OK since we have leveraged the semantics
115223 : // of STL vector memory as contigous and cast the memory as an array
115224 : // of arrays to use the 2D array indexing. Hope this is not confusing,
115225 : // but it s very fast as an implementation.
115226 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
115227 : {
115228 27 : count++;
115229 : }
115230 : }
115231 : }
115232 : }
115233 :
115234 :
115235 :
115236 4 : return count;
115237 : }
115238 :
115239 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
115240 : // using values that overflow signed values of int.
115241 : size_t
115242 0 : SgLshiftOp::memoryUsage()
115243 : {
115244 : // This function is required because we need the class name as a type when we call sizeof
115245 : // There might be another way to implement this if we have a traversal that only called a
115246 : // representative object (one call for each type of Sage IIIIR node).
115247 0 : size_t memory = numberOfNodes() * sizeof(SgLshiftOp);
115248 :
115249 0 : return memory;
115250 : }
115251 :
115252 : /* #line 115253 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
115253 :
115254 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
115255 : void
115256 5342 : SgRshiftOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
115257 : {
115258 : // This function traverses the memory pool for only a specific IR node
115259 : // and calls the visit function of the input class execute a traversal
115260 : // similar to the style of the attribute based traversals within ROSE.
115261 : // This traversal will visit ALL nodes of the AST where as the other
115262 : // attribute based traversals visit only the embedded tree within the AST.
115263 :
115264 : // Initialize array to the address of the first element of the STL vector
115265 : // (which is guaranteed to be contiguous storage).
115266 : // SgRshiftOp objectArray [] = *(Memory_Block_List.begin());
115267 5342 : if (SgRshiftOp::pools.empty() == false)
115268 : {
115269 : // Generate an array of memory pools
115270 138 : SgRshiftOp** objectArray = (SgRshiftOp**) &(SgRshiftOp::pools[0]);
115271 :
115272 : // Build a local variable for better performance
115273 138 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
115274 : #if 0
115275 : // Iterate over the memory pools
115276 : for (unsigned int i=0; i < SgRshiftOp::pools.size(); i++)
115277 : {
115278 : // objectArray[i] is a single memory pool
115279 : for (int j=0; j < SgRshiftOp::pool_size; j++)
115280 : {
115281 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
115282 : {
115283 : traversal.visit(&(objectArray[i][j]));
115284 : }
115285 : }
115286 : }
115287 : #else
115288 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
115289 : // compute the list first and then call the visit function on each list element.
115290 :
115291 : // printf ("Inside of SgRshiftOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
115292 :
115293 276 : std::vector<SgRshiftOp*> nodeList;
115294 :
115295 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
115296 276 : for (unsigned int i=0; i < SgRshiftOp::pools.size(); i++)
115297 : {
115298 : // objectArray[i] is a single memory pool
115299 276138 : for (unsigned j=0; j < SgRshiftOp::pool_size; j++)
115300 : {
115301 276000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
115302 : {
115303 6543 : nodeList.push_back(&(objectArray[i][j]));
115304 : }
115305 : }
115306 : }
115307 :
115308 : // Iterate over the saved list
115309 138 : size_t nodeListSize = nodeList.size();
115310 6681 : for (size_t i=0; i < nodeListSize; i++)
115311 : {
115312 6543 : ROSE_ASSERT(nodeList[i] != NULL);
115313 : #if 0
115314 : traversal.visit(nodeList[i]);
115315 : #else
115316 6543 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
115317 : {
115318 6543 : traversal.visit(nodeList[i]);
115319 : }
115320 : #endif
115321 : }
115322 : #endif
115323 : }
115324 :
115325 : // This should not be required since all previously static data members are
115326 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
115327 :
115328 5342 : }
115329 :
115330 :
115331 : void
115332 194 : SgRshiftOp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
115333 : {
115334 : // This function traverses the memory pool for an IR node and
115335 : // calls the function to execute the visitor object.
115336 :
115337 : // Initialize array to the address of the first element of the STL vector
115338 : // (which is guarenteed to be contiguous storage).
115339 : // SgRshiftOp objectArray [] = *(Memory_Block_List.begin());
115340 194 : if (SgRshiftOp::pools.empty() == false)
115341 : {
115342 : // Generate an array of memory pools
115343 137 : SgRshiftOp** objectArray = (SgRshiftOp**) &(SgRshiftOp::pools[0]);
115344 :
115345 : // Build a local variable for better performance
115346 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
115347 :
115348 : // Iterate over the memory pools
115349 274 : for (unsigned int i=0; i < SgRshiftOp::pools.size(); i++)
115350 : {
115351 : // objectArray[i] is a single memory pool
115352 274137 : for (unsigned j=0; j < SgRshiftOp::pool_size; j++)
115353 : {
115354 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
115355 : {
115356 : // printf ("Found a valid SgRshiftOp object in the memory pool %d at position %d \n",i,j);
115357 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
115358 1114 : objectArray[i][j].executeVisitorMemberFunction(visitor);
115359 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
115360 : }
115361 : else
115362 : {
115363 : // printf ("Found a INVALID SgRshiftOp object in the memory pool \n");
115364 : }
115365 : }
115366 : }
115367 : }
115368 :
115369 : // This should not be required since all previously static data members are
115370 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
115371 :
115372 194 : }
115373 :
115374 : void
115375 0 : SgRshiftOp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
115376 : {
115377 : // This function visits only a single IR node of the memory pool.
115378 : // it is typically called once for each type of IR node within
115379 : // the automatically generated function: traverseRepresentativeNodes().
115380 :
115381 : // Initialize array to the address of the first element of the STL vector
115382 : // (which is guarenteed to be contiguous storage).
115383 : // SgRshiftOp objectArray [] = *(Memory_Block_List.begin());
115384 0 : if (SgRshiftOp::pools.empty() == false)
115385 : {
115386 : // Generate an array of memory pools
115387 0 : SgRshiftOp** objectArray = (SgRshiftOp**) &(SgRshiftOp::pools[0]);
115388 :
115389 : // Build a local variable for better performance
115390 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
115391 :
115392 : // Iterate over the memory pools
115393 0 : bool done = false;
115394 0 : unsigned i=0;
115395 :
115396 : // find the first valid IR node, call visit function, and then leave
115397 0 : while ( done == false && i < SgRshiftOp::pools.size() )
115398 : {
115399 : // objectArray[i] is a single memory pool
115400 : unsigned j=0;
115401 0 : while (done == false && j < SgRshiftOp::pool_size)
115402 : {
115403 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
115404 : {
115405 0 : traversal.visit(&(objectArray[i][j]));
115406 0 : done = true;
115407 : }
115408 0 : j++;
115409 : }
115410 0 : i++;
115411 : }
115412 :
115413 : #if 0
115414 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
115415 : if (done == false)
115416 : {
115417 : printf ("No representative for SgRshiftOp found in memory pools \n");
115418 : }
115419 : #endif
115420 : }
115421 0 : }
115422 :
115423 :
115424 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
115425 : // using values that overflow signed values of int.
115426 : size_t
115427 4 : SgRshiftOp::numberOfNodes()
115428 : {
115429 : // This function traverses the memory pool for an IR node and
115430 : // counts the number of IR nodes of a particular Sage III IR
115431 : // nodes type.
115432 :
115433 4 : size_t count = 0;
115434 4 : if (SgRshiftOp::pools.empty() == false)
115435 : {
115436 : // Generate an array of memory pools (this is actually a STL vector,
115437 : // but it is contiguious, so OK to treat this way).
115438 1 : SgRshiftOp** objectArray = (SgRshiftOp**) &(SgRshiftOp::pools[0]);
115439 :
115440 : // Build a local variable for better performance (make it a loop invariant variable).
115441 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
115442 :
115443 : // Iterate over all of the memory pools for this IR node.
115444 2 : for (unsigned int i=0; i < SgRshiftOp::pools.size(); i++)
115445 : {
115446 : // objectArray[i] is a single memory pool, iterate over all the
115447 : // IR nodes and only count those that are valid IR nodes used in
115448 : // the AST (i.e. allocated IR nodes).
115449 2001 : for (unsigned j=0; j < SgRshiftOp::pool_size; j++)
115450 : {
115451 : // This is indexing the STL vector of C/C++ style arrays as a doubly
115452 : // indexed array access. It is OK since we have leveraged the semantics
115453 : // of STL vector memory as contigous and cast the memory as an array
115454 : // of arrays to use the 2D array indexing. Hope this is not confusing,
115455 : // but it s very fast as an implementation.
115456 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
115457 : {
115458 8 : count++;
115459 : }
115460 : }
115461 : }
115462 : }
115463 :
115464 :
115465 :
115466 4 : return count;
115467 : }
115468 :
115469 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
115470 : // using values that overflow signed values of int.
115471 : size_t
115472 0 : SgRshiftOp::memoryUsage()
115473 : {
115474 : // This function is required because we need the class name as a type when we call sizeof
115475 : // There might be another way to implement this if we have a traversal that only called a
115476 : // representative object (one call for each type of Sage IIIIR node).
115477 0 : size_t memory = numberOfNodes() * sizeof(SgRshiftOp);
115478 :
115479 0 : return memory;
115480 : }
115481 :
115482 : /* #line 115483 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
115483 :
115484 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
115485 : void
115486 5342 : SgPntrArrRefExp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
115487 : {
115488 : // This function traverses the memory pool for only a specific IR node
115489 : // and calls the visit function of the input class execute a traversal
115490 : // similar to the style of the attribute based traversals within ROSE.
115491 : // This traversal will visit ALL nodes of the AST where as the other
115492 : // attribute based traversals visit only the embedded tree within the AST.
115493 :
115494 : // Initialize array to the address of the first element of the STL vector
115495 : // (which is guaranteed to be contiguous storage).
115496 : // SgPntrArrRefExp objectArray [] = *(Memory_Block_List.begin());
115497 5342 : if (SgPntrArrRefExp::pools.empty() == false)
115498 : {
115499 : // Generate an array of memory pools
115500 2113 : SgPntrArrRefExp** objectArray = (SgPntrArrRefExp**) &(SgPntrArrRefExp::pools[0]);
115501 :
115502 : // Build a local variable for better performance
115503 2113 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
115504 : #if 0
115505 : // Iterate over the memory pools
115506 : for (unsigned int i=0; i < SgPntrArrRefExp::pools.size(); i++)
115507 : {
115508 : // objectArray[i] is a single memory pool
115509 : for (int j=0; j < SgPntrArrRefExp::pool_size; j++)
115510 : {
115511 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
115512 : {
115513 : traversal.visit(&(objectArray[i][j]));
115514 : }
115515 : }
115516 : }
115517 : #else
115518 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
115519 : // compute the list first and then call the visit function on each list element.
115520 :
115521 : // printf ("Inside of SgPntrArrRefExp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
115522 :
115523 4226 : std::vector<SgPntrArrRefExp*> nodeList;
115524 :
115525 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
115526 4226 : for (unsigned int i=0; i < SgPntrArrRefExp::pools.size(); i++)
115527 : {
115528 : // objectArray[i] is a single memory pool
115529 4228110 : for (unsigned j=0; j < SgPntrArrRefExp::pool_size; j++)
115530 : {
115531 4226000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
115532 : {
115533 29521 : nodeList.push_back(&(objectArray[i][j]));
115534 : }
115535 : }
115536 : }
115537 :
115538 : // Iterate over the saved list
115539 2113 : size_t nodeListSize = nodeList.size();
115540 31634 : for (size_t i=0; i < nodeListSize; i++)
115541 : {
115542 29521 : ROSE_ASSERT(nodeList[i] != NULL);
115543 : #if 0
115544 : traversal.visit(nodeList[i]);
115545 : #else
115546 29521 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
115547 : {
115548 29521 : traversal.visit(nodeList[i]);
115549 : }
115550 : #endif
115551 : }
115552 : #endif
115553 : }
115554 :
115555 : // This should not be required since all previously static data members are
115556 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
115557 :
115558 5342 : }
115559 :
115560 :
115561 : void
115562 194 : SgPntrArrRefExp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
115563 : {
115564 : // This function traverses the memory pool for an IR node and
115565 : // calls the function to execute the visitor object.
115566 :
115567 : // Initialize array to the address of the first element of the STL vector
115568 : // (which is guarenteed to be contiguous storage).
115569 : // SgPntrArrRefExp objectArray [] = *(Memory_Block_List.begin());
115570 194 : if (SgPntrArrRefExp::pools.empty() == false)
115571 : {
115572 : // Generate an array of memory pools
115573 190 : SgPntrArrRefExp** objectArray = (SgPntrArrRefExp**) &(SgPntrArrRefExp::pools[0]);
115574 :
115575 : // Build a local variable for better performance
115576 190 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
115577 :
115578 : // Iterate over the memory pools
115579 380 : for (unsigned int i=0; i < SgPntrArrRefExp::pools.size(); i++)
115580 : {
115581 : // objectArray[i] is a single memory pool
115582 380190 : for (unsigned j=0; j < SgPntrArrRefExp::pool_size; j++)
115583 : {
115584 380000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
115585 : {
115586 : // printf ("Found a valid SgPntrArrRefExp object in the memory pool %d at position %d \n",i,j);
115587 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
115588 17916 : objectArray[i][j].executeVisitorMemberFunction(visitor);
115589 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
115590 : }
115591 : else
115592 : {
115593 : // printf ("Found a INVALID SgPntrArrRefExp object in the memory pool \n");
115594 : }
115595 : }
115596 : }
115597 : }
115598 :
115599 : // This should not be required since all previously static data members are
115600 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
115601 :
115602 194 : }
115603 :
115604 : void
115605 0 : SgPntrArrRefExp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
115606 : {
115607 : // This function visits only a single IR node of the memory pool.
115608 : // it is typically called once for each type of IR node within
115609 : // the automatically generated function: traverseRepresentativeNodes().
115610 :
115611 : // Initialize array to the address of the first element of the STL vector
115612 : // (which is guarenteed to be contiguous storage).
115613 : // SgPntrArrRefExp objectArray [] = *(Memory_Block_List.begin());
115614 0 : if (SgPntrArrRefExp::pools.empty() == false)
115615 : {
115616 : // Generate an array of memory pools
115617 0 : SgPntrArrRefExp** objectArray = (SgPntrArrRefExp**) &(SgPntrArrRefExp::pools[0]);
115618 :
115619 : // Build a local variable for better performance
115620 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
115621 :
115622 : // Iterate over the memory pools
115623 0 : bool done = false;
115624 0 : unsigned i=0;
115625 :
115626 : // find the first valid IR node, call visit function, and then leave
115627 0 : while ( done == false && i < SgPntrArrRefExp::pools.size() )
115628 : {
115629 : // objectArray[i] is a single memory pool
115630 : unsigned j=0;
115631 0 : while (done == false && j < SgPntrArrRefExp::pool_size)
115632 : {
115633 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
115634 : {
115635 0 : traversal.visit(&(objectArray[i][j]));
115636 0 : done = true;
115637 : }
115638 0 : j++;
115639 : }
115640 0 : i++;
115641 : }
115642 :
115643 : #if 0
115644 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
115645 : if (done == false)
115646 : {
115647 : printf ("No representative for SgPntrArrRefExp found in memory pools \n");
115648 : }
115649 : #endif
115650 : }
115651 0 : }
115652 :
115653 :
115654 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
115655 : // using values that overflow signed values of int.
115656 : size_t
115657 4 : SgPntrArrRefExp::numberOfNodes()
115658 : {
115659 : // This function traverses the memory pool for an IR node and
115660 : // counts the number of IR nodes of a particular Sage III IR
115661 : // nodes type.
115662 :
115663 4 : size_t count = 0;
115664 4 : if (SgPntrArrRefExp::pools.empty() == false)
115665 : {
115666 : // Generate an array of memory pools (this is actually a STL vector,
115667 : // but it is contiguious, so OK to treat this way).
115668 1 : SgPntrArrRefExp** objectArray = (SgPntrArrRefExp**) &(SgPntrArrRefExp::pools[0]);
115669 :
115670 : // Build a local variable for better performance (make it a loop invariant variable).
115671 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
115672 :
115673 : // Iterate over all of the memory pools for this IR node.
115674 2 : for (unsigned int i=0; i < SgPntrArrRefExp::pools.size(); i++)
115675 : {
115676 : // objectArray[i] is a single memory pool, iterate over all the
115677 : // IR nodes and only count those that are valid IR nodes used in
115678 : // the AST (i.e. allocated IR nodes).
115679 2001 : for (unsigned j=0; j < SgPntrArrRefExp::pool_size; j++)
115680 : {
115681 : // This is indexing the STL vector of C/C++ style arrays as a doubly
115682 : // indexed array access. It is OK since we have leveraged the semantics
115683 : // of STL vector memory as contigous and cast the memory as an array
115684 : // of arrays to use the 2D array indexing. Hope this is not confusing,
115685 : // but it s very fast as an implementation.
115686 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
115687 : {
115688 126 : count++;
115689 : }
115690 : }
115691 : }
115692 : }
115693 :
115694 :
115695 :
115696 4 : return count;
115697 : }
115698 :
115699 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
115700 : // using values that overflow signed values of int.
115701 : size_t
115702 0 : SgPntrArrRefExp::memoryUsage()
115703 : {
115704 : // This function is required because we need the class name as a type when we call sizeof
115705 : // There might be another way to implement this if we have a traversal that only called a
115706 : // representative object (one call for each type of Sage IIIIR node).
115707 0 : size_t memory = numberOfNodes() * sizeof(SgPntrArrRefExp);
115708 :
115709 0 : return memory;
115710 : }
115711 :
115712 : /* #line 115713 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
115713 :
115714 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
115715 : void
115716 5342 : SgScopeOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
115717 : {
115718 : // This function traverses the memory pool for only a specific IR node
115719 : // and calls the visit function of the input class execute a traversal
115720 : // similar to the style of the attribute based traversals within ROSE.
115721 : // This traversal will visit ALL nodes of the AST where as the other
115722 : // attribute based traversals visit only the embedded tree within the AST.
115723 :
115724 : // Initialize array to the address of the first element of the STL vector
115725 : // (which is guaranteed to be contiguous storage).
115726 : // SgScopeOp objectArray [] = *(Memory_Block_List.begin());
115727 5342 : if (SgScopeOp::pools.empty() == false)
115728 : {
115729 : // Generate an array of memory pools
115730 0 : SgScopeOp** objectArray = (SgScopeOp**) &(SgScopeOp::pools[0]);
115731 :
115732 : // Build a local variable for better performance
115733 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
115734 : #if 0
115735 : // Iterate over the memory pools
115736 : for (unsigned int i=0; i < SgScopeOp::pools.size(); i++)
115737 : {
115738 : // objectArray[i] is a single memory pool
115739 : for (int j=0; j < SgScopeOp::pool_size; j++)
115740 : {
115741 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
115742 : {
115743 : traversal.visit(&(objectArray[i][j]));
115744 : }
115745 : }
115746 : }
115747 : #else
115748 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
115749 : // compute the list first and then call the visit function on each list element.
115750 :
115751 : // printf ("Inside of SgScopeOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
115752 :
115753 0 : std::vector<SgScopeOp*> nodeList;
115754 :
115755 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
115756 0 : for (unsigned int i=0; i < SgScopeOp::pools.size(); i++)
115757 : {
115758 : // objectArray[i] is a single memory pool
115759 0 : for (unsigned j=0; j < SgScopeOp::pool_size; j++)
115760 : {
115761 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
115762 : {
115763 0 : nodeList.push_back(&(objectArray[i][j]));
115764 : }
115765 : }
115766 : }
115767 :
115768 : // Iterate over the saved list
115769 0 : size_t nodeListSize = nodeList.size();
115770 0 : for (size_t i=0; i < nodeListSize; i++)
115771 : {
115772 0 : ROSE_ASSERT(nodeList[i] != NULL);
115773 : #if 0
115774 : traversal.visit(nodeList[i]);
115775 : #else
115776 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
115777 : {
115778 0 : traversal.visit(nodeList[i]);
115779 : }
115780 : #endif
115781 : }
115782 : #endif
115783 : }
115784 :
115785 : // This should not be required since all previously static data members are
115786 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
115787 :
115788 5342 : }
115789 :
115790 :
115791 : void
115792 194 : SgScopeOp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
115793 : {
115794 : // This function traverses the memory pool for an IR node and
115795 : // calls the function to execute the visitor object.
115796 :
115797 : // Initialize array to the address of the first element of the STL vector
115798 : // (which is guarenteed to be contiguous storage).
115799 : // SgScopeOp objectArray [] = *(Memory_Block_List.begin());
115800 194 : if (SgScopeOp::pools.empty() == false)
115801 : {
115802 : // Generate an array of memory pools
115803 0 : SgScopeOp** objectArray = (SgScopeOp**) &(SgScopeOp::pools[0]);
115804 :
115805 : // Build a local variable for better performance
115806 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
115807 :
115808 : // Iterate over the memory pools
115809 0 : for (unsigned int i=0; i < SgScopeOp::pools.size(); i++)
115810 : {
115811 : // objectArray[i] is a single memory pool
115812 0 : for (unsigned j=0; j < SgScopeOp::pool_size; j++)
115813 : {
115814 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
115815 : {
115816 : // printf ("Found a valid SgScopeOp object in the memory pool %d at position %d \n",i,j);
115817 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
115818 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
115819 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
115820 : }
115821 : else
115822 : {
115823 : // printf ("Found a INVALID SgScopeOp object in the memory pool \n");
115824 : }
115825 : }
115826 : }
115827 : }
115828 :
115829 : // This should not be required since all previously static data members are
115830 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
115831 :
115832 194 : }
115833 :
115834 : void
115835 0 : SgScopeOp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
115836 : {
115837 : // This function visits only a single IR node of the memory pool.
115838 : // it is typically called once for each type of IR node within
115839 : // the automatically generated function: traverseRepresentativeNodes().
115840 :
115841 : // Initialize array to the address of the first element of the STL vector
115842 : // (which is guarenteed to be contiguous storage).
115843 : // SgScopeOp objectArray [] = *(Memory_Block_List.begin());
115844 0 : if (SgScopeOp::pools.empty() == false)
115845 : {
115846 : // Generate an array of memory pools
115847 0 : SgScopeOp** objectArray = (SgScopeOp**) &(SgScopeOp::pools[0]);
115848 :
115849 : // Build a local variable for better performance
115850 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
115851 :
115852 : // Iterate over the memory pools
115853 0 : bool done = false;
115854 0 : unsigned i=0;
115855 :
115856 : // find the first valid IR node, call visit function, and then leave
115857 0 : while ( done == false && i < SgScopeOp::pools.size() )
115858 : {
115859 : // objectArray[i] is a single memory pool
115860 : unsigned j=0;
115861 0 : while (done == false && j < SgScopeOp::pool_size)
115862 : {
115863 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
115864 : {
115865 0 : traversal.visit(&(objectArray[i][j]));
115866 0 : done = true;
115867 : }
115868 0 : j++;
115869 : }
115870 0 : i++;
115871 : }
115872 :
115873 : #if 0
115874 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
115875 : if (done == false)
115876 : {
115877 : printf ("No representative for SgScopeOp found in memory pools \n");
115878 : }
115879 : #endif
115880 : }
115881 0 : }
115882 :
115883 :
115884 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
115885 : // using values that overflow signed values of int.
115886 : size_t
115887 4 : SgScopeOp::numberOfNodes()
115888 : {
115889 : // This function traverses the memory pool for an IR node and
115890 : // counts the number of IR nodes of a particular Sage III IR
115891 : // nodes type.
115892 :
115893 4 : size_t count = 0;
115894 4 : if (SgScopeOp::pools.empty() == false)
115895 : {
115896 : // Generate an array of memory pools (this is actually a STL vector,
115897 : // but it is contiguious, so OK to treat this way).
115898 0 : SgScopeOp** objectArray = (SgScopeOp**) &(SgScopeOp::pools[0]);
115899 :
115900 : // Build a local variable for better performance (make it a loop invariant variable).
115901 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
115902 :
115903 : // Iterate over all of the memory pools for this IR node.
115904 0 : for (unsigned int i=0; i < SgScopeOp::pools.size(); i++)
115905 : {
115906 : // objectArray[i] is a single memory pool, iterate over all the
115907 : // IR nodes and only count those that are valid IR nodes used in
115908 : // the AST (i.e. allocated IR nodes).
115909 0 : for (unsigned j=0; j < SgScopeOp::pool_size; j++)
115910 : {
115911 : // This is indexing the STL vector of C/C++ style arrays as a doubly
115912 : // indexed array access. It is OK since we have leveraged the semantics
115913 : // of STL vector memory as contigous and cast the memory as an array
115914 : // of arrays to use the 2D array indexing. Hope this is not confusing,
115915 : // but it s very fast as an implementation.
115916 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
115917 : {
115918 0 : count++;
115919 : }
115920 : }
115921 : }
115922 : }
115923 :
115924 :
115925 :
115926 4 : return count;
115927 : }
115928 :
115929 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
115930 : // using values that overflow signed values of int.
115931 : size_t
115932 0 : SgScopeOp::memoryUsage()
115933 : {
115934 : // This function is required because we need the class name as a type when we call sizeof
115935 : // There might be another way to implement this if we have a traversal that only called a
115936 : // representative object (one call for each type of Sage IIIIR node).
115937 0 : size_t memory = numberOfNodes() * sizeof(SgScopeOp);
115938 :
115939 0 : return memory;
115940 : }
115941 :
115942 : /* #line 115943 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
115943 :
115944 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
115945 : void
115946 5342 : SgAssignOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
115947 : {
115948 : // This function traverses the memory pool for only a specific IR node
115949 : // and calls the visit function of the input class execute a traversal
115950 : // similar to the style of the attribute based traversals within ROSE.
115951 : // This traversal will visit ALL nodes of the AST where as the other
115952 : // attribute based traversals visit only the embedded tree within the AST.
115953 :
115954 : // Initialize array to the address of the first element of the STL vector
115955 : // (which is guaranteed to be contiguous storage).
115956 : // SgAssignOp objectArray [] = *(Memory_Block_List.begin());
115957 5342 : if (SgAssignOp::pools.empty() == false)
115958 : {
115959 : // Generate an array of memory pools
115960 3814 : SgAssignOp** objectArray = (SgAssignOp**) &(SgAssignOp::pools[0]);
115961 :
115962 : // Build a local variable for better performance
115963 3814 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
115964 : #if 0
115965 : // Iterate over the memory pools
115966 : for (unsigned int i=0; i < SgAssignOp::pools.size(); i++)
115967 : {
115968 : // objectArray[i] is a single memory pool
115969 : for (int j=0; j < SgAssignOp::pool_size; j++)
115970 : {
115971 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
115972 : {
115973 : traversal.visit(&(objectArray[i][j]));
115974 : }
115975 : }
115976 : }
115977 : #else
115978 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
115979 : // compute the list first and then call the visit function on each list element.
115980 :
115981 : // printf ("Inside of SgAssignOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
115982 :
115983 7628 : std::vector<SgAssignOp*> nodeList;
115984 :
115985 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
115986 7628 : for (unsigned int i=0; i < SgAssignOp::pools.size(); i++)
115987 : {
115988 : // objectArray[i] is a single memory pool
115989 7631810 : for (unsigned j=0; j < SgAssignOp::pool_size; j++)
115990 : {
115991 7628000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
115992 : {
115993 83247 : nodeList.push_back(&(objectArray[i][j]));
115994 : }
115995 : }
115996 : }
115997 :
115998 : // Iterate over the saved list
115999 3814 : size_t nodeListSize = nodeList.size();
116000 87061 : for (size_t i=0; i < nodeListSize; i++)
116001 : {
116002 83247 : ROSE_ASSERT(nodeList[i] != NULL);
116003 : #if 0
116004 : traversal.visit(nodeList[i]);
116005 : #else
116006 83247 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
116007 : {
116008 83247 : traversal.visit(nodeList[i]);
116009 : }
116010 : #endif
116011 : }
116012 : #endif
116013 : }
116014 :
116015 : // This should not be required since all previously static data members are
116016 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
116017 :
116018 5342 : }
116019 :
116020 :
116021 : void
116022 194 : SgAssignOp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
116023 : {
116024 : // This function traverses the memory pool for an IR node and
116025 : // calls the function to execute the visitor object.
116026 :
116027 : // Initialize array to the address of the first element of the STL vector
116028 : // (which is guarenteed to be contiguous storage).
116029 : // SgAssignOp objectArray [] = *(Memory_Block_List.begin());
116030 194 : if (SgAssignOp::pools.empty() == false)
116031 : {
116032 : // Generate an array of memory pools
116033 194 : SgAssignOp** objectArray = (SgAssignOp**) &(SgAssignOp::pools[0]);
116034 :
116035 : // Build a local variable for better performance
116036 194 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
116037 :
116038 : // Iterate over the memory pools
116039 388 : for (unsigned int i=0; i < SgAssignOp::pools.size(); i++)
116040 : {
116041 : // objectArray[i] is a single memory pool
116042 388194 : for (unsigned j=0; j < SgAssignOp::pool_size; j++)
116043 : {
116044 388000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
116045 : {
116046 : // printf ("Found a valid SgAssignOp object in the memory pool %d at position %d \n",i,j);
116047 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
116048 64721 : objectArray[i][j].executeVisitorMemberFunction(visitor);
116049 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
116050 : }
116051 : else
116052 : {
116053 : // printf ("Found a INVALID SgAssignOp object in the memory pool \n");
116054 : }
116055 : }
116056 : }
116057 : }
116058 :
116059 : // This should not be required since all previously static data members are
116060 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
116061 :
116062 194 : }
116063 :
116064 : void
116065 0 : SgAssignOp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
116066 : {
116067 : // This function visits only a single IR node of the memory pool.
116068 : // it is typically called once for each type of IR node within
116069 : // the automatically generated function: traverseRepresentativeNodes().
116070 :
116071 : // Initialize array to the address of the first element of the STL vector
116072 : // (which is guarenteed to be contiguous storage).
116073 : // SgAssignOp objectArray [] = *(Memory_Block_List.begin());
116074 0 : if (SgAssignOp::pools.empty() == false)
116075 : {
116076 : // Generate an array of memory pools
116077 0 : SgAssignOp** objectArray = (SgAssignOp**) &(SgAssignOp::pools[0]);
116078 :
116079 : // Build a local variable for better performance
116080 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
116081 :
116082 : // Iterate over the memory pools
116083 0 : bool done = false;
116084 0 : unsigned i=0;
116085 :
116086 : // find the first valid IR node, call visit function, and then leave
116087 0 : while ( done == false && i < SgAssignOp::pools.size() )
116088 : {
116089 : // objectArray[i] is a single memory pool
116090 : unsigned j=0;
116091 0 : while (done == false && j < SgAssignOp::pool_size)
116092 : {
116093 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
116094 : {
116095 0 : traversal.visit(&(objectArray[i][j]));
116096 0 : done = true;
116097 : }
116098 0 : j++;
116099 : }
116100 0 : i++;
116101 : }
116102 :
116103 : #if 0
116104 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
116105 : if (done == false)
116106 : {
116107 : printf ("No representative for SgAssignOp found in memory pools \n");
116108 : }
116109 : #endif
116110 : }
116111 0 : }
116112 :
116113 :
116114 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
116115 : // using values that overflow signed values of int.
116116 : size_t
116117 4 : SgAssignOp::numberOfNodes()
116118 : {
116119 : // This function traverses the memory pool for an IR node and
116120 : // counts the number of IR nodes of a particular Sage III IR
116121 : // nodes type.
116122 :
116123 4 : size_t count = 0;
116124 4 : if (SgAssignOp::pools.empty() == false)
116125 : {
116126 : // Generate an array of memory pools (this is actually a STL vector,
116127 : // but it is contiguious, so OK to treat this way).
116128 2 : SgAssignOp** objectArray = (SgAssignOp**) &(SgAssignOp::pools[0]);
116129 :
116130 : // Build a local variable for better performance (make it a loop invariant variable).
116131 2 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
116132 :
116133 : // Iterate over all of the memory pools for this IR node.
116134 4 : for (unsigned int i=0; i < SgAssignOp::pools.size(); i++)
116135 : {
116136 : // objectArray[i] is a single memory pool, iterate over all the
116137 : // IR nodes and only count those that are valid IR nodes used in
116138 : // the AST (i.e. allocated IR nodes).
116139 4002 : for (unsigned j=0; j < SgAssignOp::pool_size; j++)
116140 : {
116141 : // This is indexing the STL vector of C/C++ style arrays as a doubly
116142 : // indexed array access. It is OK since we have leveraged the semantics
116143 : // of STL vector memory as contigous and cast the memory as an array
116144 : // of arrays to use the 2D array indexing. Hope this is not confusing,
116145 : // but it s very fast as an implementation.
116146 4000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
116147 : {
116148 457 : count++;
116149 : }
116150 : }
116151 : }
116152 : }
116153 :
116154 :
116155 :
116156 4 : return count;
116157 : }
116158 :
116159 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
116160 : // using values that overflow signed values of int.
116161 : size_t
116162 0 : SgAssignOp::memoryUsage()
116163 : {
116164 : // This function is required because we need the class name as a type when we call sizeof
116165 : // There might be another way to implement this if we have a traversal that only called a
116166 : // representative object (one call for each type of Sage IIIIR node).
116167 0 : size_t memory = numberOfNodes() * sizeof(SgAssignOp);
116168 :
116169 0 : return memory;
116170 : }
116171 :
116172 : /* #line 116173 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
116173 :
116174 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
116175 : void
116176 5342 : SgExponentiationOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
116177 : {
116178 : // This function traverses the memory pool for only a specific IR node
116179 : // and calls the visit function of the input class execute a traversal
116180 : // similar to the style of the attribute based traversals within ROSE.
116181 : // This traversal will visit ALL nodes of the AST where as the other
116182 : // attribute based traversals visit only the embedded tree within the AST.
116183 :
116184 : // Initialize array to the address of the first element of the STL vector
116185 : // (which is guaranteed to be contiguous storage).
116186 : // SgExponentiationOp objectArray [] = *(Memory_Block_List.begin());
116187 5342 : if (SgExponentiationOp::pools.empty() == false)
116188 : {
116189 : // Generate an array of memory pools
116190 0 : SgExponentiationOp** objectArray = (SgExponentiationOp**) &(SgExponentiationOp::pools[0]);
116191 :
116192 : // Build a local variable for better performance
116193 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
116194 : #if 0
116195 : // Iterate over the memory pools
116196 : for (unsigned int i=0; i < SgExponentiationOp::pools.size(); i++)
116197 : {
116198 : // objectArray[i] is a single memory pool
116199 : for (int j=0; j < SgExponentiationOp::pool_size; j++)
116200 : {
116201 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
116202 : {
116203 : traversal.visit(&(objectArray[i][j]));
116204 : }
116205 : }
116206 : }
116207 : #else
116208 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
116209 : // compute the list first and then call the visit function on each list element.
116210 :
116211 : // printf ("Inside of SgExponentiationOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
116212 :
116213 0 : std::vector<SgExponentiationOp*> nodeList;
116214 :
116215 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
116216 0 : for (unsigned int i=0; i < SgExponentiationOp::pools.size(); i++)
116217 : {
116218 : // objectArray[i] is a single memory pool
116219 0 : for (unsigned j=0; j < SgExponentiationOp::pool_size; j++)
116220 : {
116221 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
116222 : {
116223 0 : nodeList.push_back(&(objectArray[i][j]));
116224 : }
116225 : }
116226 : }
116227 :
116228 : // Iterate over the saved list
116229 0 : size_t nodeListSize = nodeList.size();
116230 0 : for (size_t i=0; i < nodeListSize; i++)
116231 : {
116232 0 : ROSE_ASSERT(nodeList[i] != NULL);
116233 : #if 0
116234 : traversal.visit(nodeList[i]);
116235 : #else
116236 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
116237 : {
116238 0 : traversal.visit(nodeList[i]);
116239 : }
116240 : #endif
116241 : }
116242 : #endif
116243 : }
116244 :
116245 : // This should not be required since all previously static data members are
116246 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
116247 :
116248 5342 : }
116249 :
116250 :
116251 : void
116252 194 : SgExponentiationOp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
116253 : {
116254 : // This function traverses the memory pool for an IR node and
116255 : // calls the function to execute the visitor object.
116256 :
116257 : // Initialize array to the address of the first element of the STL vector
116258 : // (which is guarenteed to be contiguous storage).
116259 : // SgExponentiationOp objectArray [] = *(Memory_Block_List.begin());
116260 194 : if (SgExponentiationOp::pools.empty() == false)
116261 : {
116262 : // Generate an array of memory pools
116263 0 : SgExponentiationOp** objectArray = (SgExponentiationOp**) &(SgExponentiationOp::pools[0]);
116264 :
116265 : // Build a local variable for better performance
116266 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
116267 :
116268 : // Iterate over the memory pools
116269 0 : for (unsigned int i=0; i < SgExponentiationOp::pools.size(); i++)
116270 : {
116271 : // objectArray[i] is a single memory pool
116272 0 : for (unsigned j=0; j < SgExponentiationOp::pool_size; j++)
116273 : {
116274 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
116275 : {
116276 : // printf ("Found a valid SgExponentiationOp object in the memory pool %d at position %d \n",i,j);
116277 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
116278 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
116279 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
116280 : }
116281 : else
116282 : {
116283 : // printf ("Found a INVALID SgExponentiationOp object in the memory pool \n");
116284 : }
116285 : }
116286 : }
116287 : }
116288 :
116289 : // This should not be required since all previously static data members are
116290 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
116291 :
116292 194 : }
116293 :
116294 : void
116295 0 : SgExponentiationOp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
116296 : {
116297 : // This function visits only a single IR node of the memory pool.
116298 : // it is typically called once for each type of IR node within
116299 : // the automatically generated function: traverseRepresentativeNodes().
116300 :
116301 : // Initialize array to the address of the first element of the STL vector
116302 : // (which is guarenteed to be contiguous storage).
116303 : // SgExponentiationOp objectArray [] = *(Memory_Block_List.begin());
116304 0 : if (SgExponentiationOp::pools.empty() == false)
116305 : {
116306 : // Generate an array of memory pools
116307 0 : SgExponentiationOp** objectArray = (SgExponentiationOp**) &(SgExponentiationOp::pools[0]);
116308 :
116309 : // Build a local variable for better performance
116310 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
116311 :
116312 : // Iterate over the memory pools
116313 0 : bool done = false;
116314 0 : unsigned i=0;
116315 :
116316 : // find the first valid IR node, call visit function, and then leave
116317 0 : while ( done == false && i < SgExponentiationOp::pools.size() )
116318 : {
116319 : // objectArray[i] is a single memory pool
116320 : unsigned j=0;
116321 0 : while (done == false && j < SgExponentiationOp::pool_size)
116322 : {
116323 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
116324 : {
116325 0 : traversal.visit(&(objectArray[i][j]));
116326 0 : done = true;
116327 : }
116328 0 : j++;
116329 : }
116330 0 : i++;
116331 : }
116332 :
116333 : #if 0
116334 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
116335 : if (done == false)
116336 : {
116337 : printf ("No representative for SgExponentiationOp found in memory pools \n");
116338 : }
116339 : #endif
116340 : }
116341 0 : }
116342 :
116343 :
116344 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
116345 : // using values that overflow signed values of int.
116346 : size_t
116347 4 : SgExponentiationOp::numberOfNodes()
116348 : {
116349 : // This function traverses the memory pool for an IR node and
116350 : // counts the number of IR nodes of a particular Sage III IR
116351 : // nodes type.
116352 :
116353 4 : size_t count = 0;
116354 4 : if (SgExponentiationOp::pools.empty() == false)
116355 : {
116356 : // Generate an array of memory pools (this is actually a STL vector,
116357 : // but it is contiguious, so OK to treat this way).
116358 0 : SgExponentiationOp** objectArray = (SgExponentiationOp**) &(SgExponentiationOp::pools[0]);
116359 :
116360 : // Build a local variable for better performance (make it a loop invariant variable).
116361 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
116362 :
116363 : // Iterate over all of the memory pools for this IR node.
116364 0 : for (unsigned int i=0; i < SgExponentiationOp::pools.size(); i++)
116365 : {
116366 : // objectArray[i] is a single memory pool, iterate over all the
116367 : // IR nodes and only count those that are valid IR nodes used in
116368 : // the AST (i.e. allocated IR nodes).
116369 0 : for (unsigned j=0; j < SgExponentiationOp::pool_size; j++)
116370 : {
116371 : // This is indexing the STL vector of C/C++ style arrays as a doubly
116372 : // indexed array access. It is OK since we have leveraged the semantics
116373 : // of STL vector memory as contigous and cast the memory as an array
116374 : // of arrays to use the 2D array indexing. Hope this is not confusing,
116375 : // but it s very fast as an implementation.
116376 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
116377 : {
116378 0 : count++;
116379 : }
116380 : }
116381 : }
116382 : }
116383 :
116384 :
116385 :
116386 4 : return count;
116387 : }
116388 :
116389 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
116390 : // using values that overflow signed values of int.
116391 : size_t
116392 0 : SgExponentiationOp::memoryUsage()
116393 : {
116394 : // This function is required because we need the class name as a type when we call sizeof
116395 : // There might be another way to implement this if we have a traversal that only called a
116396 : // representative object (one call for each type of Sage IIIIR node).
116397 0 : size_t memory = numberOfNodes() * sizeof(SgExponentiationOp);
116398 :
116399 0 : return memory;
116400 : }
116401 :
116402 : /* #line 116403 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
116403 :
116404 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
116405 : void
116406 5342 : SgConcatenationOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
116407 : {
116408 : // This function traverses the memory pool for only a specific IR node
116409 : // and calls the visit function of the input class execute a traversal
116410 : // similar to the style of the attribute based traversals within ROSE.
116411 : // This traversal will visit ALL nodes of the AST where as the other
116412 : // attribute based traversals visit only the embedded tree within the AST.
116413 :
116414 : // Initialize array to the address of the first element of the STL vector
116415 : // (which is guaranteed to be contiguous storage).
116416 : // SgConcatenationOp objectArray [] = *(Memory_Block_List.begin());
116417 5342 : if (SgConcatenationOp::pools.empty() == false)
116418 : {
116419 : // Generate an array of memory pools
116420 0 : SgConcatenationOp** objectArray = (SgConcatenationOp**) &(SgConcatenationOp::pools[0]);
116421 :
116422 : // Build a local variable for better performance
116423 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
116424 : #if 0
116425 : // Iterate over the memory pools
116426 : for (unsigned int i=0; i < SgConcatenationOp::pools.size(); i++)
116427 : {
116428 : // objectArray[i] is a single memory pool
116429 : for (int j=0; j < SgConcatenationOp::pool_size; j++)
116430 : {
116431 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
116432 : {
116433 : traversal.visit(&(objectArray[i][j]));
116434 : }
116435 : }
116436 : }
116437 : #else
116438 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
116439 : // compute the list first and then call the visit function on each list element.
116440 :
116441 : // printf ("Inside of SgConcatenationOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
116442 :
116443 0 : std::vector<SgConcatenationOp*> nodeList;
116444 :
116445 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
116446 0 : for (unsigned int i=0; i < SgConcatenationOp::pools.size(); i++)
116447 : {
116448 : // objectArray[i] is a single memory pool
116449 0 : for (unsigned j=0; j < SgConcatenationOp::pool_size; j++)
116450 : {
116451 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
116452 : {
116453 0 : nodeList.push_back(&(objectArray[i][j]));
116454 : }
116455 : }
116456 : }
116457 :
116458 : // Iterate over the saved list
116459 0 : size_t nodeListSize = nodeList.size();
116460 0 : for (size_t i=0; i < nodeListSize; i++)
116461 : {
116462 0 : ROSE_ASSERT(nodeList[i] != NULL);
116463 : #if 0
116464 : traversal.visit(nodeList[i]);
116465 : #else
116466 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
116467 : {
116468 0 : traversal.visit(nodeList[i]);
116469 : }
116470 : #endif
116471 : }
116472 : #endif
116473 : }
116474 :
116475 : // This should not be required since all previously static data members are
116476 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
116477 :
116478 5342 : }
116479 :
116480 :
116481 : void
116482 194 : SgConcatenationOp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
116483 : {
116484 : // This function traverses the memory pool for an IR node and
116485 : // calls the function to execute the visitor object.
116486 :
116487 : // Initialize array to the address of the first element of the STL vector
116488 : // (which is guarenteed to be contiguous storage).
116489 : // SgConcatenationOp objectArray [] = *(Memory_Block_List.begin());
116490 194 : if (SgConcatenationOp::pools.empty() == false)
116491 : {
116492 : // Generate an array of memory pools
116493 0 : SgConcatenationOp** objectArray = (SgConcatenationOp**) &(SgConcatenationOp::pools[0]);
116494 :
116495 : // Build a local variable for better performance
116496 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
116497 :
116498 : // Iterate over the memory pools
116499 0 : for (unsigned int i=0; i < SgConcatenationOp::pools.size(); i++)
116500 : {
116501 : // objectArray[i] is a single memory pool
116502 0 : for (unsigned j=0; j < SgConcatenationOp::pool_size; j++)
116503 : {
116504 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
116505 : {
116506 : // printf ("Found a valid SgConcatenationOp object in the memory pool %d at position %d \n",i,j);
116507 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
116508 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
116509 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
116510 : }
116511 : else
116512 : {
116513 : // printf ("Found a INVALID SgConcatenationOp object in the memory pool \n");
116514 : }
116515 : }
116516 : }
116517 : }
116518 :
116519 : // This should not be required since all previously static data members are
116520 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
116521 :
116522 194 : }
116523 :
116524 : void
116525 0 : SgConcatenationOp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
116526 : {
116527 : // This function visits only a single IR node of the memory pool.
116528 : // it is typically called once for each type of IR node within
116529 : // the automatically generated function: traverseRepresentativeNodes().
116530 :
116531 : // Initialize array to the address of the first element of the STL vector
116532 : // (which is guarenteed to be contiguous storage).
116533 : // SgConcatenationOp objectArray [] = *(Memory_Block_List.begin());
116534 0 : if (SgConcatenationOp::pools.empty() == false)
116535 : {
116536 : // Generate an array of memory pools
116537 0 : SgConcatenationOp** objectArray = (SgConcatenationOp**) &(SgConcatenationOp::pools[0]);
116538 :
116539 : // Build a local variable for better performance
116540 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
116541 :
116542 : // Iterate over the memory pools
116543 0 : bool done = false;
116544 0 : unsigned i=0;
116545 :
116546 : // find the first valid IR node, call visit function, and then leave
116547 0 : while ( done == false && i < SgConcatenationOp::pools.size() )
116548 : {
116549 : // objectArray[i] is a single memory pool
116550 : unsigned j=0;
116551 0 : while (done == false && j < SgConcatenationOp::pool_size)
116552 : {
116553 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
116554 : {
116555 0 : traversal.visit(&(objectArray[i][j]));
116556 0 : done = true;
116557 : }
116558 0 : j++;
116559 : }
116560 0 : i++;
116561 : }
116562 :
116563 : #if 0
116564 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
116565 : if (done == false)
116566 : {
116567 : printf ("No representative for SgConcatenationOp found in memory pools \n");
116568 : }
116569 : #endif
116570 : }
116571 0 : }
116572 :
116573 :
116574 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
116575 : // using values that overflow signed values of int.
116576 : size_t
116577 4 : SgConcatenationOp::numberOfNodes()
116578 : {
116579 : // This function traverses the memory pool for an IR node and
116580 : // counts the number of IR nodes of a particular Sage III IR
116581 : // nodes type.
116582 :
116583 4 : size_t count = 0;
116584 4 : if (SgConcatenationOp::pools.empty() == false)
116585 : {
116586 : // Generate an array of memory pools (this is actually a STL vector,
116587 : // but it is contiguious, so OK to treat this way).
116588 0 : SgConcatenationOp** objectArray = (SgConcatenationOp**) &(SgConcatenationOp::pools[0]);
116589 :
116590 : // Build a local variable for better performance (make it a loop invariant variable).
116591 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
116592 :
116593 : // Iterate over all of the memory pools for this IR node.
116594 0 : for (unsigned int i=0; i < SgConcatenationOp::pools.size(); i++)
116595 : {
116596 : // objectArray[i] is a single memory pool, iterate over all the
116597 : // IR nodes and only count those that are valid IR nodes used in
116598 : // the AST (i.e. allocated IR nodes).
116599 0 : for (unsigned j=0; j < SgConcatenationOp::pool_size; j++)
116600 : {
116601 : // This is indexing the STL vector of C/C++ style arrays as a doubly
116602 : // indexed array access. It is OK since we have leveraged the semantics
116603 : // of STL vector memory as contigous and cast the memory as an array
116604 : // of arrays to use the 2D array indexing. Hope this is not confusing,
116605 : // but it s very fast as an implementation.
116606 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
116607 : {
116608 0 : count++;
116609 : }
116610 : }
116611 : }
116612 : }
116613 :
116614 :
116615 :
116616 4 : return count;
116617 : }
116618 :
116619 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
116620 : // using values that overflow signed values of int.
116621 : size_t
116622 0 : SgConcatenationOp::memoryUsage()
116623 : {
116624 : // This function is required because we need the class name as a type when we call sizeof
116625 : // There might be another way to implement this if we have a traversal that only called a
116626 : // representative object (one call for each type of Sage IIIIR node).
116627 0 : size_t memory = numberOfNodes() * sizeof(SgConcatenationOp);
116628 :
116629 0 : return memory;
116630 : }
116631 :
116632 : /* #line 116633 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
116633 :
116634 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
116635 : void
116636 5342 : SgPointerAssignOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
116637 : {
116638 : // This function traverses the memory pool for only a specific IR node
116639 : // and calls the visit function of the input class execute a traversal
116640 : // similar to the style of the attribute based traversals within ROSE.
116641 : // This traversal will visit ALL nodes of the AST where as the other
116642 : // attribute based traversals visit only the embedded tree within the AST.
116643 :
116644 : // Initialize array to the address of the first element of the STL vector
116645 : // (which is guaranteed to be contiguous storage).
116646 : // SgPointerAssignOp objectArray [] = *(Memory_Block_List.begin());
116647 5342 : if (SgPointerAssignOp::pools.empty() == false)
116648 : {
116649 : // Generate an array of memory pools
116650 20 : SgPointerAssignOp** objectArray = (SgPointerAssignOp**) &(SgPointerAssignOp::pools[0]);
116651 :
116652 : // Build a local variable for better performance
116653 20 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
116654 : #if 0
116655 : // Iterate over the memory pools
116656 : for (unsigned int i=0; i < SgPointerAssignOp::pools.size(); i++)
116657 : {
116658 : // objectArray[i] is a single memory pool
116659 : for (int j=0; j < SgPointerAssignOp::pool_size; j++)
116660 : {
116661 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
116662 : {
116663 : traversal.visit(&(objectArray[i][j]));
116664 : }
116665 : }
116666 : }
116667 : #else
116668 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
116669 : // compute the list first and then call the visit function on each list element.
116670 :
116671 : // printf ("Inside of SgPointerAssignOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
116672 :
116673 40 : std::vector<SgPointerAssignOp*> nodeList;
116674 :
116675 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
116676 40 : for (unsigned int i=0; i < SgPointerAssignOp::pools.size(); i++)
116677 : {
116678 : // objectArray[i] is a single memory pool
116679 40020 : for (unsigned j=0; j < SgPointerAssignOp::pool_size; j++)
116680 : {
116681 40000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
116682 : {
116683 20 : nodeList.push_back(&(objectArray[i][j]));
116684 : }
116685 : }
116686 : }
116687 :
116688 : // Iterate over the saved list
116689 20 : size_t nodeListSize = nodeList.size();
116690 40 : for (size_t i=0; i < nodeListSize; i++)
116691 : {
116692 20 : ROSE_ASSERT(nodeList[i] != NULL);
116693 : #if 0
116694 : traversal.visit(nodeList[i]);
116695 : #else
116696 20 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
116697 : {
116698 20 : traversal.visit(nodeList[i]);
116699 : }
116700 : #endif
116701 : }
116702 : #endif
116703 : }
116704 :
116705 : // This should not be required since all previously static data members are
116706 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
116707 :
116708 5342 : }
116709 :
116710 :
116711 : void
116712 194 : SgPointerAssignOp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
116713 : {
116714 : // This function traverses the memory pool for an IR node and
116715 : // calls the function to execute the visitor object.
116716 :
116717 : // Initialize array to the address of the first element of the STL vector
116718 : // (which is guarenteed to be contiguous storage).
116719 : // SgPointerAssignOp objectArray [] = *(Memory_Block_List.begin());
116720 194 : if (SgPointerAssignOp::pools.empty() == false)
116721 : {
116722 : // Generate an array of memory pools
116723 0 : SgPointerAssignOp** objectArray = (SgPointerAssignOp**) &(SgPointerAssignOp::pools[0]);
116724 :
116725 : // Build a local variable for better performance
116726 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
116727 :
116728 : // Iterate over the memory pools
116729 0 : for (unsigned int i=0; i < SgPointerAssignOp::pools.size(); i++)
116730 : {
116731 : // objectArray[i] is a single memory pool
116732 0 : for (unsigned j=0; j < SgPointerAssignOp::pool_size; j++)
116733 : {
116734 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
116735 : {
116736 : // printf ("Found a valid SgPointerAssignOp object in the memory pool %d at position %d \n",i,j);
116737 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
116738 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
116739 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
116740 : }
116741 : else
116742 : {
116743 : // printf ("Found a INVALID SgPointerAssignOp object in the memory pool \n");
116744 : }
116745 : }
116746 : }
116747 : }
116748 :
116749 : // This should not be required since all previously static data members are
116750 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
116751 :
116752 194 : }
116753 :
116754 : void
116755 0 : SgPointerAssignOp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
116756 : {
116757 : // This function visits only a single IR node of the memory pool.
116758 : // it is typically called once for each type of IR node within
116759 : // the automatically generated function: traverseRepresentativeNodes().
116760 :
116761 : // Initialize array to the address of the first element of the STL vector
116762 : // (which is guarenteed to be contiguous storage).
116763 : // SgPointerAssignOp objectArray [] = *(Memory_Block_List.begin());
116764 0 : if (SgPointerAssignOp::pools.empty() == false)
116765 : {
116766 : // Generate an array of memory pools
116767 0 : SgPointerAssignOp** objectArray = (SgPointerAssignOp**) &(SgPointerAssignOp::pools[0]);
116768 :
116769 : // Build a local variable for better performance
116770 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
116771 :
116772 : // Iterate over the memory pools
116773 0 : bool done = false;
116774 0 : unsigned i=0;
116775 :
116776 : // find the first valid IR node, call visit function, and then leave
116777 0 : while ( done == false && i < SgPointerAssignOp::pools.size() )
116778 : {
116779 : // objectArray[i] is a single memory pool
116780 : unsigned j=0;
116781 0 : while (done == false && j < SgPointerAssignOp::pool_size)
116782 : {
116783 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
116784 : {
116785 0 : traversal.visit(&(objectArray[i][j]));
116786 0 : done = true;
116787 : }
116788 0 : j++;
116789 : }
116790 0 : i++;
116791 : }
116792 :
116793 : #if 0
116794 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
116795 : if (done == false)
116796 : {
116797 : printf ("No representative for SgPointerAssignOp found in memory pools \n");
116798 : }
116799 : #endif
116800 : }
116801 0 : }
116802 :
116803 :
116804 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
116805 : // using values that overflow signed values of int.
116806 : size_t
116807 4 : SgPointerAssignOp::numberOfNodes()
116808 : {
116809 : // This function traverses the memory pool for an IR node and
116810 : // counts the number of IR nodes of a particular Sage III IR
116811 : // nodes type.
116812 :
116813 4 : size_t count = 0;
116814 4 : if (SgPointerAssignOp::pools.empty() == false)
116815 : {
116816 : // Generate an array of memory pools (this is actually a STL vector,
116817 : // but it is contiguious, so OK to treat this way).
116818 0 : SgPointerAssignOp** objectArray = (SgPointerAssignOp**) &(SgPointerAssignOp::pools[0]);
116819 :
116820 : // Build a local variable for better performance (make it a loop invariant variable).
116821 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
116822 :
116823 : // Iterate over all of the memory pools for this IR node.
116824 0 : for (unsigned int i=0; i < SgPointerAssignOp::pools.size(); i++)
116825 : {
116826 : // objectArray[i] is a single memory pool, iterate over all the
116827 : // IR nodes and only count those that are valid IR nodes used in
116828 : // the AST (i.e. allocated IR nodes).
116829 0 : for (unsigned j=0; j < SgPointerAssignOp::pool_size; j++)
116830 : {
116831 : // This is indexing the STL vector of C/C++ style arrays as a doubly
116832 : // indexed array access. It is OK since we have leveraged the semantics
116833 : // of STL vector memory as contigous and cast the memory as an array
116834 : // of arrays to use the 2D array indexing. Hope this is not confusing,
116835 : // but it s very fast as an implementation.
116836 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
116837 : {
116838 0 : count++;
116839 : }
116840 : }
116841 : }
116842 : }
116843 :
116844 :
116845 :
116846 4 : return count;
116847 : }
116848 :
116849 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
116850 : // using values that overflow signed values of int.
116851 : size_t
116852 0 : SgPointerAssignOp::memoryUsage()
116853 : {
116854 : // This function is required because we need the class name as a type when we call sizeof
116855 : // There might be another way to implement this if we have a traversal that only called a
116856 : // representative object (one call for each type of Sage IIIIR node).
116857 0 : size_t memory = numberOfNodes() * sizeof(SgPointerAssignOp);
116858 :
116859 0 : return memory;
116860 : }
116861 :
116862 : /* #line 116863 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
116863 :
116864 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
116865 : void
116866 5342 : SgUserDefinedBinaryOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
116867 : {
116868 : // This function traverses the memory pool for only a specific IR node
116869 : // and calls the visit function of the input class execute a traversal
116870 : // similar to the style of the attribute based traversals within ROSE.
116871 : // This traversal will visit ALL nodes of the AST where as the other
116872 : // attribute based traversals visit only the embedded tree within the AST.
116873 :
116874 : // Initialize array to the address of the first element of the STL vector
116875 : // (which is guaranteed to be contiguous storage).
116876 : // SgUserDefinedBinaryOp objectArray [] = *(Memory_Block_List.begin());
116877 5342 : if (SgUserDefinedBinaryOp::pools.empty() == false)
116878 : {
116879 : // Generate an array of memory pools
116880 0 : SgUserDefinedBinaryOp** objectArray = (SgUserDefinedBinaryOp**) &(SgUserDefinedBinaryOp::pools[0]);
116881 :
116882 : // Build a local variable for better performance
116883 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
116884 : #if 0
116885 : // Iterate over the memory pools
116886 : for (unsigned int i=0; i < SgUserDefinedBinaryOp::pools.size(); i++)
116887 : {
116888 : // objectArray[i] is a single memory pool
116889 : for (int j=0; j < SgUserDefinedBinaryOp::pool_size; j++)
116890 : {
116891 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
116892 : {
116893 : traversal.visit(&(objectArray[i][j]));
116894 : }
116895 : }
116896 : }
116897 : #else
116898 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
116899 : // compute the list first and then call the visit function on each list element.
116900 :
116901 : // printf ("Inside of SgUserDefinedBinaryOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
116902 :
116903 0 : std::vector<SgUserDefinedBinaryOp*> nodeList;
116904 :
116905 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
116906 0 : for (unsigned int i=0; i < SgUserDefinedBinaryOp::pools.size(); i++)
116907 : {
116908 : // objectArray[i] is a single memory pool
116909 0 : for (unsigned j=0; j < SgUserDefinedBinaryOp::pool_size; j++)
116910 : {
116911 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
116912 : {
116913 0 : nodeList.push_back(&(objectArray[i][j]));
116914 : }
116915 : }
116916 : }
116917 :
116918 : // Iterate over the saved list
116919 0 : size_t nodeListSize = nodeList.size();
116920 0 : for (size_t i=0; i < nodeListSize; i++)
116921 : {
116922 0 : ROSE_ASSERT(nodeList[i] != NULL);
116923 : #if 0
116924 : traversal.visit(nodeList[i]);
116925 : #else
116926 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
116927 : {
116928 0 : traversal.visit(nodeList[i]);
116929 : }
116930 : #endif
116931 : }
116932 : #endif
116933 : }
116934 :
116935 : // This should not be required since all previously static data members are
116936 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
116937 :
116938 5342 : }
116939 :
116940 :
116941 : void
116942 194 : SgUserDefinedBinaryOp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
116943 : {
116944 : // This function traverses the memory pool for an IR node and
116945 : // calls the function to execute the visitor object.
116946 :
116947 : // Initialize array to the address of the first element of the STL vector
116948 : // (which is guarenteed to be contiguous storage).
116949 : // SgUserDefinedBinaryOp objectArray [] = *(Memory_Block_List.begin());
116950 194 : if (SgUserDefinedBinaryOp::pools.empty() == false)
116951 : {
116952 : // Generate an array of memory pools
116953 0 : SgUserDefinedBinaryOp** objectArray = (SgUserDefinedBinaryOp**) &(SgUserDefinedBinaryOp::pools[0]);
116954 :
116955 : // Build a local variable for better performance
116956 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
116957 :
116958 : // Iterate over the memory pools
116959 0 : for (unsigned int i=0; i < SgUserDefinedBinaryOp::pools.size(); i++)
116960 : {
116961 : // objectArray[i] is a single memory pool
116962 0 : for (unsigned j=0; j < SgUserDefinedBinaryOp::pool_size; j++)
116963 : {
116964 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
116965 : {
116966 : // printf ("Found a valid SgUserDefinedBinaryOp object in the memory pool %d at position %d \n",i,j);
116967 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
116968 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
116969 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
116970 : }
116971 : else
116972 : {
116973 : // printf ("Found a INVALID SgUserDefinedBinaryOp object in the memory pool \n");
116974 : }
116975 : }
116976 : }
116977 : }
116978 :
116979 : // This should not be required since all previously static data members are
116980 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
116981 :
116982 194 : }
116983 :
116984 : void
116985 0 : SgUserDefinedBinaryOp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
116986 : {
116987 : // This function visits only a single IR node of the memory pool.
116988 : // it is typically called once for each type of IR node within
116989 : // the automatically generated function: traverseRepresentativeNodes().
116990 :
116991 : // Initialize array to the address of the first element of the STL vector
116992 : // (which is guarenteed to be contiguous storage).
116993 : // SgUserDefinedBinaryOp objectArray [] = *(Memory_Block_List.begin());
116994 0 : if (SgUserDefinedBinaryOp::pools.empty() == false)
116995 : {
116996 : // Generate an array of memory pools
116997 0 : SgUserDefinedBinaryOp** objectArray = (SgUserDefinedBinaryOp**) &(SgUserDefinedBinaryOp::pools[0]);
116998 :
116999 : // Build a local variable for better performance
117000 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
117001 :
117002 : // Iterate over the memory pools
117003 0 : bool done = false;
117004 0 : unsigned i=0;
117005 :
117006 : // find the first valid IR node, call visit function, and then leave
117007 0 : while ( done == false && i < SgUserDefinedBinaryOp::pools.size() )
117008 : {
117009 : // objectArray[i] is a single memory pool
117010 : unsigned j=0;
117011 0 : while (done == false && j < SgUserDefinedBinaryOp::pool_size)
117012 : {
117013 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
117014 : {
117015 0 : traversal.visit(&(objectArray[i][j]));
117016 0 : done = true;
117017 : }
117018 0 : j++;
117019 : }
117020 0 : i++;
117021 : }
117022 :
117023 : #if 0
117024 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
117025 : if (done == false)
117026 : {
117027 : printf ("No representative for SgUserDefinedBinaryOp found in memory pools \n");
117028 : }
117029 : #endif
117030 : }
117031 0 : }
117032 :
117033 :
117034 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
117035 : // using values that overflow signed values of int.
117036 : size_t
117037 4 : SgUserDefinedBinaryOp::numberOfNodes()
117038 : {
117039 : // This function traverses the memory pool for an IR node and
117040 : // counts the number of IR nodes of a particular Sage III IR
117041 : // nodes type.
117042 :
117043 4 : size_t count = 0;
117044 4 : if (SgUserDefinedBinaryOp::pools.empty() == false)
117045 : {
117046 : // Generate an array of memory pools (this is actually a STL vector,
117047 : // but it is contiguious, so OK to treat this way).
117048 0 : SgUserDefinedBinaryOp** objectArray = (SgUserDefinedBinaryOp**) &(SgUserDefinedBinaryOp::pools[0]);
117049 :
117050 : // Build a local variable for better performance (make it a loop invariant variable).
117051 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
117052 :
117053 : // Iterate over all of the memory pools for this IR node.
117054 0 : for (unsigned int i=0; i < SgUserDefinedBinaryOp::pools.size(); i++)
117055 : {
117056 : // objectArray[i] is a single memory pool, iterate over all the
117057 : // IR nodes and only count those that are valid IR nodes used in
117058 : // the AST (i.e. allocated IR nodes).
117059 0 : for (unsigned j=0; j < SgUserDefinedBinaryOp::pool_size; j++)
117060 : {
117061 : // This is indexing the STL vector of C/C++ style arrays as a doubly
117062 : // indexed array access. It is OK since we have leveraged the semantics
117063 : // of STL vector memory as contigous and cast the memory as an array
117064 : // of arrays to use the 2D array indexing. Hope this is not confusing,
117065 : // but it s very fast as an implementation.
117066 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
117067 : {
117068 0 : count++;
117069 : }
117070 : }
117071 : }
117072 : }
117073 :
117074 :
117075 :
117076 4 : return count;
117077 : }
117078 :
117079 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
117080 : // using values that overflow signed values of int.
117081 : size_t
117082 0 : SgUserDefinedBinaryOp::memoryUsage()
117083 : {
117084 : // This function is required because we need the class name as a type when we call sizeof
117085 : // There might be another way to implement this if we have a traversal that only called a
117086 : // representative object (one call for each type of Sage IIIIR node).
117087 0 : size_t memory = numberOfNodes() * sizeof(SgUserDefinedBinaryOp);
117088 :
117089 0 : return memory;
117090 : }
117091 :
117092 : /* #line 117093 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
117093 :
117094 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
117095 : void
117096 5342 : SgCompoundAssignOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
117097 : {
117098 : // This function traverses the memory pool for only a specific IR node
117099 : // and calls the visit function of the input class execute a traversal
117100 : // similar to the style of the attribute based traversals within ROSE.
117101 : // This traversal will visit ALL nodes of the AST where as the other
117102 : // attribute based traversals visit only the embedded tree within the AST.
117103 :
117104 : // Initialize array to the address of the first element of the STL vector
117105 : // (which is guaranteed to be contiguous storage).
117106 : // SgCompoundAssignOp objectArray [] = *(Memory_Block_List.begin());
117107 5342 : if (SgCompoundAssignOp::pools.empty() == false)
117108 : {
117109 : // Generate an array of memory pools
117110 0 : SgCompoundAssignOp** objectArray = (SgCompoundAssignOp**) &(SgCompoundAssignOp::pools[0]);
117111 :
117112 : // Build a local variable for better performance
117113 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
117114 : #if 0
117115 : // Iterate over the memory pools
117116 : for (unsigned int i=0; i < SgCompoundAssignOp::pools.size(); i++)
117117 : {
117118 : // objectArray[i] is a single memory pool
117119 : for (int j=0; j < SgCompoundAssignOp::pool_size; j++)
117120 : {
117121 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
117122 : {
117123 : traversal.visit(&(objectArray[i][j]));
117124 : }
117125 : }
117126 : }
117127 : #else
117128 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
117129 : // compute the list first and then call the visit function on each list element.
117130 :
117131 : // printf ("Inside of SgCompoundAssignOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
117132 :
117133 0 : std::vector<SgCompoundAssignOp*> nodeList;
117134 :
117135 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
117136 0 : for (unsigned int i=0; i < SgCompoundAssignOp::pools.size(); i++)
117137 : {
117138 : // objectArray[i] is a single memory pool
117139 0 : for (unsigned j=0; j < SgCompoundAssignOp::pool_size; j++)
117140 : {
117141 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
117142 : {
117143 0 : nodeList.push_back(&(objectArray[i][j]));
117144 : }
117145 : }
117146 : }
117147 :
117148 : // Iterate over the saved list
117149 0 : size_t nodeListSize = nodeList.size();
117150 0 : for (size_t i=0; i < nodeListSize; i++)
117151 : {
117152 0 : ROSE_ASSERT(nodeList[i] != NULL);
117153 : #if 0
117154 : traversal.visit(nodeList[i]);
117155 : #else
117156 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
117157 : {
117158 0 : traversal.visit(nodeList[i]);
117159 : }
117160 : #endif
117161 : }
117162 : #endif
117163 : }
117164 :
117165 : // This should not be required since all previously static data members are
117166 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
117167 :
117168 5342 : }
117169 :
117170 :
117171 : void
117172 194 : SgCompoundAssignOp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
117173 : {
117174 : // This function traverses the memory pool for an IR node and
117175 : // calls the function to execute the visitor object.
117176 :
117177 : // Initialize array to the address of the first element of the STL vector
117178 : // (which is guarenteed to be contiguous storage).
117179 : // SgCompoundAssignOp objectArray [] = *(Memory_Block_List.begin());
117180 194 : if (SgCompoundAssignOp::pools.empty() == false)
117181 : {
117182 : // Generate an array of memory pools
117183 0 : SgCompoundAssignOp** objectArray = (SgCompoundAssignOp**) &(SgCompoundAssignOp::pools[0]);
117184 :
117185 : // Build a local variable for better performance
117186 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
117187 :
117188 : // Iterate over the memory pools
117189 0 : for (unsigned int i=0; i < SgCompoundAssignOp::pools.size(); i++)
117190 : {
117191 : // objectArray[i] is a single memory pool
117192 0 : for (unsigned j=0; j < SgCompoundAssignOp::pool_size; j++)
117193 : {
117194 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
117195 : {
117196 : // printf ("Found a valid SgCompoundAssignOp object in the memory pool %d at position %d \n",i,j);
117197 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
117198 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
117199 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
117200 : }
117201 : else
117202 : {
117203 : // printf ("Found a INVALID SgCompoundAssignOp object in the memory pool \n");
117204 : }
117205 : }
117206 : }
117207 : }
117208 :
117209 : // This should not be required since all previously static data members are
117210 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
117211 :
117212 194 : }
117213 :
117214 : void
117215 0 : SgCompoundAssignOp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
117216 : {
117217 : // This function visits only a single IR node of the memory pool.
117218 : // it is typically called once for each type of IR node within
117219 : // the automatically generated function: traverseRepresentativeNodes().
117220 :
117221 : // Initialize array to the address of the first element of the STL vector
117222 : // (which is guarenteed to be contiguous storage).
117223 : // SgCompoundAssignOp objectArray [] = *(Memory_Block_List.begin());
117224 0 : if (SgCompoundAssignOp::pools.empty() == false)
117225 : {
117226 : // Generate an array of memory pools
117227 0 : SgCompoundAssignOp** objectArray = (SgCompoundAssignOp**) &(SgCompoundAssignOp::pools[0]);
117228 :
117229 : // Build a local variable for better performance
117230 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
117231 :
117232 : // Iterate over the memory pools
117233 0 : bool done = false;
117234 0 : unsigned i=0;
117235 :
117236 : // find the first valid IR node, call visit function, and then leave
117237 0 : while ( done == false && i < SgCompoundAssignOp::pools.size() )
117238 : {
117239 : // objectArray[i] is a single memory pool
117240 : unsigned j=0;
117241 0 : while (done == false && j < SgCompoundAssignOp::pool_size)
117242 : {
117243 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
117244 : {
117245 0 : traversal.visit(&(objectArray[i][j]));
117246 0 : done = true;
117247 : }
117248 0 : j++;
117249 : }
117250 0 : i++;
117251 : }
117252 :
117253 : #if 0
117254 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
117255 : if (done == false)
117256 : {
117257 : printf ("No representative for SgCompoundAssignOp found in memory pools \n");
117258 : }
117259 : #endif
117260 : }
117261 0 : }
117262 :
117263 :
117264 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
117265 : // using values that overflow signed values of int.
117266 : size_t
117267 4 : SgCompoundAssignOp::numberOfNodes()
117268 : {
117269 : // This function traverses the memory pool for an IR node and
117270 : // counts the number of IR nodes of a particular Sage III IR
117271 : // nodes type.
117272 :
117273 4 : size_t count = 0;
117274 4 : if (SgCompoundAssignOp::pools.empty() == false)
117275 : {
117276 : // Generate an array of memory pools (this is actually a STL vector,
117277 : // but it is contiguious, so OK to treat this way).
117278 0 : SgCompoundAssignOp** objectArray = (SgCompoundAssignOp**) &(SgCompoundAssignOp::pools[0]);
117279 :
117280 : // Build a local variable for better performance (make it a loop invariant variable).
117281 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
117282 :
117283 : // Iterate over all of the memory pools for this IR node.
117284 0 : for (unsigned int i=0; i < SgCompoundAssignOp::pools.size(); i++)
117285 : {
117286 : // objectArray[i] is a single memory pool, iterate over all the
117287 : // IR nodes and only count those that are valid IR nodes used in
117288 : // the AST (i.e. allocated IR nodes).
117289 0 : for (unsigned j=0; j < SgCompoundAssignOp::pool_size; j++)
117290 : {
117291 : // This is indexing the STL vector of C/C++ style arrays as a doubly
117292 : // indexed array access. It is OK since we have leveraged the semantics
117293 : // of STL vector memory as contigous and cast the memory as an array
117294 : // of arrays to use the 2D array indexing. Hope this is not confusing,
117295 : // but it s very fast as an implementation.
117296 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
117297 : {
117298 0 : count++;
117299 : }
117300 : }
117301 : }
117302 : }
117303 :
117304 :
117305 :
117306 4 : return count;
117307 : }
117308 :
117309 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
117310 : // using values that overflow signed values of int.
117311 : size_t
117312 0 : SgCompoundAssignOp::memoryUsage()
117313 : {
117314 : // This function is required because we need the class name as a type when we call sizeof
117315 : // There might be another way to implement this if we have a traversal that only called a
117316 : // representative object (one call for each type of Sage IIIIR node).
117317 0 : size_t memory = numberOfNodes() * sizeof(SgCompoundAssignOp);
117318 :
117319 0 : return memory;
117320 : }
117321 :
117322 : /* #line 117323 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
117323 :
117324 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
117325 : void
117326 5342 : SgPlusAssignOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
117327 : {
117328 : // This function traverses the memory pool for only a specific IR node
117329 : // and calls the visit function of the input class execute a traversal
117330 : // similar to the style of the attribute based traversals within ROSE.
117331 : // This traversal will visit ALL nodes of the AST where as the other
117332 : // attribute based traversals visit only the embedded tree within the AST.
117333 :
117334 : // Initialize array to the address of the first element of the STL vector
117335 : // (which is guaranteed to be contiguous storage).
117336 : // SgPlusAssignOp objectArray [] = *(Memory_Block_List.begin());
117337 5342 : if (SgPlusAssignOp::pools.empty() == false)
117338 : {
117339 : // Generate an array of memory pools
117340 770 : SgPlusAssignOp** objectArray = (SgPlusAssignOp**) &(SgPlusAssignOp::pools[0]);
117341 :
117342 : // Build a local variable for better performance
117343 770 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
117344 : #if 0
117345 : // Iterate over the memory pools
117346 : for (unsigned int i=0; i < SgPlusAssignOp::pools.size(); i++)
117347 : {
117348 : // objectArray[i] is a single memory pool
117349 : for (int j=0; j < SgPlusAssignOp::pool_size; j++)
117350 : {
117351 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
117352 : {
117353 : traversal.visit(&(objectArray[i][j]));
117354 : }
117355 : }
117356 : }
117357 : #else
117358 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
117359 : // compute the list first and then call the visit function on each list element.
117360 :
117361 : // printf ("Inside of SgPlusAssignOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
117362 :
117363 1540 : std::vector<SgPlusAssignOp*> nodeList;
117364 :
117365 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
117366 1540 : for (unsigned int i=0; i < SgPlusAssignOp::pools.size(); i++)
117367 : {
117368 : // objectArray[i] is a single memory pool
117369 1540770 : for (unsigned j=0; j < SgPlusAssignOp::pool_size; j++)
117370 : {
117371 1540000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
117372 : {
117373 5045 : nodeList.push_back(&(objectArray[i][j]));
117374 : }
117375 : }
117376 : }
117377 :
117378 : // Iterate over the saved list
117379 770 : size_t nodeListSize = nodeList.size();
117380 5815 : for (size_t i=0; i < nodeListSize; i++)
117381 : {
117382 5045 : ROSE_ASSERT(nodeList[i] != NULL);
117383 : #if 0
117384 : traversal.visit(nodeList[i]);
117385 : #else
117386 5045 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
117387 : {
117388 5045 : traversal.visit(nodeList[i]);
117389 : }
117390 : #endif
117391 : }
117392 : #endif
117393 : }
117394 :
117395 : // This should not be required since all previously static data members are
117396 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
117397 :
117398 5342 : }
117399 :
117400 :
117401 : void
117402 194 : SgPlusAssignOp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
117403 : {
117404 : // This function traverses the memory pool for an IR node and
117405 : // calls the function to execute the visitor object.
117406 :
117407 : // Initialize array to the address of the first element of the STL vector
117408 : // (which is guarenteed to be contiguous storage).
117409 : // SgPlusAssignOp objectArray [] = *(Memory_Block_List.begin());
117410 194 : if (SgPlusAssignOp::pools.empty() == false)
117411 : {
117412 : // Generate an array of memory pools
117413 186 : SgPlusAssignOp** objectArray = (SgPlusAssignOp**) &(SgPlusAssignOp::pools[0]);
117414 :
117415 : // Build a local variable for better performance
117416 186 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
117417 :
117418 : // Iterate over the memory pools
117419 372 : for (unsigned int i=0; i < SgPlusAssignOp::pools.size(); i++)
117420 : {
117421 : // objectArray[i] is a single memory pool
117422 372186 : for (unsigned j=0; j < SgPlusAssignOp::pool_size; j++)
117423 : {
117424 372000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
117425 : {
117426 : // printf ("Found a valid SgPlusAssignOp object in the memory pool %d at position %d \n",i,j);
117427 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
117428 4317 : objectArray[i][j].executeVisitorMemberFunction(visitor);
117429 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
117430 : }
117431 : else
117432 : {
117433 : // printf ("Found a INVALID SgPlusAssignOp object in the memory pool \n");
117434 : }
117435 : }
117436 : }
117437 : }
117438 :
117439 : // This should not be required since all previously static data members are
117440 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
117441 :
117442 194 : }
117443 :
117444 : void
117445 0 : SgPlusAssignOp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
117446 : {
117447 : // This function visits only a single IR node of the memory pool.
117448 : // it is typically called once for each type of IR node within
117449 : // the automatically generated function: traverseRepresentativeNodes().
117450 :
117451 : // Initialize array to the address of the first element of the STL vector
117452 : // (which is guarenteed to be contiguous storage).
117453 : // SgPlusAssignOp objectArray [] = *(Memory_Block_List.begin());
117454 0 : if (SgPlusAssignOp::pools.empty() == false)
117455 : {
117456 : // Generate an array of memory pools
117457 0 : SgPlusAssignOp** objectArray = (SgPlusAssignOp**) &(SgPlusAssignOp::pools[0]);
117458 :
117459 : // Build a local variable for better performance
117460 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
117461 :
117462 : // Iterate over the memory pools
117463 0 : bool done = false;
117464 0 : unsigned i=0;
117465 :
117466 : // find the first valid IR node, call visit function, and then leave
117467 0 : while ( done == false && i < SgPlusAssignOp::pools.size() )
117468 : {
117469 : // objectArray[i] is a single memory pool
117470 : unsigned j=0;
117471 0 : while (done == false && j < SgPlusAssignOp::pool_size)
117472 : {
117473 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
117474 : {
117475 0 : traversal.visit(&(objectArray[i][j]));
117476 0 : done = true;
117477 : }
117478 0 : j++;
117479 : }
117480 0 : i++;
117481 : }
117482 :
117483 : #if 0
117484 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
117485 : if (done == false)
117486 : {
117487 : printf ("No representative for SgPlusAssignOp found in memory pools \n");
117488 : }
117489 : #endif
117490 : }
117491 0 : }
117492 :
117493 :
117494 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
117495 : // using values that overflow signed values of int.
117496 : size_t
117497 4 : SgPlusAssignOp::numberOfNodes()
117498 : {
117499 : // This function traverses the memory pool for an IR node and
117500 : // counts the number of IR nodes of a particular Sage III IR
117501 : // nodes type.
117502 :
117503 4 : size_t count = 0;
117504 4 : if (SgPlusAssignOp::pools.empty() == false)
117505 : {
117506 : // Generate an array of memory pools (this is actually a STL vector,
117507 : // but it is contiguious, so OK to treat this way).
117508 1 : SgPlusAssignOp** objectArray = (SgPlusAssignOp**) &(SgPlusAssignOp::pools[0]);
117509 :
117510 : // Build a local variable for better performance (make it a loop invariant variable).
117511 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
117512 :
117513 : // Iterate over all of the memory pools for this IR node.
117514 2 : for (unsigned int i=0; i < SgPlusAssignOp::pools.size(); i++)
117515 : {
117516 : // objectArray[i] is a single memory pool, iterate over all the
117517 : // IR nodes and only count those that are valid IR nodes used in
117518 : // the AST (i.e. allocated IR nodes).
117519 2001 : for (unsigned j=0; j < SgPlusAssignOp::pool_size; j++)
117520 : {
117521 : // This is indexing the STL vector of C/C++ style arrays as a doubly
117522 : // indexed array access. It is OK since we have leveraged the semantics
117523 : // of STL vector memory as contigous and cast the memory as an array
117524 : // of arrays to use the 2D array indexing. Hope this is not confusing,
117525 : // but it s very fast as an implementation.
117526 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
117527 : {
117528 29 : count++;
117529 : }
117530 : }
117531 : }
117532 : }
117533 :
117534 :
117535 :
117536 4 : return count;
117537 : }
117538 :
117539 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
117540 : // using values that overflow signed values of int.
117541 : size_t
117542 0 : SgPlusAssignOp::memoryUsage()
117543 : {
117544 : // This function is required because we need the class name as a type when we call sizeof
117545 : // There might be another way to implement this if we have a traversal that only called a
117546 : // representative object (one call for each type of Sage IIIIR node).
117547 0 : size_t memory = numberOfNodes() * sizeof(SgPlusAssignOp);
117548 :
117549 0 : return memory;
117550 : }
117551 :
117552 : /* #line 117553 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
117553 :
117554 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
117555 : void
117556 5342 : SgMinusAssignOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
117557 : {
117558 : // This function traverses the memory pool for only a specific IR node
117559 : // and calls the visit function of the input class execute a traversal
117560 : // similar to the style of the attribute based traversals within ROSE.
117561 : // This traversal will visit ALL nodes of the AST where as the other
117562 : // attribute based traversals visit only the embedded tree within the AST.
117563 :
117564 : // Initialize array to the address of the first element of the STL vector
117565 : // (which is guaranteed to be contiguous storage).
117566 : // SgMinusAssignOp objectArray [] = *(Memory_Block_List.begin());
117567 5342 : if (SgMinusAssignOp::pools.empty() == false)
117568 : {
117569 : // Generate an array of memory pools
117570 258 : SgMinusAssignOp** objectArray = (SgMinusAssignOp**) &(SgMinusAssignOp::pools[0]);
117571 :
117572 : // Build a local variable for better performance
117573 258 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
117574 : #if 0
117575 : // Iterate over the memory pools
117576 : for (unsigned int i=0; i < SgMinusAssignOp::pools.size(); i++)
117577 : {
117578 : // objectArray[i] is a single memory pool
117579 : for (int j=0; j < SgMinusAssignOp::pool_size; j++)
117580 : {
117581 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
117582 : {
117583 : traversal.visit(&(objectArray[i][j]));
117584 : }
117585 : }
117586 : }
117587 : #else
117588 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
117589 : // compute the list first and then call the visit function on each list element.
117590 :
117591 : // printf ("Inside of SgMinusAssignOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
117592 :
117593 516 : std::vector<SgMinusAssignOp*> nodeList;
117594 :
117595 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
117596 516 : for (unsigned int i=0; i < SgMinusAssignOp::pools.size(); i++)
117597 : {
117598 : // objectArray[i] is a single memory pool
117599 516258 : for (unsigned j=0; j < SgMinusAssignOp::pool_size; j++)
117600 : {
117601 516000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
117602 : {
117603 1362 : nodeList.push_back(&(objectArray[i][j]));
117604 : }
117605 : }
117606 : }
117607 :
117608 : // Iterate over the saved list
117609 258 : size_t nodeListSize = nodeList.size();
117610 1620 : for (size_t i=0; i < nodeListSize; i++)
117611 : {
117612 1362 : ROSE_ASSERT(nodeList[i] != NULL);
117613 : #if 0
117614 : traversal.visit(nodeList[i]);
117615 : #else
117616 1362 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
117617 : {
117618 1362 : traversal.visit(nodeList[i]);
117619 : }
117620 : #endif
117621 : }
117622 : #endif
117623 : }
117624 :
117625 : // This should not be required since all previously static data members are
117626 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
117627 :
117628 5342 : }
117629 :
117630 :
117631 : void
117632 194 : SgMinusAssignOp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
117633 : {
117634 : // This function traverses the memory pool for an IR node and
117635 : // calls the function to execute the visitor object.
117636 :
117637 : // Initialize array to the address of the first element of the STL vector
117638 : // (which is guarenteed to be contiguous storage).
117639 : // SgMinusAssignOp objectArray [] = *(Memory_Block_List.begin());
117640 194 : if (SgMinusAssignOp::pools.empty() == false)
117641 : {
117642 : // Generate an array of memory pools
117643 142 : SgMinusAssignOp** objectArray = (SgMinusAssignOp**) &(SgMinusAssignOp::pools[0]);
117644 :
117645 : // Build a local variable for better performance
117646 142 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
117647 :
117648 : // Iterate over the memory pools
117649 284 : for (unsigned int i=0; i < SgMinusAssignOp::pools.size(); i++)
117650 : {
117651 : // objectArray[i] is a single memory pool
117652 284142 : for (unsigned j=0; j < SgMinusAssignOp::pool_size; j++)
117653 : {
117654 284000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
117655 : {
117656 : // printf ("Found a valid SgMinusAssignOp object in the memory pool %d at position %d \n",i,j);
117657 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
117658 1375 : objectArray[i][j].executeVisitorMemberFunction(visitor);
117659 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
117660 : }
117661 : else
117662 : {
117663 : // printf ("Found a INVALID SgMinusAssignOp object in the memory pool \n");
117664 : }
117665 : }
117666 : }
117667 : }
117668 :
117669 : // This should not be required since all previously static data members are
117670 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
117671 :
117672 194 : }
117673 :
117674 : void
117675 0 : SgMinusAssignOp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
117676 : {
117677 : // This function visits only a single IR node of the memory pool.
117678 : // it is typically called once for each type of IR node within
117679 : // the automatically generated function: traverseRepresentativeNodes().
117680 :
117681 : // Initialize array to the address of the first element of the STL vector
117682 : // (which is guarenteed to be contiguous storage).
117683 : // SgMinusAssignOp objectArray [] = *(Memory_Block_List.begin());
117684 0 : if (SgMinusAssignOp::pools.empty() == false)
117685 : {
117686 : // Generate an array of memory pools
117687 0 : SgMinusAssignOp** objectArray = (SgMinusAssignOp**) &(SgMinusAssignOp::pools[0]);
117688 :
117689 : // Build a local variable for better performance
117690 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
117691 :
117692 : // Iterate over the memory pools
117693 0 : bool done = false;
117694 0 : unsigned i=0;
117695 :
117696 : // find the first valid IR node, call visit function, and then leave
117697 0 : while ( done == false && i < SgMinusAssignOp::pools.size() )
117698 : {
117699 : // objectArray[i] is a single memory pool
117700 : unsigned j=0;
117701 0 : while (done == false && j < SgMinusAssignOp::pool_size)
117702 : {
117703 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
117704 : {
117705 0 : traversal.visit(&(objectArray[i][j]));
117706 0 : done = true;
117707 : }
117708 0 : j++;
117709 : }
117710 0 : i++;
117711 : }
117712 :
117713 : #if 0
117714 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
117715 : if (done == false)
117716 : {
117717 : printf ("No representative for SgMinusAssignOp found in memory pools \n");
117718 : }
117719 : #endif
117720 : }
117721 0 : }
117722 :
117723 :
117724 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
117725 : // using values that overflow signed values of int.
117726 : size_t
117727 4 : SgMinusAssignOp::numberOfNodes()
117728 : {
117729 : // This function traverses the memory pool for an IR node and
117730 : // counts the number of IR nodes of a particular Sage III IR
117731 : // nodes type.
117732 :
117733 4 : size_t count = 0;
117734 4 : if (SgMinusAssignOp::pools.empty() == false)
117735 : {
117736 : // Generate an array of memory pools (this is actually a STL vector,
117737 : // but it is contiguious, so OK to treat this way).
117738 1 : SgMinusAssignOp** objectArray = (SgMinusAssignOp**) &(SgMinusAssignOp::pools[0]);
117739 :
117740 : // Build a local variable for better performance (make it a loop invariant variable).
117741 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
117742 :
117743 : // Iterate over all of the memory pools for this IR node.
117744 2 : for (unsigned int i=0; i < SgMinusAssignOp::pools.size(); i++)
117745 : {
117746 : // objectArray[i] is a single memory pool, iterate over all the
117747 : // IR nodes and only count those that are valid IR nodes used in
117748 : // the AST (i.e. allocated IR nodes).
117749 2001 : for (unsigned j=0; j < SgMinusAssignOp::pool_size; j++)
117750 : {
117751 : // This is indexing the STL vector of C/C++ style arrays as a doubly
117752 : // indexed array access. It is OK since we have leveraged the semantics
117753 : // of STL vector memory as contigous and cast the memory as an array
117754 : // of arrays to use the 2D array indexing. Hope this is not confusing,
117755 : // but it s very fast as an implementation.
117756 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
117757 : {
117758 10 : count++;
117759 : }
117760 : }
117761 : }
117762 : }
117763 :
117764 :
117765 :
117766 4 : return count;
117767 : }
117768 :
117769 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
117770 : // using values that overflow signed values of int.
117771 : size_t
117772 0 : SgMinusAssignOp::memoryUsage()
117773 : {
117774 : // This function is required because we need the class name as a type when we call sizeof
117775 : // There might be another way to implement this if we have a traversal that only called a
117776 : // representative object (one call for each type of Sage IIIIR node).
117777 0 : size_t memory = numberOfNodes() * sizeof(SgMinusAssignOp);
117778 :
117779 0 : return memory;
117780 : }
117781 :
117782 : /* #line 117783 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
117783 :
117784 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
117785 : void
117786 5342 : SgAndAssignOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
117787 : {
117788 : // This function traverses the memory pool for only a specific IR node
117789 : // and calls the visit function of the input class execute a traversal
117790 : // similar to the style of the attribute based traversals within ROSE.
117791 : // This traversal will visit ALL nodes of the AST where as the other
117792 : // attribute based traversals visit only the embedded tree within the AST.
117793 :
117794 : // Initialize array to the address of the first element of the STL vector
117795 : // (which is guaranteed to be contiguous storage).
117796 : // SgAndAssignOp objectArray [] = *(Memory_Block_List.begin());
117797 5342 : if (SgAndAssignOp::pools.empty() == false)
117798 : {
117799 : // Generate an array of memory pools
117800 32 : SgAndAssignOp** objectArray = (SgAndAssignOp**) &(SgAndAssignOp::pools[0]);
117801 :
117802 : // Build a local variable for better performance
117803 32 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
117804 : #if 0
117805 : // Iterate over the memory pools
117806 : for (unsigned int i=0; i < SgAndAssignOp::pools.size(); i++)
117807 : {
117808 : // objectArray[i] is a single memory pool
117809 : for (int j=0; j < SgAndAssignOp::pool_size; j++)
117810 : {
117811 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
117812 : {
117813 : traversal.visit(&(objectArray[i][j]));
117814 : }
117815 : }
117816 : }
117817 : #else
117818 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
117819 : // compute the list first and then call the visit function on each list element.
117820 :
117821 : // printf ("Inside of SgAndAssignOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
117822 :
117823 64 : std::vector<SgAndAssignOp*> nodeList;
117824 :
117825 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
117826 64 : for (unsigned int i=0; i < SgAndAssignOp::pools.size(); i++)
117827 : {
117828 : // objectArray[i] is a single memory pool
117829 64032 : for (unsigned j=0; j < SgAndAssignOp::pool_size; j++)
117830 : {
117831 64000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
117832 : {
117833 96 : nodeList.push_back(&(objectArray[i][j]));
117834 : }
117835 : }
117836 : }
117837 :
117838 : // Iterate over the saved list
117839 32 : size_t nodeListSize = nodeList.size();
117840 128 : for (size_t i=0; i < nodeListSize; i++)
117841 : {
117842 96 : ROSE_ASSERT(nodeList[i] != NULL);
117843 : #if 0
117844 : traversal.visit(nodeList[i]);
117845 : #else
117846 96 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
117847 : {
117848 96 : traversal.visit(nodeList[i]);
117849 : }
117850 : #endif
117851 : }
117852 : #endif
117853 : }
117854 :
117855 : // This should not be required since all previously static data members are
117856 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
117857 :
117858 5342 : }
117859 :
117860 :
117861 : void
117862 194 : SgAndAssignOp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
117863 : {
117864 : // This function traverses the memory pool for an IR node and
117865 : // calls the function to execute the visitor object.
117866 :
117867 : // Initialize array to the address of the first element of the STL vector
117868 : // (which is guarenteed to be contiguous storage).
117869 : // SgAndAssignOp objectArray [] = *(Memory_Block_List.begin());
117870 194 : if (SgAndAssignOp::pools.empty() == false)
117871 : {
117872 : // Generate an array of memory pools
117873 18 : SgAndAssignOp** objectArray = (SgAndAssignOp**) &(SgAndAssignOp::pools[0]);
117874 :
117875 : // Build a local variable for better performance
117876 18 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
117877 :
117878 : // Iterate over the memory pools
117879 36 : for (unsigned int i=0; i < SgAndAssignOp::pools.size(); i++)
117880 : {
117881 : // objectArray[i] is a single memory pool
117882 36018 : for (unsigned j=0; j < SgAndAssignOp::pool_size; j++)
117883 : {
117884 36000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
117885 : {
117886 : // printf ("Found a valid SgAndAssignOp object in the memory pool %d at position %d \n",i,j);
117887 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
117888 54 : objectArray[i][j].executeVisitorMemberFunction(visitor);
117889 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
117890 : }
117891 : else
117892 : {
117893 : // printf ("Found a INVALID SgAndAssignOp object in the memory pool \n");
117894 : }
117895 : }
117896 : }
117897 : }
117898 :
117899 : // This should not be required since all previously static data members are
117900 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
117901 :
117902 194 : }
117903 :
117904 : void
117905 0 : SgAndAssignOp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
117906 : {
117907 : // This function visits only a single IR node of the memory pool.
117908 : // it is typically called once for each type of IR node within
117909 : // the automatically generated function: traverseRepresentativeNodes().
117910 :
117911 : // Initialize array to the address of the first element of the STL vector
117912 : // (which is guarenteed to be contiguous storage).
117913 : // SgAndAssignOp objectArray [] = *(Memory_Block_List.begin());
117914 0 : if (SgAndAssignOp::pools.empty() == false)
117915 : {
117916 : // Generate an array of memory pools
117917 0 : SgAndAssignOp** objectArray = (SgAndAssignOp**) &(SgAndAssignOp::pools[0]);
117918 :
117919 : // Build a local variable for better performance
117920 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
117921 :
117922 : // Iterate over the memory pools
117923 0 : bool done = false;
117924 0 : unsigned i=0;
117925 :
117926 : // find the first valid IR node, call visit function, and then leave
117927 0 : while ( done == false && i < SgAndAssignOp::pools.size() )
117928 : {
117929 : // objectArray[i] is a single memory pool
117930 : unsigned j=0;
117931 0 : while (done == false && j < SgAndAssignOp::pool_size)
117932 : {
117933 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
117934 : {
117935 0 : traversal.visit(&(objectArray[i][j]));
117936 0 : done = true;
117937 : }
117938 0 : j++;
117939 : }
117940 0 : i++;
117941 : }
117942 :
117943 : #if 0
117944 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
117945 : if (done == false)
117946 : {
117947 : printf ("No representative for SgAndAssignOp found in memory pools \n");
117948 : }
117949 : #endif
117950 : }
117951 0 : }
117952 :
117953 :
117954 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
117955 : // using values that overflow signed values of int.
117956 : size_t
117957 4 : SgAndAssignOp::numberOfNodes()
117958 : {
117959 : // This function traverses the memory pool for an IR node and
117960 : // counts the number of IR nodes of a particular Sage III IR
117961 : // nodes type.
117962 :
117963 4 : size_t count = 0;
117964 4 : if (SgAndAssignOp::pools.empty() == false)
117965 : {
117966 : // Generate an array of memory pools (this is actually a STL vector,
117967 : // but it is contiguious, so OK to treat this way).
117968 0 : SgAndAssignOp** objectArray = (SgAndAssignOp**) &(SgAndAssignOp::pools[0]);
117969 :
117970 : // Build a local variable for better performance (make it a loop invariant variable).
117971 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
117972 :
117973 : // Iterate over all of the memory pools for this IR node.
117974 0 : for (unsigned int i=0; i < SgAndAssignOp::pools.size(); i++)
117975 : {
117976 : // objectArray[i] is a single memory pool, iterate over all the
117977 : // IR nodes and only count those that are valid IR nodes used in
117978 : // the AST (i.e. allocated IR nodes).
117979 0 : for (unsigned j=0; j < SgAndAssignOp::pool_size; j++)
117980 : {
117981 : // This is indexing the STL vector of C/C++ style arrays as a doubly
117982 : // indexed array access. It is OK since we have leveraged the semantics
117983 : // of STL vector memory as contigous and cast the memory as an array
117984 : // of arrays to use the 2D array indexing. Hope this is not confusing,
117985 : // but it s very fast as an implementation.
117986 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
117987 : {
117988 0 : count++;
117989 : }
117990 : }
117991 : }
117992 : }
117993 :
117994 :
117995 :
117996 4 : return count;
117997 : }
117998 :
117999 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
118000 : // using values that overflow signed values of int.
118001 : size_t
118002 0 : SgAndAssignOp::memoryUsage()
118003 : {
118004 : // This function is required because we need the class name as a type when we call sizeof
118005 : // There might be another way to implement this if we have a traversal that only called a
118006 : // representative object (one call for each type of Sage IIIIR node).
118007 0 : size_t memory = numberOfNodes() * sizeof(SgAndAssignOp);
118008 :
118009 0 : return memory;
118010 : }
118011 :
118012 : /* #line 118013 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
118013 :
118014 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
118015 : void
118016 5342 : SgIorAssignOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
118017 : {
118018 : // This function traverses the memory pool for only a specific IR node
118019 : // and calls the visit function of the input class execute a traversal
118020 : // similar to the style of the attribute based traversals within ROSE.
118021 : // This traversal will visit ALL nodes of the AST where as the other
118022 : // attribute based traversals visit only the embedded tree within the AST.
118023 :
118024 : // Initialize array to the address of the first element of the STL vector
118025 : // (which is guaranteed to be contiguous storage).
118026 : // SgIorAssignOp objectArray [] = *(Memory_Block_List.begin());
118027 5342 : if (SgIorAssignOp::pools.empty() == false)
118028 : {
118029 : // Generate an array of memory pools
118030 138 : SgIorAssignOp** objectArray = (SgIorAssignOp**) &(SgIorAssignOp::pools[0]);
118031 :
118032 : // Build a local variable for better performance
118033 138 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
118034 : #if 0
118035 : // Iterate over the memory pools
118036 : for (unsigned int i=0; i < SgIorAssignOp::pools.size(); i++)
118037 : {
118038 : // objectArray[i] is a single memory pool
118039 : for (int j=0; j < SgIorAssignOp::pool_size; j++)
118040 : {
118041 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
118042 : {
118043 : traversal.visit(&(objectArray[i][j]));
118044 : }
118045 : }
118046 : }
118047 : #else
118048 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
118049 : // compute the list first and then call the visit function on each list element.
118050 :
118051 : // printf ("Inside of SgIorAssignOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
118052 :
118053 276 : std::vector<SgIorAssignOp*> nodeList;
118054 :
118055 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
118056 276 : for (unsigned int i=0; i < SgIorAssignOp::pools.size(); i++)
118057 : {
118058 : // objectArray[i] is a single memory pool
118059 276138 : for (unsigned j=0; j < SgIorAssignOp::pool_size; j++)
118060 : {
118061 276000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
118062 : {
118063 869 : nodeList.push_back(&(objectArray[i][j]));
118064 : }
118065 : }
118066 : }
118067 :
118068 : // Iterate over the saved list
118069 138 : size_t nodeListSize = nodeList.size();
118070 1007 : for (size_t i=0; i < nodeListSize; i++)
118071 : {
118072 869 : ROSE_ASSERT(nodeList[i] != NULL);
118073 : #if 0
118074 : traversal.visit(nodeList[i]);
118075 : #else
118076 869 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
118077 : {
118078 869 : traversal.visit(nodeList[i]);
118079 : }
118080 : #endif
118081 : }
118082 : #endif
118083 : }
118084 :
118085 : // This should not be required since all previously static data members are
118086 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
118087 :
118088 5342 : }
118089 :
118090 :
118091 : void
118092 194 : SgIorAssignOp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
118093 : {
118094 : // This function traverses the memory pool for an IR node and
118095 : // calls the function to execute the visitor object.
118096 :
118097 : // Initialize array to the address of the first element of the STL vector
118098 : // (which is guarenteed to be contiguous storage).
118099 : // SgIorAssignOp objectArray [] = *(Memory_Block_List.begin());
118100 194 : if (SgIorAssignOp::pools.empty() == false)
118101 : {
118102 : // Generate an array of memory pools
118103 137 : SgIorAssignOp** objectArray = (SgIorAssignOp**) &(SgIorAssignOp::pools[0]);
118104 :
118105 : // Build a local variable for better performance
118106 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
118107 :
118108 : // Iterate over the memory pools
118109 274 : for (unsigned int i=0; i < SgIorAssignOp::pools.size(); i++)
118110 : {
118111 : // objectArray[i] is a single memory pool
118112 274137 : for (unsigned j=0; j < SgIorAssignOp::pool_size; j++)
118113 : {
118114 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
118115 : {
118116 : // printf ("Found a valid SgIorAssignOp object in the memory pool %d at position %d \n",i,j);
118117 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
118118 995 : objectArray[i][j].executeVisitorMemberFunction(visitor);
118119 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
118120 : }
118121 : else
118122 : {
118123 : // printf ("Found a INVALID SgIorAssignOp object in the memory pool \n");
118124 : }
118125 : }
118126 : }
118127 : }
118128 :
118129 : // This should not be required since all previously static data members are
118130 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
118131 :
118132 194 : }
118133 :
118134 : void
118135 0 : SgIorAssignOp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
118136 : {
118137 : // This function visits only a single IR node of the memory pool.
118138 : // it is typically called once for each type of IR node within
118139 : // the automatically generated function: traverseRepresentativeNodes().
118140 :
118141 : // Initialize array to the address of the first element of the STL vector
118142 : // (which is guarenteed to be contiguous storage).
118143 : // SgIorAssignOp objectArray [] = *(Memory_Block_List.begin());
118144 0 : if (SgIorAssignOp::pools.empty() == false)
118145 : {
118146 : // Generate an array of memory pools
118147 0 : SgIorAssignOp** objectArray = (SgIorAssignOp**) &(SgIorAssignOp::pools[0]);
118148 :
118149 : // Build a local variable for better performance
118150 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
118151 :
118152 : // Iterate over the memory pools
118153 0 : bool done = false;
118154 0 : unsigned i=0;
118155 :
118156 : // find the first valid IR node, call visit function, and then leave
118157 0 : while ( done == false && i < SgIorAssignOp::pools.size() )
118158 : {
118159 : // objectArray[i] is a single memory pool
118160 : unsigned j=0;
118161 0 : while (done == false && j < SgIorAssignOp::pool_size)
118162 : {
118163 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
118164 : {
118165 0 : traversal.visit(&(objectArray[i][j]));
118166 0 : done = true;
118167 : }
118168 0 : j++;
118169 : }
118170 0 : i++;
118171 : }
118172 :
118173 : #if 0
118174 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
118175 : if (done == false)
118176 : {
118177 : printf ("No representative for SgIorAssignOp found in memory pools \n");
118178 : }
118179 : #endif
118180 : }
118181 0 : }
118182 :
118183 :
118184 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
118185 : // using values that overflow signed values of int.
118186 : size_t
118187 4 : SgIorAssignOp::numberOfNodes()
118188 : {
118189 : // This function traverses the memory pool for an IR node and
118190 : // counts the number of IR nodes of a particular Sage III IR
118191 : // nodes type.
118192 :
118193 4 : size_t count = 0;
118194 4 : if (SgIorAssignOp::pools.empty() == false)
118195 : {
118196 : // Generate an array of memory pools (this is actually a STL vector,
118197 : // but it is contiguious, so OK to treat this way).
118198 1 : SgIorAssignOp** objectArray = (SgIorAssignOp**) &(SgIorAssignOp::pools[0]);
118199 :
118200 : // Build a local variable for better performance (make it a loop invariant variable).
118201 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
118202 :
118203 : // Iterate over all of the memory pools for this IR node.
118204 2 : for (unsigned int i=0; i < SgIorAssignOp::pools.size(); i++)
118205 : {
118206 : // objectArray[i] is a single memory pool, iterate over all the
118207 : // IR nodes and only count those that are valid IR nodes used in
118208 : // the AST (i.e. allocated IR nodes).
118209 2001 : for (unsigned j=0; j < SgIorAssignOp::pool_size; j++)
118210 : {
118211 : // This is indexing the STL vector of C/C++ style arrays as a doubly
118212 : // indexed array access. It is OK since we have leveraged the semantics
118213 : // of STL vector memory as contigous and cast the memory as an array
118214 : // of arrays to use the 2D array indexing. Hope this is not confusing,
118215 : // but it s very fast as an implementation.
118216 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
118217 : {
118218 7 : count++;
118219 : }
118220 : }
118221 : }
118222 : }
118223 :
118224 :
118225 :
118226 4 : return count;
118227 : }
118228 :
118229 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
118230 : // using values that overflow signed values of int.
118231 : size_t
118232 0 : SgIorAssignOp::memoryUsage()
118233 : {
118234 : // This function is required because we need the class name as a type when we call sizeof
118235 : // There might be another way to implement this if we have a traversal that only called a
118236 : // representative object (one call for each type of Sage IIIIR node).
118237 0 : size_t memory = numberOfNodes() * sizeof(SgIorAssignOp);
118238 :
118239 0 : return memory;
118240 : }
118241 :
118242 : /* #line 118243 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
118243 :
118244 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
118245 : void
118246 5342 : SgMultAssignOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
118247 : {
118248 : // This function traverses the memory pool for only a specific IR node
118249 : // and calls the visit function of the input class execute a traversal
118250 : // similar to the style of the attribute based traversals within ROSE.
118251 : // This traversal will visit ALL nodes of the AST where as the other
118252 : // attribute based traversals visit only the embedded tree within the AST.
118253 :
118254 : // Initialize array to the address of the first element of the STL vector
118255 : // (which is guaranteed to be contiguous storage).
118256 : // SgMultAssignOp objectArray [] = *(Memory_Block_List.begin());
118257 5342 : if (SgMultAssignOp::pools.empty() == false)
118258 : {
118259 : // Generate an array of memory pools
118260 160 : SgMultAssignOp** objectArray = (SgMultAssignOp**) &(SgMultAssignOp::pools[0]);
118261 :
118262 : // Build a local variable for better performance
118263 160 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
118264 : #if 0
118265 : // Iterate over the memory pools
118266 : for (unsigned int i=0; i < SgMultAssignOp::pools.size(); i++)
118267 : {
118268 : // objectArray[i] is a single memory pool
118269 : for (int j=0; j < SgMultAssignOp::pool_size; j++)
118270 : {
118271 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
118272 : {
118273 : traversal.visit(&(objectArray[i][j]));
118274 : }
118275 : }
118276 : }
118277 : #else
118278 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
118279 : // compute the list first and then call the visit function on each list element.
118280 :
118281 : // printf ("Inside of SgMultAssignOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
118282 :
118283 320 : std::vector<SgMultAssignOp*> nodeList;
118284 :
118285 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
118286 320 : for (unsigned int i=0; i < SgMultAssignOp::pools.size(); i++)
118287 : {
118288 : // objectArray[i] is a single memory pool
118289 320160 : for (unsigned j=0; j < SgMultAssignOp::pool_size; j++)
118290 : {
118291 320000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
118292 : {
118293 440 : nodeList.push_back(&(objectArray[i][j]));
118294 : }
118295 : }
118296 : }
118297 :
118298 : // Iterate over the saved list
118299 160 : size_t nodeListSize = nodeList.size();
118300 600 : for (size_t i=0; i < nodeListSize; i++)
118301 : {
118302 440 : ROSE_ASSERT(nodeList[i] != NULL);
118303 : #if 0
118304 : traversal.visit(nodeList[i]);
118305 : #else
118306 440 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
118307 : {
118308 440 : traversal.visit(nodeList[i]);
118309 : }
118310 : #endif
118311 : }
118312 : #endif
118313 : }
118314 :
118315 : // This should not be required since all previously static data members are
118316 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
118317 :
118318 5342 : }
118319 :
118320 :
118321 : void
118322 194 : SgMultAssignOp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
118323 : {
118324 : // This function traverses the memory pool for an IR node and
118325 : // calls the function to execute the visitor object.
118326 :
118327 : // Initialize array to the address of the first element of the STL vector
118328 : // (which is guarenteed to be contiguous storage).
118329 : // SgMultAssignOp objectArray [] = *(Memory_Block_List.begin());
118330 194 : if (SgMultAssignOp::pools.empty() == false)
118331 : {
118332 : // Generate an array of memory pools
118333 137 : SgMultAssignOp** objectArray = (SgMultAssignOp**) &(SgMultAssignOp::pools[0]);
118334 :
118335 : // Build a local variable for better performance
118336 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
118337 :
118338 : // Iterate over the memory pools
118339 274 : for (unsigned int i=0; i < SgMultAssignOp::pools.size(); i++)
118340 : {
118341 : // objectArray[i] is a single memory pool
118342 274137 : for (unsigned j=0; j < SgMultAssignOp::pool_size; j++)
118343 : {
118344 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
118345 : {
118346 : // printf ("Found a valid SgMultAssignOp object in the memory pool %d at position %d \n",i,j);
118347 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
118348 274 : objectArray[i][j].executeVisitorMemberFunction(visitor);
118349 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
118350 : }
118351 : else
118352 : {
118353 : // printf ("Found a INVALID SgMultAssignOp object in the memory pool \n");
118354 : }
118355 : }
118356 : }
118357 : }
118358 :
118359 : // This should not be required since all previously static data members are
118360 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
118361 :
118362 194 : }
118363 :
118364 : void
118365 0 : SgMultAssignOp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
118366 : {
118367 : // This function visits only a single IR node of the memory pool.
118368 : // it is typically called once for each type of IR node within
118369 : // the automatically generated function: traverseRepresentativeNodes().
118370 :
118371 : // Initialize array to the address of the first element of the STL vector
118372 : // (which is guarenteed to be contiguous storage).
118373 : // SgMultAssignOp objectArray [] = *(Memory_Block_List.begin());
118374 0 : if (SgMultAssignOp::pools.empty() == false)
118375 : {
118376 : // Generate an array of memory pools
118377 0 : SgMultAssignOp** objectArray = (SgMultAssignOp**) &(SgMultAssignOp::pools[0]);
118378 :
118379 : // Build a local variable for better performance
118380 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
118381 :
118382 : // Iterate over the memory pools
118383 0 : bool done = false;
118384 0 : unsigned i=0;
118385 :
118386 : // find the first valid IR node, call visit function, and then leave
118387 0 : while ( done == false && i < SgMultAssignOp::pools.size() )
118388 : {
118389 : // objectArray[i] is a single memory pool
118390 : unsigned j=0;
118391 0 : while (done == false && j < SgMultAssignOp::pool_size)
118392 : {
118393 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
118394 : {
118395 0 : traversal.visit(&(objectArray[i][j]));
118396 0 : done = true;
118397 : }
118398 0 : j++;
118399 : }
118400 0 : i++;
118401 : }
118402 :
118403 : #if 0
118404 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
118405 : if (done == false)
118406 : {
118407 : printf ("No representative for SgMultAssignOp found in memory pools \n");
118408 : }
118409 : #endif
118410 : }
118411 0 : }
118412 :
118413 :
118414 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
118415 : // using values that overflow signed values of int.
118416 : size_t
118417 4 : SgMultAssignOp::numberOfNodes()
118418 : {
118419 : // This function traverses the memory pool for an IR node and
118420 : // counts the number of IR nodes of a particular Sage III IR
118421 : // nodes type.
118422 :
118423 4 : size_t count = 0;
118424 4 : if (SgMultAssignOp::pools.empty() == false)
118425 : {
118426 : // Generate an array of memory pools (this is actually a STL vector,
118427 : // but it is contiguious, so OK to treat this way).
118428 1 : SgMultAssignOp** objectArray = (SgMultAssignOp**) &(SgMultAssignOp::pools[0]);
118429 :
118430 : // Build a local variable for better performance (make it a loop invariant variable).
118431 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
118432 :
118433 : // Iterate over all of the memory pools for this IR node.
118434 2 : for (unsigned int i=0; i < SgMultAssignOp::pools.size(); i++)
118435 : {
118436 : // objectArray[i] is a single memory pool, iterate over all the
118437 : // IR nodes and only count those that are valid IR nodes used in
118438 : // the AST (i.e. allocated IR nodes).
118439 2001 : for (unsigned j=0; j < SgMultAssignOp::pool_size; j++)
118440 : {
118441 : // This is indexing the STL vector of C/C++ style arrays as a doubly
118442 : // indexed array access. It is OK since we have leveraged the semantics
118443 : // of STL vector memory as contigous and cast the memory as an array
118444 : // of arrays to use the 2D array indexing. Hope this is not confusing,
118445 : // but it s very fast as an implementation.
118446 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
118447 : {
118448 2 : count++;
118449 : }
118450 : }
118451 : }
118452 : }
118453 :
118454 :
118455 :
118456 4 : return count;
118457 : }
118458 :
118459 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
118460 : // using values that overflow signed values of int.
118461 : size_t
118462 0 : SgMultAssignOp::memoryUsage()
118463 : {
118464 : // This function is required because we need the class name as a type when we call sizeof
118465 : // There might be another way to implement this if we have a traversal that only called a
118466 : // representative object (one call for each type of Sage IIIIR node).
118467 0 : size_t memory = numberOfNodes() * sizeof(SgMultAssignOp);
118468 :
118469 0 : return memory;
118470 : }
118471 :
118472 : /* #line 118473 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
118473 :
118474 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
118475 : void
118476 5342 : SgDivAssignOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
118477 : {
118478 : // This function traverses the memory pool for only a specific IR node
118479 : // and calls the visit function of the input class execute a traversal
118480 : // similar to the style of the attribute based traversals within ROSE.
118481 : // This traversal will visit ALL nodes of the AST where as the other
118482 : // attribute based traversals visit only the embedded tree within the AST.
118483 :
118484 : // Initialize array to the address of the first element of the STL vector
118485 : // (which is guaranteed to be contiguous storage).
118486 : // SgDivAssignOp objectArray [] = *(Memory_Block_List.begin());
118487 5342 : if (SgDivAssignOp::pools.empty() == false)
118488 : {
118489 : // Generate an array of memory pools
118490 130 : SgDivAssignOp** objectArray = (SgDivAssignOp**) &(SgDivAssignOp::pools[0]);
118491 :
118492 : // Build a local variable for better performance
118493 130 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
118494 : #if 0
118495 : // Iterate over the memory pools
118496 : for (unsigned int i=0; i < SgDivAssignOp::pools.size(); i++)
118497 : {
118498 : // objectArray[i] is a single memory pool
118499 : for (int j=0; j < SgDivAssignOp::pool_size; j++)
118500 : {
118501 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
118502 : {
118503 : traversal.visit(&(objectArray[i][j]));
118504 : }
118505 : }
118506 : }
118507 : #else
118508 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
118509 : // compute the list first and then call the visit function on each list element.
118510 :
118511 : // printf ("Inside of SgDivAssignOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
118512 :
118513 260 : std::vector<SgDivAssignOp*> nodeList;
118514 :
118515 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
118516 260 : for (unsigned int i=0; i < SgDivAssignOp::pools.size(); i++)
118517 : {
118518 : // objectArray[i] is a single memory pool
118519 260130 : for (unsigned j=0; j < SgDivAssignOp::pool_size; j++)
118520 : {
118521 260000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
118522 : {
118523 130 : nodeList.push_back(&(objectArray[i][j]));
118524 : }
118525 : }
118526 : }
118527 :
118528 : // Iterate over the saved list
118529 130 : size_t nodeListSize = nodeList.size();
118530 260 : for (size_t i=0; i < nodeListSize; i++)
118531 : {
118532 130 : ROSE_ASSERT(nodeList[i] != NULL);
118533 : #if 0
118534 : traversal.visit(nodeList[i]);
118535 : #else
118536 130 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
118537 : {
118538 130 : traversal.visit(nodeList[i]);
118539 : }
118540 : #endif
118541 : }
118542 : #endif
118543 : }
118544 :
118545 : // This should not be required since all previously static data members are
118546 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
118547 :
118548 5342 : }
118549 :
118550 :
118551 : void
118552 194 : SgDivAssignOp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
118553 : {
118554 : // This function traverses the memory pool for an IR node and
118555 : // calls the function to execute the visitor object.
118556 :
118557 : // Initialize array to the address of the first element of the STL vector
118558 : // (which is guarenteed to be contiguous storage).
118559 : // SgDivAssignOp objectArray [] = *(Memory_Block_List.begin());
118560 194 : if (SgDivAssignOp::pools.empty() == false)
118561 : {
118562 : // Generate an array of memory pools
118563 137 : SgDivAssignOp** objectArray = (SgDivAssignOp**) &(SgDivAssignOp::pools[0]);
118564 :
118565 : // Build a local variable for better performance
118566 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
118567 :
118568 : // Iterate over the memory pools
118569 274 : for (unsigned int i=0; i < SgDivAssignOp::pools.size(); i++)
118570 : {
118571 : // objectArray[i] is a single memory pool
118572 274137 : for (unsigned j=0; j < SgDivAssignOp::pool_size; j++)
118573 : {
118574 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
118575 : {
118576 : // printf ("Found a valid SgDivAssignOp object in the memory pool %d at position %d \n",i,j);
118577 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
118578 137 : objectArray[i][j].executeVisitorMemberFunction(visitor);
118579 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
118580 : }
118581 : else
118582 : {
118583 : // printf ("Found a INVALID SgDivAssignOp object in the memory pool \n");
118584 : }
118585 : }
118586 : }
118587 : }
118588 :
118589 : // This should not be required since all previously static data members are
118590 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
118591 :
118592 194 : }
118593 :
118594 : void
118595 0 : SgDivAssignOp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
118596 : {
118597 : // This function visits only a single IR node of the memory pool.
118598 : // it is typically called once for each type of IR node within
118599 : // the automatically generated function: traverseRepresentativeNodes().
118600 :
118601 : // Initialize array to the address of the first element of the STL vector
118602 : // (which is guarenteed to be contiguous storage).
118603 : // SgDivAssignOp objectArray [] = *(Memory_Block_List.begin());
118604 0 : if (SgDivAssignOp::pools.empty() == false)
118605 : {
118606 : // Generate an array of memory pools
118607 0 : SgDivAssignOp** objectArray = (SgDivAssignOp**) &(SgDivAssignOp::pools[0]);
118608 :
118609 : // Build a local variable for better performance
118610 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
118611 :
118612 : // Iterate over the memory pools
118613 0 : bool done = false;
118614 0 : unsigned i=0;
118615 :
118616 : // find the first valid IR node, call visit function, and then leave
118617 0 : while ( done == false && i < SgDivAssignOp::pools.size() )
118618 : {
118619 : // objectArray[i] is a single memory pool
118620 : unsigned j=0;
118621 0 : while (done == false && j < SgDivAssignOp::pool_size)
118622 : {
118623 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
118624 : {
118625 0 : traversal.visit(&(objectArray[i][j]));
118626 0 : done = true;
118627 : }
118628 0 : j++;
118629 : }
118630 0 : i++;
118631 : }
118632 :
118633 : #if 0
118634 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
118635 : if (done == false)
118636 : {
118637 : printf ("No representative for SgDivAssignOp found in memory pools \n");
118638 : }
118639 : #endif
118640 : }
118641 0 : }
118642 :
118643 :
118644 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
118645 : // using values that overflow signed values of int.
118646 : size_t
118647 4 : SgDivAssignOp::numberOfNodes()
118648 : {
118649 : // This function traverses the memory pool for an IR node and
118650 : // counts the number of IR nodes of a particular Sage III IR
118651 : // nodes type.
118652 :
118653 4 : size_t count = 0;
118654 4 : if (SgDivAssignOp::pools.empty() == false)
118655 : {
118656 : // Generate an array of memory pools (this is actually a STL vector,
118657 : // but it is contiguious, so OK to treat this way).
118658 1 : SgDivAssignOp** objectArray = (SgDivAssignOp**) &(SgDivAssignOp::pools[0]);
118659 :
118660 : // Build a local variable for better performance (make it a loop invariant variable).
118661 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
118662 :
118663 : // Iterate over all of the memory pools for this IR node.
118664 2 : for (unsigned int i=0; i < SgDivAssignOp::pools.size(); i++)
118665 : {
118666 : // objectArray[i] is a single memory pool, iterate over all the
118667 : // IR nodes and only count those that are valid IR nodes used in
118668 : // the AST (i.e. allocated IR nodes).
118669 2001 : for (unsigned j=0; j < SgDivAssignOp::pool_size; j++)
118670 : {
118671 : // This is indexing the STL vector of C/C++ style arrays as a doubly
118672 : // indexed array access. It is OK since we have leveraged the semantics
118673 : // of STL vector memory as contigous and cast the memory as an array
118674 : // of arrays to use the 2D array indexing. Hope this is not confusing,
118675 : // but it s very fast as an implementation.
118676 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
118677 : {
118678 1 : count++;
118679 : }
118680 : }
118681 : }
118682 : }
118683 :
118684 :
118685 :
118686 4 : return count;
118687 : }
118688 :
118689 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
118690 : // using values that overflow signed values of int.
118691 : size_t
118692 0 : SgDivAssignOp::memoryUsage()
118693 : {
118694 : // This function is required because we need the class name as a type when we call sizeof
118695 : // There might be another way to implement this if we have a traversal that only called a
118696 : // representative object (one call for each type of Sage IIIIR node).
118697 0 : size_t memory = numberOfNodes() * sizeof(SgDivAssignOp);
118698 :
118699 0 : return memory;
118700 : }
118701 :
118702 : /* #line 118703 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
118703 :
118704 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
118705 : void
118706 5342 : SgModAssignOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
118707 : {
118708 : // This function traverses the memory pool for only a specific IR node
118709 : // and calls the visit function of the input class execute a traversal
118710 : // similar to the style of the attribute based traversals within ROSE.
118711 : // This traversal will visit ALL nodes of the AST where as the other
118712 : // attribute based traversals visit only the embedded tree within the AST.
118713 :
118714 : // Initialize array to the address of the first element of the STL vector
118715 : // (which is guaranteed to be contiguous storage).
118716 : // SgModAssignOp objectArray [] = *(Memory_Block_List.begin());
118717 5342 : if (SgModAssignOp::pools.empty() == false)
118718 : {
118719 : // Generate an array of memory pools
118720 0 : SgModAssignOp** objectArray = (SgModAssignOp**) &(SgModAssignOp::pools[0]);
118721 :
118722 : // Build a local variable for better performance
118723 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
118724 : #if 0
118725 : // Iterate over the memory pools
118726 : for (unsigned int i=0; i < SgModAssignOp::pools.size(); i++)
118727 : {
118728 : // objectArray[i] is a single memory pool
118729 : for (int j=0; j < SgModAssignOp::pool_size; j++)
118730 : {
118731 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
118732 : {
118733 : traversal.visit(&(objectArray[i][j]));
118734 : }
118735 : }
118736 : }
118737 : #else
118738 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
118739 : // compute the list first and then call the visit function on each list element.
118740 :
118741 : // printf ("Inside of SgModAssignOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
118742 :
118743 0 : std::vector<SgModAssignOp*> nodeList;
118744 :
118745 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
118746 0 : for (unsigned int i=0; i < SgModAssignOp::pools.size(); i++)
118747 : {
118748 : // objectArray[i] is a single memory pool
118749 0 : for (unsigned j=0; j < SgModAssignOp::pool_size; j++)
118750 : {
118751 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
118752 : {
118753 0 : nodeList.push_back(&(objectArray[i][j]));
118754 : }
118755 : }
118756 : }
118757 :
118758 : // Iterate over the saved list
118759 0 : size_t nodeListSize = nodeList.size();
118760 0 : for (size_t i=0; i < nodeListSize; i++)
118761 : {
118762 0 : ROSE_ASSERT(nodeList[i] != NULL);
118763 : #if 0
118764 : traversal.visit(nodeList[i]);
118765 : #else
118766 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
118767 : {
118768 0 : traversal.visit(nodeList[i]);
118769 : }
118770 : #endif
118771 : }
118772 : #endif
118773 : }
118774 :
118775 : // This should not be required since all previously static data members are
118776 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
118777 :
118778 5342 : }
118779 :
118780 :
118781 : void
118782 194 : SgModAssignOp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
118783 : {
118784 : // This function traverses the memory pool for an IR node and
118785 : // calls the function to execute the visitor object.
118786 :
118787 : // Initialize array to the address of the first element of the STL vector
118788 : // (which is guarenteed to be contiguous storage).
118789 : // SgModAssignOp objectArray [] = *(Memory_Block_List.begin());
118790 194 : if (SgModAssignOp::pools.empty() == false)
118791 : {
118792 : // Generate an array of memory pools
118793 0 : SgModAssignOp** objectArray = (SgModAssignOp**) &(SgModAssignOp::pools[0]);
118794 :
118795 : // Build a local variable for better performance
118796 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
118797 :
118798 : // Iterate over the memory pools
118799 0 : for (unsigned int i=0; i < SgModAssignOp::pools.size(); i++)
118800 : {
118801 : // objectArray[i] is a single memory pool
118802 0 : for (unsigned j=0; j < SgModAssignOp::pool_size; j++)
118803 : {
118804 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
118805 : {
118806 : // printf ("Found a valid SgModAssignOp object in the memory pool %d at position %d \n",i,j);
118807 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
118808 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
118809 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
118810 : }
118811 : else
118812 : {
118813 : // printf ("Found a INVALID SgModAssignOp object in the memory pool \n");
118814 : }
118815 : }
118816 : }
118817 : }
118818 :
118819 : // This should not be required since all previously static data members are
118820 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
118821 :
118822 194 : }
118823 :
118824 : void
118825 0 : SgModAssignOp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
118826 : {
118827 : // This function visits only a single IR node of the memory pool.
118828 : // it is typically called once for each type of IR node within
118829 : // the automatically generated function: traverseRepresentativeNodes().
118830 :
118831 : // Initialize array to the address of the first element of the STL vector
118832 : // (which is guarenteed to be contiguous storage).
118833 : // SgModAssignOp objectArray [] = *(Memory_Block_List.begin());
118834 0 : if (SgModAssignOp::pools.empty() == false)
118835 : {
118836 : // Generate an array of memory pools
118837 0 : SgModAssignOp** objectArray = (SgModAssignOp**) &(SgModAssignOp::pools[0]);
118838 :
118839 : // Build a local variable for better performance
118840 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
118841 :
118842 : // Iterate over the memory pools
118843 0 : bool done = false;
118844 0 : unsigned i=0;
118845 :
118846 : // find the first valid IR node, call visit function, and then leave
118847 0 : while ( done == false && i < SgModAssignOp::pools.size() )
118848 : {
118849 : // objectArray[i] is a single memory pool
118850 : unsigned j=0;
118851 0 : while (done == false && j < SgModAssignOp::pool_size)
118852 : {
118853 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
118854 : {
118855 0 : traversal.visit(&(objectArray[i][j]));
118856 0 : done = true;
118857 : }
118858 0 : j++;
118859 : }
118860 0 : i++;
118861 : }
118862 :
118863 : #if 0
118864 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
118865 : if (done == false)
118866 : {
118867 : printf ("No representative for SgModAssignOp found in memory pools \n");
118868 : }
118869 : #endif
118870 : }
118871 0 : }
118872 :
118873 :
118874 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
118875 : // using values that overflow signed values of int.
118876 : size_t
118877 4 : SgModAssignOp::numberOfNodes()
118878 : {
118879 : // This function traverses the memory pool for an IR node and
118880 : // counts the number of IR nodes of a particular Sage III IR
118881 : // nodes type.
118882 :
118883 4 : size_t count = 0;
118884 4 : if (SgModAssignOp::pools.empty() == false)
118885 : {
118886 : // Generate an array of memory pools (this is actually a STL vector,
118887 : // but it is contiguious, so OK to treat this way).
118888 0 : SgModAssignOp** objectArray = (SgModAssignOp**) &(SgModAssignOp::pools[0]);
118889 :
118890 : // Build a local variable for better performance (make it a loop invariant variable).
118891 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
118892 :
118893 : // Iterate over all of the memory pools for this IR node.
118894 0 : for (unsigned int i=0; i < SgModAssignOp::pools.size(); i++)
118895 : {
118896 : // objectArray[i] is a single memory pool, iterate over all the
118897 : // IR nodes and only count those that are valid IR nodes used in
118898 : // the AST (i.e. allocated IR nodes).
118899 0 : for (unsigned j=0; j < SgModAssignOp::pool_size; j++)
118900 : {
118901 : // This is indexing the STL vector of C/C++ style arrays as a doubly
118902 : // indexed array access. It is OK since we have leveraged the semantics
118903 : // of STL vector memory as contigous and cast the memory as an array
118904 : // of arrays to use the 2D array indexing. Hope this is not confusing,
118905 : // but it s very fast as an implementation.
118906 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
118907 : {
118908 0 : count++;
118909 : }
118910 : }
118911 : }
118912 : }
118913 :
118914 :
118915 :
118916 4 : return count;
118917 : }
118918 :
118919 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
118920 : // using values that overflow signed values of int.
118921 : size_t
118922 0 : SgModAssignOp::memoryUsage()
118923 : {
118924 : // This function is required because we need the class name as a type when we call sizeof
118925 : // There might be another way to implement this if we have a traversal that only called a
118926 : // representative object (one call for each type of Sage IIIIR node).
118927 0 : size_t memory = numberOfNodes() * sizeof(SgModAssignOp);
118928 :
118929 0 : return memory;
118930 : }
118931 :
118932 : /* #line 118933 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
118933 :
118934 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
118935 : void
118936 5342 : SgXorAssignOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
118937 : {
118938 : // This function traverses the memory pool for only a specific IR node
118939 : // and calls the visit function of the input class execute a traversal
118940 : // similar to the style of the attribute based traversals within ROSE.
118941 : // This traversal will visit ALL nodes of the AST where as the other
118942 : // attribute based traversals visit only the embedded tree within the AST.
118943 :
118944 : // Initialize array to the address of the first element of the STL vector
118945 : // (which is guaranteed to be contiguous storage).
118946 : // SgXorAssignOp objectArray [] = *(Memory_Block_List.begin());
118947 5342 : if (SgXorAssignOp::pools.empty() == false)
118948 : {
118949 : // Generate an array of memory pools
118950 32 : SgXorAssignOp** objectArray = (SgXorAssignOp**) &(SgXorAssignOp::pools[0]);
118951 :
118952 : // Build a local variable for better performance
118953 32 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
118954 : #if 0
118955 : // Iterate over the memory pools
118956 : for (unsigned int i=0; i < SgXorAssignOp::pools.size(); i++)
118957 : {
118958 : // objectArray[i] is a single memory pool
118959 : for (int j=0; j < SgXorAssignOp::pool_size; j++)
118960 : {
118961 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
118962 : {
118963 : traversal.visit(&(objectArray[i][j]));
118964 : }
118965 : }
118966 : }
118967 : #else
118968 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
118969 : // compute the list first and then call the visit function on each list element.
118970 :
118971 : // printf ("Inside of SgXorAssignOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
118972 :
118973 64 : std::vector<SgXorAssignOp*> nodeList;
118974 :
118975 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
118976 64 : for (unsigned int i=0; i < SgXorAssignOp::pools.size(); i++)
118977 : {
118978 : // objectArray[i] is a single memory pool
118979 64032 : for (unsigned j=0; j < SgXorAssignOp::pool_size; j++)
118980 : {
118981 64000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
118982 : {
118983 32 : nodeList.push_back(&(objectArray[i][j]));
118984 : }
118985 : }
118986 : }
118987 :
118988 : // Iterate over the saved list
118989 32 : size_t nodeListSize = nodeList.size();
118990 64 : for (size_t i=0; i < nodeListSize; i++)
118991 : {
118992 32 : ROSE_ASSERT(nodeList[i] != NULL);
118993 : #if 0
118994 : traversal.visit(nodeList[i]);
118995 : #else
118996 32 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
118997 : {
118998 32 : traversal.visit(nodeList[i]);
118999 : }
119000 : #endif
119001 : }
119002 : #endif
119003 : }
119004 :
119005 : // This should not be required since all previously static data members are
119006 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
119007 :
119008 5342 : }
119009 :
119010 :
119011 : void
119012 194 : SgXorAssignOp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
119013 : {
119014 : // This function traverses the memory pool for an IR node and
119015 : // calls the function to execute the visitor object.
119016 :
119017 : // Initialize array to the address of the first element of the STL vector
119018 : // (which is guarenteed to be contiguous storage).
119019 : // SgXorAssignOp objectArray [] = *(Memory_Block_List.begin());
119020 194 : if (SgXorAssignOp::pools.empty() == false)
119021 : {
119022 : // Generate an array of memory pools
119023 18 : SgXorAssignOp** objectArray = (SgXorAssignOp**) &(SgXorAssignOp::pools[0]);
119024 :
119025 : // Build a local variable for better performance
119026 18 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
119027 :
119028 : // Iterate over the memory pools
119029 36 : for (unsigned int i=0; i < SgXorAssignOp::pools.size(); i++)
119030 : {
119031 : // objectArray[i] is a single memory pool
119032 36018 : for (unsigned j=0; j < SgXorAssignOp::pool_size; j++)
119033 : {
119034 36000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
119035 : {
119036 : // printf ("Found a valid SgXorAssignOp object in the memory pool %d at position %d \n",i,j);
119037 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
119038 18 : objectArray[i][j].executeVisitorMemberFunction(visitor);
119039 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
119040 : }
119041 : else
119042 : {
119043 : // printf ("Found a INVALID SgXorAssignOp object in the memory pool \n");
119044 : }
119045 : }
119046 : }
119047 : }
119048 :
119049 : // This should not be required since all previously static data members are
119050 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
119051 :
119052 194 : }
119053 :
119054 : void
119055 0 : SgXorAssignOp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
119056 : {
119057 : // This function visits only a single IR node of the memory pool.
119058 : // it is typically called once for each type of IR node within
119059 : // the automatically generated function: traverseRepresentativeNodes().
119060 :
119061 : // Initialize array to the address of the first element of the STL vector
119062 : // (which is guarenteed to be contiguous storage).
119063 : // SgXorAssignOp objectArray [] = *(Memory_Block_List.begin());
119064 0 : if (SgXorAssignOp::pools.empty() == false)
119065 : {
119066 : // Generate an array of memory pools
119067 0 : SgXorAssignOp** objectArray = (SgXorAssignOp**) &(SgXorAssignOp::pools[0]);
119068 :
119069 : // Build a local variable for better performance
119070 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
119071 :
119072 : // Iterate over the memory pools
119073 0 : bool done = false;
119074 0 : unsigned i=0;
119075 :
119076 : // find the first valid IR node, call visit function, and then leave
119077 0 : while ( done == false && i < SgXorAssignOp::pools.size() )
119078 : {
119079 : // objectArray[i] is a single memory pool
119080 : unsigned j=0;
119081 0 : while (done == false && j < SgXorAssignOp::pool_size)
119082 : {
119083 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
119084 : {
119085 0 : traversal.visit(&(objectArray[i][j]));
119086 0 : done = true;
119087 : }
119088 0 : j++;
119089 : }
119090 0 : i++;
119091 : }
119092 :
119093 : #if 0
119094 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
119095 : if (done == false)
119096 : {
119097 : printf ("No representative for SgXorAssignOp found in memory pools \n");
119098 : }
119099 : #endif
119100 : }
119101 0 : }
119102 :
119103 :
119104 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
119105 : // using values that overflow signed values of int.
119106 : size_t
119107 4 : SgXorAssignOp::numberOfNodes()
119108 : {
119109 : // This function traverses the memory pool for an IR node and
119110 : // counts the number of IR nodes of a particular Sage III IR
119111 : // nodes type.
119112 :
119113 4 : size_t count = 0;
119114 4 : if (SgXorAssignOp::pools.empty() == false)
119115 : {
119116 : // Generate an array of memory pools (this is actually a STL vector,
119117 : // but it is contiguious, so OK to treat this way).
119118 0 : SgXorAssignOp** objectArray = (SgXorAssignOp**) &(SgXorAssignOp::pools[0]);
119119 :
119120 : // Build a local variable for better performance (make it a loop invariant variable).
119121 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
119122 :
119123 : // Iterate over all of the memory pools for this IR node.
119124 0 : for (unsigned int i=0; i < SgXorAssignOp::pools.size(); i++)
119125 : {
119126 : // objectArray[i] is a single memory pool, iterate over all the
119127 : // IR nodes and only count those that are valid IR nodes used in
119128 : // the AST (i.e. allocated IR nodes).
119129 0 : for (unsigned j=0; j < SgXorAssignOp::pool_size; j++)
119130 : {
119131 : // This is indexing the STL vector of C/C++ style arrays as a doubly
119132 : // indexed array access. It is OK since we have leveraged the semantics
119133 : // of STL vector memory as contigous and cast the memory as an array
119134 : // of arrays to use the 2D array indexing. Hope this is not confusing,
119135 : // but it s very fast as an implementation.
119136 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
119137 : {
119138 0 : count++;
119139 : }
119140 : }
119141 : }
119142 : }
119143 :
119144 :
119145 :
119146 4 : return count;
119147 : }
119148 :
119149 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
119150 : // using values that overflow signed values of int.
119151 : size_t
119152 0 : SgXorAssignOp::memoryUsage()
119153 : {
119154 : // This function is required because we need the class name as a type when we call sizeof
119155 : // There might be another way to implement this if we have a traversal that only called a
119156 : // representative object (one call for each type of Sage IIIIR node).
119157 0 : size_t memory = numberOfNodes() * sizeof(SgXorAssignOp);
119158 :
119159 0 : return memory;
119160 : }
119161 :
119162 : /* #line 119163 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
119163 :
119164 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
119165 : void
119166 5342 : SgLshiftAssignOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
119167 : {
119168 : // This function traverses the memory pool for only a specific IR node
119169 : // and calls the visit function of the input class execute a traversal
119170 : // similar to the style of the attribute based traversals within ROSE.
119171 : // This traversal will visit ALL nodes of the AST where as the other
119172 : // attribute based traversals visit only the embedded tree within the AST.
119173 :
119174 : // Initialize array to the address of the first element of the STL vector
119175 : // (which is guaranteed to be contiguous storage).
119176 : // SgLshiftAssignOp objectArray [] = *(Memory_Block_List.begin());
119177 5342 : if (SgLshiftAssignOp::pools.empty() == false)
119178 : {
119179 : // Generate an array of memory pools
119180 0 : SgLshiftAssignOp** objectArray = (SgLshiftAssignOp**) &(SgLshiftAssignOp::pools[0]);
119181 :
119182 : // Build a local variable for better performance
119183 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
119184 : #if 0
119185 : // Iterate over the memory pools
119186 : for (unsigned int i=0; i < SgLshiftAssignOp::pools.size(); i++)
119187 : {
119188 : // objectArray[i] is a single memory pool
119189 : for (int j=0; j < SgLshiftAssignOp::pool_size; j++)
119190 : {
119191 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
119192 : {
119193 : traversal.visit(&(objectArray[i][j]));
119194 : }
119195 : }
119196 : }
119197 : #else
119198 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
119199 : // compute the list first and then call the visit function on each list element.
119200 :
119201 : // printf ("Inside of SgLshiftAssignOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
119202 :
119203 0 : std::vector<SgLshiftAssignOp*> nodeList;
119204 :
119205 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
119206 0 : for (unsigned int i=0; i < SgLshiftAssignOp::pools.size(); i++)
119207 : {
119208 : // objectArray[i] is a single memory pool
119209 0 : for (unsigned j=0; j < SgLshiftAssignOp::pool_size; j++)
119210 : {
119211 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
119212 : {
119213 0 : nodeList.push_back(&(objectArray[i][j]));
119214 : }
119215 : }
119216 : }
119217 :
119218 : // Iterate over the saved list
119219 0 : size_t nodeListSize = nodeList.size();
119220 0 : for (size_t i=0; i < nodeListSize; i++)
119221 : {
119222 0 : ROSE_ASSERT(nodeList[i] != NULL);
119223 : #if 0
119224 : traversal.visit(nodeList[i]);
119225 : #else
119226 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
119227 : {
119228 0 : traversal.visit(nodeList[i]);
119229 : }
119230 : #endif
119231 : }
119232 : #endif
119233 : }
119234 :
119235 : // This should not be required since all previously static data members are
119236 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
119237 :
119238 5342 : }
119239 :
119240 :
119241 : void
119242 194 : SgLshiftAssignOp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
119243 : {
119244 : // This function traverses the memory pool for an IR node and
119245 : // calls the function to execute the visitor object.
119246 :
119247 : // Initialize array to the address of the first element of the STL vector
119248 : // (which is guarenteed to be contiguous storage).
119249 : // SgLshiftAssignOp objectArray [] = *(Memory_Block_List.begin());
119250 194 : if (SgLshiftAssignOp::pools.empty() == false)
119251 : {
119252 : // Generate an array of memory pools
119253 0 : SgLshiftAssignOp** objectArray = (SgLshiftAssignOp**) &(SgLshiftAssignOp::pools[0]);
119254 :
119255 : // Build a local variable for better performance
119256 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
119257 :
119258 : // Iterate over the memory pools
119259 0 : for (unsigned int i=0; i < SgLshiftAssignOp::pools.size(); i++)
119260 : {
119261 : // objectArray[i] is a single memory pool
119262 0 : for (unsigned j=0; j < SgLshiftAssignOp::pool_size; j++)
119263 : {
119264 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
119265 : {
119266 : // printf ("Found a valid SgLshiftAssignOp object in the memory pool %d at position %d \n",i,j);
119267 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
119268 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
119269 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
119270 : }
119271 : else
119272 : {
119273 : // printf ("Found a INVALID SgLshiftAssignOp object in the memory pool \n");
119274 : }
119275 : }
119276 : }
119277 : }
119278 :
119279 : // This should not be required since all previously static data members are
119280 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
119281 :
119282 194 : }
119283 :
119284 : void
119285 0 : SgLshiftAssignOp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
119286 : {
119287 : // This function visits only a single IR node of the memory pool.
119288 : // it is typically called once for each type of IR node within
119289 : // the automatically generated function: traverseRepresentativeNodes().
119290 :
119291 : // Initialize array to the address of the first element of the STL vector
119292 : // (which is guarenteed to be contiguous storage).
119293 : // SgLshiftAssignOp objectArray [] = *(Memory_Block_List.begin());
119294 0 : if (SgLshiftAssignOp::pools.empty() == false)
119295 : {
119296 : // Generate an array of memory pools
119297 0 : SgLshiftAssignOp** objectArray = (SgLshiftAssignOp**) &(SgLshiftAssignOp::pools[0]);
119298 :
119299 : // Build a local variable for better performance
119300 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
119301 :
119302 : // Iterate over the memory pools
119303 0 : bool done = false;
119304 0 : unsigned i=0;
119305 :
119306 : // find the first valid IR node, call visit function, and then leave
119307 0 : while ( done == false && i < SgLshiftAssignOp::pools.size() )
119308 : {
119309 : // objectArray[i] is a single memory pool
119310 : unsigned j=0;
119311 0 : while (done == false && j < SgLshiftAssignOp::pool_size)
119312 : {
119313 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
119314 : {
119315 0 : traversal.visit(&(objectArray[i][j]));
119316 0 : done = true;
119317 : }
119318 0 : j++;
119319 : }
119320 0 : i++;
119321 : }
119322 :
119323 : #if 0
119324 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
119325 : if (done == false)
119326 : {
119327 : printf ("No representative for SgLshiftAssignOp found in memory pools \n");
119328 : }
119329 : #endif
119330 : }
119331 0 : }
119332 :
119333 :
119334 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
119335 : // using values that overflow signed values of int.
119336 : size_t
119337 4 : SgLshiftAssignOp::numberOfNodes()
119338 : {
119339 : // This function traverses the memory pool for an IR node and
119340 : // counts the number of IR nodes of a particular Sage III IR
119341 : // nodes type.
119342 :
119343 4 : size_t count = 0;
119344 4 : if (SgLshiftAssignOp::pools.empty() == false)
119345 : {
119346 : // Generate an array of memory pools (this is actually a STL vector,
119347 : // but it is contiguious, so OK to treat this way).
119348 0 : SgLshiftAssignOp** objectArray = (SgLshiftAssignOp**) &(SgLshiftAssignOp::pools[0]);
119349 :
119350 : // Build a local variable for better performance (make it a loop invariant variable).
119351 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
119352 :
119353 : // Iterate over all of the memory pools for this IR node.
119354 0 : for (unsigned int i=0; i < SgLshiftAssignOp::pools.size(); i++)
119355 : {
119356 : // objectArray[i] is a single memory pool, iterate over all the
119357 : // IR nodes and only count those that are valid IR nodes used in
119358 : // the AST (i.e. allocated IR nodes).
119359 0 : for (unsigned j=0; j < SgLshiftAssignOp::pool_size; j++)
119360 : {
119361 : // This is indexing the STL vector of C/C++ style arrays as a doubly
119362 : // indexed array access. It is OK since we have leveraged the semantics
119363 : // of STL vector memory as contigous and cast the memory as an array
119364 : // of arrays to use the 2D array indexing. Hope this is not confusing,
119365 : // but it s very fast as an implementation.
119366 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
119367 : {
119368 0 : count++;
119369 : }
119370 : }
119371 : }
119372 : }
119373 :
119374 :
119375 :
119376 4 : return count;
119377 : }
119378 :
119379 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
119380 : // using values that overflow signed values of int.
119381 : size_t
119382 0 : SgLshiftAssignOp::memoryUsage()
119383 : {
119384 : // This function is required because we need the class name as a type when we call sizeof
119385 : // There might be another way to implement this if we have a traversal that only called a
119386 : // representative object (one call for each type of Sage IIIIR node).
119387 0 : size_t memory = numberOfNodes() * sizeof(SgLshiftAssignOp);
119388 :
119389 0 : return memory;
119390 : }
119391 :
119392 : /* #line 119393 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
119393 :
119394 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
119395 : void
119396 5342 : SgRshiftAssignOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
119397 : {
119398 : // This function traverses the memory pool for only a specific IR node
119399 : // and calls the visit function of the input class execute a traversal
119400 : // similar to the style of the attribute based traversals within ROSE.
119401 : // This traversal will visit ALL nodes of the AST where as the other
119402 : // attribute based traversals visit only the embedded tree within the AST.
119403 :
119404 : // Initialize array to the address of the first element of the STL vector
119405 : // (which is guaranteed to be contiguous storage).
119406 : // SgRshiftAssignOp objectArray [] = *(Memory_Block_List.begin());
119407 5342 : if (SgRshiftAssignOp::pools.empty() == false)
119408 : {
119409 : // Generate an array of memory pools
119410 115 : SgRshiftAssignOp** objectArray = (SgRshiftAssignOp**) &(SgRshiftAssignOp::pools[0]);
119411 :
119412 : // Build a local variable for better performance
119413 115 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
119414 : #if 0
119415 : // Iterate over the memory pools
119416 : for (unsigned int i=0; i < SgRshiftAssignOp::pools.size(); i++)
119417 : {
119418 : // objectArray[i] is a single memory pool
119419 : for (int j=0; j < SgRshiftAssignOp::pool_size; j++)
119420 : {
119421 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
119422 : {
119423 : traversal.visit(&(objectArray[i][j]));
119424 : }
119425 : }
119426 : }
119427 : #else
119428 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
119429 : // compute the list first and then call the visit function on each list element.
119430 :
119431 : // printf ("Inside of SgRshiftAssignOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
119432 :
119433 230 : std::vector<SgRshiftAssignOp*> nodeList;
119434 :
119435 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
119436 230 : for (unsigned int i=0; i < SgRshiftAssignOp::pools.size(); i++)
119437 : {
119438 : // objectArray[i] is a single memory pool
119439 230115 : for (unsigned j=0; j < SgRshiftAssignOp::pool_size; j++)
119440 : {
119441 230000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
119442 : {
119443 230 : nodeList.push_back(&(objectArray[i][j]));
119444 : }
119445 : }
119446 : }
119447 :
119448 : // Iterate over the saved list
119449 115 : size_t nodeListSize = nodeList.size();
119450 345 : for (size_t i=0; i < nodeListSize; i++)
119451 : {
119452 230 : ROSE_ASSERT(nodeList[i] != NULL);
119453 : #if 0
119454 : traversal.visit(nodeList[i]);
119455 : #else
119456 230 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
119457 : {
119458 230 : traversal.visit(nodeList[i]);
119459 : }
119460 : #endif
119461 : }
119462 : #endif
119463 : }
119464 :
119465 : // This should not be required since all previously static data members are
119466 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
119467 :
119468 5342 : }
119469 :
119470 :
119471 : void
119472 194 : SgRshiftAssignOp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
119473 : {
119474 : // This function traverses the memory pool for an IR node and
119475 : // calls the function to execute the visitor object.
119476 :
119477 : // Initialize array to the address of the first element of the STL vector
119478 : // (which is guarenteed to be contiguous storage).
119479 : // SgRshiftAssignOp objectArray [] = *(Memory_Block_List.begin());
119480 194 : if (SgRshiftAssignOp::pools.empty() == false)
119481 : {
119482 : // Generate an array of memory pools
119483 137 : SgRshiftAssignOp** objectArray = (SgRshiftAssignOp**) &(SgRshiftAssignOp::pools[0]);
119484 :
119485 : // Build a local variable for better performance
119486 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
119487 :
119488 : // Iterate over the memory pools
119489 274 : for (unsigned int i=0; i < SgRshiftAssignOp::pools.size(); i++)
119490 : {
119491 : // objectArray[i] is a single memory pool
119492 274137 : for (unsigned j=0; j < SgRshiftAssignOp::pool_size; j++)
119493 : {
119494 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
119495 : {
119496 : // printf ("Found a valid SgRshiftAssignOp object in the memory pool %d at position %d \n",i,j);
119497 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
119498 274 : objectArray[i][j].executeVisitorMemberFunction(visitor);
119499 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
119500 : }
119501 : else
119502 : {
119503 : // printf ("Found a INVALID SgRshiftAssignOp object in the memory pool \n");
119504 : }
119505 : }
119506 : }
119507 : }
119508 :
119509 : // This should not be required since all previously static data members are
119510 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
119511 :
119512 194 : }
119513 :
119514 : void
119515 0 : SgRshiftAssignOp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
119516 : {
119517 : // This function visits only a single IR node of the memory pool.
119518 : // it is typically called once for each type of IR node within
119519 : // the automatically generated function: traverseRepresentativeNodes().
119520 :
119521 : // Initialize array to the address of the first element of the STL vector
119522 : // (which is guarenteed to be contiguous storage).
119523 : // SgRshiftAssignOp objectArray [] = *(Memory_Block_List.begin());
119524 0 : if (SgRshiftAssignOp::pools.empty() == false)
119525 : {
119526 : // Generate an array of memory pools
119527 0 : SgRshiftAssignOp** objectArray = (SgRshiftAssignOp**) &(SgRshiftAssignOp::pools[0]);
119528 :
119529 : // Build a local variable for better performance
119530 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
119531 :
119532 : // Iterate over the memory pools
119533 0 : bool done = false;
119534 0 : unsigned i=0;
119535 :
119536 : // find the first valid IR node, call visit function, and then leave
119537 0 : while ( done == false && i < SgRshiftAssignOp::pools.size() )
119538 : {
119539 : // objectArray[i] is a single memory pool
119540 : unsigned j=0;
119541 0 : while (done == false && j < SgRshiftAssignOp::pool_size)
119542 : {
119543 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
119544 : {
119545 0 : traversal.visit(&(objectArray[i][j]));
119546 0 : done = true;
119547 : }
119548 0 : j++;
119549 : }
119550 0 : i++;
119551 : }
119552 :
119553 : #if 0
119554 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
119555 : if (done == false)
119556 : {
119557 : printf ("No representative for SgRshiftAssignOp found in memory pools \n");
119558 : }
119559 : #endif
119560 : }
119561 0 : }
119562 :
119563 :
119564 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
119565 : // using values that overflow signed values of int.
119566 : size_t
119567 4 : SgRshiftAssignOp::numberOfNodes()
119568 : {
119569 : // This function traverses the memory pool for an IR node and
119570 : // counts the number of IR nodes of a particular Sage III IR
119571 : // nodes type.
119572 :
119573 4 : size_t count = 0;
119574 4 : if (SgRshiftAssignOp::pools.empty() == false)
119575 : {
119576 : // Generate an array of memory pools (this is actually a STL vector,
119577 : // but it is contiguious, so OK to treat this way).
119578 1 : SgRshiftAssignOp** objectArray = (SgRshiftAssignOp**) &(SgRshiftAssignOp::pools[0]);
119579 :
119580 : // Build a local variable for better performance (make it a loop invariant variable).
119581 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
119582 :
119583 : // Iterate over all of the memory pools for this IR node.
119584 2 : for (unsigned int i=0; i < SgRshiftAssignOp::pools.size(); i++)
119585 : {
119586 : // objectArray[i] is a single memory pool, iterate over all the
119587 : // IR nodes and only count those that are valid IR nodes used in
119588 : // the AST (i.e. allocated IR nodes).
119589 2001 : for (unsigned j=0; j < SgRshiftAssignOp::pool_size; j++)
119590 : {
119591 : // This is indexing the STL vector of C/C++ style arrays as a doubly
119592 : // indexed array access. It is OK since we have leveraged the semantics
119593 : // of STL vector memory as contigous and cast the memory as an array
119594 : // of arrays to use the 2D array indexing. Hope this is not confusing,
119595 : // but it s very fast as an implementation.
119596 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
119597 : {
119598 2 : count++;
119599 : }
119600 : }
119601 : }
119602 : }
119603 :
119604 :
119605 :
119606 4 : return count;
119607 : }
119608 :
119609 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
119610 : // using values that overflow signed values of int.
119611 : size_t
119612 0 : SgRshiftAssignOp::memoryUsage()
119613 : {
119614 : // This function is required because we need the class name as a type when we call sizeof
119615 : // There might be another way to implement this if we have a traversal that only called a
119616 : // representative object (one call for each type of Sage IIIIR node).
119617 0 : size_t memory = numberOfNodes() * sizeof(SgRshiftAssignOp);
119618 :
119619 0 : return memory;
119620 : }
119621 :
119622 : /* #line 119623 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
119623 :
119624 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
119625 : void
119626 5342 : SgIntegerDivideAssignOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
119627 : {
119628 : // This function traverses the memory pool for only a specific IR node
119629 : // and calls the visit function of the input class execute a traversal
119630 : // similar to the style of the attribute based traversals within ROSE.
119631 : // This traversal will visit ALL nodes of the AST where as the other
119632 : // attribute based traversals visit only the embedded tree within the AST.
119633 :
119634 : // Initialize array to the address of the first element of the STL vector
119635 : // (which is guaranteed to be contiguous storage).
119636 : // SgIntegerDivideAssignOp objectArray [] = *(Memory_Block_List.begin());
119637 5342 : if (SgIntegerDivideAssignOp::pools.empty() == false)
119638 : {
119639 : // Generate an array of memory pools
119640 0 : SgIntegerDivideAssignOp** objectArray = (SgIntegerDivideAssignOp**) &(SgIntegerDivideAssignOp::pools[0]);
119641 :
119642 : // Build a local variable for better performance
119643 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
119644 : #if 0
119645 : // Iterate over the memory pools
119646 : for (unsigned int i=0; i < SgIntegerDivideAssignOp::pools.size(); i++)
119647 : {
119648 : // objectArray[i] is a single memory pool
119649 : for (int j=0; j < SgIntegerDivideAssignOp::pool_size; j++)
119650 : {
119651 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
119652 : {
119653 : traversal.visit(&(objectArray[i][j]));
119654 : }
119655 : }
119656 : }
119657 : #else
119658 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
119659 : // compute the list first and then call the visit function on each list element.
119660 :
119661 : // printf ("Inside of SgIntegerDivideAssignOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
119662 :
119663 0 : std::vector<SgIntegerDivideAssignOp*> nodeList;
119664 :
119665 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
119666 0 : for (unsigned int i=0; i < SgIntegerDivideAssignOp::pools.size(); i++)
119667 : {
119668 : // objectArray[i] is a single memory pool
119669 0 : for (unsigned j=0; j < SgIntegerDivideAssignOp::pool_size; j++)
119670 : {
119671 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
119672 : {
119673 0 : nodeList.push_back(&(objectArray[i][j]));
119674 : }
119675 : }
119676 : }
119677 :
119678 : // Iterate over the saved list
119679 0 : size_t nodeListSize = nodeList.size();
119680 0 : for (size_t i=0; i < nodeListSize; i++)
119681 : {
119682 0 : ROSE_ASSERT(nodeList[i] != NULL);
119683 : #if 0
119684 : traversal.visit(nodeList[i]);
119685 : #else
119686 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
119687 : {
119688 0 : traversal.visit(nodeList[i]);
119689 : }
119690 : #endif
119691 : }
119692 : #endif
119693 : }
119694 :
119695 : // This should not be required since all previously static data members are
119696 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
119697 :
119698 5342 : }
119699 :
119700 :
119701 : void
119702 194 : SgIntegerDivideAssignOp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
119703 : {
119704 : // This function traverses the memory pool for an IR node and
119705 : // calls the function to execute the visitor object.
119706 :
119707 : // Initialize array to the address of the first element of the STL vector
119708 : // (which is guarenteed to be contiguous storage).
119709 : // SgIntegerDivideAssignOp objectArray [] = *(Memory_Block_List.begin());
119710 194 : if (SgIntegerDivideAssignOp::pools.empty() == false)
119711 : {
119712 : // Generate an array of memory pools
119713 0 : SgIntegerDivideAssignOp** objectArray = (SgIntegerDivideAssignOp**) &(SgIntegerDivideAssignOp::pools[0]);
119714 :
119715 : // Build a local variable for better performance
119716 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
119717 :
119718 : // Iterate over the memory pools
119719 0 : for (unsigned int i=0; i < SgIntegerDivideAssignOp::pools.size(); i++)
119720 : {
119721 : // objectArray[i] is a single memory pool
119722 0 : for (unsigned j=0; j < SgIntegerDivideAssignOp::pool_size; j++)
119723 : {
119724 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
119725 : {
119726 : // printf ("Found a valid SgIntegerDivideAssignOp object in the memory pool %d at position %d \n",i,j);
119727 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
119728 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
119729 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
119730 : }
119731 : else
119732 : {
119733 : // printf ("Found a INVALID SgIntegerDivideAssignOp object in the memory pool \n");
119734 : }
119735 : }
119736 : }
119737 : }
119738 :
119739 : // This should not be required since all previously static data members are
119740 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
119741 :
119742 194 : }
119743 :
119744 : void
119745 0 : SgIntegerDivideAssignOp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
119746 : {
119747 : // This function visits only a single IR node of the memory pool.
119748 : // it is typically called once for each type of IR node within
119749 : // the automatically generated function: traverseRepresentativeNodes().
119750 :
119751 : // Initialize array to the address of the first element of the STL vector
119752 : // (which is guarenteed to be contiguous storage).
119753 : // SgIntegerDivideAssignOp objectArray [] = *(Memory_Block_List.begin());
119754 0 : if (SgIntegerDivideAssignOp::pools.empty() == false)
119755 : {
119756 : // Generate an array of memory pools
119757 0 : SgIntegerDivideAssignOp** objectArray = (SgIntegerDivideAssignOp**) &(SgIntegerDivideAssignOp::pools[0]);
119758 :
119759 : // Build a local variable for better performance
119760 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
119761 :
119762 : // Iterate over the memory pools
119763 0 : bool done = false;
119764 0 : unsigned i=0;
119765 :
119766 : // find the first valid IR node, call visit function, and then leave
119767 0 : while ( done == false && i < SgIntegerDivideAssignOp::pools.size() )
119768 : {
119769 : // objectArray[i] is a single memory pool
119770 : unsigned j=0;
119771 0 : while (done == false && j < SgIntegerDivideAssignOp::pool_size)
119772 : {
119773 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
119774 : {
119775 0 : traversal.visit(&(objectArray[i][j]));
119776 0 : done = true;
119777 : }
119778 0 : j++;
119779 : }
119780 0 : i++;
119781 : }
119782 :
119783 : #if 0
119784 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
119785 : if (done == false)
119786 : {
119787 : printf ("No representative for SgIntegerDivideAssignOp found in memory pools \n");
119788 : }
119789 : #endif
119790 : }
119791 0 : }
119792 :
119793 :
119794 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
119795 : // using values that overflow signed values of int.
119796 : size_t
119797 4 : SgIntegerDivideAssignOp::numberOfNodes()
119798 : {
119799 : // This function traverses the memory pool for an IR node and
119800 : // counts the number of IR nodes of a particular Sage III IR
119801 : // nodes type.
119802 :
119803 4 : size_t count = 0;
119804 4 : if (SgIntegerDivideAssignOp::pools.empty() == false)
119805 : {
119806 : // Generate an array of memory pools (this is actually a STL vector,
119807 : // but it is contiguious, so OK to treat this way).
119808 0 : SgIntegerDivideAssignOp** objectArray = (SgIntegerDivideAssignOp**) &(SgIntegerDivideAssignOp::pools[0]);
119809 :
119810 : // Build a local variable for better performance (make it a loop invariant variable).
119811 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
119812 :
119813 : // Iterate over all of the memory pools for this IR node.
119814 0 : for (unsigned int i=0; i < SgIntegerDivideAssignOp::pools.size(); i++)
119815 : {
119816 : // objectArray[i] is a single memory pool, iterate over all the
119817 : // IR nodes and only count those that are valid IR nodes used in
119818 : // the AST (i.e. allocated IR nodes).
119819 0 : for (unsigned j=0; j < SgIntegerDivideAssignOp::pool_size; j++)
119820 : {
119821 : // This is indexing the STL vector of C/C++ style arrays as a doubly
119822 : // indexed array access. It is OK since we have leveraged the semantics
119823 : // of STL vector memory as contigous and cast the memory as an array
119824 : // of arrays to use the 2D array indexing. Hope this is not confusing,
119825 : // but it s very fast as an implementation.
119826 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
119827 : {
119828 0 : count++;
119829 : }
119830 : }
119831 : }
119832 : }
119833 :
119834 :
119835 :
119836 4 : return count;
119837 : }
119838 :
119839 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
119840 : // using values that overflow signed values of int.
119841 : size_t
119842 0 : SgIntegerDivideAssignOp::memoryUsage()
119843 : {
119844 : // This function is required because we need the class name as a type when we call sizeof
119845 : // There might be another way to implement this if we have a traversal that only called a
119846 : // representative object (one call for each type of Sage IIIIR node).
119847 0 : size_t memory = numberOfNodes() * sizeof(SgIntegerDivideAssignOp);
119848 :
119849 0 : return memory;
119850 : }
119851 :
119852 : /* #line 119853 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
119853 :
119854 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
119855 : void
119856 5342 : SgExponentiationAssignOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
119857 : {
119858 : // This function traverses the memory pool for only a specific IR node
119859 : // and calls the visit function of the input class execute a traversal
119860 : // similar to the style of the attribute based traversals within ROSE.
119861 : // This traversal will visit ALL nodes of the AST where as the other
119862 : // attribute based traversals visit only the embedded tree within the AST.
119863 :
119864 : // Initialize array to the address of the first element of the STL vector
119865 : // (which is guaranteed to be contiguous storage).
119866 : // SgExponentiationAssignOp objectArray [] = *(Memory_Block_List.begin());
119867 5342 : if (SgExponentiationAssignOp::pools.empty() == false)
119868 : {
119869 : // Generate an array of memory pools
119870 0 : SgExponentiationAssignOp** objectArray = (SgExponentiationAssignOp**) &(SgExponentiationAssignOp::pools[0]);
119871 :
119872 : // Build a local variable for better performance
119873 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
119874 : #if 0
119875 : // Iterate over the memory pools
119876 : for (unsigned int i=0; i < SgExponentiationAssignOp::pools.size(); i++)
119877 : {
119878 : // objectArray[i] is a single memory pool
119879 : for (int j=0; j < SgExponentiationAssignOp::pool_size; j++)
119880 : {
119881 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
119882 : {
119883 : traversal.visit(&(objectArray[i][j]));
119884 : }
119885 : }
119886 : }
119887 : #else
119888 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
119889 : // compute the list first and then call the visit function on each list element.
119890 :
119891 : // printf ("Inside of SgExponentiationAssignOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
119892 :
119893 0 : std::vector<SgExponentiationAssignOp*> nodeList;
119894 :
119895 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
119896 0 : for (unsigned int i=0; i < SgExponentiationAssignOp::pools.size(); i++)
119897 : {
119898 : // objectArray[i] is a single memory pool
119899 0 : for (unsigned j=0; j < SgExponentiationAssignOp::pool_size; j++)
119900 : {
119901 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
119902 : {
119903 0 : nodeList.push_back(&(objectArray[i][j]));
119904 : }
119905 : }
119906 : }
119907 :
119908 : // Iterate over the saved list
119909 0 : size_t nodeListSize = nodeList.size();
119910 0 : for (size_t i=0; i < nodeListSize; i++)
119911 : {
119912 0 : ROSE_ASSERT(nodeList[i] != NULL);
119913 : #if 0
119914 : traversal.visit(nodeList[i]);
119915 : #else
119916 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
119917 : {
119918 0 : traversal.visit(nodeList[i]);
119919 : }
119920 : #endif
119921 : }
119922 : #endif
119923 : }
119924 :
119925 : // This should not be required since all previously static data members are
119926 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
119927 :
119928 5342 : }
119929 :
119930 :
119931 : void
119932 194 : SgExponentiationAssignOp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
119933 : {
119934 : // This function traverses the memory pool for an IR node and
119935 : // calls the function to execute the visitor object.
119936 :
119937 : // Initialize array to the address of the first element of the STL vector
119938 : // (which is guarenteed to be contiguous storage).
119939 : // SgExponentiationAssignOp objectArray [] = *(Memory_Block_List.begin());
119940 194 : if (SgExponentiationAssignOp::pools.empty() == false)
119941 : {
119942 : // Generate an array of memory pools
119943 0 : SgExponentiationAssignOp** objectArray = (SgExponentiationAssignOp**) &(SgExponentiationAssignOp::pools[0]);
119944 :
119945 : // Build a local variable for better performance
119946 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
119947 :
119948 : // Iterate over the memory pools
119949 0 : for (unsigned int i=0; i < SgExponentiationAssignOp::pools.size(); i++)
119950 : {
119951 : // objectArray[i] is a single memory pool
119952 0 : for (unsigned j=0; j < SgExponentiationAssignOp::pool_size; j++)
119953 : {
119954 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
119955 : {
119956 : // printf ("Found a valid SgExponentiationAssignOp object in the memory pool %d at position %d \n",i,j);
119957 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
119958 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
119959 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
119960 : }
119961 : else
119962 : {
119963 : // printf ("Found a INVALID SgExponentiationAssignOp object in the memory pool \n");
119964 : }
119965 : }
119966 : }
119967 : }
119968 :
119969 : // This should not be required since all previously static data members are
119970 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
119971 :
119972 194 : }
119973 :
119974 : void
119975 0 : SgExponentiationAssignOp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
119976 : {
119977 : // This function visits only a single IR node of the memory pool.
119978 : // it is typically called once for each type of IR node within
119979 : // the automatically generated function: traverseRepresentativeNodes().
119980 :
119981 : // Initialize array to the address of the first element of the STL vector
119982 : // (which is guarenteed to be contiguous storage).
119983 : // SgExponentiationAssignOp objectArray [] = *(Memory_Block_List.begin());
119984 0 : if (SgExponentiationAssignOp::pools.empty() == false)
119985 : {
119986 : // Generate an array of memory pools
119987 0 : SgExponentiationAssignOp** objectArray = (SgExponentiationAssignOp**) &(SgExponentiationAssignOp::pools[0]);
119988 :
119989 : // Build a local variable for better performance
119990 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
119991 :
119992 : // Iterate over the memory pools
119993 0 : bool done = false;
119994 0 : unsigned i=0;
119995 :
119996 : // find the first valid IR node, call visit function, and then leave
119997 0 : while ( done == false && i < SgExponentiationAssignOp::pools.size() )
119998 : {
119999 : // objectArray[i] is a single memory pool
120000 : unsigned j=0;
120001 0 : while (done == false && j < SgExponentiationAssignOp::pool_size)
120002 : {
120003 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
120004 : {
120005 0 : traversal.visit(&(objectArray[i][j]));
120006 0 : done = true;
120007 : }
120008 0 : j++;
120009 : }
120010 0 : i++;
120011 : }
120012 :
120013 : #if 0
120014 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
120015 : if (done == false)
120016 : {
120017 : printf ("No representative for SgExponentiationAssignOp found in memory pools \n");
120018 : }
120019 : #endif
120020 : }
120021 0 : }
120022 :
120023 :
120024 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
120025 : // using values that overflow signed values of int.
120026 : size_t
120027 4 : SgExponentiationAssignOp::numberOfNodes()
120028 : {
120029 : // This function traverses the memory pool for an IR node and
120030 : // counts the number of IR nodes of a particular Sage III IR
120031 : // nodes type.
120032 :
120033 4 : size_t count = 0;
120034 4 : if (SgExponentiationAssignOp::pools.empty() == false)
120035 : {
120036 : // Generate an array of memory pools (this is actually a STL vector,
120037 : // but it is contiguious, so OK to treat this way).
120038 0 : SgExponentiationAssignOp** objectArray = (SgExponentiationAssignOp**) &(SgExponentiationAssignOp::pools[0]);
120039 :
120040 : // Build a local variable for better performance (make it a loop invariant variable).
120041 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
120042 :
120043 : // Iterate over all of the memory pools for this IR node.
120044 0 : for (unsigned int i=0; i < SgExponentiationAssignOp::pools.size(); i++)
120045 : {
120046 : // objectArray[i] is a single memory pool, iterate over all the
120047 : // IR nodes and only count those that are valid IR nodes used in
120048 : // the AST (i.e. allocated IR nodes).
120049 0 : for (unsigned j=0; j < SgExponentiationAssignOp::pool_size; j++)
120050 : {
120051 : // This is indexing the STL vector of C/C++ style arrays as a doubly
120052 : // indexed array access. It is OK since we have leveraged the semantics
120053 : // of STL vector memory as contigous and cast the memory as an array
120054 : // of arrays to use the 2D array indexing. Hope this is not confusing,
120055 : // but it s very fast as an implementation.
120056 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
120057 : {
120058 0 : count++;
120059 : }
120060 : }
120061 : }
120062 : }
120063 :
120064 :
120065 :
120066 4 : return count;
120067 : }
120068 :
120069 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
120070 : // using values that overflow signed values of int.
120071 : size_t
120072 0 : SgExponentiationAssignOp::memoryUsage()
120073 : {
120074 : // This function is required because we need the class name as a type when we call sizeof
120075 : // There might be another way to implement this if we have a traversal that only called a
120076 : // representative object (one call for each type of Sage IIIIR node).
120077 0 : size_t memory = numberOfNodes() * sizeof(SgExponentiationAssignOp);
120078 :
120079 0 : return memory;
120080 : }
120081 :
120082 : /* #line 120083 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
120083 :
120084 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
120085 : void
120086 5342 : SgMembershipOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
120087 : {
120088 : // This function traverses the memory pool for only a specific IR node
120089 : // and calls the visit function of the input class execute a traversal
120090 : // similar to the style of the attribute based traversals within ROSE.
120091 : // This traversal will visit ALL nodes of the AST where as the other
120092 : // attribute based traversals visit only the embedded tree within the AST.
120093 :
120094 : // Initialize array to the address of the first element of the STL vector
120095 : // (which is guaranteed to be contiguous storage).
120096 : // SgMembershipOp objectArray [] = *(Memory_Block_List.begin());
120097 5342 : if (SgMembershipOp::pools.empty() == false)
120098 : {
120099 : // Generate an array of memory pools
120100 0 : SgMembershipOp** objectArray = (SgMembershipOp**) &(SgMembershipOp::pools[0]);
120101 :
120102 : // Build a local variable for better performance
120103 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
120104 : #if 0
120105 : // Iterate over the memory pools
120106 : for (unsigned int i=0; i < SgMembershipOp::pools.size(); i++)
120107 : {
120108 : // objectArray[i] is a single memory pool
120109 : for (int j=0; j < SgMembershipOp::pool_size; j++)
120110 : {
120111 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
120112 : {
120113 : traversal.visit(&(objectArray[i][j]));
120114 : }
120115 : }
120116 : }
120117 : #else
120118 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
120119 : // compute the list first and then call the visit function on each list element.
120120 :
120121 : // printf ("Inside of SgMembershipOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
120122 :
120123 0 : std::vector<SgMembershipOp*> nodeList;
120124 :
120125 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
120126 0 : for (unsigned int i=0; i < SgMembershipOp::pools.size(); i++)
120127 : {
120128 : // objectArray[i] is a single memory pool
120129 0 : for (unsigned j=0; j < SgMembershipOp::pool_size; j++)
120130 : {
120131 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
120132 : {
120133 0 : nodeList.push_back(&(objectArray[i][j]));
120134 : }
120135 : }
120136 : }
120137 :
120138 : // Iterate over the saved list
120139 0 : size_t nodeListSize = nodeList.size();
120140 0 : for (size_t i=0; i < nodeListSize; i++)
120141 : {
120142 0 : ROSE_ASSERT(nodeList[i] != NULL);
120143 : #if 0
120144 : traversal.visit(nodeList[i]);
120145 : #else
120146 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
120147 : {
120148 0 : traversal.visit(nodeList[i]);
120149 : }
120150 : #endif
120151 : }
120152 : #endif
120153 : }
120154 :
120155 : // This should not be required since all previously static data members are
120156 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
120157 :
120158 5342 : }
120159 :
120160 :
120161 : void
120162 194 : SgMembershipOp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
120163 : {
120164 : // This function traverses the memory pool for an IR node and
120165 : // calls the function to execute the visitor object.
120166 :
120167 : // Initialize array to the address of the first element of the STL vector
120168 : // (which is guarenteed to be contiguous storage).
120169 : // SgMembershipOp objectArray [] = *(Memory_Block_List.begin());
120170 194 : if (SgMembershipOp::pools.empty() == false)
120171 : {
120172 : // Generate an array of memory pools
120173 0 : SgMembershipOp** objectArray = (SgMembershipOp**) &(SgMembershipOp::pools[0]);
120174 :
120175 : // Build a local variable for better performance
120176 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
120177 :
120178 : // Iterate over the memory pools
120179 0 : for (unsigned int i=0; i < SgMembershipOp::pools.size(); i++)
120180 : {
120181 : // objectArray[i] is a single memory pool
120182 0 : for (unsigned j=0; j < SgMembershipOp::pool_size; j++)
120183 : {
120184 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
120185 : {
120186 : // printf ("Found a valid SgMembershipOp object in the memory pool %d at position %d \n",i,j);
120187 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
120188 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
120189 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
120190 : }
120191 : else
120192 : {
120193 : // printf ("Found a INVALID SgMembershipOp object in the memory pool \n");
120194 : }
120195 : }
120196 : }
120197 : }
120198 :
120199 : // This should not be required since all previously static data members are
120200 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
120201 :
120202 194 : }
120203 :
120204 : void
120205 0 : SgMembershipOp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
120206 : {
120207 : // This function visits only a single IR node of the memory pool.
120208 : // it is typically called once for each type of IR node within
120209 : // the automatically generated function: traverseRepresentativeNodes().
120210 :
120211 : // Initialize array to the address of the first element of the STL vector
120212 : // (which is guarenteed to be contiguous storage).
120213 : // SgMembershipOp objectArray [] = *(Memory_Block_List.begin());
120214 0 : if (SgMembershipOp::pools.empty() == false)
120215 : {
120216 : // Generate an array of memory pools
120217 0 : SgMembershipOp** objectArray = (SgMembershipOp**) &(SgMembershipOp::pools[0]);
120218 :
120219 : // Build a local variable for better performance
120220 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
120221 :
120222 : // Iterate over the memory pools
120223 0 : bool done = false;
120224 0 : unsigned i=0;
120225 :
120226 : // find the first valid IR node, call visit function, and then leave
120227 0 : while ( done == false && i < SgMembershipOp::pools.size() )
120228 : {
120229 : // objectArray[i] is a single memory pool
120230 : unsigned j=0;
120231 0 : while (done == false && j < SgMembershipOp::pool_size)
120232 : {
120233 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
120234 : {
120235 0 : traversal.visit(&(objectArray[i][j]));
120236 0 : done = true;
120237 : }
120238 0 : j++;
120239 : }
120240 0 : i++;
120241 : }
120242 :
120243 : #if 0
120244 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
120245 : if (done == false)
120246 : {
120247 : printf ("No representative for SgMembershipOp found in memory pools \n");
120248 : }
120249 : #endif
120250 : }
120251 0 : }
120252 :
120253 :
120254 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
120255 : // using values that overflow signed values of int.
120256 : size_t
120257 4 : SgMembershipOp::numberOfNodes()
120258 : {
120259 : // This function traverses the memory pool for an IR node and
120260 : // counts the number of IR nodes of a particular Sage III IR
120261 : // nodes type.
120262 :
120263 4 : size_t count = 0;
120264 4 : if (SgMembershipOp::pools.empty() == false)
120265 : {
120266 : // Generate an array of memory pools (this is actually a STL vector,
120267 : // but it is contiguious, so OK to treat this way).
120268 0 : SgMembershipOp** objectArray = (SgMembershipOp**) &(SgMembershipOp::pools[0]);
120269 :
120270 : // Build a local variable for better performance (make it a loop invariant variable).
120271 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
120272 :
120273 : // Iterate over all of the memory pools for this IR node.
120274 0 : for (unsigned int i=0; i < SgMembershipOp::pools.size(); i++)
120275 : {
120276 : // objectArray[i] is a single memory pool, iterate over all the
120277 : // IR nodes and only count those that are valid IR nodes used in
120278 : // the AST (i.e. allocated IR nodes).
120279 0 : for (unsigned j=0; j < SgMembershipOp::pool_size; j++)
120280 : {
120281 : // This is indexing the STL vector of C/C++ style arrays as a doubly
120282 : // indexed array access. It is OK since we have leveraged the semantics
120283 : // of STL vector memory as contigous and cast the memory as an array
120284 : // of arrays to use the 2D array indexing. Hope this is not confusing,
120285 : // but it s very fast as an implementation.
120286 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
120287 : {
120288 0 : count++;
120289 : }
120290 : }
120291 : }
120292 : }
120293 :
120294 :
120295 :
120296 4 : return count;
120297 : }
120298 :
120299 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
120300 : // using values that overflow signed values of int.
120301 : size_t
120302 0 : SgMembershipOp::memoryUsage()
120303 : {
120304 : // This function is required because we need the class name as a type when we call sizeof
120305 : // There might be another way to implement this if we have a traversal that only called a
120306 : // representative object (one call for each type of Sage IIIIR node).
120307 0 : size_t memory = numberOfNodes() * sizeof(SgMembershipOp);
120308 :
120309 0 : return memory;
120310 : }
120311 :
120312 : /* #line 120313 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
120313 :
120314 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
120315 : void
120316 5342 : SgSpaceshipOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
120317 : {
120318 : // This function traverses the memory pool for only a specific IR node
120319 : // and calls the visit function of the input class execute a traversal
120320 : // similar to the style of the attribute based traversals within ROSE.
120321 : // This traversal will visit ALL nodes of the AST where as the other
120322 : // attribute based traversals visit only the embedded tree within the AST.
120323 :
120324 : // Initialize array to the address of the first element of the STL vector
120325 : // (which is guaranteed to be contiguous storage).
120326 : // SgSpaceshipOp objectArray [] = *(Memory_Block_List.begin());
120327 5342 : if (SgSpaceshipOp::pools.empty() == false)
120328 : {
120329 : // Generate an array of memory pools
120330 0 : SgSpaceshipOp** objectArray = (SgSpaceshipOp**) &(SgSpaceshipOp::pools[0]);
120331 :
120332 : // Build a local variable for better performance
120333 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
120334 : #if 0
120335 : // Iterate over the memory pools
120336 : for (unsigned int i=0; i < SgSpaceshipOp::pools.size(); i++)
120337 : {
120338 : // objectArray[i] is a single memory pool
120339 : for (int j=0; j < SgSpaceshipOp::pool_size; j++)
120340 : {
120341 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
120342 : {
120343 : traversal.visit(&(objectArray[i][j]));
120344 : }
120345 : }
120346 : }
120347 : #else
120348 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
120349 : // compute the list first and then call the visit function on each list element.
120350 :
120351 : // printf ("Inside of SgSpaceshipOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
120352 :
120353 0 : std::vector<SgSpaceshipOp*> nodeList;
120354 :
120355 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
120356 0 : for (unsigned int i=0; i < SgSpaceshipOp::pools.size(); i++)
120357 : {
120358 : // objectArray[i] is a single memory pool
120359 0 : for (unsigned j=0; j < SgSpaceshipOp::pool_size; j++)
120360 : {
120361 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
120362 : {
120363 0 : nodeList.push_back(&(objectArray[i][j]));
120364 : }
120365 : }
120366 : }
120367 :
120368 : // Iterate over the saved list
120369 0 : size_t nodeListSize = nodeList.size();
120370 0 : for (size_t i=0; i < nodeListSize; i++)
120371 : {
120372 0 : ROSE_ASSERT(nodeList[i] != NULL);
120373 : #if 0
120374 : traversal.visit(nodeList[i]);
120375 : #else
120376 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
120377 : {
120378 0 : traversal.visit(nodeList[i]);
120379 : }
120380 : #endif
120381 : }
120382 : #endif
120383 : }
120384 :
120385 : // This should not be required since all previously static data members are
120386 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
120387 :
120388 5342 : }
120389 :
120390 :
120391 : void
120392 194 : SgSpaceshipOp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
120393 : {
120394 : // This function traverses the memory pool for an IR node and
120395 : // calls the function to execute the visitor object.
120396 :
120397 : // Initialize array to the address of the first element of the STL vector
120398 : // (which is guarenteed to be contiguous storage).
120399 : // SgSpaceshipOp objectArray [] = *(Memory_Block_List.begin());
120400 194 : if (SgSpaceshipOp::pools.empty() == false)
120401 : {
120402 : // Generate an array of memory pools
120403 0 : SgSpaceshipOp** objectArray = (SgSpaceshipOp**) &(SgSpaceshipOp::pools[0]);
120404 :
120405 : // Build a local variable for better performance
120406 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
120407 :
120408 : // Iterate over the memory pools
120409 0 : for (unsigned int i=0; i < SgSpaceshipOp::pools.size(); i++)
120410 : {
120411 : // objectArray[i] is a single memory pool
120412 0 : for (unsigned j=0; j < SgSpaceshipOp::pool_size; j++)
120413 : {
120414 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
120415 : {
120416 : // printf ("Found a valid SgSpaceshipOp object in the memory pool %d at position %d \n",i,j);
120417 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
120418 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
120419 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
120420 : }
120421 : else
120422 : {
120423 : // printf ("Found a INVALID SgSpaceshipOp object in the memory pool \n");
120424 : }
120425 : }
120426 : }
120427 : }
120428 :
120429 : // This should not be required since all previously static data members are
120430 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
120431 :
120432 194 : }
120433 :
120434 : void
120435 0 : SgSpaceshipOp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
120436 : {
120437 : // This function visits only a single IR node of the memory pool.
120438 : // it is typically called once for each type of IR node within
120439 : // the automatically generated function: traverseRepresentativeNodes().
120440 :
120441 : // Initialize array to the address of the first element of the STL vector
120442 : // (which is guarenteed to be contiguous storage).
120443 : // SgSpaceshipOp objectArray [] = *(Memory_Block_List.begin());
120444 0 : if (SgSpaceshipOp::pools.empty() == false)
120445 : {
120446 : // Generate an array of memory pools
120447 0 : SgSpaceshipOp** objectArray = (SgSpaceshipOp**) &(SgSpaceshipOp::pools[0]);
120448 :
120449 : // Build a local variable for better performance
120450 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
120451 :
120452 : // Iterate over the memory pools
120453 0 : bool done = false;
120454 0 : unsigned i=0;
120455 :
120456 : // find the first valid IR node, call visit function, and then leave
120457 0 : while ( done == false && i < SgSpaceshipOp::pools.size() )
120458 : {
120459 : // objectArray[i] is a single memory pool
120460 : unsigned j=0;
120461 0 : while (done == false && j < SgSpaceshipOp::pool_size)
120462 : {
120463 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
120464 : {
120465 0 : traversal.visit(&(objectArray[i][j]));
120466 0 : done = true;
120467 : }
120468 0 : j++;
120469 : }
120470 0 : i++;
120471 : }
120472 :
120473 : #if 0
120474 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
120475 : if (done == false)
120476 : {
120477 : printf ("No representative for SgSpaceshipOp found in memory pools \n");
120478 : }
120479 : #endif
120480 : }
120481 0 : }
120482 :
120483 :
120484 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
120485 : // using values that overflow signed values of int.
120486 : size_t
120487 4 : SgSpaceshipOp::numberOfNodes()
120488 : {
120489 : // This function traverses the memory pool for an IR node and
120490 : // counts the number of IR nodes of a particular Sage III IR
120491 : // nodes type.
120492 :
120493 4 : size_t count = 0;
120494 4 : if (SgSpaceshipOp::pools.empty() == false)
120495 : {
120496 : // Generate an array of memory pools (this is actually a STL vector,
120497 : // but it is contiguious, so OK to treat this way).
120498 0 : SgSpaceshipOp** objectArray = (SgSpaceshipOp**) &(SgSpaceshipOp::pools[0]);
120499 :
120500 : // Build a local variable for better performance (make it a loop invariant variable).
120501 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
120502 :
120503 : // Iterate over all of the memory pools for this IR node.
120504 0 : for (unsigned int i=0; i < SgSpaceshipOp::pools.size(); i++)
120505 : {
120506 : // objectArray[i] is a single memory pool, iterate over all the
120507 : // IR nodes and only count those that are valid IR nodes used in
120508 : // the AST (i.e. allocated IR nodes).
120509 0 : for (unsigned j=0; j < SgSpaceshipOp::pool_size; j++)
120510 : {
120511 : // This is indexing the STL vector of C/C++ style arrays as a doubly
120512 : // indexed array access. It is OK since we have leveraged the semantics
120513 : // of STL vector memory as contigous and cast the memory as an array
120514 : // of arrays to use the 2D array indexing. Hope this is not confusing,
120515 : // but it s very fast as an implementation.
120516 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
120517 : {
120518 0 : count++;
120519 : }
120520 : }
120521 : }
120522 : }
120523 :
120524 :
120525 :
120526 4 : return count;
120527 : }
120528 :
120529 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
120530 : // using values that overflow signed values of int.
120531 : size_t
120532 0 : SgSpaceshipOp::memoryUsage()
120533 : {
120534 : // This function is required because we need the class name as a type when we call sizeof
120535 : // There might be another way to implement this if we have a traversal that only called a
120536 : // representative object (one call for each type of Sage IIIIR node).
120537 0 : size_t memory = numberOfNodes() * sizeof(SgSpaceshipOp);
120538 :
120539 0 : return memory;
120540 : }
120541 :
120542 : /* #line 120543 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
120543 :
120544 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
120545 : void
120546 5342 : SgNonMembershipOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
120547 : {
120548 : // This function traverses the memory pool for only a specific IR node
120549 : // and calls the visit function of the input class execute a traversal
120550 : // similar to the style of the attribute based traversals within ROSE.
120551 : // This traversal will visit ALL nodes of the AST where as the other
120552 : // attribute based traversals visit only the embedded tree within the AST.
120553 :
120554 : // Initialize array to the address of the first element of the STL vector
120555 : // (which is guaranteed to be contiguous storage).
120556 : // SgNonMembershipOp objectArray [] = *(Memory_Block_List.begin());
120557 5342 : if (SgNonMembershipOp::pools.empty() == false)
120558 : {
120559 : // Generate an array of memory pools
120560 0 : SgNonMembershipOp** objectArray = (SgNonMembershipOp**) &(SgNonMembershipOp::pools[0]);
120561 :
120562 : // Build a local variable for better performance
120563 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
120564 : #if 0
120565 : // Iterate over the memory pools
120566 : for (unsigned int i=0; i < SgNonMembershipOp::pools.size(); i++)
120567 : {
120568 : // objectArray[i] is a single memory pool
120569 : for (int j=0; j < SgNonMembershipOp::pool_size; j++)
120570 : {
120571 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
120572 : {
120573 : traversal.visit(&(objectArray[i][j]));
120574 : }
120575 : }
120576 : }
120577 : #else
120578 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
120579 : // compute the list first and then call the visit function on each list element.
120580 :
120581 : // printf ("Inside of SgNonMembershipOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
120582 :
120583 0 : std::vector<SgNonMembershipOp*> nodeList;
120584 :
120585 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
120586 0 : for (unsigned int i=0; i < SgNonMembershipOp::pools.size(); i++)
120587 : {
120588 : // objectArray[i] is a single memory pool
120589 0 : for (unsigned j=0; j < SgNonMembershipOp::pool_size; j++)
120590 : {
120591 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
120592 : {
120593 0 : nodeList.push_back(&(objectArray[i][j]));
120594 : }
120595 : }
120596 : }
120597 :
120598 : // Iterate over the saved list
120599 0 : size_t nodeListSize = nodeList.size();
120600 0 : for (size_t i=0; i < nodeListSize; i++)
120601 : {
120602 0 : ROSE_ASSERT(nodeList[i] != NULL);
120603 : #if 0
120604 : traversal.visit(nodeList[i]);
120605 : #else
120606 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
120607 : {
120608 0 : traversal.visit(nodeList[i]);
120609 : }
120610 : #endif
120611 : }
120612 : #endif
120613 : }
120614 :
120615 : // This should not be required since all previously static data members are
120616 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
120617 :
120618 5342 : }
120619 :
120620 :
120621 : void
120622 194 : SgNonMembershipOp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
120623 : {
120624 : // This function traverses the memory pool for an IR node and
120625 : // calls the function to execute the visitor object.
120626 :
120627 : // Initialize array to the address of the first element of the STL vector
120628 : // (which is guarenteed to be contiguous storage).
120629 : // SgNonMembershipOp objectArray [] = *(Memory_Block_List.begin());
120630 194 : if (SgNonMembershipOp::pools.empty() == false)
120631 : {
120632 : // Generate an array of memory pools
120633 0 : SgNonMembershipOp** objectArray = (SgNonMembershipOp**) &(SgNonMembershipOp::pools[0]);
120634 :
120635 : // Build a local variable for better performance
120636 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
120637 :
120638 : // Iterate over the memory pools
120639 0 : for (unsigned int i=0; i < SgNonMembershipOp::pools.size(); i++)
120640 : {
120641 : // objectArray[i] is a single memory pool
120642 0 : for (unsigned j=0; j < SgNonMembershipOp::pool_size; j++)
120643 : {
120644 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
120645 : {
120646 : // printf ("Found a valid SgNonMembershipOp object in the memory pool %d at position %d \n",i,j);
120647 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
120648 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
120649 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
120650 : }
120651 : else
120652 : {
120653 : // printf ("Found a INVALID SgNonMembershipOp object in the memory pool \n");
120654 : }
120655 : }
120656 : }
120657 : }
120658 :
120659 : // This should not be required since all previously static data members are
120660 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
120661 :
120662 194 : }
120663 :
120664 : void
120665 0 : SgNonMembershipOp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
120666 : {
120667 : // This function visits only a single IR node of the memory pool.
120668 : // it is typically called once for each type of IR node within
120669 : // the automatically generated function: traverseRepresentativeNodes().
120670 :
120671 : // Initialize array to the address of the first element of the STL vector
120672 : // (which is guarenteed to be contiguous storage).
120673 : // SgNonMembershipOp objectArray [] = *(Memory_Block_List.begin());
120674 0 : if (SgNonMembershipOp::pools.empty() == false)
120675 : {
120676 : // Generate an array of memory pools
120677 0 : SgNonMembershipOp** objectArray = (SgNonMembershipOp**) &(SgNonMembershipOp::pools[0]);
120678 :
120679 : // Build a local variable for better performance
120680 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
120681 :
120682 : // Iterate over the memory pools
120683 0 : bool done = false;
120684 0 : unsigned i=0;
120685 :
120686 : // find the first valid IR node, call visit function, and then leave
120687 0 : while ( done == false && i < SgNonMembershipOp::pools.size() )
120688 : {
120689 : // objectArray[i] is a single memory pool
120690 : unsigned j=0;
120691 0 : while (done == false && j < SgNonMembershipOp::pool_size)
120692 : {
120693 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
120694 : {
120695 0 : traversal.visit(&(objectArray[i][j]));
120696 0 : done = true;
120697 : }
120698 0 : j++;
120699 : }
120700 0 : i++;
120701 : }
120702 :
120703 : #if 0
120704 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
120705 : if (done == false)
120706 : {
120707 : printf ("No representative for SgNonMembershipOp found in memory pools \n");
120708 : }
120709 : #endif
120710 : }
120711 0 : }
120712 :
120713 :
120714 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
120715 : // using values that overflow signed values of int.
120716 : size_t
120717 4 : SgNonMembershipOp::numberOfNodes()
120718 : {
120719 : // This function traverses the memory pool for an IR node and
120720 : // counts the number of IR nodes of a particular Sage III IR
120721 : // nodes type.
120722 :
120723 4 : size_t count = 0;
120724 4 : if (SgNonMembershipOp::pools.empty() == false)
120725 : {
120726 : // Generate an array of memory pools (this is actually a STL vector,
120727 : // but it is contiguious, so OK to treat this way).
120728 0 : SgNonMembershipOp** objectArray = (SgNonMembershipOp**) &(SgNonMembershipOp::pools[0]);
120729 :
120730 : // Build a local variable for better performance (make it a loop invariant variable).
120731 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
120732 :
120733 : // Iterate over all of the memory pools for this IR node.
120734 0 : for (unsigned int i=0; i < SgNonMembershipOp::pools.size(); i++)
120735 : {
120736 : // objectArray[i] is a single memory pool, iterate over all the
120737 : // IR nodes and only count those that are valid IR nodes used in
120738 : // the AST (i.e. allocated IR nodes).
120739 0 : for (unsigned j=0; j < SgNonMembershipOp::pool_size; j++)
120740 : {
120741 : // This is indexing the STL vector of C/C++ style arrays as a doubly
120742 : // indexed array access. It is OK since we have leveraged the semantics
120743 : // of STL vector memory as contigous and cast the memory as an array
120744 : // of arrays to use the 2D array indexing. Hope this is not confusing,
120745 : // but it s very fast as an implementation.
120746 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
120747 : {
120748 0 : count++;
120749 : }
120750 : }
120751 : }
120752 : }
120753 :
120754 :
120755 :
120756 4 : return count;
120757 : }
120758 :
120759 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
120760 : // using values that overflow signed values of int.
120761 : size_t
120762 0 : SgNonMembershipOp::memoryUsage()
120763 : {
120764 : // This function is required because we need the class name as a type when we call sizeof
120765 : // There might be another way to implement this if we have a traversal that only called a
120766 : // representative object (one call for each type of Sage IIIIR node).
120767 0 : size_t memory = numberOfNodes() * sizeof(SgNonMembershipOp);
120768 :
120769 0 : return memory;
120770 : }
120771 :
120772 : /* #line 120773 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
120773 :
120774 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
120775 : void
120776 5342 : SgIsOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
120777 : {
120778 : // This function traverses the memory pool for only a specific IR node
120779 : // and calls the visit function of the input class execute a traversal
120780 : // similar to the style of the attribute based traversals within ROSE.
120781 : // This traversal will visit ALL nodes of the AST where as the other
120782 : // attribute based traversals visit only the embedded tree within the AST.
120783 :
120784 : // Initialize array to the address of the first element of the STL vector
120785 : // (which is guaranteed to be contiguous storage).
120786 : // SgIsOp objectArray [] = *(Memory_Block_List.begin());
120787 5342 : if (SgIsOp::pools.empty() == false)
120788 : {
120789 : // Generate an array of memory pools
120790 0 : SgIsOp** objectArray = (SgIsOp**) &(SgIsOp::pools[0]);
120791 :
120792 : // Build a local variable for better performance
120793 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
120794 : #if 0
120795 : // Iterate over the memory pools
120796 : for (unsigned int i=0; i < SgIsOp::pools.size(); i++)
120797 : {
120798 : // objectArray[i] is a single memory pool
120799 : for (int j=0; j < SgIsOp::pool_size; j++)
120800 : {
120801 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
120802 : {
120803 : traversal.visit(&(objectArray[i][j]));
120804 : }
120805 : }
120806 : }
120807 : #else
120808 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
120809 : // compute the list first and then call the visit function on each list element.
120810 :
120811 : // printf ("Inside of SgIsOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
120812 :
120813 0 : std::vector<SgIsOp*> nodeList;
120814 :
120815 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
120816 0 : for (unsigned int i=0; i < SgIsOp::pools.size(); i++)
120817 : {
120818 : // objectArray[i] is a single memory pool
120819 0 : for (unsigned j=0; j < SgIsOp::pool_size; j++)
120820 : {
120821 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
120822 : {
120823 0 : nodeList.push_back(&(objectArray[i][j]));
120824 : }
120825 : }
120826 : }
120827 :
120828 : // Iterate over the saved list
120829 0 : size_t nodeListSize = nodeList.size();
120830 0 : for (size_t i=0; i < nodeListSize; i++)
120831 : {
120832 0 : ROSE_ASSERT(nodeList[i] != NULL);
120833 : #if 0
120834 : traversal.visit(nodeList[i]);
120835 : #else
120836 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
120837 : {
120838 0 : traversal.visit(nodeList[i]);
120839 : }
120840 : #endif
120841 : }
120842 : #endif
120843 : }
120844 :
120845 : // This should not be required since all previously static data members are
120846 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
120847 :
120848 5342 : }
120849 :
120850 :
120851 : void
120852 194 : SgIsOp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
120853 : {
120854 : // This function traverses the memory pool for an IR node and
120855 : // calls the function to execute the visitor object.
120856 :
120857 : // Initialize array to the address of the first element of the STL vector
120858 : // (which is guarenteed to be contiguous storage).
120859 : // SgIsOp objectArray [] = *(Memory_Block_List.begin());
120860 194 : if (SgIsOp::pools.empty() == false)
120861 : {
120862 : // Generate an array of memory pools
120863 0 : SgIsOp** objectArray = (SgIsOp**) &(SgIsOp::pools[0]);
120864 :
120865 : // Build a local variable for better performance
120866 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
120867 :
120868 : // Iterate over the memory pools
120869 0 : for (unsigned int i=0; i < SgIsOp::pools.size(); i++)
120870 : {
120871 : // objectArray[i] is a single memory pool
120872 0 : for (unsigned j=0; j < SgIsOp::pool_size; j++)
120873 : {
120874 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
120875 : {
120876 : // printf ("Found a valid SgIsOp object in the memory pool %d at position %d \n",i,j);
120877 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
120878 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
120879 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
120880 : }
120881 : else
120882 : {
120883 : // printf ("Found a INVALID SgIsOp object in the memory pool \n");
120884 : }
120885 : }
120886 : }
120887 : }
120888 :
120889 : // This should not be required since all previously static data members are
120890 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
120891 :
120892 194 : }
120893 :
120894 : void
120895 0 : SgIsOp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
120896 : {
120897 : // This function visits only a single IR node of the memory pool.
120898 : // it is typically called once for each type of IR node within
120899 : // the automatically generated function: traverseRepresentativeNodes().
120900 :
120901 : // Initialize array to the address of the first element of the STL vector
120902 : // (which is guarenteed to be contiguous storage).
120903 : // SgIsOp objectArray [] = *(Memory_Block_List.begin());
120904 0 : if (SgIsOp::pools.empty() == false)
120905 : {
120906 : // Generate an array of memory pools
120907 0 : SgIsOp** objectArray = (SgIsOp**) &(SgIsOp::pools[0]);
120908 :
120909 : // Build a local variable for better performance
120910 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
120911 :
120912 : // Iterate over the memory pools
120913 0 : bool done = false;
120914 0 : unsigned i=0;
120915 :
120916 : // find the first valid IR node, call visit function, and then leave
120917 0 : while ( done == false && i < SgIsOp::pools.size() )
120918 : {
120919 : // objectArray[i] is a single memory pool
120920 : unsigned j=0;
120921 0 : while (done == false && j < SgIsOp::pool_size)
120922 : {
120923 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
120924 : {
120925 0 : traversal.visit(&(objectArray[i][j]));
120926 0 : done = true;
120927 : }
120928 0 : j++;
120929 : }
120930 0 : i++;
120931 : }
120932 :
120933 : #if 0
120934 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
120935 : if (done == false)
120936 : {
120937 : printf ("No representative for SgIsOp found in memory pools \n");
120938 : }
120939 : #endif
120940 : }
120941 0 : }
120942 :
120943 :
120944 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
120945 : // using values that overflow signed values of int.
120946 : size_t
120947 4 : SgIsOp::numberOfNodes()
120948 : {
120949 : // This function traverses the memory pool for an IR node and
120950 : // counts the number of IR nodes of a particular Sage III IR
120951 : // nodes type.
120952 :
120953 4 : size_t count = 0;
120954 4 : if (SgIsOp::pools.empty() == false)
120955 : {
120956 : // Generate an array of memory pools (this is actually a STL vector,
120957 : // but it is contiguious, so OK to treat this way).
120958 0 : SgIsOp** objectArray = (SgIsOp**) &(SgIsOp::pools[0]);
120959 :
120960 : // Build a local variable for better performance (make it a loop invariant variable).
120961 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
120962 :
120963 : // Iterate over all of the memory pools for this IR node.
120964 0 : for (unsigned int i=0; i < SgIsOp::pools.size(); i++)
120965 : {
120966 : // objectArray[i] is a single memory pool, iterate over all the
120967 : // IR nodes and only count those that are valid IR nodes used in
120968 : // the AST (i.e. allocated IR nodes).
120969 0 : for (unsigned j=0; j < SgIsOp::pool_size; j++)
120970 : {
120971 : // This is indexing the STL vector of C/C++ style arrays as a doubly
120972 : // indexed array access. It is OK since we have leveraged the semantics
120973 : // of STL vector memory as contigous and cast the memory as an array
120974 : // of arrays to use the 2D array indexing. Hope this is not confusing,
120975 : // but it s very fast as an implementation.
120976 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
120977 : {
120978 0 : count++;
120979 : }
120980 : }
120981 : }
120982 : }
120983 :
120984 :
120985 :
120986 4 : return count;
120987 : }
120988 :
120989 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
120990 : // using values that overflow signed values of int.
120991 : size_t
120992 0 : SgIsOp::memoryUsage()
120993 : {
120994 : // This function is required because we need the class name as a type when we call sizeof
120995 : // There might be another way to implement this if we have a traversal that only called a
120996 : // representative object (one call for each type of Sage IIIIR node).
120997 0 : size_t memory = numberOfNodes() * sizeof(SgIsOp);
120998 :
120999 0 : return memory;
121000 : }
121001 :
121002 : /* #line 121003 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
121003 :
121004 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
121005 : void
121006 5342 : SgIsNotOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
121007 : {
121008 : // This function traverses the memory pool for only a specific IR node
121009 : // and calls the visit function of the input class execute a traversal
121010 : // similar to the style of the attribute based traversals within ROSE.
121011 : // This traversal will visit ALL nodes of the AST where as the other
121012 : // attribute based traversals visit only the embedded tree within the AST.
121013 :
121014 : // Initialize array to the address of the first element of the STL vector
121015 : // (which is guaranteed to be contiguous storage).
121016 : // SgIsNotOp objectArray [] = *(Memory_Block_List.begin());
121017 5342 : if (SgIsNotOp::pools.empty() == false)
121018 : {
121019 : // Generate an array of memory pools
121020 0 : SgIsNotOp** objectArray = (SgIsNotOp**) &(SgIsNotOp::pools[0]);
121021 :
121022 : // Build a local variable for better performance
121023 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
121024 : #if 0
121025 : // Iterate over the memory pools
121026 : for (unsigned int i=0; i < SgIsNotOp::pools.size(); i++)
121027 : {
121028 : // objectArray[i] is a single memory pool
121029 : for (int j=0; j < SgIsNotOp::pool_size; j++)
121030 : {
121031 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
121032 : {
121033 : traversal.visit(&(objectArray[i][j]));
121034 : }
121035 : }
121036 : }
121037 : #else
121038 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
121039 : // compute the list first and then call the visit function on each list element.
121040 :
121041 : // printf ("Inside of SgIsNotOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
121042 :
121043 0 : std::vector<SgIsNotOp*> nodeList;
121044 :
121045 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
121046 0 : for (unsigned int i=0; i < SgIsNotOp::pools.size(); i++)
121047 : {
121048 : // objectArray[i] is a single memory pool
121049 0 : for (unsigned j=0; j < SgIsNotOp::pool_size; j++)
121050 : {
121051 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
121052 : {
121053 0 : nodeList.push_back(&(objectArray[i][j]));
121054 : }
121055 : }
121056 : }
121057 :
121058 : // Iterate over the saved list
121059 0 : size_t nodeListSize = nodeList.size();
121060 0 : for (size_t i=0; i < nodeListSize; i++)
121061 : {
121062 0 : ROSE_ASSERT(nodeList[i] != NULL);
121063 : #if 0
121064 : traversal.visit(nodeList[i]);
121065 : #else
121066 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
121067 : {
121068 0 : traversal.visit(nodeList[i]);
121069 : }
121070 : #endif
121071 : }
121072 : #endif
121073 : }
121074 :
121075 : // This should not be required since all previously static data members are
121076 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
121077 :
121078 5342 : }
121079 :
121080 :
121081 : void
121082 194 : SgIsNotOp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
121083 : {
121084 : // This function traverses the memory pool for an IR node and
121085 : // calls the function to execute the visitor object.
121086 :
121087 : // Initialize array to the address of the first element of the STL vector
121088 : // (which is guarenteed to be contiguous storage).
121089 : // SgIsNotOp objectArray [] = *(Memory_Block_List.begin());
121090 194 : if (SgIsNotOp::pools.empty() == false)
121091 : {
121092 : // Generate an array of memory pools
121093 0 : SgIsNotOp** objectArray = (SgIsNotOp**) &(SgIsNotOp::pools[0]);
121094 :
121095 : // Build a local variable for better performance
121096 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
121097 :
121098 : // Iterate over the memory pools
121099 0 : for (unsigned int i=0; i < SgIsNotOp::pools.size(); i++)
121100 : {
121101 : // objectArray[i] is a single memory pool
121102 0 : for (unsigned j=0; j < SgIsNotOp::pool_size; j++)
121103 : {
121104 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
121105 : {
121106 : // printf ("Found a valid SgIsNotOp object in the memory pool %d at position %d \n",i,j);
121107 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
121108 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
121109 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
121110 : }
121111 : else
121112 : {
121113 : // printf ("Found a INVALID SgIsNotOp object in the memory pool \n");
121114 : }
121115 : }
121116 : }
121117 : }
121118 :
121119 : // This should not be required since all previously static data members are
121120 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
121121 :
121122 194 : }
121123 :
121124 : void
121125 0 : SgIsNotOp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
121126 : {
121127 : // This function visits only a single IR node of the memory pool.
121128 : // it is typically called once for each type of IR node within
121129 : // the automatically generated function: traverseRepresentativeNodes().
121130 :
121131 : // Initialize array to the address of the first element of the STL vector
121132 : // (which is guarenteed to be contiguous storage).
121133 : // SgIsNotOp objectArray [] = *(Memory_Block_List.begin());
121134 0 : if (SgIsNotOp::pools.empty() == false)
121135 : {
121136 : // Generate an array of memory pools
121137 0 : SgIsNotOp** objectArray = (SgIsNotOp**) &(SgIsNotOp::pools[0]);
121138 :
121139 : // Build a local variable for better performance
121140 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
121141 :
121142 : // Iterate over the memory pools
121143 0 : bool done = false;
121144 0 : unsigned i=0;
121145 :
121146 : // find the first valid IR node, call visit function, and then leave
121147 0 : while ( done == false && i < SgIsNotOp::pools.size() )
121148 : {
121149 : // objectArray[i] is a single memory pool
121150 : unsigned j=0;
121151 0 : while (done == false && j < SgIsNotOp::pool_size)
121152 : {
121153 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
121154 : {
121155 0 : traversal.visit(&(objectArray[i][j]));
121156 0 : done = true;
121157 : }
121158 0 : j++;
121159 : }
121160 0 : i++;
121161 : }
121162 :
121163 : #if 0
121164 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
121165 : if (done == false)
121166 : {
121167 : printf ("No representative for SgIsNotOp found in memory pools \n");
121168 : }
121169 : #endif
121170 : }
121171 0 : }
121172 :
121173 :
121174 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
121175 : // using values that overflow signed values of int.
121176 : size_t
121177 4 : SgIsNotOp::numberOfNodes()
121178 : {
121179 : // This function traverses the memory pool for an IR node and
121180 : // counts the number of IR nodes of a particular Sage III IR
121181 : // nodes type.
121182 :
121183 4 : size_t count = 0;
121184 4 : if (SgIsNotOp::pools.empty() == false)
121185 : {
121186 : // Generate an array of memory pools (this is actually a STL vector,
121187 : // but it is contiguious, so OK to treat this way).
121188 0 : SgIsNotOp** objectArray = (SgIsNotOp**) &(SgIsNotOp::pools[0]);
121189 :
121190 : // Build a local variable for better performance (make it a loop invariant variable).
121191 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
121192 :
121193 : // Iterate over all of the memory pools for this IR node.
121194 0 : for (unsigned int i=0; i < SgIsNotOp::pools.size(); i++)
121195 : {
121196 : // objectArray[i] is a single memory pool, iterate over all the
121197 : // IR nodes and only count those that are valid IR nodes used in
121198 : // the AST (i.e. allocated IR nodes).
121199 0 : for (unsigned j=0; j < SgIsNotOp::pool_size; j++)
121200 : {
121201 : // This is indexing the STL vector of C/C++ style arrays as a doubly
121202 : // indexed array access. It is OK since we have leveraged the semantics
121203 : // of STL vector memory as contigous and cast the memory as an array
121204 : // of arrays to use the 2D array indexing. Hope this is not confusing,
121205 : // but it s very fast as an implementation.
121206 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
121207 : {
121208 0 : count++;
121209 : }
121210 : }
121211 : }
121212 : }
121213 :
121214 :
121215 :
121216 4 : return count;
121217 : }
121218 :
121219 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
121220 : // using values that overflow signed values of int.
121221 : size_t
121222 0 : SgIsNotOp::memoryUsage()
121223 : {
121224 : // This function is required because we need the class name as a type when we call sizeof
121225 : // There might be another way to implement this if we have a traversal that only called a
121226 : // representative object (one call for each type of Sage IIIIR node).
121227 0 : size_t memory = numberOfNodes() * sizeof(SgIsNotOp);
121228 :
121229 0 : return memory;
121230 : }
121231 :
121232 : /* #line 121233 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
121233 :
121234 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
121235 : void
121236 5342 : SgElementwiseOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
121237 : {
121238 : // This function traverses the memory pool for only a specific IR node
121239 : // and calls the visit function of the input class execute a traversal
121240 : // similar to the style of the attribute based traversals within ROSE.
121241 : // This traversal will visit ALL nodes of the AST where as the other
121242 : // attribute based traversals visit only the embedded tree within the AST.
121243 :
121244 : // Initialize array to the address of the first element of the STL vector
121245 : // (which is guaranteed to be contiguous storage).
121246 : // SgElementwiseOp objectArray [] = *(Memory_Block_List.begin());
121247 5342 : if (SgElementwiseOp::pools.empty() == false)
121248 : {
121249 : // Generate an array of memory pools
121250 0 : SgElementwiseOp** objectArray = (SgElementwiseOp**) &(SgElementwiseOp::pools[0]);
121251 :
121252 : // Build a local variable for better performance
121253 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
121254 : #if 0
121255 : // Iterate over the memory pools
121256 : for (unsigned int i=0; i < SgElementwiseOp::pools.size(); i++)
121257 : {
121258 : // objectArray[i] is a single memory pool
121259 : for (int j=0; j < SgElementwiseOp::pool_size; j++)
121260 : {
121261 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
121262 : {
121263 : traversal.visit(&(objectArray[i][j]));
121264 : }
121265 : }
121266 : }
121267 : #else
121268 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
121269 : // compute the list first and then call the visit function on each list element.
121270 :
121271 : // printf ("Inside of SgElementwiseOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
121272 :
121273 0 : std::vector<SgElementwiseOp*> nodeList;
121274 :
121275 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
121276 0 : for (unsigned int i=0; i < SgElementwiseOp::pools.size(); i++)
121277 : {
121278 : // objectArray[i] is a single memory pool
121279 0 : for (unsigned j=0; j < SgElementwiseOp::pool_size; j++)
121280 : {
121281 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
121282 : {
121283 0 : nodeList.push_back(&(objectArray[i][j]));
121284 : }
121285 : }
121286 : }
121287 :
121288 : // Iterate over the saved list
121289 0 : size_t nodeListSize = nodeList.size();
121290 0 : for (size_t i=0; i < nodeListSize; i++)
121291 : {
121292 0 : ROSE_ASSERT(nodeList[i] != NULL);
121293 : #if 0
121294 : traversal.visit(nodeList[i]);
121295 : #else
121296 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
121297 : {
121298 0 : traversal.visit(nodeList[i]);
121299 : }
121300 : #endif
121301 : }
121302 : #endif
121303 : }
121304 :
121305 : // This should not be required since all previously static data members are
121306 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
121307 :
121308 5342 : }
121309 :
121310 :
121311 : void
121312 194 : SgElementwiseOp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
121313 : {
121314 : // This function traverses the memory pool for an IR node and
121315 : // calls the function to execute the visitor object.
121316 :
121317 : // Initialize array to the address of the first element of the STL vector
121318 : // (which is guarenteed to be contiguous storage).
121319 : // SgElementwiseOp objectArray [] = *(Memory_Block_List.begin());
121320 194 : if (SgElementwiseOp::pools.empty() == false)
121321 : {
121322 : // Generate an array of memory pools
121323 0 : SgElementwiseOp** objectArray = (SgElementwiseOp**) &(SgElementwiseOp::pools[0]);
121324 :
121325 : // Build a local variable for better performance
121326 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
121327 :
121328 : // Iterate over the memory pools
121329 0 : for (unsigned int i=0; i < SgElementwiseOp::pools.size(); i++)
121330 : {
121331 : // objectArray[i] is a single memory pool
121332 0 : for (unsigned j=0; j < SgElementwiseOp::pool_size; j++)
121333 : {
121334 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
121335 : {
121336 : // printf ("Found a valid SgElementwiseOp object in the memory pool %d at position %d \n",i,j);
121337 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
121338 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
121339 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
121340 : }
121341 : else
121342 : {
121343 : // printf ("Found a INVALID SgElementwiseOp object in the memory pool \n");
121344 : }
121345 : }
121346 : }
121347 : }
121348 :
121349 : // This should not be required since all previously static data members are
121350 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
121351 :
121352 194 : }
121353 :
121354 : void
121355 0 : SgElementwiseOp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
121356 : {
121357 : // This function visits only a single IR node of the memory pool.
121358 : // it is typically called once for each type of IR node within
121359 : // the automatically generated function: traverseRepresentativeNodes().
121360 :
121361 : // Initialize array to the address of the first element of the STL vector
121362 : // (which is guarenteed to be contiguous storage).
121363 : // SgElementwiseOp objectArray [] = *(Memory_Block_List.begin());
121364 0 : if (SgElementwiseOp::pools.empty() == false)
121365 : {
121366 : // Generate an array of memory pools
121367 0 : SgElementwiseOp** objectArray = (SgElementwiseOp**) &(SgElementwiseOp::pools[0]);
121368 :
121369 : // Build a local variable for better performance
121370 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
121371 :
121372 : // Iterate over the memory pools
121373 0 : bool done = false;
121374 0 : unsigned i=0;
121375 :
121376 : // find the first valid IR node, call visit function, and then leave
121377 0 : while ( done == false && i < SgElementwiseOp::pools.size() )
121378 : {
121379 : // objectArray[i] is a single memory pool
121380 : unsigned j=0;
121381 0 : while (done == false && j < SgElementwiseOp::pool_size)
121382 : {
121383 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
121384 : {
121385 0 : traversal.visit(&(objectArray[i][j]));
121386 0 : done = true;
121387 : }
121388 0 : j++;
121389 : }
121390 0 : i++;
121391 : }
121392 :
121393 : #if 0
121394 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
121395 : if (done == false)
121396 : {
121397 : printf ("No representative for SgElementwiseOp found in memory pools \n");
121398 : }
121399 : #endif
121400 : }
121401 0 : }
121402 :
121403 :
121404 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
121405 : // using values that overflow signed values of int.
121406 : size_t
121407 4 : SgElementwiseOp::numberOfNodes()
121408 : {
121409 : // This function traverses the memory pool for an IR node and
121410 : // counts the number of IR nodes of a particular Sage III IR
121411 : // nodes type.
121412 :
121413 4 : size_t count = 0;
121414 4 : if (SgElementwiseOp::pools.empty() == false)
121415 : {
121416 : // Generate an array of memory pools (this is actually a STL vector,
121417 : // but it is contiguious, so OK to treat this way).
121418 0 : SgElementwiseOp** objectArray = (SgElementwiseOp**) &(SgElementwiseOp::pools[0]);
121419 :
121420 : // Build a local variable for better performance (make it a loop invariant variable).
121421 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
121422 :
121423 : // Iterate over all of the memory pools for this IR node.
121424 0 : for (unsigned int i=0; i < SgElementwiseOp::pools.size(); i++)
121425 : {
121426 : // objectArray[i] is a single memory pool, iterate over all the
121427 : // IR nodes and only count those that are valid IR nodes used in
121428 : // the AST (i.e. allocated IR nodes).
121429 0 : for (unsigned j=0; j < SgElementwiseOp::pool_size; j++)
121430 : {
121431 : // This is indexing the STL vector of C/C++ style arrays as a doubly
121432 : // indexed array access. It is OK since we have leveraged the semantics
121433 : // of STL vector memory as contigous and cast the memory as an array
121434 : // of arrays to use the 2D array indexing. Hope this is not confusing,
121435 : // but it s very fast as an implementation.
121436 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
121437 : {
121438 0 : count++;
121439 : }
121440 : }
121441 : }
121442 : }
121443 :
121444 :
121445 :
121446 4 : return count;
121447 : }
121448 :
121449 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
121450 : // using values that overflow signed values of int.
121451 : size_t
121452 0 : SgElementwiseOp::memoryUsage()
121453 : {
121454 : // This function is required because we need the class name as a type when we call sizeof
121455 : // There might be another way to implement this if we have a traversal that only called a
121456 : // representative object (one call for each type of Sage IIIIR node).
121457 0 : size_t memory = numberOfNodes() * sizeof(SgElementwiseOp);
121458 :
121459 0 : return memory;
121460 : }
121461 :
121462 : /* #line 121463 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
121463 :
121464 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
121465 : void
121466 5342 : SgElementwiseMultiplyOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
121467 : {
121468 : // This function traverses the memory pool for only a specific IR node
121469 : // and calls the visit function of the input class execute a traversal
121470 : // similar to the style of the attribute based traversals within ROSE.
121471 : // This traversal will visit ALL nodes of the AST where as the other
121472 : // attribute based traversals visit only the embedded tree within the AST.
121473 :
121474 : // Initialize array to the address of the first element of the STL vector
121475 : // (which is guaranteed to be contiguous storage).
121476 : // SgElementwiseMultiplyOp objectArray [] = *(Memory_Block_List.begin());
121477 5342 : if (SgElementwiseMultiplyOp::pools.empty() == false)
121478 : {
121479 : // Generate an array of memory pools
121480 0 : SgElementwiseMultiplyOp** objectArray = (SgElementwiseMultiplyOp**) &(SgElementwiseMultiplyOp::pools[0]);
121481 :
121482 : // Build a local variable for better performance
121483 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
121484 : #if 0
121485 : // Iterate over the memory pools
121486 : for (unsigned int i=0; i < SgElementwiseMultiplyOp::pools.size(); i++)
121487 : {
121488 : // objectArray[i] is a single memory pool
121489 : for (int j=0; j < SgElementwiseMultiplyOp::pool_size; j++)
121490 : {
121491 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
121492 : {
121493 : traversal.visit(&(objectArray[i][j]));
121494 : }
121495 : }
121496 : }
121497 : #else
121498 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
121499 : // compute the list first and then call the visit function on each list element.
121500 :
121501 : // printf ("Inside of SgElementwiseMultiplyOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
121502 :
121503 0 : std::vector<SgElementwiseMultiplyOp*> nodeList;
121504 :
121505 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
121506 0 : for (unsigned int i=0; i < SgElementwiseMultiplyOp::pools.size(); i++)
121507 : {
121508 : // objectArray[i] is a single memory pool
121509 0 : for (unsigned j=0; j < SgElementwiseMultiplyOp::pool_size; j++)
121510 : {
121511 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
121512 : {
121513 0 : nodeList.push_back(&(objectArray[i][j]));
121514 : }
121515 : }
121516 : }
121517 :
121518 : // Iterate over the saved list
121519 0 : size_t nodeListSize = nodeList.size();
121520 0 : for (size_t i=0; i < nodeListSize; i++)
121521 : {
121522 0 : ROSE_ASSERT(nodeList[i] != NULL);
121523 : #if 0
121524 : traversal.visit(nodeList[i]);
121525 : #else
121526 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
121527 : {
121528 0 : traversal.visit(nodeList[i]);
121529 : }
121530 : #endif
121531 : }
121532 : #endif
121533 : }
121534 :
121535 : // This should not be required since all previously static data members are
121536 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
121537 :
121538 5342 : }
121539 :
121540 :
121541 : void
121542 194 : SgElementwiseMultiplyOp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
121543 : {
121544 : // This function traverses the memory pool for an IR node and
121545 : // calls the function to execute the visitor object.
121546 :
121547 : // Initialize array to the address of the first element of the STL vector
121548 : // (which is guarenteed to be contiguous storage).
121549 : // SgElementwiseMultiplyOp objectArray [] = *(Memory_Block_List.begin());
121550 194 : if (SgElementwiseMultiplyOp::pools.empty() == false)
121551 : {
121552 : // Generate an array of memory pools
121553 0 : SgElementwiseMultiplyOp** objectArray = (SgElementwiseMultiplyOp**) &(SgElementwiseMultiplyOp::pools[0]);
121554 :
121555 : // Build a local variable for better performance
121556 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
121557 :
121558 : // Iterate over the memory pools
121559 0 : for (unsigned int i=0; i < SgElementwiseMultiplyOp::pools.size(); i++)
121560 : {
121561 : // objectArray[i] is a single memory pool
121562 0 : for (unsigned j=0; j < SgElementwiseMultiplyOp::pool_size; j++)
121563 : {
121564 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
121565 : {
121566 : // printf ("Found a valid SgElementwiseMultiplyOp object in the memory pool %d at position %d \n",i,j);
121567 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
121568 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
121569 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
121570 : }
121571 : else
121572 : {
121573 : // printf ("Found a INVALID SgElementwiseMultiplyOp object in the memory pool \n");
121574 : }
121575 : }
121576 : }
121577 : }
121578 :
121579 : // This should not be required since all previously static data members are
121580 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
121581 :
121582 194 : }
121583 :
121584 : void
121585 0 : SgElementwiseMultiplyOp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
121586 : {
121587 : // This function visits only a single IR node of the memory pool.
121588 : // it is typically called once for each type of IR node within
121589 : // the automatically generated function: traverseRepresentativeNodes().
121590 :
121591 : // Initialize array to the address of the first element of the STL vector
121592 : // (which is guarenteed to be contiguous storage).
121593 : // SgElementwiseMultiplyOp objectArray [] = *(Memory_Block_List.begin());
121594 0 : if (SgElementwiseMultiplyOp::pools.empty() == false)
121595 : {
121596 : // Generate an array of memory pools
121597 0 : SgElementwiseMultiplyOp** objectArray = (SgElementwiseMultiplyOp**) &(SgElementwiseMultiplyOp::pools[0]);
121598 :
121599 : // Build a local variable for better performance
121600 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
121601 :
121602 : // Iterate over the memory pools
121603 0 : bool done = false;
121604 0 : unsigned i=0;
121605 :
121606 : // find the first valid IR node, call visit function, and then leave
121607 0 : while ( done == false && i < SgElementwiseMultiplyOp::pools.size() )
121608 : {
121609 : // objectArray[i] is a single memory pool
121610 : unsigned j=0;
121611 0 : while (done == false && j < SgElementwiseMultiplyOp::pool_size)
121612 : {
121613 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
121614 : {
121615 0 : traversal.visit(&(objectArray[i][j]));
121616 0 : done = true;
121617 : }
121618 0 : j++;
121619 : }
121620 0 : i++;
121621 : }
121622 :
121623 : #if 0
121624 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
121625 : if (done == false)
121626 : {
121627 : printf ("No representative for SgElementwiseMultiplyOp found in memory pools \n");
121628 : }
121629 : #endif
121630 : }
121631 0 : }
121632 :
121633 :
121634 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
121635 : // using values that overflow signed values of int.
121636 : size_t
121637 4 : SgElementwiseMultiplyOp::numberOfNodes()
121638 : {
121639 : // This function traverses the memory pool for an IR node and
121640 : // counts the number of IR nodes of a particular Sage III IR
121641 : // nodes type.
121642 :
121643 4 : size_t count = 0;
121644 4 : if (SgElementwiseMultiplyOp::pools.empty() == false)
121645 : {
121646 : // Generate an array of memory pools (this is actually a STL vector,
121647 : // but it is contiguious, so OK to treat this way).
121648 0 : SgElementwiseMultiplyOp** objectArray = (SgElementwiseMultiplyOp**) &(SgElementwiseMultiplyOp::pools[0]);
121649 :
121650 : // Build a local variable for better performance (make it a loop invariant variable).
121651 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
121652 :
121653 : // Iterate over all of the memory pools for this IR node.
121654 0 : for (unsigned int i=0; i < SgElementwiseMultiplyOp::pools.size(); i++)
121655 : {
121656 : // objectArray[i] is a single memory pool, iterate over all the
121657 : // IR nodes and only count those that are valid IR nodes used in
121658 : // the AST (i.e. allocated IR nodes).
121659 0 : for (unsigned j=0; j < SgElementwiseMultiplyOp::pool_size; j++)
121660 : {
121661 : // This is indexing the STL vector of C/C++ style arrays as a doubly
121662 : // indexed array access. It is OK since we have leveraged the semantics
121663 : // of STL vector memory as contigous and cast the memory as an array
121664 : // of arrays to use the 2D array indexing. Hope this is not confusing,
121665 : // but it s very fast as an implementation.
121666 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
121667 : {
121668 0 : count++;
121669 : }
121670 : }
121671 : }
121672 : }
121673 :
121674 :
121675 :
121676 4 : return count;
121677 : }
121678 :
121679 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
121680 : // using values that overflow signed values of int.
121681 : size_t
121682 0 : SgElementwiseMultiplyOp::memoryUsage()
121683 : {
121684 : // This function is required because we need the class name as a type when we call sizeof
121685 : // There might be another way to implement this if we have a traversal that only called a
121686 : // representative object (one call for each type of Sage IIIIR node).
121687 0 : size_t memory = numberOfNodes() * sizeof(SgElementwiseMultiplyOp);
121688 :
121689 0 : return memory;
121690 : }
121691 :
121692 : /* #line 121693 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
121693 :
121694 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
121695 : void
121696 5342 : SgElementwisePowerOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
121697 : {
121698 : // This function traverses the memory pool for only a specific IR node
121699 : // and calls the visit function of the input class execute a traversal
121700 : // similar to the style of the attribute based traversals within ROSE.
121701 : // This traversal will visit ALL nodes of the AST where as the other
121702 : // attribute based traversals visit only the embedded tree within the AST.
121703 :
121704 : // Initialize array to the address of the first element of the STL vector
121705 : // (which is guaranteed to be contiguous storage).
121706 : // SgElementwisePowerOp objectArray [] = *(Memory_Block_List.begin());
121707 5342 : if (SgElementwisePowerOp::pools.empty() == false)
121708 : {
121709 : // Generate an array of memory pools
121710 0 : SgElementwisePowerOp** objectArray = (SgElementwisePowerOp**) &(SgElementwisePowerOp::pools[0]);
121711 :
121712 : // Build a local variable for better performance
121713 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
121714 : #if 0
121715 : // Iterate over the memory pools
121716 : for (unsigned int i=0; i < SgElementwisePowerOp::pools.size(); i++)
121717 : {
121718 : // objectArray[i] is a single memory pool
121719 : for (int j=0; j < SgElementwisePowerOp::pool_size; j++)
121720 : {
121721 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
121722 : {
121723 : traversal.visit(&(objectArray[i][j]));
121724 : }
121725 : }
121726 : }
121727 : #else
121728 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
121729 : // compute the list first and then call the visit function on each list element.
121730 :
121731 : // printf ("Inside of SgElementwisePowerOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
121732 :
121733 0 : std::vector<SgElementwisePowerOp*> nodeList;
121734 :
121735 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
121736 0 : for (unsigned int i=0; i < SgElementwisePowerOp::pools.size(); i++)
121737 : {
121738 : // objectArray[i] is a single memory pool
121739 0 : for (unsigned j=0; j < SgElementwisePowerOp::pool_size; j++)
121740 : {
121741 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
121742 : {
121743 0 : nodeList.push_back(&(objectArray[i][j]));
121744 : }
121745 : }
121746 : }
121747 :
121748 : // Iterate over the saved list
121749 0 : size_t nodeListSize = nodeList.size();
121750 0 : for (size_t i=0; i < nodeListSize; i++)
121751 : {
121752 0 : ROSE_ASSERT(nodeList[i] != NULL);
121753 : #if 0
121754 : traversal.visit(nodeList[i]);
121755 : #else
121756 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
121757 : {
121758 0 : traversal.visit(nodeList[i]);
121759 : }
121760 : #endif
121761 : }
121762 : #endif
121763 : }
121764 :
121765 : // This should not be required since all previously static data members are
121766 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
121767 :
121768 5342 : }
121769 :
121770 :
121771 : void
121772 194 : SgElementwisePowerOp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
121773 : {
121774 : // This function traverses the memory pool for an IR node and
121775 : // calls the function to execute the visitor object.
121776 :
121777 : // Initialize array to the address of the first element of the STL vector
121778 : // (which is guarenteed to be contiguous storage).
121779 : // SgElementwisePowerOp objectArray [] = *(Memory_Block_List.begin());
121780 194 : if (SgElementwisePowerOp::pools.empty() == false)
121781 : {
121782 : // Generate an array of memory pools
121783 0 : SgElementwisePowerOp** objectArray = (SgElementwisePowerOp**) &(SgElementwisePowerOp::pools[0]);
121784 :
121785 : // Build a local variable for better performance
121786 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
121787 :
121788 : // Iterate over the memory pools
121789 0 : for (unsigned int i=0; i < SgElementwisePowerOp::pools.size(); i++)
121790 : {
121791 : // objectArray[i] is a single memory pool
121792 0 : for (unsigned j=0; j < SgElementwisePowerOp::pool_size; j++)
121793 : {
121794 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
121795 : {
121796 : // printf ("Found a valid SgElementwisePowerOp object in the memory pool %d at position %d \n",i,j);
121797 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
121798 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
121799 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
121800 : }
121801 : else
121802 : {
121803 : // printf ("Found a INVALID SgElementwisePowerOp object in the memory pool \n");
121804 : }
121805 : }
121806 : }
121807 : }
121808 :
121809 : // This should not be required since all previously static data members are
121810 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
121811 :
121812 194 : }
121813 :
121814 : void
121815 0 : SgElementwisePowerOp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
121816 : {
121817 : // This function visits only a single IR node of the memory pool.
121818 : // it is typically called once for each type of IR node within
121819 : // the automatically generated function: traverseRepresentativeNodes().
121820 :
121821 : // Initialize array to the address of the first element of the STL vector
121822 : // (which is guarenteed to be contiguous storage).
121823 : // SgElementwisePowerOp objectArray [] = *(Memory_Block_List.begin());
121824 0 : if (SgElementwisePowerOp::pools.empty() == false)
121825 : {
121826 : // Generate an array of memory pools
121827 0 : SgElementwisePowerOp** objectArray = (SgElementwisePowerOp**) &(SgElementwisePowerOp::pools[0]);
121828 :
121829 : // Build a local variable for better performance
121830 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
121831 :
121832 : // Iterate over the memory pools
121833 0 : bool done = false;
121834 0 : unsigned i=0;
121835 :
121836 : // find the first valid IR node, call visit function, and then leave
121837 0 : while ( done == false && i < SgElementwisePowerOp::pools.size() )
121838 : {
121839 : // objectArray[i] is a single memory pool
121840 : unsigned j=0;
121841 0 : while (done == false && j < SgElementwisePowerOp::pool_size)
121842 : {
121843 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
121844 : {
121845 0 : traversal.visit(&(objectArray[i][j]));
121846 0 : done = true;
121847 : }
121848 0 : j++;
121849 : }
121850 0 : i++;
121851 : }
121852 :
121853 : #if 0
121854 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
121855 : if (done == false)
121856 : {
121857 : printf ("No representative for SgElementwisePowerOp found in memory pools \n");
121858 : }
121859 : #endif
121860 : }
121861 0 : }
121862 :
121863 :
121864 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
121865 : // using values that overflow signed values of int.
121866 : size_t
121867 4 : SgElementwisePowerOp::numberOfNodes()
121868 : {
121869 : // This function traverses the memory pool for an IR node and
121870 : // counts the number of IR nodes of a particular Sage III IR
121871 : // nodes type.
121872 :
121873 4 : size_t count = 0;
121874 4 : if (SgElementwisePowerOp::pools.empty() == false)
121875 : {
121876 : // Generate an array of memory pools (this is actually a STL vector,
121877 : // but it is contiguious, so OK to treat this way).
121878 0 : SgElementwisePowerOp** objectArray = (SgElementwisePowerOp**) &(SgElementwisePowerOp::pools[0]);
121879 :
121880 : // Build a local variable for better performance (make it a loop invariant variable).
121881 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
121882 :
121883 : // Iterate over all of the memory pools for this IR node.
121884 0 : for (unsigned int i=0; i < SgElementwisePowerOp::pools.size(); i++)
121885 : {
121886 : // objectArray[i] is a single memory pool, iterate over all the
121887 : // IR nodes and only count those that are valid IR nodes used in
121888 : // the AST (i.e. allocated IR nodes).
121889 0 : for (unsigned j=0; j < SgElementwisePowerOp::pool_size; j++)
121890 : {
121891 : // This is indexing the STL vector of C/C++ style arrays as a doubly
121892 : // indexed array access. It is OK since we have leveraged the semantics
121893 : // of STL vector memory as contigous and cast the memory as an array
121894 : // of arrays to use the 2D array indexing. Hope this is not confusing,
121895 : // but it s very fast as an implementation.
121896 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
121897 : {
121898 0 : count++;
121899 : }
121900 : }
121901 : }
121902 : }
121903 :
121904 :
121905 :
121906 4 : return count;
121907 : }
121908 :
121909 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
121910 : // using values that overflow signed values of int.
121911 : size_t
121912 0 : SgElementwisePowerOp::memoryUsage()
121913 : {
121914 : // This function is required because we need the class name as a type when we call sizeof
121915 : // There might be another way to implement this if we have a traversal that only called a
121916 : // representative object (one call for each type of Sage IIIIR node).
121917 0 : size_t memory = numberOfNodes() * sizeof(SgElementwisePowerOp);
121918 :
121919 0 : return memory;
121920 : }
121921 :
121922 : /* #line 121923 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
121923 :
121924 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
121925 : void
121926 5342 : SgElementwiseLeftDivideOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
121927 : {
121928 : // This function traverses the memory pool for only a specific IR node
121929 : // and calls the visit function of the input class execute a traversal
121930 : // similar to the style of the attribute based traversals within ROSE.
121931 : // This traversal will visit ALL nodes of the AST where as the other
121932 : // attribute based traversals visit only the embedded tree within the AST.
121933 :
121934 : // Initialize array to the address of the first element of the STL vector
121935 : // (which is guaranteed to be contiguous storage).
121936 : // SgElementwiseLeftDivideOp objectArray [] = *(Memory_Block_List.begin());
121937 5342 : if (SgElementwiseLeftDivideOp::pools.empty() == false)
121938 : {
121939 : // Generate an array of memory pools
121940 0 : SgElementwiseLeftDivideOp** objectArray = (SgElementwiseLeftDivideOp**) &(SgElementwiseLeftDivideOp::pools[0]);
121941 :
121942 : // Build a local variable for better performance
121943 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
121944 : #if 0
121945 : // Iterate over the memory pools
121946 : for (unsigned int i=0; i < SgElementwiseLeftDivideOp::pools.size(); i++)
121947 : {
121948 : // objectArray[i] is a single memory pool
121949 : for (int j=0; j < SgElementwiseLeftDivideOp::pool_size; j++)
121950 : {
121951 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
121952 : {
121953 : traversal.visit(&(objectArray[i][j]));
121954 : }
121955 : }
121956 : }
121957 : #else
121958 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
121959 : // compute the list first and then call the visit function on each list element.
121960 :
121961 : // printf ("Inside of SgElementwiseLeftDivideOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
121962 :
121963 0 : std::vector<SgElementwiseLeftDivideOp*> nodeList;
121964 :
121965 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
121966 0 : for (unsigned int i=0; i < SgElementwiseLeftDivideOp::pools.size(); i++)
121967 : {
121968 : // objectArray[i] is a single memory pool
121969 0 : for (unsigned j=0; j < SgElementwiseLeftDivideOp::pool_size; j++)
121970 : {
121971 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
121972 : {
121973 0 : nodeList.push_back(&(objectArray[i][j]));
121974 : }
121975 : }
121976 : }
121977 :
121978 : // Iterate over the saved list
121979 0 : size_t nodeListSize = nodeList.size();
121980 0 : for (size_t i=0; i < nodeListSize; i++)
121981 : {
121982 0 : ROSE_ASSERT(nodeList[i] != NULL);
121983 : #if 0
121984 : traversal.visit(nodeList[i]);
121985 : #else
121986 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
121987 : {
121988 0 : traversal.visit(nodeList[i]);
121989 : }
121990 : #endif
121991 : }
121992 : #endif
121993 : }
121994 :
121995 : // This should not be required since all previously static data members are
121996 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
121997 :
121998 5342 : }
121999 :
122000 :
122001 : void
122002 194 : SgElementwiseLeftDivideOp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
122003 : {
122004 : // This function traverses the memory pool for an IR node and
122005 : // calls the function to execute the visitor object.
122006 :
122007 : // Initialize array to the address of the first element of the STL vector
122008 : // (which is guarenteed to be contiguous storage).
122009 : // SgElementwiseLeftDivideOp objectArray [] = *(Memory_Block_List.begin());
122010 194 : if (SgElementwiseLeftDivideOp::pools.empty() == false)
122011 : {
122012 : // Generate an array of memory pools
122013 0 : SgElementwiseLeftDivideOp** objectArray = (SgElementwiseLeftDivideOp**) &(SgElementwiseLeftDivideOp::pools[0]);
122014 :
122015 : // Build a local variable for better performance
122016 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
122017 :
122018 : // Iterate over the memory pools
122019 0 : for (unsigned int i=0; i < SgElementwiseLeftDivideOp::pools.size(); i++)
122020 : {
122021 : // objectArray[i] is a single memory pool
122022 0 : for (unsigned j=0; j < SgElementwiseLeftDivideOp::pool_size; j++)
122023 : {
122024 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
122025 : {
122026 : // printf ("Found a valid SgElementwiseLeftDivideOp object in the memory pool %d at position %d \n",i,j);
122027 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
122028 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
122029 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
122030 : }
122031 : else
122032 : {
122033 : // printf ("Found a INVALID SgElementwiseLeftDivideOp object in the memory pool \n");
122034 : }
122035 : }
122036 : }
122037 : }
122038 :
122039 : // This should not be required since all previously static data members are
122040 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
122041 :
122042 194 : }
122043 :
122044 : void
122045 0 : SgElementwiseLeftDivideOp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
122046 : {
122047 : // This function visits only a single IR node of the memory pool.
122048 : // it is typically called once for each type of IR node within
122049 : // the automatically generated function: traverseRepresentativeNodes().
122050 :
122051 : // Initialize array to the address of the first element of the STL vector
122052 : // (which is guarenteed to be contiguous storage).
122053 : // SgElementwiseLeftDivideOp objectArray [] = *(Memory_Block_List.begin());
122054 0 : if (SgElementwiseLeftDivideOp::pools.empty() == false)
122055 : {
122056 : // Generate an array of memory pools
122057 0 : SgElementwiseLeftDivideOp** objectArray = (SgElementwiseLeftDivideOp**) &(SgElementwiseLeftDivideOp::pools[0]);
122058 :
122059 : // Build a local variable for better performance
122060 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
122061 :
122062 : // Iterate over the memory pools
122063 0 : bool done = false;
122064 0 : unsigned i=0;
122065 :
122066 : // find the first valid IR node, call visit function, and then leave
122067 0 : while ( done == false && i < SgElementwiseLeftDivideOp::pools.size() )
122068 : {
122069 : // objectArray[i] is a single memory pool
122070 : unsigned j=0;
122071 0 : while (done == false && j < SgElementwiseLeftDivideOp::pool_size)
122072 : {
122073 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
122074 : {
122075 0 : traversal.visit(&(objectArray[i][j]));
122076 0 : done = true;
122077 : }
122078 0 : j++;
122079 : }
122080 0 : i++;
122081 : }
122082 :
122083 : #if 0
122084 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
122085 : if (done == false)
122086 : {
122087 : printf ("No representative for SgElementwiseLeftDivideOp found in memory pools \n");
122088 : }
122089 : #endif
122090 : }
122091 0 : }
122092 :
122093 :
122094 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
122095 : // using values that overflow signed values of int.
122096 : size_t
122097 4 : SgElementwiseLeftDivideOp::numberOfNodes()
122098 : {
122099 : // This function traverses the memory pool for an IR node and
122100 : // counts the number of IR nodes of a particular Sage III IR
122101 : // nodes type.
122102 :
122103 4 : size_t count = 0;
122104 4 : if (SgElementwiseLeftDivideOp::pools.empty() == false)
122105 : {
122106 : // Generate an array of memory pools (this is actually a STL vector,
122107 : // but it is contiguious, so OK to treat this way).
122108 0 : SgElementwiseLeftDivideOp** objectArray = (SgElementwiseLeftDivideOp**) &(SgElementwiseLeftDivideOp::pools[0]);
122109 :
122110 : // Build a local variable for better performance (make it a loop invariant variable).
122111 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
122112 :
122113 : // Iterate over all of the memory pools for this IR node.
122114 0 : for (unsigned int i=0; i < SgElementwiseLeftDivideOp::pools.size(); i++)
122115 : {
122116 : // objectArray[i] is a single memory pool, iterate over all the
122117 : // IR nodes and only count those that are valid IR nodes used in
122118 : // the AST (i.e. allocated IR nodes).
122119 0 : for (unsigned j=0; j < SgElementwiseLeftDivideOp::pool_size; j++)
122120 : {
122121 : // This is indexing the STL vector of C/C++ style arrays as a doubly
122122 : // indexed array access. It is OK since we have leveraged the semantics
122123 : // of STL vector memory as contigous and cast the memory as an array
122124 : // of arrays to use the 2D array indexing. Hope this is not confusing,
122125 : // but it s very fast as an implementation.
122126 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
122127 : {
122128 0 : count++;
122129 : }
122130 : }
122131 : }
122132 : }
122133 :
122134 :
122135 :
122136 4 : return count;
122137 : }
122138 :
122139 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
122140 : // using values that overflow signed values of int.
122141 : size_t
122142 0 : SgElementwiseLeftDivideOp::memoryUsage()
122143 : {
122144 : // This function is required because we need the class name as a type when we call sizeof
122145 : // There might be another way to implement this if we have a traversal that only called a
122146 : // representative object (one call for each type of Sage IIIIR node).
122147 0 : size_t memory = numberOfNodes() * sizeof(SgElementwiseLeftDivideOp);
122148 :
122149 0 : return memory;
122150 : }
122151 :
122152 : /* #line 122153 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
122153 :
122154 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
122155 : void
122156 5342 : SgElementwiseDivideOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
122157 : {
122158 : // This function traverses the memory pool for only a specific IR node
122159 : // and calls the visit function of the input class execute a traversal
122160 : // similar to the style of the attribute based traversals within ROSE.
122161 : // This traversal will visit ALL nodes of the AST where as the other
122162 : // attribute based traversals visit only the embedded tree within the AST.
122163 :
122164 : // Initialize array to the address of the first element of the STL vector
122165 : // (which is guaranteed to be contiguous storage).
122166 : // SgElementwiseDivideOp objectArray [] = *(Memory_Block_List.begin());
122167 5342 : if (SgElementwiseDivideOp::pools.empty() == false)
122168 : {
122169 : // Generate an array of memory pools
122170 0 : SgElementwiseDivideOp** objectArray = (SgElementwiseDivideOp**) &(SgElementwiseDivideOp::pools[0]);
122171 :
122172 : // Build a local variable for better performance
122173 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
122174 : #if 0
122175 : // Iterate over the memory pools
122176 : for (unsigned int i=0; i < SgElementwiseDivideOp::pools.size(); i++)
122177 : {
122178 : // objectArray[i] is a single memory pool
122179 : for (int j=0; j < SgElementwiseDivideOp::pool_size; j++)
122180 : {
122181 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
122182 : {
122183 : traversal.visit(&(objectArray[i][j]));
122184 : }
122185 : }
122186 : }
122187 : #else
122188 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
122189 : // compute the list first and then call the visit function on each list element.
122190 :
122191 : // printf ("Inside of SgElementwiseDivideOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
122192 :
122193 0 : std::vector<SgElementwiseDivideOp*> nodeList;
122194 :
122195 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
122196 0 : for (unsigned int i=0; i < SgElementwiseDivideOp::pools.size(); i++)
122197 : {
122198 : // objectArray[i] is a single memory pool
122199 0 : for (unsigned j=0; j < SgElementwiseDivideOp::pool_size; j++)
122200 : {
122201 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
122202 : {
122203 0 : nodeList.push_back(&(objectArray[i][j]));
122204 : }
122205 : }
122206 : }
122207 :
122208 : // Iterate over the saved list
122209 0 : size_t nodeListSize = nodeList.size();
122210 0 : for (size_t i=0; i < nodeListSize; i++)
122211 : {
122212 0 : ROSE_ASSERT(nodeList[i] != NULL);
122213 : #if 0
122214 : traversal.visit(nodeList[i]);
122215 : #else
122216 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
122217 : {
122218 0 : traversal.visit(nodeList[i]);
122219 : }
122220 : #endif
122221 : }
122222 : #endif
122223 : }
122224 :
122225 : // This should not be required since all previously static data members are
122226 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
122227 :
122228 5342 : }
122229 :
122230 :
122231 : void
122232 194 : SgElementwiseDivideOp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
122233 : {
122234 : // This function traverses the memory pool for an IR node and
122235 : // calls the function to execute the visitor object.
122236 :
122237 : // Initialize array to the address of the first element of the STL vector
122238 : // (which is guarenteed to be contiguous storage).
122239 : // SgElementwiseDivideOp objectArray [] = *(Memory_Block_List.begin());
122240 194 : if (SgElementwiseDivideOp::pools.empty() == false)
122241 : {
122242 : // Generate an array of memory pools
122243 0 : SgElementwiseDivideOp** objectArray = (SgElementwiseDivideOp**) &(SgElementwiseDivideOp::pools[0]);
122244 :
122245 : // Build a local variable for better performance
122246 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
122247 :
122248 : // Iterate over the memory pools
122249 0 : for (unsigned int i=0; i < SgElementwiseDivideOp::pools.size(); i++)
122250 : {
122251 : // objectArray[i] is a single memory pool
122252 0 : for (unsigned j=0; j < SgElementwiseDivideOp::pool_size; j++)
122253 : {
122254 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
122255 : {
122256 : // printf ("Found a valid SgElementwiseDivideOp object in the memory pool %d at position %d \n",i,j);
122257 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
122258 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
122259 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
122260 : }
122261 : else
122262 : {
122263 : // printf ("Found a INVALID SgElementwiseDivideOp object in the memory pool \n");
122264 : }
122265 : }
122266 : }
122267 : }
122268 :
122269 : // This should not be required since all previously static data members are
122270 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
122271 :
122272 194 : }
122273 :
122274 : void
122275 0 : SgElementwiseDivideOp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
122276 : {
122277 : // This function visits only a single IR node of the memory pool.
122278 : // it is typically called once for each type of IR node within
122279 : // the automatically generated function: traverseRepresentativeNodes().
122280 :
122281 : // Initialize array to the address of the first element of the STL vector
122282 : // (which is guarenteed to be contiguous storage).
122283 : // SgElementwiseDivideOp objectArray [] = *(Memory_Block_List.begin());
122284 0 : if (SgElementwiseDivideOp::pools.empty() == false)
122285 : {
122286 : // Generate an array of memory pools
122287 0 : SgElementwiseDivideOp** objectArray = (SgElementwiseDivideOp**) &(SgElementwiseDivideOp::pools[0]);
122288 :
122289 : // Build a local variable for better performance
122290 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
122291 :
122292 : // Iterate over the memory pools
122293 0 : bool done = false;
122294 0 : unsigned i=0;
122295 :
122296 : // find the first valid IR node, call visit function, and then leave
122297 0 : while ( done == false && i < SgElementwiseDivideOp::pools.size() )
122298 : {
122299 : // objectArray[i] is a single memory pool
122300 : unsigned j=0;
122301 0 : while (done == false && j < SgElementwiseDivideOp::pool_size)
122302 : {
122303 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
122304 : {
122305 0 : traversal.visit(&(objectArray[i][j]));
122306 0 : done = true;
122307 : }
122308 0 : j++;
122309 : }
122310 0 : i++;
122311 : }
122312 :
122313 : #if 0
122314 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
122315 : if (done == false)
122316 : {
122317 : printf ("No representative for SgElementwiseDivideOp found in memory pools \n");
122318 : }
122319 : #endif
122320 : }
122321 0 : }
122322 :
122323 :
122324 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
122325 : // using values that overflow signed values of int.
122326 : size_t
122327 4 : SgElementwiseDivideOp::numberOfNodes()
122328 : {
122329 : // This function traverses the memory pool for an IR node and
122330 : // counts the number of IR nodes of a particular Sage III IR
122331 : // nodes type.
122332 :
122333 4 : size_t count = 0;
122334 4 : if (SgElementwiseDivideOp::pools.empty() == false)
122335 : {
122336 : // Generate an array of memory pools (this is actually a STL vector,
122337 : // but it is contiguious, so OK to treat this way).
122338 0 : SgElementwiseDivideOp** objectArray = (SgElementwiseDivideOp**) &(SgElementwiseDivideOp::pools[0]);
122339 :
122340 : // Build a local variable for better performance (make it a loop invariant variable).
122341 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
122342 :
122343 : // Iterate over all of the memory pools for this IR node.
122344 0 : for (unsigned int i=0; i < SgElementwiseDivideOp::pools.size(); i++)
122345 : {
122346 : // objectArray[i] is a single memory pool, iterate over all the
122347 : // IR nodes and only count those that are valid IR nodes used in
122348 : // the AST (i.e. allocated IR nodes).
122349 0 : for (unsigned j=0; j < SgElementwiseDivideOp::pool_size; j++)
122350 : {
122351 : // This is indexing the STL vector of C/C++ style arrays as a doubly
122352 : // indexed array access. It is OK since we have leveraged the semantics
122353 : // of STL vector memory as contigous and cast the memory as an array
122354 : // of arrays to use the 2D array indexing. Hope this is not confusing,
122355 : // but it s very fast as an implementation.
122356 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
122357 : {
122358 0 : count++;
122359 : }
122360 : }
122361 : }
122362 : }
122363 :
122364 :
122365 :
122366 4 : return count;
122367 : }
122368 :
122369 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
122370 : // using values that overflow signed values of int.
122371 : size_t
122372 0 : SgElementwiseDivideOp::memoryUsage()
122373 : {
122374 : // This function is required because we need the class name as a type when we call sizeof
122375 : // There might be another way to implement this if we have a traversal that only called a
122376 : // representative object (one call for each type of Sage IIIIR node).
122377 0 : size_t memory = numberOfNodes() * sizeof(SgElementwiseDivideOp);
122378 :
122379 0 : return memory;
122380 : }
122381 :
122382 : /* #line 122383 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
122383 :
122384 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
122385 : void
122386 5342 : SgElementwiseAddOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
122387 : {
122388 : // This function traverses the memory pool for only a specific IR node
122389 : // and calls the visit function of the input class execute a traversal
122390 : // similar to the style of the attribute based traversals within ROSE.
122391 : // This traversal will visit ALL nodes of the AST where as the other
122392 : // attribute based traversals visit only the embedded tree within the AST.
122393 :
122394 : // Initialize array to the address of the first element of the STL vector
122395 : // (which is guaranteed to be contiguous storage).
122396 : // SgElementwiseAddOp objectArray [] = *(Memory_Block_List.begin());
122397 5342 : if (SgElementwiseAddOp::pools.empty() == false)
122398 : {
122399 : // Generate an array of memory pools
122400 0 : SgElementwiseAddOp** objectArray = (SgElementwiseAddOp**) &(SgElementwiseAddOp::pools[0]);
122401 :
122402 : // Build a local variable for better performance
122403 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
122404 : #if 0
122405 : // Iterate over the memory pools
122406 : for (unsigned int i=0; i < SgElementwiseAddOp::pools.size(); i++)
122407 : {
122408 : // objectArray[i] is a single memory pool
122409 : for (int j=0; j < SgElementwiseAddOp::pool_size; j++)
122410 : {
122411 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
122412 : {
122413 : traversal.visit(&(objectArray[i][j]));
122414 : }
122415 : }
122416 : }
122417 : #else
122418 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
122419 : // compute the list first and then call the visit function on each list element.
122420 :
122421 : // printf ("Inside of SgElementwiseAddOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
122422 :
122423 0 : std::vector<SgElementwiseAddOp*> nodeList;
122424 :
122425 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
122426 0 : for (unsigned int i=0; i < SgElementwiseAddOp::pools.size(); i++)
122427 : {
122428 : // objectArray[i] is a single memory pool
122429 0 : for (unsigned j=0; j < SgElementwiseAddOp::pool_size; j++)
122430 : {
122431 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
122432 : {
122433 0 : nodeList.push_back(&(objectArray[i][j]));
122434 : }
122435 : }
122436 : }
122437 :
122438 : // Iterate over the saved list
122439 0 : size_t nodeListSize = nodeList.size();
122440 0 : for (size_t i=0; i < nodeListSize; i++)
122441 : {
122442 0 : ROSE_ASSERT(nodeList[i] != NULL);
122443 : #if 0
122444 : traversal.visit(nodeList[i]);
122445 : #else
122446 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
122447 : {
122448 0 : traversal.visit(nodeList[i]);
122449 : }
122450 : #endif
122451 : }
122452 : #endif
122453 : }
122454 :
122455 : // This should not be required since all previously static data members are
122456 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
122457 :
122458 5342 : }
122459 :
122460 :
122461 : void
122462 194 : SgElementwiseAddOp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
122463 : {
122464 : // This function traverses the memory pool for an IR node and
122465 : // calls the function to execute the visitor object.
122466 :
122467 : // Initialize array to the address of the first element of the STL vector
122468 : // (which is guarenteed to be contiguous storage).
122469 : // SgElementwiseAddOp objectArray [] = *(Memory_Block_List.begin());
122470 194 : if (SgElementwiseAddOp::pools.empty() == false)
122471 : {
122472 : // Generate an array of memory pools
122473 0 : SgElementwiseAddOp** objectArray = (SgElementwiseAddOp**) &(SgElementwiseAddOp::pools[0]);
122474 :
122475 : // Build a local variable for better performance
122476 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
122477 :
122478 : // Iterate over the memory pools
122479 0 : for (unsigned int i=0; i < SgElementwiseAddOp::pools.size(); i++)
122480 : {
122481 : // objectArray[i] is a single memory pool
122482 0 : for (unsigned j=0; j < SgElementwiseAddOp::pool_size; j++)
122483 : {
122484 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
122485 : {
122486 : // printf ("Found a valid SgElementwiseAddOp object in the memory pool %d at position %d \n",i,j);
122487 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
122488 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
122489 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
122490 : }
122491 : else
122492 : {
122493 : // printf ("Found a INVALID SgElementwiseAddOp object in the memory pool \n");
122494 : }
122495 : }
122496 : }
122497 : }
122498 :
122499 : // This should not be required since all previously static data members are
122500 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
122501 :
122502 194 : }
122503 :
122504 : void
122505 0 : SgElementwiseAddOp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
122506 : {
122507 : // This function visits only a single IR node of the memory pool.
122508 : // it is typically called once for each type of IR node within
122509 : // the automatically generated function: traverseRepresentativeNodes().
122510 :
122511 : // Initialize array to the address of the first element of the STL vector
122512 : // (which is guarenteed to be contiguous storage).
122513 : // SgElementwiseAddOp objectArray [] = *(Memory_Block_List.begin());
122514 0 : if (SgElementwiseAddOp::pools.empty() == false)
122515 : {
122516 : // Generate an array of memory pools
122517 0 : SgElementwiseAddOp** objectArray = (SgElementwiseAddOp**) &(SgElementwiseAddOp::pools[0]);
122518 :
122519 : // Build a local variable for better performance
122520 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
122521 :
122522 : // Iterate over the memory pools
122523 0 : bool done = false;
122524 0 : unsigned i=0;
122525 :
122526 : // find the first valid IR node, call visit function, and then leave
122527 0 : while ( done == false && i < SgElementwiseAddOp::pools.size() )
122528 : {
122529 : // objectArray[i] is a single memory pool
122530 : unsigned j=0;
122531 0 : while (done == false && j < SgElementwiseAddOp::pool_size)
122532 : {
122533 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
122534 : {
122535 0 : traversal.visit(&(objectArray[i][j]));
122536 0 : done = true;
122537 : }
122538 0 : j++;
122539 : }
122540 0 : i++;
122541 : }
122542 :
122543 : #if 0
122544 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
122545 : if (done == false)
122546 : {
122547 : printf ("No representative for SgElementwiseAddOp found in memory pools \n");
122548 : }
122549 : #endif
122550 : }
122551 0 : }
122552 :
122553 :
122554 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
122555 : // using values that overflow signed values of int.
122556 : size_t
122557 4 : SgElementwiseAddOp::numberOfNodes()
122558 : {
122559 : // This function traverses the memory pool for an IR node and
122560 : // counts the number of IR nodes of a particular Sage III IR
122561 : // nodes type.
122562 :
122563 4 : size_t count = 0;
122564 4 : if (SgElementwiseAddOp::pools.empty() == false)
122565 : {
122566 : // Generate an array of memory pools (this is actually a STL vector,
122567 : // but it is contiguious, so OK to treat this way).
122568 0 : SgElementwiseAddOp** objectArray = (SgElementwiseAddOp**) &(SgElementwiseAddOp::pools[0]);
122569 :
122570 : // Build a local variable for better performance (make it a loop invariant variable).
122571 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
122572 :
122573 : // Iterate over all of the memory pools for this IR node.
122574 0 : for (unsigned int i=0; i < SgElementwiseAddOp::pools.size(); i++)
122575 : {
122576 : // objectArray[i] is a single memory pool, iterate over all the
122577 : // IR nodes and only count those that are valid IR nodes used in
122578 : // the AST (i.e. allocated IR nodes).
122579 0 : for (unsigned j=0; j < SgElementwiseAddOp::pool_size; j++)
122580 : {
122581 : // This is indexing the STL vector of C/C++ style arrays as a doubly
122582 : // indexed array access. It is OK since we have leveraged the semantics
122583 : // of STL vector memory as contigous and cast the memory as an array
122584 : // of arrays to use the 2D array indexing. Hope this is not confusing,
122585 : // but it s very fast as an implementation.
122586 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
122587 : {
122588 0 : count++;
122589 : }
122590 : }
122591 : }
122592 : }
122593 :
122594 :
122595 :
122596 4 : return count;
122597 : }
122598 :
122599 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
122600 : // using values that overflow signed values of int.
122601 : size_t
122602 0 : SgElementwiseAddOp::memoryUsage()
122603 : {
122604 : // This function is required because we need the class name as a type when we call sizeof
122605 : // There might be another way to implement this if we have a traversal that only called a
122606 : // representative object (one call for each type of Sage IIIIR node).
122607 0 : size_t memory = numberOfNodes() * sizeof(SgElementwiseAddOp);
122608 :
122609 0 : return memory;
122610 : }
122611 :
122612 : /* #line 122613 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
122613 :
122614 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
122615 : void
122616 5342 : SgElementwiseSubtractOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
122617 : {
122618 : // This function traverses the memory pool for only a specific IR node
122619 : // and calls the visit function of the input class execute a traversal
122620 : // similar to the style of the attribute based traversals within ROSE.
122621 : // This traversal will visit ALL nodes of the AST where as the other
122622 : // attribute based traversals visit only the embedded tree within the AST.
122623 :
122624 : // Initialize array to the address of the first element of the STL vector
122625 : // (which is guaranteed to be contiguous storage).
122626 : // SgElementwiseSubtractOp objectArray [] = *(Memory_Block_List.begin());
122627 5342 : if (SgElementwiseSubtractOp::pools.empty() == false)
122628 : {
122629 : // Generate an array of memory pools
122630 0 : SgElementwiseSubtractOp** objectArray = (SgElementwiseSubtractOp**) &(SgElementwiseSubtractOp::pools[0]);
122631 :
122632 : // Build a local variable for better performance
122633 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
122634 : #if 0
122635 : // Iterate over the memory pools
122636 : for (unsigned int i=0; i < SgElementwiseSubtractOp::pools.size(); i++)
122637 : {
122638 : // objectArray[i] is a single memory pool
122639 : for (int j=0; j < SgElementwiseSubtractOp::pool_size; j++)
122640 : {
122641 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
122642 : {
122643 : traversal.visit(&(objectArray[i][j]));
122644 : }
122645 : }
122646 : }
122647 : #else
122648 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
122649 : // compute the list first and then call the visit function on each list element.
122650 :
122651 : // printf ("Inside of SgElementwiseSubtractOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
122652 :
122653 0 : std::vector<SgElementwiseSubtractOp*> nodeList;
122654 :
122655 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
122656 0 : for (unsigned int i=0; i < SgElementwiseSubtractOp::pools.size(); i++)
122657 : {
122658 : // objectArray[i] is a single memory pool
122659 0 : for (unsigned j=0; j < SgElementwiseSubtractOp::pool_size; j++)
122660 : {
122661 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
122662 : {
122663 0 : nodeList.push_back(&(objectArray[i][j]));
122664 : }
122665 : }
122666 : }
122667 :
122668 : // Iterate over the saved list
122669 0 : size_t nodeListSize = nodeList.size();
122670 0 : for (size_t i=0; i < nodeListSize; i++)
122671 : {
122672 0 : ROSE_ASSERT(nodeList[i] != NULL);
122673 : #if 0
122674 : traversal.visit(nodeList[i]);
122675 : #else
122676 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
122677 : {
122678 0 : traversal.visit(nodeList[i]);
122679 : }
122680 : #endif
122681 : }
122682 : #endif
122683 : }
122684 :
122685 : // This should not be required since all previously static data members are
122686 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
122687 :
122688 5342 : }
122689 :
122690 :
122691 : void
122692 194 : SgElementwiseSubtractOp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
122693 : {
122694 : // This function traverses the memory pool for an IR node and
122695 : // calls the function to execute the visitor object.
122696 :
122697 : // Initialize array to the address of the first element of the STL vector
122698 : // (which is guarenteed to be contiguous storage).
122699 : // SgElementwiseSubtractOp objectArray [] = *(Memory_Block_List.begin());
122700 194 : if (SgElementwiseSubtractOp::pools.empty() == false)
122701 : {
122702 : // Generate an array of memory pools
122703 0 : SgElementwiseSubtractOp** objectArray = (SgElementwiseSubtractOp**) &(SgElementwiseSubtractOp::pools[0]);
122704 :
122705 : // Build a local variable for better performance
122706 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
122707 :
122708 : // Iterate over the memory pools
122709 0 : for (unsigned int i=0; i < SgElementwiseSubtractOp::pools.size(); i++)
122710 : {
122711 : // objectArray[i] is a single memory pool
122712 0 : for (unsigned j=0; j < SgElementwiseSubtractOp::pool_size; j++)
122713 : {
122714 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
122715 : {
122716 : // printf ("Found a valid SgElementwiseSubtractOp object in the memory pool %d at position %d \n",i,j);
122717 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
122718 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
122719 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
122720 : }
122721 : else
122722 : {
122723 : // printf ("Found a INVALID SgElementwiseSubtractOp object in the memory pool \n");
122724 : }
122725 : }
122726 : }
122727 : }
122728 :
122729 : // This should not be required since all previously static data members are
122730 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
122731 :
122732 194 : }
122733 :
122734 : void
122735 0 : SgElementwiseSubtractOp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
122736 : {
122737 : // This function visits only a single IR node of the memory pool.
122738 : // it is typically called once for each type of IR node within
122739 : // the automatically generated function: traverseRepresentativeNodes().
122740 :
122741 : // Initialize array to the address of the first element of the STL vector
122742 : // (which is guarenteed to be contiguous storage).
122743 : // SgElementwiseSubtractOp objectArray [] = *(Memory_Block_List.begin());
122744 0 : if (SgElementwiseSubtractOp::pools.empty() == false)
122745 : {
122746 : // Generate an array of memory pools
122747 0 : SgElementwiseSubtractOp** objectArray = (SgElementwiseSubtractOp**) &(SgElementwiseSubtractOp::pools[0]);
122748 :
122749 : // Build a local variable for better performance
122750 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
122751 :
122752 : // Iterate over the memory pools
122753 0 : bool done = false;
122754 0 : unsigned i=0;
122755 :
122756 : // find the first valid IR node, call visit function, and then leave
122757 0 : while ( done == false && i < SgElementwiseSubtractOp::pools.size() )
122758 : {
122759 : // objectArray[i] is a single memory pool
122760 : unsigned j=0;
122761 0 : while (done == false && j < SgElementwiseSubtractOp::pool_size)
122762 : {
122763 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
122764 : {
122765 0 : traversal.visit(&(objectArray[i][j]));
122766 0 : done = true;
122767 : }
122768 0 : j++;
122769 : }
122770 0 : i++;
122771 : }
122772 :
122773 : #if 0
122774 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
122775 : if (done == false)
122776 : {
122777 : printf ("No representative for SgElementwiseSubtractOp found in memory pools \n");
122778 : }
122779 : #endif
122780 : }
122781 0 : }
122782 :
122783 :
122784 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
122785 : // using values that overflow signed values of int.
122786 : size_t
122787 4 : SgElementwiseSubtractOp::numberOfNodes()
122788 : {
122789 : // This function traverses the memory pool for an IR node and
122790 : // counts the number of IR nodes of a particular Sage III IR
122791 : // nodes type.
122792 :
122793 4 : size_t count = 0;
122794 4 : if (SgElementwiseSubtractOp::pools.empty() == false)
122795 : {
122796 : // Generate an array of memory pools (this is actually a STL vector,
122797 : // but it is contiguious, so OK to treat this way).
122798 0 : SgElementwiseSubtractOp** objectArray = (SgElementwiseSubtractOp**) &(SgElementwiseSubtractOp::pools[0]);
122799 :
122800 : // Build a local variable for better performance (make it a loop invariant variable).
122801 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
122802 :
122803 : // Iterate over all of the memory pools for this IR node.
122804 0 : for (unsigned int i=0; i < SgElementwiseSubtractOp::pools.size(); i++)
122805 : {
122806 : // objectArray[i] is a single memory pool, iterate over all the
122807 : // IR nodes and only count those that are valid IR nodes used in
122808 : // the AST (i.e. allocated IR nodes).
122809 0 : for (unsigned j=0; j < SgElementwiseSubtractOp::pool_size; j++)
122810 : {
122811 : // This is indexing the STL vector of C/C++ style arrays as a doubly
122812 : // indexed array access. It is OK since we have leveraged the semantics
122813 : // of STL vector memory as contigous and cast the memory as an array
122814 : // of arrays to use the 2D array indexing. Hope this is not confusing,
122815 : // but it s very fast as an implementation.
122816 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
122817 : {
122818 0 : count++;
122819 : }
122820 : }
122821 : }
122822 : }
122823 :
122824 :
122825 :
122826 4 : return count;
122827 : }
122828 :
122829 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
122830 : // using values that overflow signed values of int.
122831 : size_t
122832 0 : SgElementwiseSubtractOp::memoryUsage()
122833 : {
122834 : // This function is required because we need the class name as a type when we call sizeof
122835 : // There might be another way to implement this if we have a traversal that only called a
122836 : // representative object (one call for each type of Sage IIIIR node).
122837 0 : size_t memory = numberOfNodes() * sizeof(SgElementwiseSubtractOp);
122838 :
122839 0 : return memory;
122840 : }
122841 :
122842 : /* #line 122843 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
122843 :
122844 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
122845 : void
122846 5342 : SgPowerOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
122847 : {
122848 : // This function traverses the memory pool for only a specific IR node
122849 : // and calls the visit function of the input class execute a traversal
122850 : // similar to the style of the attribute based traversals within ROSE.
122851 : // This traversal will visit ALL nodes of the AST where as the other
122852 : // attribute based traversals visit only the embedded tree within the AST.
122853 :
122854 : // Initialize array to the address of the first element of the STL vector
122855 : // (which is guaranteed to be contiguous storage).
122856 : // SgPowerOp objectArray [] = *(Memory_Block_List.begin());
122857 5342 : if (SgPowerOp::pools.empty() == false)
122858 : {
122859 : // Generate an array of memory pools
122860 0 : SgPowerOp** objectArray = (SgPowerOp**) &(SgPowerOp::pools[0]);
122861 :
122862 : // Build a local variable for better performance
122863 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
122864 : #if 0
122865 : // Iterate over the memory pools
122866 : for (unsigned int i=0; i < SgPowerOp::pools.size(); i++)
122867 : {
122868 : // objectArray[i] is a single memory pool
122869 : for (int j=0; j < SgPowerOp::pool_size; j++)
122870 : {
122871 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
122872 : {
122873 : traversal.visit(&(objectArray[i][j]));
122874 : }
122875 : }
122876 : }
122877 : #else
122878 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
122879 : // compute the list first and then call the visit function on each list element.
122880 :
122881 : // printf ("Inside of SgPowerOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
122882 :
122883 0 : std::vector<SgPowerOp*> nodeList;
122884 :
122885 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
122886 0 : for (unsigned int i=0; i < SgPowerOp::pools.size(); i++)
122887 : {
122888 : // objectArray[i] is a single memory pool
122889 0 : for (unsigned j=0; j < SgPowerOp::pool_size; j++)
122890 : {
122891 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
122892 : {
122893 0 : nodeList.push_back(&(objectArray[i][j]));
122894 : }
122895 : }
122896 : }
122897 :
122898 : // Iterate over the saved list
122899 0 : size_t nodeListSize = nodeList.size();
122900 0 : for (size_t i=0; i < nodeListSize; i++)
122901 : {
122902 0 : ROSE_ASSERT(nodeList[i] != NULL);
122903 : #if 0
122904 : traversal.visit(nodeList[i]);
122905 : #else
122906 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
122907 : {
122908 0 : traversal.visit(nodeList[i]);
122909 : }
122910 : #endif
122911 : }
122912 : #endif
122913 : }
122914 :
122915 : // This should not be required since all previously static data members are
122916 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
122917 :
122918 5342 : }
122919 :
122920 :
122921 : void
122922 194 : SgPowerOp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
122923 : {
122924 : // This function traverses the memory pool for an IR node and
122925 : // calls the function to execute the visitor object.
122926 :
122927 : // Initialize array to the address of the first element of the STL vector
122928 : // (which is guarenteed to be contiguous storage).
122929 : // SgPowerOp objectArray [] = *(Memory_Block_List.begin());
122930 194 : if (SgPowerOp::pools.empty() == false)
122931 : {
122932 : // Generate an array of memory pools
122933 0 : SgPowerOp** objectArray = (SgPowerOp**) &(SgPowerOp::pools[0]);
122934 :
122935 : // Build a local variable for better performance
122936 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
122937 :
122938 : // Iterate over the memory pools
122939 0 : for (unsigned int i=0; i < SgPowerOp::pools.size(); i++)
122940 : {
122941 : // objectArray[i] is a single memory pool
122942 0 : for (unsigned j=0; j < SgPowerOp::pool_size; j++)
122943 : {
122944 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
122945 : {
122946 : // printf ("Found a valid SgPowerOp object in the memory pool %d at position %d \n",i,j);
122947 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
122948 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
122949 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
122950 : }
122951 : else
122952 : {
122953 : // printf ("Found a INVALID SgPowerOp object in the memory pool \n");
122954 : }
122955 : }
122956 : }
122957 : }
122958 :
122959 : // This should not be required since all previously static data members are
122960 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
122961 :
122962 194 : }
122963 :
122964 : void
122965 0 : SgPowerOp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
122966 : {
122967 : // This function visits only a single IR node of the memory pool.
122968 : // it is typically called once for each type of IR node within
122969 : // the automatically generated function: traverseRepresentativeNodes().
122970 :
122971 : // Initialize array to the address of the first element of the STL vector
122972 : // (which is guarenteed to be contiguous storage).
122973 : // SgPowerOp objectArray [] = *(Memory_Block_List.begin());
122974 0 : if (SgPowerOp::pools.empty() == false)
122975 : {
122976 : // Generate an array of memory pools
122977 0 : SgPowerOp** objectArray = (SgPowerOp**) &(SgPowerOp::pools[0]);
122978 :
122979 : // Build a local variable for better performance
122980 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
122981 :
122982 : // Iterate over the memory pools
122983 0 : bool done = false;
122984 0 : unsigned i=0;
122985 :
122986 : // find the first valid IR node, call visit function, and then leave
122987 0 : while ( done == false && i < SgPowerOp::pools.size() )
122988 : {
122989 : // objectArray[i] is a single memory pool
122990 : unsigned j=0;
122991 0 : while (done == false && j < SgPowerOp::pool_size)
122992 : {
122993 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
122994 : {
122995 0 : traversal.visit(&(objectArray[i][j]));
122996 0 : done = true;
122997 : }
122998 0 : j++;
122999 : }
123000 0 : i++;
123001 : }
123002 :
123003 : #if 0
123004 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
123005 : if (done == false)
123006 : {
123007 : printf ("No representative for SgPowerOp found in memory pools \n");
123008 : }
123009 : #endif
123010 : }
123011 0 : }
123012 :
123013 :
123014 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
123015 : // using values that overflow signed values of int.
123016 : size_t
123017 4 : SgPowerOp::numberOfNodes()
123018 : {
123019 : // This function traverses the memory pool for an IR node and
123020 : // counts the number of IR nodes of a particular Sage III IR
123021 : // nodes type.
123022 :
123023 4 : size_t count = 0;
123024 4 : if (SgPowerOp::pools.empty() == false)
123025 : {
123026 : // Generate an array of memory pools (this is actually a STL vector,
123027 : // but it is contiguious, so OK to treat this way).
123028 0 : SgPowerOp** objectArray = (SgPowerOp**) &(SgPowerOp::pools[0]);
123029 :
123030 : // Build a local variable for better performance (make it a loop invariant variable).
123031 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
123032 :
123033 : // Iterate over all of the memory pools for this IR node.
123034 0 : for (unsigned int i=0; i < SgPowerOp::pools.size(); i++)
123035 : {
123036 : // objectArray[i] is a single memory pool, iterate over all the
123037 : // IR nodes and only count those that are valid IR nodes used in
123038 : // the AST (i.e. allocated IR nodes).
123039 0 : for (unsigned j=0; j < SgPowerOp::pool_size; j++)
123040 : {
123041 : // This is indexing the STL vector of C/C++ style arrays as a doubly
123042 : // indexed array access. It is OK since we have leveraged the semantics
123043 : // of STL vector memory as contigous and cast the memory as an array
123044 : // of arrays to use the 2D array indexing. Hope this is not confusing,
123045 : // but it s very fast as an implementation.
123046 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
123047 : {
123048 0 : count++;
123049 : }
123050 : }
123051 : }
123052 : }
123053 :
123054 :
123055 :
123056 4 : return count;
123057 : }
123058 :
123059 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
123060 : // using values that overflow signed values of int.
123061 : size_t
123062 0 : SgPowerOp::memoryUsage()
123063 : {
123064 : // This function is required because we need the class name as a type when we call sizeof
123065 : // There might be another way to implement this if we have a traversal that only called a
123066 : // representative object (one call for each type of Sage IIIIR node).
123067 0 : size_t memory = numberOfNodes() * sizeof(SgPowerOp);
123068 :
123069 0 : return memory;
123070 : }
123071 :
123072 : /* #line 123073 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
123073 :
123074 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
123075 : void
123076 5342 : SgLeftDivideOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
123077 : {
123078 : // This function traverses the memory pool for only a specific IR node
123079 : // and calls the visit function of the input class execute a traversal
123080 : // similar to the style of the attribute based traversals within ROSE.
123081 : // This traversal will visit ALL nodes of the AST where as the other
123082 : // attribute based traversals visit only the embedded tree within the AST.
123083 :
123084 : // Initialize array to the address of the first element of the STL vector
123085 : // (which is guaranteed to be contiguous storage).
123086 : // SgLeftDivideOp objectArray [] = *(Memory_Block_List.begin());
123087 5342 : if (SgLeftDivideOp::pools.empty() == false)
123088 : {
123089 : // Generate an array of memory pools
123090 0 : SgLeftDivideOp** objectArray = (SgLeftDivideOp**) &(SgLeftDivideOp::pools[0]);
123091 :
123092 : // Build a local variable for better performance
123093 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
123094 : #if 0
123095 : // Iterate over the memory pools
123096 : for (unsigned int i=0; i < SgLeftDivideOp::pools.size(); i++)
123097 : {
123098 : // objectArray[i] is a single memory pool
123099 : for (int j=0; j < SgLeftDivideOp::pool_size; j++)
123100 : {
123101 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
123102 : {
123103 : traversal.visit(&(objectArray[i][j]));
123104 : }
123105 : }
123106 : }
123107 : #else
123108 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
123109 : // compute the list first and then call the visit function on each list element.
123110 :
123111 : // printf ("Inside of SgLeftDivideOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
123112 :
123113 0 : std::vector<SgLeftDivideOp*> nodeList;
123114 :
123115 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
123116 0 : for (unsigned int i=0; i < SgLeftDivideOp::pools.size(); i++)
123117 : {
123118 : // objectArray[i] is a single memory pool
123119 0 : for (unsigned j=0; j < SgLeftDivideOp::pool_size; j++)
123120 : {
123121 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
123122 : {
123123 0 : nodeList.push_back(&(objectArray[i][j]));
123124 : }
123125 : }
123126 : }
123127 :
123128 : // Iterate over the saved list
123129 0 : size_t nodeListSize = nodeList.size();
123130 0 : for (size_t i=0; i < nodeListSize; i++)
123131 : {
123132 0 : ROSE_ASSERT(nodeList[i] != NULL);
123133 : #if 0
123134 : traversal.visit(nodeList[i]);
123135 : #else
123136 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
123137 : {
123138 0 : traversal.visit(nodeList[i]);
123139 : }
123140 : #endif
123141 : }
123142 : #endif
123143 : }
123144 :
123145 : // This should not be required since all previously static data members are
123146 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
123147 :
123148 5342 : }
123149 :
123150 :
123151 : void
123152 194 : SgLeftDivideOp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
123153 : {
123154 : // This function traverses the memory pool for an IR node and
123155 : // calls the function to execute the visitor object.
123156 :
123157 : // Initialize array to the address of the first element of the STL vector
123158 : // (which is guarenteed to be contiguous storage).
123159 : // SgLeftDivideOp objectArray [] = *(Memory_Block_List.begin());
123160 194 : if (SgLeftDivideOp::pools.empty() == false)
123161 : {
123162 : // Generate an array of memory pools
123163 0 : SgLeftDivideOp** objectArray = (SgLeftDivideOp**) &(SgLeftDivideOp::pools[0]);
123164 :
123165 : // Build a local variable for better performance
123166 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
123167 :
123168 : // Iterate over the memory pools
123169 0 : for (unsigned int i=0; i < SgLeftDivideOp::pools.size(); i++)
123170 : {
123171 : // objectArray[i] is a single memory pool
123172 0 : for (unsigned j=0; j < SgLeftDivideOp::pool_size; j++)
123173 : {
123174 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
123175 : {
123176 : // printf ("Found a valid SgLeftDivideOp object in the memory pool %d at position %d \n",i,j);
123177 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
123178 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
123179 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
123180 : }
123181 : else
123182 : {
123183 : // printf ("Found a INVALID SgLeftDivideOp object in the memory pool \n");
123184 : }
123185 : }
123186 : }
123187 : }
123188 :
123189 : // This should not be required since all previously static data members are
123190 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
123191 :
123192 194 : }
123193 :
123194 : void
123195 0 : SgLeftDivideOp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
123196 : {
123197 : // This function visits only a single IR node of the memory pool.
123198 : // it is typically called once for each type of IR node within
123199 : // the automatically generated function: traverseRepresentativeNodes().
123200 :
123201 : // Initialize array to the address of the first element of the STL vector
123202 : // (which is guarenteed to be contiguous storage).
123203 : // SgLeftDivideOp objectArray [] = *(Memory_Block_List.begin());
123204 0 : if (SgLeftDivideOp::pools.empty() == false)
123205 : {
123206 : // Generate an array of memory pools
123207 0 : SgLeftDivideOp** objectArray = (SgLeftDivideOp**) &(SgLeftDivideOp::pools[0]);
123208 :
123209 : // Build a local variable for better performance
123210 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
123211 :
123212 : // Iterate over the memory pools
123213 0 : bool done = false;
123214 0 : unsigned i=0;
123215 :
123216 : // find the first valid IR node, call visit function, and then leave
123217 0 : while ( done == false && i < SgLeftDivideOp::pools.size() )
123218 : {
123219 : // objectArray[i] is a single memory pool
123220 : unsigned j=0;
123221 0 : while (done == false && j < SgLeftDivideOp::pool_size)
123222 : {
123223 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
123224 : {
123225 0 : traversal.visit(&(objectArray[i][j]));
123226 0 : done = true;
123227 : }
123228 0 : j++;
123229 : }
123230 0 : i++;
123231 : }
123232 :
123233 : #if 0
123234 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
123235 : if (done == false)
123236 : {
123237 : printf ("No representative for SgLeftDivideOp found in memory pools \n");
123238 : }
123239 : #endif
123240 : }
123241 0 : }
123242 :
123243 :
123244 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
123245 : // using values that overflow signed values of int.
123246 : size_t
123247 4 : SgLeftDivideOp::numberOfNodes()
123248 : {
123249 : // This function traverses the memory pool for an IR node and
123250 : // counts the number of IR nodes of a particular Sage III IR
123251 : // nodes type.
123252 :
123253 4 : size_t count = 0;
123254 4 : if (SgLeftDivideOp::pools.empty() == false)
123255 : {
123256 : // Generate an array of memory pools (this is actually a STL vector,
123257 : // but it is contiguious, so OK to treat this way).
123258 0 : SgLeftDivideOp** objectArray = (SgLeftDivideOp**) &(SgLeftDivideOp::pools[0]);
123259 :
123260 : // Build a local variable for better performance (make it a loop invariant variable).
123261 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
123262 :
123263 : // Iterate over all of the memory pools for this IR node.
123264 0 : for (unsigned int i=0; i < SgLeftDivideOp::pools.size(); i++)
123265 : {
123266 : // objectArray[i] is a single memory pool, iterate over all the
123267 : // IR nodes and only count those that are valid IR nodes used in
123268 : // the AST (i.e. allocated IR nodes).
123269 0 : for (unsigned j=0; j < SgLeftDivideOp::pool_size; j++)
123270 : {
123271 : // This is indexing the STL vector of C/C++ style arrays as a doubly
123272 : // indexed array access. It is OK since we have leveraged the semantics
123273 : // of STL vector memory as contigous and cast the memory as an array
123274 : // of arrays to use the 2D array indexing. Hope this is not confusing,
123275 : // but it s very fast as an implementation.
123276 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
123277 : {
123278 0 : count++;
123279 : }
123280 : }
123281 : }
123282 : }
123283 :
123284 :
123285 :
123286 4 : return count;
123287 : }
123288 :
123289 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
123290 : // using values that overflow signed values of int.
123291 : size_t
123292 0 : SgLeftDivideOp::memoryUsage()
123293 : {
123294 : // This function is required because we need the class name as a type when we call sizeof
123295 : // There might be another way to implement this if we have a traversal that only called a
123296 : // representative object (one call for each type of Sage IIIIR node).
123297 0 : size_t memory = numberOfNodes() * sizeof(SgLeftDivideOp);
123298 :
123299 0 : return memory;
123300 : }
123301 :
123302 : /* #line 123303 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
123303 :
123304 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
123305 : void
123306 5342 : SgSIMDBinaryOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
123307 : {
123308 : // This function traverses the memory pool for only a specific IR node
123309 : // and calls the visit function of the input class execute a traversal
123310 : // similar to the style of the attribute based traversals within ROSE.
123311 : // This traversal will visit ALL nodes of the AST where as the other
123312 : // attribute based traversals visit only the embedded tree within the AST.
123313 :
123314 : // Initialize array to the address of the first element of the STL vector
123315 : // (which is guaranteed to be contiguous storage).
123316 : // SgSIMDBinaryOp objectArray [] = *(Memory_Block_List.begin());
123317 5342 : if (SgSIMDBinaryOp::pools.empty() == false)
123318 : {
123319 : // Generate an array of memory pools
123320 0 : SgSIMDBinaryOp** objectArray = (SgSIMDBinaryOp**) &(SgSIMDBinaryOp::pools[0]);
123321 :
123322 : // Build a local variable for better performance
123323 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
123324 : #if 0
123325 : // Iterate over the memory pools
123326 : for (unsigned int i=0; i < SgSIMDBinaryOp::pools.size(); i++)
123327 : {
123328 : // objectArray[i] is a single memory pool
123329 : for (int j=0; j < SgSIMDBinaryOp::pool_size; j++)
123330 : {
123331 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
123332 : {
123333 : traversal.visit(&(objectArray[i][j]));
123334 : }
123335 : }
123336 : }
123337 : #else
123338 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
123339 : // compute the list first and then call the visit function on each list element.
123340 :
123341 : // printf ("Inside of SgSIMDBinaryOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
123342 :
123343 0 : std::vector<SgSIMDBinaryOp*> nodeList;
123344 :
123345 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
123346 0 : for (unsigned int i=0; i < SgSIMDBinaryOp::pools.size(); i++)
123347 : {
123348 : // objectArray[i] is a single memory pool
123349 0 : for (unsigned j=0; j < SgSIMDBinaryOp::pool_size; j++)
123350 : {
123351 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
123352 : {
123353 0 : nodeList.push_back(&(objectArray[i][j]));
123354 : }
123355 : }
123356 : }
123357 :
123358 : // Iterate over the saved list
123359 0 : size_t nodeListSize = nodeList.size();
123360 0 : for (size_t i=0; i < nodeListSize; i++)
123361 : {
123362 0 : ROSE_ASSERT(nodeList[i] != NULL);
123363 : #if 0
123364 : traversal.visit(nodeList[i]);
123365 : #else
123366 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
123367 : {
123368 0 : traversal.visit(nodeList[i]);
123369 : }
123370 : #endif
123371 : }
123372 : #endif
123373 : }
123374 :
123375 : // This should not be required since all previously static data members are
123376 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
123377 :
123378 5342 : }
123379 :
123380 :
123381 : void
123382 194 : SgSIMDBinaryOp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
123383 : {
123384 : // This function traverses the memory pool for an IR node and
123385 : // calls the function to execute the visitor object.
123386 :
123387 : // Initialize array to the address of the first element of the STL vector
123388 : // (which is guarenteed to be contiguous storage).
123389 : // SgSIMDBinaryOp objectArray [] = *(Memory_Block_List.begin());
123390 194 : if (SgSIMDBinaryOp::pools.empty() == false)
123391 : {
123392 : // Generate an array of memory pools
123393 0 : SgSIMDBinaryOp** objectArray = (SgSIMDBinaryOp**) &(SgSIMDBinaryOp::pools[0]);
123394 :
123395 : // Build a local variable for better performance
123396 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
123397 :
123398 : // Iterate over the memory pools
123399 0 : for (unsigned int i=0; i < SgSIMDBinaryOp::pools.size(); i++)
123400 : {
123401 : // objectArray[i] is a single memory pool
123402 0 : for (unsigned j=0; j < SgSIMDBinaryOp::pool_size; j++)
123403 : {
123404 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
123405 : {
123406 : // printf ("Found a valid SgSIMDBinaryOp object in the memory pool %d at position %d \n",i,j);
123407 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
123408 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
123409 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
123410 : }
123411 : else
123412 : {
123413 : // printf ("Found a INVALID SgSIMDBinaryOp object in the memory pool \n");
123414 : }
123415 : }
123416 : }
123417 : }
123418 :
123419 : // This should not be required since all previously static data members are
123420 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
123421 :
123422 194 : }
123423 :
123424 : void
123425 0 : SgSIMDBinaryOp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
123426 : {
123427 : // This function visits only a single IR node of the memory pool.
123428 : // it is typically called once for each type of IR node within
123429 : // the automatically generated function: traverseRepresentativeNodes().
123430 :
123431 : // Initialize array to the address of the first element of the STL vector
123432 : // (which is guarenteed to be contiguous storage).
123433 : // SgSIMDBinaryOp objectArray [] = *(Memory_Block_List.begin());
123434 0 : if (SgSIMDBinaryOp::pools.empty() == false)
123435 : {
123436 : // Generate an array of memory pools
123437 0 : SgSIMDBinaryOp** objectArray = (SgSIMDBinaryOp**) &(SgSIMDBinaryOp::pools[0]);
123438 :
123439 : // Build a local variable for better performance
123440 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
123441 :
123442 : // Iterate over the memory pools
123443 0 : bool done = false;
123444 0 : unsigned i=0;
123445 :
123446 : // find the first valid IR node, call visit function, and then leave
123447 0 : while ( done == false && i < SgSIMDBinaryOp::pools.size() )
123448 : {
123449 : // objectArray[i] is a single memory pool
123450 : unsigned j=0;
123451 0 : while (done == false && j < SgSIMDBinaryOp::pool_size)
123452 : {
123453 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
123454 : {
123455 0 : traversal.visit(&(objectArray[i][j]));
123456 0 : done = true;
123457 : }
123458 0 : j++;
123459 : }
123460 0 : i++;
123461 : }
123462 :
123463 : #if 0
123464 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
123465 : if (done == false)
123466 : {
123467 : printf ("No representative for SgSIMDBinaryOp found in memory pools \n");
123468 : }
123469 : #endif
123470 : }
123471 0 : }
123472 :
123473 :
123474 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
123475 : // using values that overflow signed values of int.
123476 : size_t
123477 4 : SgSIMDBinaryOp::numberOfNodes()
123478 : {
123479 : // This function traverses the memory pool for an IR node and
123480 : // counts the number of IR nodes of a particular Sage III IR
123481 : // nodes type.
123482 :
123483 4 : size_t count = 0;
123484 4 : if (SgSIMDBinaryOp::pools.empty() == false)
123485 : {
123486 : // Generate an array of memory pools (this is actually a STL vector,
123487 : // but it is contiguious, so OK to treat this way).
123488 0 : SgSIMDBinaryOp** objectArray = (SgSIMDBinaryOp**) &(SgSIMDBinaryOp::pools[0]);
123489 :
123490 : // Build a local variable for better performance (make it a loop invariant variable).
123491 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
123492 :
123493 : // Iterate over all of the memory pools for this IR node.
123494 0 : for (unsigned int i=0; i < SgSIMDBinaryOp::pools.size(); i++)
123495 : {
123496 : // objectArray[i] is a single memory pool, iterate over all the
123497 : // IR nodes and only count those that are valid IR nodes used in
123498 : // the AST (i.e. allocated IR nodes).
123499 0 : for (unsigned j=0; j < SgSIMDBinaryOp::pool_size; j++)
123500 : {
123501 : // This is indexing the STL vector of C/C++ style arrays as a doubly
123502 : // indexed array access. It is OK since we have leveraged the semantics
123503 : // of STL vector memory as contigous and cast the memory as an array
123504 : // of arrays to use the 2D array indexing. Hope this is not confusing,
123505 : // but it s very fast as an implementation.
123506 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
123507 : {
123508 0 : count++;
123509 : }
123510 : }
123511 : }
123512 : }
123513 :
123514 :
123515 :
123516 4 : return count;
123517 : }
123518 :
123519 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
123520 : // using values that overflow signed values of int.
123521 : size_t
123522 0 : SgSIMDBinaryOp::memoryUsage()
123523 : {
123524 : // This function is required because we need the class name as a type when we call sizeof
123525 : // There might be another way to implement this if we have a traversal that only called a
123526 : // representative object (one call for each type of Sage IIIIR node).
123527 0 : size_t memory = numberOfNodes() * sizeof(SgSIMDBinaryOp);
123528 :
123529 0 : return memory;
123530 : }
123531 :
123532 : /* #line 123533 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
123533 :
123534 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
123535 : void
123536 5342 : SgSIMDAddOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
123537 : {
123538 : // This function traverses the memory pool for only a specific IR node
123539 : // and calls the visit function of the input class execute a traversal
123540 : // similar to the style of the attribute based traversals within ROSE.
123541 : // This traversal will visit ALL nodes of the AST where as the other
123542 : // attribute based traversals visit only the embedded tree within the AST.
123543 :
123544 : // Initialize array to the address of the first element of the STL vector
123545 : // (which is guaranteed to be contiguous storage).
123546 : // SgSIMDAddOp objectArray [] = *(Memory_Block_List.begin());
123547 5342 : if (SgSIMDAddOp::pools.empty() == false)
123548 : {
123549 : // Generate an array of memory pools
123550 0 : SgSIMDAddOp** objectArray = (SgSIMDAddOp**) &(SgSIMDAddOp::pools[0]);
123551 :
123552 : // Build a local variable for better performance
123553 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
123554 : #if 0
123555 : // Iterate over the memory pools
123556 : for (unsigned int i=0; i < SgSIMDAddOp::pools.size(); i++)
123557 : {
123558 : // objectArray[i] is a single memory pool
123559 : for (int j=0; j < SgSIMDAddOp::pool_size; j++)
123560 : {
123561 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
123562 : {
123563 : traversal.visit(&(objectArray[i][j]));
123564 : }
123565 : }
123566 : }
123567 : #else
123568 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
123569 : // compute the list first and then call the visit function on each list element.
123570 :
123571 : // printf ("Inside of SgSIMDAddOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
123572 :
123573 0 : std::vector<SgSIMDAddOp*> nodeList;
123574 :
123575 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
123576 0 : for (unsigned int i=0; i < SgSIMDAddOp::pools.size(); i++)
123577 : {
123578 : // objectArray[i] is a single memory pool
123579 0 : for (unsigned j=0; j < SgSIMDAddOp::pool_size; j++)
123580 : {
123581 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
123582 : {
123583 0 : nodeList.push_back(&(objectArray[i][j]));
123584 : }
123585 : }
123586 : }
123587 :
123588 : // Iterate over the saved list
123589 0 : size_t nodeListSize = nodeList.size();
123590 0 : for (size_t i=0; i < nodeListSize; i++)
123591 : {
123592 0 : ROSE_ASSERT(nodeList[i] != NULL);
123593 : #if 0
123594 : traversal.visit(nodeList[i]);
123595 : #else
123596 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
123597 : {
123598 0 : traversal.visit(nodeList[i]);
123599 : }
123600 : #endif
123601 : }
123602 : #endif
123603 : }
123604 :
123605 : // This should not be required since all previously static data members are
123606 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
123607 :
123608 5342 : }
123609 :
123610 :
123611 : void
123612 194 : SgSIMDAddOp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
123613 : {
123614 : // This function traverses the memory pool for an IR node and
123615 : // calls the function to execute the visitor object.
123616 :
123617 : // Initialize array to the address of the first element of the STL vector
123618 : // (which is guarenteed to be contiguous storage).
123619 : // SgSIMDAddOp objectArray [] = *(Memory_Block_List.begin());
123620 194 : if (SgSIMDAddOp::pools.empty() == false)
123621 : {
123622 : // Generate an array of memory pools
123623 0 : SgSIMDAddOp** objectArray = (SgSIMDAddOp**) &(SgSIMDAddOp::pools[0]);
123624 :
123625 : // Build a local variable for better performance
123626 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
123627 :
123628 : // Iterate over the memory pools
123629 0 : for (unsigned int i=0; i < SgSIMDAddOp::pools.size(); i++)
123630 : {
123631 : // objectArray[i] is a single memory pool
123632 0 : for (unsigned j=0; j < SgSIMDAddOp::pool_size; j++)
123633 : {
123634 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
123635 : {
123636 : // printf ("Found a valid SgSIMDAddOp object in the memory pool %d at position %d \n",i,j);
123637 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
123638 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
123639 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
123640 : }
123641 : else
123642 : {
123643 : // printf ("Found a INVALID SgSIMDAddOp object in the memory pool \n");
123644 : }
123645 : }
123646 : }
123647 : }
123648 :
123649 : // This should not be required since all previously static data members are
123650 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
123651 :
123652 194 : }
123653 :
123654 : void
123655 0 : SgSIMDAddOp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
123656 : {
123657 : // This function visits only a single IR node of the memory pool.
123658 : // it is typically called once for each type of IR node within
123659 : // the automatically generated function: traverseRepresentativeNodes().
123660 :
123661 : // Initialize array to the address of the first element of the STL vector
123662 : // (which is guarenteed to be contiguous storage).
123663 : // SgSIMDAddOp objectArray [] = *(Memory_Block_List.begin());
123664 0 : if (SgSIMDAddOp::pools.empty() == false)
123665 : {
123666 : // Generate an array of memory pools
123667 0 : SgSIMDAddOp** objectArray = (SgSIMDAddOp**) &(SgSIMDAddOp::pools[0]);
123668 :
123669 : // Build a local variable for better performance
123670 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
123671 :
123672 : // Iterate over the memory pools
123673 0 : bool done = false;
123674 0 : unsigned i=0;
123675 :
123676 : // find the first valid IR node, call visit function, and then leave
123677 0 : while ( done == false && i < SgSIMDAddOp::pools.size() )
123678 : {
123679 : // objectArray[i] is a single memory pool
123680 : unsigned j=0;
123681 0 : while (done == false && j < SgSIMDAddOp::pool_size)
123682 : {
123683 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
123684 : {
123685 0 : traversal.visit(&(objectArray[i][j]));
123686 0 : done = true;
123687 : }
123688 0 : j++;
123689 : }
123690 0 : i++;
123691 : }
123692 :
123693 : #if 0
123694 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
123695 : if (done == false)
123696 : {
123697 : printf ("No representative for SgSIMDAddOp found in memory pools \n");
123698 : }
123699 : #endif
123700 : }
123701 0 : }
123702 :
123703 :
123704 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
123705 : // using values that overflow signed values of int.
123706 : size_t
123707 4 : SgSIMDAddOp::numberOfNodes()
123708 : {
123709 : // This function traverses the memory pool for an IR node and
123710 : // counts the number of IR nodes of a particular Sage III IR
123711 : // nodes type.
123712 :
123713 4 : size_t count = 0;
123714 4 : if (SgSIMDAddOp::pools.empty() == false)
123715 : {
123716 : // Generate an array of memory pools (this is actually a STL vector,
123717 : // but it is contiguious, so OK to treat this way).
123718 0 : SgSIMDAddOp** objectArray = (SgSIMDAddOp**) &(SgSIMDAddOp::pools[0]);
123719 :
123720 : // Build a local variable for better performance (make it a loop invariant variable).
123721 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
123722 :
123723 : // Iterate over all of the memory pools for this IR node.
123724 0 : for (unsigned int i=0; i < SgSIMDAddOp::pools.size(); i++)
123725 : {
123726 : // objectArray[i] is a single memory pool, iterate over all the
123727 : // IR nodes and only count those that are valid IR nodes used in
123728 : // the AST (i.e. allocated IR nodes).
123729 0 : for (unsigned j=0; j < SgSIMDAddOp::pool_size; j++)
123730 : {
123731 : // This is indexing the STL vector of C/C++ style arrays as a doubly
123732 : // indexed array access. It is OK since we have leveraged the semantics
123733 : // of STL vector memory as contigous and cast the memory as an array
123734 : // of arrays to use the 2D array indexing. Hope this is not confusing,
123735 : // but it s very fast as an implementation.
123736 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
123737 : {
123738 0 : count++;
123739 : }
123740 : }
123741 : }
123742 : }
123743 :
123744 :
123745 :
123746 4 : return count;
123747 : }
123748 :
123749 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
123750 : // using values that overflow signed values of int.
123751 : size_t
123752 0 : SgSIMDAddOp::memoryUsage()
123753 : {
123754 : // This function is required because we need the class name as a type when we call sizeof
123755 : // There might be another way to implement this if we have a traversal that only called a
123756 : // representative object (one call for each type of Sage IIIIR node).
123757 0 : size_t memory = numberOfNodes() * sizeof(SgSIMDAddOp);
123758 :
123759 0 : return memory;
123760 : }
123761 :
123762 : /* #line 123763 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
123763 :
123764 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
123765 : void
123766 5342 : SgSIMDSubOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
123767 : {
123768 : // This function traverses the memory pool for only a specific IR node
123769 : // and calls the visit function of the input class execute a traversal
123770 : // similar to the style of the attribute based traversals within ROSE.
123771 : // This traversal will visit ALL nodes of the AST where as the other
123772 : // attribute based traversals visit only the embedded tree within the AST.
123773 :
123774 : // Initialize array to the address of the first element of the STL vector
123775 : // (which is guaranteed to be contiguous storage).
123776 : // SgSIMDSubOp objectArray [] = *(Memory_Block_List.begin());
123777 5342 : if (SgSIMDSubOp::pools.empty() == false)
123778 : {
123779 : // Generate an array of memory pools
123780 0 : SgSIMDSubOp** objectArray = (SgSIMDSubOp**) &(SgSIMDSubOp::pools[0]);
123781 :
123782 : // Build a local variable for better performance
123783 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
123784 : #if 0
123785 : // Iterate over the memory pools
123786 : for (unsigned int i=0; i < SgSIMDSubOp::pools.size(); i++)
123787 : {
123788 : // objectArray[i] is a single memory pool
123789 : for (int j=0; j < SgSIMDSubOp::pool_size; j++)
123790 : {
123791 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
123792 : {
123793 : traversal.visit(&(objectArray[i][j]));
123794 : }
123795 : }
123796 : }
123797 : #else
123798 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
123799 : // compute the list first and then call the visit function on each list element.
123800 :
123801 : // printf ("Inside of SgSIMDSubOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
123802 :
123803 0 : std::vector<SgSIMDSubOp*> nodeList;
123804 :
123805 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
123806 0 : for (unsigned int i=0; i < SgSIMDSubOp::pools.size(); i++)
123807 : {
123808 : // objectArray[i] is a single memory pool
123809 0 : for (unsigned j=0; j < SgSIMDSubOp::pool_size; j++)
123810 : {
123811 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
123812 : {
123813 0 : nodeList.push_back(&(objectArray[i][j]));
123814 : }
123815 : }
123816 : }
123817 :
123818 : // Iterate over the saved list
123819 0 : size_t nodeListSize = nodeList.size();
123820 0 : for (size_t i=0; i < nodeListSize; i++)
123821 : {
123822 0 : ROSE_ASSERT(nodeList[i] != NULL);
123823 : #if 0
123824 : traversal.visit(nodeList[i]);
123825 : #else
123826 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
123827 : {
123828 0 : traversal.visit(nodeList[i]);
123829 : }
123830 : #endif
123831 : }
123832 : #endif
123833 : }
123834 :
123835 : // This should not be required since all previously static data members are
123836 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
123837 :
123838 5342 : }
123839 :
123840 :
123841 : void
123842 194 : SgSIMDSubOp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
123843 : {
123844 : // This function traverses the memory pool for an IR node and
123845 : // calls the function to execute the visitor object.
123846 :
123847 : // Initialize array to the address of the first element of the STL vector
123848 : // (which is guarenteed to be contiguous storage).
123849 : // SgSIMDSubOp objectArray [] = *(Memory_Block_List.begin());
123850 194 : if (SgSIMDSubOp::pools.empty() == false)
123851 : {
123852 : // Generate an array of memory pools
123853 0 : SgSIMDSubOp** objectArray = (SgSIMDSubOp**) &(SgSIMDSubOp::pools[0]);
123854 :
123855 : // Build a local variable for better performance
123856 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
123857 :
123858 : // Iterate over the memory pools
123859 0 : for (unsigned int i=0; i < SgSIMDSubOp::pools.size(); i++)
123860 : {
123861 : // objectArray[i] is a single memory pool
123862 0 : for (unsigned j=0; j < SgSIMDSubOp::pool_size; j++)
123863 : {
123864 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
123865 : {
123866 : // printf ("Found a valid SgSIMDSubOp object in the memory pool %d at position %d \n",i,j);
123867 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
123868 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
123869 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
123870 : }
123871 : else
123872 : {
123873 : // printf ("Found a INVALID SgSIMDSubOp object in the memory pool \n");
123874 : }
123875 : }
123876 : }
123877 : }
123878 :
123879 : // This should not be required since all previously static data members are
123880 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
123881 :
123882 194 : }
123883 :
123884 : void
123885 0 : SgSIMDSubOp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
123886 : {
123887 : // This function visits only a single IR node of the memory pool.
123888 : // it is typically called once for each type of IR node within
123889 : // the automatically generated function: traverseRepresentativeNodes().
123890 :
123891 : // Initialize array to the address of the first element of the STL vector
123892 : // (which is guarenteed to be contiguous storage).
123893 : // SgSIMDSubOp objectArray [] = *(Memory_Block_List.begin());
123894 0 : if (SgSIMDSubOp::pools.empty() == false)
123895 : {
123896 : // Generate an array of memory pools
123897 0 : SgSIMDSubOp** objectArray = (SgSIMDSubOp**) &(SgSIMDSubOp::pools[0]);
123898 :
123899 : // Build a local variable for better performance
123900 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
123901 :
123902 : // Iterate over the memory pools
123903 0 : bool done = false;
123904 0 : unsigned i=0;
123905 :
123906 : // find the first valid IR node, call visit function, and then leave
123907 0 : while ( done == false && i < SgSIMDSubOp::pools.size() )
123908 : {
123909 : // objectArray[i] is a single memory pool
123910 : unsigned j=0;
123911 0 : while (done == false && j < SgSIMDSubOp::pool_size)
123912 : {
123913 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
123914 : {
123915 0 : traversal.visit(&(objectArray[i][j]));
123916 0 : done = true;
123917 : }
123918 0 : j++;
123919 : }
123920 0 : i++;
123921 : }
123922 :
123923 : #if 0
123924 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
123925 : if (done == false)
123926 : {
123927 : printf ("No representative for SgSIMDSubOp found in memory pools \n");
123928 : }
123929 : #endif
123930 : }
123931 0 : }
123932 :
123933 :
123934 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
123935 : // using values that overflow signed values of int.
123936 : size_t
123937 4 : SgSIMDSubOp::numberOfNodes()
123938 : {
123939 : // This function traverses the memory pool for an IR node and
123940 : // counts the number of IR nodes of a particular Sage III IR
123941 : // nodes type.
123942 :
123943 4 : size_t count = 0;
123944 4 : if (SgSIMDSubOp::pools.empty() == false)
123945 : {
123946 : // Generate an array of memory pools (this is actually a STL vector,
123947 : // but it is contiguious, so OK to treat this way).
123948 0 : SgSIMDSubOp** objectArray = (SgSIMDSubOp**) &(SgSIMDSubOp::pools[0]);
123949 :
123950 : // Build a local variable for better performance (make it a loop invariant variable).
123951 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
123952 :
123953 : // Iterate over all of the memory pools for this IR node.
123954 0 : for (unsigned int i=0; i < SgSIMDSubOp::pools.size(); i++)
123955 : {
123956 : // objectArray[i] is a single memory pool, iterate over all the
123957 : // IR nodes and only count those that are valid IR nodes used in
123958 : // the AST (i.e. allocated IR nodes).
123959 0 : for (unsigned j=0; j < SgSIMDSubOp::pool_size; j++)
123960 : {
123961 : // This is indexing the STL vector of C/C++ style arrays as a doubly
123962 : // indexed array access. It is OK since we have leveraged the semantics
123963 : // of STL vector memory as contigous and cast the memory as an array
123964 : // of arrays to use the 2D array indexing. Hope this is not confusing,
123965 : // but it s very fast as an implementation.
123966 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
123967 : {
123968 0 : count++;
123969 : }
123970 : }
123971 : }
123972 : }
123973 :
123974 :
123975 :
123976 4 : return count;
123977 : }
123978 :
123979 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
123980 : // using values that overflow signed values of int.
123981 : size_t
123982 0 : SgSIMDSubOp::memoryUsage()
123983 : {
123984 : // This function is required because we need the class name as a type when we call sizeof
123985 : // There might be another way to implement this if we have a traversal that only called a
123986 : // representative object (one call for each type of Sage IIIIR node).
123987 0 : size_t memory = numberOfNodes() * sizeof(SgSIMDSubOp);
123988 :
123989 0 : return memory;
123990 : }
123991 :
123992 : /* #line 123993 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
123993 :
123994 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
123995 : void
123996 5342 : SgSIMDMulOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
123997 : {
123998 : // This function traverses the memory pool for only a specific IR node
123999 : // and calls the visit function of the input class execute a traversal
124000 : // similar to the style of the attribute based traversals within ROSE.
124001 : // This traversal will visit ALL nodes of the AST where as the other
124002 : // attribute based traversals visit only the embedded tree within the AST.
124003 :
124004 : // Initialize array to the address of the first element of the STL vector
124005 : // (which is guaranteed to be contiguous storage).
124006 : // SgSIMDMulOp objectArray [] = *(Memory_Block_List.begin());
124007 5342 : if (SgSIMDMulOp::pools.empty() == false)
124008 : {
124009 : // Generate an array of memory pools
124010 0 : SgSIMDMulOp** objectArray = (SgSIMDMulOp**) &(SgSIMDMulOp::pools[0]);
124011 :
124012 : // Build a local variable for better performance
124013 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
124014 : #if 0
124015 : // Iterate over the memory pools
124016 : for (unsigned int i=0; i < SgSIMDMulOp::pools.size(); i++)
124017 : {
124018 : // objectArray[i] is a single memory pool
124019 : for (int j=0; j < SgSIMDMulOp::pool_size; j++)
124020 : {
124021 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
124022 : {
124023 : traversal.visit(&(objectArray[i][j]));
124024 : }
124025 : }
124026 : }
124027 : #else
124028 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
124029 : // compute the list first and then call the visit function on each list element.
124030 :
124031 : // printf ("Inside of SgSIMDMulOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
124032 :
124033 0 : std::vector<SgSIMDMulOp*> nodeList;
124034 :
124035 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
124036 0 : for (unsigned int i=0; i < SgSIMDMulOp::pools.size(); i++)
124037 : {
124038 : // objectArray[i] is a single memory pool
124039 0 : for (unsigned j=0; j < SgSIMDMulOp::pool_size; j++)
124040 : {
124041 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
124042 : {
124043 0 : nodeList.push_back(&(objectArray[i][j]));
124044 : }
124045 : }
124046 : }
124047 :
124048 : // Iterate over the saved list
124049 0 : size_t nodeListSize = nodeList.size();
124050 0 : for (size_t i=0; i < nodeListSize; i++)
124051 : {
124052 0 : ROSE_ASSERT(nodeList[i] != NULL);
124053 : #if 0
124054 : traversal.visit(nodeList[i]);
124055 : #else
124056 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
124057 : {
124058 0 : traversal.visit(nodeList[i]);
124059 : }
124060 : #endif
124061 : }
124062 : #endif
124063 : }
124064 :
124065 : // This should not be required since all previously static data members are
124066 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
124067 :
124068 5342 : }
124069 :
124070 :
124071 : void
124072 194 : SgSIMDMulOp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
124073 : {
124074 : // This function traverses the memory pool for an IR node and
124075 : // calls the function to execute the visitor object.
124076 :
124077 : // Initialize array to the address of the first element of the STL vector
124078 : // (which is guarenteed to be contiguous storage).
124079 : // SgSIMDMulOp objectArray [] = *(Memory_Block_List.begin());
124080 194 : if (SgSIMDMulOp::pools.empty() == false)
124081 : {
124082 : // Generate an array of memory pools
124083 0 : SgSIMDMulOp** objectArray = (SgSIMDMulOp**) &(SgSIMDMulOp::pools[0]);
124084 :
124085 : // Build a local variable for better performance
124086 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
124087 :
124088 : // Iterate over the memory pools
124089 0 : for (unsigned int i=0; i < SgSIMDMulOp::pools.size(); i++)
124090 : {
124091 : // objectArray[i] is a single memory pool
124092 0 : for (unsigned j=0; j < SgSIMDMulOp::pool_size; j++)
124093 : {
124094 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
124095 : {
124096 : // printf ("Found a valid SgSIMDMulOp object in the memory pool %d at position %d \n",i,j);
124097 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
124098 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
124099 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
124100 : }
124101 : else
124102 : {
124103 : // printf ("Found a INVALID SgSIMDMulOp object in the memory pool \n");
124104 : }
124105 : }
124106 : }
124107 : }
124108 :
124109 : // This should not be required since all previously static data members are
124110 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
124111 :
124112 194 : }
124113 :
124114 : void
124115 0 : SgSIMDMulOp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
124116 : {
124117 : // This function visits only a single IR node of the memory pool.
124118 : // it is typically called once for each type of IR node within
124119 : // the automatically generated function: traverseRepresentativeNodes().
124120 :
124121 : // Initialize array to the address of the first element of the STL vector
124122 : // (which is guarenteed to be contiguous storage).
124123 : // SgSIMDMulOp objectArray [] = *(Memory_Block_List.begin());
124124 0 : if (SgSIMDMulOp::pools.empty() == false)
124125 : {
124126 : // Generate an array of memory pools
124127 0 : SgSIMDMulOp** objectArray = (SgSIMDMulOp**) &(SgSIMDMulOp::pools[0]);
124128 :
124129 : // Build a local variable for better performance
124130 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
124131 :
124132 : // Iterate over the memory pools
124133 0 : bool done = false;
124134 0 : unsigned i=0;
124135 :
124136 : // find the first valid IR node, call visit function, and then leave
124137 0 : while ( done == false && i < SgSIMDMulOp::pools.size() )
124138 : {
124139 : // objectArray[i] is a single memory pool
124140 : unsigned j=0;
124141 0 : while (done == false && j < SgSIMDMulOp::pool_size)
124142 : {
124143 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
124144 : {
124145 0 : traversal.visit(&(objectArray[i][j]));
124146 0 : done = true;
124147 : }
124148 0 : j++;
124149 : }
124150 0 : i++;
124151 : }
124152 :
124153 : #if 0
124154 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
124155 : if (done == false)
124156 : {
124157 : printf ("No representative for SgSIMDMulOp found in memory pools \n");
124158 : }
124159 : #endif
124160 : }
124161 0 : }
124162 :
124163 :
124164 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
124165 : // using values that overflow signed values of int.
124166 : size_t
124167 4 : SgSIMDMulOp::numberOfNodes()
124168 : {
124169 : // This function traverses the memory pool for an IR node and
124170 : // counts the number of IR nodes of a particular Sage III IR
124171 : // nodes type.
124172 :
124173 4 : size_t count = 0;
124174 4 : if (SgSIMDMulOp::pools.empty() == false)
124175 : {
124176 : // Generate an array of memory pools (this is actually a STL vector,
124177 : // but it is contiguious, so OK to treat this way).
124178 0 : SgSIMDMulOp** objectArray = (SgSIMDMulOp**) &(SgSIMDMulOp::pools[0]);
124179 :
124180 : // Build a local variable for better performance (make it a loop invariant variable).
124181 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
124182 :
124183 : // Iterate over all of the memory pools for this IR node.
124184 0 : for (unsigned int i=0; i < SgSIMDMulOp::pools.size(); i++)
124185 : {
124186 : // objectArray[i] is a single memory pool, iterate over all the
124187 : // IR nodes and only count those that are valid IR nodes used in
124188 : // the AST (i.e. allocated IR nodes).
124189 0 : for (unsigned j=0; j < SgSIMDMulOp::pool_size; j++)
124190 : {
124191 : // This is indexing the STL vector of C/C++ style arrays as a doubly
124192 : // indexed array access. It is OK since we have leveraged the semantics
124193 : // of STL vector memory as contigous and cast the memory as an array
124194 : // of arrays to use the 2D array indexing. Hope this is not confusing,
124195 : // but it s very fast as an implementation.
124196 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
124197 : {
124198 0 : count++;
124199 : }
124200 : }
124201 : }
124202 : }
124203 :
124204 :
124205 :
124206 4 : return count;
124207 : }
124208 :
124209 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
124210 : // using values that overflow signed values of int.
124211 : size_t
124212 0 : SgSIMDMulOp::memoryUsage()
124213 : {
124214 : // This function is required because we need the class name as a type when we call sizeof
124215 : // There might be another way to implement this if we have a traversal that only called a
124216 : // representative object (one call for each type of Sage IIIIR node).
124217 0 : size_t memory = numberOfNodes() * sizeof(SgSIMDMulOp);
124218 :
124219 0 : return memory;
124220 : }
124221 :
124222 : /* #line 124223 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
124223 :
124224 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
124225 : void
124226 5342 : SgSIMDDivOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
124227 : {
124228 : // This function traverses the memory pool for only a specific IR node
124229 : // and calls the visit function of the input class execute a traversal
124230 : // similar to the style of the attribute based traversals within ROSE.
124231 : // This traversal will visit ALL nodes of the AST where as the other
124232 : // attribute based traversals visit only the embedded tree within the AST.
124233 :
124234 : // Initialize array to the address of the first element of the STL vector
124235 : // (which is guaranteed to be contiguous storage).
124236 : // SgSIMDDivOp objectArray [] = *(Memory_Block_List.begin());
124237 5342 : if (SgSIMDDivOp::pools.empty() == false)
124238 : {
124239 : // Generate an array of memory pools
124240 0 : SgSIMDDivOp** objectArray = (SgSIMDDivOp**) &(SgSIMDDivOp::pools[0]);
124241 :
124242 : // Build a local variable for better performance
124243 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
124244 : #if 0
124245 : // Iterate over the memory pools
124246 : for (unsigned int i=0; i < SgSIMDDivOp::pools.size(); i++)
124247 : {
124248 : // objectArray[i] is a single memory pool
124249 : for (int j=0; j < SgSIMDDivOp::pool_size; j++)
124250 : {
124251 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
124252 : {
124253 : traversal.visit(&(objectArray[i][j]));
124254 : }
124255 : }
124256 : }
124257 : #else
124258 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
124259 : // compute the list first and then call the visit function on each list element.
124260 :
124261 : // printf ("Inside of SgSIMDDivOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
124262 :
124263 0 : std::vector<SgSIMDDivOp*> nodeList;
124264 :
124265 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
124266 0 : for (unsigned int i=0; i < SgSIMDDivOp::pools.size(); i++)
124267 : {
124268 : // objectArray[i] is a single memory pool
124269 0 : for (unsigned j=0; j < SgSIMDDivOp::pool_size; j++)
124270 : {
124271 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
124272 : {
124273 0 : nodeList.push_back(&(objectArray[i][j]));
124274 : }
124275 : }
124276 : }
124277 :
124278 : // Iterate over the saved list
124279 0 : size_t nodeListSize = nodeList.size();
124280 0 : for (size_t i=0; i < nodeListSize; i++)
124281 : {
124282 0 : ROSE_ASSERT(nodeList[i] != NULL);
124283 : #if 0
124284 : traversal.visit(nodeList[i]);
124285 : #else
124286 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
124287 : {
124288 0 : traversal.visit(nodeList[i]);
124289 : }
124290 : #endif
124291 : }
124292 : #endif
124293 : }
124294 :
124295 : // This should not be required since all previously static data members are
124296 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
124297 :
124298 5342 : }
124299 :
124300 :
124301 : void
124302 194 : SgSIMDDivOp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
124303 : {
124304 : // This function traverses the memory pool for an IR node and
124305 : // calls the function to execute the visitor object.
124306 :
124307 : // Initialize array to the address of the first element of the STL vector
124308 : // (which is guarenteed to be contiguous storage).
124309 : // SgSIMDDivOp objectArray [] = *(Memory_Block_List.begin());
124310 194 : if (SgSIMDDivOp::pools.empty() == false)
124311 : {
124312 : // Generate an array of memory pools
124313 0 : SgSIMDDivOp** objectArray = (SgSIMDDivOp**) &(SgSIMDDivOp::pools[0]);
124314 :
124315 : // Build a local variable for better performance
124316 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
124317 :
124318 : // Iterate over the memory pools
124319 0 : for (unsigned int i=0; i < SgSIMDDivOp::pools.size(); i++)
124320 : {
124321 : // objectArray[i] is a single memory pool
124322 0 : for (unsigned j=0; j < SgSIMDDivOp::pool_size; j++)
124323 : {
124324 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
124325 : {
124326 : // printf ("Found a valid SgSIMDDivOp object in the memory pool %d at position %d \n",i,j);
124327 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
124328 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
124329 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
124330 : }
124331 : else
124332 : {
124333 : // printf ("Found a INVALID SgSIMDDivOp object in the memory pool \n");
124334 : }
124335 : }
124336 : }
124337 : }
124338 :
124339 : // This should not be required since all previously static data members are
124340 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
124341 :
124342 194 : }
124343 :
124344 : void
124345 0 : SgSIMDDivOp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
124346 : {
124347 : // This function visits only a single IR node of the memory pool.
124348 : // it is typically called once for each type of IR node within
124349 : // the automatically generated function: traverseRepresentativeNodes().
124350 :
124351 : // Initialize array to the address of the first element of the STL vector
124352 : // (which is guarenteed to be contiguous storage).
124353 : // SgSIMDDivOp objectArray [] = *(Memory_Block_List.begin());
124354 0 : if (SgSIMDDivOp::pools.empty() == false)
124355 : {
124356 : // Generate an array of memory pools
124357 0 : SgSIMDDivOp** objectArray = (SgSIMDDivOp**) &(SgSIMDDivOp::pools[0]);
124358 :
124359 : // Build a local variable for better performance
124360 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
124361 :
124362 : // Iterate over the memory pools
124363 0 : bool done = false;
124364 0 : unsigned i=0;
124365 :
124366 : // find the first valid IR node, call visit function, and then leave
124367 0 : while ( done == false && i < SgSIMDDivOp::pools.size() )
124368 : {
124369 : // objectArray[i] is a single memory pool
124370 : unsigned j=0;
124371 0 : while (done == false && j < SgSIMDDivOp::pool_size)
124372 : {
124373 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
124374 : {
124375 0 : traversal.visit(&(objectArray[i][j]));
124376 0 : done = true;
124377 : }
124378 0 : j++;
124379 : }
124380 0 : i++;
124381 : }
124382 :
124383 : #if 0
124384 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
124385 : if (done == false)
124386 : {
124387 : printf ("No representative for SgSIMDDivOp found in memory pools \n");
124388 : }
124389 : #endif
124390 : }
124391 0 : }
124392 :
124393 :
124394 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
124395 : // using values that overflow signed values of int.
124396 : size_t
124397 4 : SgSIMDDivOp::numberOfNodes()
124398 : {
124399 : // This function traverses the memory pool for an IR node and
124400 : // counts the number of IR nodes of a particular Sage III IR
124401 : // nodes type.
124402 :
124403 4 : size_t count = 0;
124404 4 : if (SgSIMDDivOp::pools.empty() == false)
124405 : {
124406 : // Generate an array of memory pools (this is actually a STL vector,
124407 : // but it is contiguious, so OK to treat this way).
124408 0 : SgSIMDDivOp** objectArray = (SgSIMDDivOp**) &(SgSIMDDivOp::pools[0]);
124409 :
124410 : // Build a local variable for better performance (make it a loop invariant variable).
124411 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
124412 :
124413 : // Iterate over all of the memory pools for this IR node.
124414 0 : for (unsigned int i=0; i < SgSIMDDivOp::pools.size(); i++)
124415 : {
124416 : // objectArray[i] is a single memory pool, iterate over all the
124417 : // IR nodes and only count those that are valid IR nodes used in
124418 : // the AST (i.e. allocated IR nodes).
124419 0 : for (unsigned j=0; j < SgSIMDDivOp::pool_size; j++)
124420 : {
124421 : // This is indexing the STL vector of C/C++ style arrays as a doubly
124422 : // indexed array access. It is OK since we have leveraged the semantics
124423 : // of STL vector memory as contigous and cast the memory as an array
124424 : // of arrays to use the 2D array indexing. Hope this is not confusing,
124425 : // but it s very fast as an implementation.
124426 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
124427 : {
124428 0 : count++;
124429 : }
124430 : }
124431 : }
124432 : }
124433 :
124434 :
124435 :
124436 4 : return count;
124437 : }
124438 :
124439 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
124440 : // using values that overflow signed values of int.
124441 : size_t
124442 0 : SgSIMDDivOp::memoryUsage()
124443 : {
124444 : // This function is required because we need the class name as a type when we call sizeof
124445 : // There might be another way to implement this if we have a traversal that only called a
124446 : // representative object (one call for each type of Sage IIIIR node).
124447 0 : size_t memory = numberOfNodes() * sizeof(SgSIMDDivOp);
124448 :
124449 0 : return memory;
124450 : }
124451 :
124452 : /* #line 124453 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
124453 :
124454 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
124455 : void
124456 5342 : SgSIMDFmaOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
124457 : {
124458 : // This function traverses the memory pool for only a specific IR node
124459 : // and calls the visit function of the input class execute a traversal
124460 : // similar to the style of the attribute based traversals within ROSE.
124461 : // This traversal will visit ALL nodes of the AST where as the other
124462 : // attribute based traversals visit only the embedded tree within the AST.
124463 :
124464 : // Initialize array to the address of the first element of the STL vector
124465 : // (which is guaranteed to be contiguous storage).
124466 : // SgSIMDFmaOp objectArray [] = *(Memory_Block_List.begin());
124467 5342 : if (SgSIMDFmaOp::pools.empty() == false)
124468 : {
124469 : // Generate an array of memory pools
124470 0 : SgSIMDFmaOp** objectArray = (SgSIMDFmaOp**) &(SgSIMDFmaOp::pools[0]);
124471 :
124472 : // Build a local variable for better performance
124473 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
124474 : #if 0
124475 : // Iterate over the memory pools
124476 : for (unsigned int i=0; i < SgSIMDFmaOp::pools.size(); i++)
124477 : {
124478 : // objectArray[i] is a single memory pool
124479 : for (int j=0; j < SgSIMDFmaOp::pool_size; j++)
124480 : {
124481 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
124482 : {
124483 : traversal.visit(&(objectArray[i][j]));
124484 : }
124485 : }
124486 : }
124487 : #else
124488 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
124489 : // compute the list first and then call the visit function on each list element.
124490 :
124491 : // printf ("Inside of SgSIMDFmaOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
124492 :
124493 0 : std::vector<SgSIMDFmaOp*> nodeList;
124494 :
124495 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
124496 0 : for (unsigned int i=0; i < SgSIMDFmaOp::pools.size(); i++)
124497 : {
124498 : // objectArray[i] is a single memory pool
124499 0 : for (unsigned j=0; j < SgSIMDFmaOp::pool_size; j++)
124500 : {
124501 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
124502 : {
124503 0 : nodeList.push_back(&(objectArray[i][j]));
124504 : }
124505 : }
124506 : }
124507 :
124508 : // Iterate over the saved list
124509 0 : size_t nodeListSize = nodeList.size();
124510 0 : for (size_t i=0; i < nodeListSize; i++)
124511 : {
124512 0 : ROSE_ASSERT(nodeList[i] != NULL);
124513 : #if 0
124514 : traversal.visit(nodeList[i]);
124515 : #else
124516 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
124517 : {
124518 0 : traversal.visit(nodeList[i]);
124519 : }
124520 : #endif
124521 : }
124522 : #endif
124523 : }
124524 :
124525 : // This should not be required since all previously static data members are
124526 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
124527 :
124528 5342 : }
124529 :
124530 :
124531 : void
124532 194 : SgSIMDFmaOp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
124533 : {
124534 : // This function traverses the memory pool for an IR node and
124535 : // calls the function to execute the visitor object.
124536 :
124537 : // Initialize array to the address of the first element of the STL vector
124538 : // (which is guarenteed to be contiguous storage).
124539 : // SgSIMDFmaOp objectArray [] = *(Memory_Block_List.begin());
124540 194 : if (SgSIMDFmaOp::pools.empty() == false)
124541 : {
124542 : // Generate an array of memory pools
124543 0 : SgSIMDFmaOp** objectArray = (SgSIMDFmaOp**) &(SgSIMDFmaOp::pools[0]);
124544 :
124545 : // Build a local variable for better performance
124546 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
124547 :
124548 : // Iterate over the memory pools
124549 0 : for (unsigned int i=0; i < SgSIMDFmaOp::pools.size(); i++)
124550 : {
124551 : // objectArray[i] is a single memory pool
124552 0 : for (unsigned j=0; j < SgSIMDFmaOp::pool_size; j++)
124553 : {
124554 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
124555 : {
124556 : // printf ("Found a valid SgSIMDFmaOp object in the memory pool %d at position %d \n",i,j);
124557 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
124558 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
124559 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
124560 : }
124561 : else
124562 : {
124563 : // printf ("Found a INVALID SgSIMDFmaOp object in the memory pool \n");
124564 : }
124565 : }
124566 : }
124567 : }
124568 :
124569 : // This should not be required since all previously static data members are
124570 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
124571 :
124572 194 : }
124573 :
124574 : void
124575 0 : SgSIMDFmaOp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
124576 : {
124577 : // This function visits only a single IR node of the memory pool.
124578 : // it is typically called once for each type of IR node within
124579 : // the automatically generated function: traverseRepresentativeNodes().
124580 :
124581 : // Initialize array to the address of the first element of the STL vector
124582 : // (which is guarenteed to be contiguous storage).
124583 : // SgSIMDFmaOp objectArray [] = *(Memory_Block_List.begin());
124584 0 : if (SgSIMDFmaOp::pools.empty() == false)
124585 : {
124586 : // Generate an array of memory pools
124587 0 : SgSIMDFmaOp** objectArray = (SgSIMDFmaOp**) &(SgSIMDFmaOp::pools[0]);
124588 :
124589 : // Build a local variable for better performance
124590 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
124591 :
124592 : // Iterate over the memory pools
124593 0 : bool done = false;
124594 0 : unsigned i=0;
124595 :
124596 : // find the first valid IR node, call visit function, and then leave
124597 0 : while ( done == false && i < SgSIMDFmaOp::pools.size() )
124598 : {
124599 : // objectArray[i] is a single memory pool
124600 : unsigned j=0;
124601 0 : while (done == false && j < SgSIMDFmaOp::pool_size)
124602 : {
124603 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
124604 : {
124605 0 : traversal.visit(&(objectArray[i][j]));
124606 0 : done = true;
124607 : }
124608 0 : j++;
124609 : }
124610 0 : i++;
124611 : }
124612 :
124613 : #if 0
124614 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
124615 : if (done == false)
124616 : {
124617 : printf ("No representative for SgSIMDFmaOp found in memory pools \n");
124618 : }
124619 : #endif
124620 : }
124621 0 : }
124622 :
124623 :
124624 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
124625 : // using values that overflow signed values of int.
124626 : size_t
124627 4 : SgSIMDFmaOp::numberOfNodes()
124628 : {
124629 : // This function traverses the memory pool for an IR node and
124630 : // counts the number of IR nodes of a particular Sage III IR
124631 : // nodes type.
124632 :
124633 4 : size_t count = 0;
124634 4 : if (SgSIMDFmaOp::pools.empty() == false)
124635 : {
124636 : // Generate an array of memory pools (this is actually a STL vector,
124637 : // but it is contiguious, so OK to treat this way).
124638 0 : SgSIMDFmaOp** objectArray = (SgSIMDFmaOp**) &(SgSIMDFmaOp::pools[0]);
124639 :
124640 : // Build a local variable for better performance (make it a loop invariant variable).
124641 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
124642 :
124643 : // Iterate over all of the memory pools for this IR node.
124644 0 : for (unsigned int i=0; i < SgSIMDFmaOp::pools.size(); i++)
124645 : {
124646 : // objectArray[i] is a single memory pool, iterate over all the
124647 : // IR nodes and only count those that are valid IR nodes used in
124648 : // the AST (i.e. allocated IR nodes).
124649 0 : for (unsigned j=0; j < SgSIMDFmaOp::pool_size; j++)
124650 : {
124651 : // This is indexing the STL vector of C/C++ style arrays as a doubly
124652 : // indexed array access. It is OK since we have leveraged the semantics
124653 : // of STL vector memory as contigous and cast the memory as an array
124654 : // of arrays to use the 2D array indexing. Hope this is not confusing,
124655 : // but it s very fast as an implementation.
124656 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
124657 : {
124658 0 : count++;
124659 : }
124660 : }
124661 : }
124662 : }
124663 :
124664 :
124665 :
124666 4 : return count;
124667 : }
124668 :
124669 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
124670 : // using values that overflow signed values of int.
124671 : size_t
124672 0 : SgSIMDFmaOp::memoryUsage()
124673 : {
124674 : // This function is required because we need the class name as a type when we call sizeof
124675 : // There might be another way to implement this if we have a traversal that only called a
124676 : // representative object (one call for each type of Sage IIIIR node).
124677 0 : size_t memory = numberOfNodes() * sizeof(SgSIMDFmaOp);
124678 :
124679 0 : return memory;
124680 : }
124681 :
124682 : /* #line 124683 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
124683 :
124684 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
124685 : void
124686 5342 : SgSIMDLoad::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
124687 : {
124688 : // This function traverses the memory pool for only a specific IR node
124689 : // and calls the visit function of the input class execute a traversal
124690 : // similar to the style of the attribute based traversals within ROSE.
124691 : // This traversal will visit ALL nodes of the AST where as the other
124692 : // attribute based traversals visit only the embedded tree within the AST.
124693 :
124694 : // Initialize array to the address of the first element of the STL vector
124695 : // (which is guaranteed to be contiguous storage).
124696 : // SgSIMDLoad objectArray [] = *(Memory_Block_List.begin());
124697 5342 : if (SgSIMDLoad::pools.empty() == false)
124698 : {
124699 : // Generate an array of memory pools
124700 0 : SgSIMDLoad** objectArray = (SgSIMDLoad**) &(SgSIMDLoad::pools[0]);
124701 :
124702 : // Build a local variable for better performance
124703 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
124704 : #if 0
124705 : // Iterate over the memory pools
124706 : for (unsigned int i=0; i < SgSIMDLoad::pools.size(); i++)
124707 : {
124708 : // objectArray[i] is a single memory pool
124709 : for (int j=0; j < SgSIMDLoad::pool_size; j++)
124710 : {
124711 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
124712 : {
124713 : traversal.visit(&(objectArray[i][j]));
124714 : }
124715 : }
124716 : }
124717 : #else
124718 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
124719 : // compute the list first and then call the visit function on each list element.
124720 :
124721 : // printf ("Inside of SgSIMDLoad::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
124722 :
124723 0 : std::vector<SgSIMDLoad*> nodeList;
124724 :
124725 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
124726 0 : for (unsigned int i=0; i < SgSIMDLoad::pools.size(); i++)
124727 : {
124728 : // objectArray[i] is a single memory pool
124729 0 : for (unsigned j=0; j < SgSIMDLoad::pool_size; j++)
124730 : {
124731 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
124732 : {
124733 0 : nodeList.push_back(&(objectArray[i][j]));
124734 : }
124735 : }
124736 : }
124737 :
124738 : // Iterate over the saved list
124739 0 : size_t nodeListSize = nodeList.size();
124740 0 : for (size_t i=0; i < nodeListSize; i++)
124741 : {
124742 0 : ROSE_ASSERT(nodeList[i] != NULL);
124743 : #if 0
124744 : traversal.visit(nodeList[i]);
124745 : #else
124746 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
124747 : {
124748 0 : traversal.visit(nodeList[i]);
124749 : }
124750 : #endif
124751 : }
124752 : #endif
124753 : }
124754 :
124755 : // This should not be required since all previously static data members are
124756 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
124757 :
124758 5342 : }
124759 :
124760 :
124761 : void
124762 194 : SgSIMDLoad::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
124763 : {
124764 : // This function traverses the memory pool for an IR node and
124765 : // calls the function to execute the visitor object.
124766 :
124767 : // Initialize array to the address of the first element of the STL vector
124768 : // (which is guarenteed to be contiguous storage).
124769 : // SgSIMDLoad objectArray [] = *(Memory_Block_List.begin());
124770 194 : if (SgSIMDLoad::pools.empty() == false)
124771 : {
124772 : // Generate an array of memory pools
124773 0 : SgSIMDLoad** objectArray = (SgSIMDLoad**) &(SgSIMDLoad::pools[0]);
124774 :
124775 : // Build a local variable for better performance
124776 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
124777 :
124778 : // Iterate over the memory pools
124779 0 : for (unsigned int i=0; i < SgSIMDLoad::pools.size(); i++)
124780 : {
124781 : // objectArray[i] is a single memory pool
124782 0 : for (unsigned j=0; j < SgSIMDLoad::pool_size; j++)
124783 : {
124784 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
124785 : {
124786 : // printf ("Found a valid SgSIMDLoad object in the memory pool %d at position %d \n",i,j);
124787 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
124788 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
124789 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
124790 : }
124791 : else
124792 : {
124793 : // printf ("Found a INVALID SgSIMDLoad object in the memory pool \n");
124794 : }
124795 : }
124796 : }
124797 : }
124798 :
124799 : // This should not be required since all previously static data members are
124800 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
124801 :
124802 194 : }
124803 :
124804 : void
124805 0 : SgSIMDLoad::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
124806 : {
124807 : // This function visits only a single IR node of the memory pool.
124808 : // it is typically called once for each type of IR node within
124809 : // the automatically generated function: traverseRepresentativeNodes().
124810 :
124811 : // Initialize array to the address of the first element of the STL vector
124812 : // (which is guarenteed to be contiguous storage).
124813 : // SgSIMDLoad objectArray [] = *(Memory_Block_List.begin());
124814 0 : if (SgSIMDLoad::pools.empty() == false)
124815 : {
124816 : // Generate an array of memory pools
124817 0 : SgSIMDLoad** objectArray = (SgSIMDLoad**) &(SgSIMDLoad::pools[0]);
124818 :
124819 : // Build a local variable for better performance
124820 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
124821 :
124822 : // Iterate over the memory pools
124823 0 : bool done = false;
124824 0 : unsigned i=0;
124825 :
124826 : // find the first valid IR node, call visit function, and then leave
124827 0 : while ( done == false && i < SgSIMDLoad::pools.size() )
124828 : {
124829 : // objectArray[i] is a single memory pool
124830 : unsigned j=0;
124831 0 : while (done == false && j < SgSIMDLoad::pool_size)
124832 : {
124833 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
124834 : {
124835 0 : traversal.visit(&(objectArray[i][j]));
124836 0 : done = true;
124837 : }
124838 0 : j++;
124839 : }
124840 0 : i++;
124841 : }
124842 :
124843 : #if 0
124844 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
124845 : if (done == false)
124846 : {
124847 : printf ("No representative for SgSIMDLoad found in memory pools \n");
124848 : }
124849 : #endif
124850 : }
124851 0 : }
124852 :
124853 :
124854 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
124855 : // using values that overflow signed values of int.
124856 : size_t
124857 4 : SgSIMDLoad::numberOfNodes()
124858 : {
124859 : // This function traverses the memory pool for an IR node and
124860 : // counts the number of IR nodes of a particular Sage III IR
124861 : // nodes type.
124862 :
124863 4 : size_t count = 0;
124864 4 : if (SgSIMDLoad::pools.empty() == false)
124865 : {
124866 : // Generate an array of memory pools (this is actually a STL vector,
124867 : // but it is contiguious, so OK to treat this way).
124868 0 : SgSIMDLoad** objectArray = (SgSIMDLoad**) &(SgSIMDLoad::pools[0]);
124869 :
124870 : // Build a local variable for better performance (make it a loop invariant variable).
124871 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
124872 :
124873 : // Iterate over all of the memory pools for this IR node.
124874 0 : for (unsigned int i=0; i < SgSIMDLoad::pools.size(); i++)
124875 : {
124876 : // objectArray[i] is a single memory pool, iterate over all the
124877 : // IR nodes and only count those that are valid IR nodes used in
124878 : // the AST (i.e. allocated IR nodes).
124879 0 : for (unsigned j=0; j < SgSIMDLoad::pool_size; j++)
124880 : {
124881 : // This is indexing the STL vector of C/C++ style arrays as a doubly
124882 : // indexed array access. It is OK since we have leveraged the semantics
124883 : // of STL vector memory as contigous and cast the memory as an array
124884 : // of arrays to use the 2D array indexing. Hope this is not confusing,
124885 : // but it s very fast as an implementation.
124886 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
124887 : {
124888 0 : count++;
124889 : }
124890 : }
124891 : }
124892 : }
124893 :
124894 :
124895 :
124896 4 : return count;
124897 : }
124898 :
124899 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
124900 : // using values that overflow signed values of int.
124901 : size_t
124902 0 : SgSIMDLoad::memoryUsage()
124903 : {
124904 : // This function is required because we need the class name as a type when we call sizeof
124905 : // There might be another way to implement this if we have a traversal that only called a
124906 : // representative object (one call for each type of Sage IIIIR node).
124907 0 : size_t memory = numberOfNodes() * sizeof(SgSIMDLoad);
124908 :
124909 0 : return memory;
124910 : }
124911 :
124912 : /* #line 124913 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
124913 :
124914 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
124915 : void
124916 5342 : SgSIMDBroadcast::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
124917 : {
124918 : // This function traverses the memory pool for only a specific IR node
124919 : // and calls the visit function of the input class execute a traversal
124920 : // similar to the style of the attribute based traversals within ROSE.
124921 : // This traversal will visit ALL nodes of the AST where as the other
124922 : // attribute based traversals visit only the embedded tree within the AST.
124923 :
124924 : // Initialize array to the address of the first element of the STL vector
124925 : // (which is guaranteed to be contiguous storage).
124926 : // SgSIMDBroadcast objectArray [] = *(Memory_Block_List.begin());
124927 5342 : if (SgSIMDBroadcast::pools.empty() == false)
124928 : {
124929 : // Generate an array of memory pools
124930 0 : SgSIMDBroadcast** objectArray = (SgSIMDBroadcast**) &(SgSIMDBroadcast::pools[0]);
124931 :
124932 : // Build a local variable for better performance
124933 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
124934 : #if 0
124935 : // Iterate over the memory pools
124936 : for (unsigned int i=0; i < SgSIMDBroadcast::pools.size(); i++)
124937 : {
124938 : // objectArray[i] is a single memory pool
124939 : for (int j=0; j < SgSIMDBroadcast::pool_size; j++)
124940 : {
124941 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
124942 : {
124943 : traversal.visit(&(objectArray[i][j]));
124944 : }
124945 : }
124946 : }
124947 : #else
124948 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
124949 : // compute the list first and then call the visit function on each list element.
124950 :
124951 : // printf ("Inside of SgSIMDBroadcast::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
124952 :
124953 0 : std::vector<SgSIMDBroadcast*> nodeList;
124954 :
124955 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
124956 0 : for (unsigned int i=0; i < SgSIMDBroadcast::pools.size(); i++)
124957 : {
124958 : // objectArray[i] is a single memory pool
124959 0 : for (unsigned j=0; j < SgSIMDBroadcast::pool_size; j++)
124960 : {
124961 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
124962 : {
124963 0 : nodeList.push_back(&(objectArray[i][j]));
124964 : }
124965 : }
124966 : }
124967 :
124968 : // Iterate over the saved list
124969 0 : size_t nodeListSize = nodeList.size();
124970 0 : for (size_t i=0; i < nodeListSize; i++)
124971 : {
124972 0 : ROSE_ASSERT(nodeList[i] != NULL);
124973 : #if 0
124974 : traversal.visit(nodeList[i]);
124975 : #else
124976 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
124977 : {
124978 0 : traversal.visit(nodeList[i]);
124979 : }
124980 : #endif
124981 : }
124982 : #endif
124983 : }
124984 :
124985 : // This should not be required since all previously static data members are
124986 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
124987 :
124988 5342 : }
124989 :
124990 :
124991 : void
124992 194 : SgSIMDBroadcast::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
124993 : {
124994 : // This function traverses the memory pool for an IR node and
124995 : // calls the function to execute the visitor object.
124996 :
124997 : // Initialize array to the address of the first element of the STL vector
124998 : // (which is guarenteed to be contiguous storage).
124999 : // SgSIMDBroadcast objectArray [] = *(Memory_Block_List.begin());
125000 194 : if (SgSIMDBroadcast::pools.empty() == false)
125001 : {
125002 : // Generate an array of memory pools
125003 0 : SgSIMDBroadcast** objectArray = (SgSIMDBroadcast**) &(SgSIMDBroadcast::pools[0]);
125004 :
125005 : // Build a local variable for better performance
125006 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
125007 :
125008 : // Iterate over the memory pools
125009 0 : for (unsigned int i=0; i < SgSIMDBroadcast::pools.size(); i++)
125010 : {
125011 : // objectArray[i] is a single memory pool
125012 0 : for (unsigned j=0; j < SgSIMDBroadcast::pool_size; j++)
125013 : {
125014 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
125015 : {
125016 : // printf ("Found a valid SgSIMDBroadcast object in the memory pool %d at position %d \n",i,j);
125017 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
125018 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
125019 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
125020 : }
125021 : else
125022 : {
125023 : // printf ("Found a INVALID SgSIMDBroadcast object in the memory pool \n");
125024 : }
125025 : }
125026 : }
125027 : }
125028 :
125029 : // This should not be required since all previously static data members are
125030 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
125031 :
125032 194 : }
125033 :
125034 : void
125035 0 : SgSIMDBroadcast::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
125036 : {
125037 : // This function visits only a single IR node of the memory pool.
125038 : // it is typically called once for each type of IR node within
125039 : // the automatically generated function: traverseRepresentativeNodes().
125040 :
125041 : // Initialize array to the address of the first element of the STL vector
125042 : // (which is guarenteed to be contiguous storage).
125043 : // SgSIMDBroadcast objectArray [] = *(Memory_Block_List.begin());
125044 0 : if (SgSIMDBroadcast::pools.empty() == false)
125045 : {
125046 : // Generate an array of memory pools
125047 0 : SgSIMDBroadcast** objectArray = (SgSIMDBroadcast**) &(SgSIMDBroadcast::pools[0]);
125048 :
125049 : // Build a local variable for better performance
125050 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
125051 :
125052 : // Iterate over the memory pools
125053 0 : bool done = false;
125054 0 : unsigned i=0;
125055 :
125056 : // find the first valid IR node, call visit function, and then leave
125057 0 : while ( done == false && i < SgSIMDBroadcast::pools.size() )
125058 : {
125059 : // objectArray[i] is a single memory pool
125060 : unsigned j=0;
125061 0 : while (done == false && j < SgSIMDBroadcast::pool_size)
125062 : {
125063 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
125064 : {
125065 0 : traversal.visit(&(objectArray[i][j]));
125066 0 : done = true;
125067 : }
125068 0 : j++;
125069 : }
125070 0 : i++;
125071 : }
125072 :
125073 : #if 0
125074 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
125075 : if (done == false)
125076 : {
125077 : printf ("No representative for SgSIMDBroadcast found in memory pools \n");
125078 : }
125079 : #endif
125080 : }
125081 0 : }
125082 :
125083 :
125084 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
125085 : // using values that overflow signed values of int.
125086 : size_t
125087 4 : SgSIMDBroadcast::numberOfNodes()
125088 : {
125089 : // This function traverses the memory pool for an IR node and
125090 : // counts the number of IR nodes of a particular Sage III IR
125091 : // nodes type.
125092 :
125093 4 : size_t count = 0;
125094 4 : if (SgSIMDBroadcast::pools.empty() == false)
125095 : {
125096 : // Generate an array of memory pools (this is actually a STL vector,
125097 : // but it is contiguious, so OK to treat this way).
125098 0 : SgSIMDBroadcast** objectArray = (SgSIMDBroadcast**) &(SgSIMDBroadcast::pools[0]);
125099 :
125100 : // Build a local variable for better performance (make it a loop invariant variable).
125101 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
125102 :
125103 : // Iterate over all of the memory pools for this IR node.
125104 0 : for (unsigned int i=0; i < SgSIMDBroadcast::pools.size(); i++)
125105 : {
125106 : // objectArray[i] is a single memory pool, iterate over all the
125107 : // IR nodes and only count those that are valid IR nodes used in
125108 : // the AST (i.e. allocated IR nodes).
125109 0 : for (unsigned j=0; j < SgSIMDBroadcast::pool_size; j++)
125110 : {
125111 : // This is indexing the STL vector of C/C++ style arrays as a doubly
125112 : // indexed array access. It is OK since we have leveraged the semantics
125113 : // of STL vector memory as contigous and cast the memory as an array
125114 : // of arrays to use the 2D array indexing. Hope this is not confusing,
125115 : // but it s very fast as an implementation.
125116 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
125117 : {
125118 0 : count++;
125119 : }
125120 : }
125121 : }
125122 : }
125123 :
125124 :
125125 :
125126 4 : return count;
125127 : }
125128 :
125129 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
125130 : // using values that overflow signed values of int.
125131 : size_t
125132 0 : SgSIMDBroadcast::memoryUsage()
125133 : {
125134 : // This function is required because we need the class name as a type when we call sizeof
125135 : // There might be another way to implement this if we have a traversal that only called a
125136 : // representative object (one call for each type of Sage IIIIR node).
125137 0 : size_t memory = numberOfNodes() * sizeof(SgSIMDBroadcast);
125138 :
125139 0 : return memory;
125140 : }
125141 :
125142 : /* #line 125143 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
125143 :
125144 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
125145 : void
125146 5342 : SgSIMDStore::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
125147 : {
125148 : // This function traverses the memory pool for only a specific IR node
125149 : // and calls the visit function of the input class execute a traversal
125150 : // similar to the style of the attribute based traversals within ROSE.
125151 : // This traversal will visit ALL nodes of the AST where as the other
125152 : // attribute based traversals visit only the embedded tree within the AST.
125153 :
125154 : // Initialize array to the address of the first element of the STL vector
125155 : // (which is guaranteed to be contiguous storage).
125156 : // SgSIMDStore objectArray [] = *(Memory_Block_List.begin());
125157 5342 : if (SgSIMDStore::pools.empty() == false)
125158 : {
125159 : // Generate an array of memory pools
125160 0 : SgSIMDStore** objectArray = (SgSIMDStore**) &(SgSIMDStore::pools[0]);
125161 :
125162 : // Build a local variable for better performance
125163 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
125164 : #if 0
125165 : // Iterate over the memory pools
125166 : for (unsigned int i=0; i < SgSIMDStore::pools.size(); i++)
125167 : {
125168 : // objectArray[i] is a single memory pool
125169 : for (int j=0; j < SgSIMDStore::pool_size; j++)
125170 : {
125171 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
125172 : {
125173 : traversal.visit(&(objectArray[i][j]));
125174 : }
125175 : }
125176 : }
125177 : #else
125178 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
125179 : // compute the list first and then call the visit function on each list element.
125180 :
125181 : // printf ("Inside of SgSIMDStore::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
125182 :
125183 0 : std::vector<SgSIMDStore*> nodeList;
125184 :
125185 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
125186 0 : for (unsigned int i=0; i < SgSIMDStore::pools.size(); i++)
125187 : {
125188 : // objectArray[i] is a single memory pool
125189 0 : for (unsigned j=0; j < SgSIMDStore::pool_size; j++)
125190 : {
125191 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
125192 : {
125193 0 : nodeList.push_back(&(objectArray[i][j]));
125194 : }
125195 : }
125196 : }
125197 :
125198 : // Iterate over the saved list
125199 0 : size_t nodeListSize = nodeList.size();
125200 0 : for (size_t i=0; i < nodeListSize; i++)
125201 : {
125202 0 : ROSE_ASSERT(nodeList[i] != NULL);
125203 : #if 0
125204 : traversal.visit(nodeList[i]);
125205 : #else
125206 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
125207 : {
125208 0 : traversal.visit(nodeList[i]);
125209 : }
125210 : #endif
125211 : }
125212 : #endif
125213 : }
125214 :
125215 : // This should not be required since all previously static data members are
125216 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
125217 :
125218 5342 : }
125219 :
125220 :
125221 : void
125222 194 : SgSIMDStore::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
125223 : {
125224 : // This function traverses the memory pool for an IR node and
125225 : // calls the function to execute the visitor object.
125226 :
125227 : // Initialize array to the address of the first element of the STL vector
125228 : // (which is guarenteed to be contiguous storage).
125229 : // SgSIMDStore objectArray [] = *(Memory_Block_List.begin());
125230 194 : if (SgSIMDStore::pools.empty() == false)
125231 : {
125232 : // Generate an array of memory pools
125233 0 : SgSIMDStore** objectArray = (SgSIMDStore**) &(SgSIMDStore::pools[0]);
125234 :
125235 : // Build a local variable for better performance
125236 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
125237 :
125238 : // Iterate over the memory pools
125239 0 : for (unsigned int i=0; i < SgSIMDStore::pools.size(); i++)
125240 : {
125241 : // objectArray[i] is a single memory pool
125242 0 : for (unsigned j=0; j < SgSIMDStore::pool_size; j++)
125243 : {
125244 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
125245 : {
125246 : // printf ("Found a valid SgSIMDStore object in the memory pool %d at position %d \n",i,j);
125247 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
125248 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
125249 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
125250 : }
125251 : else
125252 : {
125253 : // printf ("Found a INVALID SgSIMDStore object in the memory pool \n");
125254 : }
125255 : }
125256 : }
125257 : }
125258 :
125259 : // This should not be required since all previously static data members are
125260 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
125261 :
125262 194 : }
125263 :
125264 : void
125265 0 : SgSIMDStore::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
125266 : {
125267 : // This function visits only a single IR node of the memory pool.
125268 : // it is typically called once for each type of IR node within
125269 : // the automatically generated function: traverseRepresentativeNodes().
125270 :
125271 : // Initialize array to the address of the first element of the STL vector
125272 : // (which is guarenteed to be contiguous storage).
125273 : // SgSIMDStore objectArray [] = *(Memory_Block_List.begin());
125274 0 : if (SgSIMDStore::pools.empty() == false)
125275 : {
125276 : // Generate an array of memory pools
125277 0 : SgSIMDStore** objectArray = (SgSIMDStore**) &(SgSIMDStore::pools[0]);
125278 :
125279 : // Build a local variable for better performance
125280 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
125281 :
125282 : // Iterate over the memory pools
125283 0 : bool done = false;
125284 0 : unsigned i=0;
125285 :
125286 : // find the first valid IR node, call visit function, and then leave
125287 0 : while ( done == false && i < SgSIMDStore::pools.size() )
125288 : {
125289 : // objectArray[i] is a single memory pool
125290 : unsigned j=0;
125291 0 : while (done == false && j < SgSIMDStore::pool_size)
125292 : {
125293 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
125294 : {
125295 0 : traversal.visit(&(objectArray[i][j]));
125296 0 : done = true;
125297 : }
125298 0 : j++;
125299 : }
125300 0 : i++;
125301 : }
125302 :
125303 : #if 0
125304 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
125305 : if (done == false)
125306 : {
125307 : printf ("No representative for SgSIMDStore found in memory pools \n");
125308 : }
125309 : #endif
125310 : }
125311 0 : }
125312 :
125313 :
125314 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
125315 : // using values that overflow signed values of int.
125316 : size_t
125317 4 : SgSIMDStore::numberOfNodes()
125318 : {
125319 : // This function traverses the memory pool for an IR node and
125320 : // counts the number of IR nodes of a particular Sage III IR
125321 : // nodes type.
125322 :
125323 4 : size_t count = 0;
125324 4 : if (SgSIMDStore::pools.empty() == false)
125325 : {
125326 : // Generate an array of memory pools (this is actually a STL vector,
125327 : // but it is contiguious, so OK to treat this way).
125328 0 : SgSIMDStore** objectArray = (SgSIMDStore**) &(SgSIMDStore::pools[0]);
125329 :
125330 : // Build a local variable for better performance (make it a loop invariant variable).
125331 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
125332 :
125333 : // Iterate over all of the memory pools for this IR node.
125334 0 : for (unsigned int i=0; i < SgSIMDStore::pools.size(); i++)
125335 : {
125336 : // objectArray[i] is a single memory pool, iterate over all the
125337 : // IR nodes and only count those that are valid IR nodes used in
125338 : // the AST (i.e. allocated IR nodes).
125339 0 : for (unsigned j=0; j < SgSIMDStore::pool_size; j++)
125340 : {
125341 : // This is indexing the STL vector of C/C++ style arrays as a doubly
125342 : // indexed array access. It is OK since we have leveraged the semantics
125343 : // of STL vector memory as contigous and cast the memory as an array
125344 : // of arrays to use the 2D array indexing. Hope this is not confusing,
125345 : // but it s very fast as an implementation.
125346 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
125347 : {
125348 0 : count++;
125349 : }
125350 : }
125351 : }
125352 : }
125353 :
125354 :
125355 :
125356 4 : return count;
125357 : }
125358 :
125359 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
125360 : // using values that overflow signed values of int.
125361 : size_t
125362 0 : SgSIMDStore::memoryUsage()
125363 : {
125364 : // This function is required because we need the class name as a type when we call sizeof
125365 : // There might be another way to implement this if we have a traversal that only called a
125366 : // representative object (one call for each type of Sage IIIIR node).
125367 0 : size_t memory = numberOfNodes() * sizeof(SgSIMDStore);
125368 :
125369 0 : return memory;
125370 : }
125371 :
125372 : /* #line 125373 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
125373 :
125374 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
125375 : void
125376 5342 : SgSIMDPartialStore::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
125377 : {
125378 : // This function traverses the memory pool for only a specific IR node
125379 : // and calls the visit function of the input class execute a traversal
125380 : // similar to the style of the attribute based traversals within ROSE.
125381 : // This traversal will visit ALL nodes of the AST where as the other
125382 : // attribute based traversals visit only the embedded tree within the AST.
125383 :
125384 : // Initialize array to the address of the first element of the STL vector
125385 : // (which is guaranteed to be contiguous storage).
125386 : // SgSIMDPartialStore objectArray [] = *(Memory_Block_List.begin());
125387 5342 : if (SgSIMDPartialStore::pools.empty() == false)
125388 : {
125389 : // Generate an array of memory pools
125390 0 : SgSIMDPartialStore** objectArray = (SgSIMDPartialStore**) &(SgSIMDPartialStore::pools[0]);
125391 :
125392 : // Build a local variable for better performance
125393 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
125394 : #if 0
125395 : // Iterate over the memory pools
125396 : for (unsigned int i=0; i < SgSIMDPartialStore::pools.size(); i++)
125397 : {
125398 : // objectArray[i] is a single memory pool
125399 : for (int j=0; j < SgSIMDPartialStore::pool_size; j++)
125400 : {
125401 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
125402 : {
125403 : traversal.visit(&(objectArray[i][j]));
125404 : }
125405 : }
125406 : }
125407 : #else
125408 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
125409 : // compute the list first and then call the visit function on each list element.
125410 :
125411 : // printf ("Inside of SgSIMDPartialStore::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
125412 :
125413 0 : std::vector<SgSIMDPartialStore*> nodeList;
125414 :
125415 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
125416 0 : for (unsigned int i=0; i < SgSIMDPartialStore::pools.size(); i++)
125417 : {
125418 : // objectArray[i] is a single memory pool
125419 0 : for (unsigned j=0; j < SgSIMDPartialStore::pool_size; j++)
125420 : {
125421 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
125422 : {
125423 0 : nodeList.push_back(&(objectArray[i][j]));
125424 : }
125425 : }
125426 : }
125427 :
125428 : // Iterate over the saved list
125429 0 : size_t nodeListSize = nodeList.size();
125430 0 : for (size_t i=0; i < nodeListSize; i++)
125431 : {
125432 0 : ROSE_ASSERT(nodeList[i] != NULL);
125433 : #if 0
125434 : traversal.visit(nodeList[i]);
125435 : #else
125436 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
125437 : {
125438 0 : traversal.visit(nodeList[i]);
125439 : }
125440 : #endif
125441 : }
125442 : #endif
125443 : }
125444 :
125445 : // This should not be required since all previously static data members are
125446 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
125447 :
125448 5342 : }
125449 :
125450 :
125451 : void
125452 194 : SgSIMDPartialStore::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
125453 : {
125454 : // This function traverses the memory pool for an IR node and
125455 : // calls the function to execute the visitor object.
125456 :
125457 : // Initialize array to the address of the first element of the STL vector
125458 : // (which is guarenteed to be contiguous storage).
125459 : // SgSIMDPartialStore objectArray [] = *(Memory_Block_List.begin());
125460 194 : if (SgSIMDPartialStore::pools.empty() == false)
125461 : {
125462 : // Generate an array of memory pools
125463 0 : SgSIMDPartialStore** objectArray = (SgSIMDPartialStore**) &(SgSIMDPartialStore::pools[0]);
125464 :
125465 : // Build a local variable for better performance
125466 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
125467 :
125468 : // Iterate over the memory pools
125469 0 : for (unsigned int i=0; i < SgSIMDPartialStore::pools.size(); i++)
125470 : {
125471 : // objectArray[i] is a single memory pool
125472 0 : for (unsigned j=0; j < SgSIMDPartialStore::pool_size; j++)
125473 : {
125474 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
125475 : {
125476 : // printf ("Found a valid SgSIMDPartialStore object in the memory pool %d at position %d \n",i,j);
125477 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
125478 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
125479 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
125480 : }
125481 : else
125482 : {
125483 : // printf ("Found a INVALID SgSIMDPartialStore object in the memory pool \n");
125484 : }
125485 : }
125486 : }
125487 : }
125488 :
125489 : // This should not be required since all previously static data members are
125490 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
125491 :
125492 194 : }
125493 :
125494 : void
125495 0 : SgSIMDPartialStore::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
125496 : {
125497 : // This function visits only a single IR node of the memory pool.
125498 : // it is typically called once for each type of IR node within
125499 : // the automatically generated function: traverseRepresentativeNodes().
125500 :
125501 : // Initialize array to the address of the first element of the STL vector
125502 : // (which is guarenteed to be contiguous storage).
125503 : // SgSIMDPartialStore objectArray [] = *(Memory_Block_List.begin());
125504 0 : if (SgSIMDPartialStore::pools.empty() == false)
125505 : {
125506 : // Generate an array of memory pools
125507 0 : SgSIMDPartialStore** objectArray = (SgSIMDPartialStore**) &(SgSIMDPartialStore::pools[0]);
125508 :
125509 : // Build a local variable for better performance
125510 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
125511 :
125512 : // Iterate over the memory pools
125513 0 : bool done = false;
125514 0 : unsigned i=0;
125515 :
125516 : // find the first valid IR node, call visit function, and then leave
125517 0 : while ( done == false && i < SgSIMDPartialStore::pools.size() )
125518 : {
125519 : // objectArray[i] is a single memory pool
125520 : unsigned j=0;
125521 0 : while (done == false && j < SgSIMDPartialStore::pool_size)
125522 : {
125523 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
125524 : {
125525 0 : traversal.visit(&(objectArray[i][j]));
125526 0 : done = true;
125527 : }
125528 0 : j++;
125529 : }
125530 0 : i++;
125531 : }
125532 :
125533 : #if 0
125534 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
125535 : if (done == false)
125536 : {
125537 : printf ("No representative for SgSIMDPartialStore found in memory pools \n");
125538 : }
125539 : #endif
125540 : }
125541 0 : }
125542 :
125543 :
125544 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
125545 : // using values that overflow signed values of int.
125546 : size_t
125547 4 : SgSIMDPartialStore::numberOfNodes()
125548 : {
125549 : // This function traverses the memory pool for an IR node and
125550 : // counts the number of IR nodes of a particular Sage III IR
125551 : // nodes type.
125552 :
125553 4 : size_t count = 0;
125554 4 : if (SgSIMDPartialStore::pools.empty() == false)
125555 : {
125556 : // Generate an array of memory pools (this is actually a STL vector,
125557 : // but it is contiguious, so OK to treat this way).
125558 0 : SgSIMDPartialStore** objectArray = (SgSIMDPartialStore**) &(SgSIMDPartialStore::pools[0]);
125559 :
125560 : // Build a local variable for better performance (make it a loop invariant variable).
125561 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
125562 :
125563 : // Iterate over all of the memory pools for this IR node.
125564 0 : for (unsigned int i=0; i < SgSIMDPartialStore::pools.size(); i++)
125565 : {
125566 : // objectArray[i] is a single memory pool, iterate over all the
125567 : // IR nodes and only count those that are valid IR nodes used in
125568 : // the AST (i.e. allocated IR nodes).
125569 0 : for (unsigned j=0; j < SgSIMDPartialStore::pool_size; j++)
125570 : {
125571 : // This is indexing the STL vector of C/C++ style arrays as a doubly
125572 : // indexed array access. It is OK since we have leveraged the semantics
125573 : // of STL vector memory as contigous and cast the memory as an array
125574 : // of arrays to use the 2D array indexing. Hope this is not confusing,
125575 : // but it s very fast as an implementation.
125576 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
125577 : {
125578 0 : count++;
125579 : }
125580 : }
125581 : }
125582 : }
125583 :
125584 :
125585 :
125586 4 : return count;
125587 : }
125588 :
125589 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
125590 : // using values that overflow signed values of int.
125591 : size_t
125592 0 : SgSIMDPartialStore::memoryUsage()
125593 : {
125594 : // This function is required because we need the class name as a type when we call sizeof
125595 : // There might be another way to implement this if we have a traversal that only called a
125596 : // representative object (one call for each type of Sage IIIIR node).
125597 0 : size_t memory = numberOfNodes() * sizeof(SgSIMDPartialStore);
125598 :
125599 0 : return memory;
125600 : }
125601 :
125602 : /* #line 125603 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
125603 :
125604 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
125605 : void
125606 5342 : SgSIMDScalarStore::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
125607 : {
125608 : // This function traverses the memory pool for only a specific IR node
125609 : // and calls the visit function of the input class execute a traversal
125610 : // similar to the style of the attribute based traversals within ROSE.
125611 : // This traversal will visit ALL nodes of the AST where as the other
125612 : // attribute based traversals visit only the embedded tree within the AST.
125613 :
125614 : // Initialize array to the address of the first element of the STL vector
125615 : // (which is guaranteed to be contiguous storage).
125616 : // SgSIMDScalarStore objectArray [] = *(Memory_Block_List.begin());
125617 5342 : if (SgSIMDScalarStore::pools.empty() == false)
125618 : {
125619 : // Generate an array of memory pools
125620 0 : SgSIMDScalarStore** objectArray = (SgSIMDScalarStore**) &(SgSIMDScalarStore::pools[0]);
125621 :
125622 : // Build a local variable for better performance
125623 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
125624 : #if 0
125625 : // Iterate over the memory pools
125626 : for (unsigned int i=0; i < SgSIMDScalarStore::pools.size(); i++)
125627 : {
125628 : // objectArray[i] is a single memory pool
125629 : for (int j=0; j < SgSIMDScalarStore::pool_size; j++)
125630 : {
125631 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
125632 : {
125633 : traversal.visit(&(objectArray[i][j]));
125634 : }
125635 : }
125636 : }
125637 : #else
125638 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
125639 : // compute the list first and then call the visit function on each list element.
125640 :
125641 : // printf ("Inside of SgSIMDScalarStore::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
125642 :
125643 0 : std::vector<SgSIMDScalarStore*> nodeList;
125644 :
125645 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
125646 0 : for (unsigned int i=0; i < SgSIMDScalarStore::pools.size(); i++)
125647 : {
125648 : // objectArray[i] is a single memory pool
125649 0 : for (unsigned j=0; j < SgSIMDScalarStore::pool_size; j++)
125650 : {
125651 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
125652 : {
125653 0 : nodeList.push_back(&(objectArray[i][j]));
125654 : }
125655 : }
125656 : }
125657 :
125658 : // Iterate over the saved list
125659 0 : size_t nodeListSize = nodeList.size();
125660 0 : for (size_t i=0; i < nodeListSize; i++)
125661 : {
125662 0 : ROSE_ASSERT(nodeList[i] != NULL);
125663 : #if 0
125664 : traversal.visit(nodeList[i]);
125665 : #else
125666 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
125667 : {
125668 0 : traversal.visit(nodeList[i]);
125669 : }
125670 : #endif
125671 : }
125672 : #endif
125673 : }
125674 :
125675 : // This should not be required since all previously static data members are
125676 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
125677 :
125678 5342 : }
125679 :
125680 :
125681 : void
125682 194 : SgSIMDScalarStore::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
125683 : {
125684 : // This function traverses the memory pool for an IR node and
125685 : // calls the function to execute the visitor object.
125686 :
125687 : // Initialize array to the address of the first element of the STL vector
125688 : // (which is guarenteed to be contiguous storage).
125689 : // SgSIMDScalarStore objectArray [] = *(Memory_Block_List.begin());
125690 194 : if (SgSIMDScalarStore::pools.empty() == false)
125691 : {
125692 : // Generate an array of memory pools
125693 0 : SgSIMDScalarStore** objectArray = (SgSIMDScalarStore**) &(SgSIMDScalarStore::pools[0]);
125694 :
125695 : // Build a local variable for better performance
125696 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
125697 :
125698 : // Iterate over the memory pools
125699 0 : for (unsigned int i=0; i < SgSIMDScalarStore::pools.size(); i++)
125700 : {
125701 : // objectArray[i] is a single memory pool
125702 0 : for (unsigned j=0; j < SgSIMDScalarStore::pool_size; j++)
125703 : {
125704 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
125705 : {
125706 : // printf ("Found a valid SgSIMDScalarStore object in the memory pool %d at position %d \n",i,j);
125707 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
125708 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
125709 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
125710 : }
125711 : else
125712 : {
125713 : // printf ("Found a INVALID SgSIMDScalarStore object in the memory pool \n");
125714 : }
125715 : }
125716 : }
125717 : }
125718 :
125719 : // This should not be required since all previously static data members are
125720 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
125721 :
125722 194 : }
125723 :
125724 : void
125725 0 : SgSIMDScalarStore::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
125726 : {
125727 : // This function visits only a single IR node of the memory pool.
125728 : // it is typically called once for each type of IR node within
125729 : // the automatically generated function: traverseRepresentativeNodes().
125730 :
125731 : // Initialize array to the address of the first element of the STL vector
125732 : // (which is guarenteed to be contiguous storage).
125733 : // SgSIMDScalarStore objectArray [] = *(Memory_Block_List.begin());
125734 0 : if (SgSIMDScalarStore::pools.empty() == false)
125735 : {
125736 : // Generate an array of memory pools
125737 0 : SgSIMDScalarStore** objectArray = (SgSIMDScalarStore**) &(SgSIMDScalarStore::pools[0]);
125738 :
125739 : // Build a local variable for better performance
125740 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
125741 :
125742 : // Iterate over the memory pools
125743 0 : bool done = false;
125744 0 : unsigned i=0;
125745 :
125746 : // find the first valid IR node, call visit function, and then leave
125747 0 : while ( done == false && i < SgSIMDScalarStore::pools.size() )
125748 : {
125749 : // objectArray[i] is a single memory pool
125750 : unsigned j=0;
125751 0 : while (done == false && j < SgSIMDScalarStore::pool_size)
125752 : {
125753 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
125754 : {
125755 0 : traversal.visit(&(objectArray[i][j]));
125756 0 : done = true;
125757 : }
125758 0 : j++;
125759 : }
125760 0 : i++;
125761 : }
125762 :
125763 : #if 0
125764 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
125765 : if (done == false)
125766 : {
125767 : printf ("No representative for SgSIMDScalarStore found in memory pools \n");
125768 : }
125769 : #endif
125770 : }
125771 0 : }
125772 :
125773 :
125774 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
125775 : // using values that overflow signed values of int.
125776 : size_t
125777 4 : SgSIMDScalarStore::numberOfNodes()
125778 : {
125779 : // This function traverses the memory pool for an IR node and
125780 : // counts the number of IR nodes of a particular Sage III IR
125781 : // nodes type.
125782 :
125783 4 : size_t count = 0;
125784 4 : if (SgSIMDScalarStore::pools.empty() == false)
125785 : {
125786 : // Generate an array of memory pools (this is actually a STL vector,
125787 : // but it is contiguious, so OK to treat this way).
125788 0 : SgSIMDScalarStore** objectArray = (SgSIMDScalarStore**) &(SgSIMDScalarStore::pools[0]);
125789 :
125790 : // Build a local variable for better performance (make it a loop invariant variable).
125791 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
125792 :
125793 : // Iterate over all of the memory pools for this IR node.
125794 0 : for (unsigned int i=0; i < SgSIMDScalarStore::pools.size(); i++)
125795 : {
125796 : // objectArray[i] is a single memory pool, iterate over all the
125797 : // IR nodes and only count those that are valid IR nodes used in
125798 : // the AST (i.e. allocated IR nodes).
125799 0 : for (unsigned j=0; j < SgSIMDScalarStore::pool_size; j++)
125800 : {
125801 : // This is indexing the STL vector of C/C++ style arrays as a doubly
125802 : // indexed array access. It is OK since we have leveraged the semantics
125803 : // of STL vector memory as contigous and cast the memory as an array
125804 : // of arrays to use the 2D array indexing. Hope this is not confusing,
125805 : // but it s very fast as an implementation.
125806 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
125807 : {
125808 0 : count++;
125809 : }
125810 : }
125811 : }
125812 : }
125813 :
125814 :
125815 :
125816 4 : return count;
125817 : }
125818 :
125819 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
125820 : // using values that overflow signed values of int.
125821 : size_t
125822 0 : SgSIMDScalarStore::memoryUsage()
125823 : {
125824 : // This function is required because we need the class name as a type when we call sizeof
125825 : // There might be another way to implement this if we have a traversal that only called a
125826 : // representative object (one call for each type of Sage IIIIR node).
125827 0 : size_t memory = numberOfNodes() * sizeof(SgSIMDScalarStore);
125828 :
125829 0 : return memory;
125830 : }
125831 :
125832 : /* #line 125833 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
125833 :
125834 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
125835 : void
125836 5342 : SgSIMDGather::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
125837 : {
125838 : // This function traverses the memory pool for only a specific IR node
125839 : // and calls the visit function of the input class execute a traversal
125840 : // similar to the style of the attribute based traversals within ROSE.
125841 : // This traversal will visit ALL nodes of the AST where as the other
125842 : // attribute based traversals visit only the embedded tree within the AST.
125843 :
125844 : // Initialize array to the address of the first element of the STL vector
125845 : // (which is guaranteed to be contiguous storage).
125846 : // SgSIMDGather objectArray [] = *(Memory_Block_List.begin());
125847 5342 : if (SgSIMDGather::pools.empty() == false)
125848 : {
125849 : // Generate an array of memory pools
125850 0 : SgSIMDGather** objectArray = (SgSIMDGather**) &(SgSIMDGather::pools[0]);
125851 :
125852 : // Build a local variable for better performance
125853 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
125854 : #if 0
125855 : // Iterate over the memory pools
125856 : for (unsigned int i=0; i < SgSIMDGather::pools.size(); i++)
125857 : {
125858 : // objectArray[i] is a single memory pool
125859 : for (int j=0; j < SgSIMDGather::pool_size; j++)
125860 : {
125861 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
125862 : {
125863 : traversal.visit(&(objectArray[i][j]));
125864 : }
125865 : }
125866 : }
125867 : #else
125868 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
125869 : // compute the list first and then call the visit function on each list element.
125870 :
125871 : // printf ("Inside of SgSIMDGather::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
125872 :
125873 0 : std::vector<SgSIMDGather*> nodeList;
125874 :
125875 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
125876 0 : for (unsigned int i=0; i < SgSIMDGather::pools.size(); i++)
125877 : {
125878 : // objectArray[i] is a single memory pool
125879 0 : for (unsigned j=0; j < SgSIMDGather::pool_size; j++)
125880 : {
125881 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
125882 : {
125883 0 : nodeList.push_back(&(objectArray[i][j]));
125884 : }
125885 : }
125886 : }
125887 :
125888 : // Iterate over the saved list
125889 0 : size_t nodeListSize = nodeList.size();
125890 0 : for (size_t i=0; i < nodeListSize; i++)
125891 : {
125892 0 : ROSE_ASSERT(nodeList[i] != NULL);
125893 : #if 0
125894 : traversal.visit(nodeList[i]);
125895 : #else
125896 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
125897 : {
125898 0 : traversal.visit(nodeList[i]);
125899 : }
125900 : #endif
125901 : }
125902 : #endif
125903 : }
125904 :
125905 : // This should not be required since all previously static data members are
125906 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
125907 :
125908 5342 : }
125909 :
125910 :
125911 : void
125912 194 : SgSIMDGather::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
125913 : {
125914 : // This function traverses the memory pool for an IR node and
125915 : // calls the function to execute the visitor object.
125916 :
125917 : // Initialize array to the address of the first element of the STL vector
125918 : // (which is guarenteed to be contiguous storage).
125919 : // SgSIMDGather objectArray [] = *(Memory_Block_List.begin());
125920 194 : if (SgSIMDGather::pools.empty() == false)
125921 : {
125922 : // Generate an array of memory pools
125923 0 : SgSIMDGather** objectArray = (SgSIMDGather**) &(SgSIMDGather::pools[0]);
125924 :
125925 : // Build a local variable for better performance
125926 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
125927 :
125928 : // Iterate over the memory pools
125929 0 : for (unsigned int i=0; i < SgSIMDGather::pools.size(); i++)
125930 : {
125931 : // objectArray[i] is a single memory pool
125932 0 : for (unsigned j=0; j < SgSIMDGather::pool_size; j++)
125933 : {
125934 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
125935 : {
125936 : // printf ("Found a valid SgSIMDGather object in the memory pool %d at position %d \n",i,j);
125937 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
125938 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
125939 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
125940 : }
125941 : else
125942 : {
125943 : // printf ("Found a INVALID SgSIMDGather object in the memory pool \n");
125944 : }
125945 : }
125946 : }
125947 : }
125948 :
125949 : // This should not be required since all previously static data members are
125950 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
125951 :
125952 194 : }
125953 :
125954 : void
125955 0 : SgSIMDGather::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
125956 : {
125957 : // This function visits only a single IR node of the memory pool.
125958 : // it is typically called once for each type of IR node within
125959 : // the automatically generated function: traverseRepresentativeNodes().
125960 :
125961 : // Initialize array to the address of the first element of the STL vector
125962 : // (which is guarenteed to be contiguous storage).
125963 : // SgSIMDGather objectArray [] = *(Memory_Block_List.begin());
125964 0 : if (SgSIMDGather::pools.empty() == false)
125965 : {
125966 : // Generate an array of memory pools
125967 0 : SgSIMDGather** objectArray = (SgSIMDGather**) &(SgSIMDGather::pools[0]);
125968 :
125969 : // Build a local variable for better performance
125970 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
125971 :
125972 : // Iterate over the memory pools
125973 0 : bool done = false;
125974 0 : unsigned i=0;
125975 :
125976 : // find the first valid IR node, call visit function, and then leave
125977 0 : while ( done == false && i < SgSIMDGather::pools.size() )
125978 : {
125979 : // objectArray[i] is a single memory pool
125980 : unsigned j=0;
125981 0 : while (done == false && j < SgSIMDGather::pool_size)
125982 : {
125983 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
125984 : {
125985 0 : traversal.visit(&(objectArray[i][j]));
125986 0 : done = true;
125987 : }
125988 0 : j++;
125989 : }
125990 0 : i++;
125991 : }
125992 :
125993 : #if 0
125994 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
125995 : if (done == false)
125996 : {
125997 : printf ("No representative for SgSIMDGather found in memory pools \n");
125998 : }
125999 : #endif
126000 : }
126001 0 : }
126002 :
126003 :
126004 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
126005 : // using values that overflow signed values of int.
126006 : size_t
126007 4 : SgSIMDGather::numberOfNodes()
126008 : {
126009 : // This function traverses the memory pool for an IR node and
126010 : // counts the number of IR nodes of a particular Sage III IR
126011 : // nodes type.
126012 :
126013 4 : size_t count = 0;
126014 4 : if (SgSIMDGather::pools.empty() == false)
126015 : {
126016 : // Generate an array of memory pools (this is actually a STL vector,
126017 : // but it is contiguious, so OK to treat this way).
126018 0 : SgSIMDGather** objectArray = (SgSIMDGather**) &(SgSIMDGather::pools[0]);
126019 :
126020 : // Build a local variable for better performance (make it a loop invariant variable).
126021 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
126022 :
126023 : // Iterate over all of the memory pools for this IR node.
126024 0 : for (unsigned int i=0; i < SgSIMDGather::pools.size(); i++)
126025 : {
126026 : // objectArray[i] is a single memory pool, iterate over all the
126027 : // IR nodes and only count those that are valid IR nodes used in
126028 : // the AST (i.e. allocated IR nodes).
126029 0 : for (unsigned j=0; j < SgSIMDGather::pool_size; j++)
126030 : {
126031 : // This is indexing the STL vector of C/C++ style arrays as a doubly
126032 : // indexed array access. It is OK since we have leveraged the semantics
126033 : // of STL vector memory as contigous and cast the memory as an array
126034 : // of arrays to use the 2D array indexing. Hope this is not confusing,
126035 : // but it s very fast as an implementation.
126036 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
126037 : {
126038 0 : count++;
126039 : }
126040 : }
126041 : }
126042 : }
126043 :
126044 :
126045 :
126046 4 : return count;
126047 : }
126048 :
126049 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
126050 : // using values that overflow signed values of int.
126051 : size_t
126052 0 : SgSIMDGather::memoryUsage()
126053 : {
126054 : // This function is required because we need the class name as a type when we call sizeof
126055 : // There might be another way to implement this if we have a traversal that only called a
126056 : // representative object (one call for each type of Sage IIIIR node).
126057 0 : size_t memory = numberOfNodes() * sizeof(SgSIMDGather);
126058 :
126059 0 : return memory;
126060 : }
126061 :
126062 : /* #line 126063 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
126063 :
126064 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
126065 : void
126066 5342 : SgSIMDExplicitGather::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
126067 : {
126068 : // This function traverses the memory pool for only a specific IR node
126069 : // and calls the visit function of the input class execute a traversal
126070 : // similar to the style of the attribute based traversals within ROSE.
126071 : // This traversal will visit ALL nodes of the AST where as the other
126072 : // attribute based traversals visit only the embedded tree within the AST.
126073 :
126074 : // Initialize array to the address of the first element of the STL vector
126075 : // (which is guaranteed to be contiguous storage).
126076 : // SgSIMDExplicitGather objectArray [] = *(Memory_Block_List.begin());
126077 5342 : if (SgSIMDExplicitGather::pools.empty() == false)
126078 : {
126079 : // Generate an array of memory pools
126080 0 : SgSIMDExplicitGather** objectArray = (SgSIMDExplicitGather**) &(SgSIMDExplicitGather::pools[0]);
126081 :
126082 : // Build a local variable for better performance
126083 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
126084 : #if 0
126085 : // Iterate over the memory pools
126086 : for (unsigned int i=0; i < SgSIMDExplicitGather::pools.size(); i++)
126087 : {
126088 : // objectArray[i] is a single memory pool
126089 : for (int j=0; j < SgSIMDExplicitGather::pool_size; j++)
126090 : {
126091 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
126092 : {
126093 : traversal.visit(&(objectArray[i][j]));
126094 : }
126095 : }
126096 : }
126097 : #else
126098 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
126099 : // compute the list first and then call the visit function on each list element.
126100 :
126101 : // printf ("Inside of SgSIMDExplicitGather::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
126102 :
126103 0 : std::vector<SgSIMDExplicitGather*> nodeList;
126104 :
126105 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
126106 0 : for (unsigned int i=0; i < SgSIMDExplicitGather::pools.size(); i++)
126107 : {
126108 : // objectArray[i] is a single memory pool
126109 0 : for (unsigned j=0; j < SgSIMDExplicitGather::pool_size; j++)
126110 : {
126111 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
126112 : {
126113 0 : nodeList.push_back(&(objectArray[i][j]));
126114 : }
126115 : }
126116 : }
126117 :
126118 : // Iterate over the saved list
126119 0 : size_t nodeListSize = nodeList.size();
126120 0 : for (size_t i=0; i < nodeListSize; i++)
126121 : {
126122 0 : ROSE_ASSERT(nodeList[i] != NULL);
126123 : #if 0
126124 : traversal.visit(nodeList[i]);
126125 : #else
126126 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
126127 : {
126128 0 : traversal.visit(nodeList[i]);
126129 : }
126130 : #endif
126131 : }
126132 : #endif
126133 : }
126134 :
126135 : // This should not be required since all previously static data members are
126136 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
126137 :
126138 5342 : }
126139 :
126140 :
126141 : void
126142 194 : SgSIMDExplicitGather::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
126143 : {
126144 : // This function traverses the memory pool for an IR node and
126145 : // calls the function to execute the visitor object.
126146 :
126147 : // Initialize array to the address of the first element of the STL vector
126148 : // (which is guarenteed to be contiguous storage).
126149 : // SgSIMDExplicitGather objectArray [] = *(Memory_Block_List.begin());
126150 194 : if (SgSIMDExplicitGather::pools.empty() == false)
126151 : {
126152 : // Generate an array of memory pools
126153 0 : SgSIMDExplicitGather** objectArray = (SgSIMDExplicitGather**) &(SgSIMDExplicitGather::pools[0]);
126154 :
126155 : // Build a local variable for better performance
126156 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
126157 :
126158 : // Iterate over the memory pools
126159 0 : for (unsigned int i=0; i < SgSIMDExplicitGather::pools.size(); i++)
126160 : {
126161 : // objectArray[i] is a single memory pool
126162 0 : for (unsigned j=0; j < SgSIMDExplicitGather::pool_size; j++)
126163 : {
126164 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
126165 : {
126166 : // printf ("Found a valid SgSIMDExplicitGather object in the memory pool %d at position %d \n",i,j);
126167 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
126168 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
126169 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
126170 : }
126171 : else
126172 : {
126173 : // printf ("Found a INVALID SgSIMDExplicitGather object in the memory pool \n");
126174 : }
126175 : }
126176 : }
126177 : }
126178 :
126179 : // This should not be required since all previously static data members are
126180 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
126181 :
126182 194 : }
126183 :
126184 : void
126185 0 : SgSIMDExplicitGather::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
126186 : {
126187 : // This function visits only a single IR node of the memory pool.
126188 : // it is typically called once for each type of IR node within
126189 : // the automatically generated function: traverseRepresentativeNodes().
126190 :
126191 : // Initialize array to the address of the first element of the STL vector
126192 : // (which is guarenteed to be contiguous storage).
126193 : // SgSIMDExplicitGather objectArray [] = *(Memory_Block_List.begin());
126194 0 : if (SgSIMDExplicitGather::pools.empty() == false)
126195 : {
126196 : // Generate an array of memory pools
126197 0 : SgSIMDExplicitGather** objectArray = (SgSIMDExplicitGather**) &(SgSIMDExplicitGather::pools[0]);
126198 :
126199 : // Build a local variable for better performance
126200 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
126201 :
126202 : // Iterate over the memory pools
126203 0 : bool done = false;
126204 0 : unsigned i=0;
126205 :
126206 : // find the first valid IR node, call visit function, and then leave
126207 0 : while ( done == false && i < SgSIMDExplicitGather::pools.size() )
126208 : {
126209 : // objectArray[i] is a single memory pool
126210 : unsigned j=0;
126211 0 : while (done == false && j < SgSIMDExplicitGather::pool_size)
126212 : {
126213 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
126214 : {
126215 0 : traversal.visit(&(objectArray[i][j]));
126216 0 : done = true;
126217 : }
126218 0 : j++;
126219 : }
126220 0 : i++;
126221 : }
126222 :
126223 : #if 0
126224 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
126225 : if (done == false)
126226 : {
126227 : printf ("No representative for SgSIMDExplicitGather found in memory pools \n");
126228 : }
126229 : #endif
126230 : }
126231 0 : }
126232 :
126233 :
126234 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
126235 : // using values that overflow signed values of int.
126236 : size_t
126237 4 : SgSIMDExplicitGather::numberOfNodes()
126238 : {
126239 : // This function traverses the memory pool for an IR node and
126240 : // counts the number of IR nodes of a particular Sage III IR
126241 : // nodes type.
126242 :
126243 4 : size_t count = 0;
126244 4 : if (SgSIMDExplicitGather::pools.empty() == false)
126245 : {
126246 : // Generate an array of memory pools (this is actually a STL vector,
126247 : // but it is contiguious, so OK to treat this way).
126248 0 : SgSIMDExplicitGather** objectArray = (SgSIMDExplicitGather**) &(SgSIMDExplicitGather::pools[0]);
126249 :
126250 : // Build a local variable for better performance (make it a loop invariant variable).
126251 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
126252 :
126253 : // Iterate over all of the memory pools for this IR node.
126254 0 : for (unsigned int i=0; i < SgSIMDExplicitGather::pools.size(); i++)
126255 : {
126256 : // objectArray[i] is a single memory pool, iterate over all the
126257 : // IR nodes and only count those that are valid IR nodes used in
126258 : // the AST (i.e. allocated IR nodes).
126259 0 : for (unsigned j=0; j < SgSIMDExplicitGather::pool_size; j++)
126260 : {
126261 : // This is indexing the STL vector of C/C++ style arrays as a doubly
126262 : // indexed array access. It is OK since we have leveraged the semantics
126263 : // of STL vector memory as contigous and cast the memory as an array
126264 : // of arrays to use the 2D array indexing. Hope this is not confusing,
126265 : // but it s very fast as an implementation.
126266 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
126267 : {
126268 0 : count++;
126269 : }
126270 : }
126271 : }
126272 : }
126273 :
126274 :
126275 :
126276 4 : return count;
126277 : }
126278 :
126279 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
126280 : // using values that overflow signed values of int.
126281 : size_t
126282 0 : SgSIMDExplicitGather::memoryUsage()
126283 : {
126284 : // This function is required because we need the class name as a type when we call sizeof
126285 : // There might be another way to implement this if we have a traversal that only called a
126286 : // representative object (one call for each type of Sage IIIIR node).
126287 0 : size_t memory = numberOfNodes() * sizeof(SgSIMDExplicitGather);
126288 :
126289 0 : return memory;
126290 : }
126291 :
126292 : /* #line 126293 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
126293 :
126294 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
126295 : void
126296 5342 : SgSIMDScatter::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
126297 : {
126298 : // This function traverses the memory pool for only a specific IR node
126299 : // and calls the visit function of the input class execute a traversal
126300 : // similar to the style of the attribute based traversals within ROSE.
126301 : // This traversal will visit ALL nodes of the AST where as the other
126302 : // attribute based traversals visit only the embedded tree within the AST.
126303 :
126304 : // Initialize array to the address of the first element of the STL vector
126305 : // (which is guaranteed to be contiguous storage).
126306 : // SgSIMDScatter objectArray [] = *(Memory_Block_List.begin());
126307 5342 : if (SgSIMDScatter::pools.empty() == false)
126308 : {
126309 : // Generate an array of memory pools
126310 0 : SgSIMDScatter** objectArray = (SgSIMDScatter**) &(SgSIMDScatter::pools[0]);
126311 :
126312 : // Build a local variable for better performance
126313 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
126314 : #if 0
126315 : // Iterate over the memory pools
126316 : for (unsigned int i=0; i < SgSIMDScatter::pools.size(); i++)
126317 : {
126318 : // objectArray[i] is a single memory pool
126319 : for (int j=0; j < SgSIMDScatter::pool_size; j++)
126320 : {
126321 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
126322 : {
126323 : traversal.visit(&(objectArray[i][j]));
126324 : }
126325 : }
126326 : }
126327 : #else
126328 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
126329 : // compute the list first and then call the visit function on each list element.
126330 :
126331 : // printf ("Inside of SgSIMDScatter::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
126332 :
126333 0 : std::vector<SgSIMDScatter*> nodeList;
126334 :
126335 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
126336 0 : for (unsigned int i=0; i < SgSIMDScatter::pools.size(); i++)
126337 : {
126338 : // objectArray[i] is a single memory pool
126339 0 : for (unsigned j=0; j < SgSIMDScatter::pool_size; j++)
126340 : {
126341 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
126342 : {
126343 0 : nodeList.push_back(&(objectArray[i][j]));
126344 : }
126345 : }
126346 : }
126347 :
126348 : // Iterate over the saved list
126349 0 : size_t nodeListSize = nodeList.size();
126350 0 : for (size_t i=0; i < nodeListSize; i++)
126351 : {
126352 0 : ROSE_ASSERT(nodeList[i] != NULL);
126353 : #if 0
126354 : traversal.visit(nodeList[i]);
126355 : #else
126356 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
126357 : {
126358 0 : traversal.visit(nodeList[i]);
126359 : }
126360 : #endif
126361 : }
126362 : #endif
126363 : }
126364 :
126365 : // This should not be required since all previously static data members are
126366 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
126367 :
126368 5342 : }
126369 :
126370 :
126371 : void
126372 194 : SgSIMDScatter::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
126373 : {
126374 : // This function traverses the memory pool for an IR node and
126375 : // calls the function to execute the visitor object.
126376 :
126377 : // Initialize array to the address of the first element of the STL vector
126378 : // (which is guarenteed to be contiguous storage).
126379 : // SgSIMDScatter objectArray [] = *(Memory_Block_List.begin());
126380 194 : if (SgSIMDScatter::pools.empty() == false)
126381 : {
126382 : // Generate an array of memory pools
126383 0 : SgSIMDScatter** objectArray = (SgSIMDScatter**) &(SgSIMDScatter::pools[0]);
126384 :
126385 : // Build a local variable for better performance
126386 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
126387 :
126388 : // Iterate over the memory pools
126389 0 : for (unsigned int i=0; i < SgSIMDScatter::pools.size(); i++)
126390 : {
126391 : // objectArray[i] is a single memory pool
126392 0 : for (unsigned j=0; j < SgSIMDScatter::pool_size; j++)
126393 : {
126394 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
126395 : {
126396 : // printf ("Found a valid SgSIMDScatter object in the memory pool %d at position %d \n",i,j);
126397 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
126398 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
126399 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
126400 : }
126401 : else
126402 : {
126403 : // printf ("Found a INVALID SgSIMDScatter object in the memory pool \n");
126404 : }
126405 : }
126406 : }
126407 : }
126408 :
126409 : // This should not be required since all previously static data members are
126410 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
126411 :
126412 194 : }
126413 :
126414 : void
126415 0 : SgSIMDScatter::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
126416 : {
126417 : // This function visits only a single IR node of the memory pool.
126418 : // it is typically called once for each type of IR node within
126419 : // the automatically generated function: traverseRepresentativeNodes().
126420 :
126421 : // Initialize array to the address of the first element of the STL vector
126422 : // (which is guarenteed to be contiguous storage).
126423 : // SgSIMDScatter objectArray [] = *(Memory_Block_List.begin());
126424 0 : if (SgSIMDScatter::pools.empty() == false)
126425 : {
126426 : // Generate an array of memory pools
126427 0 : SgSIMDScatter** objectArray = (SgSIMDScatter**) &(SgSIMDScatter::pools[0]);
126428 :
126429 : // Build a local variable for better performance
126430 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
126431 :
126432 : // Iterate over the memory pools
126433 0 : bool done = false;
126434 0 : unsigned i=0;
126435 :
126436 : // find the first valid IR node, call visit function, and then leave
126437 0 : while ( done == false && i < SgSIMDScatter::pools.size() )
126438 : {
126439 : // objectArray[i] is a single memory pool
126440 : unsigned j=0;
126441 0 : while (done == false && j < SgSIMDScatter::pool_size)
126442 : {
126443 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
126444 : {
126445 0 : traversal.visit(&(objectArray[i][j]));
126446 0 : done = true;
126447 : }
126448 0 : j++;
126449 : }
126450 0 : i++;
126451 : }
126452 :
126453 : #if 0
126454 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
126455 : if (done == false)
126456 : {
126457 : printf ("No representative for SgSIMDScatter found in memory pools \n");
126458 : }
126459 : #endif
126460 : }
126461 0 : }
126462 :
126463 :
126464 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
126465 : // using values that overflow signed values of int.
126466 : size_t
126467 4 : SgSIMDScatter::numberOfNodes()
126468 : {
126469 : // This function traverses the memory pool for an IR node and
126470 : // counts the number of IR nodes of a particular Sage III IR
126471 : // nodes type.
126472 :
126473 4 : size_t count = 0;
126474 4 : if (SgSIMDScatter::pools.empty() == false)
126475 : {
126476 : // Generate an array of memory pools (this is actually a STL vector,
126477 : // but it is contiguious, so OK to treat this way).
126478 0 : SgSIMDScatter** objectArray = (SgSIMDScatter**) &(SgSIMDScatter::pools[0]);
126479 :
126480 : // Build a local variable for better performance (make it a loop invariant variable).
126481 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
126482 :
126483 : // Iterate over all of the memory pools for this IR node.
126484 0 : for (unsigned int i=0; i < SgSIMDScatter::pools.size(); i++)
126485 : {
126486 : // objectArray[i] is a single memory pool, iterate over all the
126487 : // IR nodes and only count those that are valid IR nodes used in
126488 : // the AST (i.e. allocated IR nodes).
126489 0 : for (unsigned j=0; j < SgSIMDScatter::pool_size; j++)
126490 : {
126491 : // This is indexing the STL vector of C/C++ style arrays as a doubly
126492 : // indexed array access. It is OK since we have leveraged the semantics
126493 : // of STL vector memory as contigous and cast the memory as an array
126494 : // of arrays to use the 2D array indexing. Hope this is not confusing,
126495 : // but it s very fast as an implementation.
126496 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
126497 : {
126498 0 : count++;
126499 : }
126500 : }
126501 : }
126502 : }
126503 :
126504 :
126505 :
126506 4 : return count;
126507 : }
126508 :
126509 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
126510 : // using values that overflow signed values of int.
126511 : size_t
126512 0 : SgSIMDScatter::memoryUsage()
126513 : {
126514 : // This function is required because we need the class name as a type when we call sizeof
126515 : // There might be another way to implement this if we have a traversal that only called a
126516 : // representative object (one call for each type of Sage IIIIR node).
126517 0 : size_t memory = numberOfNodes() * sizeof(SgSIMDScatter);
126518 :
126519 0 : return memory;
126520 : }
126521 :
126522 : /* #line 126523 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
126523 :
126524 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
126525 : void
126526 5342 : SgExprListExp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
126527 : {
126528 : // This function traverses the memory pool for only a specific IR node
126529 : // and calls the visit function of the input class execute a traversal
126530 : // similar to the style of the attribute based traversals within ROSE.
126531 : // This traversal will visit ALL nodes of the AST where as the other
126532 : // attribute based traversals visit only the embedded tree within the AST.
126533 :
126534 : // Initialize array to the address of the first element of the STL vector
126535 : // (which is guaranteed to be contiguous storage).
126536 : // SgExprListExp objectArray [] = *(Memory_Block_List.begin());
126537 5342 : if (SgExprListExp::pools.empty() == false)
126538 : {
126539 : // Generate an array of memory pools
126540 3958 : SgExprListExp** objectArray = (SgExprListExp**) &(SgExprListExp::pools[0]);
126541 :
126542 : // Build a local variable for better performance
126543 3958 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
126544 : #if 0
126545 : // Iterate over the memory pools
126546 : for (unsigned int i=0; i < SgExprListExp::pools.size(); i++)
126547 : {
126548 : // objectArray[i] is a single memory pool
126549 : for (int j=0; j < SgExprListExp::pool_size; j++)
126550 : {
126551 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
126552 : {
126553 : traversal.visit(&(objectArray[i][j]));
126554 : }
126555 : }
126556 : }
126557 : #else
126558 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
126559 : // compute the list first and then call the visit function on each list element.
126560 :
126561 : // printf ("Inside of SgExprListExp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
126562 :
126563 7916 : std::vector<SgExprListExp*> nodeList;
126564 :
126565 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
126566 8063 : for (unsigned int i=0; i < SgExprListExp::pools.size(); i++)
126567 : {
126568 : // objectArray[i] is a single memory pool
126569 8214100 : for (unsigned j=0; j < SgExprListExp::pool_size; j++)
126570 : {
126571 8210000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
126572 : {
126573 526891 : nodeList.push_back(&(objectArray[i][j]));
126574 : }
126575 : }
126576 : }
126577 :
126578 : // Iterate over the saved list
126579 3958 : size_t nodeListSize = nodeList.size();
126580 530849 : for (size_t i=0; i < nodeListSize; i++)
126581 : {
126582 526891 : ROSE_ASSERT(nodeList[i] != NULL);
126583 : #if 0
126584 : traversal.visit(nodeList[i]);
126585 : #else
126586 526891 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
126587 : {
126588 526891 : traversal.visit(nodeList[i]);
126589 : }
126590 : #endif
126591 : }
126592 : #endif
126593 : }
126594 :
126595 : // This should not be required since all previously static data members are
126596 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
126597 :
126598 5342 : }
126599 :
126600 :
126601 : void
126602 194 : SgExprListExp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
126603 : {
126604 : // This function traverses the memory pool for an IR node and
126605 : // calls the function to execute the visitor object.
126606 :
126607 : // Initialize array to the address of the first element of the STL vector
126608 : // (which is guarenteed to be contiguous storage).
126609 : // SgExprListExp objectArray [] = *(Memory_Block_List.begin());
126610 194 : if (SgExprListExp::pools.empty() == false)
126611 : {
126612 : // Generate an array of memory pools
126613 171 : SgExprListExp** objectArray = (SgExprListExp**) &(SgExprListExp::pools[0]);
126614 :
126615 : // Build a local variable for better performance
126616 171 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
126617 :
126618 : // Iterate over the memory pools
126619 497 : for (unsigned int i=0; i < SgExprListExp::pools.size(); i++)
126620 : {
126621 : // objectArray[i] is a single memory pool
126622 652326 : for (unsigned j=0; j < SgExprListExp::pool_size; j++)
126623 : {
126624 652000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
126625 : {
126626 : // printf ("Found a valid SgExprListExp object in the memory pool %d at position %d \n",i,j);
126627 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
126628 527761 : objectArray[i][j].executeVisitorMemberFunction(visitor);
126629 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
126630 : }
126631 : else
126632 : {
126633 : // printf ("Found a INVALID SgExprListExp object in the memory pool \n");
126634 : }
126635 : }
126636 : }
126637 : }
126638 :
126639 : // This should not be required since all previously static data members are
126640 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
126641 :
126642 194 : }
126643 :
126644 : void
126645 0 : SgExprListExp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
126646 : {
126647 : // This function visits only a single IR node of the memory pool.
126648 : // it is typically called once for each type of IR node within
126649 : // the automatically generated function: traverseRepresentativeNodes().
126650 :
126651 : // Initialize array to the address of the first element of the STL vector
126652 : // (which is guarenteed to be contiguous storage).
126653 : // SgExprListExp objectArray [] = *(Memory_Block_List.begin());
126654 0 : if (SgExprListExp::pools.empty() == false)
126655 : {
126656 : // Generate an array of memory pools
126657 0 : SgExprListExp** objectArray = (SgExprListExp**) &(SgExprListExp::pools[0]);
126658 :
126659 : // Build a local variable for better performance
126660 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
126661 :
126662 : // Iterate over the memory pools
126663 0 : bool done = false;
126664 0 : unsigned i=0;
126665 :
126666 : // find the first valid IR node, call visit function, and then leave
126667 0 : while ( done == false && i < SgExprListExp::pools.size() )
126668 : {
126669 : // objectArray[i] is a single memory pool
126670 : unsigned j=0;
126671 0 : while (done == false && j < SgExprListExp::pool_size)
126672 : {
126673 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
126674 : {
126675 0 : traversal.visit(&(objectArray[i][j]));
126676 0 : done = true;
126677 : }
126678 0 : j++;
126679 : }
126680 0 : i++;
126681 : }
126682 :
126683 : #if 0
126684 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
126685 : if (done == false)
126686 : {
126687 : printf ("No representative for SgExprListExp found in memory pools \n");
126688 : }
126689 : #endif
126690 : }
126691 0 : }
126692 :
126693 :
126694 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
126695 : // using values that overflow signed values of int.
126696 : size_t
126697 4 : SgExprListExp::numberOfNodes()
126698 : {
126699 : // This function traverses the memory pool for an IR node and
126700 : // counts the number of IR nodes of a particular Sage III IR
126701 : // nodes type.
126702 :
126703 4 : size_t count = 0;
126704 4 : if (SgExprListExp::pools.empty() == false)
126705 : {
126706 : // Generate an array of memory pools (this is actually a STL vector,
126707 : // but it is contiguious, so OK to treat this way).
126708 3 : SgExprListExp** objectArray = (SgExprListExp**) &(SgExprListExp::pools[0]);
126709 :
126710 : // Build a local variable for better performance (make it a loop invariant variable).
126711 3 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
126712 :
126713 : // Iterate over all of the memory pools for this IR node.
126714 7 : for (unsigned int i=0; i < SgExprListExp::pools.size(); i++)
126715 : {
126716 : // objectArray[i] is a single memory pool, iterate over all the
126717 : // IR nodes and only count those that are valid IR nodes used in
126718 : // the AST (i.e. allocated IR nodes).
126719 8004 : for (unsigned j=0; j < SgExprListExp::pool_size; j++)
126720 : {
126721 : // This is indexing the STL vector of C/C++ style arrays as a doubly
126722 : // indexed array access. It is OK since we have leveraged the semantics
126723 : // of STL vector memory as contigous and cast the memory as an array
126724 : // of arrays to use the 2D array indexing. Hope this is not confusing,
126725 : // but it s very fast as an implementation.
126726 8000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
126727 : {
126728 3693 : count++;
126729 : }
126730 : }
126731 : }
126732 : }
126733 :
126734 :
126735 :
126736 4 : return count;
126737 : }
126738 :
126739 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
126740 : // using values that overflow signed values of int.
126741 : size_t
126742 0 : SgExprListExp::memoryUsage()
126743 : {
126744 : // This function is required because we need the class name as a type when we call sizeof
126745 : // There might be another way to implement this if we have a traversal that only called a
126746 : // representative object (one call for each type of Sage IIIIR node).
126747 0 : size_t memory = numberOfNodes() * sizeof(SgExprListExp);
126748 :
126749 0 : return memory;
126750 : }
126751 :
126752 : /* #line 126753 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
126753 :
126754 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
126755 : void
126756 5342 : SgListExp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
126757 : {
126758 : // This function traverses the memory pool for only a specific IR node
126759 : // and calls the visit function of the input class execute a traversal
126760 : // similar to the style of the attribute based traversals within ROSE.
126761 : // This traversal will visit ALL nodes of the AST where as the other
126762 : // attribute based traversals visit only the embedded tree within the AST.
126763 :
126764 : // Initialize array to the address of the first element of the STL vector
126765 : // (which is guaranteed to be contiguous storage).
126766 : // SgListExp objectArray [] = *(Memory_Block_List.begin());
126767 5342 : if (SgListExp::pools.empty() == false)
126768 : {
126769 : // Generate an array of memory pools
126770 0 : SgListExp** objectArray = (SgListExp**) &(SgListExp::pools[0]);
126771 :
126772 : // Build a local variable for better performance
126773 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
126774 : #if 0
126775 : // Iterate over the memory pools
126776 : for (unsigned int i=0; i < SgListExp::pools.size(); i++)
126777 : {
126778 : // objectArray[i] is a single memory pool
126779 : for (int j=0; j < SgListExp::pool_size; j++)
126780 : {
126781 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
126782 : {
126783 : traversal.visit(&(objectArray[i][j]));
126784 : }
126785 : }
126786 : }
126787 : #else
126788 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
126789 : // compute the list first and then call the visit function on each list element.
126790 :
126791 : // printf ("Inside of SgListExp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
126792 :
126793 0 : std::vector<SgListExp*> nodeList;
126794 :
126795 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
126796 0 : for (unsigned int i=0; i < SgListExp::pools.size(); i++)
126797 : {
126798 : // objectArray[i] is a single memory pool
126799 0 : for (unsigned j=0; j < SgListExp::pool_size; j++)
126800 : {
126801 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
126802 : {
126803 0 : nodeList.push_back(&(objectArray[i][j]));
126804 : }
126805 : }
126806 : }
126807 :
126808 : // Iterate over the saved list
126809 0 : size_t nodeListSize = nodeList.size();
126810 0 : for (size_t i=0; i < nodeListSize; i++)
126811 : {
126812 0 : ROSE_ASSERT(nodeList[i] != NULL);
126813 : #if 0
126814 : traversal.visit(nodeList[i]);
126815 : #else
126816 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
126817 : {
126818 0 : traversal.visit(nodeList[i]);
126819 : }
126820 : #endif
126821 : }
126822 : #endif
126823 : }
126824 :
126825 : // This should not be required since all previously static data members are
126826 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
126827 :
126828 5342 : }
126829 :
126830 :
126831 : void
126832 194 : SgListExp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
126833 : {
126834 : // This function traverses the memory pool for an IR node and
126835 : // calls the function to execute the visitor object.
126836 :
126837 : // Initialize array to the address of the first element of the STL vector
126838 : // (which is guarenteed to be contiguous storage).
126839 : // SgListExp objectArray [] = *(Memory_Block_List.begin());
126840 194 : if (SgListExp::pools.empty() == false)
126841 : {
126842 : // Generate an array of memory pools
126843 0 : SgListExp** objectArray = (SgListExp**) &(SgListExp::pools[0]);
126844 :
126845 : // Build a local variable for better performance
126846 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
126847 :
126848 : // Iterate over the memory pools
126849 0 : for (unsigned int i=0; i < SgListExp::pools.size(); i++)
126850 : {
126851 : // objectArray[i] is a single memory pool
126852 0 : for (unsigned j=0; j < SgListExp::pool_size; j++)
126853 : {
126854 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
126855 : {
126856 : // printf ("Found a valid SgListExp object in the memory pool %d at position %d \n",i,j);
126857 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
126858 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
126859 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
126860 : }
126861 : else
126862 : {
126863 : // printf ("Found a INVALID SgListExp object in the memory pool \n");
126864 : }
126865 : }
126866 : }
126867 : }
126868 :
126869 : // This should not be required since all previously static data members are
126870 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
126871 :
126872 194 : }
126873 :
126874 : void
126875 0 : SgListExp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
126876 : {
126877 : // This function visits only a single IR node of the memory pool.
126878 : // it is typically called once for each type of IR node within
126879 : // the automatically generated function: traverseRepresentativeNodes().
126880 :
126881 : // Initialize array to the address of the first element of the STL vector
126882 : // (which is guarenteed to be contiguous storage).
126883 : // SgListExp objectArray [] = *(Memory_Block_List.begin());
126884 0 : if (SgListExp::pools.empty() == false)
126885 : {
126886 : // Generate an array of memory pools
126887 0 : SgListExp** objectArray = (SgListExp**) &(SgListExp::pools[0]);
126888 :
126889 : // Build a local variable for better performance
126890 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
126891 :
126892 : // Iterate over the memory pools
126893 0 : bool done = false;
126894 0 : unsigned i=0;
126895 :
126896 : // find the first valid IR node, call visit function, and then leave
126897 0 : while ( done == false && i < SgListExp::pools.size() )
126898 : {
126899 : // objectArray[i] is a single memory pool
126900 : unsigned j=0;
126901 0 : while (done == false && j < SgListExp::pool_size)
126902 : {
126903 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
126904 : {
126905 0 : traversal.visit(&(objectArray[i][j]));
126906 0 : done = true;
126907 : }
126908 0 : j++;
126909 : }
126910 0 : i++;
126911 : }
126912 :
126913 : #if 0
126914 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
126915 : if (done == false)
126916 : {
126917 : printf ("No representative for SgListExp found in memory pools \n");
126918 : }
126919 : #endif
126920 : }
126921 0 : }
126922 :
126923 :
126924 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
126925 : // using values that overflow signed values of int.
126926 : size_t
126927 4 : SgListExp::numberOfNodes()
126928 : {
126929 : // This function traverses the memory pool for an IR node and
126930 : // counts the number of IR nodes of a particular Sage III IR
126931 : // nodes type.
126932 :
126933 4 : size_t count = 0;
126934 4 : if (SgListExp::pools.empty() == false)
126935 : {
126936 : // Generate an array of memory pools (this is actually a STL vector,
126937 : // but it is contiguious, so OK to treat this way).
126938 0 : SgListExp** objectArray = (SgListExp**) &(SgListExp::pools[0]);
126939 :
126940 : // Build a local variable for better performance (make it a loop invariant variable).
126941 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
126942 :
126943 : // Iterate over all of the memory pools for this IR node.
126944 0 : for (unsigned int i=0; i < SgListExp::pools.size(); i++)
126945 : {
126946 : // objectArray[i] is a single memory pool, iterate over all the
126947 : // IR nodes and only count those that are valid IR nodes used in
126948 : // the AST (i.e. allocated IR nodes).
126949 0 : for (unsigned j=0; j < SgListExp::pool_size; j++)
126950 : {
126951 : // This is indexing the STL vector of C/C++ style arrays as a doubly
126952 : // indexed array access. It is OK since we have leveraged the semantics
126953 : // of STL vector memory as contigous and cast the memory as an array
126954 : // of arrays to use the 2D array indexing. Hope this is not confusing,
126955 : // but it s very fast as an implementation.
126956 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
126957 : {
126958 0 : count++;
126959 : }
126960 : }
126961 : }
126962 : }
126963 :
126964 :
126965 :
126966 4 : return count;
126967 : }
126968 :
126969 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
126970 : // using values that overflow signed values of int.
126971 : size_t
126972 0 : SgListExp::memoryUsage()
126973 : {
126974 : // This function is required because we need the class name as a type when we call sizeof
126975 : // There might be another way to implement this if we have a traversal that only called a
126976 : // representative object (one call for each type of Sage IIIIR node).
126977 0 : size_t memory = numberOfNodes() * sizeof(SgListExp);
126978 :
126979 0 : return memory;
126980 : }
126981 :
126982 : /* #line 126983 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
126983 :
126984 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
126985 : void
126986 5342 : SgTupleExp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
126987 : {
126988 : // This function traverses the memory pool for only a specific IR node
126989 : // and calls the visit function of the input class execute a traversal
126990 : // similar to the style of the attribute based traversals within ROSE.
126991 : // This traversal will visit ALL nodes of the AST where as the other
126992 : // attribute based traversals visit only the embedded tree within the AST.
126993 :
126994 : // Initialize array to the address of the first element of the STL vector
126995 : // (which is guaranteed to be contiguous storage).
126996 : // SgTupleExp objectArray [] = *(Memory_Block_List.begin());
126997 5342 : if (SgTupleExp::pools.empty() == false)
126998 : {
126999 : // Generate an array of memory pools
127000 0 : SgTupleExp** objectArray = (SgTupleExp**) &(SgTupleExp::pools[0]);
127001 :
127002 : // Build a local variable for better performance
127003 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
127004 : #if 0
127005 : // Iterate over the memory pools
127006 : for (unsigned int i=0; i < SgTupleExp::pools.size(); i++)
127007 : {
127008 : // objectArray[i] is a single memory pool
127009 : for (int j=0; j < SgTupleExp::pool_size; j++)
127010 : {
127011 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
127012 : {
127013 : traversal.visit(&(objectArray[i][j]));
127014 : }
127015 : }
127016 : }
127017 : #else
127018 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
127019 : // compute the list first and then call the visit function on each list element.
127020 :
127021 : // printf ("Inside of SgTupleExp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
127022 :
127023 0 : std::vector<SgTupleExp*> nodeList;
127024 :
127025 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
127026 0 : for (unsigned int i=0; i < SgTupleExp::pools.size(); i++)
127027 : {
127028 : // objectArray[i] is a single memory pool
127029 0 : for (unsigned j=0; j < SgTupleExp::pool_size; j++)
127030 : {
127031 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
127032 : {
127033 0 : nodeList.push_back(&(objectArray[i][j]));
127034 : }
127035 : }
127036 : }
127037 :
127038 : // Iterate over the saved list
127039 0 : size_t nodeListSize = nodeList.size();
127040 0 : for (size_t i=0; i < nodeListSize; i++)
127041 : {
127042 0 : ROSE_ASSERT(nodeList[i] != NULL);
127043 : #if 0
127044 : traversal.visit(nodeList[i]);
127045 : #else
127046 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
127047 : {
127048 0 : traversal.visit(nodeList[i]);
127049 : }
127050 : #endif
127051 : }
127052 : #endif
127053 : }
127054 :
127055 : // This should not be required since all previously static data members are
127056 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
127057 :
127058 5342 : }
127059 :
127060 :
127061 : void
127062 194 : SgTupleExp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
127063 : {
127064 : // This function traverses the memory pool for an IR node and
127065 : // calls the function to execute the visitor object.
127066 :
127067 : // Initialize array to the address of the first element of the STL vector
127068 : // (which is guarenteed to be contiguous storage).
127069 : // SgTupleExp objectArray [] = *(Memory_Block_List.begin());
127070 194 : if (SgTupleExp::pools.empty() == false)
127071 : {
127072 : // Generate an array of memory pools
127073 0 : SgTupleExp** objectArray = (SgTupleExp**) &(SgTupleExp::pools[0]);
127074 :
127075 : // Build a local variable for better performance
127076 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
127077 :
127078 : // Iterate over the memory pools
127079 0 : for (unsigned int i=0; i < SgTupleExp::pools.size(); i++)
127080 : {
127081 : // objectArray[i] is a single memory pool
127082 0 : for (unsigned j=0; j < SgTupleExp::pool_size; j++)
127083 : {
127084 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
127085 : {
127086 : // printf ("Found a valid SgTupleExp object in the memory pool %d at position %d \n",i,j);
127087 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
127088 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
127089 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
127090 : }
127091 : else
127092 : {
127093 : // printf ("Found a INVALID SgTupleExp object in the memory pool \n");
127094 : }
127095 : }
127096 : }
127097 : }
127098 :
127099 : // This should not be required since all previously static data members are
127100 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
127101 :
127102 194 : }
127103 :
127104 : void
127105 0 : SgTupleExp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
127106 : {
127107 : // This function visits only a single IR node of the memory pool.
127108 : // it is typically called once for each type of IR node within
127109 : // the automatically generated function: traverseRepresentativeNodes().
127110 :
127111 : // Initialize array to the address of the first element of the STL vector
127112 : // (which is guarenteed to be contiguous storage).
127113 : // SgTupleExp objectArray [] = *(Memory_Block_List.begin());
127114 0 : if (SgTupleExp::pools.empty() == false)
127115 : {
127116 : // Generate an array of memory pools
127117 0 : SgTupleExp** objectArray = (SgTupleExp**) &(SgTupleExp::pools[0]);
127118 :
127119 : // Build a local variable for better performance
127120 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
127121 :
127122 : // Iterate over the memory pools
127123 0 : bool done = false;
127124 0 : unsigned i=0;
127125 :
127126 : // find the first valid IR node, call visit function, and then leave
127127 0 : while ( done == false && i < SgTupleExp::pools.size() )
127128 : {
127129 : // objectArray[i] is a single memory pool
127130 : unsigned j=0;
127131 0 : while (done == false && j < SgTupleExp::pool_size)
127132 : {
127133 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
127134 : {
127135 0 : traversal.visit(&(objectArray[i][j]));
127136 0 : done = true;
127137 : }
127138 0 : j++;
127139 : }
127140 0 : i++;
127141 : }
127142 :
127143 : #if 0
127144 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
127145 : if (done == false)
127146 : {
127147 : printf ("No representative for SgTupleExp found in memory pools \n");
127148 : }
127149 : #endif
127150 : }
127151 0 : }
127152 :
127153 :
127154 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
127155 : // using values that overflow signed values of int.
127156 : size_t
127157 4 : SgTupleExp::numberOfNodes()
127158 : {
127159 : // This function traverses the memory pool for an IR node and
127160 : // counts the number of IR nodes of a particular Sage III IR
127161 : // nodes type.
127162 :
127163 4 : size_t count = 0;
127164 4 : if (SgTupleExp::pools.empty() == false)
127165 : {
127166 : // Generate an array of memory pools (this is actually a STL vector,
127167 : // but it is contiguious, so OK to treat this way).
127168 0 : SgTupleExp** objectArray = (SgTupleExp**) &(SgTupleExp::pools[0]);
127169 :
127170 : // Build a local variable for better performance (make it a loop invariant variable).
127171 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
127172 :
127173 : // Iterate over all of the memory pools for this IR node.
127174 0 : for (unsigned int i=0; i < SgTupleExp::pools.size(); i++)
127175 : {
127176 : // objectArray[i] is a single memory pool, iterate over all the
127177 : // IR nodes and only count those that are valid IR nodes used in
127178 : // the AST (i.e. allocated IR nodes).
127179 0 : for (unsigned j=0; j < SgTupleExp::pool_size; j++)
127180 : {
127181 : // This is indexing the STL vector of C/C++ style arrays as a doubly
127182 : // indexed array access. It is OK since we have leveraged the semantics
127183 : // of STL vector memory as contigous and cast the memory as an array
127184 : // of arrays to use the 2D array indexing. Hope this is not confusing,
127185 : // but it s very fast as an implementation.
127186 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
127187 : {
127188 0 : count++;
127189 : }
127190 : }
127191 : }
127192 : }
127193 :
127194 :
127195 :
127196 4 : return count;
127197 : }
127198 :
127199 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
127200 : // using values that overflow signed values of int.
127201 : size_t
127202 0 : SgTupleExp::memoryUsage()
127203 : {
127204 : // This function is required because we need the class name as a type when we call sizeof
127205 : // There might be another way to implement this if we have a traversal that only called a
127206 : // representative object (one call for each type of Sage IIIIR node).
127207 0 : size_t memory = numberOfNodes() * sizeof(SgTupleExp);
127208 :
127209 0 : return memory;
127210 : }
127211 :
127212 : /* #line 127213 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
127213 :
127214 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
127215 : void
127216 5342 : SgMatrixExp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
127217 : {
127218 : // This function traverses the memory pool for only a specific IR node
127219 : // and calls the visit function of the input class execute a traversal
127220 : // similar to the style of the attribute based traversals within ROSE.
127221 : // This traversal will visit ALL nodes of the AST where as the other
127222 : // attribute based traversals visit only the embedded tree within the AST.
127223 :
127224 : // Initialize array to the address of the first element of the STL vector
127225 : // (which is guaranteed to be contiguous storage).
127226 : // SgMatrixExp objectArray [] = *(Memory_Block_List.begin());
127227 5342 : if (SgMatrixExp::pools.empty() == false)
127228 : {
127229 : // Generate an array of memory pools
127230 0 : SgMatrixExp** objectArray = (SgMatrixExp**) &(SgMatrixExp::pools[0]);
127231 :
127232 : // Build a local variable for better performance
127233 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
127234 : #if 0
127235 : // Iterate over the memory pools
127236 : for (unsigned int i=0; i < SgMatrixExp::pools.size(); i++)
127237 : {
127238 : // objectArray[i] is a single memory pool
127239 : for (int j=0; j < SgMatrixExp::pool_size; j++)
127240 : {
127241 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
127242 : {
127243 : traversal.visit(&(objectArray[i][j]));
127244 : }
127245 : }
127246 : }
127247 : #else
127248 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
127249 : // compute the list first and then call the visit function on each list element.
127250 :
127251 : // printf ("Inside of SgMatrixExp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
127252 :
127253 0 : std::vector<SgMatrixExp*> nodeList;
127254 :
127255 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
127256 0 : for (unsigned int i=0; i < SgMatrixExp::pools.size(); i++)
127257 : {
127258 : // objectArray[i] is a single memory pool
127259 0 : for (unsigned j=0; j < SgMatrixExp::pool_size; j++)
127260 : {
127261 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
127262 : {
127263 0 : nodeList.push_back(&(objectArray[i][j]));
127264 : }
127265 : }
127266 : }
127267 :
127268 : // Iterate over the saved list
127269 0 : size_t nodeListSize = nodeList.size();
127270 0 : for (size_t i=0; i < nodeListSize; i++)
127271 : {
127272 0 : ROSE_ASSERT(nodeList[i] != NULL);
127273 : #if 0
127274 : traversal.visit(nodeList[i]);
127275 : #else
127276 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
127277 : {
127278 0 : traversal.visit(nodeList[i]);
127279 : }
127280 : #endif
127281 : }
127282 : #endif
127283 : }
127284 :
127285 : // This should not be required since all previously static data members are
127286 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
127287 :
127288 5342 : }
127289 :
127290 :
127291 : void
127292 194 : SgMatrixExp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
127293 : {
127294 : // This function traverses the memory pool for an IR node and
127295 : // calls the function to execute the visitor object.
127296 :
127297 : // Initialize array to the address of the first element of the STL vector
127298 : // (which is guarenteed to be contiguous storage).
127299 : // SgMatrixExp objectArray [] = *(Memory_Block_List.begin());
127300 194 : if (SgMatrixExp::pools.empty() == false)
127301 : {
127302 : // Generate an array of memory pools
127303 0 : SgMatrixExp** objectArray = (SgMatrixExp**) &(SgMatrixExp::pools[0]);
127304 :
127305 : // Build a local variable for better performance
127306 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
127307 :
127308 : // Iterate over the memory pools
127309 0 : for (unsigned int i=0; i < SgMatrixExp::pools.size(); i++)
127310 : {
127311 : // objectArray[i] is a single memory pool
127312 0 : for (unsigned j=0; j < SgMatrixExp::pool_size; j++)
127313 : {
127314 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
127315 : {
127316 : // printf ("Found a valid SgMatrixExp object in the memory pool %d at position %d \n",i,j);
127317 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
127318 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
127319 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
127320 : }
127321 : else
127322 : {
127323 : // printf ("Found a INVALID SgMatrixExp object in the memory pool \n");
127324 : }
127325 : }
127326 : }
127327 : }
127328 :
127329 : // This should not be required since all previously static data members are
127330 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
127331 :
127332 194 : }
127333 :
127334 : void
127335 0 : SgMatrixExp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
127336 : {
127337 : // This function visits only a single IR node of the memory pool.
127338 : // it is typically called once for each type of IR node within
127339 : // the automatically generated function: traverseRepresentativeNodes().
127340 :
127341 : // Initialize array to the address of the first element of the STL vector
127342 : // (which is guarenteed to be contiguous storage).
127343 : // SgMatrixExp objectArray [] = *(Memory_Block_List.begin());
127344 0 : if (SgMatrixExp::pools.empty() == false)
127345 : {
127346 : // Generate an array of memory pools
127347 0 : SgMatrixExp** objectArray = (SgMatrixExp**) &(SgMatrixExp::pools[0]);
127348 :
127349 : // Build a local variable for better performance
127350 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
127351 :
127352 : // Iterate over the memory pools
127353 0 : bool done = false;
127354 0 : unsigned i=0;
127355 :
127356 : // find the first valid IR node, call visit function, and then leave
127357 0 : while ( done == false && i < SgMatrixExp::pools.size() )
127358 : {
127359 : // objectArray[i] is a single memory pool
127360 : unsigned j=0;
127361 0 : while (done == false && j < SgMatrixExp::pool_size)
127362 : {
127363 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
127364 : {
127365 0 : traversal.visit(&(objectArray[i][j]));
127366 0 : done = true;
127367 : }
127368 0 : j++;
127369 : }
127370 0 : i++;
127371 : }
127372 :
127373 : #if 0
127374 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
127375 : if (done == false)
127376 : {
127377 : printf ("No representative for SgMatrixExp found in memory pools \n");
127378 : }
127379 : #endif
127380 : }
127381 0 : }
127382 :
127383 :
127384 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
127385 : // using values that overflow signed values of int.
127386 : size_t
127387 4 : SgMatrixExp::numberOfNodes()
127388 : {
127389 : // This function traverses the memory pool for an IR node and
127390 : // counts the number of IR nodes of a particular Sage III IR
127391 : // nodes type.
127392 :
127393 4 : size_t count = 0;
127394 4 : if (SgMatrixExp::pools.empty() == false)
127395 : {
127396 : // Generate an array of memory pools (this is actually a STL vector,
127397 : // but it is contiguious, so OK to treat this way).
127398 0 : SgMatrixExp** objectArray = (SgMatrixExp**) &(SgMatrixExp::pools[0]);
127399 :
127400 : // Build a local variable for better performance (make it a loop invariant variable).
127401 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
127402 :
127403 : // Iterate over all of the memory pools for this IR node.
127404 0 : for (unsigned int i=0; i < SgMatrixExp::pools.size(); i++)
127405 : {
127406 : // objectArray[i] is a single memory pool, iterate over all the
127407 : // IR nodes and only count those that are valid IR nodes used in
127408 : // the AST (i.e. allocated IR nodes).
127409 0 : for (unsigned j=0; j < SgMatrixExp::pool_size; j++)
127410 : {
127411 : // This is indexing the STL vector of C/C++ style arrays as a doubly
127412 : // indexed array access. It is OK since we have leveraged the semantics
127413 : // of STL vector memory as contigous and cast the memory as an array
127414 : // of arrays to use the 2D array indexing. Hope this is not confusing,
127415 : // but it s very fast as an implementation.
127416 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
127417 : {
127418 0 : count++;
127419 : }
127420 : }
127421 : }
127422 : }
127423 :
127424 :
127425 :
127426 4 : return count;
127427 : }
127428 :
127429 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
127430 : // using values that overflow signed values of int.
127431 : size_t
127432 0 : SgMatrixExp::memoryUsage()
127433 : {
127434 : // This function is required because we need the class name as a type when we call sizeof
127435 : // There might be another way to implement this if we have a traversal that only called a
127436 : // representative object (one call for each type of Sage IIIIR node).
127437 0 : size_t memory = numberOfNodes() * sizeof(SgMatrixExp);
127438 :
127439 0 : return memory;
127440 : }
127441 :
127442 : /* #line 127443 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
127443 :
127444 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
127445 : void
127446 5342 : SgVarRefExp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
127447 : {
127448 : // This function traverses the memory pool for only a specific IR node
127449 : // and calls the visit function of the input class execute a traversal
127450 : // similar to the style of the attribute based traversals within ROSE.
127451 : // This traversal will visit ALL nodes of the AST where as the other
127452 : // attribute based traversals visit only the embedded tree within the AST.
127453 :
127454 : // Initialize array to the address of the first element of the STL vector
127455 : // (which is guaranteed to be contiguous storage).
127456 : // SgVarRefExp objectArray [] = *(Memory_Block_List.begin());
127457 5342 : if (SgVarRefExp::pools.empty() == false)
127458 : {
127459 : // Generate an array of memory pools
127460 4463 : SgVarRefExp** objectArray = (SgVarRefExp**) &(SgVarRefExp::pools[0]);
127461 :
127462 : // Build a local variable for better performance
127463 4463 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
127464 : #if 0
127465 : // Iterate over the memory pools
127466 : for (unsigned int i=0; i < SgVarRefExp::pools.size(); i++)
127467 : {
127468 : // objectArray[i] is a single memory pool
127469 : for (int j=0; j < SgVarRefExp::pool_size; j++)
127470 : {
127471 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
127472 : {
127473 : traversal.visit(&(objectArray[i][j]));
127474 : }
127475 : }
127476 : }
127477 : #else
127478 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
127479 : // compute the list first and then call the visit function on each list element.
127480 :
127481 : // printf ("Inside of SgVarRefExp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
127482 :
127483 8926 : std::vector<SgVarRefExp*> nodeList;
127484 :
127485 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
127486 9304 : for (unsigned int i=0; i < SgVarRefExp::pools.size(); i++)
127487 : {
127488 : // objectArray[i] is a single memory pool
127489 9686840 : for (unsigned j=0; j < SgVarRefExp::pool_size; j++)
127490 : {
127491 9682000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
127492 : {
127493 989819 : nodeList.push_back(&(objectArray[i][j]));
127494 : }
127495 : }
127496 : }
127497 :
127498 : // Iterate over the saved list
127499 4463 : size_t nodeListSize = nodeList.size();
127500 994282 : for (size_t i=0; i < nodeListSize; i++)
127501 : {
127502 989819 : ROSE_ASSERT(nodeList[i] != NULL);
127503 : #if 0
127504 : traversal.visit(nodeList[i]);
127505 : #else
127506 989819 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
127507 : {
127508 989819 : traversal.visit(nodeList[i]);
127509 : }
127510 : #endif
127511 : }
127512 : #endif
127513 : }
127514 :
127515 : // This should not be required since all previously static data members are
127516 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
127517 :
127518 5342 : }
127519 :
127520 :
127521 : void
127522 194 : SgVarRefExp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
127523 : {
127524 : // This function traverses the memory pool for an IR node and
127525 : // calls the function to execute the visitor object.
127526 :
127527 : // Initialize array to the address of the first element of the STL vector
127528 : // (which is guarenteed to be contiguous storage).
127529 : // SgVarRefExp objectArray [] = *(Memory_Block_List.begin());
127530 194 : if (SgVarRefExp::pools.empty() == false)
127531 : {
127532 : // Generate an array of memory pools
127533 194 : SgVarRefExp** objectArray = (SgVarRefExp**) &(SgVarRefExp::pools[0]);
127534 :
127535 : // Build a local variable for better performance
127536 194 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
127537 :
127538 : // Iterate over the memory pools
127539 818 : for (unsigned int i=0; i < SgVarRefExp::pools.size(); i++)
127540 : {
127541 : // objectArray[i] is a single memory pool
127542 1248620 : for (unsigned j=0; j < SgVarRefExp::pool_size; j++)
127543 : {
127544 1248000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
127545 : {
127546 : // printf ("Found a valid SgVarRefExp object in the memory pool %d at position %d \n",i,j);
127547 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
127548 924234 : objectArray[i][j].executeVisitorMemberFunction(visitor);
127549 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
127550 : }
127551 : else
127552 : {
127553 : // printf ("Found a INVALID SgVarRefExp object in the memory pool \n");
127554 : }
127555 : }
127556 : }
127557 : }
127558 :
127559 : // This should not be required since all previously static data members are
127560 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
127561 :
127562 194 : }
127563 :
127564 : void
127565 0 : SgVarRefExp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
127566 : {
127567 : // This function visits only a single IR node of the memory pool.
127568 : // it is typically called once for each type of IR node within
127569 : // the automatically generated function: traverseRepresentativeNodes().
127570 :
127571 : // Initialize array to the address of the first element of the STL vector
127572 : // (which is guarenteed to be contiguous storage).
127573 : // SgVarRefExp objectArray [] = *(Memory_Block_List.begin());
127574 0 : if (SgVarRefExp::pools.empty() == false)
127575 : {
127576 : // Generate an array of memory pools
127577 0 : SgVarRefExp** objectArray = (SgVarRefExp**) &(SgVarRefExp::pools[0]);
127578 :
127579 : // Build a local variable for better performance
127580 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
127581 :
127582 : // Iterate over the memory pools
127583 0 : bool done = false;
127584 0 : unsigned i=0;
127585 :
127586 : // find the first valid IR node, call visit function, and then leave
127587 0 : while ( done == false && i < SgVarRefExp::pools.size() )
127588 : {
127589 : // objectArray[i] is a single memory pool
127590 : unsigned j=0;
127591 0 : while (done == false && j < SgVarRefExp::pool_size)
127592 : {
127593 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
127594 : {
127595 0 : traversal.visit(&(objectArray[i][j]));
127596 0 : done = true;
127597 : }
127598 0 : j++;
127599 : }
127600 0 : i++;
127601 : }
127602 :
127603 : #if 0
127604 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
127605 : if (done == false)
127606 : {
127607 : printf ("No representative for SgVarRefExp found in memory pools \n");
127608 : }
127609 : #endif
127610 : }
127611 0 : }
127612 :
127613 :
127614 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
127615 : // using values that overflow signed values of int.
127616 : size_t
127617 4 : SgVarRefExp::numberOfNodes()
127618 : {
127619 : // This function traverses the memory pool for an IR node and
127620 : // counts the number of IR nodes of a particular Sage III IR
127621 : // nodes type.
127622 :
127623 4 : size_t count = 0;
127624 4 : if (SgVarRefExp::pools.empty() == false)
127625 : {
127626 : // Generate an array of memory pools (this is actually a STL vector,
127627 : // but it is contiguious, so OK to treat this way).
127628 2 : SgVarRefExp** objectArray = (SgVarRefExp**) &(SgVarRefExp::pools[0]);
127629 :
127630 : // Build a local variable for better performance (make it a loop invariant variable).
127631 2 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
127632 :
127633 : // Iterate over all of the memory pools for this IR node.
127634 7 : for (unsigned int i=0; i < SgVarRefExp::pools.size(); i++)
127635 : {
127636 : // objectArray[i] is a single memory pool, iterate over all the
127637 : // IR nodes and only count those that are valid IR nodes used in
127638 : // the AST (i.e. allocated IR nodes).
127639 10005 : for (unsigned j=0; j < SgVarRefExp::pool_size; j++)
127640 : {
127641 : // This is indexing the STL vector of C/C++ style arrays as a doubly
127642 : // indexed array access. It is OK since we have leveraged the semantics
127643 : // of STL vector memory as contigous and cast the memory as an array
127644 : // of arrays to use the 2D array indexing. Hope this is not confusing,
127645 : // but it s very fast as an implementation.
127646 10000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
127647 : {
127648 6515 : count++;
127649 : }
127650 : }
127651 : }
127652 : }
127653 :
127654 :
127655 :
127656 4 : return count;
127657 : }
127658 :
127659 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
127660 : // using values that overflow signed values of int.
127661 : size_t
127662 0 : SgVarRefExp::memoryUsage()
127663 : {
127664 : // This function is required because we need the class name as a type when we call sizeof
127665 : // There might be another way to implement this if we have a traversal that only called a
127666 : // representative object (one call for each type of Sage IIIIR node).
127667 0 : size_t memory = numberOfNodes() * sizeof(SgVarRefExp);
127668 :
127669 0 : return memory;
127670 : }
127671 :
127672 : /* #line 127673 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
127673 :
127674 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
127675 : void
127676 5342 : SgClassNameRefExp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
127677 : {
127678 : // This function traverses the memory pool for only a specific IR node
127679 : // and calls the visit function of the input class execute a traversal
127680 : // similar to the style of the attribute based traversals within ROSE.
127681 : // This traversal will visit ALL nodes of the AST where as the other
127682 : // attribute based traversals visit only the embedded tree within the AST.
127683 :
127684 : // Initialize array to the address of the first element of the STL vector
127685 : // (which is guaranteed to be contiguous storage).
127686 : // SgClassNameRefExp objectArray [] = *(Memory_Block_List.begin());
127687 5342 : if (SgClassNameRefExp::pools.empty() == false)
127688 : {
127689 : // Generate an array of memory pools
127690 0 : SgClassNameRefExp** objectArray = (SgClassNameRefExp**) &(SgClassNameRefExp::pools[0]);
127691 :
127692 : // Build a local variable for better performance
127693 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
127694 : #if 0
127695 : // Iterate over the memory pools
127696 : for (unsigned int i=0; i < SgClassNameRefExp::pools.size(); i++)
127697 : {
127698 : // objectArray[i] is a single memory pool
127699 : for (int j=0; j < SgClassNameRefExp::pool_size; j++)
127700 : {
127701 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
127702 : {
127703 : traversal.visit(&(objectArray[i][j]));
127704 : }
127705 : }
127706 : }
127707 : #else
127708 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
127709 : // compute the list first and then call the visit function on each list element.
127710 :
127711 : // printf ("Inside of SgClassNameRefExp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
127712 :
127713 0 : std::vector<SgClassNameRefExp*> nodeList;
127714 :
127715 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
127716 0 : for (unsigned int i=0; i < SgClassNameRefExp::pools.size(); i++)
127717 : {
127718 : // objectArray[i] is a single memory pool
127719 0 : for (unsigned j=0; j < SgClassNameRefExp::pool_size; j++)
127720 : {
127721 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
127722 : {
127723 0 : nodeList.push_back(&(objectArray[i][j]));
127724 : }
127725 : }
127726 : }
127727 :
127728 : // Iterate over the saved list
127729 0 : size_t nodeListSize = nodeList.size();
127730 0 : for (size_t i=0; i < nodeListSize; i++)
127731 : {
127732 0 : ROSE_ASSERT(nodeList[i] != NULL);
127733 : #if 0
127734 : traversal.visit(nodeList[i]);
127735 : #else
127736 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
127737 : {
127738 0 : traversal.visit(nodeList[i]);
127739 : }
127740 : #endif
127741 : }
127742 : #endif
127743 : }
127744 :
127745 : // This should not be required since all previously static data members are
127746 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
127747 :
127748 5342 : }
127749 :
127750 :
127751 : void
127752 194 : SgClassNameRefExp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
127753 : {
127754 : // This function traverses the memory pool for an IR node and
127755 : // calls the function to execute the visitor object.
127756 :
127757 : // Initialize array to the address of the first element of the STL vector
127758 : // (which is guarenteed to be contiguous storage).
127759 : // SgClassNameRefExp objectArray [] = *(Memory_Block_List.begin());
127760 194 : if (SgClassNameRefExp::pools.empty() == false)
127761 : {
127762 : // Generate an array of memory pools
127763 0 : SgClassNameRefExp** objectArray = (SgClassNameRefExp**) &(SgClassNameRefExp::pools[0]);
127764 :
127765 : // Build a local variable for better performance
127766 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
127767 :
127768 : // Iterate over the memory pools
127769 0 : for (unsigned int i=0; i < SgClassNameRefExp::pools.size(); i++)
127770 : {
127771 : // objectArray[i] is a single memory pool
127772 0 : for (unsigned j=0; j < SgClassNameRefExp::pool_size; j++)
127773 : {
127774 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
127775 : {
127776 : // printf ("Found a valid SgClassNameRefExp object in the memory pool %d at position %d \n",i,j);
127777 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
127778 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
127779 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
127780 : }
127781 : else
127782 : {
127783 : // printf ("Found a INVALID SgClassNameRefExp object in the memory pool \n");
127784 : }
127785 : }
127786 : }
127787 : }
127788 :
127789 : // This should not be required since all previously static data members are
127790 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
127791 :
127792 194 : }
127793 :
127794 : void
127795 0 : SgClassNameRefExp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
127796 : {
127797 : // This function visits only a single IR node of the memory pool.
127798 : // it is typically called once for each type of IR node within
127799 : // the automatically generated function: traverseRepresentativeNodes().
127800 :
127801 : // Initialize array to the address of the first element of the STL vector
127802 : // (which is guarenteed to be contiguous storage).
127803 : // SgClassNameRefExp objectArray [] = *(Memory_Block_List.begin());
127804 0 : if (SgClassNameRefExp::pools.empty() == false)
127805 : {
127806 : // Generate an array of memory pools
127807 0 : SgClassNameRefExp** objectArray = (SgClassNameRefExp**) &(SgClassNameRefExp::pools[0]);
127808 :
127809 : // Build a local variable for better performance
127810 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
127811 :
127812 : // Iterate over the memory pools
127813 0 : bool done = false;
127814 0 : unsigned i=0;
127815 :
127816 : // find the first valid IR node, call visit function, and then leave
127817 0 : while ( done == false && i < SgClassNameRefExp::pools.size() )
127818 : {
127819 : // objectArray[i] is a single memory pool
127820 : unsigned j=0;
127821 0 : while (done == false && j < SgClassNameRefExp::pool_size)
127822 : {
127823 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
127824 : {
127825 0 : traversal.visit(&(objectArray[i][j]));
127826 0 : done = true;
127827 : }
127828 0 : j++;
127829 : }
127830 0 : i++;
127831 : }
127832 :
127833 : #if 0
127834 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
127835 : if (done == false)
127836 : {
127837 : printf ("No representative for SgClassNameRefExp found in memory pools \n");
127838 : }
127839 : #endif
127840 : }
127841 0 : }
127842 :
127843 :
127844 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
127845 : // using values that overflow signed values of int.
127846 : size_t
127847 4 : SgClassNameRefExp::numberOfNodes()
127848 : {
127849 : // This function traverses the memory pool for an IR node and
127850 : // counts the number of IR nodes of a particular Sage III IR
127851 : // nodes type.
127852 :
127853 4 : size_t count = 0;
127854 4 : if (SgClassNameRefExp::pools.empty() == false)
127855 : {
127856 : // Generate an array of memory pools (this is actually a STL vector,
127857 : // but it is contiguious, so OK to treat this way).
127858 0 : SgClassNameRefExp** objectArray = (SgClassNameRefExp**) &(SgClassNameRefExp::pools[0]);
127859 :
127860 : // Build a local variable for better performance (make it a loop invariant variable).
127861 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
127862 :
127863 : // Iterate over all of the memory pools for this IR node.
127864 0 : for (unsigned int i=0; i < SgClassNameRefExp::pools.size(); i++)
127865 : {
127866 : // objectArray[i] is a single memory pool, iterate over all the
127867 : // IR nodes and only count those that are valid IR nodes used in
127868 : // the AST (i.e. allocated IR nodes).
127869 0 : for (unsigned j=0; j < SgClassNameRefExp::pool_size; j++)
127870 : {
127871 : // This is indexing the STL vector of C/C++ style arrays as a doubly
127872 : // indexed array access. It is OK since we have leveraged the semantics
127873 : // of STL vector memory as contigous and cast the memory as an array
127874 : // of arrays to use the 2D array indexing. Hope this is not confusing,
127875 : // but it s very fast as an implementation.
127876 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
127877 : {
127878 0 : count++;
127879 : }
127880 : }
127881 : }
127882 : }
127883 :
127884 :
127885 :
127886 4 : return count;
127887 : }
127888 :
127889 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
127890 : // using values that overflow signed values of int.
127891 : size_t
127892 0 : SgClassNameRefExp::memoryUsage()
127893 : {
127894 : // This function is required because we need the class name as a type when we call sizeof
127895 : // There might be another way to implement this if we have a traversal that only called a
127896 : // representative object (one call for each type of Sage IIIIR node).
127897 0 : size_t memory = numberOfNodes() * sizeof(SgClassNameRefExp);
127898 :
127899 0 : return memory;
127900 : }
127901 :
127902 : /* #line 127903 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
127903 :
127904 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
127905 : void
127906 5342 : SgFunctionRefExp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
127907 : {
127908 : // This function traverses the memory pool for only a specific IR node
127909 : // and calls the visit function of the input class execute a traversal
127910 : // similar to the style of the attribute based traversals within ROSE.
127911 : // This traversal will visit ALL nodes of the AST where as the other
127912 : // attribute based traversals visit only the embedded tree within the AST.
127913 :
127914 : // Initialize array to the address of the first element of the STL vector
127915 : // (which is guaranteed to be contiguous storage).
127916 : // SgFunctionRefExp objectArray [] = *(Memory_Block_List.begin());
127917 5342 : if (SgFunctionRefExp::pools.empty() == false)
127918 : {
127919 : // Generate an array of memory pools
127920 3424 : SgFunctionRefExp** objectArray = (SgFunctionRefExp**) &(SgFunctionRefExp::pools[0]);
127921 :
127922 : // Build a local variable for better performance
127923 3424 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
127924 : #if 0
127925 : // Iterate over the memory pools
127926 : for (unsigned int i=0; i < SgFunctionRefExp::pools.size(); i++)
127927 : {
127928 : // objectArray[i] is a single memory pool
127929 : for (int j=0; j < SgFunctionRefExp::pool_size; j++)
127930 : {
127931 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
127932 : {
127933 : traversal.visit(&(objectArray[i][j]));
127934 : }
127935 : }
127936 : }
127937 : #else
127938 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
127939 : // compute the list first and then call the visit function on each list element.
127940 :
127941 : // printf ("Inside of SgFunctionRefExp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
127942 :
127943 6848 : std::vector<SgFunctionRefExp*> nodeList;
127944 :
127945 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
127946 6848 : for (unsigned int i=0; i < SgFunctionRefExp::pools.size(); i++)
127947 : {
127948 : // objectArray[i] is a single memory pool
127949 6851420 : for (unsigned j=0; j < SgFunctionRefExp::pool_size; j++)
127950 : {
127951 6848000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
127952 : {
127953 112285 : nodeList.push_back(&(objectArray[i][j]));
127954 : }
127955 : }
127956 : }
127957 :
127958 : // Iterate over the saved list
127959 3424 : size_t nodeListSize = nodeList.size();
127960 115709 : for (size_t i=0; i < nodeListSize; i++)
127961 : {
127962 112285 : ROSE_ASSERT(nodeList[i] != NULL);
127963 : #if 0
127964 : traversal.visit(nodeList[i]);
127965 : #else
127966 112285 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
127967 : {
127968 112285 : traversal.visit(nodeList[i]);
127969 : }
127970 : #endif
127971 : }
127972 : #endif
127973 : }
127974 :
127975 : // This should not be required since all previously static data members are
127976 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
127977 :
127978 5342 : }
127979 :
127980 :
127981 : void
127982 194 : SgFunctionRefExp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
127983 : {
127984 : // This function traverses the memory pool for an IR node and
127985 : // calls the function to execute the visitor object.
127986 :
127987 : // Initialize array to the address of the first element of the STL vector
127988 : // (which is guarenteed to be contiguous storage).
127989 : // SgFunctionRefExp objectArray [] = *(Memory_Block_List.begin());
127990 194 : if (SgFunctionRefExp::pools.empty() == false)
127991 : {
127992 : // Generate an array of memory pools
127993 141 : SgFunctionRefExp** objectArray = (SgFunctionRefExp**) &(SgFunctionRefExp::pools[0]);
127994 :
127995 : // Build a local variable for better performance
127996 141 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
127997 :
127998 : // Iterate over the memory pools
127999 282 : for (unsigned int i=0; i < SgFunctionRefExp::pools.size(); i++)
128000 : {
128001 : // objectArray[i] is a single memory pool
128002 282141 : for (unsigned j=0; j < SgFunctionRefExp::pool_size; j++)
128003 : {
128004 282000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
128005 : {
128006 : // printf ("Found a valid SgFunctionRefExp object in the memory pool %d at position %d \n",i,j);
128007 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
128008 84885 : objectArray[i][j].executeVisitorMemberFunction(visitor);
128009 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
128010 : }
128011 : else
128012 : {
128013 : // printf ("Found a INVALID SgFunctionRefExp object in the memory pool \n");
128014 : }
128015 : }
128016 : }
128017 : }
128018 :
128019 : // This should not be required since all previously static data members are
128020 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
128021 :
128022 194 : }
128023 :
128024 : void
128025 0 : SgFunctionRefExp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
128026 : {
128027 : // This function visits only a single IR node of the memory pool.
128028 : // it is typically called once for each type of IR node within
128029 : // the automatically generated function: traverseRepresentativeNodes().
128030 :
128031 : // Initialize array to the address of the first element of the STL vector
128032 : // (which is guarenteed to be contiguous storage).
128033 : // SgFunctionRefExp objectArray [] = *(Memory_Block_List.begin());
128034 0 : if (SgFunctionRefExp::pools.empty() == false)
128035 : {
128036 : // Generate an array of memory pools
128037 0 : SgFunctionRefExp** objectArray = (SgFunctionRefExp**) &(SgFunctionRefExp::pools[0]);
128038 :
128039 : // Build a local variable for better performance
128040 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
128041 :
128042 : // Iterate over the memory pools
128043 0 : bool done = false;
128044 0 : unsigned i=0;
128045 :
128046 : // find the first valid IR node, call visit function, and then leave
128047 0 : while ( done == false && i < SgFunctionRefExp::pools.size() )
128048 : {
128049 : // objectArray[i] is a single memory pool
128050 : unsigned j=0;
128051 0 : while (done == false && j < SgFunctionRefExp::pool_size)
128052 : {
128053 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
128054 : {
128055 0 : traversal.visit(&(objectArray[i][j]));
128056 0 : done = true;
128057 : }
128058 0 : j++;
128059 : }
128060 0 : i++;
128061 : }
128062 :
128063 : #if 0
128064 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
128065 : if (done == false)
128066 : {
128067 : printf ("No representative for SgFunctionRefExp found in memory pools \n");
128068 : }
128069 : #endif
128070 : }
128071 0 : }
128072 :
128073 :
128074 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
128075 : // using values that overflow signed values of int.
128076 : size_t
128077 4 : SgFunctionRefExp::numberOfNodes()
128078 : {
128079 : // This function traverses the memory pool for an IR node and
128080 : // counts the number of IR nodes of a particular Sage III IR
128081 : // nodes type.
128082 :
128083 4 : size_t count = 0;
128084 4 : if (SgFunctionRefExp::pools.empty() == false)
128085 : {
128086 : // Generate an array of memory pools (this is actually a STL vector,
128087 : // but it is contiguious, so OK to treat this way).
128088 4 : SgFunctionRefExp** objectArray = (SgFunctionRefExp**) &(SgFunctionRefExp::pools[0]);
128089 :
128090 : // Build a local variable for better performance (make it a loop invariant variable).
128091 4 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
128092 :
128093 : // Iterate over all of the memory pools for this IR node.
128094 8 : for (unsigned int i=0; i < SgFunctionRefExp::pools.size(); i++)
128095 : {
128096 : // objectArray[i] is a single memory pool, iterate over all the
128097 : // IR nodes and only count those that are valid IR nodes used in
128098 : // the AST (i.e. allocated IR nodes).
128099 8004 : for (unsigned j=0; j < SgFunctionRefExp::pool_size; j++)
128100 : {
128101 : // This is indexing the STL vector of C/C++ style arrays as a doubly
128102 : // indexed array access. It is OK since we have leveraged the semantics
128103 : // of STL vector memory as contigous and cast the memory as an array
128104 : // of arrays to use the 2D array indexing. Hope this is not confusing,
128105 : // but it s very fast as an implementation.
128106 8000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
128107 : {
128108 611 : count++;
128109 : }
128110 : }
128111 : }
128112 : }
128113 :
128114 :
128115 :
128116 4 : return count;
128117 : }
128118 :
128119 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
128120 : // using values that overflow signed values of int.
128121 : size_t
128122 0 : SgFunctionRefExp::memoryUsage()
128123 : {
128124 : // This function is required because we need the class name as a type when we call sizeof
128125 : // There might be another way to implement this if we have a traversal that only called a
128126 : // representative object (one call for each type of Sage IIIIR node).
128127 0 : size_t memory = numberOfNodes() * sizeof(SgFunctionRefExp);
128128 :
128129 0 : return memory;
128130 : }
128131 :
128132 : /* #line 128133 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
128133 :
128134 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
128135 : void
128136 5342 : SgMemberFunctionRefExp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
128137 : {
128138 : // This function traverses the memory pool for only a specific IR node
128139 : // and calls the visit function of the input class execute a traversal
128140 : // similar to the style of the attribute based traversals within ROSE.
128141 : // This traversal will visit ALL nodes of the AST where as the other
128142 : // attribute based traversals visit only the embedded tree within the AST.
128143 :
128144 : // Initialize array to the address of the first element of the STL vector
128145 : // (which is guaranteed to be contiguous storage).
128146 : // SgMemberFunctionRefExp objectArray [] = *(Memory_Block_List.begin());
128147 5342 : if (SgMemberFunctionRefExp::pools.empty() == false)
128148 : {
128149 : // Generate an array of memory pools
128150 183 : SgMemberFunctionRefExp** objectArray = (SgMemberFunctionRefExp**) &(SgMemberFunctionRefExp::pools[0]);
128151 :
128152 : // Build a local variable for better performance
128153 183 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
128154 : #if 0
128155 : // Iterate over the memory pools
128156 : for (unsigned int i=0; i < SgMemberFunctionRefExp::pools.size(); i++)
128157 : {
128158 : // objectArray[i] is a single memory pool
128159 : for (int j=0; j < SgMemberFunctionRefExp::pool_size; j++)
128160 : {
128161 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
128162 : {
128163 : traversal.visit(&(objectArray[i][j]));
128164 : }
128165 : }
128166 : }
128167 : #else
128168 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
128169 : // compute the list first and then call the visit function on each list element.
128170 :
128171 : // printf ("Inside of SgMemberFunctionRefExp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
128172 :
128173 366 : std::vector<SgMemberFunctionRefExp*> nodeList;
128174 :
128175 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
128176 366 : for (unsigned int i=0; i < SgMemberFunctionRefExp::pools.size(); i++)
128177 : {
128178 : // objectArray[i] is a single memory pool
128179 366183 : for (unsigned j=0; j < SgMemberFunctionRefExp::pool_size; j++)
128180 : {
128181 366000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
128182 : {
128183 65816 : nodeList.push_back(&(objectArray[i][j]));
128184 : }
128185 : }
128186 : }
128187 :
128188 : // Iterate over the saved list
128189 183 : size_t nodeListSize = nodeList.size();
128190 65999 : for (size_t i=0; i < nodeListSize; i++)
128191 : {
128192 65816 : ROSE_ASSERT(nodeList[i] != NULL);
128193 : #if 0
128194 : traversal.visit(nodeList[i]);
128195 : #else
128196 65816 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
128197 : {
128198 65816 : traversal.visit(nodeList[i]);
128199 : }
128200 : #endif
128201 : }
128202 : #endif
128203 : }
128204 :
128205 : // This should not be required since all previously static data members are
128206 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
128207 :
128208 5342 : }
128209 :
128210 :
128211 : void
128212 194 : SgMemberFunctionRefExp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
128213 : {
128214 : // This function traverses the memory pool for an IR node and
128215 : // calls the function to execute the visitor object.
128216 :
128217 : // Initialize array to the address of the first element of the STL vector
128218 : // (which is guarenteed to be contiguous storage).
128219 : // SgMemberFunctionRefExp objectArray [] = *(Memory_Block_List.begin());
128220 194 : if (SgMemberFunctionRefExp::pools.empty() == false)
128221 : {
128222 : // Generate an array of memory pools
128223 137 : SgMemberFunctionRefExp** objectArray = (SgMemberFunctionRefExp**) &(SgMemberFunctionRefExp::pools[0]);
128224 :
128225 : // Build a local variable for better performance
128226 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
128227 :
128228 : // Iterate over the memory pools
128229 274 : for (unsigned int i=0; i < SgMemberFunctionRefExp::pools.size(); i++)
128230 : {
128231 : // objectArray[i] is a single memory pool
128232 274137 : for (unsigned j=0; j < SgMemberFunctionRefExp::pool_size; j++)
128233 : {
128234 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
128235 : {
128236 : // printf ("Found a valid SgMemberFunctionRefExp object in the memory pool %d at position %d \n",i,j);
128237 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
128238 76152 : objectArray[i][j].executeVisitorMemberFunction(visitor);
128239 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
128240 : }
128241 : else
128242 : {
128243 : // printf ("Found a INVALID SgMemberFunctionRefExp object in the memory pool \n");
128244 : }
128245 : }
128246 : }
128247 : }
128248 :
128249 : // This should not be required since all previously static data members are
128250 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
128251 :
128252 194 : }
128253 :
128254 : void
128255 0 : SgMemberFunctionRefExp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
128256 : {
128257 : // This function visits only a single IR node of the memory pool.
128258 : // it is typically called once for each type of IR node within
128259 : // the automatically generated function: traverseRepresentativeNodes().
128260 :
128261 : // Initialize array to the address of the first element of the STL vector
128262 : // (which is guarenteed to be contiguous storage).
128263 : // SgMemberFunctionRefExp objectArray [] = *(Memory_Block_List.begin());
128264 0 : if (SgMemberFunctionRefExp::pools.empty() == false)
128265 : {
128266 : // Generate an array of memory pools
128267 0 : SgMemberFunctionRefExp** objectArray = (SgMemberFunctionRefExp**) &(SgMemberFunctionRefExp::pools[0]);
128268 :
128269 : // Build a local variable for better performance
128270 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
128271 :
128272 : // Iterate over the memory pools
128273 0 : bool done = false;
128274 0 : unsigned i=0;
128275 :
128276 : // find the first valid IR node, call visit function, and then leave
128277 0 : while ( done == false && i < SgMemberFunctionRefExp::pools.size() )
128278 : {
128279 : // objectArray[i] is a single memory pool
128280 : unsigned j=0;
128281 0 : while (done == false && j < SgMemberFunctionRefExp::pool_size)
128282 : {
128283 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
128284 : {
128285 0 : traversal.visit(&(objectArray[i][j]));
128286 0 : done = true;
128287 : }
128288 0 : j++;
128289 : }
128290 0 : i++;
128291 : }
128292 :
128293 : #if 0
128294 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
128295 : if (done == false)
128296 : {
128297 : printf ("No representative for SgMemberFunctionRefExp found in memory pools \n");
128298 : }
128299 : #endif
128300 : }
128301 0 : }
128302 :
128303 :
128304 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
128305 : // using values that overflow signed values of int.
128306 : size_t
128307 4 : SgMemberFunctionRefExp::numberOfNodes()
128308 : {
128309 : // This function traverses the memory pool for an IR node and
128310 : // counts the number of IR nodes of a particular Sage III IR
128311 : // nodes type.
128312 :
128313 4 : size_t count = 0;
128314 4 : if (SgMemberFunctionRefExp::pools.empty() == false)
128315 : {
128316 : // Generate an array of memory pools (this is actually a STL vector,
128317 : // but it is contiguious, so OK to treat this way).
128318 1 : SgMemberFunctionRefExp** objectArray = (SgMemberFunctionRefExp**) &(SgMemberFunctionRefExp::pools[0]);
128319 :
128320 : // Build a local variable for better performance (make it a loop invariant variable).
128321 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
128322 :
128323 : // Iterate over all of the memory pools for this IR node.
128324 2 : for (unsigned int i=0; i < SgMemberFunctionRefExp::pools.size(); i++)
128325 : {
128326 : // objectArray[i] is a single memory pool, iterate over all the
128327 : // IR nodes and only count those that are valid IR nodes used in
128328 : // the AST (i.e. allocated IR nodes).
128329 2001 : for (unsigned j=0; j < SgMemberFunctionRefExp::pool_size; j++)
128330 : {
128331 : // This is indexing the STL vector of C/C++ style arrays as a doubly
128332 : // indexed array access. It is OK since we have leveraged the semantics
128333 : // of STL vector memory as contigous and cast the memory as an array
128334 : // of arrays to use the 2D array indexing. Hope this is not confusing,
128335 : // but it s very fast as an implementation.
128336 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
128337 : {
128338 540 : count++;
128339 : }
128340 : }
128341 : }
128342 : }
128343 :
128344 :
128345 :
128346 4 : return count;
128347 : }
128348 :
128349 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
128350 : // using values that overflow signed values of int.
128351 : size_t
128352 0 : SgMemberFunctionRefExp::memoryUsage()
128353 : {
128354 : // This function is required because we need the class name as a type when we call sizeof
128355 : // There might be another way to implement this if we have a traversal that only called a
128356 : // representative object (one call for each type of Sage IIIIR node).
128357 0 : size_t memory = numberOfNodes() * sizeof(SgMemberFunctionRefExp);
128358 :
128359 0 : return memory;
128360 : }
128361 :
128362 : /* #line 128363 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
128363 :
128364 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
128365 : void
128366 5342 : SgValueExp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
128367 : {
128368 : // This function traverses the memory pool for only a specific IR node
128369 : // and calls the visit function of the input class execute a traversal
128370 : // similar to the style of the attribute based traversals within ROSE.
128371 : // This traversal will visit ALL nodes of the AST where as the other
128372 : // attribute based traversals visit only the embedded tree within the AST.
128373 :
128374 : // Initialize array to the address of the first element of the STL vector
128375 : // (which is guaranteed to be contiguous storage).
128376 : // SgValueExp objectArray [] = *(Memory_Block_List.begin());
128377 5342 : if (SgValueExp::pools.empty() == false)
128378 : {
128379 : // Generate an array of memory pools
128380 0 : SgValueExp** objectArray = (SgValueExp**) &(SgValueExp::pools[0]);
128381 :
128382 : // Build a local variable for better performance
128383 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
128384 : #if 0
128385 : // Iterate over the memory pools
128386 : for (unsigned int i=0; i < SgValueExp::pools.size(); i++)
128387 : {
128388 : // objectArray[i] is a single memory pool
128389 : for (int j=0; j < SgValueExp::pool_size; j++)
128390 : {
128391 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
128392 : {
128393 : traversal.visit(&(objectArray[i][j]));
128394 : }
128395 : }
128396 : }
128397 : #else
128398 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
128399 : // compute the list first and then call the visit function on each list element.
128400 :
128401 : // printf ("Inside of SgValueExp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
128402 :
128403 0 : std::vector<SgValueExp*> nodeList;
128404 :
128405 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
128406 0 : for (unsigned int i=0; i < SgValueExp::pools.size(); i++)
128407 : {
128408 : // objectArray[i] is a single memory pool
128409 0 : for (unsigned j=0; j < SgValueExp::pool_size; j++)
128410 : {
128411 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
128412 : {
128413 0 : nodeList.push_back(&(objectArray[i][j]));
128414 : }
128415 : }
128416 : }
128417 :
128418 : // Iterate over the saved list
128419 0 : size_t nodeListSize = nodeList.size();
128420 0 : for (size_t i=0; i < nodeListSize; i++)
128421 : {
128422 0 : ROSE_ASSERT(nodeList[i] != NULL);
128423 : #if 0
128424 : traversal.visit(nodeList[i]);
128425 : #else
128426 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
128427 : {
128428 0 : traversal.visit(nodeList[i]);
128429 : }
128430 : #endif
128431 : }
128432 : #endif
128433 : }
128434 :
128435 : // This should not be required since all previously static data members are
128436 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
128437 :
128438 5342 : }
128439 :
128440 :
128441 : void
128442 194 : SgValueExp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
128443 : {
128444 : // This function traverses the memory pool for an IR node and
128445 : // calls the function to execute the visitor object.
128446 :
128447 : // Initialize array to the address of the first element of the STL vector
128448 : // (which is guarenteed to be contiguous storage).
128449 : // SgValueExp objectArray [] = *(Memory_Block_List.begin());
128450 194 : if (SgValueExp::pools.empty() == false)
128451 : {
128452 : // Generate an array of memory pools
128453 0 : SgValueExp** objectArray = (SgValueExp**) &(SgValueExp::pools[0]);
128454 :
128455 : // Build a local variable for better performance
128456 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
128457 :
128458 : // Iterate over the memory pools
128459 0 : for (unsigned int i=0; i < SgValueExp::pools.size(); i++)
128460 : {
128461 : // objectArray[i] is a single memory pool
128462 0 : for (unsigned j=0; j < SgValueExp::pool_size; j++)
128463 : {
128464 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
128465 : {
128466 : // printf ("Found a valid SgValueExp object in the memory pool %d at position %d \n",i,j);
128467 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
128468 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
128469 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
128470 : }
128471 : else
128472 : {
128473 : // printf ("Found a INVALID SgValueExp object in the memory pool \n");
128474 : }
128475 : }
128476 : }
128477 : }
128478 :
128479 : // This should not be required since all previously static data members are
128480 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
128481 :
128482 194 : }
128483 :
128484 : void
128485 0 : SgValueExp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
128486 : {
128487 : // This function visits only a single IR node of the memory pool.
128488 : // it is typically called once for each type of IR node within
128489 : // the automatically generated function: traverseRepresentativeNodes().
128490 :
128491 : // Initialize array to the address of the first element of the STL vector
128492 : // (which is guarenteed to be contiguous storage).
128493 : // SgValueExp objectArray [] = *(Memory_Block_List.begin());
128494 0 : if (SgValueExp::pools.empty() == false)
128495 : {
128496 : // Generate an array of memory pools
128497 0 : SgValueExp** objectArray = (SgValueExp**) &(SgValueExp::pools[0]);
128498 :
128499 : // Build a local variable for better performance
128500 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
128501 :
128502 : // Iterate over the memory pools
128503 0 : bool done = false;
128504 0 : unsigned i=0;
128505 :
128506 : // find the first valid IR node, call visit function, and then leave
128507 0 : while ( done == false && i < SgValueExp::pools.size() )
128508 : {
128509 : // objectArray[i] is a single memory pool
128510 : unsigned j=0;
128511 0 : while (done == false && j < SgValueExp::pool_size)
128512 : {
128513 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
128514 : {
128515 0 : traversal.visit(&(objectArray[i][j]));
128516 0 : done = true;
128517 : }
128518 0 : j++;
128519 : }
128520 0 : i++;
128521 : }
128522 :
128523 : #if 0
128524 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
128525 : if (done == false)
128526 : {
128527 : printf ("No representative for SgValueExp found in memory pools \n");
128528 : }
128529 : #endif
128530 : }
128531 0 : }
128532 :
128533 :
128534 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
128535 : // using values that overflow signed values of int.
128536 : size_t
128537 4 : SgValueExp::numberOfNodes()
128538 : {
128539 : // This function traverses the memory pool for an IR node and
128540 : // counts the number of IR nodes of a particular Sage III IR
128541 : // nodes type.
128542 :
128543 4 : size_t count = 0;
128544 4 : if (SgValueExp::pools.empty() == false)
128545 : {
128546 : // Generate an array of memory pools (this is actually a STL vector,
128547 : // but it is contiguious, so OK to treat this way).
128548 0 : SgValueExp** objectArray = (SgValueExp**) &(SgValueExp::pools[0]);
128549 :
128550 : // Build a local variable for better performance (make it a loop invariant variable).
128551 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
128552 :
128553 : // Iterate over all of the memory pools for this IR node.
128554 0 : for (unsigned int i=0; i < SgValueExp::pools.size(); i++)
128555 : {
128556 : // objectArray[i] is a single memory pool, iterate over all the
128557 : // IR nodes and only count those that are valid IR nodes used in
128558 : // the AST (i.e. allocated IR nodes).
128559 0 : for (unsigned j=0; j < SgValueExp::pool_size; j++)
128560 : {
128561 : // This is indexing the STL vector of C/C++ style arrays as a doubly
128562 : // indexed array access. It is OK since we have leveraged the semantics
128563 : // of STL vector memory as contigous and cast the memory as an array
128564 : // of arrays to use the 2D array indexing. Hope this is not confusing,
128565 : // but it s very fast as an implementation.
128566 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
128567 : {
128568 0 : count++;
128569 : }
128570 : }
128571 : }
128572 : }
128573 :
128574 :
128575 :
128576 4 : return count;
128577 : }
128578 :
128579 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
128580 : // using values that overflow signed values of int.
128581 : size_t
128582 0 : SgValueExp::memoryUsage()
128583 : {
128584 : // This function is required because we need the class name as a type when we call sizeof
128585 : // There might be another way to implement this if we have a traversal that only called a
128586 : // representative object (one call for each type of Sage IIIIR node).
128587 0 : size_t memory = numberOfNodes() * sizeof(SgValueExp);
128588 :
128589 0 : return memory;
128590 : }
128591 :
128592 : /* #line 128593 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
128593 :
128594 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
128595 : void
128596 5342 : SgBoolValExp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
128597 : {
128598 : // This function traverses the memory pool for only a specific IR node
128599 : // and calls the visit function of the input class execute a traversal
128600 : // similar to the style of the attribute based traversals within ROSE.
128601 : // This traversal will visit ALL nodes of the AST where as the other
128602 : // attribute based traversals visit only the embedded tree within the AST.
128603 :
128604 : // Initialize array to the address of the first element of the STL vector
128605 : // (which is guaranteed to be contiguous storage).
128606 : // SgBoolValExp objectArray [] = *(Memory_Block_List.begin());
128607 5342 : if (SgBoolValExp::pools.empty() == false)
128608 : {
128609 : // Generate an array of memory pools
128610 145 : SgBoolValExp** objectArray = (SgBoolValExp**) &(SgBoolValExp::pools[0]);
128611 :
128612 : // Build a local variable for better performance
128613 145 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
128614 : #if 0
128615 : // Iterate over the memory pools
128616 : for (unsigned int i=0; i < SgBoolValExp::pools.size(); i++)
128617 : {
128618 : // objectArray[i] is a single memory pool
128619 : for (int j=0; j < SgBoolValExp::pool_size; j++)
128620 : {
128621 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
128622 : {
128623 : traversal.visit(&(objectArray[i][j]));
128624 : }
128625 : }
128626 : }
128627 : #else
128628 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
128629 : // compute the list first and then call the visit function on each list element.
128630 :
128631 : // printf ("Inside of SgBoolValExp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
128632 :
128633 290 : std::vector<SgBoolValExp*> nodeList;
128634 :
128635 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
128636 290 : for (unsigned int i=0; i < SgBoolValExp::pools.size(); i++)
128637 : {
128638 : // objectArray[i] is a single memory pool
128639 290145 : for (unsigned j=0; j < SgBoolValExp::pool_size; j++)
128640 : {
128641 290000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
128642 : {
128643 61858 : nodeList.push_back(&(objectArray[i][j]));
128644 : }
128645 : }
128646 : }
128647 :
128648 : // Iterate over the saved list
128649 145 : size_t nodeListSize = nodeList.size();
128650 62003 : for (size_t i=0; i < nodeListSize; i++)
128651 : {
128652 61858 : ROSE_ASSERT(nodeList[i] != NULL);
128653 : #if 0
128654 : traversal.visit(nodeList[i]);
128655 : #else
128656 61858 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
128657 : {
128658 61858 : traversal.visit(nodeList[i]);
128659 : }
128660 : #endif
128661 : }
128662 : #endif
128663 : }
128664 :
128665 : // This should not be required since all previously static data members are
128666 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
128667 :
128668 5342 : }
128669 :
128670 :
128671 : void
128672 194 : SgBoolValExp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
128673 : {
128674 : // This function traverses the memory pool for an IR node and
128675 : // calls the function to execute the visitor object.
128676 :
128677 : // Initialize array to the address of the first element of the STL vector
128678 : // (which is guarenteed to be contiguous storage).
128679 : // SgBoolValExp objectArray [] = *(Memory_Block_List.begin());
128680 194 : if (SgBoolValExp::pools.empty() == false)
128681 : {
128682 : // Generate an array of memory pools
128683 137 : SgBoolValExp** objectArray = (SgBoolValExp**) &(SgBoolValExp::pools[0]);
128684 :
128685 : // Build a local variable for better performance
128686 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
128687 :
128688 : // Iterate over the memory pools
128689 274 : for (unsigned int i=0; i < SgBoolValExp::pools.size(); i++)
128690 : {
128691 : // objectArray[i] is a single memory pool
128692 274137 : for (unsigned j=0; j < SgBoolValExp::pool_size; j++)
128693 : {
128694 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
128695 : {
128696 : // printf ("Found a valid SgBoolValExp object in the memory pool %d at position %d \n",i,j);
128697 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
128698 55071 : objectArray[i][j].executeVisitorMemberFunction(visitor);
128699 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
128700 : }
128701 : else
128702 : {
128703 : // printf ("Found a INVALID SgBoolValExp object in the memory pool \n");
128704 : }
128705 : }
128706 : }
128707 : }
128708 :
128709 : // This should not be required since all previously static data members are
128710 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
128711 :
128712 194 : }
128713 :
128714 : void
128715 0 : SgBoolValExp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
128716 : {
128717 : // This function visits only a single IR node of the memory pool.
128718 : // it is typically called once for each type of IR node within
128719 : // the automatically generated function: traverseRepresentativeNodes().
128720 :
128721 : // Initialize array to the address of the first element of the STL vector
128722 : // (which is guarenteed to be contiguous storage).
128723 : // SgBoolValExp objectArray [] = *(Memory_Block_List.begin());
128724 0 : if (SgBoolValExp::pools.empty() == false)
128725 : {
128726 : // Generate an array of memory pools
128727 0 : SgBoolValExp** objectArray = (SgBoolValExp**) &(SgBoolValExp::pools[0]);
128728 :
128729 : // Build a local variable for better performance
128730 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
128731 :
128732 : // Iterate over the memory pools
128733 0 : bool done = false;
128734 0 : unsigned i=0;
128735 :
128736 : // find the first valid IR node, call visit function, and then leave
128737 0 : while ( done == false && i < SgBoolValExp::pools.size() )
128738 : {
128739 : // objectArray[i] is a single memory pool
128740 : unsigned j=0;
128741 0 : while (done == false && j < SgBoolValExp::pool_size)
128742 : {
128743 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
128744 : {
128745 0 : traversal.visit(&(objectArray[i][j]));
128746 0 : done = true;
128747 : }
128748 0 : j++;
128749 : }
128750 0 : i++;
128751 : }
128752 :
128753 : #if 0
128754 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
128755 : if (done == false)
128756 : {
128757 : printf ("No representative for SgBoolValExp found in memory pools \n");
128758 : }
128759 : #endif
128760 : }
128761 0 : }
128762 :
128763 :
128764 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
128765 : // using values that overflow signed values of int.
128766 : size_t
128767 4 : SgBoolValExp::numberOfNodes()
128768 : {
128769 : // This function traverses the memory pool for an IR node and
128770 : // counts the number of IR nodes of a particular Sage III IR
128771 : // nodes type.
128772 :
128773 4 : size_t count = 0;
128774 4 : if (SgBoolValExp::pools.empty() == false)
128775 : {
128776 : // Generate an array of memory pools (this is actually a STL vector,
128777 : // but it is contiguious, so OK to treat this way).
128778 1 : SgBoolValExp** objectArray = (SgBoolValExp**) &(SgBoolValExp::pools[0]);
128779 :
128780 : // Build a local variable for better performance (make it a loop invariant variable).
128781 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
128782 :
128783 : // Iterate over all of the memory pools for this IR node.
128784 2 : for (unsigned int i=0; i < SgBoolValExp::pools.size(); i++)
128785 : {
128786 : // objectArray[i] is a single memory pool, iterate over all the
128787 : // IR nodes and only count those that are valid IR nodes used in
128788 : // the AST (i.e. allocated IR nodes).
128789 2001 : for (unsigned j=0; j < SgBoolValExp::pool_size; j++)
128790 : {
128791 : // This is indexing the STL vector of C/C++ style arrays as a doubly
128792 : // indexed array access. It is OK since we have leveraged the semantics
128793 : // of STL vector memory as contigous and cast the memory as an array
128794 : // of arrays to use the 2D array indexing. Hope this is not confusing,
128795 : // but it s very fast as an implementation.
128796 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
128797 : {
128798 398 : count++;
128799 : }
128800 : }
128801 : }
128802 : }
128803 :
128804 :
128805 :
128806 4 : return count;
128807 : }
128808 :
128809 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
128810 : // using values that overflow signed values of int.
128811 : size_t
128812 0 : SgBoolValExp::memoryUsage()
128813 : {
128814 : // This function is required because we need the class name as a type when we call sizeof
128815 : // There might be another way to implement this if we have a traversal that only called a
128816 : // representative object (one call for each type of Sage IIIIR node).
128817 0 : size_t memory = numberOfNodes() * sizeof(SgBoolValExp);
128818 :
128819 0 : return memory;
128820 : }
128821 :
128822 : /* #line 128823 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
128823 :
128824 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
128825 : void
128826 5342 : SgStringVal::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
128827 : {
128828 : // This function traverses the memory pool for only a specific IR node
128829 : // and calls the visit function of the input class execute a traversal
128830 : // similar to the style of the attribute based traversals within ROSE.
128831 : // This traversal will visit ALL nodes of the AST where as the other
128832 : // attribute based traversals visit only the embedded tree within the AST.
128833 :
128834 : // Initialize array to the address of the first element of the STL vector
128835 : // (which is guaranteed to be contiguous storage).
128836 : // SgStringVal objectArray [] = *(Memory_Block_List.begin());
128837 5342 : if (SgStringVal::pools.empty() == false)
128838 : {
128839 : // Generate an array of memory pools
128840 2661 : SgStringVal** objectArray = (SgStringVal**) &(SgStringVal::pools[0]);
128841 :
128842 : // Build a local variable for better performance
128843 2661 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
128844 : #if 0
128845 : // Iterate over the memory pools
128846 : for (unsigned int i=0; i < SgStringVal::pools.size(); i++)
128847 : {
128848 : // objectArray[i] is a single memory pool
128849 : for (int j=0; j < SgStringVal::pool_size; j++)
128850 : {
128851 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
128852 : {
128853 : traversal.visit(&(objectArray[i][j]));
128854 : }
128855 : }
128856 : }
128857 : #else
128858 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
128859 : // compute the list first and then call the visit function on each list element.
128860 :
128861 : // printf ("Inside of SgStringVal::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
128862 :
128863 5322 : std::vector<SgStringVal*> nodeList;
128864 :
128865 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
128866 5322 : for (unsigned int i=0; i < SgStringVal::pools.size(); i++)
128867 : {
128868 : // objectArray[i] is a single memory pool
128869 5324660 : for (unsigned j=0; j < SgStringVal::pool_size; j++)
128870 : {
128871 5322000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
128872 : {
128873 20950 : nodeList.push_back(&(objectArray[i][j]));
128874 : }
128875 : }
128876 : }
128877 :
128878 : // Iterate over the saved list
128879 2661 : size_t nodeListSize = nodeList.size();
128880 23611 : for (size_t i=0; i < nodeListSize; i++)
128881 : {
128882 20950 : ROSE_ASSERT(nodeList[i] != NULL);
128883 : #if 0
128884 : traversal.visit(nodeList[i]);
128885 : #else
128886 20950 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
128887 : {
128888 20950 : traversal.visit(nodeList[i]);
128889 : }
128890 : #endif
128891 : }
128892 : #endif
128893 : }
128894 :
128895 : // This should not be required since all previously static data members are
128896 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
128897 :
128898 5342 : }
128899 :
128900 :
128901 : void
128902 194 : SgStringVal::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
128903 : {
128904 : // This function traverses the memory pool for an IR node and
128905 : // calls the function to execute the visitor object.
128906 :
128907 : // Initialize array to the address of the first element of the STL vector
128908 : // (which is guarenteed to be contiguous storage).
128909 : // SgStringVal objectArray [] = *(Memory_Block_List.begin());
128910 194 : if (SgStringVal::pools.empty() == false)
128911 : {
128912 : // Generate an array of memory pools
128913 137 : SgStringVal** objectArray = (SgStringVal**) &(SgStringVal::pools[0]);
128914 :
128915 : // Build a local variable for better performance
128916 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
128917 :
128918 : // Iterate over the memory pools
128919 274 : for (unsigned int i=0; i < SgStringVal::pools.size(); i++)
128920 : {
128921 : // objectArray[i] is a single memory pool
128922 274137 : for (unsigned j=0; j < SgStringVal::pool_size; j++)
128923 : {
128924 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
128925 : {
128926 : // printf ("Found a valid SgStringVal object in the memory pool %d at position %d \n",i,j);
128927 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
128928 11595 : objectArray[i][j].executeVisitorMemberFunction(visitor);
128929 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
128930 : }
128931 : else
128932 : {
128933 : // printf ("Found a INVALID SgStringVal object in the memory pool \n");
128934 : }
128935 : }
128936 : }
128937 : }
128938 :
128939 : // This should not be required since all previously static data members are
128940 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
128941 :
128942 194 : }
128943 :
128944 : void
128945 0 : SgStringVal::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
128946 : {
128947 : // This function visits only a single IR node of the memory pool.
128948 : // it is typically called once for each type of IR node within
128949 : // the automatically generated function: traverseRepresentativeNodes().
128950 :
128951 : // Initialize array to the address of the first element of the STL vector
128952 : // (which is guarenteed to be contiguous storage).
128953 : // SgStringVal objectArray [] = *(Memory_Block_List.begin());
128954 0 : if (SgStringVal::pools.empty() == false)
128955 : {
128956 : // Generate an array of memory pools
128957 0 : SgStringVal** objectArray = (SgStringVal**) &(SgStringVal::pools[0]);
128958 :
128959 : // Build a local variable for better performance
128960 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
128961 :
128962 : // Iterate over the memory pools
128963 0 : bool done = false;
128964 0 : unsigned i=0;
128965 :
128966 : // find the first valid IR node, call visit function, and then leave
128967 0 : while ( done == false && i < SgStringVal::pools.size() )
128968 : {
128969 : // objectArray[i] is a single memory pool
128970 : unsigned j=0;
128971 0 : while (done == false && j < SgStringVal::pool_size)
128972 : {
128973 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
128974 : {
128975 0 : traversal.visit(&(objectArray[i][j]));
128976 0 : done = true;
128977 : }
128978 0 : j++;
128979 : }
128980 0 : i++;
128981 : }
128982 :
128983 : #if 0
128984 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
128985 : if (done == false)
128986 : {
128987 : printf ("No representative for SgStringVal found in memory pools \n");
128988 : }
128989 : #endif
128990 : }
128991 0 : }
128992 :
128993 :
128994 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
128995 : // using values that overflow signed values of int.
128996 : size_t
128997 4 : SgStringVal::numberOfNodes()
128998 : {
128999 : // This function traverses the memory pool for an IR node and
129000 : // counts the number of IR nodes of a particular Sage III IR
129001 : // nodes type.
129002 :
129003 4 : size_t count = 0;
129004 4 : if (SgStringVal::pools.empty() == false)
129005 : {
129006 : // Generate an array of memory pools (this is actually a STL vector,
129007 : // but it is contiguious, so OK to treat this way).
129008 2 : SgStringVal** objectArray = (SgStringVal**) &(SgStringVal::pools[0]);
129009 :
129010 : // Build a local variable for better performance (make it a loop invariant variable).
129011 2 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
129012 :
129013 : // Iterate over all of the memory pools for this IR node.
129014 4 : for (unsigned int i=0; i < SgStringVal::pools.size(); i++)
129015 : {
129016 : // objectArray[i] is a single memory pool, iterate over all the
129017 : // IR nodes and only count those that are valid IR nodes used in
129018 : // the AST (i.e. allocated IR nodes).
129019 4002 : for (unsigned j=0; j < SgStringVal::pool_size; j++)
129020 : {
129021 : // This is indexing the STL vector of C/C++ style arrays as a doubly
129022 : // indexed array access. It is OK since we have leveraged the semantics
129023 : // of STL vector memory as contigous and cast the memory as an array
129024 : // of arrays to use the 2D array indexing. Hope this is not confusing,
129025 : // but it s very fast as an implementation.
129026 4000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
129027 : {
129028 82 : count++;
129029 : }
129030 : }
129031 : }
129032 : }
129033 :
129034 :
129035 :
129036 4 : return count;
129037 : }
129038 :
129039 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
129040 : // using values that overflow signed values of int.
129041 : size_t
129042 0 : SgStringVal::memoryUsage()
129043 : {
129044 : // This function is required because we need the class name as a type when we call sizeof
129045 : // There might be another way to implement this if we have a traversal that only called a
129046 : // representative object (one call for each type of Sage IIIIR node).
129047 0 : size_t memory = numberOfNodes() * sizeof(SgStringVal);
129048 :
129049 0 : return memory;
129050 : }
129051 :
129052 : /* #line 129053 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
129053 :
129054 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
129055 : void
129056 5342 : SgShortVal::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
129057 : {
129058 : // This function traverses the memory pool for only a specific IR node
129059 : // and calls the visit function of the input class execute a traversal
129060 : // similar to the style of the attribute based traversals within ROSE.
129061 : // This traversal will visit ALL nodes of the AST where as the other
129062 : // attribute based traversals visit only the embedded tree within the AST.
129063 :
129064 : // Initialize array to the address of the first element of the STL vector
129065 : // (which is guaranteed to be contiguous storage).
129066 : // SgShortVal objectArray [] = *(Memory_Block_List.begin());
129067 5342 : if (SgShortVal::pools.empty() == false)
129068 : {
129069 : // Generate an array of memory pools
129070 115 : SgShortVal** objectArray = (SgShortVal**) &(SgShortVal::pools[0]);
129071 :
129072 : // Build a local variable for better performance
129073 115 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
129074 : #if 0
129075 : // Iterate over the memory pools
129076 : for (unsigned int i=0; i < SgShortVal::pools.size(); i++)
129077 : {
129078 : // objectArray[i] is a single memory pool
129079 : for (int j=0; j < SgShortVal::pool_size; j++)
129080 : {
129081 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
129082 : {
129083 : traversal.visit(&(objectArray[i][j]));
129084 : }
129085 : }
129086 : }
129087 : #else
129088 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
129089 : // compute the list first and then call the visit function on each list element.
129090 :
129091 : // printf ("Inside of SgShortVal::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
129092 :
129093 230 : std::vector<SgShortVal*> nodeList;
129094 :
129095 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
129096 230 : for (unsigned int i=0; i < SgShortVal::pools.size(); i++)
129097 : {
129098 : // objectArray[i] is a single memory pool
129099 230115 : for (unsigned j=0; j < SgShortVal::pool_size; j++)
129100 : {
129101 230000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
129102 : {
129103 278 : nodeList.push_back(&(objectArray[i][j]));
129104 : }
129105 : }
129106 : }
129107 :
129108 : // Iterate over the saved list
129109 115 : size_t nodeListSize = nodeList.size();
129110 393 : for (size_t i=0; i < nodeListSize; i++)
129111 : {
129112 278 : ROSE_ASSERT(nodeList[i] != NULL);
129113 : #if 0
129114 : traversal.visit(nodeList[i]);
129115 : #else
129116 278 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
129117 : {
129118 278 : traversal.visit(nodeList[i]);
129119 : }
129120 : #endif
129121 : }
129122 : #endif
129123 : }
129124 :
129125 : // This should not be required since all previously static data members are
129126 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
129127 :
129128 5342 : }
129129 :
129130 :
129131 : void
129132 194 : SgShortVal::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
129133 : {
129134 : // This function traverses the memory pool for an IR node and
129135 : // calls the function to execute the visitor object.
129136 :
129137 : // Initialize array to the address of the first element of the STL vector
129138 : // (which is guarenteed to be contiguous storage).
129139 : // SgShortVal objectArray [] = *(Memory_Block_List.begin());
129140 194 : if (SgShortVal::pools.empty() == false)
129141 : {
129142 : // Generate an array of memory pools
129143 137 : SgShortVal** objectArray = (SgShortVal**) &(SgShortVal::pools[0]);
129144 :
129145 : // Build a local variable for better performance
129146 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
129147 :
129148 : // Iterate over the memory pools
129149 274 : for (unsigned int i=0; i < SgShortVal::pools.size(); i++)
129150 : {
129151 : // objectArray[i] is a single memory pool
129152 274137 : for (unsigned j=0; j < SgShortVal::pool_size; j++)
129153 : {
129154 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
129155 : {
129156 : // printf ("Found a valid SgShortVal object in the memory pool %d at position %d \n",i,j);
129157 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
129158 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
129159 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
129160 : }
129161 : else
129162 : {
129163 : // printf ("Found a INVALID SgShortVal object in the memory pool \n");
129164 : }
129165 : }
129166 : }
129167 : }
129168 :
129169 : // This should not be required since all previously static data members are
129170 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
129171 :
129172 194 : }
129173 :
129174 : void
129175 0 : SgShortVal::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
129176 : {
129177 : // This function visits only a single IR node of the memory pool.
129178 : // it is typically called once for each type of IR node within
129179 : // the automatically generated function: traverseRepresentativeNodes().
129180 :
129181 : // Initialize array to the address of the first element of the STL vector
129182 : // (which is guarenteed to be contiguous storage).
129183 : // SgShortVal objectArray [] = *(Memory_Block_List.begin());
129184 0 : if (SgShortVal::pools.empty() == false)
129185 : {
129186 : // Generate an array of memory pools
129187 0 : SgShortVal** objectArray = (SgShortVal**) &(SgShortVal::pools[0]);
129188 :
129189 : // Build a local variable for better performance
129190 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
129191 :
129192 : // Iterate over the memory pools
129193 0 : bool done = false;
129194 0 : unsigned i=0;
129195 :
129196 : // find the first valid IR node, call visit function, and then leave
129197 0 : while ( done == false && i < SgShortVal::pools.size() )
129198 : {
129199 : // objectArray[i] is a single memory pool
129200 : unsigned j=0;
129201 0 : while (done == false && j < SgShortVal::pool_size)
129202 : {
129203 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
129204 : {
129205 0 : traversal.visit(&(objectArray[i][j]));
129206 0 : done = true;
129207 : }
129208 0 : j++;
129209 : }
129210 0 : i++;
129211 : }
129212 :
129213 : #if 0
129214 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
129215 : if (done == false)
129216 : {
129217 : printf ("No representative for SgShortVal found in memory pools \n");
129218 : }
129219 : #endif
129220 : }
129221 0 : }
129222 :
129223 :
129224 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
129225 : // using values that overflow signed values of int.
129226 : size_t
129227 4 : SgShortVal::numberOfNodes()
129228 : {
129229 : // This function traverses the memory pool for an IR node and
129230 : // counts the number of IR nodes of a particular Sage III IR
129231 : // nodes type.
129232 :
129233 4 : size_t count = 0;
129234 4 : if (SgShortVal::pools.empty() == false)
129235 : {
129236 : // Generate an array of memory pools (this is actually a STL vector,
129237 : // but it is contiguious, so OK to treat this way).
129238 0 : SgShortVal** objectArray = (SgShortVal**) &(SgShortVal::pools[0]);
129239 :
129240 : // Build a local variable for better performance (make it a loop invariant variable).
129241 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
129242 :
129243 : // Iterate over all of the memory pools for this IR node.
129244 0 : for (unsigned int i=0; i < SgShortVal::pools.size(); i++)
129245 : {
129246 : // objectArray[i] is a single memory pool, iterate over all the
129247 : // IR nodes and only count those that are valid IR nodes used in
129248 : // the AST (i.e. allocated IR nodes).
129249 0 : for (unsigned j=0; j < SgShortVal::pool_size; j++)
129250 : {
129251 : // This is indexing the STL vector of C/C++ style arrays as a doubly
129252 : // indexed array access. It is OK since we have leveraged the semantics
129253 : // of STL vector memory as contigous and cast the memory as an array
129254 : // of arrays to use the 2D array indexing. Hope this is not confusing,
129255 : // but it s very fast as an implementation.
129256 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
129257 : {
129258 0 : count++;
129259 : }
129260 : }
129261 : }
129262 : }
129263 :
129264 :
129265 :
129266 4 : return count;
129267 : }
129268 :
129269 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
129270 : // using values that overflow signed values of int.
129271 : size_t
129272 0 : SgShortVal::memoryUsage()
129273 : {
129274 : // This function is required because we need the class name as a type when we call sizeof
129275 : // There might be another way to implement this if we have a traversal that only called a
129276 : // representative object (one call for each type of Sage IIIIR node).
129277 0 : size_t memory = numberOfNodes() * sizeof(SgShortVal);
129278 :
129279 0 : return memory;
129280 : }
129281 :
129282 : /* #line 129283 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
129283 :
129284 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
129285 : void
129286 5342 : SgCharVal::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
129287 : {
129288 : // This function traverses the memory pool for only a specific IR node
129289 : // and calls the visit function of the input class execute a traversal
129290 : // similar to the style of the attribute based traversals within ROSE.
129291 : // This traversal will visit ALL nodes of the AST where as the other
129292 : // attribute based traversals visit only the embedded tree within the AST.
129293 :
129294 : // Initialize array to the address of the first element of the STL vector
129295 : // (which is guaranteed to be contiguous storage).
129296 : // SgCharVal objectArray [] = *(Memory_Block_List.begin());
129297 5342 : if (SgCharVal::pools.empty() == false)
129298 : {
129299 : // Generate an array of memory pools
129300 153 : SgCharVal** objectArray = (SgCharVal**) &(SgCharVal::pools[0]);
129301 :
129302 : // Build a local variable for better performance
129303 153 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
129304 : #if 0
129305 : // Iterate over the memory pools
129306 : for (unsigned int i=0; i < SgCharVal::pools.size(); i++)
129307 : {
129308 : // objectArray[i] is a single memory pool
129309 : for (int j=0; j < SgCharVal::pool_size; j++)
129310 : {
129311 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
129312 : {
129313 : traversal.visit(&(objectArray[i][j]));
129314 : }
129315 : }
129316 : }
129317 : #else
129318 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
129319 : // compute the list first and then call the visit function on each list element.
129320 :
129321 : // printf ("Inside of SgCharVal::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
129322 :
129323 306 : std::vector<SgCharVal*> nodeList;
129324 :
129325 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
129326 306 : for (unsigned int i=0; i < SgCharVal::pools.size(); i++)
129327 : {
129328 : // objectArray[i] is a single memory pool
129329 306153 : for (unsigned j=0; j < SgCharVal::pool_size; j++)
129330 : {
129331 306000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
129332 : {
129333 5685 : nodeList.push_back(&(objectArray[i][j]));
129334 : }
129335 : }
129336 : }
129337 :
129338 : // Iterate over the saved list
129339 153 : size_t nodeListSize = nodeList.size();
129340 5838 : for (size_t i=0; i < nodeListSize; i++)
129341 : {
129342 5685 : ROSE_ASSERT(nodeList[i] != NULL);
129343 : #if 0
129344 : traversal.visit(nodeList[i]);
129345 : #else
129346 5685 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
129347 : {
129348 5685 : traversal.visit(nodeList[i]);
129349 : }
129350 : #endif
129351 : }
129352 : #endif
129353 : }
129354 :
129355 : // This should not be required since all previously static data members are
129356 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
129357 :
129358 5342 : }
129359 :
129360 :
129361 : void
129362 194 : SgCharVal::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
129363 : {
129364 : // This function traverses the memory pool for an IR node and
129365 : // calls the function to execute the visitor object.
129366 :
129367 : // Initialize array to the address of the first element of the STL vector
129368 : // (which is guarenteed to be contiguous storage).
129369 : // SgCharVal objectArray [] = *(Memory_Block_List.begin());
129370 194 : if (SgCharVal::pools.empty() == false)
129371 : {
129372 : // Generate an array of memory pools
129373 137 : SgCharVal** objectArray = (SgCharVal**) &(SgCharVal::pools[0]);
129374 :
129375 : // Build a local variable for better performance
129376 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
129377 :
129378 : // Iterate over the memory pools
129379 274 : for (unsigned int i=0; i < SgCharVal::pools.size(); i++)
129380 : {
129381 : // objectArray[i] is a single memory pool
129382 274137 : for (unsigned j=0; j < SgCharVal::pool_size; j++)
129383 : {
129384 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
129385 : {
129386 : // printf ("Found a valid SgCharVal object in the memory pool %d at position %d \n",i,j);
129387 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
129388 6496 : objectArray[i][j].executeVisitorMemberFunction(visitor);
129389 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
129390 : }
129391 : else
129392 : {
129393 : // printf ("Found a INVALID SgCharVal object in the memory pool \n");
129394 : }
129395 : }
129396 : }
129397 : }
129398 :
129399 : // This should not be required since all previously static data members are
129400 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
129401 :
129402 194 : }
129403 :
129404 : void
129405 0 : SgCharVal::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
129406 : {
129407 : // This function visits only a single IR node of the memory pool.
129408 : // it is typically called once for each type of IR node within
129409 : // the automatically generated function: traverseRepresentativeNodes().
129410 :
129411 : // Initialize array to the address of the first element of the STL vector
129412 : // (which is guarenteed to be contiguous storage).
129413 : // SgCharVal objectArray [] = *(Memory_Block_List.begin());
129414 0 : if (SgCharVal::pools.empty() == false)
129415 : {
129416 : // Generate an array of memory pools
129417 0 : SgCharVal** objectArray = (SgCharVal**) &(SgCharVal::pools[0]);
129418 :
129419 : // Build a local variable for better performance
129420 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
129421 :
129422 : // Iterate over the memory pools
129423 0 : bool done = false;
129424 0 : unsigned i=0;
129425 :
129426 : // find the first valid IR node, call visit function, and then leave
129427 0 : while ( done == false && i < SgCharVal::pools.size() )
129428 : {
129429 : // objectArray[i] is a single memory pool
129430 : unsigned j=0;
129431 0 : while (done == false && j < SgCharVal::pool_size)
129432 : {
129433 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
129434 : {
129435 0 : traversal.visit(&(objectArray[i][j]));
129436 0 : done = true;
129437 : }
129438 0 : j++;
129439 : }
129440 0 : i++;
129441 : }
129442 :
129443 : #if 0
129444 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
129445 : if (done == false)
129446 : {
129447 : printf ("No representative for SgCharVal found in memory pools \n");
129448 : }
129449 : #endif
129450 : }
129451 0 : }
129452 :
129453 :
129454 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
129455 : // using values that overflow signed values of int.
129456 : size_t
129457 4 : SgCharVal::numberOfNodes()
129458 : {
129459 : // This function traverses the memory pool for an IR node and
129460 : // counts the number of IR nodes of a particular Sage III IR
129461 : // nodes type.
129462 :
129463 4 : size_t count = 0;
129464 4 : if (SgCharVal::pools.empty() == false)
129465 : {
129466 : // Generate an array of memory pools (this is actually a STL vector,
129467 : // but it is contiguious, so OK to treat this way).
129468 1 : SgCharVal** objectArray = (SgCharVal**) &(SgCharVal::pools[0]);
129469 :
129470 : // Build a local variable for better performance (make it a loop invariant variable).
129471 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
129472 :
129473 : // Iterate over all of the memory pools for this IR node.
129474 2 : for (unsigned int i=0; i < SgCharVal::pools.size(); i++)
129475 : {
129476 : // objectArray[i] is a single memory pool, iterate over all the
129477 : // IR nodes and only count those that are valid IR nodes used in
129478 : // the AST (i.e. allocated IR nodes).
129479 2001 : for (unsigned j=0; j < SgCharVal::pool_size; j++)
129480 : {
129481 : // This is indexing the STL vector of C/C++ style arrays as a doubly
129482 : // indexed array access. It is OK since we have leveraged the semantics
129483 : // of STL vector memory as contigous and cast the memory as an array
129484 : // of arrays to use the 2D array indexing. Hope this is not confusing,
129485 : // but it s very fast as an implementation.
129486 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
129487 : {
129488 47 : count++;
129489 : }
129490 : }
129491 : }
129492 : }
129493 :
129494 :
129495 :
129496 4 : return count;
129497 : }
129498 :
129499 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
129500 : // using values that overflow signed values of int.
129501 : size_t
129502 0 : SgCharVal::memoryUsage()
129503 : {
129504 : // This function is required because we need the class name as a type when we call sizeof
129505 : // There might be another way to implement this if we have a traversal that only called a
129506 : // representative object (one call for each type of Sage IIIIR node).
129507 0 : size_t memory = numberOfNodes() * sizeof(SgCharVal);
129508 :
129509 0 : return memory;
129510 : }
129511 :
129512 : /* #line 129513 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
129513 :
129514 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
129515 : void
129516 5342 : SgUnsignedCharVal::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
129517 : {
129518 : // This function traverses the memory pool for only a specific IR node
129519 : // and calls the visit function of the input class execute a traversal
129520 : // similar to the style of the attribute based traversals within ROSE.
129521 : // This traversal will visit ALL nodes of the AST where as the other
129522 : // attribute based traversals visit only the embedded tree within the AST.
129523 :
129524 : // Initialize array to the address of the first element of the STL vector
129525 : // (which is guaranteed to be contiguous storage).
129526 : // SgUnsignedCharVal objectArray [] = *(Memory_Block_List.begin());
129527 5342 : if (SgUnsignedCharVal::pools.empty() == false)
129528 : {
129529 : // Generate an array of memory pools
129530 7 : SgUnsignedCharVal** objectArray = (SgUnsignedCharVal**) &(SgUnsignedCharVal::pools[0]);
129531 :
129532 : // Build a local variable for better performance
129533 7 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
129534 : #if 0
129535 : // Iterate over the memory pools
129536 : for (unsigned int i=0; i < SgUnsignedCharVal::pools.size(); i++)
129537 : {
129538 : // objectArray[i] is a single memory pool
129539 : for (int j=0; j < SgUnsignedCharVal::pool_size; j++)
129540 : {
129541 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
129542 : {
129543 : traversal.visit(&(objectArray[i][j]));
129544 : }
129545 : }
129546 : }
129547 : #else
129548 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
129549 : // compute the list first and then call the visit function on each list element.
129550 :
129551 : // printf ("Inside of SgUnsignedCharVal::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
129552 :
129553 14 : std::vector<SgUnsignedCharVal*> nodeList;
129554 :
129555 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
129556 14 : for (unsigned int i=0; i < SgUnsignedCharVal::pools.size(); i++)
129557 : {
129558 : // objectArray[i] is a single memory pool
129559 14007 : for (unsigned j=0; j < SgUnsignedCharVal::pool_size; j++)
129560 : {
129561 14000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
129562 : {
129563 14 : nodeList.push_back(&(objectArray[i][j]));
129564 : }
129565 : }
129566 : }
129567 :
129568 : // Iterate over the saved list
129569 7 : size_t nodeListSize = nodeList.size();
129570 21 : for (size_t i=0; i < nodeListSize; i++)
129571 : {
129572 14 : ROSE_ASSERT(nodeList[i] != NULL);
129573 : #if 0
129574 : traversal.visit(nodeList[i]);
129575 : #else
129576 14 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
129577 : {
129578 14 : traversal.visit(nodeList[i]);
129579 : }
129580 : #endif
129581 : }
129582 : #endif
129583 : }
129584 :
129585 : // This should not be required since all previously static data members are
129586 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
129587 :
129588 5342 : }
129589 :
129590 :
129591 : void
129592 194 : SgUnsignedCharVal::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
129593 : {
129594 : // This function traverses the memory pool for an IR node and
129595 : // calls the function to execute the visitor object.
129596 :
129597 : // Initialize array to the address of the first element of the STL vector
129598 : // (which is guarenteed to be contiguous storage).
129599 : // SgUnsignedCharVal objectArray [] = *(Memory_Block_List.begin());
129600 194 : if (SgUnsignedCharVal::pools.empty() == false)
129601 : {
129602 : // Generate an array of memory pools
129603 0 : SgUnsignedCharVal** objectArray = (SgUnsignedCharVal**) &(SgUnsignedCharVal::pools[0]);
129604 :
129605 : // Build a local variable for better performance
129606 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
129607 :
129608 : // Iterate over the memory pools
129609 0 : for (unsigned int i=0; i < SgUnsignedCharVal::pools.size(); i++)
129610 : {
129611 : // objectArray[i] is a single memory pool
129612 0 : for (unsigned j=0; j < SgUnsignedCharVal::pool_size; j++)
129613 : {
129614 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
129615 : {
129616 : // printf ("Found a valid SgUnsignedCharVal object in the memory pool %d at position %d \n",i,j);
129617 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
129618 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
129619 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
129620 : }
129621 : else
129622 : {
129623 : // printf ("Found a INVALID SgUnsignedCharVal object in the memory pool \n");
129624 : }
129625 : }
129626 : }
129627 : }
129628 :
129629 : // This should not be required since all previously static data members are
129630 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
129631 :
129632 194 : }
129633 :
129634 : void
129635 0 : SgUnsignedCharVal::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
129636 : {
129637 : // This function visits only a single IR node of the memory pool.
129638 : // it is typically called once for each type of IR node within
129639 : // the automatically generated function: traverseRepresentativeNodes().
129640 :
129641 : // Initialize array to the address of the first element of the STL vector
129642 : // (which is guarenteed to be contiguous storage).
129643 : // SgUnsignedCharVal objectArray [] = *(Memory_Block_List.begin());
129644 0 : if (SgUnsignedCharVal::pools.empty() == false)
129645 : {
129646 : // Generate an array of memory pools
129647 0 : SgUnsignedCharVal** objectArray = (SgUnsignedCharVal**) &(SgUnsignedCharVal::pools[0]);
129648 :
129649 : // Build a local variable for better performance
129650 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
129651 :
129652 : // Iterate over the memory pools
129653 0 : bool done = false;
129654 0 : unsigned i=0;
129655 :
129656 : // find the first valid IR node, call visit function, and then leave
129657 0 : while ( done == false && i < SgUnsignedCharVal::pools.size() )
129658 : {
129659 : // objectArray[i] is a single memory pool
129660 : unsigned j=0;
129661 0 : while (done == false && j < SgUnsignedCharVal::pool_size)
129662 : {
129663 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
129664 : {
129665 0 : traversal.visit(&(objectArray[i][j]));
129666 0 : done = true;
129667 : }
129668 0 : j++;
129669 : }
129670 0 : i++;
129671 : }
129672 :
129673 : #if 0
129674 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
129675 : if (done == false)
129676 : {
129677 : printf ("No representative for SgUnsignedCharVal found in memory pools \n");
129678 : }
129679 : #endif
129680 : }
129681 0 : }
129682 :
129683 :
129684 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
129685 : // using values that overflow signed values of int.
129686 : size_t
129687 4 : SgUnsignedCharVal::numberOfNodes()
129688 : {
129689 : // This function traverses the memory pool for an IR node and
129690 : // counts the number of IR nodes of a particular Sage III IR
129691 : // nodes type.
129692 :
129693 4 : size_t count = 0;
129694 4 : if (SgUnsignedCharVal::pools.empty() == false)
129695 : {
129696 : // Generate an array of memory pools (this is actually a STL vector,
129697 : // but it is contiguious, so OK to treat this way).
129698 0 : SgUnsignedCharVal** objectArray = (SgUnsignedCharVal**) &(SgUnsignedCharVal::pools[0]);
129699 :
129700 : // Build a local variable for better performance (make it a loop invariant variable).
129701 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
129702 :
129703 : // Iterate over all of the memory pools for this IR node.
129704 0 : for (unsigned int i=0; i < SgUnsignedCharVal::pools.size(); i++)
129705 : {
129706 : // objectArray[i] is a single memory pool, iterate over all the
129707 : // IR nodes and only count those that are valid IR nodes used in
129708 : // the AST (i.e. allocated IR nodes).
129709 0 : for (unsigned j=0; j < SgUnsignedCharVal::pool_size; j++)
129710 : {
129711 : // This is indexing the STL vector of C/C++ style arrays as a doubly
129712 : // indexed array access. It is OK since we have leveraged the semantics
129713 : // of STL vector memory as contigous and cast the memory as an array
129714 : // of arrays to use the 2D array indexing. Hope this is not confusing,
129715 : // but it s very fast as an implementation.
129716 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
129717 : {
129718 0 : count++;
129719 : }
129720 : }
129721 : }
129722 : }
129723 :
129724 :
129725 :
129726 4 : return count;
129727 : }
129728 :
129729 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
129730 : // using values that overflow signed values of int.
129731 : size_t
129732 0 : SgUnsignedCharVal::memoryUsage()
129733 : {
129734 : // This function is required because we need the class name as a type when we call sizeof
129735 : // There might be another way to implement this if we have a traversal that only called a
129736 : // representative object (one call for each type of Sage IIIIR node).
129737 0 : size_t memory = numberOfNodes() * sizeof(SgUnsignedCharVal);
129738 :
129739 0 : return memory;
129740 : }
129741 :
129742 : /* #line 129743 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
129743 :
129744 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
129745 : void
129746 5342 : SgWcharVal::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
129747 : {
129748 : // This function traverses the memory pool for only a specific IR node
129749 : // and calls the visit function of the input class execute a traversal
129750 : // similar to the style of the attribute based traversals within ROSE.
129751 : // This traversal will visit ALL nodes of the AST where as the other
129752 : // attribute based traversals visit only the embedded tree within the AST.
129753 :
129754 : // Initialize array to the address of the first element of the STL vector
129755 : // (which is guaranteed to be contiguous storage).
129756 : // SgWcharVal objectArray [] = *(Memory_Block_List.begin());
129757 5342 : if (SgWcharVal::pools.empty() == false)
129758 : {
129759 : // Generate an array of memory pools
129760 115 : SgWcharVal** objectArray = (SgWcharVal**) &(SgWcharVal::pools[0]);
129761 :
129762 : // Build a local variable for better performance
129763 115 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
129764 : #if 0
129765 : // Iterate over the memory pools
129766 : for (unsigned int i=0; i < SgWcharVal::pools.size(); i++)
129767 : {
129768 : // objectArray[i] is a single memory pool
129769 : for (int j=0; j < SgWcharVal::pool_size; j++)
129770 : {
129771 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
129772 : {
129773 : traversal.visit(&(objectArray[i][j]));
129774 : }
129775 : }
129776 : }
129777 : #else
129778 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
129779 : // compute the list first and then call the visit function on each list element.
129780 :
129781 : // printf ("Inside of SgWcharVal::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
129782 :
129783 230 : std::vector<SgWcharVal*> nodeList;
129784 :
129785 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
129786 230 : for (unsigned int i=0; i < SgWcharVal::pools.size(); i++)
129787 : {
129788 : // objectArray[i] is a single memory pool
129789 230115 : for (unsigned j=0; j < SgWcharVal::pool_size; j++)
129790 : {
129791 230000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
129792 : {
129793 71 : nodeList.push_back(&(objectArray[i][j]));
129794 : }
129795 : }
129796 : }
129797 :
129798 : // Iterate over the saved list
129799 115 : size_t nodeListSize = nodeList.size();
129800 186 : for (size_t i=0; i < nodeListSize; i++)
129801 : {
129802 71 : ROSE_ASSERT(nodeList[i] != NULL);
129803 : #if 0
129804 : traversal.visit(nodeList[i]);
129805 : #else
129806 71 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
129807 : {
129808 71 : traversal.visit(nodeList[i]);
129809 : }
129810 : #endif
129811 : }
129812 : #endif
129813 : }
129814 :
129815 : // This should not be required since all previously static data members are
129816 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
129817 :
129818 5342 : }
129819 :
129820 :
129821 : void
129822 194 : SgWcharVal::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
129823 : {
129824 : // This function traverses the memory pool for an IR node and
129825 : // calls the function to execute the visitor object.
129826 :
129827 : // Initialize array to the address of the first element of the STL vector
129828 : // (which is guarenteed to be contiguous storage).
129829 : // SgWcharVal objectArray [] = *(Memory_Block_List.begin());
129830 194 : if (SgWcharVal::pools.empty() == false)
129831 : {
129832 : // Generate an array of memory pools
129833 137 : SgWcharVal** objectArray = (SgWcharVal**) &(SgWcharVal::pools[0]);
129834 :
129835 : // Build a local variable for better performance
129836 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
129837 :
129838 : // Iterate over the memory pools
129839 274 : for (unsigned int i=0; i < SgWcharVal::pools.size(); i++)
129840 : {
129841 : // objectArray[i] is a single memory pool
129842 274137 : for (unsigned j=0; j < SgWcharVal::pool_size; j++)
129843 : {
129844 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
129845 : {
129846 : // printf ("Found a valid SgWcharVal object in the memory pool %d at position %d \n",i,j);
129847 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
129848 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
129849 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
129850 : }
129851 : else
129852 : {
129853 : // printf ("Found a INVALID SgWcharVal object in the memory pool \n");
129854 : }
129855 : }
129856 : }
129857 : }
129858 :
129859 : // This should not be required since all previously static data members are
129860 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
129861 :
129862 194 : }
129863 :
129864 : void
129865 0 : SgWcharVal::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
129866 : {
129867 : // This function visits only a single IR node of the memory pool.
129868 : // it is typically called once for each type of IR node within
129869 : // the automatically generated function: traverseRepresentativeNodes().
129870 :
129871 : // Initialize array to the address of the first element of the STL vector
129872 : // (which is guarenteed to be contiguous storage).
129873 : // SgWcharVal objectArray [] = *(Memory_Block_List.begin());
129874 0 : if (SgWcharVal::pools.empty() == false)
129875 : {
129876 : // Generate an array of memory pools
129877 0 : SgWcharVal** objectArray = (SgWcharVal**) &(SgWcharVal::pools[0]);
129878 :
129879 : // Build a local variable for better performance
129880 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
129881 :
129882 : // Iterate over the memory pools
129883 0 : bool done = false;
129884 0 : unsigned i=0;
129885 :
129886 : // find the first valid IR node, call visit function, and then leave
129887 0 : while ( done == false && i < SgWcharVal::pools.size() )
129888 : {
129889 : // objectArray[i] is a single memory pool
129890 : unsigned j=0;
129891 0 : while (done == false && j < SgWcharVal::pool_size)
129892 : {
129893 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
129894 : {
129895 0 : traversal.visit(&(objectArray[i][j]));
129896 0 : done = true;
129897 : }
129898 0 : j++;
129899 : }
129900 0 : i++;
129901 : }
129902 :
129903 : #if 0
129904 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
129905 : if (done == false)
129906 : {
129907 : printf ("No representative for SgWcharVal found in memory pools \n");
129908 : }
129909 : #endif
129910 : }
129911 0 : }
129912 :
129913 :
129914 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
129915 : // using values that overflow signed values of int.
129916 : size_t
129917 4 : SgWcharVal::numberOfNodes()
129918 : {
129919 : // This function traverses the memory pool for an IR node and
129920 : // counts the number of IR nodes of a particular Sage III IR
129921 : // nodes type.
129922 :
129923 4 : size_t count = 0;
129924 4 : if (SgWcharVal::pools.empty() == false)
129925 : {
129926 : // Generate an array of memory pools (this is actually a STL vector,
129927 : // but it is contiguious, so OK to treat this way).
129928 0 : SgWcharVal** objectArray = (SgWcharVal**) &(SgWcharVal::pools[0]);
129929 :
129930 : // Build a local variable for better performance (make it a loop invariant variable).
129931 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
129932 :
129933 : // Iterate over all of the memory pools for this IR node.
129934 0 : for (unsigned int i=0; i < SgWcharVal::pools.size(); i++)
129935 : {
129936 : // objectArray[i] is a single memory pool, iterate over all the
129937 : // IR nodes and only count those that are valid IR nodes used in
129938 : // the AST (i.e. allocated IR nodes).
129939 0 : for (unsigned j=0; j < SgWcharVal::pool_size; j++)
129940 : {
129941 : // This is indexing the STL vector of C/C++ style arrays as a doubly
129942 : // indexed array access. It is OK since we have leveraged the semantics
129943 : // of STL vector memory as contigous and cast the memory as an array
129944 : // of arrays to use the 2D array indexing. Hope this is not confusing,
129945 : // but it s very fast as an implementation.
129946 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
129947 : {
129948 0 : count++;
129949 : }
129950 : }
129951 : }
129952 : }
129953 :
129954 :
129955 :
129956 4 : return count;
129957 : }
129958 :
129959 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
129960 : // using values that overflow signed values of int.
129961 : size_t
129962 0 : SgWcharVal::memoryUsage()
129963 : {
129964 : // This function is required because we need the class name as a type when we call sizeof
129965 : // There might be another way to implement this if we have a traversal that only called a
129966 : // representative object (one call for each type of Sage IIIIR node).
129967 0 : size_t memory = numberOfNodes() * sizeof(SgWcharVal);
129968 :
129969 0 : return memory;
129970 : }
129971 :
129972 : /* #line 129973 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
129973 :
129974 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
129975 : void
129976 5342 : SgUnsignedShortVal::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
129977 : {
129978 : // This function traverses the memory pool for only a specific IR node
129979 : // and calls the visit function of the input class execute a traversal
129980 : // similar to the style of the attribute based traversals within ROSE.
129981 : // This traversal will visit ALL nodes of the AST where as the other
129982 : // attribute based traversals visit only the embedded tree within the AST.
129983 :
129984 : // Initialize array to the address of the first element of the STL vector
129985 : // (which is guaranteed to be contiguous storage).
129986 : // SgUnsignedShortVal objectArray [] = *(Memory_Block_List.begin());
129987 5342 : if (SgUnsignedShortVal::pools.empty() == false)
129988 : {
129989 : // Generate an array of memory pools
129990 115 : SgUnsignedShortVal** objectArray = (SgUnsignedShortVal**) &(SgUnsignedShortVal::pools[0]);
129991 :
129992 : // Build a local variable for better performance
129993 115 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
129994 : #if 0
129995 : // Iterate over the memory pools
129996 : for (unsigned int i=0; i < SgUnsignedShortVal::pools.size(); i++)
129997 : {
129998 : // objectArray[i] is a single memory pool
129999 : for (int j=0; j < SgUnsignedShortVal::pool_size; j++)
130000 : {
130001 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
130002 : {
130003 : traversal.visit(&(objectArray[i][j]));
130004 : }
130005 : }
130006 : }
130007 : #else
130008 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
130009 : // compute the list first and then call the visit function on each list element.
130010 :
130011 : // printf ("Inside of SgUnsignedShortVal::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
130012 :
130013 230 : std::vector<SgUnsignedShortVal*> nodeList;
130014 :
130015 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
130016 230 : for (unsigned int i=0; i < SgUnsignedShortVal::pools.size(); i++)
130017 : {
130018 : // objectArray[i] is a single memory pool
130019 230115 : for (unsigned j=0; j < SgUnsignedShortVal::pool_size; j++)
130020 : {
130021 230000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
130022 : {
130023 1750 : nodeList.push_back(&(objectArray[i][j]));
130024 : }
130025 : }
130026 : }
130027 :
130028 : // Iterate over the saved list
130029 115 : size_t nodeListSize = nodeList.size();
130030 1865 : for (size_t i=0; i < nodeListSize; i++)
130031 : {
130032 1750 : ROSE_ASSERT(nodeList[i] != NULL);
130033 : #if 0
130034 : traversal.visit(nodeList[i]);
130035 : #else
130036 1750 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
130037 : {
130038 1750 : traversal.visit(nodeList[i]);
130039 : }
130040 : #endif
130041 : }
130042 : #endif
130043 : }
130044 :
130045 : // This should not be required since all previously static data members are
130046 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
130047 :
130048 5342 : }
130049 :
130050 :
130051 : void
130052 194 : SgUnsignedShortVal::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
130053 : {
130054 : // This function traverses the memory pool for an IR node and
130055 : // calls the function to execute the visitor object.
130056 :
130057 : // Initialize array to the address of the first element of the STL vector
130058 : // (which is guarenteed to be contiguous storage).
130059 : // SgUnsignedShortVal objectArray [] = *(Memory_Block_List.begin());
130060 194 : if (SgUnsignedShortVal::pools.empty() == false)
130061 : {
130062 : // Generate an array of memory pools
130063 137 : SgUnsignedShortVal** objectArray = (SgUnsignedShortVal**) &(SgUnsignedShortVal::pools[0]);
130064 :
130065 : // Build a local variable for better performance
130066 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
130067 :
130068 : // Iterate over the memory pools
130069 274 : for (unsigned int i=0; i < SgUnsignedShortVal::pools.size(); i++)
130070 : {
130071 : // objectArray[i] is a single memory pool
130072 274137 : for (unsigned j=0; j < SgUnsignedShortVal::pool_size; j++)
130073 : {
130074 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
130075 : {
130076 : // printf ("Found a valid SgUnsignedShortVal object in the memory pool %d at position %d \n",i,j);
130077 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
130078 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
130079 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
130080 : }
130081 : else
130082 : {
130083 : // printf ("Found a INVALID SgUnsignedShortVal object in the memory pool \n");
130084 : }
130085 : }
130086 : }
130087 : }
130088 :
130089 : // This should not be required since all previously static data members are
130090 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
130091 :
130092 194 : }
130093 :
130094 : void
130095 0 : SgUnsignedShortVal::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
130096 : {
130097 : // This function visits only a single IR node of the memory pool.
130098 : // it is typically called once for each type of IR node within
130099 : // the automatically generated function: traverseRepresentativeNodes().
130100 :
130101 : // Initialize array to the address of the first element of the STL vector
130102 : // (which is guarenteed to be contiguous storage).
130103 : // SgUnsignedShortVal objectArray [] = *(Memory_Block_List.begin());
130104 0 : if (SgUnsignedShortVal::pools.empty() == false)
130105 : {
130106 : // Generate an array of memory pools
130107 0 : SgUnsignedShortVal** objectArray = (SgUnsignedShortVal**) &(SgUnsignedShortVal::pools[0]);
130108 :
130109 : // Build a local variable for better performance
130110 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
130111 :
130112 : // Iterate over the memory pools
130113 0 : bool done = false;
130114 0 : unsigned i=0;
130115 :
130116 : // find the first valid IR node, call visit function, and then leave
130117 0 : while ( done == false && i < SgUnsignedShortVal::pools.size() )
130118 : {
130119 : // objectArray[i] is a single memory pool
130120 : unsigned j=0;
130121 0 : while (done == false && j < SgUnsignedShortVal::pool_size)
130122 : {
130123 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
130124 : {
130125 0 : traversal.visit(&(objectArray[i][j]));
130126 0 : done = true;
130127 : }
130128 0 : j++;
130129 : }
130130 0 : i++;
130131 : }
130132 :
130133 : #if 0
130134 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
130135 : if (done == false)
130136 : {
130137 : printf ("No representative for SgUnsignedShortVal found in memory pools \n");
130138 : }
130139 : #endif
130140 : }
130141 0 : }
130142 :
130143 :
130144 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
130145 : // using values that overflow signed values of int.
130146 : size_t
130147 4 : SgUnsignedShortVal::numberOfNodes()
130148 : {
130149 : // This function traverses the memory pool for an IR node and
130150 : // counts the number of IR nodes of a particular Sage III IR
130151 : // nodes type.
130152 :
130153 4 : size_t count = 0;
130154 4 : if (SgUnsignedShortVal::pools.empty() == false)
130155 : {
130156 : // Generate an array of memory pools (this is actually a STL vector,
130157 : // but it is contiguious, so OK to treat this way).
130158 0 : SgUnsignedShortVal** objectArray = (SgUnsignedShortVal**) &(SgUnsignedShortVal::pools[0]);
130159 :
130160 : // Build a local variable for better performance (make it a loop invariant variable).
130161 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
130162 :
130163 : // Iterate over all of the memory pools for this IR node.
130164 0 : for (unsigned int i=0; i < SgUnsignedShortVal::pools.size(); i++)
130165 : {
130166 : // objectArray[i] is a single memory pool, iterate over all the
130167 : // IR nodes and only count those that are valid IR nodes used in
130168 : // the AST (i.e. allocated IR nodes).
130169 0 : for (unsigned j=0; j < SgUnsignedShortVal::pool_size; j++)
130170 : {
130171 : // This is indexing the STL vector of C/C++ style arrays as a doubly
130172 : // indexed array access. It is OK since we have leveraged the semantics
130173 : // of STL vector memory as contigous and cast the memory as an array
130174 : // of arrays to use the 2D array indexing. Hope this is not confusing,
130175 : // but it s very fast as an implementation.
130176 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
130177 : {
130178 0 : count++;
130179 : }
130180 : }
130181 : }
130182 : }
130183 :
130184 :
130185 :
130186 4 : return count;
130187 : }
130188 :
130189 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
130190 : // using values that overflow signed values of int.
130191 : size_t
130192 0 : SgUnsignedShortVal::memoryUsage()
130193 : {
130194 : // This function is required because we need the class name as a type when we call sizeof
130195 : // There might be another way to implement this if we have a traversal that only called a
130196 : // representative object (one call for each type of Sage IIIIR node).
130197 0 : size_t memory = numberOfNodes() * sizeof(SgUnsignedShortVal);
130198 :
130199 0 : return memory;
130200 : }
130201 :
130202 : /* #line 130203 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
130203 :
130204 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
130205 : void
130206 5342 : SgIntVal::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
130207 : {
130208 : // This function traverses the memory pool for only a specific IR node
130209 : // and calls the visit function of the input class execute a traversal
130210 : // similar to the style of the attribute based traversals within ROSE.
130211 : // This traversal will visit ALL nodes of the AST where as the other
130212 : // attribute based traversals visit only the embedded tree within the AST.
130213 :
130214 : // Initialize array to the address of the first element of the STL vector
130215 : // (which is guaranteed to be contiguous storage).
130216 : // SgIntVal objectArray [] = *(Memory_Block_List.begin());
130217 5342 : if (SgIntVal::pools.empty() == false)
130218 : {
130219 : // Generate an array of memory pools
130220 4528 : SgIntVal** objectArray = (SgIntVal**) &(SgIntVal::pools[0]);
130221 :
130222 : // Build a local variable for better performance
130223 4528 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
130224 : #if 0
130225 : // Iterate over the memory pools
130226 : for (unsigned int i=0; i < SgIntVal::pools.size(); i++)
130227 : {
130228 : // objectArray[i] is a single memory pool
130229 : for (int j=0; j < SgIntVal::pool_size; j++)
130230 : {
130231 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
130232 : {
130233 : traversal.visit(&(objectArray[i][j]));
130234 : }
130235 : }
130236 : }
130237 : #else
130238 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
130239 : // compute the list first and then call the visit function on each list element.
130240 :
130241 : // printf ("Inside of SgIntVal::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
130242 :
130243 9056 : std::vector<SgIntVal*> nodeList;
130244 :
130245 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
130246 9164 : for (unsigned int i=0; i < SgIntVal::pools.size(); i++)
130247 : {
130248 : // objectArray[i] is a single memory pool
130249 9276640 : for (unsigned j=0; j < SgIntVal::pool_size; j++)
130250 : {
130251 9272000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
130252 : {
130253 333798 : nodeList.push_back(&(objectArray[i][j]));
130254 : }
130255 : }
130256 : }
130257 :
130258 : // Iterate over the saved list
130259 4528 : size_t nodeListSize = nodeList.size();
130260 338326 : for (size_t i=0; i < nodeListSize; i++)
130261 : {
130262 333798 : ROSE_ASSERT(nodeList[i] != NULL);
130263 : #if 0
130264 : traversal.visit(nodeList[i]);
130265 : #else
130266 333798 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
130267 : {
130268 333798 : traversal.visit(nodeList[i]);
130269 : }
130270 : #endif
130271 : }
130272 : #endif
130273 : }
130274 :
130275 : // This should not be required since all previously static data members are
130276 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
130277 :
130278 5342 : }
130279 :
130280 :
130281 : void
130282 194 : SgIntVal::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
130283 : {
130284 : // This function traverses the memory pool for an IR node and
130285 : // calls the function to execute the visitor object.
130286 :
130287 : // Initialize array to the address of the first element of the STL vector
130288 : // (which is guarenteed to be contiguous storage).
130289 : // SgIntVal objectArray [] = *(Memory_Block_List.begin());
130290 194 : if (SgIntVal::pools.empty() == false)
130291 : {
130292 : // Generate an array of memory pools
130293 192 : SgIntVal** objectArray = (SgIntVal**) &(SgIntVal::pools[0]);
130294 :
130295 : // Build a local variable for better performance
130296 192 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
130297 :
130298 : // Iterate over the memory pools
130299 521 : for (unsigned int i=0; i < SgIntVal::pools.size(); i++)
130300 : {
130301 : // objectArray[i] is a single memory pool
130302 658329 : for (unsigned j=0; j < SgIntVal::pool_size; j++)
130303 : {
130304 658000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
130305 : {
130306 : // printf ("Found a valid SgIntVal object in the memory pool %d at position %d \n",i,j);
130307 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
130308 133448 : objectArray[i][j].executeVisitorMemberFunction(visitor);
130309 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
130310 : }
130311 : else
130312 : {
130313 : // printf ("Found a INVALID SgIntVal object in the memory pool \n");
130314 : }
130315 : }
130316 : }
130317 : }
130318 :
130319 : // This should not be required since all previously static data members are
130320 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
130321 :
130322 194 : }
130323 :
130324 : void
130325 0 : SgIntVal::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
130326 : {
130327 : // This function visits only a single IR node of the memory pool.
130328 : // it is typically called once for each type of IR node within
130329 : // the automatically generated function: traverseRepresentativeNodes().
130330 :
130331 : // Initialize array to the address of the first element of the STL vector
130332 : // (which is guarenteed to be contiguous storage).
130333 : // SgIntVal objectArray [] = *(Memory_Block_List.begin());
130334 0 : if (SgIntVal::pools.empty() == false)
130335 : {
130336 : // Generate an array of memory pools
130337 0 : SgIntVal** objectArray = (SgIntVal**) &(SgIntVal::pools[0]);
130338 :
130339 : // Build a local variable for better performance
130340 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
130341 :
130342 : // Iterate over the memory pools
130343 0 : bool done = false;
130344 0 : unsigned i=0;
130345 :
130346 : // find the first valid IR node, call visit function, and then leave
130347 0 : while ( done == false && i < SgIntVal::pools.size() )
130348 : {
130349 : // objectArray[i] is a single memory pool
130350 : unsigned j=0;
130351 0 : while (done == false && j < SgIntVal::pool_size)
130352 : {
130353 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
130354 : {
130355 0 : traversal.visit(&(objectArray[i][j]));
130356 0 : done = true;
130357 : }
130358 0 : j++;
130359 : }
130360 0 : i++;
130361 : }
130362 :
130363 : #if 0
130364 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
130365 : if (done == false)
130366 : {
130367 : printf ("No representative for SgIntVal found in memory pools \n");
130368 : }
130369 : #endif
130370 : }
130371 0 : }
130372 :
130373 :
130374 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
130375 : // using values that overflow signed values of int.
130376 : size_t
130377 4 : SgIntVal::numberOfNodes()
130378 : {
130379 : // This function traverses the memory pool for an IR node and
130380 : // counts the number of IR nodes of a particular Sage III IR
130381 : // nodes type.
130382 :
130383 4 : size_t count = 0;
130384 4 : if (SgIntVal::pools.empty() == false)
130385 : {
130386 : // Generate an array of memory pools (this is actually a STL vector,
130387 : // but it is contiguious, so OK to treat this way).
130388 2 : SgIntVal** objectArray = (SgIntVal**) &(SgIntVal::pools[0]);
130389 :
130390 : // Build a local variable for better performance (make it a loop invariant variable).
130391 2 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
130392 :
130393 : // Iterate over all of the memory pools for this IR node.
130394 4 : for (unsigned int i=0; i < SgIntVal::pools.size(); i++)
130395 : {
130396 : // objectArray[i] is a single memory pool, iterate over all the
130397 : // IR nodes and only count those that are valid IR nodes used in
130398 : // the AST (i.e. allocated IR nodes).
130399 4002 : for (unsigned j=0; j < SgIntVal::pool_size; j++)
130400 : {
130401 : // This is indexing the STL vector of C/C++ style arrays as a doubly
130402 : // indexed array access. It is OK since we have leveraged the semantics
130403 : // of STL vector memory as contigous and cast the memory as an array
130404 : // of arrays to use the 2D array indexing. Hope this is not confusing,
130405 : // but it s very fast as an implementation.
130406 4000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
130407 : {
130408 925 : count++;
130409 : }
130410 : }
130411 : }
130412 : }
130413 :
130414 :
130415 :
130416 4 : return count;
130417 : }
130418 :
130419 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
130420 : // using values that overflow signed values of int.
130421 : size_t
130422 0 : SgIntVal::memoryUsage()
130423 : {
130424 : // This function is required because we need the class name as a type when we call sizeof
130425 : // There might be another way to implement this if we have a traversal that only called a
130426 : // representative object (one call for each type of Sage IIIIR node).
130427 0 : size_t memory = numberOfNodes() * sizeof(SgIntVal);
130428 :
130429 0 : return memory;
130430 : }
130431 :
130432 : /* #line 130433 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
130433 :
130434 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
130435 : void
130436 5379 : SgEnumVal::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
130437 : {
130438 : // This function traverses the memory pool for only a specific IR node
130439 : // and calls the visit function of the input class execute a traversal
130440 : // similar to the style of the attribute based traversals within ROSE.
130441 : // This traversal will visit ALL nodes of the AST where as the other
130442 : // attribute based traversals visit only the embedded tree within the AST.
130443 :
130444 : // Initialize array to the address of the first element of the STL vector
130445 : // (which is guaranteed to be contiguous storage).
130446 : // SgEnumVal objectArray [] = *(Memory_Block_List.begin());
130447 5379 : if (SgEnumVal::pools.empty() == false)
130448 : {
130449 : // Generate an array of memory pools
130450 2726 : SgEnumVal** objectArray = (SgEnumVal**) &(SgEnumVal::pools[0]);
130451 :
130452 : // Build a local variable for better performance
130453 2726 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
130454 : #if 0
130455 : // Iterate over the memory pools
130456 : for (unsigned int i=0; i < SgEnumVal::pools.size(); i++)
130457 : {
130458 : // objectArray[i] is a single memory pool
130459 : for (int j=0; j < SgEnumVal::pool_size; j++)
130460 : {
130461 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
130462 : {
130463 : traversal.visit(&(objectArray[i][j]));
130464 : }
130465 : }
130466 : }
130467 : #else
130468 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
130469 : // compute the list first and then call the visit function on each list element.
130470 :
130471 : // printf ("Inside of SgEnumVal::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
130472 :
130473 5452 : std::vector<SgEnumVal*> nodeList;
130474 :
130475 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
130476 5452 : for (unsigned int i=0; i < SgEnumVal::pools.size(); i++)
130477 : {
130478 : // objectArray[i] is a single memory pool
130479 5454730 : for (unsigned j=0; j < SgEnumVal::pool_size; j++)
130480 : {
130481 5452000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
130482 : {
130483 158205 : nodeList.push_back(&(objectArray[i][j]));
130484 : }
130485 : }
130486 : }
130487 :
130488 : // Iterate over the saved list
130489 2726 : size_t nodeListSize = nodeList.size();
130490 160931 : for (size_t i=0; i < nodeListSize; i++)
130491 : {
130492 158205 : ROSE_ASSERT(nodeList[i] != NULL);
130493 : #if 0
130494 : traversal.visit(nodeList[i]);
130495 : #else
130496 158205 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
130497 : {
130498 158205 : traversal.visit(nodeList[i]);
130499 : }
130500 : #endif
130501 : }
130502 : #endif
130503 : }
130504 :
130505 : // This should not be required since all previously static data members are
130506 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
130507 :
130508 5379 : }
130509 :
130510 :
130511 : void
130512 194 : SgEnumVal::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
130513 : {
130514 : // This function traverses the memory pool for an IR node and
130515 : // calls the function to execute the visitor object.
130516 :
130517 : // Initialize array to the address of the first element of the STL vector
130518 : // (which is guarenteed to be contiguous storage).
130519 : // SgEnumVal objectArray [] = *(Memory_Block_List.begin());
130520 194 : if (SgEnumVal::pools.empty() == false)
130521 : {
130522 : // Generate an array of memory pools
130523 137 : SgEnumVal** objectArray = (SgEnumVal**) &(SgEnumVal::pools[0]);
130524 :
130525 : // Build a local variable for better performance
130526 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
130527 :
130528 : // Iterate over the memory pools
130529 274 : for (unsigned int i=0; i < SgEnumVal::pools.size(); i++)
130530 : {
130531 : // objectArray[i] is a single memory pool
130532 274137 : for (unsigned j=0; j < SgEnumVal::pool_size; j++)
130533 : {
130534 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
130535 : {
130536 : // printf ("Found a valid SgEnumVal object in the memory pool %d at position %d \n",i,j);
130537 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
130538 77066 : objectArray[i][j].executeVisitorMemberFunction(visitor);
130539 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
130540 : }
130541 : else
130542 : {
130543 : // printf ("Found a INVALID SgEnumVal object in the memory pool \n");
130544 : }
130545 : }
130546 : }
130547 : }
130548 :
130549 : // This should not be required since all previously static data members are
130550 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
130551 :
130552 194 : }
130553 :
130554 : void
130555 0 : SgEnumVal::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
130556 : {
130557 : // This function visits only a single IR node of the memory pool.
130558 : // it is typically called once for each type of IR node within
130559 : // the automatically generated function: traverseRepresentativeNodes().
130560 :
130561 : // Initialize array to the address of the first element of the STL vector
130562 : // (which is guarenteed to be contiguous storage).
130563 : // SgEnumVal objectArray [] = *(Memory_Block_List.begin());
130564 0 : if (SgEnumVal::pools.empty() == false)
130565 : {
130566 : // Generate an array of memory pools
130567 0 : SgEnumVal** objectArray = (SgEnumVal**) &(SgEnumVal::pools[0]);
130568 :
130569 : // Build a local variable for better performance
130570 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
130571 :
130572 : // Iterate over the memory pools
130573 0 : bool done = false;
130574 0 : unsigned i=0;
130575 :
130576 : // find the first valid IR node, call visit function, and then leave
130577 0 : while ( done == false && i < SgEnumVal::pools.size() )
130578 : {
130579 : // objectArray[i] is a single memory pool
130580 : unsigned j=0;
130581 0 : while (done == false && j < SgEnumVal::pool_size)
130582 : {
130583 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
130584 : {
130585 0 : traversal.visit(&(objectArray[i][j]));
130586 0 : done = true;
130587 : }
130588 0 : j++;
130589 : }
130590 0 : i++;
130591 : }
130592 :
130593 : #if 0
130594 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
130595 : if (done == false)
130596 : {
130597 : printf ("No representative for SgEnumVal found in memory pools \n");
130598 : }
130599 : #endif
130600 : }
130601 0 : }
130602 :
130603 :
130604 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
130605 : // using values that overflow signed values of int.
130606 : size_t
130607 4 : SgEnumVal::numberOfNodes()
130608 : {
130609 : // This function traverses the memory pool for an IR node and
130610 : // counts the number of IR nodes of a particular Sage III IR
130611 : // nodes type.
130612 :
130613 4 : size_t count = 0;
130614 4 : if (SgEnumVal::pools.empty() == false)
130615 : {
130616 : // Generate an array of memory pools (this is actually a STL vector,
130617 : // but it is contiguious, so OK to treat this way).
130618 1 : SgEnumVal** objectArray = (SgEnumVal**) &(SgEnumVal::pools[0]);
130619 :
130620 : // Build a local variable for better performance (make it a loop invariant variable).
130621 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
130622 :
130623 : // Iterate over all of the memory pools for this IR node.
130624 2 : for (unsigned int i=0; i < SgEnumVal::pools.size(); i++)
130625 : {
130626 : // objectArray[i] is a single memory pool, iterate over all the
130627 : // IR nodes and only count those that are valid IR nodes used in
130628 : // the AST (i.e. allocated IR nodes).
130629 2001 : for (unsigned j=0; j < SgEnumVal::pool_size; j++)
130630 : {
130631 : // This is indexing the STL vector of C/C++ style arrays as a doubly
130632 : // indexed array access. It is OK since we have leveraged the semantics
130633 : // of STL vector memory as contigous and cast the memory as an array
130634 : // of arrays to use the 2D array indexing. Hope this is not confusing,
130635 : // but it s very fast as an implementation.
130636 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
130637 : {
130638 550 : count++;
130639 : }
130640 : }
130641 : }
130642 : }
130643 :
130644 :
130645 :
130646 4 : return count;
130647 : }
130648 :
130649 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
130650 : // using values that overflow signed values of int.
130651 : size_t
130652 0 : SgEnumVal::memoryUsage()
130653 : {
130654 : // This function is required because we need the class name as a type when we call sizeof
130655 : // There might be another way to implement this if we have a traversal that only called a
130656 : // representative object (one call for each type of Sage IIIIR node).
130657 0 : size_t memory = numberOfNodes() * sizeof(SgEnumVal);
130658 :
130659 0 : return memory;
130660 : }
130661 :
130662 : /* #line 130663 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
130663 :
130664 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
130665 : void
130666 5342 : SgUnsignedIntVal::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
130667 : {
130668 : // This function traverses the memory pool for only a specific IR node
130669 : // and calls the visit function of the input class execute a traversal
130670 : // similar to the style of the attribute based traversals within ROSE.
130671 : // This traversal will visit ALL nodes of the AST where as the other
130672 : // attribute based traversals visit only the embedded tree within the AST.
130673 :
130674 : // Initialize array to the address of the first element of the STL vector
130675 : // (which is guaranteed to be contiguous storage).
130676 : // SgUnsignedIntVal objectArray [] = *(Memory_Block_List.begin());
130677 5342 : if (SgUnsignedIntVal::pools.empty() == false)
130678 : {
130679 : // Generate an array of memory pools
130680 625 : SgUnsignedIntVal** objectArray = (SgUnsignedIntVal**) &(SgUnsignedIntVal::pools[0]);
130681 :
130682 : // Build a local variable for better performance
130683 625 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
130684 : #if 0
130685 : // Iterate over the memory pools
130686 : for (unsigned int i=0; i < SgUnsignedIntVal::pools.size(); i++)
130687 : {
130688 : // objectArray[i] is a single memory pool
130689 : for (int j=0; j < SgUnsignedIntVal::pool_size; j++)
130690 : {
130691 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
130692 : {
130693 : traversal.visit(&(objectArray[i][j]));
130694 : }
130695 : }
130696 : }
130697 : #else
130698 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
130699 : // compute the list first and then call the visit function on each list element.
130700 :
130701 : // printf ("Inside of SgUnsignedIntVal::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
130702 :
130703 1250 : std::vector<SgUnsignedIntVal*> nodeList;
130704 :
130705 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
130706 1250 : for (unsigned int i=0; i < SgUnsignedIntVal::pools.size(); i++)
130707 : {
130708 : // objectArray[i] is a single memory pool
130709 1250620 : for (unsigned j=0; j < SgUnsignedIntVal::pool_size; j++)
130710 : {
130711 1250000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
130712 : {
130713 2463 : nodeList.push_back(&(objectArray[i][j]));
130714 : }
130715 : }
130716 : }
130717 :
130718 : // Iterate over the saved list
130719 625 : size_t nodeListSize = nodeList.size();
130720 3088 : for (size_t i=0; i < nodeListSize; i++)
130721 : {
130722 2463 : ROSE_ASSERT(nodeList[i] != NULL);
130723 : #if 0
130724 : traversal.visit(nodeList[i]);
130725 : #else
130726 2463 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
130727 : {
130728 2463 : traversal.visit(nodeList[i]);
130729 : }
130730 : #endif
130731 : }
130732 : #endif
130733 : }
130734 :
130735 : // This should not be required since all previously static data members are
130736 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
130737 :
130738 5342 : }
130739 :
130740 :
130741 : void
130742 194 : SgUnsignedIntVal::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
130743 : {
130744 : // This function traverses the memory pool for an IR node and
130745 : // calls the function to execute the visitor object.
130746 :
130747 : // Initialize array to the address of the first element of the STL vector
130748 : // (which is guarenteed to be contiguous storage).
130749 : // SgUnsignedIntVal objectArray [] = *(Memory_Block_List.begin());
130750 194 : if (SgUnsignedIntVal::pools.empty() == false)
130751 : {
130752 : // Generate an array of memory pools
130753 137 : SgUnsignedIntVal** objectArray = (SgUnsignedIntVal**) &(SgUnsignedIntVal::pools[0]);
130754 :
130755 : // Build a local variable for better performance
130756 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
130757 :
130758 : // Iterate over the memory pools
130759 274 : for (unsigned int i=0; i < SgUnsignedIntVal::pools.size(); i++)
130760 : {
130761 : // objectArray[i] is a single memory pool
130762 274137 : for (unsigned j=0; j < SgUnsignedIntVal::pool_size; j++)
130763 : {
130764 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
130765 : {
130766 : // printf ("Found a valid SgUnsignedIntVal object in the memory pool %d at position %d \n",i,j);
130767 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
130768 1096 : objectArray[i][j].executeVisitorMemberFunction(visitor);
130769 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
130770 : }
130771 : else
130772 : {
130773 : // printf ("Found a INVALID SgUnsignedIntVal object in the memory pool \n");
130774 : }
130775 : }
130776 : }
130777 : }
130778 :
130779 : // This should not be required since all previously static data members are
130780 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
130781 :
130782 194 : }
130783 :
130784 : void
130785 0 : SgUnsignedIntVal::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
130786 : {
130787 : // This function visits only a single IR node of the memory pool.
130788 : // it is typically called once for each type of IR node within
130789 : // the automatically generated function: traverseRepresentativeNodes().
130790 :
130791 : // Initialize array to the address of the first element of the STL vector
130792 : // (which is guarenteed to be contiguous storage).
130793 : // SgUnsignedIntVal objectArray [] = *(Memory_Block_List.begin());
130794 0 : if (SgUnsignedIntVal::pools.empty() == false)
130795 : {
130796 : // Generate an array of memory pools
130797 0 : SgUnsignedIntVal** objectArray = (SgUnsignedIntVal**) &(SgUnsignedIntVal::pools[0]);
130798 :
130799 : // Build a local variable for better performance
130800 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
130801 :
130802 : // Iterate over the memory pools
130803 0 : bool done = false;
130804 0 : unsigned i=0;
130805 :
130806 : // find the first valid IR node, call visit function, and then leave
130807 0 : while ( done == false && i < SgUnsignedIntVal::pools.size() )
130808 : {
130809 : // objectArray[i] is a single memory pool
130810 : unsigned j=0;
130811 0 : while (done == false && j < SgUnsignedIntVal::pool_size)
130812 : {
130813 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
130814 : {
130815 0 : traversal.visit(&(objectArray[i][j]));
130816 0 : done = true;
130817 : }
130818 0 : j++;
130819 : }
130820 0 : i++;
130821 : }
130822 :
130823 : #if 0
130824 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
130825 : if (done == false)
130826 : {
130827 : printf ("No representative for SgUnsignedIntVal found in memory pools \n");
130828 : }
130829 : #endif
130830 : }
130831 0 : }
130832 :
130833 :
130834 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
130835 : // using values that overflow signed values of int.
130836 : size_t
130837 4 : SgUnsignedIntVal::numberOfNodes()
130838 : {
130839 : // This function traverses the memory pool for an IR node and
130840 : // counts the number of IR nodes of a particular Sage III IR
130841 : // nodes type.
130842 :
130843 4 : size_t count = 0;
130844 4 : if (SgUnsignedIntVal::pools.empty() == false)
130845 : {
130846 : // Generate an array of memory pools (this is actually a STL vector,
130847 : // but it is contiguious, so OK to treat this way).
130848 1 : SgUnsignedIntVal** objectArray = (SgUnsignedIntVal**) &(SgUnsignedIntVal::pools[0]);
130849 :
130850 : // Build a local variable for better performance (make it a loop invariant variable).
130851 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
130852 :
130853 : // Iterate over all of the memory pools for this IR node.
130854 2 : for (unsigned int i=0; i < SgUnsignedIntVal::pools.size(); i++)
130855 : {
130856 : // objectArray[i] is a single memory pool, iterate over all the
130857 : // IR nodes and only count those that are valid IR nodes used in
130858 : // the AST (i.e. allocated IR nodes).
130859 2001 : for (unsigned j=0; j < SgUnsignedIntVal::pool_size; j++)
130860 : {
130861 : // This is indexing the STL vector of C/C++ style arrays as a doubly
130862 : // indexed array access. It is OK since we have leveraged the semantics
130863 : // of STL vector memory as contigous and cast the memory as an array
130864 : // of arrays to use the 2D array indexing. Hope this is not confusing,
130865 : // but it s very fast as an implementation.
130866 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
130867 : {
130868 8 : count++;
130869 : }
130870 : }
130871 : }
130872 : }
130873 :
130874 :
130875 :
130876 4 : return count;
130877 : }
130878 :
130879 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
130880 : // using values that overflow signed values of int.
130881 : size_t
130882 0 : SgUnsignedIntVal::memoryUsage()
130883 : {
130884 : // This function is required because we need the class name as a type when we call sizeof
130885 : // There might be another way to implement this if we have a traversal that only called a
130886 : // representative object (one call for each type of Sage IIIIR node).
130887 0 : size_t memory = numberOfNodes() * sizeof(SgUnsignedIntVal);
130888 :
130889 0 : return memory;
130890 : }
130891 :
130892 : /* #line 130893 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
130893 :
130894 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
130895 : void
130896 5342 : SgLongIntVal::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
130897 : {
130898 : // This function traverses the memory pool for only a specific IR node
130899 : // and calls the visit function of the input class execute a traversal
130900 : // similar to the style of the attribute based traversals within ROSE.
130901 : // This traversal will visit ALL nodes of the AST where as the other
130902 : // attribute based traversals visit only the embedded tree within the AST.
130903 :
130904 : // Initialize array to the address of the first element of the STL vector
130905 : // (which is guaranteed to be contiguous storage).
130906 : // SgLongIntVal objectArray [] = *(Memory_Block_List.begin());
130907 5342 : if (SgLongIntVal::pools.empty() == false)
130908 : {
130909 : // Generate an array of memory pools
130910 243 : SgLongIntVal** objectArray = (SgLongIntVal**) &(SgLongIntVal::pools[0]);
130911 :
130912 : // Build a local variable for better performance
130913 243 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
130914 : #if 0
130915 : // Iterate over the memory pools
130916 : for (unsigned int i=0; i < SgLongIntVal::pools.size(); i++)
130917 : {
130918 : // objectArray[i] is a single memory pool
130919 : for (int j=0; j < SgLongIntVal::pool_size; j++)
130920 : {
130921 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
130922 : {
130923 : traversal.visit(&(objectArray[i][j]));
130924 : }
130925 : }
130926 : }
130927 : #else
130928 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
130929 : // compute the list first and then call the visit function on each list element.
130930 :
130931 : // printf ("Inside of SgLongIntVal::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
130932 :
130933 486 : std::vector<SgLongIntVal*> nodeList;
130934 :
130935 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
130936 486 : for (unsigned int i=0; i < SgLongIntVal::pools.size(); i++)
130937 : {
130938 : // objectArray[i] is a single memory pool
130939 486243 : for (unsigned j=0; j < SgLongIntVal::pool_size; j++)
130940 : {
130941 486000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
130942 : {
130943 16093 : nodeList.push_back(&(objectArray[i][j]));
130944 : }
130945 : }
130946 : }
130947 :
130948 : // Iterate over the saved list
130949 243 : size_t nodeListSize = nodeList.size();
130950 16336 : for (size_t i=0; i < nodeListSize; i++)
130951 : {
130952 16093 : ROSE_ASSERT(nodeList[i] != NULL);
130953 : #if 0
130954 : traversal.visit(nodeList[i]);
130955 : #else
130956 16093 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
130957 : {
130958 16093 : traversal.visit(nodeList[i]);
130959 : }
130960 : #endif
130961 : }
130962 : #endif
130963 : }
130964 :
130965 : // This should not be required since all previously static data members are
130966 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
130967 :
130968 5342 : }
130969 :
130970 :
130971 : void
130972 194 : SgLongIntVal::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
130973 : {
130974 : // This function traverses the memory pool for an IR node and
130975 : // calls the function to execute the visitor object.
130976 :
130977 : // Initialize array to the address of the first element of the STL vector
130978 : // (which is guarenteed to be contiguous storage).
130979 : // SgLongIntVal objectArray [] = *(Memory_Block_List.begin());
130980 194 : if (SgLongIntVal::pools.empty() == false)
130981 : {
130982 : // Generate an array of memory pools
130983 137 : SgLongIntVal** objectArray = (SgLongIntVal**) &(SgLongIntVal::pools[0]);
130984 :
130985 : // Build a local variable for better performance
130986 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
130987 :
130988 : // Iterate over the memory pools
130989 274 : for (unsigned int i=0; i < SgLongIntVal::pools.size(); i++)
130990 : {
130991 : // objectArray[i] is a single memory pool
130992 274137 : for (unsigned j=0; j < SgLongIntVal::pool_size; j++)
130993 : {
130994 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
130995 : {
130996 : // printf ("Found a valid SgLongIntVal object in the memory pool %d at position %d \n",i,j);
130997 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
130998 1781 : objectArray[i][j].executeVisitorMemberFunction(visitor);
130999 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
131000 : }
131001 : else
131002 : {
131003 : // printf ("Found a INVALID SgLongIntVal object in the memory pool \n");
131004 : }
131005 : }
131006 : }
131007 : }
131008 :
131009 : // This should not be required since all previously static data members are
131010 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
131011 :
131012 194 : }
131013 :
131014 : void
131015 0 : SgLongIntVal::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
131016 : {
131017 : // This function visits only a single IR node of the memory pool.
131018 : // it is typically called once for each type of IR node within
131019 : // the automatically generated function: traverseRepresentativeNodes().
131020 :
131021 : // Initialize array to the address of the first element of the STL vector
131022 : // (which is guarenteed to be contiguous storage).
131023 : // SgLongIntVal objectArray [] = *(Memory_Block_List.begin());
131024 0 : if (SgLongIntVal::pools.empty() == false)
131025 : {
131026 : // Generate an array of memory pools
131027 0 : SgLongIntVal** objectArray = (SgLongIntVal**) &(SgLongIntVal::pools[0]);
131028 :
131029 : // Build a local variable for better performance
131030 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
131031 :
131032 : // Iterate over the memory pools
131033 0 : bool done = false;
131034 0 : unsigned i=0;
131035 :
131036 : // find the first valid IR node, call visit function, and then leave
131037 0 : while ( done == false && i < SgLongIntVal::pools.size() )
131038 : {
131039 : // objectArray[i] is a single memory pool
131040 : unsigned j=0;
131041 0 : while (done == false && j < SgLongIntVal::pool_size)
131042 : {
131043 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
131044 : {
131045 0 : traversal.visit(&(objectArray[i][j]));
131046 0 : done = true;
131047 : }
131048 0 : j++;
131049 : }
131050 0 : i++;
131051 : }
131052 :
131053 : #if 0
131054 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
131055 : if (done == false)
131056 : {
131057 : printf ("No representative for SgLongIntVal found in memory pools \n");
131058 : }
131059 : #endif
131060 : }
131061 0 : }
131062 :
131063 :
131064 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
131065 : // using values that overflow signed values of int.
131066 : size_t
131067 4 : SgLongIntVal::numberOfNodes()
131068 : {
131069 : // This function traverses the memory pool for an IR node and
131070 : // counts the number of IR nodes of a particular Sage III IR
131071 : // nodes type.
131072 :
131073 4 : size_t count = 0;
131074 4 : if (SgLongIntVal::pools.empty() == false)
131075 : {
131076 : // Generate an array of memory pools (this is actually a STL vector,
131077 : // but it is contiguious, so OK to treat this way).
131078 1 : SgLongIntVal** objectArray = (SgLongIntVal**) &(SgLongIntVal::pools[0]);
131079 :
131080 : // Build a local variable for better performance (make it a loop invariant variable).
131081 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
131082 :
131083 : // Iterate over all of the memory pools for this IR node.
131084 2 : for (unsigned int i=0; i < SgLongIntVal::pools.size(); i++)
131085 : {
131086 : // objectArray[i] is a single memory pool, iterate over all the
131087 : // IR nodes and only count those that are valid IR nodes used in
131088 : // the AST (i.e. allocated IR nodes).
131089 2001 : for (unsigned j=0; j < SgLongIntVal::pool_size; j++)
131090 : {
131091 : // This is indexing the STL vector of C/C++ style arrays as a doubly
131092 : // indexed array access. It is OK since we have leveraged the semantics
131093 : // of STL vector memory as contigous and cast the memory as an array
131094 : // of arrays to use the 2D array indexing. Hope this is not confusing,
131095 : // but it s very fast as an implementation.
131096 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
131097 : {
131098 13 : count++;
131099 : }
131100 : }
131101 : }
131102 : }
131103 :
131104 :
131105 :
131106 4 : return count;
131107 : }
131108 :
131109 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
131110 : // using values that overflow signed values of int.
131111 : size_t
131112 0 : SgLongIntVal::memoryUsage()
131113 : {
131114 : // This function is required because we need the class name as a type when we call sizeof
131115 : // There might be another way to implement this if we have a traversal that only called a
131116 : // representative object (one call for each type of Sage IIIIR node).
131117 0 : size_t memory = numberOfNodes() * sizeof(SgLongIntVal);
131118 :
131119 0 : return memory;
131120 : }
131121 :
131122 : /* #line 131123 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
131123 :
131124 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
131125 : void
131126 5342 : SgLongLongIntVal::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
131127 : {
131128 : // This function traverses the memory pool for only a specific IR node
131129 : // and calls the visit function of the input class execute a traversal
131130 : // similar to the style of the attribute based traversals within ROSE.
131131 : // This traversal will visit ALL nodes of the AST where as the other
131132 : // attribute based traversals visit only the embedded tree within the AST.
131133 :
131134 : // Initialize array to the address of the first element of the STL vector
131135 : // (which is guaranteed to be contiguous storage).
131136 : // SgLongLongIntVal objectArray [] = *(Memory_Block_List.begin());
131137 5342 : if (SgLongLongIntVal::pools.empty() == false)
131138 : {
131139 : // Generate an array of memory pools
131140 183 : SgLongLongIntVal** objectArray = (SgLongLongIntVal**) &(SgLongLongIntVal::pools[0]);
131141 :
131142 : // Build a local variable for better performance
131143 183 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
131144 : #if 0
131145 : // Iterate over the memory pools
131146 : for (unsigned int i=0; i < SgLongLongIntVal::pools.size(); i++)
131147 : {
131148 : // objectArray[i] is a single memory pool
131149 : for (int j=0; j < SgLongLongIntVal::pool_size; j++)
131150 : {
131151 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
131152 : {
131153 : traversal.visit(&(objectArray[i][j]));
131154 : }
131155 : }
131156 : }
131157 : #else
131158 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
131159 : // compute the list first and then call the visit function on each list element.
131160 :
131161 : // printf ("Inside of SgLongLongIntVal::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
131162 :
131163 366 : std::vector<SgLongLongIntVal*> nodeList;
131164 :
131165 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
131166 366 : for (unsigned int i=0; i < SgLongLongIntVal::pools.size(); i++)
131167 : {
131168 : // objectArray[i] is a single memory pool
131169 366183 : for (unsigned j=0; j < SgLongLongIntVal::pool_size; j++)
131170 : {
131171 366000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
131172 : {
131173 375 : nodeList.push_back(&(objectArray[i][j]));
131174 : }
131175 : }
131176 : }
131177 :
131178 : // Iterate over the saved list
131179 183 : size_t nodeListSize = nodeList.size();
131180 558 : for (size_t i=0; i < nodeListSize; i++)
131181 : {
131182 375 : ROSE_ASSERT(nodeList[i] != NULL);
131183 : #if 0
131184 : traversal.visit(nodeList[i]);
131185 : #else
131186 375 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
131187 : {
131188 375 : traversal.visit(nodeList[i]);
131189 : }
131190 : #endif
131191 : }
131192 : #endif
131193 : }
131194 :
131195 : // This should not be required since all previously static data members are
131196 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
131197 :
131198 5342 : }
131199 :
131200 :
131201 : void
131202 194 : SgLongLongIntVal::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
131203 : {
131204 : // This function traverses the memory pool for an IR node and
131205 : // calls the function to execute the visitor object.
131206 :
131207 : // Initialize array to the address of the first element of the STL vector
131208 : // (which is guarenteed to be contiguous storage).
131209 : // SgLongLongIntVal objectArray [] = *(Memory_Block_List.begin());
131210 194 : if (SgLongLongIntVal::pools.empty() == false)
131211 : {
131212 : // Generate an array of memory pools
131213 137 : SgLongLongIntVal** objectArray = (SgLongLongIntVal**) &(SgLongLongIntVal::pools[0]);
131214 :
131215 : // Build a local variable for better performance
131216 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
131217 :
131218 : // Iterate over the memory pools
131219 274 : for (unsigned int i=0; i < SgLongLongIntVal::pools.size(); i++)
131220 : {
131221 : // objectArray[i] is a single memory pool
131222 274137 : for (unsigned j=0; j < SgLongLongIntVal::pool_size; j++)
131223 : {
131224 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
131225 : {
131226 : // printf ("Found a valid SgLongLongIntVal object in the memory pool %d at position %d \n",i,j);
131227 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
131228 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
131229 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
131230 : }
131231 : else
131232 : {
131233 : // printf ("Found a INVALID SgLongLongIntVal object in the memory pool \n");
131234 : }
131235 : }
131236 : }
131237 : }
131238 :
131239 : // This should not be required since all previously static data members are
131240 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
131241 :
131242 194 : }
131243 :
131244 : void
131245 0 : SgLongLongIntVal::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
131246 : {
131247 : // This function visits only a single IR node of the memory pool.
131248 : // it is typically called once for each type of IR node within
131249 : // the automatically generated function: traverseRepresentativeNodes().
131250 :
131251 : // Initialize array to the address of the first element of the STL vector
131252 : // (which is guarenteed to be contiguous storage).
131253 : // SgLongLongIntVal objectArray [] = *(Memory_Block_List.begin());
131254 0 : if (SgLongLongIntVal::pools.empty() == false)
131255 : {
131256 : // Generate an array of memory pools
131257 0 : SgLongLongIntVal** objectArray = (SgLongLongIntVal**) &(SgLongLongIntVal::pools[0]);
131258 :
131259 : // Build a local variable for better performance
131260 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
131261 :
131262 : // Iterate over the memory pools
131263 0 : bool done = false;
131264 0 : unsigned i=0;
131265 :
131266 : // find the first valid IR node, call visit function, and then leave
131267 0 : while ( done == false && i < SgLongLongIntVal::pools.size() )
131268 : {
131269 : // objectArray[i] is a single memory pool
131270 : unsigned j=0;
131271 0 : while (done == false && j < SgLongLongIntVal::pool_size)
131272 : {
131273 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
131274 : {
131275 0 : traversal.visit(&(objectArray[i][j]));
131276 0 : done = true;
131277 : }
131278 0 : j++;
131279 : }
131280 0 : i++;
131281 : }
131282 :
131283 : #if 0
131284 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
131285 : if (done == false)
131286 : {
131287 : printf ("No representative for SgLongLongIntVal found in memory pools \n");
131288 : }
131289 : #endif
131290 : }
131291 0 : }
131292 :
131293 :
131294 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
131295 : // using values that overflow signed values of int.
131296 : size_t
131297 4 : SgLongLongIntVal::numberOfNodes()
131298 : {
131299 : // This function traverses the memory pool for an IR node and
131300 : // counts the number of IR nodes of a particular Sage III IR
131301 : // nodes type.
131302 :
131303 4 : size_t count = 0;
131304 4 : if (SgLongLongIntVal::pools.empty() == false)
131305 : {
131306 : // Generate an array of memory pools (this is actually a STL vector,
131307 : // but it is contiguious, so OK to treat this way).
131308 0 : SgLongLongIntVal** objectArray = (SgLongLongIntVal**) &(SgLongLongIntVal::pools[0]);
131309 :
131310 : // Build a local variable for better performance (make it a loop invariant variable).
131311 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
131312 :
131313 : // Iterate over all of the memory pools for this IR node.
131314 0 : for (unsigned int i=0; i < SgLongLongIntVal::pools.size(); i++)
131315 : {
131316 : // objectArray[i] is a single memory pool, iterate over all the
131317 : // IR nodes and only count those that are valid IR nodes used in
131318 : // the AST (i.e. allocated IR nodes).
131319 0 : for (unsigned j=0; j < SgLongLongIntVal::pool_size; j++)
131320 : {
131321 : // This is indexing the STL vector of C/C++ style arrays as a doubly
131322 : // indexed array access. It is OK since we have leveraged the semantics
131323 : // of STL vector memory as contigous and cast the memory as an array
131324 : // of arrays to use the 2D array indexing. Hope this is not confusing,
131325 : // but it s very fast as an implementation.
131326 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
131327 : {
131328 0 : count++;
131329 : }
131330 : }
131331 : }
131332 : }
131333 :
131334 :
131335 :
131336 4 : return count;
131337 : }
131338 :
131339 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
131340 : // using values that overflow signed values of int.
131341 : size_t
131342 0 : SgLongLongIntVal::memoryUsage()
131343 : {
131344 : // This function is required because we need the class name as a type when we call sizeof
131345 : // There might be another way to implement this if we have a traversal that only called a
131346 : // representative object (one call for each type of Sage IIIIR node).
131347 0 : size_t memory = numberOfNodes() * sizeof(SgLongLongIntVal);
131348 :
131349 0 : return memory;
131350 : }
131351 :
131352 : /* #line 131353 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
131353 :
131354 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
131355 : void
131356 5342 : SgUnsignedLongLongIntVal::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
131357 : {
131358 : // This function traverses the memory pool for only a specific IR node
131359 : // and calls the visit function of the input class execute a traversal
131360 : // similar to the style of the attribute based traversals within ROSE.
131361 : // This traversal will visit ALL nodes of the AST where as the other
131362 : // attribute based traversals visit only the embedded tree within the AST.
131363 :
131364 : // Initialize array to the address of the first element of the STL vector
131365 : // (which is guaranteed to be contiguous storage).
131366 : // SgUnsignedLongLongIntVal objectArray [] = *(Memory_Block_List.begin());
131367 5342 : if (SgUnsignedLongLongIntVal::pools.empty() == false)
131368 : {
131369 : // Generate an array of memory pools
131370 115 : SgUnsignedLongLongIntVal** objectArray = (SgUnsignedLongLongIntVal**) &(SgUnsignedLongLongIntVal::pools[0]);
131371 :
131372 : // Build a local variable for better performance
131373 115 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
131374 : #if 0
131375 : // Iterate over the memory pools
131376 : for (unsigned int i=0; i < SgUnsignedLongLongIntVal::pools.size(); i++)
131377 : {
131378 : // objectArray[i] is a single memory pool
131379 : for (int j=0; j < SgUnsignedLongLongIntVal::pool_size; j++)
131380 : {
131381 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
131382 : {
131383 : traversal.visit(&(objectArray[i][j]));
131384 : }
131385 : }
131386 : }
131387 : #else
131388 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
131389 : // compute the list first and then call the visit function on each list element.
131390 :
131391 : // printf ("Inside of SgUnsignedLongLongIntVal::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
131392 :
131393 230 : std::vector<SgUnsignedLongLongIntVal*> nodeList;
131394 :
131395 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
131396 230 : for (unsigned int i=0; i < SgUnsignedLongLongIntVal::pools.size(); i++)
131397 : {
131398 : // objectArray[i] is a single memory pool
131399 230115 : for (unsigned j=0; j < SgUnsignedLongLongIntVal::pool_size; j++)
131400 : {
131401 230000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
131402 : {
131403 278 : nodeList.push_back(&(objectArray[i][j]));
131404 : }
131405 : }
131406 : }
131407 :
131408 : // Iterate over the saved list
131409 115 : size_t nodeListSize = nodeList.size();
131410 393 : for (size_t i=0; i < nodeListSize; i++)
131411 : {
131412 278 : ROSE_ASSERT(nodeList[i] != NULL);
131413 : #if 0
131414 : traversal.visit(nodeList[i]);
131415 : #else
131416 278 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
131417 : {
131418 278 : traversal.visit(nodeList[i]);
131419 : }
131420 : #endif
131421 : }
131422 : #endif
131423 : }
131424 :
131425 : // This should not be required since all previously static data members are
131426 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
131427 :
131428 5342 : }
131429 :
131430 :
131431 : void
131432 194 : SgUnsignedLongLongIntVal::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
131433 : {
131434 : // This function traverses the memory pool for an IR node and
131435 : // calls the function to execute the visitor object.
131436 :
131437 : // Initialize array to the address of the first element of the STL vector
131438 : // (which is guarenteed to be contiguous storage).
131439 : // SgUnsignedLongLongIntVal objectArray [] = *(Memory_Block_List.begin());
131440 194 : if (SgUnsignedLongLongIntVal::pools.empty() == false)
131441 : {
131442 : // Generate an array of memory pools
131443 137 : SgUnsignedLongLongIntVal** objectArray = (SgUnsignedLongLongIntVal**) &(SgUnsignedLongLongIntVal::pools[0]);
131444 :
131445 : // Build a local variable for better performance
131446 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
131447 :
131448 : // Iterate over the memory pools
131449 274 : for (unsigned int i=0; i < SgUnsignedLongLongIntVal::pools.size(); i++)
131450 : {
131451 : // objectArray[i] is a single memory pool
131452 274137 : for (unsigned j=0; j < SgUnsignedLongLongIntVal::pool_size; j++)
131453 : {
131454 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
131455 : {
131456 : // printf ("Found a valid SgUnsignedLongLongIntVal object in the memory pool %d at position %d \n",i,j);
131457 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
131458 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
131459 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
131460 : }
131461 : else
131462 : {
131463 : // printf ("Found a INVALID SgUnsignedLongLongIntVal object in the memory pool \n");
131464 : }
131465 : }
131466 : }
131467 : }
131468 :
131469 : // This should not be required since all previously static data members are
131470 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
131471 :
131472 194 : }
131473 :
131474 : void
131475 0 : SgUnsignedLongLongIntVal::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
131476 : {
131477 : // This function visits only a single IR node of the memory pool.
131478 : // it is typically called once for each type of IR node within
131479 : // the automatically generated function: traverseRepresentativeNodes().
131480 :
131481 : // Initialize array to the address of the first element of the STL vector
131482 : // (which is guarenteed to be contiguous storage).
131483 : // SgUnsignedLongLongIntVal objectArray [] = *(Memory_Block_List.begin());
131484 0 : if (SgUnsignedLongLongIntVal::pools.empty() == false)
131485 : {
131486 : // Generate an array of memory pools
131487 0 : SgUnsignedLongLongIntVal** objectArray = (SgUnsignedLongLongIntVal**) &(SgUnsignedLongLongIntVal::pools[0]);
131488 :
131489 : // Build a local variable for better performance
131490 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
131491 :
131492 : // Iterate over the memory pools
131493 0 : bool done = false;
131494 0 : unsigned i=0;
131495 :
131496 : // find the first valid IR node, call visit function, and then leave
131497 0 : while ( done == false && i < SgUnsignedLongLongIntVal::pools.size() )
131498 : {
131499 : // objectArray[i] is a single memory pool
131500 : unsigned j=0;
131501 0 : while (done == false && j < SgUnsignedLongLongIntVal::pool_size)
131502 : {
131503 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
131504 : {
131505 0 : traversal.visit(&(objectArray[i][j]));
131506 0 : done = true;
131507 : }
131508 0 : j++;
131509 : }
131510 0 : i++;
131511 : }
131512 :
131513 : #if 0
131514 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
131515 : if (done == false)
131516 : {
131517 : printf ("No representative for SgUnsignedLongLongIntVal found in memory pools \n");
131518 : }
131519 : #endif
131520 : }
131521 0 : }
131522 :
131523 :
131524 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
131525 : // using values that overflow signed values of int.
131526 : size_t
131527 4 : SgUnsignedLongLongIntVal::numberOfNodes()
131528 : {
131529 : // This function traverses the memory pool for an IR node and
131530 : // counts the number of IR nodes of a particular Sage III IR
131531 : // nodes type.
131532 :
131533 4 : size_t count = 0;
131534 4 : if (SgUnsignedLongLongIntVal::pools.empty() == false)
131535 : {
131536 : // Generate an array of memory pools (this is actually a STL vector,
131537 : // but it is contiguious, so OK to treat this way).
131538 0 : SgUnsignedLongLongIntVal** objectArray = (SgUnsignedLongLongIntVal**) &(SgUnsignedLongLongIntVal::pools[0]);
131539 :
131540 : // Build a local variable for better performance (make it a loop invariant variable).
131541 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
131542 :
131543 : // Iterate over all of the memory pools for this IR node.
131544 0 : for (unsigned int i=0; i < SgUnsignedLongLongIntVal::pools.size(); i++)
131545 : {
131546 : // objectArray[i] is a single memory pool, iterate over all the
131547 : // IR nodes and only count those that are valid IR nodes used in
131548 : // the AST (i.e. allocated IR nodes).
131549 0 : for (unsigned j=0; j < SgUnsignedLongLongIntVal::pool_size; j++)
131550 : {
131551 : // This is indexing the STL vector of C/C++ style arrays as a doubly
131552 : // indexed array access. It is OK since we have leveraged the semantics
131553 : // of STL vector memory as contigous and cast the memory as an array
131554 : // of arrays to use the 2D array indexing. Hope this is not confusing,
131555 : // but it s very fast as an implementation.
131556 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
131557 : {
131558 0 : count++;
131559 : }
131560 : }
131561 : }
131562 : }
131563 :
131564 :
131565 :
131566 4 : return count;
131567 : }
131568 :
131569 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
131570 : // using values that overflow signed values of int.
131571 : size_t
131572 0 : SgUnsignedLongLongIntVal::memoryUsage()
131573 : {
131574 : // This function is required because we need the class name as a type when we call sizeof
131575 : // There might be another way to implement this if we have a traversal that only called a
131576 : // representative object (one call for each type of Sage IIIIR node).
131577 0 : size_t memory = numberOfNodes() * sizeof(SgUnsignedLongLongIntVal);
131578 :
131579 0 : return memory;
131580 : }
131581 :
131582 : /* #line 131583 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
131583 :
131584 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
131585 : void
131586 5342 : SgUnsignedLongVal::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
131587 : {
131588 : // This function traverses the memory pool for only a specific IR node
131589 : // and calls the visit function of the input class execute a traversal
131590 : // similar to the style of the attribute based traversals within ROSE.
131591 : // This traversal will visit ALL nodes of the AST where as the other
131592 : // attribute based traversals visit only the embedded tree within the AST.
131593 :
131594 : // Initialize array to the address of the first element of the STL vector
131595 : // (which is guaranteed to be contiguous storage).
131596 : // SgUnsignedLongVal objectArray [] = *(Memory_Block_List.begin());
131597 5342 : if (SgUnsignedLongVal::pools.empty() == false)
131598 : {
131599 : // Generate an array of memory pools
131600 3070 : SgUnsignedLongVal** objectArray = (SgUnsignedLongVal**) &(SgUnsignedLongVal::pools[0]);
131601 :
131602 : // Build a local variable for better performance
131603 3070 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
131604 : #if 0
131605 : // Iterate over the memory pools
131606 : for (unsigned int i=0; i < SgUnsignedLongVal::pools.size(); i++)
131607 : {
131608 : // objectArray[i] is a single memory pool
131609 : for (int j=0; j < SgUnsignedLongVal::pool_size; j++)
131610 : {
131611 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
131612 : {
131613 : traversal.visit(&(objectArray[i][j]));
131614 : }
131615 : }
131616 : }
131617 : #else
131618 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
131619 : // compute the list first and then call the visit function on each list element.
131620 :
131621 : // printf ("Inside of SgUnsignedLongVal::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
131622 :
131623 6140 : std::vector<SgUnsignedLongVal*> nodeList;
131624 :
131625 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
131626 6140 : for (unsigned int i=0; i < SgUnsignedLongVal::pools.size(); i++)
131627 : {
131628 : // objectArray[i] is a single memory pool
131629 6143070 : for (unsigned j=0; j < SgUnsignedLongVal::pool_size; j++)
131630 : {
131631 6140000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
131632 : {
131633 64081 : nodeList.push_back(&(objectArray[i][j]));
131634 : }
131635 : }
131636 : }
131637 :
131638 : // Iterate over the saved list
131639 3070 : size_t nodeListSize = nodeList.size();
131640 67151 : for (size_t i=0; i < nodeListSize; i++)
131641 : {
131642 64081 : ROSE_ASSERT(nodeList[i] != NULL);
131643 : #if 0
131644 : traversal.visit(nodeList[i]);
131645 : #else
131646 64081 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
131647 : {
131648 64081 : traversal.visit(nodeList[i]);
131649 : }
131650 : #endif
131651 : }
131652 : #endif
131653 : }
131654 :
131655 : // This should not be required since all previously static data members are
131656 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
131657 :
131658 5342 : }
131659 :
131660 :
131661 : void
131662 194 : SgUnsignedLongVal::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
131663 : {
131664 : // This function traverses the memory pool for an IR node and
131665 : // calls the function to execute the visitor object.
131666 :
131667 : // Initialize array to the address of the first element of the STL vector
131668 : // (which is guarenteed to be contiguous storage).
131669 : // SgUnsignedLongVal objectArray [] = *(Memory_Block_List.begin());
131670 194 : if (SgUnsignedLongVal::pools.empty() == false)
131671 : {
131672 : // Generate an array of memory pools
131673 190 : SgUnsignedLongVal** objectArray = (SgUnsignedLongVal**) &(SgUnsignedLongVal::pools[0]);
131674 :
131675 : // Build a local variable for better performance
131676 190 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
131677 :
131678 : // Iterate over the memory pools
131679 380 : for (unsigned int i=0; i < SgUnsignedLongVal::pools.size(); i++)
131680 : {
131681 : // objectArray[i] is a single memory pool
131682 380190 : for (unsigned j=0; j < SgUnsignedLongVal::pool_size; j++)
131683 : {
131684 380000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
131685 : {
131686 : // printf ("Found a valid SgUnsignedLongVal object in the memory pool %d at position %d \n",i,j);
131687 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
131688 2846 : objectArray[i][j].executeVisitorMemberFunction(visitor);
131689 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
131690 : }
131691 : else
131692 : {
131693 : // printf ("Found a INVALID SgUnsignedLongVal object in the memory pool \n");
131694 : }
131695 : }
131696 : }
131697 : }
131698 :
131699 : // This should not be required since all previously static data members are
131700 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
131701 :
131702 194 : }
131703 :
131704 : void
131705 0 : SgUnsignedLongVal::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
131706 : {
131707 : // This function visits only a single IR node of the memory pool.
131708 : // it is typically called once for each type of IR node within
131709 : // the automatically generated function: traverseRepresentativeNodes().
131710 :
131711 : // Initialize array to the address of the first element of the STL vector
131712 : // (which is guarenteed to be contiguous storage).
131713 : // SgUnsignedLongVal objectArray [] = *(Memory_Block_List.begin());
131714 0 : if (SgUnsignedLongVal::pools.empty() == false)
131715 : {
131716 : // Generate an array of memory pools
131717 0 : SgUnsignedLongVal** objectArray = (SgUnsignedLongVal**) &(SgUnsignedLongVal::pools[0]);
131718 :
131719 : // Build a local variable for better performance
131720 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
131721 :
131722 : // Iterate over the memory pools
131723 0 : bool done = false;
131724 0 : unsigned i=0;
131725 :
131726 : // find the first valid IR node, call visit function, and then leave
131727 0 : while ( done == false && i < SgUnsignedLongVal::pools.size() )
131728 : {
131729 : // objectArray[i] is a single memory pool
131730 : unsigned j=0;
131731 0 : while (done == false && j < SgUnsignedLongVal::pool_size)
131732 : {
131733 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
131734 : {
131735 0 : traversal.visit(&(objectArray[i][j]));
131736 0 : done = true;
131737 : }
131738 0 : j++;
131739 : }
131740 0 : i++;
131741 : }
131742 :
131743 : #if 0
131744 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
131745 : if (done == false)
131746 : {
131747 : printf ("No representative for SgUnsignedLongVal found in memory pools \n");
131748 : }
131749 : #endif
131750 : }
131751 0 : }
131752 :
131753 :
131754 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
131755 : // using values that overflow signed values of int.
131756 : size_t
131757 4 : SgUnsignedLongVal::numberOfNodes()
131758 : {
131759 : // This function traverses the memory pool for an IR node and
131760 : // counts the number of IR nodes of a particular Sage III IR
131761 : // nodes type.
131762 :
131763 4 : size_t count = 0;
131764 4 : if (SgUnsignedLongVal::pools.empty() == false)
131765 : {
131766 : // Generate an array of memory pools (this is actually a STL vector,
131767 : // but it is contiguious, so OK to treat this way).
131768 1 : SgUnsignedLongVal** objectArray = (SgUnsignedLongVal**) &(SgUnsignedLongVal::pools[0]);
131769 :
131770 : // Build a local variable for better performance (make it a loop invariant variable).
131771 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
131772 :
131773 : // Iterate over all of the memory pools for this IR node.
131774 2 : for (unsigned int i=0; i < SgUnsignedLongVal::pools.size(); i++)
131775 : {
131776 : // objectArray[i] is a single memory pool, iterate over all the
131777 : // IR nodes and only count those that are valid IR nodes used in
131778 : // the AST (i.e. allocated IR nodes).
131779 2001 : for (unsigned j=0; j < SgUnsignedLongVal::pool_size; j++)
131780 : {
131781 : // This is indexing the STL vector of C/C++ style arrays as a doubly
131782 : // indexed array access. It is OK since we have leveraged the semantics
131783 : // of STL vector memory as contigous and cast the memory as an array
131784 : // of arrays to use the 2D array indexing. Hope this is not confusing,
131785 : // but it s very fast as an implementation.
131786 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
131787 : {
131788 19 : count++;
131789 : }
131790 : }
131791 : }
131792 : }
131793 :
131794 :
131795 :
131796 4 : return count;
131797 : }
131798 :
131799 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
131800 : // using values that overflow signed values of int.
131801 : size_t
131802 0 : SgUnsignedLongVal::memoryUsage()
131803 : {
131804 : // This function is required because we need the class name as a type when we call sizeof
131805 : // There might be another way to implement this if we have a traversal that only called a
131806 : // representative object (one call for each type of Sage IIIIR node).
131807 0 : size_t memory = numberOfNodes() * sizeof(SgUnsignedLongVal);
131808 :
131809 0 : return memory;
131810 : }
131811 :
131812 : /* #line 131813 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
131813 :
131814 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
131815 : void
131816 5342 : SgFloatVal::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
131817 : {
131818 : // This function traverses the memory pool for only a specific IR node
131819 : // and calls the visit function of the input class execute a traversal
131820 : // similar to the style of the attribute based traversals within ROSE.
131821 : // This traversal will visit ALL nodes of the AST where as the other
131822 : // attribute based traversals visit only the embedded tree within the AST.
131823 :
131824 : // Initialize array to the address of the first element of the STL vector
131825 : // (which is guaranteed to be contiguous storage).
131826 : // SgFloatVal objectArray [] = *(Memory_Block_List.begin());
131827 5342 : if (SgFloatVal::pools.empty() == false)
131828 : {
131829 : // Generate an array of memory pools
131830 488 : SgFloatVal** objectArray = (SgFloatVal**) &(SgFloatVal::pools[0]);
131831 :
131832 : // Build a local variable for better performance
131833 488 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
131834 : #if 0
131835 : // Iterate over the memory pools
131836 : for (unsigned int i=0; i < SgFloatVal::pools.size(); i++)
131837 : {
131838 : // objectArray[i] is a single memory pool
131839 : for (int j=0; j < SgFloatVal::pool_size; j++)
131840 : {
131841 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
131842 : {
131843 : traversal.visit(&(objectArray[i][j]));
131844 : }
131845 : }
131846 : }
131847 : #else
131848 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
131849 : // compute the list first and then call the visit function on each list element.
131850 :
131851 : // printf ("Inside of SgFloatVal::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
131852 :
131853 976 : std::vector<SgFloatVal*> nodeList;
131854 :
131855 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
131856 976 : for (unsigned int i=0; i < SgFloatVal::pools.size(); i++)
131857 : {
131858 : // objectArray[i] is a single memory pool
131859 976488 : for (unsigned j=0; j < SgFloatVal::pool_size; j++)
131860 : {
131861 976000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
131862 : {
131863 1102 : nodeList.push_back(&(objectArray[i][j]));
131864 : }
131865 : }
131866 : }
131867 :
131868 : // Iterate over the saved list
131869 488 : size_t nodeListSize = nodeList.size();
131870 1590 : for (size_t i=0; i < nodeListSize; i++)
131871 : {
131872 1102 : ROSE_ASSERT(nodeList[i] != NULL);
131873 : #if 0
131874 : traversal.visit(nodeList[i]);
131875 : #else
131876 1102 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
131877 : {
131878 1102 : traversal.visit(nodeList[i]);
131879 : }
131880 : #endif
131881 : }
131882 : #endif
131883 : }
131884 :
131885 : // This should not be required since all previously static data members are
131886 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
131887 :
131888 5342 : }
131889 :
131890 :
131891 : void
131892 194 : SgFloatVal::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
131893 : {
131894 : // This function traverses the memory pool for an IR node and
131895 : // calls the function to execute the visitor object.
131896 :
131897 : // Initialize array to the address of the first element of the STL vector
131898 : // (which is guarenteed to be contiguous storage).
131899 : // SgFloatVal objectArray [] = *(Memory_Block_List.begin());
131900 194 : if (SgFloatVal::pools.empty() == false)
131901 : {
131902 : // Generate an array of memory pools
131903 137 : SgFloatVal** objectArray = (SgFloatVal**) &(SgFloatVal::pools[0]);
131904 :
131905 : // Build a local variable for better performance
131906 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
131907 :
131908 : // Iterate over the memory pools
131909 274 : for (unsigned int i=0; i < SgFloatVal::pools.size(); i++)
131910 : {
131911 : // objectArray[i] is a single memory pool
131912 274137 : for (unsigned j=0; j < SgFloatVal::pool_size; j++)
131913 : {
131914 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
131915 : {
131916 : // printf ("Found a valid SgFloatVal object in the memory pool %d at position %d \n",i,j);
131917 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
131918 137 : objectArray[i][j].executeVisitorMemberFunction(visitor);
131919 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
131920 : }
131921 : else
131922 : {
131923 : // printf ("Found a INVALID SgFloatVal object in the memory pool \n");
131924 : }
131925 : }
131926 : }
131927 : }
131928 :
131929 : // This should not be required since all previously static data members are
131930 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
131931 :
131932 194 : }
131933 :
131934 : void
131935 0 : SgFloatVal::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
131936 : {
131937 : // This function visits only a single IR node of the memory pool.
131938 : // it is typically called once for each type of IR node within
131939 : // the automatically generated function: traverseRepresentativeNodes().
131940 :
131941 : // Initialize array to the address of the first element of the STL vector
131942 : // (which is guarenteed to be contiguous storage).
131943 : // SgFloatVal objectArray [] = *(Memory_Block_List.begin());
131944 0 : if (SgFloatVal::pools.empty() == false)
131945 : {
131946 : // Generate an array of memory pools
131947 0 : SgFloatVal** objectArray = (SgFloatVal**) &(SgFloatVal::pools[0]);
131948 :
131949 : // Build a local variable for better performance
131950 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
131951 :
131952 : // Iterate over the memory pools
131953 0 : bool done = false;
131954 0 : unsigned i=0;
131955 :
131956 : // find the first valid IR node, call visit function, and then leave
131957 0 : while ( done == false && i < SgFloatVal::pools.size() )
131958 : {
131959 : // objectArray[i] is a single memory pool
131960 : unsigned j=0;
131961 0 : while (done == false && j < SgFloatVal::pool_size)
131962 : {
131963 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
131964 : {
131965 0 : traversal.visit(&(objectArray[i][j]));
131966 0 : done = true;
131967 : }
131968 0 : j++;
131969 : }
131970 0 : i++;
131971 : }
131972 :
131973 : #if 0
131974 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
131975 : if (done == false)
131976 : {
131977 : printf ("No representative for SgFloatVal found in memory pools \n");
131978 : }
131979 : #endif
131980 : }
131981 0 : }
131982 :
131983 :
131984 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
131985 : // using values that overflow signed values of int.
131986 : size_t
131987 4 : SgFloatVal::numberOfNodes()
131988 : {
131989 : // This function traverses the memory pool for an IR node and
131990 : // counts the number of IR nodes of a particular Sage III IR
131991 : // nodes type.
131992 :
131993 4 : size_t count = 0;
131994 4 : if (SgFloatVal::pools.empty() == false)
131995 : {
131996 : // Generate an array of memory pools (this is actually a STL vector,
131997 : // but it is contiguious, so OK to treat this way).
131998 2 : SgFloatVal** objectArray = (SgFloatVal**) &(SgFloatVal::pools[0]);
131999 :
132000 : // Build a local variable for better performance (make it a loop invariant variable).
132001 2 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
132002 :
132003 : // Iterate over all of the memory pools for this IR node.
132004 4 : for (unsigned int i=0; i < SgFloatVal::pools.size(); i++)
132005 : {
132006 : // objectArray[i] is a single memory pool, iterate over all the
132007 : // IR nodes and only count those that are valid IR nodes used in
132008 : // the AST (i.e. allocated IR nodes).
132009 4002 : for (unsigned j=0; j < SgFloatVal::pool_size; j++)
132010 : {
132011 : // This is indexing the STL vector of C/C++ style arrays as a doubly
132012 : // indexed array access. It is OK since we have leveraged the semantics
132013 : // of STL vector memory as contigous and cast the memory as an array
132014 : // of arrays to use the 2D array indexing. Hope this is not confusing,
132015 : // but it s very fast as an implementation.
132016 4000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
132017 : {
132018 2 : count++;
132019 : }
132020 : }
132021 : }
132022 : }
132023 :
132024 :
132025 :
132026 4 : return count;
132027 : }
132028 :
132029 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
132030 : // using values that overflow signed values of int.
132031 : size_t
132032 0 : SgFloatVal::memoryUsage()
132033 : {
132034 : // This function is required because we need the class name as a type when we call sizeof
132035 : // There might be another way to implement this if we have a traversal that only called a
132036 : // representative object (one call for each type of Sage IIIIR node).
132037 0 : size_t memory = numberOfNodes() * sizeof(SgFloatVal);
132038 :
132039 0 : return memory;
132040 : }
132041 :
132042 : /* #line 132043 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
132043 :
132044 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
132045 : void
132046 5342 : SgDoubleVal::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
132047 : {
132048 : // This function traverses the memory pool for only a specific IR node
132049 : // and calls the visit function of the input class execute a traversal
132050 : // similar to the style of the attribute based traversals within ROSE.
132051 : // This traversal will visit ALL nodes of the AST where as the other
132052 : // attribute based traversals visit only the embedded tree within the AST.
132053 :
132054 : // Initialize array to the address of the first element of the STL vector
132055 : // (which is guaranteed to be contiguous storage).
132056 : // SgDoubleVal objectArray [] = *(Memory_Block_List.begin());
132057 5342 : if (SgDoubleVal::pools.empty() == false)
132058 : {
132059 : // Generate an array of memory pools
132060 963 : SgDoubleVal** objectArray = (SgDoubleVal**) &(SgDoubleVal::pools[0]);
132061 :
132062 : // Build a local variable for better performance
132063 963 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
132064 : #if 0
132065 : // Iterate over the memory pools
132066 : for (unsigned int i=0; i < SgDoubleVal::pools.size(); i++)
132067 : {
132068 : // objectArray[i] is a single memory pool
132069 : for (int j=0; j < SgDoubleVal::pool_size; j++)
132070 : {
132071 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
132072 : {
132073 : traversal.visit(&(objectArray[i][j]));
132074 : }
132075 : }
132076 : }
132077 : #else
132078 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
132079 : // compute the list first and then call the visit function on each list element.
132080 :
132081 : // printf ("Inside of SgDoubleVal::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
132082 :
132083 1926 : std::vector<SgDoubleVal*> nodeList;
132084 :
132085 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
132086 1926 : for (unsigned int i=0; i < SgDoubleVal::pools.size(); i++)
132087 : {
132088 : // objectArray[i] is a single memory pool
132089 1926960 : for (unsigned j=0; j < SgDoubleVal::pool_size; j++)
132090 : {
132091 1926000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
132092 : {
132093 7464 : nodeList.push_back(&(objectArray[i][j]));
132094 : }
132095 : }
132096 : }
132097 :
132098 : // Iterate over the saved list
132099 963 : size_t nodeListSize = nodeList.size();
132100 8427 : for (size_t i=0; i < nodeListSize; i++)
132101 : {
132102 7464 : ROSE_ASSERT(nodeList[i] != NULL);
132103 : #if 0
132104 : traversal.visit(nodeList[i]);
132105 : #else
132106 7464 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
132107 : {
132108 7464 : traversal.visit(nodeList[i]);
132109 : }
132110 : #endif
132111 : }
132112 : #endif
132113 : }
132114 :
132115 : // This should not be required since all previously static data members are
132116 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
132117 :
132118 5342 : }
132119 :
132120 :
132121 : void
132122 194 : SgDoubleVal::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
132123 : {
132124 : // This function traverses the memory pool for an IR node and
132125 : // calls the function to execute the visitor object.
132126 :
132127 : // Initialize array to the address of the first element of the STL vector
132128 : // (which is guarenteed to be contiguous storage).
132129 : // SgDoubleVal objectArray [] = *(Memory_Block_List.begin());
132130 194 : if (SgDoubleVal::pools.empty() == false)
132131 : {
132132 : // Generate an array of memory pools
132133 137 : SgDoubleVal** objectArray = (SgDoubleVal**) &(SgDoubleVal::pools[0]);
132134 :
132135 : // Build a local variable for better performance
132136 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
132137 :
132138 : // Iterate over the memory pools
132139 274 : for (unsigned int i=0; i < SgDoubleVal::pools.size(); i++)
132140 : {
132141 : // objectArray[i] is a single memory pool
132142 274137 : for (unsigned j=0; j < SgDoubleVal::pool_size; j++)
132143 : {
132144 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
132145 : {
132146 : // printf ("Found a valid SgDoubleVal object in the memory pool %d at position %d \n",i,j);
132147 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
132148 173 : objectArray[i][j].executeVisitorMemberFunction(visitor);
132149 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
132150 : }
132151 : else
132152 : {
132153 : // printf ("Found a INVALID SgDoubleVal object in the memory pool \n");
132154 : }
132155 : }
132156 : }
132157 : }
132158 :
132159 : // This should not be required since all previously static data members are
132160 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
132161 :
132162 194 : }
132163 :
132164 : void
132165 0 : SgDoubleVal::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
132166 : {
132167 : // This function visits only a single IR node of the memory pool.
132168 : // it is typically called once for each type of IR node within
132169 : // the automatically generated function: traverseRepresentativeNodes().
132170 :
132171 : // Initialize array to the address of the first element of the STL vector
132172 : // (which is guarenteed to be contiguous storage).
132173 : // SgDoubleVal objectArray [] = *(Memory_Block_List.begin());
132174 0 : if (SgDoubleVal::pools.empty() == false)
132175 : {
132176 : // Generate an array of memory pools
132177 0 : SgDoubleVal** objectArray = (SgDoubleVal**) &(SgDoubleVal::pools[0]);
132178 :
132179 : // Build a local variable for better performance
132180 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
132181 :
132182 : // Iterate over the memory pools
132183 0 : bool done = false;
132184 0 : unsigned i=0;
132185 :
132186 : // find the first valid IR node, call visit function, and then leave
132187 0 : while ( done == false && i < SgDoubleVal::pools.size() )
132188 : {
132189 : // objectArray[i] is a single memory pool
132190 : unsigned j=0;
132191 0 : while (done == false && j < SgDoubleVal::pool_size)
132192 : {
132193 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
132194 : {
132195 0 : traversal.visit(&(objectArray[i][j]));
132196 0 : done = true;
132197 : }
132198 0 : j++;
132199 : }
132200 0 : i++;
132201 : }
132202 :
132203 : #if 0
132204 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
132205 : if (done == false)
132206 : {
132207 : printf ("No representative for SgDoubleVal found in memory pools \n");
132208 : }
132209 : #endif
132210 : }
132211 0 : }
132212 :
132213 :
132214 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
132215 : // using values that overflow signed values of int.
132216 : size_t
132217 4 : SgDoubleVal::numberOfNodes()
132218 : {
132219 : // This function traverses the memory pool for an IR node and
132220 : // counts the number of IR nodes of a particular Sage III IR
132221 : // nodes type.
132222 :
132223 4 : size_t count = 0;
132224 4 : if (SgDoubleVal::pools.empty() == false)
132225 : {
132226 : // Generate an array of memory pools (this is actually a STL vector,
132227 : // but it is contiguious, so OK to treat this way).
132228 1 : SgDoubleVal** objectArray = (SgDoubleVal**) &(SgDoubleVal::pools[0]);
132229 :
132230 : // Build a local variable for better performance (make it a loop invariant variable).
132231 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
132232 :
132233 : // Iterate over all of the memory pools for this IR node.
132234 2 : for (unsigned int i=0; i < SgDoubleVal::pools.size(); i++)
132235 : {
132236 : // objectArray[i] is a single memory pool, iterate over all the
132237 : // IR nodes and only count those that are valid IR nodes used in
132238 : // the AST (i.e. allocated IR nodes).
132239 2001 : for (unsigned j=0; j < SgDoubleVal::pool_size; j++)
132240 : {
132241 : // This is indexing the STL vector of C/C++ style arrays as a doubly
132242 : // indexed array access. It is OK since we have leveraged the semantics
132243 : // of STL vector memory as contigous and cast the memory as an array
132244 : // of arrays to use the 2D array indexing. Hope this is not confusing,
132245 : // but it s very fast as an implementation.
132246 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
132247 : {
132248 1 : count++;
132249 : }
132250 : }
132251 : }
132252 : }
132253 :
132254 :
132255 :
132256 4 : return count;
132257 : }
132258 :
132259 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
132260 : // using values that overflow signed values of int.
132261 : size_t
132262 0 : SgDoubleVal::memoryUsage()
132263 : {
132264 : // This function is required because we need the class name as a type when we call sizeof
132265 : // There might be another way to implement this if we have a traversal that only called a
132266 : // representative object (one call for each type of Sage IIIIR node).
132267 0 : size_t memory = numberOfNodes() * sizeof(SgDoubleVal);
132268 :
132269 0 : return memory;
132270 : }
132271 :
132272 : /* #line 132273 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
132273 :
132274 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
132275 : void
132276 5342 : SgLongDoubleVal::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
132277 : {
132278 : // This function traverses the memory pool for only a specific IR node
132279 : // and calls the visit function of the input class execute a traversal
132280 : // similar to the style of the attribute based traversals within ROSE.
132281 : // This traversal will visit ALL nodes of the AST where as the other
132282 : // attribute based traversals visit only the embedded tree within the AST.
132283 :
132284 : // Initialize array to the address of the first element of the STL vector
132285 : // (which is guaranteed to be contiguous storage).
132286 : // SgLongDoubleVal objectArray [] = *(Memory_Block_List.begin());
132287 5342 : if (SgLongDoubleVal::pools.empty() == false)
132288 : {
132289 : // Generate an array of memory pools
132290 115 : SgLongDoubleVal** objectArray = (SgLongDoubleVal**) &(SgLongDoubleVal::pools[0]);
132291 :
132292 : // Build a local variable for better performance
132293 115 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
132294 : #if 0
132295 : // Iterate over the memory pools
132296 : for (unsigned int i=0; i < SgLongDoubleVal::pools.size(); i++)
132297 : {
132298 : // objectArray[i] is a single memory pool
132299 : for (int j=0; j < SgLongDoubleVal::pool_size; j++)
132300 : {
132301 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
132302 : {
132303 : traversal.visit(&(objectArray[i][j]));
132304 : }
132305 : }
132306 : }
132307 : #else
132308 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
132309 : // compute the list first and then call the visit function on each list element.
132310 :
132311 : // printf ("Inside of SgLongDoubleVal::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
132312 :
132313 230 : std::vector<SgLongDoubleVal*> nodeList;
132314 :
132315 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
132316 230 : for (unsigned int i=0; i < SgLongDoubleVal::pools.size(); i++)
132317 : {
132318 : // objectArray[i] is a single memory pool
132319 230115 : for (unsigned j=0; j < SgLongDoubleVal::pool_size; j++)
132320 : {
132321 230000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
132322 : {
132323 263 : nodeList.push_back(&(objectArray[i][j]));
132324 : }
132325 : }
132326 : }
132327 :
132328 : // Iterate over the saved list
132329 115 : size_t nodeListSize = nodeList.size();
132330 378 : for (size_t i=0; i < nodeListSize; i++)
132331 : {
132332 263 : ROSE_ASSERT(nodeList[i] != NULL);
132333 : #if 0
132334 : traversal.visit(nodeList[i]);
132335 : #else
132336 263 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
132337 : {
132338 263 : traversal.visit(nodeList[i]);
132339 : }
132340 : #endif
132341 : }
132342 : #endif
132343 : }
132344 :
132345 : // This should not be required since all previously static data members are
132346 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
132347 :
132348 5342 : }
132349 :
132350 :
132351 : void
132352 194 : SgLongDoubleVal::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
132353 : {
132354 : // This function traverses the memory pool for an IR node and
132355 : // calls the function to execute the visitor object.
132356 :
132357 : // Initialize array to the address of the first element of the STL vector
132358 : // (which is guarenteed to be contiguous storage).
132359 : // SgLongDoubleVal objectArray [] = *(Memory_Block_List.begin());
132360 194 : if (SgLongDoubleVal::pools.empty() == false)
132361 : {
132362 : // Generate an array of memory pools
132363 137 : SgLongDoubleVal** objectArray = (SgLongDoubleVal**) &(SgLongDoubleVal::pools[0]);
132364 :
132365 : // Build a local variable for better performance
132366 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
132367 :
132368 : // Iterate over the memory pools
132369 274 : for (unsigned int i=0; i < SgLongDoubleVal::pools.size(); i++)
132370 : {
132371 : // objectArray[i] is a single memory pool
132372 274137 : for (unsigned j=0; j < SgLongDoubleVal::pool_size; j++)
132373 : {
132374 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
132375 : {
132376 : // printf ("Found a valid SgLongDoubleVal object in the memory pool %d at position %d \n",i,j);
132377 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
132378 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
132379 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
132380 : }
132381 : else
132382 : {
132383 : // printf ("Found a INVALID SgLongDoubleVal object in the memory pool \n");
132384 : }
132385 : }
132386 : }
132387 : }
132388 :
132389 : // This should not be required since all previously static data members are
132390 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
132391 :
132392 194 : }
132393 :
132394 : void
132395 0 : SgLongDoubleVal::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
132396 : {
132397 : // This function visits only a single IR node of the memory pool.
132398 : // it is typically called once for each type of IR node within
132399 : // the automatically generated function: traverseRepresentativeNodes().
132400 :
132401 : // Initialize array to the address of the first element of the STL vector
132402 : // (which is guarenteed to be contiguous storage).
132403 : // SgLongDoubleVal objectArray [] = *(Memory_Block_List.begin());
132404 0 : if (SgLongDoubleVal::pools.empty() == false)
132405 : {
132406 : // Generate an array of memory pools
132407 0 : SgLongDoubleVal** objectArray = (SgLongDoubleVal**) &(SgLongDoubleVal::pools[0]);
132408 :
132409 : // Build a local variable for better performance
132410 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
132411 :
132412 : // Iterate over the memory pools
132413 0 : bool done = false;
132414 0 : unsigned i=0;
132415 :
132416 : // find the first valid IR node, call visit function, and then leave
132417 0 : while ( done == false && i < SgLongDoubleVal::pools.size() )
132418 : {
132419 : // objectArray[i] is a single memory pool
132420 : unsigned j=0;
132421 0 : while (done == false && j < SgLongDoubleVal::pool_size)
132422 : {
132423 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
132424 : {
132425 0 : traversal.visit(&(objectArray[i][j]));
132426 0 : done = true;
132427 : }
132428 0 : j++;
132429 : }
132430 0 : i++;
132431 : }
132432 :
132433 : #if 0
132434 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
132435 : if (done == false)
132436 : {
132437 : printf ("No representative for SgLongDoubleVal found in memory pools \n");
132438 : }
132439 : #endif
132440 : }
132441 0 : }
132442 :
132443 :
132444 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
132445 : // using values that overflow signed values of int.
132446 : size_t
132447 4 : SgLongDoubleVal::numberOfNodes()
132448 : {
132449 : // This function traverses the memory pool for an IR node and
132450 : // counts the number of IR nodes of a particular Sage III IR
132451 : // nodes type.
132452 :
132453 4 : size_t count = 0;
132454 4 : if (SgLongDoubleVal::pools.empty() == false)
132455 : {
132456 : // Generate an array of memory pools (this is actually a STL vector,
132457 : // but it is contiguious, so OK to treat this way).
132458 0 : SgLongDoubleVal** objectArray = (SgLongDoubleVal**) &(SgLongDoubleVal::pools[0]);
132459 :
132460 : // Build a local variable for better performance (make it a loop invariant variable).
132461 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
132462 :
132463 : // Iterate over all of the memory pools for this IR node.
132464 0 : for (unsigned int i=0; i < SgLongDoubleVal::pools.size(); i++)
132465 : {
132466 : // objectArray[i] is a single memory pool, iterate over all the
132467 : // IR nodes and only count those that are valid IR nodes used in
132468 : // the AST (i.e. allocated IR nodes).
132469 0 : for (unsigned j=0; j < SgLongDoubleVal::pool_size; j++)
132470 : {
132471 : // This is indexing the STL vector of C/C++ style arrays as a doubly
132472 : // indexed array access. It is OK since we have leveraged the semantics
132473 : // of STL vector memory as contigous and cast the memory as an array
132474 : // of arrays to use the 2D array indexing. Hope this is not confusing,
132475 : // but it s very fast as an implementation.
132476 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
132477 : {
132478 0 : count++;
132479 : }
132480 : }
132481 : }
132482 : }
132483 :
132484 :
132485 :
132486 4 : return count;
132487 : }
132488 :
132489 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
132490 : // using values that overflow signed values of int.
132491 : size_t
132492 0 : SgLongDoubleVal::memoryUsage()
132493 : {
132494 : // This function is required because we need the class name as a type when we call sizeof
132495 : // There might be another way to implement this if we have a traversal that only called a
132496 : // representative object (one call for each type of Sage IIIIR node).
132497 0 : size_t memory = numberOfNodes() * sizeof(SgLongDoubleVal);
132498 :
132499 0 : return memory;
132500 : }
132501 :
132502 : /* #line 132503 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
132503 :
132504 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
132505 : void
132506 5342 : SgComplexVal::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
132507 : {
132508 : // This function traverses the memory pool for only a specific IR node
132509 : // and calls the visit function of the input class execute a traversal
132510 : // similar to the style of the attribute based traversals within ROSE.
132511 : // This traversal will visit ALL nodes of the AST where as the other
132512 : // attribute based traversals visit only the embedded tree within the AST.
132513 :
132514 : // Initialize array to the address of the first element of the STL vector
132515 : // (which is guaranteed to be contiguous storage).
132516 : // SgComplexVal objectArray [] = *(Memory_Block_List.begin());
132517 5342 : if (SgComplexVal::pools.empty() == false)
132518 : {
132519 : // Generate an array of memory pools
132520 7 : SgComplexVal** objectArray = (SgComplexVal**) &(SgComplexVal::pools[0]);
132521 :
132522 : // Build a local variable for better performance
132523 7 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
132524 : #if 0
132525 : // Iterate over the memory pools
132526 : for (unsigned int i=0; i < SgComplexVal::pools.size(); i++)
132527 : {
132528 : // objectArray[i] is a single memory pool
132529 : for (int j=0; j < SgComplexVal::pool_size; j++)
132530 : {
132531 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
132532 : {
132533 : traversal.visit(&(objectArray[i][j]));
132534 : }
132535 : }
132536 : }
132537 : #else
132538 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
132539 : // compute the list first and then call the visit function on each list element.
132540 :
132541 : // printf ("Inside of SgComplexVal::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
132542 :
132543 14 : std::vector<SgComplexVal*> nodeList;
132544 :
132545 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
132546 14 : for (unsigned int i=0; i < SgComplexVal::pools.size(); i++)
132547 : {
132548 : // objectArray[i] is a single memory pool
132549 14007 : for (unsigned j=0; j < SgComplexVal::pool_size; j++)
132550 : {
132551 14000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
132552 : {
132553 28 : nodeList.push_back(&(objectArray[i][j]));
132554 : }
132555 : }
132556 : }
132557 :
132558 : // Iterate over the saved list
132559 7 : size_t nodeListSize = nodeList.size();
132560 35 : for (size_t i=0; i < nodeListSize; i++)
132561 : {
132562 28 : ROSE_ASSERT(nodeList[i] != NULL);
132563 : #if 0
132564 : traversal.visit(nodeList[i]);
132565 : #else
132566 28 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
132567 : {
132568 28 : traversal.visit(nodeList[i]);
132569 : }
132570 : #endif
132571 : }
132572 : #endif
132573 : }
132574 :
132575 : // This should not be required since all previously static data members are
132576 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
132577 :
132578 5342 : }
132579 :
132580 :
132581 : void
132582 194 : SgComplexVal::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
132583 : {
132584 : // This function traverses the memory pool for an IR node and
132585 : // calls the function to execute the visitor object.
132586 :
132587 : // Initialize array to the address of the first element of the STL vector
132588 : // (which is guarenteed to be contiguous storage).
132589 : // SgComplexVal objectArray [] = *(Memory_Block_List.begin());
132590 194 : if (SgComplexVal::pools.empty() == false)
132591 : {
132592 : // Generate an array of memory pools
132593 0 : SgComplexVal** objectArray = (SgComplexVal**) &(SgComplexVal::pools[0]);
132594 :
132595 : // Build a local variable for better performance
132596 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
132597 :
132598 : // Iterate over the memory pools
132599 0 : for (unsigned int i=0; i < SgComplexVal::pools.size(); i++)
132600 : {
132601 : // objectArray[i] is a single memory pool
132602 0 : for (unsigned j=0; j < SgComplexVal::pool_size; j++)
132603 : {
132604 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
132605 : {
132606 : // printf ("Found a valid SgComplexVal object in the memory pool %d at position %d \n",i,j);
132607 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
132608 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
132609 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
132610 : }
132611 : else
132612 : {
132613 : // printf ("Found a INVALID SgComplexVal object in the memory pool \n");
132614 : }
132615 : }
132616 : }
132617 : }
132618 :
132619 : // This should not be required since all previously static data members are
132620 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
132621 :
132622 194 : }
132623 :
132624 : void
132625 0 : SgComplexVal::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
132626 : {
132627 : // This function visits only a single IR node of the memory pool.
132628 : // it is typically called once for each type of IR node within
132629 : // the automatically generated function: traverseRepresentativeNodes().
132630 :
132631 : // Initialize array to the address of the first element of the STL vector
132632 : // (which is guarenteed to be contiguous storage).
132633 : // SgComplexVal objectArray [] = *(Memory_Block_List.begin());
132634 0 : if (SgComplexVal::pools.empty() == false)
132635 : {
132636 : // Generate an array of memory pools
132637 0 : SgComplexVal** objectArray = (SgComplexVal**) &(SgComplexVal::pools[0]);
132638 :
132639 : // Build a local variable for better performance
132640 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
132641 :
132642 : // Iterate over the memory pools
132643 0 : bool done = false;
132644 0 : unsigned i=0;
132645 :
132646 : // find the first valid IR node, call visit function, and then leave
132647 0 : while ( done == false && i < SgComplexVal::pools.size() )
132648 : {
132649 : // objectArray[i] is a single memory pool
132650 : unsigned j=0;
132651 0 : while (done == false && j < SgComplexVal::pool_size)
132652 : {
132653 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
132654 : {
132655 0 : traversal.visit(&(objectArray[i][j]));
132656 0 : done = true;
132657 : }
132658 0 : j++;
132659 : }
132660 0 : i++;
132661 : }
132662 :
132663 : #if 0
132664 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
132665 : if (done == false)
132666 : {
132667 : printf ("No representative for SgComplexVal found in memory pools \n");
132668 : }
132669 : #endif
132670 : }
132671 0 : }
132672 :
132673 :
132674 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
132675 : // using values that overflow signed values of int.
132676 : size_t
132677 4 : SgComplexVal::numberOfNodes()
132678 : {
132679 : // This function traverses the memory pool for an IR node and
132680 : // counts the number of IR nodes of a particular Sage III IR
132681 : // nodes type.
132682 :
132683 4 : size_t count = 0;
132684 4 : if (SgComplexVal::pools.empty() == false)
132685 : {
132686 : // Generate an array of memory pools (this is actually a STL vector,
132687 : // but it is contiguious, so OK to treat this way).
132688 0 : SgComplexVal** objectArray = (SgComplexVal**) &(SgComplexVal::pools[0]);
132689 :
132690 : // Build a local variable for better performance (make it a loop invariant variable).
132691 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
132692 :
132693 : // Iterate over all of the memory pools for this IR node.
132694 0 : for (unsigned int i=0; i < SgComplexVal::pools.size(); i++)
132695 : {
132696 : // objectArray[i] is a single memory pool, iterate over all the
132697 : // IR nodes and only count those that are valid IR nodes used in
132698 : // the AST (i.e. allocated IR nodes).
132699 0 : for (unsigned j=0; j < SgComplexVal::pool_size; j++)
132700 : {
132701 : // This is indexing the STL vector of C/C++ style arrays as a doubly
132702 : // indexed array access. It is OK since we have leveraged the semantics
132703 : // of STL vector memory as contigous and cast the memory as an array
132704 : // of arrays to use the 2D array indexing. Hope this is not confusing,
132705 : // but it s very fast as an implementation.
132706 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
132707 : {
132708 0 : count++;
132709 : }
132710 : }
132711 : }
132712 : }
132713 :
132714 :
132715 :
132716 4 : return count;
132717 : }
132718 :
132719 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
132720 : // using values that overflow signed values of int.
132721 : size_t
132722 0 : SgComplexVal::memoryUsage()
132723 : {
132724 : // This function is required because we need the class name as a type when we call sizeof
132725 : // There might be another way to implement this if we have a traversal that only called a
132726 : // representative object (one call for each type of Sage IIIIR node).
132727 0 : size_t memory = numberOfNodes() * sizeof(SgComplexVal);
132728 :
132729 0 : return memory;
132730 : }
132731 :
132732 : /* #line 132733 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
132733 :
132734 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
132735 : void
132736 5342 : SgUpcThreads::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
132737 : {
132738 : // This function traverses the memory pool for only a specific IR node
132739 : // and calls the visit function of the input class execute a traversal
132740 : // similar to the style of the attribute based traversals within ROSE.
132741 : // This traversal will visit ALL nodes of the AST where as the other
132742 : // attribute based traversals visit only the embedded tree within the AST.
132743 :
132744 : // Initialize array to the address of the first element of the STL vector
132745 : // (which is guaranteed to be contiguous storage).
132746 : // SgUpcThreads objectArray [] = *(Memory_Block_List.begin());
132747 5342 : if (SgUpcThreads::pools.empty() == false)
132748 : {
132749 : // Generate an array of memory pools
132750 0 : SgUpcThreads** objectArray = (SgUpcThreads**) &(SgUpcThreads::pools[0]);
132751 :
132752 : // Build a local variable for better performance
132753 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
132754 : #if 0
132755 : // Iterate over the memory pools
132756 : for (unsigned int i=0; i < SgUpcThreads::pools.size(); i++)
132757 : {
132758 : // objectArray[i] is a single memory pool
132759 : for (int j=0; j < SgUpcThreads::pool_size; j++)
132760 : {
132761 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
132762 : {
132763 : traversal.visit(&(objectArray[i][j]));
132764 : }
132765 : }
132766 : }
132767 : #else
132768 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
132769 : // compute the list first and then call the visit function on each list element.
132770 :
132771 : // printf ("Inside of SgUpcThreads::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
132772 :
132773 0 : std::vector<SgUpcThreads*> nodeList;
132774 :
132775 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
132776 0 : for (unsigned int i=0; i < SgUpcThreads::pools.size(); i++)
132777 : {
132778 : // objectArray[i] is a single memory pool
132779 0 : for (unsigned j=0; j < SgUpcThreads::pool_size; j++)
132780 : {
132781 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
132782 : {
132783 0 : nodeList.push_back(&(objectArray[i][j]));
132784 : }
132785 : }
132786 : }
132787 :
132788 : // Iterate over the saved list
132789 0 : size_t nodeListSize = nodeList.size();
132790 0 : for (size_t i=0; i < nodeListSize; i++)
132791 : {
132792 0 : ROSE_ASSERT(nodeList[i] != NULL);
132793 : #if 0
132794 : traversal.visit(nodeList[i]);
132795 : #else
132796 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
132797 : {
132798 0 : traversal.visit(nodeList[i]);
132799 : }
132800 : #endif
132801 : }
132802 : #endif
132803 : }
132804 :
132805 : // This should not be required since all previously static data members are
132806 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
132807 :
132808 5342 : }
132809 :
132810 :
132811 : void
132812 194 : SgUpcThreads::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
132813 : {
132814 : // This function traverses the memory pool for an IR node and
132815 : // calls the function to execute the visitor object.
132816 :
132817 : // Initialize array to the address of the first element of the STL vector
132818 : // (which is guarenteed to be contiguous storage).
132819 : // SgUpcThreads objectArray [] = *(Memory_Block_List.begin());
132820 194 : if (SgUpcThreads::pools.empty() == false)
132821 : {
132822 : // Generate an array of memory pools
132823 0 : SgUpcThreads** objectArray = (SgUpcThreads**) &(SgUpcThreads::pools[0]);
132824 :
132825 : // Build a local variable for better performance
132826 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
132827 :
132828 : // Iterate over the memory pools
132829 0 : for (unsigned int i=0; i < SgUpcThreads::pools.size(); i++)
132830 : {
132831 : // objectArray[i] is a single memory pool
132832 0 : for (unsigned j=0; j < SgUpcThreads::pool_size; j++)
132833 : {
132834 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
132835 : {
132836 : // printf ("Found a valid SgUpcThreads object in the memory pool %d at position %d \n",i,j);
132837 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
132838 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
132839 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
132840 : }
132841 : else
132842 : {
132843 : // printf ("Found a INVALID SgUpcThreads object in the memory pool \n");
132844 : }
132845 : }
132846 : }
132847 : }
132848 :
132849 : // This should not be required since all previously static data members are
132850 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
132851 :
132852 194 : }
132853 :
132854 : void
132855 0 : SgUpcThreads::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
132856 : {
132857 : // This function visits only a single IR node of the memory pool.
132858 : // it is typically called once for each type of IR node within
132859 : // the automatically generated function: traverseRepresentativeNodes().
132860 :
132861 : // Initialize array to the address of the first element of the STL vector
132862 : // (which is guarenteed to be contiguous storage).
132863 : // SgUpcThreads objectArray [] = *(Memory_Block_List.begin());
132864 0 : if (SgUpcThreads::pools.empty() == false)
132865 : {
132866 : // Generate an array of memory pools
132867 0 : SgUpcThreads** objectArray = (SgUpcThreads**) &(SgUpcThreads::pools[0]);
132868 :
132869 : // Build a local variable for better performance
132870 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
132871 :
132872 : // Iterate over the memory pools
132873 0 : bool done = false;
132874 0 : unsigned i=0;
132875 :
132876 : // find the first valid IR node, call visit function, and then leave
132877 0 : while ( done == false && i < SgUpcThreads::pools.size() )
132878 : {
132879 : // objectArray[i] is a single memory pool
132880 : unsigned j=0;
132881 0 : while (done == false && j < SgUpcThreads::pool_size)
132882 : {
132883 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
132884 : {
132885 0 : traversal.visit(&(objectArray[i][j]));
132886 0 : done = true;
132887 : }
132888 0 : j++;
132889 : }
132890 0 : i++;
132891 : }
132892 :
132893 : #if 0
132894 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
132895 : if (done == false)
132896 : {
132897 : printf ("No representative for SgUpcThreads found in memory pools \n");
132898 : }
132899 : #endif
132900 : }
132901 0 : }
132902 :
132903 :
132904 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
132905 : // using values that overflow signed values of int.
132906 : size_t
132907 4 : SgUpcThreads::numberOfNodes()
132908 : {
132909 : // This function traverses the memory pool for an IR node and
132910 : // counts the number of IR nodes of a particular Sage III IR
132911 : // nodes type.
132912 :
132913 4 : size_t count = 0;
132914 4 : if (SgUpcThreads::pools.empty() == false)
132915 : {
132916 : // Generate an array of memory pools (this is actually a STL vector,
132917 : // but it is contiguious, so OK to treat this way).
132918 0 : SgUpcThreads** objectArray = (SgUpcThreads**) &(SgUpcThreads::pools[0]);
132919 :
132920 : // Build a local variable for better performance (make it a loop invariant variable).
132921 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
132922 :
132923 : // Iterate over all of the memory pools for this IR node.
132924 0 : for (unsigned int i=0; i < SgUpcThreads::pools.size(); i++)
132925 : {
132926 : // objectArray[i] is a single memory pool, iterate over all the
132927 : // IR nodes and only count those that are valid IR nodes used in
132928 : // the AST (i.e. allocated IR nodes).
132929 0 : for (unsigned j=0; j < SgUpcThreads::pool_size; j++)
132930 : {
132931 : // This is indexing the STL vector of C/C++ style arrays as a doubly
132932 : // indexed array access. It is OK since we have leveraged the semantics
132933 : // of STL vector memory as contigous and cast the memory as an array
132934 : // of arrays to use the 2D array indexing. Hope this is not confusing,
132935 : // but it s very fast as an implementation.
132936 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
132937 : {
132938 0 : count++;
132939 : }
132940 : }
132941 : }
132942 : }
132943 :
132944 :
132945 :
132946 4 : return count;
132947 : }
132948 :
132949 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
132950 : // using values that overflow signed values of int.
132951 : size_t
132952 0 : SgUpcThreads::memoryUsage()
132953 : {
132954 : // This function is required because we need the class name as a type when we call sizeof
132955 : // There might be another way to implement this if we have a traversal that only called a
132956 : // representative object (one call for each type of Sage IIIIR node).
132957 0 : size_t memory = numberOfNodes() * sizeof(SgUpcThreads);
132958 :
132959 0 : return memory;
132960 : }
132961 :
132962 : /* #line 132963 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
132963 :
132964 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
132965 : void
132966 5342 : SgUpcMythread::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
132967 : {
132968 : // This function traverses the memory pool for only a specific IR node
132969 : // and calls the visit function of the input class execute a traversal
132970 : // similar to the style of the attribute based traversals within ROSE.
132971 : // This traversal will visit ALL nodes of the AST where as the other
132972 : // attribute based traversals visit only the embedded tree within the AST.
132973 :
132974 : // Initialize array to the address of the first element of the STL vector
132975 : // (which is guaranteed to be contiguous storage).
132976 : // SgUpcMythread objectArray [] = *(Memory_Block_List.begin());
132977 5342 : if (SgUpcMythread::pools.empty() == false)
132978 : {
132979 : // Generate an array of memory pools
132980 0 : SgUpcMythread** objectArray = (SgUpcMythread**) &(SgUpcMythread::pools[0]);
132981 :
132982 : // Build a local variable for better performance
132983 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
132984 : #if 0
132985 : // Iterate over the memory pools
132986 : for (unsigned int i=0; i < SgUpcMythread::pools.size(); i++)
132987 : {
132988 : // objectArray[i] is a single memory pool
132989 : for (int j=0; j < SgUpcMythread::pool_size; j++)
132990 : {
132991 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
132992 : {
132993 : traversal.visit(&(objectArray[i][j]));
132994 : }
132995 : }
132996 : }
132997 : #else
132998 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
132999 : // compute the list first and then call the visit function on each list element.
133000 :
133001 : // printf ("Inside of SgUpcMythread::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
133002 :
133003 0 : std::vector<SgUpcMythread*> nodeList;
133004 :
133005 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
133006 0 : for (unsigned int i=0; i < SgUpcMythread::pools.size(); i++)
133007 : {
133008 : // objectArray[i] is a single memory pool
133009 0 : for (unsigned j=0; j < SgUpcMythread::pool_size; j++)
133010 : {
133011 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
133012 : {
133013 0 : nodeList.push_back(&(objectArray[i][j]));
133014 : }
133015 : }
133016 : }
133017 :
133018 : // Iterate over the saved list
133019 0 : size_t nodeListSize = nodeList.size();
133020 0 : for (size_t i=0; i < nodeListSize; i++)
133021 : {
133022 0 : ROSE_ASSERT(nodeList[i] != NULL);
133023 : #if 0
133024 : traversal.visit(nodeList[i]);
133025 : #else
133026 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
133027 : {
133028 0 : traversal.visit(nodeList[i]);
133029 : }
133030 : #endif
133031 : }
133032 : #endif
133033 : }
133034 :
133035 : // This should not be required since all previously static data members are
133036 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
133037 :
133038 5342 : }
133039 :
133040 :
133041 : void
133042 194 : SgUpcMythread::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
133043 : {
133044 : // This function traverses the memory pool for an IR node and
133045 : // calls the function to execute the visitor object.
133046 :
133047 : // Initialize array to the address of the first element of the STL vector
133048 : // (which is guarenteed to be contiguous storage).
133049 : // SgUpcMythread objectArray [] = *(Memory_Block_List.begin());
133050 194 : if (SgUpcMythread::pools.empty() == false)
133051 : {
133052 : // Generate an array of memory pools
133053 0 : SgUpcMythread** objectArray = (SgUpcMythread**) &(SgUpcMythread::pools[0]);
133054 :
133055 : // Build a local variable for better performance
133056 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
133057 :
133058 : // Iterate over the memory pools
133059 0 : for (unsigned int i=0; i < SgUpcMythread::pools.size(); i++)
133060 : {
133061 : // objectArray[i] is a single memory pool
133062 0 : for (unsigned j=0; j < SgUpcMythread::pool_size; j++)
133063 : {
133064 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
133065 : {
133066 : // printf ("Found a valid SgUpcMythread object in the memory pool %d at position %d \n",i,j);
133067 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
133068 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
133069 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
133070 : }
133071 : else
133072 : {
133073 : // printf ("Found a INVALID SgUpcMythread object in the memory pool \n");
133074 : }
133075 : }
133076 : }
133077 : }
133078 :
133079 : // This should not be required since all previously static data members are
133080 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
133081 :
133082 194 : }
133083 :
133084 : void
133085 0 : SgUpcMythread::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
133086 : {
133087 : // This function visits only a single IR node of the memory pool.
133088 : // it is typically called once for each type of IR node within
133089 : // the automatically generated function: traverseRepresentativeNodes().
133090 :
133091 : // Initialize array to the address of the first element of the STL vector
133092 : // (which is guarenteed to be contiguous storage).
133093 : // SgUpcMythread objectArray [] = *(Memory_Block_List.begin());
133094 0 : if (SgUpcMythread::pools.empty() == false)
133095 : {
133096 : // Generate an array of memory pools
133097 0 : SgUpcMythread** objectArray = (SgUpcMythread**) &(SgUpcMythread::pools[0]);
133098 :
133099 : // Build a local variable for better performance
133100 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
133101 :
133102 : // Iterate over the memory pools
133103 0 : bool done = false;
133104 0 : unsigned i=0;
133105 :
133106 : // find the first valid IR node, call visit function, and then leave
133107 0 : while ( done == false && i < SgUpcMythread::pools.size() )
133108 : {
133109 : // objectArray[i] is a single memory pool
133110 : unsigned j=0;
133111 0 : while (done == false && j < SgUpcMythread::pool_size)
133112 : {
133113 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
133114 : {
133115 0 : traversal.visit(&(objectArray[i][j]));
133116 0 : done = true;
133117 : }
133118 0 : j++;
133119 : }
133120 0 : i++;
133121 : }
133122 :
133123 : #if 0
133124 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
133125 : if (done == false)
133126 : {
133127 : printf ("No representative for SgUpcMythread found in memory pools \n");
133128 : }
133129 : #endif
133130 : }
133131 0 : }
133132 :
133133 :
133134 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
133135 : // using values that overflow signed values of int.
133136 : size_t
133137 4 : SgUpcMythread::numberOfNodes()
133138 : {
133139 : // This function traverses the memory pool for an IR node and
133140 : // counts the number of IR nodes of a particular Sage III IR
133141 : // nodes type.
133142 :
133143 4 : size_t count = 0;
133144 4 : if (SgUpcMythread::pools.empty() == false)
133145 : {
133146 : // Generate an array of memory pools (this is actually a STL vector,
133147 : // but it is contiguious, so OK to treat this way).
133148 0 : SgUpcMythread** objectArray = (SgUpcMythread**) &(SgUpcMythread::pools[0]);
133149 :
133150 : // Build a local variable for better performance (make it a loop invariant variable).
133151 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
133152 :
133153 : // Iterate over all of the memory pools for this IR node.
133154 0 : for (unsigned int i=0; i < SgUpcMythread::pools.size(); i++)
133155 : {
133156 : // objectArray[i] is a single memory pool, iterate over all the
133157 : // IR nodes and only count those that are valid IR nodes used in
133158 : // the AST (i.e. allocated IR nodes).
133159 0 : for (unsigned j=0; j < SgUpcMythread::pool_size; j++)
133160 : {
133161 : // This is indexing the STL vector of C/C++ style arrays as a doubly
133162 : // indexed array access. It is OK since we have leveraged the semantics
133163 : // of STL vector memory as contigous and cast the memory as an array
133164 : // of arrays to use the 2D array indexing. Hope this is not confusing,
133165 : // but it s very fast as an implementation.
133166 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
133167 : {
133168 0 : count++;
133169 : }
133170 : }
133171 : }
133172 : }
133173 :
133174 :
133175 :
133176 4 : return count;
133177 : }
133178 :
133179 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
133180 : // using values that overflow signed values of int.
133181 : size_t
133182 0 : SgUpcMythread::memoryUsage()
133183 : {
133184 : // This function is required because we need the class name as a type when we call sizeof
133185 : // There might be another way to implement this if we have a traversal that only called a
133186 : // representative object (one call for each type of Sage IIIIR node).
133187 0 : size_t memory = numberOfNodes() * sizeof(SgUpcMythread);
133188 :
133189 0 : return memory;
133190 : }
133191 :
133192 : /* #line 133193 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
133193 :
133194 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
133195 : void
133196 5342 : SgTemplateParameterVal::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
133197 : {
133198 : // This function traverses the memory pool for only a specific IR node
133199 : // and calls the visit function of the input class execute a traversal
133200 : // similar to the style of the attribute based traversals within ROSE.
133201 : // This traversal will visit ALL nodes of the AST where as the other
133202 : // attribute based traversals visit only the embedded tree within the AST.
133203 :
133204 : // Initialize array to the address of the first element of the STL vector
133205 : // (which is guaranteed to be contiguous storage).
133206 : // SgTemplateParameterVal objectArray [] = *(Memory_Block_List.begin());
133207 5342 : if (SgTemplateParameterVal::pools.empty() == false)
133208 : {
133209 : // Generate an array of memory pools
133210 0 : SgTemplateParameterVal** objectArray = (SgTemplateParameterVal**) &(SgTemplateParameterVal::pools[0]);
133211 :
133212 : // Build a local variable for better performance
133213 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
133214 : #if 0
133215 : // Iterate over the memory pools
133216 : for (unsigned int i=0; i < SgTemplateParameterVal::pools.size(); i++)
133217 : {
133218 : // objectArray[i] is a single memory pool
133219 : for (int j=0; j < SgTemplateParameterVal::pool_size; j++)
133220 : {
133221 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
133222 : {
133223 : traversal.visit(&(objectArray[i][j]));
133224 : }
133225 : }
133226 : }
133227 : #else
133228 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
133229 : // compute the list first and then call the visit function on each list element.
133230 :
133231 : // printf ("Inside of SgTemplateParameterVal::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
133232 :
133233 0 : std::vector<SgTemplateParameterVal*> nodeList;
133234 :
133235 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
133236 0 : for (unsigned int i=0; i < SgTemplateParameterVal::pools.size(); i++)
133237 : {
133238 : // objectArray[i] is a single memory pool
133239 0 : for (unsigned j=0; j < SgTemplateParameterVal::pool_size; j++)
133240 : {
133241 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
133242 : {
133243 0 : nodeList.push_back(&(objectArray[i][j]));
133244 : }
133245 : }
133246 : }
133247 :
133248 : // Iterate over the saved list
133249 0 : size_t nodeListSize = nodeList.size();
133250 0 : for (size_t i=0; i < nodeListSize; i++)
133251 : {
133252 0 : ROSE_ASSERT(nodeList[i] != NULL);
133253 : #if 0
133254 : traversal.visit(nodeList[i]);
133255 : #else
133256 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
133257 : {
133258 0 : traversal.visit(nodeList[i]);
133259 : }
133260 : #endif
133261 : }
133262 : #endif
133263 : }
133264 :
133265 : // This should not be required since all previously static data members are
133266 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
133267 :
133268 5342 : }
133269 :
133270 :
133271 : void
133272 194 : SgTemplateParameterVal::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
133273 : {
133274 : // This function traverses the memory pool for an IR node and
133275 : // calls the function to execute the visitor object.
133276 :
133277 : // Initialize array to the address of the first element of the STL vector
133278 : // (which is guarenteed to be contiguous storage).
133279 : // SgTemplateParameterVal objectArray [] = *(Memory_Block_List.begin());
133280 194 : if (SgTemplateParameterVal::pools.empty() == false)
133281 : {
133282 : // Generate an array of memory pools
133283 0 : SgTemplateParameterVal** objectArray = (SgTemplateParameterVal**) &(SgTemplateParameterVal::pools[0]);
133284 :
133285 : // Build a local variable for better performance
133286 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
133287 :
133288 : // Iterate over the memory pools
133289 0 : for (unsigned int i=0; i < SgTemplateParameterVal::pools.size(); i++)
133290 : {
133291 : // objectArray[i] is a single memory pool
133292 0 : for (unsigned j=0; j < SgTemplateParameterVal::pool_size; j++)
133293 : {
133294 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
133295 : {
133296 : // printf ("Found a valid SgTemplateParameterVal object in the memory pool %d at position %d \n",i,j);
133297 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
133298 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
133299 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
133300 : }
133301 : else
133302 : {
133303 : // printf ("Found a INVALID SgTemplateParameterVal object in the memory pool \n");
133304 : }
133305 : }
133306 : }
133307 : }
133308 :
133309 : // This should not be required since all previously static data members are
133310 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
133311 :
133312 194 : }
133313 :
133314 : void
133315 0 : SgTemplateParameterVal::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
133316 : {
133317 : // This function visits only a single IR node of the memory pool.
133318 : // it is typically called once for each type of IR node within
133319 : // the automatically generated function: traverseRepresentativeNodes().
133320 :
133321 : // Initialize array to the address of the first element of the STL vector
133322 : // (which is guarenteed to be contiguous storage).
133323 : // SgTemplateParameterVal objectArray [] = *(Memory_Block_List.begin());
133324 0 : if (SgTemplateParameterVal::pools.empty() == false)
133325 : {
133326 : // Generate an array of memory pools
133327 0 : SgTemplateParameterVal** objectArray = (SgTemplateParameterVal**) &(SgTemplateParameterVal::pools[0]);
133328 :
133329 : // Build a local variable for better performance
133330 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
133331 :
133332 : // Iterate over the memory pools
133333 0 : bool done = false;
133334 0 : unsigned i=0;
133335 :
133336 : // find the first valid IR node, call visit function, and then leave
133337 0 : while ( done == false && i < SgTemplateParameterVal::pools.size() )
133338 : {
133339 : // objectArray[i] is a single memory pool
133340 : unsigned j=0;
133341 0 : while (done == false && j < SgTemplateParameterVal::pool_size)
133342 : {
133343 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
133344 : {
133345 0 : traversal.visit(&(objectArray[i][j]));
133346 0 : done = true;
133347 : }
133348 0 : j++;
133349 : }
133350 0 : i++;
133351 : }
133352 :
133353 : #if 0
133354 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
133355 : if (done == false)
133356 : {
133357 : printf ("No representative for SgTemplateParameterVal found in memory pools \n");
133358 : }
133359 : #endif
133360 : }
133361 0 : }
133362 :
133363 :
133364 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
133365 : // using values that overflow signed values of int.
133366 : size_t
133367 4 : SgTemplateParameterVal::numberOfNodes()
133368 : {
133369 : // This function traverses the memory pool for an IR node and
133370 : // counts the number of IR nodes of a particular Sage III IR
133371 : // nodes type.
133372 :
133373 4 : size_t count = 0;
133374 4 : if (SgTemplateParameterVal::pools.empty() == false)
133375 : {
133376 : // Generate an array of memory pools (this is actually a STL vector,
133377 : // but it is contiguious, so OK to treat this way).
133378 0 : SgTemplateParameterVal** objectArray = (SgTemplateParameterVal**) &(SgTemplateParameterVal::pools[0]);
133379 :
133380 : // Build a local variable for better performance (make it a loop invariant variable).
133381 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
133382 :
133383 : // Iterate over all of the memory pools for this IR node.
133384 0 : for (unsigned int i=0; i < SgTemplateParameterVal::pools.size(); i++)
133385 : {
133386 : // objectArray[i] is a single memory pool, iterate over all the
133387 : // IR nodes and only count those that are valid IR nodes used in
133388 : // the AST (i.e. allocated IR nodes).
133389 0 : for (unsigned j=0; j < SgTemplateParameterVal::pool_size; j++)
133390 : {
133391 : // This is indexing the STL vector of C/C++ style arrays as a doubly
133392 : // indexed array access. It is OK since we have leveraged the semantics
133393 : // of STL vector memory as contigous and cast the memory as an array
133394 : // of arrays to use the 2D array indexing. Hope this is not confusing,
133395 : // but it s very fast as an implementation.
133396 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
133397 : {
133398 0 : count++;
133399 : }
133400 : }
133401 : }
133402 : }
133403 :
133404 :
133405 :
133406 4 : return count;
133407 : }
133408 :
133409 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
133410 : // using values that overflow signed values of int.
133411 : size_t
133412 0 : SgTemplateParameterVal::memoryUsage()
133413 : {
133414 : // This function is required because we need the class name as a type when we call sizeof
133415 : // There might be another way to implement this if we have a traversal that only called a
133416 : // representative object (one call for each type of Sage IIIIR node).
133417 0 : size_t memory = numberOfNodes() * sizeof(SgTemplateParameterVal);
133418 :
133419 0 : return memory;
133420 : }
133421 :
133422 : /* #line 133423 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
133423 :
133424 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
133425 : void
133426 5342 : SgNullptrValExp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
133427 : {
133428 : // This function traverses the memory pool for only a specific IR node
133429 : // and calls the visit function of the input class execute a traversal
133430 : // similar to the style of the attribute based traversals within ROSE.
133431 : // This traversal will visit ALL nodes of the AST where as the other
133432 : // attribute based traversals visit only the embedded tree within the AST.
133433 :
133434 : // Initialize array to the address of the first element of the STL vector
133435 : // (which is guaranteed to be contiguous storage).
133436 : // SgNullptrValExp objectArray [] = *(Memory_Block_List.begin());
133437 5342 : if (SgNullptrValExp::pools.empty() == false)
133438 : {
133439 : // Generate an array of memory pools
133440 834 : SgNullptrValExp** objectArray = (SgNullptrValExp**) &(SgNullptrValExp::pools[0]);
133441 :
133442 : // Build a local variable for better performance
133443 834 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
133444 : #if 0
133445 : // Iterate over the memory pools
133446 : for (unsigned int i=0; i < SgNullptrValExp::pools.size(); i++)
133447 : {
133448 : // objectArray[i] is a single memory pool
133449 : for (int j=0; j < SgNullptrValExp::pool_size; j++)
133450 : {
133451 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
133452 : {
133453 : traversal.visit(&(objectArray[i][j]));
133454 : }
133455 : }
133456 : }
133457 : #else
133458 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
133459 : // compute the list first and then call the visit function on each list element.
133460 :
133461 : // printf ("Inside of SgNullptrValExp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
133462 :
133463 1668 : std::vector<SgNullptrValExp*> nodeList;
133464 :
133465 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
133466 1668 : for (unsigned int i=0; i < SgNullptrValExp::pools.size(); i++)
133467 : {
133468 : // objectArray[i] is a single memory pool
133469 1668830 : for (unsigned j=0; j < SgNullptrValExp::pool_size; j++)
133470 : {
133471 1668000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
133472 : {
133473 1743 : nodeList.push_back(&(objectArray[i][j]));
133474 : }
133475 : }
133476 : }
133477 :
133478 : // Iterate over the saved list
133479 834 : size_t nodeListSize = nodeList.size();
133480 2577 : for (size_t i=0; i < nodeListSize; i++)
133481 : {
133482 1743 : ROSE_ASSERT(nodeList[i] != NULL);
133483 : #if 0
133484 : traversal.visit(nodeList[i]);
133485 : #else
133486 1743 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
133487 : {
133488 1743 : traversal.visit(nodeList[i]);
133489 : }
133490 : #endif
133491 : }
133492 : #endif
133493 : }
133494 :
133495 : // This should not be required since all previously static data members are
133496 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
133497 :
133498 5342 : }
133499 :
133500 :
133501 : void
133502 194 : SgNullptrValExp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
133503 : {
133504 : // This function traverses the memory pool for an IR node and
133505 : // calls the function to execute the visitor object.
133506 :
133507 : // Initialize array to the address of the first element of the STL vector
133508 : // (which is guarenteed to be contiguous storage).
133509 : // SgNullptrValExp objectArray [] = *(Memory_Block_List.begin());
133510 194 : if (SgNullptrValExp::pools.empty() == false)
133511 : {
133512 : // Generate an array of memory pools
133513 194 : SgNullptrValExp** objectArray = (SgNullptrValExp**) &(SgNullptrValExp::pools[0]);
133514 :
133515 : // Build a local variable for better performance
133516 194 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
133517 :
133518 : // Iterate over the memory pools
133519 388 : for (unsigned int i=0; i < SgNullptrValExp::pools.size(); i++)
133520 : {
133521 : // objectArray[i] is a single memory pool
133522 388194 : for (unsigned j=0; j < SgNullptrValExp::pool_size; j++)
133523 : {
133524 388000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
133525 : {
133526 : // printf ("Found a valid SgNullptrValExp object in the memory pool %d at position %d \n",i,j);
133527 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
133528 951 : objectArray[i][j].executeVisitorMemberFunction(visitor);
133529 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
133530 : }
133531 : else
133532 : {
133533 : // printf ("Found a INVALID SgNullptrValExp object in the memory pool \n");
133534 : }
133535 : }
133536 : }
133537 : }
133538 :
133539 : // This should not be required since all previously static data members are
133540 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
133541 :
133542 194 : }
133543 :
133544 : void
133545 0 : SgNullptrValExp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
133546 : {
133547 : // This function visits only a single IR node of the memory pool.
133548 : // it is typically called once for each type of IR node within
133549 : // the automatically generated function: traverseRepresentativeNodes().
133550 :
133551 : // Initialize array to the address of the first element of the STL vector
133552 : // (which is guarenteed to be contiguous storage).
133553 : // SgNullptrValExp objectArray [] = *(Memory_Block_List.begin());
133554 0 : if (SgNullptrValExp::pools.empty() == false)
133555 : {
133556 : // Generate an array of memory pools
133557 0 : SgNullptrValExp** objectArray = (SgNullptrValExp**) &(SgNullptrValExp::pools[0]);
133558 :
133559 : // Build a local variable for better performance
133560 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
133561 :
133562 : // Iterate over the memory pools
133563 0 : bool done = false;
133564 0 : unsigned i=0;
133565 :
133566 : // find the first valid IR node, call visit function, and then leave
133567 0 : while ( done == false && i < SgNullptrValExp::pools.size() )
133568 : {
133569 : // objectArray[i] is a single memory pool
133570 : unsigned j=0;
133571 0 : while (done == false && j < SgNullptrValExp::pool_size)
133572 : {
133573 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
133574 : {
133575 0 : traversal.visit(&(objectArray[i][j]));
133576 0 : done = true;
133577 : }
133578 0 : j++;
133579 : }
133580 0 : i++;
133581 : }
133582 :
133583 : #if 0
133584 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
133585 : if (done == false)
133586 : {
133587 : printf ("No representative for SgNullptrValExp found in memory pools \n");
133588 : }
133589 : #endif
133590 : }
133591 0 : }
133592 :
133593 :
133594 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
133595 : // using values that overflow signed values of int.
133596 : size_t
133597 4 : SgNullptrValExp::numberOfNodes()
133598 : {
133599 : // This function traverses the memory pool for an IR node and
133600 : // counts the number of IR nodes of a particular Sage III IR
133601 : // nodes type.
133602 :
133603 4 : size_t count = 0;
133604 4 : if (SgNullptrValExp::pools.empty() == false)
133605 : {
133606 : // Generate an array of memory pools (this is actually a STL vector,
133607 : // but it is contiguious, so OK to treat this way).
133608 1 : SgNullptrValExp** objectArray = (SgNullptrValExp**) &(SgNullptrValExp::pools[0]);
133609 :
133610 : // Build a local variable for better performance (make it a loop invariant variable).
133611 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
133612 :
133613 : // Iterate over all of the memory pools for this IR node.
133614 2 : for (unsigned int i=0; i < SgNullptrValExp::pools.size(); i++)
133615 : {
133616 : // objectArray[i] is a single memory pool, iterate over all the
133617 : // IR nodes and only count those that are valid IR nodes used in
133618 : // the AST (i.e. allocated IR nodes).
133619 2001 : for (unsigned j=0; j < SgNullptrValExp::pool_size; j++)
133620 : {
133621 : // This is indexing the STL vector of C/C++ style arrays as a doubly
133622 : // indexed array access. It is OK since we have leveraged the semantics
133623 : // of STL vector memory as contigous and cast the memory as an array
133624 : // of arrays to use the 2D array indexing. Hope this is not confusing,
133625 : // but it s very fast as an implementation.
133626 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
133627 : {
133628 6 : count++;
133629 : }
133630 : }
133631 : }
133632 : }
133633 :
133634 :
133635 :
133636 4 : return count;
133637 : }
133638 :
133639 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
133640 : // using values that overflow signed values of int.
133641 : size_t
133642 0 : SgNullptrValExp::memoryUsage()
133643 : {
133644 : // This function is required because we need the class name as a type when we call sizeof
133645 : // There might be another way to implement this if we have a traversal that only called a
133646 : // representative object (one call for each type of Sage IIIIR node).
133647 0 : size_t memory = numberOfNodes() * sizeof(SgNullptrValExp);
133648 :
133649 0 : return memory;
133650 : }
133651 :
133652 : /* #line 133653 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
133653 :
133654 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
133655 : void
133656 5342 : SgChar16Val::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
133657 : {
133658 : // This function traverses the memory pool for only a specific IR node
133659 : // and calls the visit function of the input class execute a traversal
133660 : // similar to the style of the attribute based traversals within ROSE.
133661 : // This traversal will visit ALL nodes of the AST where as the other
133662 : // attribute based traversals visit only the embedded tree within the AST.
133663 :
133664 : // Initialize array to the address of the first element of the STL vector
133665 : // (which is guaranteed to be contiguous storage).
133666 : // SgChar16Val objectArray [] = *(Memory_Block_List.begin());
133667 5342 : if (SgChar16Val::pools.empty() == false)
133668 : {
133669 : // Generate an array of memory pools
133670 0 : SgChar16Val** objectArray = (SgChar16Val**) &(SgChar16Val::pools[0]);
133671 :
133672 : // Build a local variable for better performance
133673 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
133674 : #if 0
133675 : // Iterate over the memory pools
133676 : for (unsigned int i=0; i < SgChar16Val::pools.size(); i++)
133677 : {
133678 : // objectArray[i] is a single memory pool
133679 : for (int j=0; j < SgChar16Val::pool_size; j++)
133680 : {
133681 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
133682 : {
133683 : traversal.visit(&(objectArray[i][j]));
133684 : }
133685 : }
133686 : }
133687 : #else
133688 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
133689 : // compute the list first and then call the visit function on each list element.
133690 :
133691 : // printf ("Inside of SgChar16Val::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
133692 :
133693 0 : std::vector<SgChar16Val*> nodeList;
133694 :
133695 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
133696 0 : for (unsigned int i=0; i < SgChar16Val::pools.size(); i++)
133697 : {
133698 : // objectArray[i] is a single memory pool
133699 0 : for (unsigned j=0; j < SgChar16Val::pool_size; j++)
133700 : {
133701 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
133702 : {
133703 0 : nodeList.push_back(&(objectArray[i][j]));
133704 : }
133705 : }
133706 : }
133707 :
133708 : // Iterate over the saved list
133709 0 : size_t nodeListSize = nodeList.size();
133710 0 : for (size_t i=0; i < nodeListSize; i++)
133711 : {
133712 0 : ROSE_ASSERT(nodeList[i] != NULL);
133713 : #if 0
133714 : traversal.visit(nodeList[i]);
133715 : #else
133716 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
133717 : {
133718 0 : traversal.visit(nodeList[i]);
133719 : }
133720 : #endif
133721 : }
133722 : #endif
133723 : }
133724 :
133725 : // This should not be required since all previously static data members are
133726 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
133727 :
133728 5342 : }
133729 :
133730 :
133731 : void
133732 194 : SgChar16Val::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
133733 : {
133734 : // This function traverses the memory pool for an IR node and
133735 : // calls the function to execute the visitor object.
133736 :
133737 : // Initialize array to the address of the first element of the STL vector
133738 : // (which is guarenteed to be contiguous storage).
133739 : // SgChar16Val objectArray [] = *(Memory_Block_List.begin());
133740 194 : if (SgChar16Val::pools.empty() == false)
133741 : {
133742 : // Generate an array of memory pools
133743 0 : SgChar16Val** objectArray = (SgChar16Val**) &(SgChar16Val::pools[0]);
133744 :
133745 : // Build a local variable for better performance
133746 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
133747 :
133748 : // Iterate over the memory pools
133749 0 : for (unsigned int i=0; i < SgChar16Val::pools.size(); i++)
133750 : {
133751 : // objectArray[i] is a single memory pool
133752 0 : for (unsigned j=0; j < SgChar16Val::pool_size; j++)
133753 : {
133754 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
133755 : {
133756 : // printf ("Found a valid SgChar16Val object in the memory pool %d at position %d \n",i,j);
133757 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
133758 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
133759 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
133760 : }
133761 : else
133762 : {
133763 : // printf ("Found a INVALID SgChar16Val object in the memory pool \n");
133764 : }
133765 : }
133766 : }
133767 : }
133768 :
133769 : // This should not be required since all previously static data members are
133770 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
133771 :
133772 194 : }
133773 :
133774 : void
133775 0 : SgChar16Val::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
133776 : {
133777 : // This function visits only a single IR node of the memory pool.
133778 : // it is typically called once for each type of IR node within
133779 : // the automatically generated function: traverseRepresentativeNodes().
133780 :
133781 : // Initialize array to the address of the first element of the STL vector
133782 : // (which is guarenteed to be contiguous storage).
133783 : // SgChar16Val objectArray [] = *(Memory_Block_List.begin());
133784 0 : if (SgChar16Val::pools.empty() == false)
133785 : {
133786 : // Generate an array of memory pools
133787 0 : SgChar16Val** objectArray = (SgChar16Val**) &(SgChar16Val::pools[0]);
133788 :
133789 : // Build a local variable for better performance
133790 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
133791 :
133792 : // Iterate over the memory pools
133793 0 : bool done = false;
133794 0 : unsigned i=0;
133795 :
133796 : // find the first valid IR node, call visit function, and then leave
133797 0 : while ( done == false && i < SgChar16Val::pools.size() )
133798 : {
133799 : // objectArray[i] is a single memory pool
133800 : unsigned j=0;
133801 0 : while (done == false && j < SgChar16Val::pool_size)
133802 : {
133803 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
133804 : {
133805 0 : traversal.visit(&(objectArray[i][j]));
133806 0 : done = true;
133807 : }
133808 0 : j++;
133809 : }
133810 0 : i++;
133811 : }
133812 :
133813 : #if 0
133814 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
133815 : if (done == false)
133816 : {
133817 : printf ("No representative for SgChar16Val found in memory pools \n");
133818 : }
133819 : #endif
133820 : }
133821 0 : }
133822 :
133823 :
133824 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
133825 : // using values that overflow signed values of int.
133826 : size_t
133827 4 : SgChar16Val::numberOfNodes()
133828 : {
133829 : // This function traverses the memory pool for an IR node and
133830 : // counts the number of IR nodes of a particular Sage III IR
133831 : // nodes type.
133832 :
133833 4 : size_t count = 0;
133834 4 : if (SgChar16Val::pools.empty() == false)
133835 : {
133836 : // Generate an array of memory pools (this is actually a STL vector,
133837 : // but it is contiguious, so OK to treat this way).
133838 0 : SgChar16Val** objectArray = (SgChar16Val**) &(SgChar16Val::pools[0]);
133839 :
133840 : // Build a local variable for better performance (make it a loop invariant variable).
133841 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
133842 :
133843 : // Iterate over all of the memory pools for this IR node.
133844 0 : for (unsigned int i=0; i < SgChar16Val::pools.size(); i++)
133845 : {
133846 : // objectArray[i] is a single memory pool, iterate over all the
133847 : // IR nodes and only count those that are valid IR nodes used in
133848 : // the AST (i.e. allocated IR nodes).
133849 0 : for (unsigned j=0; j < SgChar16Val::pool_size; j++)
133850 : {
133851 : // This is indexing the STL vector of C/C++ style arrays as a doubly
133852 : // indexed array access. It is OK since we have leveraged the semantics
133853 : // of STL vector memory as contigous and cast the memory as an array
133854 : // of arrays to use the 2D array indexing. Hope this is not confusing,
133855 : // but it s very fast as an implementation.
133856 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
133857 : {
133858 0 : count++;
133859 : }
133860 : }
133861 : }
133862 : }
133863 :
133864 :
133865 :
133866 4 : return count;
133867 : }
133868 :
133869 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
133870 : // using values that overflow signed values of int.
133871 : size_t
133872 0 : SgChar16Val::memoryUsage()
133873 : {
133874 : // This function is required because we need the class name as a type when we call sizeof
133875 : // There might be another way to implement this if we have a traversal that only called a
133876 : // representative object (one call for each type of Sage IIIIR node).
133877 0 : size_t memory = numberOfNodes() * sizeof(SgChar16Val);
133878 :
133879 0 : return memory;
133880 : }
133881 :
133882 : /* #line 133883 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
133883 :
133884 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
133885 : void
133886 5342 : SgChar32Val::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
133887 : {
133888 : // This function traverses the memory pool for only a specific IR node
133889 : // and calls the visit function of the input class execute a traversal
133890 : // similar to the style of the attribute based traversals within ROSE.
133891 : // This traversal will visit ALL nodes of the AST where as the other
133892 : // attribute based traversals visit only the embedded tree within the AST.
133893 :
133894 : // Initialize array to the address of the first element of the STL vector
133895 : // (which is guaranteed to be contiguous storage).
133896 : // SgChar32Val objectArray [] = *(Memory_Block_List.begin());
133897 5342 : if (SgChar32Val::pools.empty() == false)
133898 : {
133899 : // Generate an array of memory pools
133900 0 : SgChar32Val** objectArray = (SgChar32Val**) &(SgChar32Val::pools[0]);
133901 :
133902 : // Build a local variable for better performance
133903 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
133904 : #if 0
133905 : // Iterate over the memory pools
133906 : for (unsigned int i=0; i < SgChar32Val::pools.size(); i++)
133907 : {
133908 : // objectArray[i] is a single memory pool
133909 : for (int j=0; j < SgChar32Val::pool_size; j++)
133910 : {
133911 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
133912 : {
133913 : traversal.visit(&(objectArray[i][j]));
133914 : }
133915 : }
133916 : }
133917 : #else
133918 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
133919 : // compute the list first and then call the visit function on each list element.
133920 :
133921 : // printf ("Inside of SgChar32Val::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
133922 :
133923 0 : std::vector<SgChar32Val*> nodeList;
133924 :
133925 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
133926 0 : for (unsigned int i=0; i < SgChar32Val::pools.size(); i++)
133927 : {
133928 : // objectArray[i] is a single memory pool
133929 0 : for (unsigned j=0; j < SgChar32Val::pool_size; j++)
133930 : {
133931 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
133932 : {
133933 0 : nodeList.push_back(&(objectArray[i][j]));
133934 : }
133935 : }
133936 : }
133937 :
133938 : // Iterate over the saved list
133939 0 : size_t nodeListSize = nodeList.size();
133940 0 : for (size_t i=0; i < nodeListSize; i++)
133941 : {
133942 0 : ROSE_ASSERT(nodeList[i] != NULL);
133943 : #if 0
133944 : traversal.visit(nodeList[i]);
133945 : #else
133946 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
133947 : {
133948 0 : traversal.visit(nodeList[i]);
133949 : }
133950 : #endif
133951 : }
133952 : #endif
133953 : }
133954 :
133955 : // This should not be required since all previously static data members are
133956 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
133957 :
133958 5342 : }
133959 :
133960 :
133961 : void
133962 194 : SgChar32Val::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
133963 : {
133964 : // This function traverses the memory pool for an IR node and
133965 : // calls the function to execute the visitor object.
133966 :
133967 : // Initialize array to the address of the first element of the STL vector
133968 : // (which is guarenteed to be contiguous storage).
133969 : // SgChar32Val objectArray [] = *(Memory_Block_List.begin());
133970 194 : if (SgChar32Val::pools.empty() == false)
133971 : {
133972 : // Generate an array of memory pools
133973 0 : SgChar32Val** objectArray = (SgChar32Val**) &(SgChar32Val::pools[0]);
133974 :
133975 : // Build a local variable for better performance
133976 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
133977 :
133978 : // Iterate over the memory pools
133979 0 : for (unsigned int i=0; i < SgChar32Val::pools.size(); i++)
133980 : {
133981 : // objectArray[i] is a single memory pool
133982 0 : for (unsigned j=0; j < SgChar32Val::pool_size; j++)
133983 : {
133984 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
133985 : {
133986 : // printf ("Found a valid SgChar32Val object in the memory pool %d at position %d \n",i,j);
133987 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
133988 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
133989 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
133990 : }
133991 : else
133992 : {
133993 : // printf ("Found a INVALID SgChar32Val object in the memory pool \n");
133994 : }
133995 : }
133996 : }
133997 : }
133998 :
133999 : // This should not be required since all previously static data members are
134000 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
134001 :
134002 194 : }
134003 :
134004 : void
134005 0 : SgChar32Val::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
134006 : {
134007 : // This function visits only a single IR node of the memory pool.
134008 : // it is typically called once for each type of IR node within
134009 : // the automatically generated function: traverseRepresentativeNodes().
134010 :
134011 : // Initialize array to the address of the first element of the STL vector
134012 : // (which is guarenteed to be contiguous storage).
134013 : // SgChar32Val objectArray [] = *(Memory_Block_List.begin());
134014 0 : if (SgChar32Val::pools.empty() == false)
134015 : {
134016 : // Generate an array of memory pools
134017 0 : SgChar32Val** objectArray = (SgChar32Val**) &(SgChar32Val::pools[0]);
134018 :
134019 : // Build a local variable for better performance
134020 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
134021 :
134022 : // Iterate over the memory pools
134023 0 : bool done = false;
134024 0 : unsigned i=0;
134025 :
134026 : // find the first valid IR node, call visit function, and then leave
134027 0 : while ( done == false && i < SgChar32Val::pools.size() )
134028 : {
134029 : // objectArray[i] is a single memory pool
134030 : unsigned j=0;
134031 0 : while (done == false && j < SgChar32Val::pool_size)
134032 : {
134033 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
134034 : {
134035 0 : traversal.visit(&(objectArray[i][j]));
134036 0 : done = true;
134037 : }
134038 0 : j++;
134039 : }
134040 0 : i++;
134041 : }
134042 :
134043 : #if 0
134044 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
134045 : if (done == false)
134046 : {
134047 : printf ("No representative for SgChar32Val found in memory pools \n");
134048 : }
134049 : #endif
134050 : }
134051 0 : }
134052 :
134053 :
134054 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
134055 : // using values that overflow signed values of int.
134056 : size_t
134057 4 : SgChar32Val::numberOfNodes()
134058 : {
134059 : // This function traverses the memory pool for an IR node and
134060 : // counts the number of IR nodes of a particular Sage III IR
134061 : // nodes type.
134062 :
134063 4 : size_t count = 0;
134064 4 : if (SgChar32Val::pools.empty() == false)
134065 : {
134066 : // Generate an array of memory pools (this is actually a STL vector,
134067 : // but it is contiguious, so OK to treat this way).
134068 0 : SgChar32Val** objectArray = (SgChar32Val**) &(SgChar32Val::pools[0]);
134069 :
134070 : // Build a local variable for better performance (make it a loop invariant variable).
134071 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
134072 :
134073 : // Iterate over all of the memory pools for this IR node.
134074 0 : for (unsigned int i=0; i < SgChar32Val::pools.size(); i++)
134075 : {
134076 : // objectArray[i] is a single memory pool, iterate over all the
134077 : // IR nodes and only count those that are valid IR nodes used in
134078 : // the AST (i.e. allocated IR nodes).
134079 0 : for (unsigned j=0; j < SgChar32Val::pool_size; j++)
134080 : {
134081 : // This is indexing the STL vector of C/C++ style arrays as a doubly
134082 : // indexed array access. It is OK since we have leveraged the semantics
134083 : // of STL vector memory as contigous and cast the memory as an array
134084 : // of arrays to use the 2D array indexing. Hope this is not confusing,
134085 : // but it s very fast as an implementation.
134086 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
134087 : {
134088 0 : count++;
134089 : }
134090 : }
134091 : }
134092 : }
134093 :
134094 :
134095 :
134096 4 : return count;
134097 : }
134098 :
134099 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
134100 : // using values that overflow signed values of int.
134101 : size_t
134102 0 : SgChar32Val::memoryUsage()
134103 : {
134104 : // This function is required because we need the class name as a type when we call sizeof
134105 : // There might be another way to implement this if we have a traversal that only called a
134106 : // representative object (one call for each type of Sage IIIIR node).
134107 0 : size_t memory = numberOfNodes() * sizeof(SgChar32Val);
134108 :
134109 0 : return memory;
134110 : }
134111 :
134112 : /* #line 134113 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
134113 :
134114 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
134115 : void
134116 5342 : SgFloat80Val::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
134117 : {
134118 : // This function traverses the memory pool for only a specific IR node
134119 : // and calls the visit function of the input class execute a traversal
134120 : // similar to the style of the attribute based traversals within ROSE.
134121 : // This traversal will visit ALL nodes of the AST where as the other
134122 : // attribute based traversals visit only the embedded tree within the AST.
134123 :
134124 : // Initialize array to the address of the first element of the STL vector
134125 : // (which is guaranteed to be contiguous storage).
134126 : // SgFloat80Val objectArray [] = *(Memory_Block_List.begin());
134127 5342 : if (SgFloat80Val::pools.empty() == false)
134128 : {
134129 : // Generate an array of memory pools
134130 0 : SgFloat80Val** objectArray = (SgFloat80Val**) &(SgFloat80Val::pools[0]);
134131 :
134132 : // Build a local variable for better performance
134133 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
134134 : #if 0
134135 : // Iterate over the memory pools
134136 : for (unsigned int i=0; i < SgFloat80Val::pools.size(); i++)
134137 : {
134138 : // objectArray[i] is a single memory pool
134139 : for (int j=0; j < SgFloat80Val::pool_size; j++)
134140 : {
134141 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
134142 : {
134143 : traversal.visit(&(objectArray[i][j]));
134144 : }
134145 : }
134146 : }
134147 : #else
134148 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
134149 : // compute the list first and then call the visit function on each list element.
134150 :
134151 : // printf ("Inside of SgFloat80Val::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
134152 :
134153 0 : std::vector<SgFloat80Val*> nodeList;
134154 :
134155 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
134156 0 : for (unsigned int i=0; i < SgFloat80Val::pools.size(); i++)
134157 : {
134158 : // objectArray[i] is a single memory pool
134159 0 : for (unsigned j=0; j < SgFloat80Val::pool_size; j++)
134160 : {
134161 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
134162 : {
134163 0 : nodeList.push_back(&(objectArray[i][j]));
134164 : }
134165 : }
134166 : }
134167 :
134168 : // Iterate over the saved list
134169 0 : size_t nodeListSize = nodeList.size();
134170 0 : for (size_t i=0; i < nodeListSize; i++)
134171 : {
134172 0 : ROSE_ASSERT(nodeList[i] != NULL);
134173 : #if 0
134174 : traversal.visit(nodeList[i]);
134175 : #else
134176 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
134177 : {
134178 0 : traversal.visit(nodeList[i]);
134179 : }
134180 : #endif
134181 : }
134182 : #endif
134183 : }
134184 :
134185 : // This should not be required since all previously static data members are
134186 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
134187 :
134188 5342 : }
134189 :
134190 :
134191 : void
134192 194 : SgFloat80Val::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
134193 : {
134194 : // This function traverses the memory pool for an IR node and
134195 : // calls the function to execute the visitor object.
134196 :
134197 : // Initialize array to the address of the first element of the STL vector
134198 : // (which is guarenteed to be contiguous storage).
134199 : // SgFloat80Val objectArray [] = *(Memory_Block_List.begin());
134200 194 : if (SgFloat80Val::pools.empty() == false)
134201 : {
134202 : // Generate an array of memory pools
134203 0 : SgFloat80Val** objectArray = (SgFloat80Val**) &(SgFloat80Val::pools[0]);
134204 :
134205 : // Build a local variable for better performance
134206 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
134207 :
134208 : // Iterate over the memory pools
134209 0 : for (unsigned int i=0; i < SgFloat80Val::pools.size(); i++)
134210 : {
134211 : // objectArray[i] is a single memory pool
134212 0 : for (unsigned j=0; j < SgFloat80Val::pool_size; j++)
134213 : {
134214 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
134215 : {
134216 : // printf ("Found a valid SgFloat80Val object in the memory pool %d at position %d \n",i,j);
134217 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
134218 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
134219 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
134220 : }
134221 : else
134222 : {
134223 : // printf ("Found a INVALID SgFloat80Val object in the memory pool \n");
134224 : }
134225 : }
134226 : }
134227 : }
134228 :
134229 : // This should not be required since all previously static data members are
134230 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
134231 :
134232 194 : }
134233 :
134234 : void
134235 0 : SgFloat80Val::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
134236 : {
134237 : // This function visits only a single IR node of the memory pool.
134238 : // it is typically called once for each type of IR node within
134239 : // the automatically generated function: traverseRepresentativeNodes().
134240 :
134241 : // Initialize array to the address of the first element of the STL vector
134242 : // (which is guarenteed to be contiguous storage).
134243 : // SgFloat80Val objectArray [] = *(Memory_Block_List.begin());
134244 0 : if (SgFloat80Val::pools.empty() == false)
134245 : {
134246 : // Generate an array of memory pools
134247 0 : SgFloat80Val** objectArray = (SgFloat80Val**) &(SgFloat80Val::pools[0]);
134248 :
134249 : // Build a local variable for better performance
134250 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
134251 :
134252 : // Iterate over the memory pools
134253 0 : bool done = false;
134254 0 : unsigned i=0;
134255 :
134256 : // find the first valid IR node, call visit function, and then leave
134257 0 : while ( done == false && i < SgFloat80Val::pools.size() )
134258 : {
134259 : // objectArray[i] is a single memory pool
134260 : unsigned j=0;
134261 0 : while (done == false && j < SgFloat80Val::pool_size)
134262 : {
134263 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
134264 : {
134265 0 : traversal.visit(&(objectArray[i][j]));
134266 0 : done = true;
134267 : }
134268 0 : j++;
134269 : }
134270 0 : i++;
134271 : }
134272 :
134273 : #if 0
134274 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
134275 : if (done == false)
134276 : {
134277 : printf ("No representative for SgFloat80Val found in memory pools \n");
134278 : }
134279 : #endif
134280 : }
134281 0 : }
134282 :
134283 :
134284 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
134285 : // using values that overflow signed values of int.
134286 : size_t
134287 4 : SgFloat80Val::numberOfNodes()
134288 : {
134289 : // This function traverses the memory pool for an IR node and
134290 : // counts the number of IR nodes of a particular Sage III IR
134291 : // nodes type.
134292 :
134293 4 : size_t count = 0;
134294 4 : if (SgFloat80Val::pools.empty() == false)
134295 : {
134296 : // Generate an array of memory pools (this is actually a STL vector,
134297 : // but it is contiguious, so OK to treat this way).
134298 0 : SgFloat80Val** objectArray = (SgFloat80Val**) &(SgFloat80Val::pools[0]);
134299 :
134300 : // Build a local variable for better performance (make it a loop invariant variable).
134301 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
134302 :
134303 : // Iterate over all of the memory pools for this IR node.
134304 0 : for (unsigned int i=0; i < SgFloat80Val::pools.size(); i++)
134305 : {
134306 : // objectArray[i] is a single memory pool, iterate over all the
134307 : // IR nodes and only count those that are valid IR nodes used in
134308 : // the AST (i.e. allocated IR nodes).
134309 0 : for (unsigned j=0; j < SgFloat80Val::pool_size; j++)
134310 : {
134311 : // This is indexing the STL vector of C/C++ style arrays as a doubly
134312 : // indexed array access. It is OK since we have leveraged the semantics
134313 : // of STL vector memory as contigous and cast the memory as an array
134314 : // of arrays to use the 2D array indexing. Hope this is not confusing,
134315 : // but it s very fast as an implementation.
134316 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
134317 : {
134318 0 : count++;
134319 : }
134320 : }
134321 : }
134322 : }
134323 :
134324 :
134325 :
134326 4 : return count;
134327 : }
134328 :
134329 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
134330 : // using values that overflow signed values of int.
134331 : size_t
134332 0 : SgFloat80Val::memoryUsage()
134333 : {
134334 : // This function is required because we need the class name as a type when we call sizeof
134335 : // There might be another way to implement this if we have a traversal that only called a
134336 : // representative object (one call for each type of Sage IIIIR node).
134337 0 : size_t memory = numberOfNodes() * sizeof(SgFloat80Val);
134338 :
134339 0 : return memory;
134340 : }
134341 :
134342 : /* #line 134343 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
134343 :
134344 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
134345 : void
134346 5342 : SgFloat128Val::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
134347 : {
134348 : // This function traverses the memory pool for only a specific IR node
134349 : // and calls the visit function of the input class execute a traversal
134350 : // similar to the style of the attribute based traversals within ROSE.
134351 : // This traversal will visit ALL nodes of the AST where as the other
134352 : // attribute based traversals visit only the embedded tree within the AST.
134353 :
134354 : // Initialize array to the address of the first element of the STL vector
134355 : // (which is guaranteed to be contiguous storage).
134356 : // SgFloat128Val objectArray [] = *(Memory_Block_List.begin());
134357 5342 : if (SgFloat128Val::pools.empty() == false)
134358 : {
134359 : // Generate an array of memory pools
134360 0 : SgFloat128Val** objectArray = (SgFloat128Val**) &(SgFloat128Val::pools[0]);
134361 :
134362 : // Build a local variable for better performance
134363 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
134364 : #if 0
134365 : // Iterate over the memory pools
134366 : for (unsigned int i=0; i < SgFloat128Val::pools.size(); i++)
134367 : {
134368 : // objectArray[i] is a single memory pool
134369 : for (int j=0; j < SgFloat128Val::pool_size; j++)
134370 : {
134371 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
134372 : {
134373 : traversal.visit(&(objectArray[i][j]));
134374 : }
134375 : }
134376 : }
134377 : #else
134378 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
134379 : // compute the list first and then call the visit function on each list element.
134380 :
134381 : // printf ("Inside of SgFloat128Val::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
134382 :
134383 0 : std::vector<SgFloat128Val*> nodeList;
134384 :
134385 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
134386 0 : for (unsigned int i=0; i < SgFloat128Val::pools.size(); i++)
134387 : {
134388 : // objectArray[i] is a single memory pool
134389 0 : for (unsigned j=0; j < SgFloat128Val::pool_size; j++)
134390 : {
134391 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
134392 : {
134393 0 : nodeList.push_back(&(objectArray[i][j]));
134394 : }
134395 : }
134396 : }
134397 :
134398 : // Iterate over the saved list
134399 0 : size_t nodeListSize = nodeList.size();
134400 0 : for (size_t i=0; i < nodeListSize; i++)
134401 : {
134402 0 : ROSE_ASSERT(nodeList[i] != NULL);
134403 : #if 0
134404 : traversal.visit(nodeList[i]);
134405 : #else
134406 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
134407 : {
134408 0 : traversal.visit(nodeList[i]);
134409 : }
134410 : #endif
134411 : }
134412 : #endif
134413 : }
134414 :
134415 : // This should not be required since all previously static data members are
134416 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
134417 :
134418 5342 : }
134419 :
134420 :
134421 : void
134422 194 : SgFloat128Val::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
134423 : {
134424 : // This function traverses the memory pool for an IR node and
134425 : // calls the function to execute the visitor object.
134426 :
134427 : // Initialize array to the address of the first element of the STL vector
134428 : // (which is guarenteed to be contiguous storage).
134429 : // SgFloat128Val objectArray [] = *(Memory_Block_List.begin());
134430 194 : if (SgFloat128Val::pools.empty() == false)
134431 : {
134432 : // Generate an array of memory pools
134433 0 : SgFloat128Val** objectArray = (SgFloat128Val**) &(SgFloat128Val::pools[0]);
134434 :
134435 : // Build a local variable for better performance
134436 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
134437 :
134438 : // Iterate over the memory pools
134439 0 : for (unsigned int i=0; i < SgFloat128Val::pools.size(); i++)
134440 : {
134441 : // objectArray[i] is a single memory pool
134442 0 : for (unsigned j=0; j < SgFloat128Val::pool_size; j++)
134443 : {
134444 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
134445 : {
134446 : // printf ("Found a valid SgFloat128Val object in the memory pool %d at position %d \n",i,j);
134447 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
134448 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
134449 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
134450 : }
134451 : else
134452 : {
134453 : // printf ("Found a INVALID SgFloat128Val object in the memory pool \n");
134454 : }
134455 : }
134456 : }
134457 : }
134458 :
134459 : // This should not be required since all previously static data members are
134460 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
134461 :
134462 194 : }
134463 :
134464 : void
134465 0 : SgFloat128Val::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
134466 : {
134467 : // This function visits only a single IR node of the memory pool.
134468 : // it is typically called once for each type of IR node within
134469 : // the automatically generated function: traverseRepresentativeNodes().
134470 :
134471 : // Initialize array to the address of the first element of the STL vector
134472 : // (which is guarenteed to be contiguous storage).
134473 : // SgFloat128Val objectArray [] = *(Memory_Block_List.begin());
134474 0 : if (SgFloat128Val::pools.empty() == false)
134475 : {
134476 : // Generate an array of memory pools
134477 0 : SgFloat128Val** objectArray = (SgFloat128Val**) &(SgFloat128Val::pools[0]);
134478 :
134479 : // Build a local variable for better performance
134480 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
134481 :
134482 : // Iterate over the memory pools
134483 0 : bool done = false;
134484 0 : unsigned i=0;
134485 :
134486 : // find the first valid IR node, call visit function, and then leave
134487 0 : while ( done == false && i < SgFloat128Val::pools.size() )
134488 : {
134489 : // objectArray[i] is a single memory pool
134490 : unsigned j=0;
134491 0 : while (done == false && j < SgFloat128Val::pool_size)
134492 : {
134493 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
134494 : {
134495 0 : traversal.visit(&(objectArray[i][j]));
134496 0 : done = true;
134497 : }
134498 0 : j++;
134499 : }
134500 0 : i++;
134501 : }
134502 :
134503 : #if 0
134504 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
134505 : if (done == false)
134506 : {
134507 : printf ("No representative for SgFloat128Val found in memory pools \n");
134508 : }
134509 : #endif
134510 : }
134511 0 : }
134512 :
134513 :
134514 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
134515 : // using values that overflow signed values of int.
134516 : size_t
134517 4 : SgFloat128Val::numberOfNodes()
134518 : {
134519 : // This function traverses the memory pool for an IR node and
134520 : // counts the number of IR nodes of a particular Sage III IR
134521 : // nodes type.
134522 :
134523 4 : size_t count = 0;
134524 4 : if (SgFloat128Val::pools.empty() == false)
134525 : {
134526 : // Generate an array of memory pools (this is actually a STL vector,
134527 : // but it is contiguious, so OK to treat this way).
134528 0 : SgFloat128Val** objectArray = (SgFloat128Val**) &(SgFloat128Val::pools[0]);
134529 :
134530 : // Build a local variable for better performance (make it a loop invariant variable).
134531 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
134532 :
134533 : // Iterate over all of the memory pools for this IR node.
134534 0 : for (unsigned int i=0; i < SgFloat128Val::pools.size(); i++)
134535 : {
134536 : // objectArray[i] is a single memory pool, iterate over all the
134537 : // IR nodes and only count those that are valid IR nodes used in
134538 : // the AST (i.e. allocated IR nodes).
134539 0 : for (unsigned j=0; j < SgFloat128Val::pool_size; j++)
134540 : {
134541 : // This is indexing the STL vector of C/C++ style arrays as a doubly
134542 : // indexed array access. It is OK since we have leveraged the semantics
134543 : // of STL vector memory as contigous and cast the memory as an array
134544 : // of arrays to use the 2D array indexing. Hope this is not confusing,
134545 : // but it s very fast as an implementation.
134546 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
134547 : {
134548 0 : count++;
134549 : }
134550 : }
134551 : }
134552 : }
134553 :
134554 :
134555 :
134556 4 : return count;
134557 : }
134558 :
134559 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
134560 : // using values that overflow signed values of int.
134561 : size_t
134562 0 : SgFloat128Val::memoryUsage()
134563 : {
134564 : // This function is required because we need the class name as a type when we call sizeof
134565 : // There might be another way to implement this if we have a traversal that only called a
134566 : // representative object (one call for each type of Sage IIIIR node).
134567 0 : size_t memory = numberOfNodes() * sizeof(SgFloat128Val);
134568 :
134569 0 : return memory;
134570 : }
134571 :
134572 : /* #line 134573 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
134573 :
134574 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
134575 : void
134576 5342 : SgVoidVal::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
134577 : {
134578 : // This function traverses the memory pool for only a specific IR node
134579 : // and calls the visit function of the input class execute a traversal
134580 : // similar to the style of the attribute based traversals within ROSE.
134581 : // This traversal will visit ALL nodes of the AST where as the other
134582 : // attribute based traversals visit only the embedded tree within the AST.
134583 :
134584 : // Initialize array to the address of the first element of the STL vector
134585 : // (which is guaranteed to be contiguous storage).
134586 : // SgVoidVal objectArray [] = *(Memory_Block_List.begin());
134587 5342 : if (SgVoidVal::pools.empty() == false)
134588 : {
134589 : // Generate an array of memory pools
134590 0 : SgVoidVal** objectArray = (SgVoidVal**) &(SgVoidVal::pools[0]);
134591 :
134592 : // Build a local variable for better performance
134593 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
134594 : #if 0
134595 : // Iterate over the memory pools
134596 : for (unsigned int i=0; i < SgVoidVal::pools.size(); i++)
134597 : {
134598 : // objectArray[i] is a single memory pool
134599 : for (int j=0; j < SgVoidVal::pool_size; j++)
134600 : {
134601 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
134602 : {
134603 : traversal.visit(&(objectArray[i][j]));
134604 : }
134605 : }
134606 : }
134607 : #else
134608 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
134609 : // compute the list first and then call the visit function on each list element.
134610 :
134611 : // printf ("Inside of SgVoidVal::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
134612 :
134613 0 : std::vector<SgVoidVal*> nodeList;
134614 :
134615 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
134616 0 : for (unsigned int i=0; i < SgVoidVal::pools.size(); i++)
134617 : {
134618 : // objectArray[i] is a single memory pool
134619 0 : for (unsigned j=0; j < SgVoidVal::pool_size; j++)
134620 : {
134621 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
134622 : {
134623 0 : nodeList.push_back(&(objectArray[i][j]));
134624 : }
134625 : }
134626 : }
134627 :
134628 : // Iterate over the saved list
134629 0 : size_t nodeListSize = nodeList.size();
134630 0 : for (size_t i=0; i < nodeListSize; i++)
134631 : {
134632 0 : ROSE_ASSERT(nodeList[i] != NULL);
134633 : #if 0
134634 : traversal.visit(nodeList[i]);
134635 : #else
134636 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
134637 : {
134638 0 : traversal.visit(nodeList[i]);
134639 : }
134640 : #endif
134641 : }
134642 : #endif
134643 : }
134644 :
134645 : // This should not be required since all previously static data members are
134646 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
134647 :
134648 5342 : }
134649 :
134650 :
134651 : void
134652 194 : SgVoidVal::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
134653 : {
134654 : // This function traverses the memory pool for an IR node and
134655 : // calls the function to execute the visitor object.
134656 :
134657 : // Initialize array to the address of the first element of the STL vector
134658 : // (which is guarenteed to be contiguous storage).
134659 : // SgVoidVal objectArray [] = *(Memory_Block_List.begin());
134660 194 : if (SgVoidVal::pools.empty() == false)
134661 : {
134662 : // Generate an array of memory pools
134663 0 : SgVoidVal** objectArray = (SgVoidVal**) &(SgVoidVal::pools[0]);
134664 :
134665 : // Build a local variable for better performance
134666 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
134667 :
134668 : // Iterate over the memory pools
134669 0 : for (unsigned int i=0; i < SgVoidVal::pools.size(); i++)
134670 : {
134671 : // objectArray[i] is a single memory pool
134672 0 : for (unsigned j=0; j < SgVoidVal::pool_size; j++)
134673 : {
134674 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
134675 : {
134676 : // printf ("Found a valid SgVoidVal object in the memory pool %d at position %d \n",i,j);
134677 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
134678 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
134679 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
134680 : }
134681 : else
134682 : {
134683 : // printf ("Found a INVALID SgVoidVal object in the memory pool \n");
134684 : }
134685 : }
134686 : }
134687 : }
134688 :
134689 : // This should not be required since all previously static data members are
134690 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
134691 :
134692 194 : }
134693 :
134694 : void
134695 0 : SgVoidVal::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
134696 : {
134697 : // This function visits only a single IR node of the memory pool.
134698 : // it is typically called once for each type of IR node within
134699 : // the automatically generated function: traverseRepresentativeNodes().
134700 :
134701 : // Initialize array to the address of the first element of the STL vector
134702 : // (which is guarenteed to be contiguous storage).
134703 : // SgVoidVal objectArray [] = *(Memory_Block_List.begin());
134704 0 : if (SgVoidVal::pools.empty() == false)
134705 : {
134706 : // Generate an array of memory pools
134707 0 : SgVoidVal** objectArray = (SgVoidVal**) &(SgVoidVal::pools[0]);
134708 :
134709 : // Build a local variable for better performance
134710 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
134711 :
134712 : // Iterate over the memory pools
134713 0 : bool done = false;
134714 0 : unsigned i=0;
134715 :
134716 : // find the first valid IR node, call visit function, and then leave
134717 0 : while ( done == false && i < SgVoidVal::pools.size() )
134718 : {
134719 : // objectArray[i] is a single memory pool
134720 : unsigned j=0;
134721 0 : while (done == false && j < SgVoidVal::pool_size)
134722 : {
134723 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
134724 : {
134725 0 : traversal.visit(&(objectArray[i][j]));
134726 0 : done = true;
134727 : }
134728 0 : j++;
134729 : }
134730 0 : i++;
134731 : }
134732 :
134733 : #if 0
134734 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
134735 : if (done == false)
134736 : {
134737 : printf ("No representative for SgVoidVal found in memory pools \n");
134738 : }
134739 : #endif
134740 : }
134741 0 : }
134742 :
134743 :
134744 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
134745 : // using values that overflow signed values of int.
134746 : size_t
134747 4 : SgVoidVal::numberOfNodes()
134748 : {
134749 : // This function traverses the memory pool for an IR node and
134750 : // counts the number of IR nodes of a particular Sage III IR
134751 : // nodes type.
134752 :
134753 4 : size_t count = 0;
134754 4 : if (SgVoidVal::pools.empty() == false)
134755 : {
134756 : // Generate an array of memory pools (this is actually a STL vector,
134757 : // but it is contiguious, so OK to treat this way).
134758 0 : SgVoidVal** objectArray = (SgVoidVal**) &(SgVoidVal::pools[0]);
134759 :
134760 : // Build a local variable for better performance (make it a loop invariant variable).
134761 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
134762 :
134763 : // Iterate over all of the memory pools for this IR node.
134764 0 : for (unsigned int i=0; i < SgVoidVal::pools.size(); i++)
134765 : {
134766 : // objectArray[i] is a single memory pool, iterate over all the
134767 : // IR nodes and only count those that are valid IR nodes used in
134768 : // the AST (i.e. allocated IR nodes).
134769 0 : for (unsigned j=0; j < SgVoidVal::pool_size; j++)
134770 : {
134771 : // This is indexing the STL vector of C/C++ style arrays as a doubly
134772 : // indexed array access. It is OK since we have leveraged the semantics
134773 : // of STL vector memory as contigous and cast the memory as an array
134774 : // of arrays to use the 2D array indexing. Hope this is not confusing,
134775 : // but it s very fast as an implementation.
134776 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
134777 : {
134778 0 : count++;
134779 : }
134780 : }
134781 : }
134782 : }
134783 :
134784 :
134785 :
134786 4 : return count;
134787 : }
134788 :
134789 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
134790 : // using values that overflow signed values of int.
134791 : size_t
134792 0 : SgVoidVal::memoryUsage()
134793 : {
134794 : // This function is required because we need the class name as a type when we call sizeof
134795 : // There might be another way to implement this if we have a traversal that only called a
134796 : // representative object (one call for each type of Sage IIIIR node).
134797 0 : size_t memory = numberOfNodes() * sizeof(SgVoidVal);
134798 :
134799 0 : return memory;
134800 : }
134801 :
134802 : /* #line 134803 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
134803 :
134804 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
134805 : void
134806 5342 : SgCallExpression::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
134807 : {
134808 : // This function traverses the memory pool for only a specific IR node
134809 : // and calls the visit function of the input class execute a traversal
134810 : // similar to the style of the attribute based traversals within ROSE.
134811 : // This traversal will visit ALL nodes of the AST where as the other
134812 : // attribute based traversals visit only the embedded tree within the AST.
134813 :
134814 : // Initialize array to the address of the first element of the STL vector
134815 : // (which is guaranteed to be contiguous storage).
134816 : // SgCallExpression objectArray [] = *(Memory_Block_List.begin());
134817 5342 : if (SgCallExpression::pools.empty() == false)
134818 : {
134819 : // Generate an array of memory pools
134820 0 : SgCallExpression** objectArray = (SgCallExpression**) &(SgCallExpression::pools[0]);
134821 :
134822 : // Build a local variable for better performance
134823 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
134824 : #if 0
134825 : // Iterate over the memory pools
134826 : for (unsigned int i=0; i < SgCallExpression::pools.size(); i++)
134827 : {
134828 : // objectArray[i] is a single memory pool
134829 : for (int j=0; j < SgCallExpression::pool_size; j++)
134830 : {
134831 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
134832 : {
134833 : traversal.visit(&(objectArray[i][j]));
134834 : }
134835 : }
134836 : }
134837 : #else
134838 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
134839 : // compute the list first and then call the visit function on each list element.
134840 :
134841 : // printf ("Inside of SgCallExpression::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
134842 :
134843 0 : std::vector<SgCallExpression*> nodeList;
134844 :
134845 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
134846 0 : for (unsigned int i=0; i < SgCallExpression::pools.size(); i++)
134847 : {
134848 : // objectArray[i] is a single memory pool
134849 0 : for (unsigned j=0; j < SgCallExpression::pool_size; j++)
134850 : {
134851 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
134852 : {
134853 0 : nodeList.push_back(&(objectArray[i][j]));
134854 : }
134855 : }
134856 : }
134857 :
134858 : // Iterate over the saved list
134859 0 : size_t nodeListSize = nodeList.size();
134860 0 : for (size_t i=0; i < nodeListSize; i++)
134861 : {
134862 0 : ROSE_ASSERT(nodeList[i] != NULL);
134863 : #if 0
134864 : traversal.visit(nodeList[i]);
134865 : #else
134866 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
134867 : {
134868 0 : traversal.visit(nodeList[i]);
134869 : }
134870 : #endif
134871 : }
134872 : #endif
134873 : }
134874 :
134875 : // This should not be required since all previously static data members are
134876 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
134877 :
134878 5342 : }
134879 :
134880 :
134881 : void
134882 194 : SgCallExpression::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
134883 : {
134884 : // This function traverses the memory pool for an IR node and
134885 : // calls the function to execute the visitor object.
134886 :
134887 : // Initialize array to the address of the first element of the STL vector
134888 : // (which is guarenteed to be contiguous storage).
134889 : // SgCallExpression objectArray [] = *(Memory_Block_List.begin());
134890 194 : if (SgCallExpression::pools.empty() == false)
134891 : {
134892 : // Generate an array of memory pools
134893 0 : SgCallExpression** objectArray = (SgCallExpression**) &(SgCallExpression::pools[0]);
134894 :
134895 : // Build a local variable for better performance
134896 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
134897 :
134898 : // Iterate over the memory pools
134899 0 : for (unsigned int i=0; i < SgCallExpression::pools.size(); i++)
134900 : {
134901 : // objectArray[i] is a single memory pool
134902 0 : for (unsigned j=0; j < SgCallExpression::pool_size; j++)
134903 : {
134904 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
134905 : {
134906 : // printf ("Found a valid SgCallExpression object in the memory pool %d at position %d \n",i,j);
134907 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
134908 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
134909 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
134910 : }
134911 : else
134912 : {
134913 : // printf ("Found a INVALID SgCallExpression object in the memory pool \n");
134914 : }
134915 : }
134916 : }
134917 : }
134918 :
134919 : // This should not be required since all previously static data members are
134920 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
134921 :
134922 194 : }
134923 :
134924 : void
134925 0 : SgCallExpression::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
134926 : {
134927 : // This function visits only a single IR node of the memory pool.
134928 : // it is typically called once for each type of IR node within
134929 : // the automatically generated function: traverseRepresentativeNodes().
134930 :
134931 : // Initialize array to the address of the first element of the STL vector
134932 : // (which is guarenteed to be contiguous storage).
134933 : // SgCallExpression objectArray [] = *(Memory_Block_List.begin());
134934 0 : if (SgCallExpression::pools.empty() == false)
134935 : {
134936 : // Generate an array of memory pools
134937 0 : SgCallExpression** objectArray = (SgCallExpression**) &(SgCallExpression::pools[0]);
134938 :
134939 : // Build a local variable for better performance
134940 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
134941 :
134942 : // Iterate over the memory pools
134943 0 : bool done = false;
134944 0 : unsigned i=0;
134945 :
134946 : // find the first valid IR node, call visit function, and then leave
134947 0 : while ( done == false && i < SgCallExpression::pools.size() )
134948 : {
134949 : // objectArray[i] is a single memory pool
134950 : unsigned j=0;
134951 0 : while (done == false && j < SgCallExpression::pool_size)
134952 : {
134953 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
134954 : {
134955 0 : traversal.visit(&(objectArray[i][j]));
134956 0 : done = true;
134957 : }
134958 0 : j++;
134959 : }
134960 0 : i++;
134961 : }
134962 :
134963 : #if 0
134964 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
134965 : if (done == false)
134966 : {
134967 : printf ("No representative for SgCallExpression found in memory pools \n");
134968 : }
134969 : #endif
134970 : }
134971 0 : }
134972 :
134973 :
134974 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
134975 : // using values that overflow signed values of int.
134976 : size_t
134977 4 : SgCallExpression::numberOfNodes()
134978 : {
134979 : // This function traverses the memory pool for an IR node and
134980 : // counts the number of IR nodes of a particular Sage III IR
134981 : // nodes type.
134982 :
134983 4 : size_t count = 0;
134984 4 : if (SgCallExpression::pools.empty() == false)
134985 : {
134986 : // Generate an array of memory pools (this is actually a STL vector,
134987 : // but it is contiguious, so OK to treat this way).
134988 0 : SgCallExpression** objectArray = (SgCallExpression**) &(SgCallExpression::pools[0]);
134989 :
134990 : // Build a local variable for better performance (make it a loop invariant variable).
134991 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
134992 :
134993 : // Iterate over all of the memory pools for this IR node.
134994 0 : for (unsigned int i=0; i < SgCallExpression::pools.size(); i++)
134995 : {
134996 : // objectArray[i] is a single memory pool, iterate over all the
134997 : // IR nodes and only count those that are valid IR nodes used in
134998 : // the AST (i.e. allocated IR nodes).
134999 0 : for (unsigned j=0; j < SgCallExpression::pool_size; j++)
135000 : {
135001 : // This is indexing the STL vector of C/C++ style arrays as a doubly
135002 : // indexed array access. It is OK since we have leveraged the semantics
135003 : // of STL vector memory as contigous and cast the memory as an array
135004 : // of arrays to use the 2D array indexing. Hope this is not confusing,
135005 : // but it s very fast as an implementation.
135006 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
135007 : {
135008 0 : count++;
135009 : }
135010 : }
135011 : }
135012 : }
135013 :
135014 :
135015 :
135016 4 : return count;
135017 : }
135018 :
135019 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
135020 : // using values that overflow signed values of int.
135021 : size_t
135022 0 : SgCallExpression::memoryUsage()
135023 : {
135024 : // This function is required because we need the class name as a type when we call sizeof
135025 : // There might be another way to implement this if we have a traversal that only called a
135026 : // representative object (one call for each type of Sage IIIIR node).
135027 0 : size_t memory = numberOfNodes() * sizeof(SgCallExpression);
135028 :
135029 0 : return memory;
135030 : }
135031 :
135032 : /* #line 135033 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
135033 :
135034 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
135035 : void
135036 5342 : SgFunctionCallExp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
135037 : {
135038 : // This function traverses the memory pool for only a specific IR node
135039 : // and calls the visit function of the input class execute a traversal
135040 : // similar to the style of the attribute based traversals within ROSE.
135041 : // This traversal will visit ALL nodes of the AST where as the other
135042 : // attribute based traversals visit only the embedded tree within the AST.
135043 :
135044 : // Initialize array to the address of the first element of the STL vector
135045 : // (which is guaranteed to be contiguous storage).
135046 : // SgFunctionCallExp objectArray [] = *(Memory_Block_List.begin());
135047 5342 : if (SgFunctionCallExp::pools.empty() == false)
135048 : {
135049 : // Generate an array of memory pools
135050 3404 : SgFunctionCallExp** objectArray = (SgFunctionCallExp**) &(SgFunctionCallExp::pools[0]);
135051 :
135052 : // Build a local variable for better performance
135053 3404 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
135054 : #if 0
135055 : // Iterate over the memory pools
135056 : for (unsigned int i=0; i < SgFunctionCallExp::pools.size(); i++)
135057 : {
135058 : // objectArray[i] is a single memory pool
135059 : for (int j=0; j < SgFunctionCallExp::pool_size; j++)
135060 : {
135061 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
135062 : {
135063 : traversal.visit(&(objectArray[i][j]));
135064 : }
135065 : }
135066 : }
135067 : #else
135068 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
135069 : // compute the list first and then call the visit function on each list element.
135070 :
135071 : // printf ("Inside of SgFunctionCallExp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
135072 :
135073 6808 : std::vector<SgFunctionCallExp*> nodeList;
135074 :
135075 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
135076 6932 : for (unsigned int i=0; i < SgFunctionCallExp::pools.size(); i++)
135077 : {
135078 : // objectArray[i] is a single memory pool
135079 7059530 : for (unsigned j=0; j < SgFunctionCallExp::pool_size; j++)
135080 : {
135081 7056000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
135082 : {
135083 445657 : nodeList.push_back(&(objectArray[i][j]));
135084 : }
135085 : }
135086 : }
135087 :
135088 : // Iterate over the saved list
135089 3404 : size_t nodeListSize = nodeList.size();
135090 449061 : for (size_t i=0; i < nodeListSize; i++)
135091 : {
135092 445657 : ROSE_ASSERT(nodeList[i] != NULL);
135093 : #if 0
135094 : traversal.visit(nodeList[i]);
135095 : #else
135096 445657 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
135097 : {
135098 445657 : traversal.visit(nodeList[i]);
135099 : }
135100 : #endif
135101 : }
135102 : #endif
135103 : }
135104 :
135105 : // This should not be required since all previously static data members are
135106 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
135107 :
135108 5342 : }
135109 :
135110 :
135111 : void
135112 194 : SgFunctionCallExp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
135113 : {
135114 : // This function traverses the memory pool for an IR node and
135115 : // calls the function to execute the visitor object.
135116 :
135117 : // Initialize array to the address of the first element of the STL vector
135118 : // (which is guarenteed to be contiguous storage).
135119 : // SgFunctionCallExp objectArray [] = *(Memory_Block_List.begin());
135120 194 : if (SgFunctionCallExp::pools.empty() == false)
135121 : {
135122 : // Generate an array of memory pools
135123 141 : SgFunctionCallExp** objectArray = (SgFunctionCallExp**) &(SgFunctionCallExp::pools[0]);
135124 :
135125 : // Build a local variable for better performance
135126 141 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
135127 :
135128 : // Iterate over the memory pools
135129 437 : for (unsigned int i=0; i < SgFunctionCallExp::pools.size(); i++)
135130 : {
135131 : // objectArray[i] is a single memory pool
135132 592296 : for (unsigned j=0; j < SgFunctionCallExp::pool_size; j++)
135133 : {
135134 592000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
135135 : {
135136 : // printf ("Found a valid SgFunctionCallExp object in the memory pool %d at position %d \n",i,j);
135137 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
135138 460372 : objectArray[i][j].executeVisitorMemberFunction(visitor);
135139 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
135140 : }
135141 : else
135142 : {
135143 : // printf ("Found a INVALID SgFunctionCallExp object in the memory pool \n");
135144 : }
135145 : }
135146 : }
135147 : }
135148 :
135149 : // This should not be required since all previously static data members are
135150 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
135151 :
135152 194 : }
135153 :
135154 : void
135155 0 : SgFunctionCallExp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
135156 : {
135157 : // This function visits only a single IR node of the memory pool.
135158 : // it is typically called once for each type of IR node within
135159 : // the automatically generated function: traverseRepresentativeNodes().
135160 :
135161 : // Initialize array to the address of the first element of the STL vector
135162 : // (which is guarenteed to be contiguous storage).
135163 : // SgFunctionCallExp objectArray [] = *(Memory_Block_List.begin());
135164 0 : if (SgFunctionCallExp::pools.empty() == false)
135165 : {
135166 : // Generate an array of memory pools
135167 0 : SgFunctionCallExp** objectArray = (SgFunctionCallExp**) &(SgFunctionCallExp::pools[0]);
135168 :
135169 : // Build a local variable for better performance
135170 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
135171 :
135172 : // Iterate over the memory pools
135173 0 : bool done = false;
135174 0 : unsigned i=0;
135175 :
135176 : // find the first valid IR node, call visit function, and then leave
135177 0 : while ( done == false && i < SgFunctionCallExp::pools.size() )
135178 : {
135179 : // objectArray[i] is a single memory pool
135180 : unsigned j=0;
135181 0 : while (done == false && j < SgFunctionCallExp::pool_size)
135182 : {
135183 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
135184 : {
135185 0 : traversal.visit(&(objectArray[i][j]));
135186 0 : done = true;
135187 : }
135188 0 : j++;
135189 : }
135190 0 : i++;
135191 : }
135192 :
135193 : #if 0
135194 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
135195 : if (done == false)
135196 : {
135197 : printf ("No representative for SgFunctionCallExp found in memory pools \n");
135198 : }
135199 : #endif
135200 : }
135201 0 : }
135202 :
135203 :
135204 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
135205 : // using values that overflow signed values of int.
135206 : size_t
135207 4 : SgFunctionCallExp::numberOfNodes()
135208 : {
135209 : // This function traverses the memory pool for an IR node and
135210 : // counts the number of IR nodes of a particular Sage III IR
135211 : // nodes type.
135212 :
135213 4 : size_t count = 0;
135214 4 : if (SgFunctionCallExp::pools.empty() == false)
135215 : {
135216 : // Generate an array of memory pools (this is actually a STL vector,
135217 : // but it is contiguious, so OK to treat this way).
135218 2 : SgFunctionCallExp** objectArray = (SgFunctionCallExp**) &(SgFunctionCallExp::pools[0]);
135219 :
135220 : // Build a local variable for better performance (make it a loop invariant variable).
135221 2 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
135222 :
135223 : // Iterate over all of the memory pools for this IR node.
135224 5 : for (unsigned int i=0; i < SgFunctionCallExp::pools.size(); i++)
135225 : {
135226 : // objectArray[i] is a single memory pool, iterate over all the
135227 : // IR nodes and only count those that are valid IR nodes used in
135228 : // the AST (i.e. allocated IR nodes).
135229 6003 : for (unsigned j=0; j < SgFunctionCallExp::pool_size; j++)
135230 : {
135231 : // This is indexing the STL vector of C/C++ style arrays as a doubly
135232 : // indexed array access. It is OK since we have leveraged the semantics
135233 : // of STL vector memory as contigous and cast the memory as an array
135234 : // of arrays to use the 2D array indexing. Hope this is not confusing,
135235 : // but it s very fast as an implementation.
135236 6000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
135237 : {
135238 3222 : count++;
135239 : }
135240 : }
135241 : }
135242 : }
135243 :
135244 :
135245 :
135246 4 : return count;
135247 : }
135248 :
135249 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
135250 : // using values that overflow signed values of int.
135251 : size_t
135252 0 : SgFunctionCallExp::memoryUsage()
135253 : {
135254 : // This function is required because we need the class name as a type when we call sizeof
135255 : // There might be another way to implement this if we have a traversal that only called a
135256 : // representative object (one call for each type of Sage IIIIR node).
135257 0 : size_t memory = numberOfNodes() * sizeof(SgFunctionCallExp);
135258 :
135259 0 : return memory;
135260 : }
135261 :
135262 : /* #line 135263 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
135263 :
135264 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
135265 : void
135266 5342 : SgCudaKernelCallExp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
135267 : {
135268 : // This function traverses the memory pool for only a specific IR node
135269 : // and calls the visit function of the input class execute a traversal
135270 : // similar to the style of the attribute based traversals within ROSE.
135271 : // This traversal will visit ALL nodes of the AST where as the other
135272 : // attribute based traversals visit only the embedded tree within the AST.
135273 :
135274 : // Initialize array to the address of the first element of the STL vector
135275 : // (which is guaranteed to be contiguous storage).
135276 : // SgCudaKernelCallExp objectArray [] = *(Memory_Block_List.begin());
135277 5342 : if (SgCudaKernelCallExp::pools.empty() == false)
135278 : {
135279 : // Generate an array of memory pools
135280 0 : SgCudaKernelCallExp** objectArray = (SgCudaKernelCallExp**) &(SgCudaKernelCallExp::pools[0]);
135281 :
135282 : // Build a local variable for better performance
135283 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
135284 : #if 0
135285 : // Iterate over the memory pools
135286 : for (unsigned int i=0; i < SgCudaKernelCallExp::pools.size(); i++)
135287 : {
135288 : // objectArray[i] is a single memory pool
135289 : for (int j=0; j < SgCudaKernelCallExp::pool_size; j++)
135290 : {
135291 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
135292 : {
135293 : traversal.visit(&(objectArray[i][j]));
135294 : }
135295 : }
135296 : }
135297 : #else
135298 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
135299 : // compute the list first and then call the visit function on each list element.
135300 :
135301 : // printf ("Inside of SgCudaKernelCallExp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
135302 :
135303 0 : std::vector<SgCudaKernelCallExp*> nodeList;
135304 :
135305 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
135306 0 : for (unsigned int i=0; i < SgCudaKernelCallExp::pools.size(); i++)
135307 : {
135308 : // objectArray[i] is a single memory pool
135309 0 : for (unsigned j=0; j < SgCudaKernelCallExp::pool_size; j++)
135310 : {
135311 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
135312 : {
135313 0 : nodeList.push_back(&(objectArray[i][j]));
135314 : }
135315 : }
135316 : }
135317 :
135318 : // Iterate over the saved list
135319 0 : size_t nodeListSize = nodeList.size();
135320 0 : for (size_t i=0; i < nodeListSize; i++)
135321 : {
135322 0 : ROSE_ASSERT(nodeList[i] != NULL);
135323 : #if 0
135324 : traversal.visit(nodeList[i]);
135325 : #else
135326 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
135327 : {
135328 0 : traversal.visit(nodeList[i]);
135329 : }
135330 : #endif
135331 : }
135332 : #endif
135333 : }
135334 :
135335 : // This should not be required since all previously static data members are
135336 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
135337 :
135338 5342 : }
135339 :
135340 :
135341 : void
135342 194 : SgCudaKernelCallExp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
135343 : {
135344 : // This function traverses the memory pool for an IR node and
135345 : // calls the function to execute the visitor object.
135346 :
135347 : // Initialize array to the address of the first element of the STL vector
135348 : // (which is guarenteed to be contiguous storage).
135349 : // SgCudaKernelCallExp objectArray [] = *(Memory_Block_List.begin());
135350 194 : if (SgCudaKernelCallExp::pools.empty() == false)
135351 : {
135352 : // Generate an array of memory pools
135353 0 : SgCudaKernelCallExp** objectArray = (SgCudaKernelCallExp**) &(SgCudaKernelCallExp::pools[0]);
135354 :
135355 : // Build a local variable for better performance
135356 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
135357 :
135358 : // Iterate over the memory pools
135359 0 : for (unsigned int i=0; i < SgCudaKernelCallExp::pools.size(); i++)
135360 : {
135361 : // objectArray[i] is a single memory pool
135362 0 : for (unsigned j=0; j < SgCudaKernelCallExp::pool_size; j++)
135363 : {
135364 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
135365 : {
135366 : // printf ("Found a valid SgCudaKernelCallExp object in the memory pool %d at position %d \n",i,j);
135367 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
135368 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
135369 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
135370 : }
135371 : else
135372 : {
135373 : // printf ("Found a INVALID SgCudaKernelCallExp object in the memory pool \n");
135374 : }
135375 : }
135376 : }
135377 : }
135378 :
135379 : // This should not be required since all previously static data members are
135380 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
135381 :
135382 194 : }
135383 :
135384 : void
135385 0 : SgCudaKernelCallExp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
135386 : {
135387 : // This function visits only a single IR node of the memory pool.
135388 : // it is typically called once for each type of IR node within
135389 : // the automatically generated function: traverseRepresentativeNodes().
135390 :
135391 : // Initialize array to the address of the first element of the STL vector
135392 : // (which is guarenteed to be contiguous storage).
135393 : // SgCudaKernelCallExp objectArray [] = *(Memory_Block_List.begin());
135394 0 : if (SgCudaKernelCallExp::pools.empty() == false)
135395 : {
135396 : // Generate an array of memory pools
135397 0 : SgCudaKernelCallExp** objectArray = (SgCudaKernelCallExp**) &(SgCudaKernelCallExp::pools[0]);
135398 :
135399 : // Build a local variable for better performance
135400 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
135401 :
135402 : // Iterate over the memory pools
135403 0 : bool done = false;
135404 0 : unsigned i=0;
135405 :
135406 : // find the first valid IR node, call visit function, and then leave
135407 0 : while ( done == false && i < SgCudaKernelCallExp::pools.size() )
135408 : {
135409 : // objectArray[i] is a single memory pool
135410 : unsigned j=0;
135411 0 : while (done == false && j < SgCudaKernelCallExp::pool_size)
135412 : {
135413 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
135414 : {
135415 0 : traversal.visit(&(objectArray[i][j]));
135416 0 : done = true;
135417 : }
135418 0 : j++;
135419 : }
135420 0 : i++;
135421 : }
135422 :
135423 : #if 0
135424 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
135425 : if (done == false)
135426 : {
135427 : printf ("No representative for SgCudaKernelCallExp found in memory pools \n");
135428 : }
135429 : #endif
135430 : }
135431 0 : }
135432 :
135433 :
135434 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
135435 : // using values that overflow signed values of int.
135436 : size_t
135437 4 : SgCudaKernelCallExp::numberOfNodes()
135438 : {
135439 : // This function traverses the memory pool for an IR node and
135440 : // counts the number of IR nodes of a particular Sage III IR
135441 : // nodes type.
135442 :
135443 4 : size_t count = 0;
135444 4 : if (SgCudaKernelCallExp::pools.empty() == false)
135445 : {
135446 : // Generate an array of memory pools (this is actually a STL vector,
135447 : // but it is contiguious, so OK to treat this way).
135448 0 : SgCudaKernelCallExp** objectArray = (SgCudaKernelCallExp**) &(SgCudaKernelCallExp::pools[0]);
135449 :
135450 : // Build a local variable for better performance (make it a loop invariant variable).
135451 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
135452 :
135453 : // Iterate over all of the memory pools for this IR node.
135454 0 : for (unsigned int i=0; i < SgCudaKernelCallExp::pools.size(); i++)
135455 : {
135456 : // objectArray[i] is a single memory pool, iterate over all the
135457 : // IR nodes and only count those that are valid IR nodes used in
135458 : // the AST (i.e. allocated IR nodes).
135459 0 : for (unsigned j=0; j < SgCudaKernelCallExp::pool_size; j++)
135460 : {
135461 : // This is indexing the STL vector of C/C++ style arrays as a doubly
135462 : // indexed array access. It is OK since we have leveraged the semantics
135463 : // of STL vector memory as contigous and cast the memory as an array
135464 : // of arrays to use the 2D array indexing. Hope this is not confusing,
135465 : // but it s very fast as an implementation.
135466 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
135467 : {
135468 0 : count++;
135469 : }
135470 : }
135471 : }
135472 : }
135473 :
135474 :
135475 :
135476 4 : return count;
135477 : }
135478 :
135479 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
135480 : // using values that overflow signed values of int.
135481 : size_t
135482 0 : SgCudaKernelCallExp::memoryUsage()
135483 : {
135484 : // This function is required because we need the class name as a type when we call sizeof
135485 : // There might be another way to implement this if we have a traversal that only called a
135486 : // representative object (one call for each type of Sage IIIIR node).
135487 0 : size_t memory = numberOfNodes() * sizeof(SgCudaKernelCallExp);
135488 :
135489 0 : return memory;
135490 : }
135491 :
135492 : /* #line 135493 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
135493 :
135494 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
135495 : void
135496 5342 : SgSizeOfOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
135497 : {
135498 : // This function traverses the memory pool for only a specific IR node
135499 : // and calls the visit function of the input class execute a traversal
135500 : // similar to the style of the attribute based traversals within ROSE.
135501 : // This traversal will visit ALL nodes of the AST where as the other
135502 : // attribute based traversals visit only the embedded tree within the AST.
135503 :
135504 : // Initialize array to the address of the first element of the STL vector
135505 : // (which is guaranteed to be contiguous storage).
135506 : // SgSizeOfOp objectArray [] = *(Memory_Block_List.begin());
135507 5342 : if (SgSizeOfOp::pools.empty() == false)
135508 : {
135509 : // Generate an array of memory pools
135510 2958 : SgSizeOfOp** objectArray = (SgSizeOfOp**) &(SgSizeOfOp::pools[0]);
135511 :
135512 : // Build a local variable for better performance
135513 2958 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
135514 : #if 0
135515 : // Iterate over the memory pools
135516 : for (unsigned int i=0; i < SgSizeOfOp::pools.size(); i++)
135517 : {
135518 : // objectArray[i] is a single memory pool
135519 : for (int j=0; j < SgSizeOfOp::pool_size; j++)
135520 : {
135521 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
135522 : {
135523 : traversal.visit(&(objectArray[i][j]));
135524 : }
135525 : }
135526 : }
135527 : #else
135528 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
135529 : // compute the list first and then call the visit function on each list element.
135530 :
135531 : // printf ("Inside of SgSizeOfOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
135532 :
135533 5916 : std::vector<SgSizeOfOp*> nodeList;
135534 :
135535 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
135536 5916 : for (unsigned int i=0; i < SgSizeOfOp::pools.size(); i++)
135537 : {
135538 : // objectArray[i] is a single memory pool
135539 5918960 : for (unsigned j=0; j < SgSizeOfOp::pool_size; j++)
135540 : {
135541 5916000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
135542 : {
135543 28418 : nodeList.push_back(&(objectArray[i][j]));
135544 : }
135545 : }
135546 : }
135547 :
135548 : // Iterate over the saved list
135549 2958 : size_t nodeListSize = nodeList.size();
135550 31376 : for (size_t i=0; i < nodeListSize; i++)
135551 : {
135552 28418 : ROSE_ASSERT(nodeList[i] != NULL);
135553 : #if 0
135554 : traversal.visit(nodeList[i]);
135555 : #else
135556 28418 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
135557 : {
135558 28418 : traversal.visit(nodeList[i]);
135559 : }
135560 : #endif
135561 : }
135562 : #endif
135563 : }
135564 :
135565 : // This should not be required since all previously static data members are
135566 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
135567 :
135568 5342 : }
135569 :
135570 :
135571 : void
135572 194 : SgSizeOfOp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
135573 : {
135574 : // This function traverses the memory pool for an IR node and
135575 : // calls the function to execute the visitor object.
135576 :
135577 : // Initialize array to the address of the first element of the STL vector
135578 : // (which is guarenteed to be contiguous storage).
135579 : // SgSizeOfOp objectArray [] = *(Memory_Block_List.begin());
135580 194 : if (SgSizeOfOp::pools.empty() == false)
135581 : {
135582 : // Generate an array of memory pools
135583 137 : SgSizeOfOp** objectArray = (SgSizeOfOp**) &(SgSizeOfOp::pools[0]);
135584 :
135585 : // Build a local variable for better performance
135586 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
135587 :
135588 : // Iterate over the memory pools
135589 274 : for (unsigned int i=0; i < SgSizeOfOp::pools.size(); i++)
135590 : {
135591 : // objectArray[i] is a single memory pool
135592 274137 : for (unsigned j=0; j < SgSizeOfOp::pool_size; j++)
135593 : {
135594 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
135595 : {
135596 : // printf ("Found a valid SgSizeOfOp object in the memory pool %d at position %d \n",i,j);
135597 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
135598 13157 : objectArray[i][j].executeVisitorMemberFunction(visitor);
135599 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
135600 : }
135601 : else
135602 : {
135603 : // printf ("Found a INVALID SgSizeOfOp object in the memory pool \n");
135604 : }
135605 : }
135606 : }
135607 : }
135608 :
135609 : // This should not be required since all previously static data members are
135610 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
135611 :
135612 194 : }
135613 :
135614 : void
135615 0 : SgSizeOfOp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
135616 : {
135617 : // This function visits only a single IR node of the memory pool.
135618 : // it is typically called once for each type of IR node within
135619 : // the automatically generated function: traverseRepresentativeNodes().
135620 :
135621 : // Initialize array to the address of the first element of the STL vector
135622 : // (which is guarenteed to be contiguous storage).
135623 : // SgSizeOfOp objectArray [] = *(Memory_Block_List.begin());
135624 0 : if (SgSizeOfOp::pools.empty() == false)
135625 : {
135626 : // Generate an array of memory pools
135627 0 : SgSizeOfOp** objectArray = (SgSizeOfOp**) &(SgSizeOfOp::pools[0]);
135628 :
135629 : // Build a local variable for better performance
135630 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
135631 :
135632 : // Iterate over the memory pools
135633 0 : bool done = false;
135634 0 : unsigned i=0;
135635 :
135636 : // find the first valid IR node, call visit function, and then leave
135637 0 : while ( done == false && i < SgSizeOfOp::pools.size() )
135638 : {
135639 : // objectArray[i] is a single memory pool
135640 : unsigned j=0;
135641 0 : while (done == false && j < SgSizeOfOp::pool_size)
135642 : {
135643 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
135644 : {
135645 0 : traversal.visit(&(objectArray[i][j]));
135646 0 : done = true;
135647 : }
135648 0 : j++;
135649 : }
135650 0 : i++;
135651 : }
135652 :
135653 : #if 0
135654 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
135655 : if (done == false)
135656 : {
135657 : printf ("No representative for SgSizeOfOp found in memory pools \n");
135658 : }
135659 : #endif
135660 : }
135661 0 : }
135662 :
135663 :
135664 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
135665 : // using values that overflow signed values of int.
135666 : size_t
135667 4 : SgSizeOfOp::numberOfNodes()
135668 : {
135669 : // This function traverses the memory pool for an IR node and
135670 : // counts the number of IR nodes of a particular Sage III IR
135671 : // nodes type.
135672 :
135673 4 : size_t count = 0;
135674 4 : if (SgSizeOfOp::pools.empty() == false)
135675 : {
135676 : // Generate an array of memory pools (this is actually a STL vector,
135677 : // but it is contiguious, so OK to treat this way).
135678 2 : SgSizeOfOp** objectArray = (SgSizeOfOp**) &(SgSizeOfOp::pools[0]);
135679 :
135680 : // Build a local variable for better performance (make it a loop invariant variable).
135681 2 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
135682 :
135683 : // Iterate over all of the memory pools for this IR node.
135684 4 : for (unsigned int i=0; i < SgSizeOfOp::pools.size(); i++)
135685 : {
135686 : // objectArray[i] is a single memory pool, iterate over all the
135687 : // IR nodes and only count those that are valid IR nodes used in
135688 : // the AST (i.e. allocated IR nodes).
135689 4002 : for (unsigned j=0; j < SgSizeOfOp::pool_size; j++)
135690 : {
135691 : // This is indexing the STL vector of C/C++ style arrays as a doubly
135692 : // indexed array access. It is OK since we have leveraged the semantics
135693 : // of STL vector memory as contigous and cast the memory as an array
135694 : // of arrays to use the 2D array indexing. Hope this is not confusing,
135695 : // but it s very fast as an implementation.
135696 4000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
135697 : {
135698 98 : count++;
135699 : }
135700 : }
135701 : }
135702 : }
135703 :
135704 :
135705 :
135706 4 : return count;
135707 : }
135708 :
135709 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
135710 : // using values that overflow signed values of int.
135711 : size_t
135712 0 : SgSizeOfOp::memoryUsage()
135713 : {
135714 : // This function is required because we need the class name as a type when we call sizeof
135715 : // There might be another way to implement this if we have a traversal that only called a
135716 : // representative object (one call for each type of Sage IIIIR node).
135717 0 : size_t memory = numberOfNodes() * sizeof(SgSizeOfOp);
135718 :
135719 0 : return memory;
135720 : }
135721 :
135722 : /* #line 135723 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
135723 :
135724 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
135725 : void
135726 5342 : SgUpcLocalsizeofExpression::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
135727 : {
135728 : // This function traverses the memory pool for only a specific IR node
135729 : // and calls the visit function of the input class execute a traversal
135730 : // similar to the style of the attribute based traversals within ROSE.
135731 : // This traversal will visit ALL nodes of the AST where as the other
135732 : // attribute based traversals visit only the embedded tree within the AST.
135733 :
135734 : // Initialize array to the address of the first element of the STL vector
135735 : // (which is guaranteed to be contiguous storage).
135736 : // SgUpcLocalsizeofExpression objectArray [] = *(Memory_Block_List.begin());
135737 5342 : if (SgUpcLocalsizeofExpression::pools.empty() == false)
135738 : {
135739 : // Generate an array of memory pools
135740 0 : SgUpcLocalsizeofExpression** objectArray = (SgUpcLocalsizeofExpression**) &(SgUpcLocalsizeofExpression::pools[0]);
135741 :
135742 : // Build a local variable for better performance
135743 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
135744 : #if 0
135745 : // Iterate over the memory pools
135746 : for (unsigned int i=0; i < SgUpcLocalsizeofExpression::pools.size(); i++)
135747 : {
135748 : // objectArray[i] is a single memory pool
135749 : for (int j=0; j < SgUpcLocalsizeofExpression::pool_size; j++)
135750 : {
135751 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
135752 : {
135753 : traversal.visit(&(objectArray[i][j]));
135754 : }
135755 : }
135756 : }
135757 : #else
135758 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
135759 : // compute the list first and then call the visit function on each list element.
135760 :
135761 : // printf ("Inside of SgUpcLocalsizeofExpression::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
135762 :
135763 0 : std::vector<SgUpcLocalsizeofExpression*> nodeList;
135764 :
135765 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
135766 0 : for (unsigned int i=0; i < SgUpcLocalsizeofExpression::pools.size(); i++)
135767 : {
135768 : // objectArray[i] is a single memory pool
135769 0 : for (unsigned j=0; j < SgUpcLocalsizeofExpression::pool_size; j++)
135770 : {
135771 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
135772 : {
135773 0 : nodeList.push_back(&(objectArray[i][j]));
135774 : }
135775 : }
135776 : }
135777 :
135778 : // Iterate over the saved list
135779 0 : size_t nodeListSize = nodeList.size();
135780 0 : for (size_t i=0; i < nodeListSize; i++)
135781 : {
135782 0 : ROSE_ASSERT(nodeList[i] != NULL);
135783 : #if 0
135784 : traversal.visit(nodeList[i]);
135785 : #else
135786 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
135787 : {
135788 0 : traversal.visit(nodeList[i]);
135789 : }
135790 : #endif
135791 : }
135792 : #endif
135793 : }
135794 :
135795 : // This should not be required since all previously static data members are
135796 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
135797 :
135798 5342 : }
135799 :
135800 :
135801 : void
135802 194 : SgUpcLocalsizeofExpression::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
135803 : {
135804 : // This function traverses the memory pool for an IR node and
135805 : // calls the function to execute the visitor object.
135806 :
135807 : // Initialize array to the address of the first element of the STL vector
135808 : // (which is guarenteed to be contiguous storage).
135809 : // SgUpcLocalsizeofExpression objectArray [] = *(Memory_Block_List.begin());
135810 194 : if (SgUpcLocalsizeofExpression::pools.empty() == false)
135811 : {
135812 : // Generate an array of memory pools
135813 0 : SgUpcLocalsizeofExpression** objectArray = (SgUpcLocalsizeofExpression**) &(SgUpcLocalsizeofExpression::pools[0]);
135814 :
135815 : // Build a local variable for better performance
135816 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
135817 :
135818 : // Iterate over the memory pools
135819 0 : for (unsigned int i=0; i < SgUpcLocalsizeofExpression::pools.size(); i++)
135820 : {
135821 : // objectArray[i] is a single memory pool
135822 0 : for (unsigned j=0; j < SgUpcLocalsizeofExpression::pool_size; j++)
135823 : {
135824 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
135825 : {
135826 : // printf ("Found a valid SgUpcLocalsizeofExpression object in the memory pool %d at position %d \n",i,j);
135827 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
135828 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
135829 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
135830 : }
135831 : else
135832 : {
135833 : // printf ("Found a INVALID SgUpcLocalsizeofExpression object in the memory pool \n");
135834 : }
135835 : }
135836 : }
135837 : }
135838 :
135839 : // This should not be required since all previously static data members are
135840 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
135841 :
135842 194 : }
135843 :
135844 : void
135845 0 : SgUpcLocalsizeofExpression::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
135846 : {
135847 : // This function visits only a single IR node of the memory pool.
135848 : // it is typically called once for each type of IR node within
135849 : // the automatically generated function: traverseRepresentativeNodes().
135850 :
135851 : // Initialize array to the address of the first element of the STL vector
135852 : // (which is guarenteed to be contiguous storage).
135853 : // SgUpcLocalsizeofExpression objectArray [] = *(Memory_Block_List.begin());
135854 0 : if (SgUpcLocalsizeofExpression::pools.empty() == false)
135855 : {
135856 : // Generate an array of memory pools
135857 0 : SgUpcLocalsizeofExpression** objectArray = (SgUpcLocalsizeofExpression**) &(SgUpcLocalsizeofExpression::pools[0]);
135858 :
135859 : // Build a local variable for better performance
135860 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
135861 :
135862 : // Iterate over the memory pools
135863 0 : bool done = false;
135864 0 : unsigned i=0;
135865 :
135866 : // find the first valid IR node, call visit function, and then leave
135867 0 : while ( done == false && i < SgUpcLocalsizeofExpression::pools.size() )
135868 : {
135869 : // objectArray[i] is a single memory pool
135870 : unsigned j=0;
135871 0 : while (done == false && j < SgUpcLocalsizeofExpression::pool_size)
135872 : {
135873 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
135874 : {
135875 0 : traversal.visit(&(objectArray[i][j]));
135876 0 : done = true;
135877 : }
135878 0 : j++;
135879 : }
135880 0 : i++;
135881 : }
135882 :
135883 : #if 0
135884 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
135885 : if (done == false)
135886 : {
135887 : printf ("No representative for SgUpcLocalsizeofExpression found in memory pools \n");
135888 : }
135889 : #endif
135890 : }
135891 0 : }
135892 :
135893 :
135894 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
135895 : // using values that overflow signed values of int.
135896 : size_t
135897 4 : SgUpcLocalsizeofExpression::numberOfNodes()
135898 : {
135899 : // This function traverses the memory pool for an IR node and
135900 : // counts the number of IR nodes of a particular Sage III IR
135901 : // nodes type.
135902 :
135903 4 : size_t count = 0;
135904 4 : if (SgUpcLocalsizeofExpression::pools.empty() == false)
135905 : {
135906 : // Generate an array of memory pools (this is actually a STL vector,
135907 : // but it is contiguious, so OK to treat this way).
135908 0 : SgUpcLocalsizeofExpression** objectArray = (SgUpcLocalsizeofExpression**) &(SgUpcLocalsizeofExpression::pools[0]);
135909 :
135910 : // Build a local variable for better performance (make it a loop invariant variable).
135911 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
135912 :
135913 : // Iterate over all of the memory pools for this IR node.
135914 0 : for (unsigned int i=0; i < SgUpcLocalsizeofExpression::pools.size(); i++)
135915 : {
135916 : // objectArray[i] is a single memory pool, iterate over all the
135917 : // IR nodes and only count those that are valid IR nodes used in
135918 : // the AST (i.e. allocated IR nodes).
135919 0 : for (unsigned j=0; j < SgUpcLocalsizeofExpression::pool_size; j++)
135920 : {
135921 : // This is indexing the STL vector of C/C++ style arrays as a doubly
135922 : // indexed array access. It is OK since we have leveraged the semantics
135923 : // of STL vector memory as contigous and cast the memory as an array
135924 : // of arrays to use the 2D array indexing. Hope this is not confusing,
135925 : // but it s very fast as an implementation.
135926 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
135927 : {
135928 0 : count++;
135929 : }
135930 : }
135931 : }
135932 : }
135933 :
135934 :
135935 :
135936 4 : return count;
135937 : }
135938 :
135939 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
135940 : // using values that overflow signed values of int.
135941 : size_t
135942 0 : SgUpcLocalsizeofExpression::memoryUsage()
135943 : {
135944 : // This function is required because we need the class name as a type when we call sizeof
135945 : // There might be another way to implement this if we have a traversal that only called a
135946 : // representative object (one call for each type of Sage IIIIR node).
135947 0 : size_t memory = numberOfNodes() * sizeof(SgUpcLocalsizeofExpression);
135948 :
135949 0 : return memory;
135950 : }
135951 :
135952 : /* #line 135953 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
135953 :
135954 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
135955 : void
135956 5342 : SgUpcBlocksizeofExpression::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
135957 : {
135958 : // This function traverses the memory pool for only a specific IR node
135959 : // and calls the visit function of the input class execute a traversal
135960 : // similar to the style of the attribute based traversals within ROSE.
135961 : // This traversal will visit ALL nodes of the AST where as the other
135962 : // attribute based traversals visit only the embedded tree within the AST.
135963 :
135964 : // Initialize array to the address of the first element of the STL vector
135965 : // (which is guaranteed to be contiguous storage).
135966 : // SgUpcBlocksizeofExpression objectArray [] = *(Memory_Block_List.begin());
135967 5342 : if (SgUpcBlocksizeofExpression::pools.empty() == false)
135968 : {
135969 : // Generate an array of memory pools
135970 0 : SgUpcBlocksizeofExpression** objectArray = (SgUpcBlocksizeofExpression**) &(SgUpcBlocksizeofExpression::pools[0]);
135971 :
135972 : // Build a local variable for better performance
135973 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
135974 : #if 0
135975 : // Iterate over the memory pools
135976 : for (unsigned int i=0; i < SgUpcBlocksizeofExpression::pools.size(); i++)
135977 : {
135978 : // objectArray[i] is a single memory pool
135979 : for (int j=0; j < SgUpcBlocksizeofExpression::pool_size; j++)
135980 : {
135981 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
135982 : {
135983 : traversal.visit(&(objectArray[i][j]));
135984 : }
135985 : }
135986 : }
135987 : #else
135988 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
135989 : // compute the list first and then call the visit function on each list element.
135990 :
135991 : // printf ("Inside of SgUpcBlocksizeofExpression::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
135992 :
135993 0 : std::vector<SgUpcBlocksizeofExpression*> nodeList;
135994 :
135995 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
135996 0 : for (unsigned int i=0; i < SgUpcBlocksizeofExpression::pools.size(); i++)
135997 : {
135998 : // objectArray[i] is a single memory pool
135999 0 : for (unsigned j=0; j < SgUpcBlocksizeofExpression::pool_size; j++)
136000 : {
136001 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
136002 : {
136003 0 : nodeList.push_back(&(objectArray[i][j]));
136004 : }
136005 : }
136006 : }
136007 :
136008 : // Iterate over the saved list
136009 0 : size_t nodeListSize = nodeList.size();
136010 0 : for (size_t i=0; i < nodeListSize; i++)
136011 : {
136012 0 : ROSE_ASSERT(nodeList[i] != NULL);
136013 : #if 0
136014 : traversal.visit(nodeList[i]);
136015 : #else
136016 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
136017 : {
136018 0 : traversal.visit(nodeList[i]);
136019 : }
136020 : #endif
136021 : }
136022 : #endif
136023 : }
136024 :
136025 : // This should not be required since all previously static data members are
136026 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
136027 :
136028 5342 : }
136029 :
136030 :
136031 : void
136032 194 : SgUpcBlocksizeofExpression::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
136033 : {
136034 : // This function traverses the memory pool for an IR node and
136035 : // calls the function to execute the visitor object.
136036 :
136037 : // Initialize array to the address of the first element of the STL vector
136038 : // (which is guarenteed to be contiguous storage).
136039 : // SgUpcBlocksizeofExpression objectArray [] = *(Memory_Block_List.begin());
136040 194 : if (SgUpcBlocksizeofExpression::pools.empty() == false)
136041 : {
136042 : // Generate an array of memory pools
136043 0 : SgUpcBlocksizeofExpression** objectArray = (SgUpcBlocksizeofExpression**) &(SgUpcBlocksizeofExpression::pools[0]);
136044 :
136045 : // Build a local variable for better performance
136046 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
136047 :
136048 : // Iterate over the memory pools
136049 0 : for (unsigned int i=0; i < SgUpcBlocksizeofExpression::pools.size(); i++)
136050 : {
136051 : // objectArray[i] is a single memory pool
136052 0 : for (unsigned j=0; j < SgUpcBlocksizeofExpression::pool_size; j++)
136053 : {
136054 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
136055 : {
136056 : // printf ("Found a valid SgUpcBlocksizeofExpression object in the memory pool %d at position %d \n",i,j);
136057 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
136058 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
136059 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
136060 : }
136061 : else
136062 : {
136063 : // printf ("Found a INVALID SgUpcBlocksizeofExpression object in the memory pool \n");
136064 : }
136065 : }
136066 : }
136067 : }
136068 :
136069 : // This should not be required since all previously static data members are
136070 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
136071 :
136072 194 : }
136073 :
136074 : void
136075 0 : SgUpcBlocksizeofExpression::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
136076 : {
136077 : // This function visits only a single IR node of the memory pool.
136078 : // it is typically called once for each type of IR node within
136079 : // the automatically generated function: traverseRepresentativeNodes().
136080 :
136081 : // Initialize array to the address of the first element of the STL vector
136082 : // (which is guarenteed to be contiguous storage).
136083 : // SgUpcBlocksizeofExpression objectArray [] = *(Memory_Block_List.begin());
136084 0 : if (SgUpcBlocksizeofExpression::pools.empty() == false)
136085 : {
136086 : // Generate an array of memory pools
136087 0 : SgUpcBlocksizeofExpression** objectArray = (SgUpcBlocksizeofExpression**) &(SgUpcBlocksizeofExpression::pools[0]);
136088 :
136089 : // Build a local variable for better performance
136090 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
136091 :
136092 : // Iterate over the memory pools
136093 0 : bool done = false;
136094 0 : unsigned i=0;
136095 :
136096 : // find the first valid IR node, call visit function, and then leave
136097 0 : while ( done == false && i < SgUpcBlocksizeofExpression::pools.size() )
136098 : {
136099 : // objectArray[i] is a single memory pool
136100 : unsigned j=0;
136101 0 : while (done == false && j < SgUpcBlocksizeofExpression::pool_size)
136102 : {
136103 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
136104 : {
136105 0 : traversal.visit(&(objectArray[i][j]));
136106 0 : done = true;
136107 : }
136108 0 : j++;
136109 : }
136110 0 : i++;
136111 : }
136112 :
136113 : #if 0
136114 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
136115 : if (done == false)
136116 : {
136117 : printf ("No representative for SgUpcBlocksizeofExpression found in memory pools \n");
136118 : }
136119 : #endif
136120 : }
136121 0 : }
136122 :
136123 :
136124 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
136125 : // using values that overflow signed values of int.
136126 : size_t
136127 4 : SgUpcBlocksizeofExpression::numberOfNodes()
136128 : {
136129 : // This function traverses the memory pool for an IR node and
136130 : // counts the number of IR nodes of a particular Sage III IR
136131 : // nodes type.
136132 :
136133 4 : size_t count = 0;
136134 4 : if (SgUpcBlocksizeofExpression::pools.empty() == false)
136135 : {
136136 : // Generate an array of memory pools (this is actually a STL vector,
136137 : // but it is contiguious, so OK to treat this way).
136138 0 : SgUpcBlocksizeofExpression** objectArray = (SgUpcBlocksizeofExpression**) &(SgUpcBlocksizeofExpression::pools[0]);
136139 :
136140 : // Build a local variable for better performance (make it a loop invariant variable).
136141 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
136142 :
136143 : // Iterate over all of the memory pools for this IR node.
136144 0 : for (unsigned int i=0; i < SgUpcBlocksizeofExpression::pools.size(); i++)
136145 : {
136146 : // objectArray[i] is a single memory pool, iterate over all the
136147 : // IR nodes and only count those that are valid IR nodes used in
136148 : // the AST (i.e. allocated IR nodes).
136149 0 : for (unsigned j=0; j < SgUpcBlocksizeofExpression::pool_size; j++)
136150 : {
136151 : // This is indexing the STL vector of C/C++ style arrays as a doubly
136152 : // indexed array access. It is OK since we have leveraged the semantics
136153 : // of STL vector memory as contigous and cast the memory as an array
136154 : // of arrays to use the 2D array indexing. Hope this is not confusing,
136155 : // but it s very fast as an implementation.
136156 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
136157 : {
136158 0 : count++;
136159 : }
136160 : }
136161 : }
136162 : }
136163 :
136164 :
136165 :
136166 4 : return count;
136167 : }
136168 :
136169 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
136170 : // using values that overflow signed values of int.
136171 : size_t
136172 0 : SgUpcBlocksizeofExpression::memoryUsage()
136173 : {
136174 : // This function is required because we need the class name as a type when we call sizeof
136175 : // There might be another way to implement this if we have a traversal that only called a
136176 : // representative object (one call for each type of Sage IIIIR node).
136177 0 : size_t memory = numberOfNodes() * sizeof(SgUpcBlocksizeofExpression);
136178 :
136179 0 : return memory;
136180 : }
136181 :
136182 : /* #line 136183 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
136183 :
136184 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
136185 : void
136186 5342 : SgUpcElemsizeofExpression::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
136187 : {
136188 : // This function traverses the memory pool for only a specific IR node
136189 : // and calls the visit function of the input class execute a traversal
136190 : // similar to the style of the attribute based traversals within ROSE.
136191 : // This traversal will visit ALL nodes of the AST where as the other
136192 : // attribute based traversals visit only the embedded tree within the AST.
136193 :
136194 : // Initialize array to the address of the first element of the STL vector
136195 : // (which is guaranteed to be contiguous storage).
136196 : // SgUpcElemsizeofExpression objectArray [] = *(Memory_Block_List.begin());
136197 5342 : if (SgUpcElemsizeofExpression::pools.empty() == false)
136198 : {
136199 : // Generate an array of memory pools
136200 0 : SgUpcElemsizeofExpression** objectArray = (SgUpcElemsizeofExpression**) &(SgUpcElemsizeofExpression::pools[0]);
136201 :
136202 : // Build a local variable for better performance
136203 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
136204 : #if 0
136205 : // Iterate over the memory pools
136206 : for (unsigned int i=0; i < SgUpcElemsizeofExpression::pools.size(); i++)
136207 : {
136208 : // objectArray[i] is a single memory pool
136209 : for (int j=0; j < SgUpcElemsizeofExpression::pool_size; j++)
136210 : {
136211 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
136212 : {
136213 : traversal.visit(&(objectArray[i][j]));
136214 : }
136215 : }
136216 : }
136217 : #else
136218 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
136219 : // compute the list first and then call the visit function on each list element.
136220 :
136221 : // printf ("Inside of SgUpcElemsizeofExpression::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
136222 :
136223 0 : std::vector<SgUpcElemsizeofExpression*> nodeList;
136224 :
136225 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
136226 0 : for (unsigned int i=0; i < SgUpcElemsizeofExpression::pools.size(); i++)
136227 : {
136228 : // objectArray[i] is a single memory pool
136229 0 : for (unsigned j=0; j < SgUpcElemsizeofExpression::pool_size; j++)
136230 : {
136231 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
136232 : {
136233 0 : nodeList.push_back(&(objectArray[i][j]));
136234 : }
136235 : }
136236 : }
136237 :
136238 : // Iterate over the saved list
136239 0 : size_t nodeListSize = nodeList.size();
136240 0 : for (size_t i=0; i < nodeListSize; i++)
136241 : {
136242 0 : ROSE_ASSERT(nodeList[i] != NULL);
136243 : #if 0
136244 : traversal.visit(nodeList[i]);
136245 : #else
136246 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
136247 : {
136248 0 : traversal.visit(nodeList[i]);
136249 : }
136250 : #endif
136251 : }
136252 : #endif
136253 : }
136254 :
136255 : // This should not be required since all previously static data members are
136256 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
136257 :
136258 5342 : }
136259 :
136260 :
136261 : void
136262 194 : SgUpcElemsizeofExpression::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
136263 : {
136264 : // This function traverses the memory pool for an IR node and
136265 : // calls the function to execute the visitor object.
136266 :
136267 : // Initialize array to the address of the first element of the STL vector
136268 : // (which is guarenteed to be contiguous storage).
136269 : // SgUpcElemsizeofExpression objectArray [] = *(Memory_Block_List.begin());
136270 194 : if (SgUpcElemsizeofExpression::pools.empty() == false)
136271 : {
136272 : // Generate an array of memory pools
136273 0 : SgUpcElemsizeofExpression** objectArray = (SgUpcElemsizeofExpression**) &(SgUpcElemsizeofExpression::pools[0]);
136274 :
136275 : // Build a local variable for better performance
136276 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
136277 :
136278 : // Iterate over the memory pools
136279 0 : for (unsigned int i=0; i < SgUpcElemsizeofExpression::pools.size(); i++)
136280 : {
136281 : // objectArray[i] is a single memory pool
136282 0 : for (unsigned j=0; j < SgUpcElemsizeofExpression::pool_size; j++)
136283 : {
136284 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
136285 : {
136286 : // printf ("Found a valid SgUpcElemsizeofExpression object in the memory pool %d at position %d \n",i,j);
136287 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
136288 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
136289 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
136290 : }
136291 : else
136292 : {
136293 : // printf ("Found a INVALID SgUpcElemsizeofExpression object in the memory pool \n");
136294 : }
136295 : }
136296 : }
136297 : }
136298 :
136299 : // This should not be required since all previously static data members are
136300 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
136301 :
136302 194 : }
136303 :
136304 : void
136305 0 : SgUpcElemsizeofExpression::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
136306 : {
136307 : // This function visits only a single IR node of the memory pool.
136308 : // it is typically called once for each type of IR node within
136309 : // the automatically generated function: traverseRepresentativeNodes().
136310 :
136311 : // Initialize array to the address of the first element of the STL vector
136312 : // (which is guarenteed to be contiguous storage).
136313 : // SgUpcElemsizeofExpression objectArray [] = *(Memory_Block_List.begin());
136314 0 : if (SgUpcElemsizeofExpression::pools.empty() == false)
136315 : {
136316 : // Generate an array of memory pools
136317 0 : SgUpcElemsizeofExpression** objectArray = (SgUpcElemsizeofExpression**) &(SgUpcElemsizeofExpression::pools[0]);
136318 :
136319 : // Build a local variable for better performance
136320 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
136321 :
136322 : // Iterate over the memory pools
136323 0 : bool done = false;
136324 0 : unsigned i=0;
136325 :
136326 : // find the first valid IR node, call visit function, and then leave
136327 0 : while ( done == false && i < SgUpcElemsizeofExpression::pools.size() )
136328 : {
136329 : // objectArray[i] is a single memory pool
136330 : unsigned j=0;
136331 0 : while (done == false && j < SgUpcElemsizeofExpression::pool_size)
136332 : {
136333 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
136334 : {
136335 0 : traversal.visit(&(objectArray[i][j]));
136336 0 : done = true;
136337 : }
136338 0 : j++;
136339 : }
136340 0 : i++;
136341 : }
136342 :
136343 : #if 0
136344 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
136345 : if (done == false)
136346 : {
136347 : printf ("No representative for SgUpcElemsizeofExpression found in memory pools \n");
136348 : }
136349 : #endif
136350 : }
136351 0 : }
136352 :
136353 :
136354 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
136355 : // using values that overflow signed values of int.
136356 : size_t
136357 4 : SgUpcElemsizeofExpression::numberOfNodes()
136358 : {
136359 : // This function traverses the memory pool for an IR node and
136360 : // counts the number of IR nodes of a particular Sage III IR
136361 : // nodes type.
136362 :
136363 4 : size_t count = 0;
136364 4 : if (SgUpcElemsizeofExpression::pools.empty() == false)
136365 : {
136366 : // Generate an array of memory pools (this is actually a STL vector,
136367 : // but it is contiguious, so OK to treat this way).
136368 0 : SgUpcElemsizeofExpression** objectArray = (SgUpcElemsizeofExpression**) &(SgUpcElemsizeofExpression::pools[0]);
136369 :
136370 : // Build a local variable for better performance (make it a loop invariant variable).
136371 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
136372 :
136373 : // Iterate over all of the memory pools for this IR node.
136374 0 : for (unsigned int i=0; i < SgUpcElemsizeofExpression::pools.size(); i++)
136375 : {
136376 : // objectArray[i] is a single memory pool, iterate over all the
136377 : // IR nodes and only count those that are valid IR nodes used in
136378 : // the AST (i.e. allocated IR nodes).
136379 0 : for (unsigned j=0; j < SgUpcElemsizeofExpression::pool_size; j++)
136380 : {
136381 : // This is indexing the STL vector of C/C++ style arrays as a doubly
136382 : // indexed array access. It is OK since we have leveraged the semantics
136383 : // of STL vector memory as contigous and cast the memory as an array
136384 : // of arrays to use the 2D array indexing. Hope this is not confusing,
136385 : // but it s very fast as an implementation.
136386 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
136387 : {
136388 0 : count++;
136389 : }
136390 : }
136391 : }
136392 : }
136393 :
136394 :
136395 :
136396 4 : return count;
136397 : }
136398 :
136399 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
136400 : // using values that overflow signed values of int.
136401 : size_t
136402 0 : SgUpcElemsizeofExpression::memoryUsage()
136403 : {
136404 : // This function is required because we need the class name as a type when we call sizeof
136405 : // There might be another way to implement this if we have a traversal that only called a
136406 : // representative object (one call for each type of Sage IIIIR node).
136407 0 : size_t memory = numberOfNodes() * sizeof(SgUpcElemsizeofExpression);
136408 :
136409 0 : return memory;
136410 : }
136411 :
136412 : /* #line 136413 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
136413 :
136414 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
136415 : void
136416 5342 : SgSuperExp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
136417 : {
136418 : // This function traverses the memory pool for only a specific IR node
136419 : // and calls the visit function of the input class execute a traversal
136420 : // similar to the style of the attribute based traversals within ROSE.
136421 : // This traversal will visit ALL nodes of the AST where as the other
136422 : // attribute based traversals visit only the embedded tree within the AST.
136423 :
136424 : // Initialize array to the address of the first element of the STL vector
136425 : // (which is guaranteed to be contiguous storage).
136426 : // SgSuperExp objectArray [] = *(Memory_Block_List.begin());
136427 5342 : if (SgSuperExp::pools.empty() == false)
136428 : {
136429 : // Generate an array of memory pools
136430 0 : SgSuperExp** objectArray = (SgSuperExp**) &(SgSuperExp::pools[0]);
136431 :
136432 : // Build a local variable for better performance
136433 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
136434 : #if 0
136435 : // Iterate over the memory pools
136436 : for (unsigned int i=0; i < SgSuperExp::pools.size(); i++)
136437 : {
136438 : // objectArray[i] is a single memory pool
136439 : for (int j=0; j < SgSuperExp::pool_size; j++)
136440 : {
136441 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
136442 : {
136443 : traversal.visit(&(objectArray[i][j]));
136444 : }
136445 : }
136446 : }
136447 : #else
136448 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
136449 : // compute the list first and then call the visit function on each list element.
136450 :
136451 : // printf ("Inside of SgSuperExp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
136452 :
136453 0 : std::vector<SgSuperExp*> nodeList;
136454 :
136455 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
136456 0 : for (unsigned int i=0; i < SgSuperExp::pools.size(); i++)
136457 : {
136458 : // objectArray[i] is a single memory pool
136459 0 : for (unsigned j=0; j < SgSuperExp::pool_size; j++)
136460 : {
136461 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
136462 : {
136463 0 : nodeList.push_back(&(objectArray[i][j]));
136464 : }
136465 : }
136466 : }
136467 :
136468 : // Iterate over the saved list
136469 0 : size_t nodeListSize = nodeList.size();
136470 0 : for (size_t i=0; i < nodeListSize; i++)
136471 : {
136472 0 : ROSE_ASSERT(nodeList[i] != NULL);
136473 : #if 0
136474 : traversal.visit(nodeList[i]);
136475 : #else
136476 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
136477 : {
136478 0 : traversal.visit(nodeList[i]);
136479 : }
136480 : #endif
136481 : }
136482 : #endif
136483 : }
136484 :
136485 : // This should not be required since all previously static data members are
136486 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
136487 :
136488 5342 : }
136489 :
136490 :
136491 : void
136492 194 : SgSuperExp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
136493 : {
136494 : // This function traverses the memory pool for an IR node and
136495 : // calls the function to execute the visitor object.
136496 :
136497 : // Initialize array to the address of the first element of the STL vector
136498 : // (which is guarenteed to be contiguous storage).
136499 : // SgSuperExp objectArray [] = *(Memory_Block_List.begin());
136500 194 : if (SgSuperExp::pools.empty() == false)
136501 : {
136502 : // Generate an array of memory pools
136503 0 : SgSuperExp** objectArray = (SgSuperExp**) &(SgSuperExp::pools[0]);
136504 :
136505 : // Build a local variable for better performance
136506 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
136507 :
136508 : // Iterate over the memory pools
136509 0 : for (unsigned int i=0; i < SgSuperExp::pools.size(); i++)
136510 : {
136511 : // objectArray[i] is a single memory pool
136512 0 : for (unsigned j=0; j < SgSuperExp::pool_size; j++)
136513 : {
136514 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
136515 : {
136516 : // printf ("Found a valid SgSuperExp object in the memory pool %d at position %d \n",i,j);
136517 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
136518 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
136519 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
136520 : }
136521 : else
136522 : {
136523 : // printf ("Found a INVALID SgSuperExp object in the memory pool \n");
136524 : }
136525 : }
136526 : }
136527 : }
136528 :
136529 : // This should not be required since all previously static data members are
136530 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
136531 :
136532 194 : }
136533 :
136534 : void
136535 0 : SgSuperExp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
136536 : {
136537 : // This function visits only a single IR node of the memory pool.
136538 : // it is typically called once for each type of IR node within
136539 : // the automatically generated function: traverseRepresentativeNodes().
136540 :
136541 : // Initialize array to the address of the first element of the STL vector
136542 : // (which is guarenteed to be contiguous storage).
136543 : // SgSuperExp objectArray [] = *(Memory_Block_List.begin());
136544 0 : if (SgSuperExp::pools.empty() == false)
136545 : {
136546 : // Generate an array of memory pools
136547 0 : SgSuperExp** objectArray = (SgSuperExp**) &(SgSuperExp::pools[0]);
136548 :
136549 : // Build a local variable for better performance
136550 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
136551 :
136552 : // Iterate over the memory pools
136553 0 : bool done = false;
136554 0 : unsigned i=0;
136555 :
136556 : // find the first valid IR node, call visit function, and then leave
136557 0 : while ( done == false && i < SgSuperExp::pools.size() )
136558 : {
136559 : // objectArray[i] is a single memory pool
136560 : unsigned j=0;
136561 0 : while (done == false && j < SgSuperExp::pool_size)
136562 : {
136563 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
136564 : {
136565 0 : traversal.visit(&(objectArray[i][j]));
136566 0 : done = true;
136567 : }
136568 0 : j++;
136569 : }
136570 0 : i++;
136571 : }
136572 :
136573 : #if 0
136574 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
136575 : if (done == false)
136576 : {
136577 : printf ("No representative for SgSuperExp found in memory pools \n");
136578 : }
136579 : #endif
136580 : }
136581 0 : }
136582 :
136583 :
136584 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
136585 : // using values that overflow signed values of int.
136586 : size_t
136587 4 : SgSuperExp::numberOfNodes()
136588 : {
136589 : // This function traverses the memory pool for an IR node and
136590 : // counts the number of IR nodes of a particular Sage III IR
136591 : // nodes type.
136592 :
136593 4 : size_t count = 0;
136594 4 : if (SgSuperExp::pools.empty() == false)
136595 : {
136596 : // Generate an array of memory pools (this is actually a STL vector,
136597 : // but it is contiguious, so OK to treat this way).
136598 0 : SgSuperExp** objectArray = (SgSuperExp**) &(SgSuperExp::pools[0]);
136599 :
136600 : // Build a local variable for better performance (make it a loop invariant variable).
136601 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
136602 :
136603 : // Iterate over all of the memory pools for this IR node.
136604 0 : for (unsigned int i=0; i < SgSuperExp::pools.size(); i++)
136605 : {
136606 : // objectArray[i] is a single memory pool, iterate over all the
136607 : // IR nodes and only count those that are valid IR nodes used in
136608 : // the AST (i.e. allocated IR nodes).
136609 0 : for (unsigned j=0; j < SgSuperExp::pool_size; j++)
136610 : {
136611 : // This is indexing the STL vector of C/C++ style arrays as a doubly
136612 : // indexed array access. It is OK since we have leveraged the semantics
136613 : // of STL vector memory as contigous and cast the memory as an array
136614 : // of arrays to use the 2D array indexing. Hope this is not confusing,
136615 : // but it s very fast as an implementation.
136616 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
136617 : {
136618 0 : count++;
136619 : }
136620 : }
136621 : }
136622 : }
136623 :
136624 :
136625 :
136626 4 : return count;
136627 : }
136628 :
136629 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
136630 : // using values that overflow signed values of int.
136631 : size_t
136632 0 : SgSuperExp::memoryUsage()
136633 : {
136634 : // This function is required because we need the class name as a type when we call sizeof
136635 : // There might be another way to implement this if we have a traversal that only called a
136636 : // representative object (one call for each type of Sage IIIIR node).
136637 0 : size_t memory = numberOfNodes() * sizeof(SgSuperExp);
136638 :
136639 0 : return memory;
136640 : }
136641 :
136642 : /* #line 136643 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
136643 :
136644 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
136645 : void
136646 5342 : SgTypeIdOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
136647 : {
136648 : // This function traverses the memory pool for only a specific IR node
136649 : // and calls the visit function of the input class execute a traversal
136650 : // similar to the style of the attribute based traversals within ROSE.
136651 : // This traversal will visit ALL nodes of the AST where as the other
136652 : // attribute based traversals visit only the embedded tree within the AST.
136653 :
136654 : // Initialize array to the address of the first element of the STL vector
136655 : // (which is guaranteed to be contiguous storage).
136656 : // SgTypeIdOp objectArray [] = *(Memory_Block_List.begin());
136657 5342 : if (SgTypeIdOp::pools.empty() == false)
136658 : {
136659 : // Generate an array of memory pools
136660 138 : SgTypeIdOp** objectArray = (SgTypeIdOp**) &(SgTypeIdOp::pools[0]);
136661 :
136662 : // Build a local variable for better performance
136663 138 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
136664 : #if 0
136665 : // Iterate over the memory pools
136666 : for (unsigned int i=0; i < SgTypeIdOp::pools.size(); i++)
136667 : {
136668 : // objectArray[i] is a single memory pool
136669 : for (int j=0; j < SgTypeIdOp::pool_size; j++)
136670 : {
136671 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
136672 : {
136673 : traversal.visit(&(objectArray[i][j]));
136674 : }
136675 : }
136676 : }
136677 : #else
136678 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
136679 : // compute the list first and then call the visit function on each list element.
136680 :
136681 : // printf ("Inside of SgTypeIdOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
136682 :
136683 276 : std::vector<SgTypeIdOp*> nodeList;
136684 :
136685 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
136686 276 : for (unsigned int i=0; i < SgTypeIdOp::pools.size(); i++)
136687 : {
136688 : // objectArray[i] is a single memory pool
136689 276138 : for (unsigned j=0; j < SgTypeIdOp::pool_size; j++)
136690 : {
136691 276000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
136692 : {
136693 138 : nodeList.push_back(&(objectArray[i][j]));
136694 : }
136695 : }
136696 : }
136697 :
136698 : // Iterate over the saved list
136699 138 : size_t nodeListSize = nodeList.size();
136700 276 : for (size_t i=0; i < nodeListSize; i++)
136701 : {
136702 138 : ROSE_ASSERT(nodeList[i] != NULL);
136703 : #if 0
136704 : traversal.visit(nodeList[i]);
136705 : #else
136706 138 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
136707 : {
136708 138 : traversal.visit(nodeList[i]);
136709 : }
136710 : #endif
136711 : }
136712 : #endif
136713 : }
136714 :
136715 : // This should not be required since all previously static data members are
136716 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
136717 :
136718 5342 : }
136719 :
136720 :
136721 : void
136722 194 : SgTypeIdOp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
136723 : {
136724 : // This function traverses the memory pool for an IR node and
136725 : // calls the function to execute the visitor object.
136726 :
136727 : // Initialize array to the address of the first element of the STL vector
136728 : // (which is guarenteed to be contiguous storage).
136729 : // SgTypeIdOp objectArray [] = *(Memory_Block_List.begin());
136730 194 : if (SgTypeIdOp::pools.empty() == false)
136731 : {
136732 : // Generate an array of memory pools
136733 137 : SgTypeIdOp** objectArray = (SgTypeIdOp**) &(SgTypeIdOp::pools[0]);
136734 :
136735 : // Build a local variable for better performance
136736 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
136737 :
136738 : // Iterate over the memory pools
136739 274 : for (unsigned int i=0; i < SgTypeIdOp::pools.size(); i++)
136740 : {
136741 : // objectArray[i] is a single memory pool
136742 274137 : for (unsigned j=0; j < SgTypeIdOp::pool_size; j++)
136743 : {
136744 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
136745 : {
136746 : // printf ("Found a valid SgTypeIdOp object in the memory pool %d at position %d \n",i,j);
136747 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
136748 137 : objectArray[i][j].executeVisitorMemberFunction(visitor);
136749 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
136750 : }
136751 : else
136752 : {
136753 : // printf ("Found a INVALID SgTypeIdOp object in the memory pool \n");
136754 : }
136755 : }
136756 : }
136757 : }
136758 :
136759 : // This should not be required since all previously static data members are
136760 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
136761 :
136762 194 : }
136763 :
136764 : void
136765 0 : SgTypeIdOp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
136766 : {
136767 : // This function visits only a single IR node of the memory pool.
136768 : // it is typically called once for each type of IR node within
136769 : // the automatically generated function: traverseRepresentativeNodes().
136770 :
136771 : // Initialize array to the address of the first element of the STL vector
136772 : // (which is guarenteed to be contiguous storage).
136773 : // SgTypeIdOp objectArray [] = *(Memory_Block_List.begin());
136774 0 : if (SgTypeIdOp::pools.empty() == false)
136775 : {
136776 : // Generate an array of memory pools
136777 0 : SgTypeIdOp** objectArray = (SgTypeIdOp**) &(SgTypeIdOp::pools[0]);
136778 :
136779 : // Build a local variable for better performance
136780 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
136781 :
136782 : // Iterate over the memory pools
136783 0 : bool done = false;
136784 0 : unsigned i=0;
136785 :
136786 : // find the first valid IR node, call visit function, and then leave
136787 0 : while ( done == false && i < SgTypeIdOp::pools.size() )
136788 : {
136789 : // objectArray[i] is a single memory pool
136790 : unsigned j=0;
136791 0 : while (done == false && j < SgTypeIdOp::pool_size)
136792 : {
136793 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
136794 : {
136795 0 : traversal.visit(&(objectArray[i][j]));
136796 0 : done = true;
136797 : }
136798 0 : j++;
136799 : }
136800 0 : i++;
136801 : }
136802 :
136803 : #if 0
136804 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
136805 : if (done == false)
136806 : {
136807 : printf ("No representative for SgTypeIdOp found in memory pools \n");
136808 : }
136809 : #endif
136810 : }
136811 0 : }
136812 :
136813 :
136814 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
136815 : // using values that overflow signed values of int.
136816 : size_t
136817 4 : SgTypeIdOp::numberOfNodes()
136818 : {
136819 : // This function traverses the memory pool for an IR node and
136820 : // counts the number of IR nodes of a particular Sage III IR
136821 : // nodes type.
136822 :
136823 4 : size_t count = 0;
136824 4 : if (SgTypeIdOp::pools.empty() == false)
136825 : {
136826 : // Generate an array of memory pools (this is actually a STL vector,
136827 : // but it is contiguious, so OK to treat this way).
136828 1 : SgTypeIdOp** objectArray = (SgTypeIdOp**) &(SgTypeIdOp::pools[0]);
136829 :
136830 : // Build a local variable for better performance (make it a loop invariant variable).
136831 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
136832 :
136833 : // Iterate over all of the memory pools for this IR node.
136834 2 : for (unsigned int i=0; i < SgTypeIdOp::pools.size(); i++)
136835 : {
136836 : // objectArray[i] is a single memory pool, iterate over all the
136837 : // IR nodes and only count those that are valid IR nodes used in
136838 : // the AST (i.e. allocated IR nodes).
136839 2001 : for (unsigned j=0; j < SgTypeIdOp::pool_size; j++)
136840 : {
136841 : // This is indexing the STL vector of C/C++ style arrays as a doubly
136842 : // indexed array access. It is OK since we have leveraged the semantics
136843 : // of STL vector memory as contigous and cast the memory as an array
136844 : // of arrays to use the 2D array indexing. Hope this is not confusing,
136845 : // but it s very fast as an implementation.
136846 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
136847 : {
136848 1 : count++;
136849 : }
136850 : }
136851 : }
136852 : }
136853 :
136854 :
136855 :
136856 4 : return count;
136857 : }
136858 :
136859 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
136860 : // using values that overflow signed values of int.
136861 : size_t
136862 0 : SgTypeIdOp::memoryUsage()
136863 : {
136864 : // This function is required because we need the class name as a type when we call sizeof
136865 : // There might be another way to implement this if we have a traversal that only called a
136866 : // representative object (one call for each type of Sage IIIIR node).
136867 0 : size_t memory = numberOfNodes() * sizeof(SgTypeIdOp);
136868 :
136869 0 : return memory;
136870 : }
136871 :
136872 : /* #line 136873 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
136873 :
136874 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
136875 : void
136876 5342 : SgConditionalExp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
136877 : {
136878 : // This function traverses the memory pool for only a specific IR node
136879 : // and calls the visit function of the input class execute a traversal
136880 : // similar to the style of the attribute based traversals within ROSE.
136881 : // This traversal will visit ALL nodes of the AST where as the other
136882 : // attribute based traversals visit only the embedded tree within the AST.
136883 :
136884 : // Initialize array to the address of the first element of the STL vector
136885 : // (which is guaranteed to be contiguous storage).
136886 : // SgConditionalExp objectArray [] = *(Memory_Block_List.begin());
136887 5342 : if (SgConditionalExp::pools.empty() == false)
136888 : {
136889 : // Generate an array of memory pools
136890 670 : SgConditionalExp** objectArray = (SgConditionalExp**) &(SgConditionalExp::pools[0]);
136891 :
136892 : // Build a local variable for better performance
136893 670 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
136894 : #if 0
136895 : // Iterate over the memory pools
136896 : for (unsigned int i=0; i < SgConditionalExp::pools.size(); i++)
136897 : {
136898 : // objectArray[i] is a single memory pool
136899 : for (int j=0; j < SgConditionalExp::pool_size; j++)
136900 : {
136901 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
136902 : {
136903 : traversal.visit(&(objectArray[i][j]));
136904 : }
136905 : }
136906 : }
136907 : #else
136908 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
136909 : // compute the list first and then call the visit function on each list element.
136910 :
136911 : // printf ("Inside of SgConditionalExp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
136912 :
136913 1340 : std::vector<SgConditionalExp*> nodeList;
136914 :
136915 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
136916 1340 : for (unsigned int i=0; i < SgConditionalExp::pools.size(); i++)
136917 : {
136918 : // objectArray[i] is a single memory pool
136919 1340670 : for (unsigned j=0; j < SgConditionalExp::pool_size; j++)
136920 : {
136921 1340000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
136922 : {
136923 18773 : nodeList.push_back(&(objectArray[i][j]));
136924 : }
136925 : }
136926 : }
136927 :
136928 : // Iterate over the saved list
136929 670 : size_t nodeListSize = nodeList.size();
136930 19443 : for (size_t i=0; i < nodeListSize; i++)
136931 : {
136932 18773 : ROSE_ASSERT(nodeList[i] != NULL);
136933 : #if 0
136934 : traversal.visit(nodeList[i]);
136935 : #else
136936 18773 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
136937 : {
136938 18773 : traversal.visit(nodeList[i]);
136939 : }
136940 : #endif
136941 : }
136942 : #endif
136943 : }
136944 :
136945 : // This should not be required since all previously static data members are
136946 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
136947 :
136948 5342 : }
136949 :
136950 :
136951 : void
136952 194 : SgConditionalExp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
136953 : {
136954 : // This function traverses the memory pool for an IR node and
136955 : // calls the function to execute the visitor object.
136956 :
136957 : // Initialize array to the address of the first element of the STL vector
136958 : // (which is guarenteed to be contiguous storage).
136959 : // SgConditionalExp objectArray [] = *(Memory_Block_List.begin());
136960 194 : if (SgConditionalExp::pools.empty() == false)
136961 : {
136962 : // Generate an array of memory pools
136963 170 : SgConditionalExp** objectArray = (SgConditionalExp**) &(SgConditionalExp::pools[0]);
136964 :
136965 : // Build a local variable for better performance
136966 170 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
136967 :
136968 : // Iterate over the memory pools
136969 340 : for (unsigned int i=0; i < SgConditionalExp::pools.size(); i++)
136970 : {
136971 : // objectArray[i] is a single memory pool
136972 340170 : for (unsigned j=0; j < SgConditionalExp::pool_size; j++)
136973 : {
136974 340000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
136975 : {
136976 : // printf ("Found a valid SgConditionalExp object in the memory pool %d at position %d \n",i,j);
136977 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
136978 9971 : objectArray[i][j].executeVisitorMemberFunction(visitor);
136979 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
136980 : }
136981 : else
136982 : {
136983 : // printf ("Found a INVALID SgConditionalExp object in the memory pool \n");
136984 : }
136985 : }
136986 : }
136987 : }
136988 :
136989 : // This should not be required since all previously static data members are
136990 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
136991 :
136992 194 : }
136993 :
136994 : void
136995 0 : SgConditionalExp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
136996 : {
136997 : // This function visits only a single IR node of the memory pool.
136998 : // it is typically called once for each type of IR node within
136999 : // the automatically generated function: traverseRepresentativeNodes().
137000 :
137001 : // Initialize array to the address of the first element of the STL vector
137002 : // (which is guarenteed to be contiguous storage).
137003 : // SgConditionalExp objectArray [] = *(Memory_Block_List.begin());
137004 0 : if (SgConditionalExp::pools.empty() == false)
137005 : {
137006 : // Generate an array of memory pools
137007 0 : SgConditionalExp** objectArray = (SgConditionalExp**) &(SgConditionalExp::pools[0]);
137008 :
137009 : // Build a local variable for better performance
137010 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
137011 :
137012 : // Iterate over the memory pools
137013 0 : bool done = false;
137014 0 : unsigned i=0;
137015 :
137016 : // find the first valid IR node, call visit function, and then leave
137017 0 : while ( done == false && i < SgConditionalExp::pools.size() )
137018 : {
137019 : // objectArray[i] is a single memory pool
137020 : unsigned j=0;
137021 0 : while (done == false && j < SgConditionalExp::pool_size)
137022 : {
137023 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
137024 : {
137025 0 : traversal.visit(&(objectArray[i][j]));
137026 0 : done = true;
137027 : }
137028 0 : j++;
137029 : }
137030 0 : i++;
137031 : }
137032 :
137033 : #if 0
137034 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
137035 : if (done == false)
137036 : {
137037 : printf ("No representative for SgConditionalExp found in memory pools \n");
137038 : }
137039 : #endif
137040 : }
137041 0 : }
137042 :
137043 :
137044 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
137045 : // using values that overflow signed values of int.
137046 : size_t
137047 4 : SgConditionalExp::numberOfNodes()
137048 : {
137049 : // This function traverses the memory pool for an IR node and
137050 : // counts the number of IR nodes of a particular Sage III IR
137051 : // nodes type.
137052 :
137053 4 : size_t count = 0;
137054 4 : if (SgConditionalExp::pools.empty() == false)
137055 : {
137056 : // Generate an array of memory pools (this is actually a STL vector,
137057 : // but it is contiguious, so OK to treat this way).
137058 1 : SgConditionalExp** objectArray = (SgConditionalExp**) &(SgConditionalExp::pools[0]);
137059 :
137060 : // Build a local variable for better performance (make it a loop invariant variable).
137061 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
137062 :
137063 : // Iterate over all of the memory pools for this IR node.
137064 2 : for (unsigned int i=0; i < SgConditionalExp::pools.size(); i++)
137065 : {
137066 : // objectArray[i] is a single memory pool, iterate over all the
137067 : // IR nodes and only count those that are valid IR nodes used in
137068 : // the AST (i.e. allocated IR nodes).
137069 2001 : for (unsigned j=0; j < SgConditionalExp::pool_size; j++)
137070 : {
137071 : // This is indexing the STL vector of C/C++ style arrays as a doubly
137072 : // indexed array access. It is OK since we have leveraged the semantics
137073 : // of STL vector memory as contigous and cast the memory as an array
137074 : // of arrays to use the 2D array indexing. Hope this is not confusing,
137075 : // but it s very fast as an implementation.
137076 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
137077 : {
137078 71 : count++;
137079 : }
137080 : }
137081 : }
137082 : }
137083 :
137084 :
137085 :
137086 4 : return count;
137087 : }
137088 :
137089 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
137090 : // using values that overflow signed values of int.
137091 : size_t
137092 0 : SgConditionalExp::memoryUsage()
137093 : {
137094 : // This function is required because we need the class name as a type when we call sizeof
137095 : // There might be another way to implement this if we have a traversal that only called a
137096 : // representative object (one call for each type of Sage IIIIR node).
137097 0 : size_t memory = numberOfNodes() * sizeof(SgConditionalExp);
137098 :
137099 0 : return memory;
137100 : }
137101 :
137102 : /* #line 137103 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
137103 :
137104 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
137105 : void
137106 5342 : SgNewExp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
137107 : {
137108 : // This function traverses the memory pool for only a specific IR node
137109 : // and calls the visit function of the input class execute a traversal
137110 : // similar to the style of the attribute based traversals within ROSE.
137111 : // This traversal will visit ALL nodes of the AST where as the other
137112 : // attribute based traversals visit only the embedded tree within the AST.
137113 :
137114 : // Initialize array to the address of the first element of the STL vector
137115 : // (which is guaranteed to be contiguous storage).
137116 : // SgNewExp objectArray [] = *(Memory_Block_List.begin());
137117 5342 : if (SgNewExp::pools.empty() == false)
137118 : {
137119 : // Generate an array of memory pools
137120 160 : SgNewExp** objectArray = (SgNewExp**) &(SgNewExp::pools[0]);
137121 :
137122 : // Build a local variable for better performance
137123 160 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
137124 : #if 0
137125 : // Iterate over the memory pools
137126 : for (unsigned int i=0; i < SgNewExp::pools.size(); i++)
137127 : {
137128 : // objectArray[i] is a single memory pool
137129 : for (int j=0; j < SgNewExp::pool_size; j++)
137130 : {
137131 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
137132 : {
137133 : traversal.visit(&(objectArray[i][j]));
137134 : }
137135 : }
137136 : }
137137 : #else
137138 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
137139 : // compute the list first and then call the visit function on each list element.
137140 :
137141 : // printf ("Inside of SgNewExp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
137142 :
137143 320 : std::vector<SgNewExp*> nodeList;
137144 :
137145 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
137146 320 : for (unsigned int i=0; i < SgNewExp::pools.size(); i++)
137147 : {
137148 : // objectArray[i] is a single memory pool
137149 320160 : for (unsigned j=0; j < SgNewExp::pool_size; j++)
137150 : {
137151 320000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
137152 : {
137153 1818 : nodeList.push_back(&(objectArray[i][j]));
137154 : }
137155 : }
137156 : }
137157 :
137158 : // Iterate over the saved list
137159 160 : size_t nodeListSize = nodeList.size();
137160 1978 : for (size_t i=0; i < nodeListSize; i++)
137161 : {
137162 1818 : ROSE_ASSERT(nodeList[i] != NULL);
137163 : #if 0
137164 : traversal.visit(nodeList[i]);
137165 : #else
137166 1818 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
137167 : {
137168 1818 : traversal.visit(nodeList[i]);
137169 : }
137170 : #endif
137171 : }
137172 : #endif
137173 : }
137174 :
137175 : // This should not be required since all previously static data members are
137176 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
137177 :
137178 5342 : }
137179 :
137180 :
137181 : void
137182 194 : SgNewExp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
137183 : {
137184 : // This function traverses the memory pool for an IR node and
137185 : // calls the function to execute the visitor object.
137186 :
137187 : // Initialize array to the address of the first element of the STL vector
137188 : // (which is guarenteed to be contiguous storage).
137189 : // SgNewExp objectArray [] = *(Memory_Block_List.begin());
137190 194 : if (SgNewExp::pools.empty() == false)
137191 : {
137192 : // Generate an array of memory pools
137193 137 : SgNewExp** objectArray = (SgNewExp**) &(SgNewExp::pools[0]);
137194 :
137195 : // Build a local variable for better performance
137196 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
137197 :
137198 : // Iterate over the memory pools
137199 274 : for (unsigned int i=0; i < SgNewExp::pools.size(); i++)
137200 : {
137201 : // objectArray[i] is a single memory pool
137202 274137 : for (unsigned j=0; j < SgNewExp::pool_size; j++)
137203 : {
137204 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
137205 : {
137206 : // printf ("Found a valid SgNewExp object in the memory pool %d at position %d \n",i,j);
137207 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
137208 1954 : objectArray[i][j].executeVisitorMemberFunction(visitor);
137209 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
137210 : }
137211 : else
137212 : {
137213 : // printf ("Found a INVALID SgNewExp object in the memory pool \n");
137214 : }
137215 : }
137216 : }
137217 : }
137218 :
137219 : // This should not be required since all previously static data members are
137220 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
137221 :
137222 194 : }
137223 :
137224 : void
137225 0 : SgNewExp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
137226 : {
137227 : // This function visits only a single IR node of the memory pool.
137228 : // it is typically called once for each type of IR node within
137229 : // the automatically generated function: traverseRepresentativeNodes().
137230 :
137231 : // Initialize array to the address of the first element of the STL vector
137232 : // (which is guarenteed to be contiguous storage).
137233 : // SgNewExp objectArray [] = *(Memory_Block_List.begin());
137234 0 : if (SgNewExp::pools.empty() == false)
137235 : {
137236 : // Generate an array of memory pools
137237 0 : SgNewExp** objectArray = (SgNewExp**) &(SgNewExp::pools[0]);
137238 :
137239 : // Build a local variable for better performance
137240 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
137241 :
137242 : // Iterate over the memory pools
137243 0 : bool done = false;
137244 0 : unsigned i=0;
137245 :
137246 : // find the first valid IR node, call visit function, and then leave
137247 0 : while ( done == false && i < SgNewExp::pools.size() )
137248 : {
137249 : // objectArray[i] is a single memory pool
137250 : unsigned j=0;
137251 0 : while (done == false && j < SgNewExp::pool_size)
137252 : {
137253 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
137254 : {
137255 0 : traversal.visit(&(objectArray[i][j]));
137256 0 : done = true;
137257 : }
137258 0 : j++;
137259 : }
137260 0 : i++;
137261 : }
137262 :
137263 : #if 0
137264 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
137265 : if (done == false)
137266 : {
137267 : printf ("No representative for SgNewExp found in memory pools \n");
137268 : }
137269 : #endif
137270 : }
137271 0 : }
137272 :
137273 :
137274 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
137275 : // using values that overflow signed values of int.
137276 : size_t
137277 4 : SgNewExp::numberOfNodes()
137278 : {
137279 : // This function traverses the memory pool for an IR node and
137280 : // counts the number of IR nodes of a particular Sage III IR
137281 : // nodes type.
137282 :
137283 4 : size_t count = 0;
137284 4 : if (SgNewExp::pools.empty() == false)
137285 : {
137286 : // Generate an array of memory pools (this is actually a STL vector,
137287 : // but it is contiguious, so OK to treat this way).
137288 1 : SgNewExp** objectArray = (SgNewExp**) &(SgNewExp::pools[0]);
137289 :
137290 : // Build a local variable for better performance (make it a loop invariant variable).
137291 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
137292 :
137293 : // Iterate over all of the memory pools for this IR node.
137294 2 : for (unsigned int i=0; i < SgNewExp::pools.size(); i++)
137295 : {
137296 : // objectArray[i] is a single memory pool, iterate over all the
137297 : // IR nodes and only count those that are valid IR nodes used in
137298 : // the AST (i.e. allocated IR nodes).
137299 2001 : for (unsigned j=0; j < SgNewExp::pool_size; j++)
137300 : {
137301 : // This is indexing the STL vector of C/C++ style arrays as a doubly
137302 : // indexed array access. It is OK since we have leveraged the semantics
137303 : // of STL vector memory as contigous and cast the memory as an array
137304 : // of arrays to use the 2D array indexing. Hope this is not confusing,
137305 : // but it s very fast as an implementation.
137306 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
137307 : {
137308 14 : count++;
137309 : }
137310 : }
137311 : }
137312 : }
137313 :
137314 :
137315 :
137316 4 : return count;
137317 : }
137318 :
137319 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
137320 : // using values that overflow signed values of int.
137321 : size_t
137322 0 : SgNewExp::memoryUsage()
137323 : {
137324 : // This function is required because we need the class name as a type when we call sizeof
137325 : // There might be another way to implement this if we have a traversal that only called a
137326 : // representative object (one call for each type of Sage IIIIR node).
137327 0 : size_t memory = numberOfNodes() * sizeof(SgNewExp);
137328 :
137329 0 : return memory;
137330 : }
137331 :
137332 : /* #line 137333 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
137333 :
137334 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
137335 : void
137336 5342 : SgDeleteExp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
137337 : {
137338 : // This function traverses the memory pool for only a specific IR node
137339 : // and calls the visit function of the input class execute a traversal
137340 : // similar to the style of the attribute based traversals within ROSE.
137341 : // This traversal will visit ALL nodes of the AST where as the other
137342 : // attribute based traversals visit only the embedded tree within the AST.
137343 :
137344 : // Initialize array to the address of the first element of the STL vector
137345 : // (which is guaranteed to be contiguous storage).
137346 : // SgDeleteExp objectArray [] = *(Memory_Block_List.begin());
137347 5342 : if (SgDeleteExp::pools.empty() == false)
137348 : {
137349 : // Generate an array of memory pools
137350 115 : SgDeleteExp** objectArray = (SgDeleteExp**) &(SgDeleteExp::pools[0]);
137351 :
137352 : // Build a local variable for better performance
137353 115 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
137354 : #if 0
137355 : // Iterate over the memory pools
137356 : for (unsigned int i=0; i < SgDeleteExp::pools.size(); i++)
137357 : {
137358 : // objectArray[i] is a single memory pool
137359 : for (int j=0; j < SgDeleteExp::pool_size; j++)
137360 : {
137361 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
137362 : {
137363 : traversal.visit(&(objectArray[i][j]));
137364 : }
137365 : }
137366 : }
137367 : #else
137368 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
137369 : // compute the list first and then call the visit function on each list element.
137370 :
137371 : // printf ("Inside of SgDeleteExp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
137372 :
137373 230 : std::vector<SgDeleteExp*> nodeList;
137374 :
137375 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
137376 230 : for (unsigned int i=0; i < SgDeleteExp::pools.size(); i++)
137377 : {
137378 : // objectArray[i] is a single memory pool
137379 230115 : for (unsigned j=0; j < SgDeleteExp::pool_size; j++)
137380 : {
137381 230000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
137382 : {
137383 1725 : nodeList.push_back(&(objectArray[i][j]));
137384 : }
137385 : }
137386 : }
137387 :
137388 : // Iterate over the saved list
137389 115 : size_t nodeListSize = nodeList.size();
137390 1840 : for (size_t i=0; i < nodeListSize; i++)
137391 : {
137392 1725 : ROSE_ASSERT(nodeList[i] != NULL);
137393 : #if 0
137394 : traversal.visit(nodeList[i]);
137395 : #else
137396 1725 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
137397 : {
137398 1725 : traversal.visit(nodeList[i]);
137399 : }
137400 : #endif
137401 : }
137402 : #endif
137403 : }
137404 :
137405 : // This should not be required since all previously static data members are
137406 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
137407 :
137408 5342 : }
137409 :
137410 :
137411 : void
137412 194 : SgDeleteExp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
137413 : {
137414 : // This function traverses the memory pool for an IR node and
137415 : // calls the function to execute the visitor object.
137416 :
137417 : // Initialize array to the address of the first element of the STL vector
137418 : // (which is guarenteed to be contiguous storage).
137419 : // SgDeleteExp objectArray [] = *(Memory_Block_List.begin());
137420 194 : if (SgDeleteExp::pools.empty() == false)
137421 : {
137422 : // Generate an array of memory pools
137423 137 : SgDeleteExp** objectArray = (SgDeleteExp**) &(SgDeleteExp::pools[0]);
137424 :
137425 : // Build a local variable for better performance
137426 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
137427 :
137428 : // Iterate over the memory pools
137429 274 : for (unsigned int i=0; i < SgDeleteExp::pools.size(); i++)
137430 : {
137431 : // objectArray[i] is a single memory pool
137432 274137 : for (unsigned j=0; j < SgDeleteExp::pool_size; j++)
137433 : {
137434 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
137435 : {
137436 : // printf ("Found a valid SgDeleteExp object in the memory pool %d at position %d \n",i,j);
137437 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
137438 2055 : objectArray[i][j].executeVisitorMemberFunction(visitor);
137439 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
137440 : }
137441 : else
137442 : {
137443 : // printf ("Found a INVALID SgDeleteExp object in the memory pool \n");
137444 : }
137445 : }
137446 : }
137447 : }
137448 :
137449 : // This should not be required since all previously static data members are
137450 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
137451 :
137452 194 : }
137453 :
137454 : void
137455 0 : SgDeleteExp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
137456 : {
137457 : // This function visits only a single IR node of the memory pool.
137458 : // it is typically called once for each type of IR node within
137459 : // the automatically generated function: traverseRepresentativeNodes().
137460 :
137461 : // Initialize array to the address of the first element of the STL vector
137462 : // (which is guarenteed to be contiguous storage).
137463 : // SgDeleteExp objectArray [] = *(Memory_Block_List.begin());
137464 0 : if (SgDeleteExp::pools.empty() == false)
137465 : {
137466 : // Generate an array of memory pools
137467 0 : SgDeleteExp** objectArray = (SgDeleteExp**) &(SgDeleteExp::pools[0]);
137468 :
137469 : // Build a local variable for better performance
137470 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
137471 :
137472 : // Iterate over the memory pools
137473 0 : bool done = false;
137474 0 : unsigned i=0;
137475 :
137476 : // find the first valid IR node, call visit function, and then leave
137477 0 : while ( done == false && i < SgDeleteExp::pools.size() )
137478 : {
137479 : // objectArray[i] is a single memory pool
137480 : unsigned j=0;
137481 0 : while (done == false && j < SgDeleteExp::pool_size)
137482 : {
137483 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
137484 : {
137485 0 : traversal.visit(&(objectArray[i][j]));
137486 0 : done = true;
137487 : }
137488 0 : j++;
137489 : }
137490 0 : i++;
137491 : }
137492 :
137493 : #if 0
137494 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
137495 : if (done == false)
137496 : {
137497 : printf ("No representative for SgDeleteExp found in memory pools \n");
137498 : }
137499 : #endif
137500 : }
137501 0 : }
137502 :
137503 :
137504 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
137505 : // using values that overflow signed values of int.
137506 : size_t
137507 4 : SgDeleteExp::numberOfNodes()
137508 : {
137509 : // This function traverses the memory pool for an IR node and
137510 : // counts the number of IR nodes of a particular Sage III IR
137511 : // nodes type.
137512 :
137513 4 : size_t count = 0;
137514 4 : if (SgDeleteExp::pools.empty() == false)
137515 : {
137516 : // Generate an array of memory pools (this is actually a STL vector,
137517 : // but it is contiguious, so OK to treat this way).
137518 1 : SgDeleteExp** objectArray = (SgDeleteExp**) &(SgDeleteExp::pools[0]);
137519 :
137520 : // Build a local variable for better performance (make it a loop invariant variable).
137521 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
137522 :
137523 : // Iterate over all of the memory pools for this IR node.
137524 2 : for (unsigned int i=0; i < SgDeleteExp::pools.size(); i++)
137525 : {
137526 : // objectArray[i] is a single memory pool, iterate over all the
137527 : // IR nodes and only count those that are valid IR nodes used in
137528 : // the AST (i.e. allocated IR nodes).
137529 2001 : for (unsigned j=0; j < SgDeleteExp::pool_size; j++)
137530 : {
137531 : // This is indexing the STL vector of C/C++ style arrays as a doubly
137532 : // indexed array access. It is OK since we have leveraged the semantics
137533 : // of STL vector memory as contigous and cast the memory as an array
137534 : // of arrays to use the 2D array indexing. Hope this is not confusing,
137535 : // but it s very fast as an implementation.
137536 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
137537 : {
137538 15 : count++;
137539 : }
137540 : }
137541 : }
137542 : }
137543 :
137544 :
137545 :
137546 4 : return count;
137547 : }
137548 :
137549 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
137550 : // using values that overflow signed values of int.
137551 : size_t
137552 0 : SgDeleteExp::memoryUsage()
137553 : {
137554 : // This function is required because we need the class name as a type when we call sizeof
137555 : // There might be another way to implement this if we have a traversal that only called a
137556 : // representative object (one call for each type of Sage IIIIR node).
137557 0 : size_t memory = numberOfNodes() * sizeof(SgDeleteExp);
137558 :
137559 0 : return memory;
137560 : }
137561 :
137562 : /* #line 137563 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
137563 :
137564 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
137565 : void
137566 5342 : SgThisExp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
137567 : {
137568 : // This function traverses the memory pool for only a specific IR node
137569 : // and calls the visit function of the input class execute a traversal
137570 : // similar to the style of the attribute based traversals within ROSE.
137571 : // This traversal will visit ALL nodes of the AST where as the other
137572 : // attribute based traversals visit only the embedded tree within the AST.
137573 :
137574 : // Initialize array to the address of the first element of the STL vector
137575 : // (which is guaranteed to be contiguous storage).
137576 : // SgThisExp objectArray [] = *(Memory_Block_List.begin());
137577 5342 : if (SgThisExp::pools.empty() == false)
137578 : {
137579 : // Generate an array of memory pools
137580 205 : SgThisExp** objectArray = (SgThisExp**) &(SgThisExp::pools[0]);
137581 :
137582 : // Build a local variable for better performance
137583 205 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
137584 : #if 0
137585 : // Iterate over the memory pools
137586 : for (unsigned int i=0; i < SgThisExp::pools.size(); i++)
137587 : {
137588 : // objectArray[i] is a single memory pool
137589 : for (int j=0; j < SgThisExp::pool_size; j++)
137590 : {
137591 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
137592 : {
137593 : traversal.visit(&(objectArray[i][j]));
137594 : }
137595 : }
137596 : }
137597 : #else
137598 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
137599 : // compute the list first and then call the visit function on each list element.
137600 :
137601 : // printf ("Inside of SgThisExp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
137602 :
137603 410 : std::vector<SgThisExp*> nodeList;
137604 :
137605 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
137606 411 : for (unsigned int i=0; i < SgThisExp::pools.size(); i++)
137607 : {
137608 : // objectArray[i] is a single memory pool
137609 412206 : for (unsigned j=0; j < SgThisExp::pool_size; j++)
137610 : {
137611 412000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
137612 : {
137613 162614 : nodeList.push_back(&(objectArray[i][j]));
137614 : }
137615 : }
137616 : }
137617 :
137618 : // Iterate over the saved list
137619 205 : size_t nodeListSize = nodeList.size();
137620 162819 : for (size_t i=0; i < nodeListSize; i++)
137621 : {
137622 162614 : ROSE_ASSERT(nodeList[i] != NULL);
137623 : #if 0
137624 : traversal.visit(nodeList[i]);
137625 : #else
137626 162614 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
137627 : {
137628 162614 : traversal.visit(nodeList[i]);
137629 : }
137630 : #endif
137631 : }
137632 : #endif
137633 : }
137634 :
137635 : // This should not be required since all previously static data members are
137636 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
137637 :
137638 5342 : }
137639 :
137640 :
137641 : void
137642 194 : SgThisExp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
137643 : {
137644 : // This function traverses the memory pool for an IR node and
137645 : // calls the function to execute the visitor object.
137646 :
137647 : // Initialize array to the address of the first element of the STL vector
137648 : // (which is guarenteed to be contiguous storage).
137649 : // SgThisExp objectArray [] = *(Memory_Block_List.begin());
137650 194 : if (SgThisExp::pools.empty() == false)
137651 : {
137652 : // Generate an array of memory pools
137653 137 : SgThisExp** objectArray = (SgThisExp**) &(SgThisExp::pools[0]);
137654 :
137655 : // Build a local variable for better performance
137656 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
137657 :
137658 : // Iterate over the memory pools
137659 275 : for (unsigned int i=0; i < SgThisExp::pools.size(); i++)
137660 : {
137661 : // objectArray[i] is a single memory pool
137662 276138 : for (unsigned j=0; j < SgThisExp::pool_size; j++)
137663 : {
137664 276000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
137665 : {
137666 : // printf ("Found a valid SgThisExp object in the memory pool %d at position %d \n",i,j);
137667 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
137668 179329 : objectArray[i][j].executeVisitorMemberFunction(visitor);
137669 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
137670 : }
137671 : else
137672 : {
137673 : // printf ("Found a INVALID SgThisExp object in the memory pool \n");
137674 : }
137675 : }
137676 : }
137677 : }
137678 :
137679 : // This should not be required since all previously static data members are
137680 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
137681 :
137682 194 : }
137683 :
137684 : void
137685 0 : SgThisExp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
137686 : {
137687 : // This function visits only a single IR node of the memory pool.
137688 : // it is typically called once for each type of IR node within
137689 : // the automatically generated function: traverseRepresentativeNodes().
137690 :
137691 : // Initialize array to the address of the first element of the STL vector
137692 : // (which is guarenteed to be contiguous storage).
137693 : // SgThisExp objectArray [] = *(Memory_Block_List.begin());
137694 0 : if (SgThisExp::pools.empty() == false)
137695 : {
137696 : // Generate an array of memory pools
137697 0 : SgThisExp** objectArray = (SgThisExp**) &(SgThisExp::pools[0]);
137698 :
137699 : // Build a local variable for better performance
137700 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
137701 :
137702 : // Iterate over the memory pools
137703 0 : bool done = false;
137704 0 : unsigned i=0;
137705 :
137706 : // find the first valid IR node, call visit function, and then leave
137707 0 : while ( done == false && i < SgThisExp::pools.size() )
137708 : {
137709 : // objectArray[i] is a single memory pool
137710 : unsigned j=0;
137711 0 : while (done == false && j < SgThisExp::pool_size)
137712 : {
137713 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
137714 : {
137715 0 : traversal.visit(&(objectArray[i][j]));
137716 0 : done = true;
137717 : }
137718 0 : j++;
137719 : }
137720 0 : i++;
137721 : }
137722 :
137723 : #if 0
137724 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
137725 : if (done == false)
137726 : {
137727 : printf ("No representative for SgThisExp found in memory pools \n");
137728 : }
137729 : #endif
137730 : }
137731 0 : }
137732 :
137733 :
137734 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
137735 : // using values that overflow signed values of int.
137736 : size_t
137737 4 : SgThisExp::numberOfNodes()
137738 : {
137739 : // This function traverses the memory pool for an IR node and
137740 : // counts the number of IR nodes of a particular Sage III IR
137741 : // nodes type.
137742 :
137743 4 : size_t count = 0;
137744 4 : if (SgThisExp::pools.empty() == false)
137745 : {
137746 : // Generate an array of memory pools (this is actually a STL vector,
137747 : // but it is contiguious, so OK to treat this way).
137748 1 : SgThisExp** objectArray = (SgThisExp**) &(SgThisExp::pools[0]);
137749 :
137750 : // Build a local variable for better performance (make it a loop invariant variable).
137751 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
137752 :
137753 : // Iterate over all of the memory pools for this IR node.
137754 2 : for (unsigned int i=0; i < SgThisExp::pools.size(); i++)
137755 : {
137756 : // objectArray[i] is a single memory pool, iterate over all the
137757 : // IR nodes and only count those that are valid IR nodes used in
137758 : // the AST (i.e. allocated IR nodes).
137759 2001 : for (unsigned j=0; j < SgThisExp::pool_size; j++)
137760 : {
137761 : // This is indexing the STL vector of C/C++ style arrays as a doubly
137762 : // indexed array access. It is OK since we have leveraged the semantics
137763 : // of STL vector memory as contigous and cast the memory as an array
137764 : // of arrays to use the 2D array indexing. Hope this is not confusing,
137765 : // but it s very fast as an implementation.
137766 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
137767 : {
137768 1236 : count++;
137769 : }
137770 : }
137771 : }
137772 : }
137773 :
137774 :
137775 :
137776 4 : return count;
137777 : }
137778 :
137779 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
137780 : // using values that overflow signed values of int.
137781 : size_t
137782 0 : SgThisExp::memoryUsage()
137783 : {
137784 : // This function is required because we need the class name as a type when we call sizeof
137785 : // There might be another way to implement this if we have a traversal that only called a
137786 : // representative object (one call for each type of Sage IIIIR node).
137787 0 : size_t memory = numberOfNodes() * sizeof(SgThisExp);
137788 :
137789 0 : return memory;
137790 : }
137791 :
137792 : /* #line 137793 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
137793 :
137794 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
137795 : void
137796 5342 : SgRefExp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
137797 : {
137798 : // This function traverses the memory pool for only a specific IR node
137799 : // and calls the visit function of the input class execute a traversal
137800 : // similar to the style of the attribute based traversals within ROSE.
137801 : // This traversal will visit ALL nodes of the AST where as the other
137802 : // attribute based traversals visit only the embedded tree within the AST.
137803 :
137804 : // Initialize array to the address of the first element of the STL vector
137805 : // (which is guaranteed to be contiguous storage).
137806 : // SgRefExp objectArray [] = *(Memory_Block_List.begin());
137807 5342 : if (SgRefExp::pools.empty() == false)
137808 : {
137809 : // Generate an array of memory pools
137810 0 : SgRefExp** objectArray = (SgRefExp**) &(SgRefExp::pools[0]);
137811 :
137812 : // Build a local variable for better performance
137813 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
137814 : #if 0
137815 : // Iterate over the memory pools
137816 : for (unsigned int i=0; i < SgRefExp::pools.size(); i++)
137817 : {
137818 : // objectArray[i] is a single memory pool
137819 : for (int j=0; j < SgRefExp::pool_size; j++)
137820 : {
137821 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
137822 : {
137823 : traversal.visit(&(objectArray[i][j]));
137824 : }
137825 : }
137826 : }
137827 : #else
137828 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
137829 : // compute the list first and then call the visit function on each list element.
137830 :
137831 : // printf ("Inside of SgRefExp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
137832 :
137833 0 : std::vector<SgRefExp*> nodeList;
137834 :
137835 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
137836 0 : for (unsigned int i=0; i < SgRefExp::pools.size(); i++)
137837 : {
137838 : // objectArray[i] is a single memory pool
137839 0 : for (unsigned j=0; j < SgRefExp::pool_size; j++)
137840 : {
137841 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
137842 : {
137843 0 : nodeList.push_back(&(objectArray[i][j]));
137844 : }
137845 : }
137846 : }
137847 :
137848 : // Iterate over the saved list
137849 0 : size_t nodeListSize = nodeList.size();
137850 0 : for (size_t i=0; i < nodeListSize; i++)
137851 : {
137852 0 : ROSE_ASSERT(nodeList[i] != NULL);
137853 : #if 0
137854 : traversal.visit(nodeList[i]);
137855 : #else
137856 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
137857 : {
137858 0 : traversal.visit(nodeList[i]);
137859 : }
137860 : #endif
137861 : }
137862 : #endif
137863 : }
137864 :
137865 : // This should not be required since all previously static data members are
137866 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
137867 :
137868 5342 : }
137869 :
137870 :
137871 : void
137872 194 : SgRefExp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
137873 : {
137874 : // This function traverses the memory pool for an IR node and
137875 : // calls the function to execute the visitor object.
137876 :
137877 : // Initialize array to the address of the first element of the STL vector
137878 : // (which is guarenteed to be contiguous storage).
137879 : // SgRefExp objectArray [] = *(Memory_Block_List.begin());
137880 194 : if (SgRefExp::pools.empty() == false)
137881 : {
137882 : // Generate an array of memory pools
137883 0 : SgRefExp** objectArray = (SgRefExp**) &(SgRefExp::pools[0]);
137884 :
137885 : // Build a local variable for better performance
137886 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
137887 :
137888 : // Iterate over the memory pools
137889 0 : for (unsigned int i=0; i < SgRefExp::pools.size(); i++)
137890 : {
137891 : // objectArray[i] is a single memory pool
137892 0 : for (unsigned j=0; j < SgRefExp::pool_size; j++)
137893 : {
137894 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
137895 : {
137896 : // printf ("Found a valid SgRefExp object in the memory pool %d at position %d \n",i,j);
137897 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
137898 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
137899 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
137900 : }
137901 : else
137902 : {
137903 : // printf ("Found a INVALID SgRefExp object in the memory pool \n");
137904 : }
137905 : }
137906 : }
137907 : }
137908 :
137909 : // This should not be required since all previously static data members are
137910 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
137911 :
137912 194 : }
137913 :
137914 : void
137915 0 : SgRefExp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
137916 : {
137917 : // This function visits only a single IR node of the memory pool.
137918 : // it is typically called once for each type of IR node within
137919 : // the automatically generated function: traverseRepresentativeNodes().
137920 :
137921 : // Initialize array to the address of the first element of the STL vector
137922 : // (which is guarenteed to be contiguous storage).
137923 : // SgRefExp objectArray [] = *(Memory_Block_List.begin());
137924 0 : if (SgRefExp::pools.empty() == false)
137925 : {
137926 : // Generate an array of memory pools
137927 0 : SgRefExp** objectArray = (SgRefExp**) &(SgRefExp::pools[0]);
137928 :
137929 : // Build a local variable for better performance
137930 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
137931 :
137932 : // Iterate over the memory pools
137933 0 : bool done = false;
137934 0 : unsigned i=0;
137935 :
137936 : // find the first valid IR node, call visit function, and then leave
137937 0 : while ( done == false && i < SgRefExp::pools.size() )
137938 : {
137939 : // objectArray[i] is a single memory pool
137940 : unsigned j=0;
137941 0 : while (done == false && j < SgRefExp::pool_size)
137942 : {
137943 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
137944 : {
137945 0 : traversal.visit(&(objectArray[i][j]));
137946 0 : done = true;
137947 : }
137948 0 : j++;
137949 : }
137950 0 : i++;
137951 : }
137952 :
137953 : #if 0
137954 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
137955 : if (done == false)
137956 : {
137957 : printf ("No representative for SgRefExp found in memory pools \n");
137958 : }
137959 : #endif
137960 : }
137961 0 : }
137962 :
137963 :
137964 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
137965 : // using values that overflow signed values of int.
137966 : size_t
137967 4 : SgRefExp::numberOfNodes()
137968 : {
137969 : // This function traverses the memory pool for an IR node and
137970 : // counts the number of IR nodes of a particular Sage III IR
137971 : // nodes type.
137972 :
137973 4 : size_t count = 0;
137974 4 : if (SgRefExp::pools.empty() == false)
137975 : {
137976 : // Generate an array of memory pools (this is actually a STL vector,
137977 : // but it is contiguious, so OK to treat this way).
137978 0 : SgRefExp** objectArray = (SgRefExp**) &(SgRefExp::pools[0]);
137979 :
137980 : // Build a local variable for better performance (make it a loop invariant variable).
137981 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
137982 :
137983 : // Iterate over all of the memory pools for this IR node.
137984 0 : for (unsigned int i=0; i < SgRefExp::pools.size(); i++)
137985 : {
137986 : // objectArray[i] is a single memory pool, iterate over all the
137987 : // IR nodes and only count those that are valid IR nodes used in
137988 : // the AST (i.e. allocated IR nodes).
137989 0 : for (unsigned j=0; j < SgRefExp::pool_size; j++)
137990 : {
137991 : // This is indexing the STL vector of C/C++ style arrays as a doubly
137992 : // indexed array access. It is OK since we have leveraged the semantics
137993 : // of STL vector memory as contigous and cast the memory as an array
137994 : // of arrays to use the 2D array indexing. Hope this is not confusing,
137995 : // but it s very fast as an implementation.
137996 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
137997 : {
137998 0 : count++;
137999 : }
138000 : }
138001 : }
138002 : }
138003 :
138004 :
138005 :
138006 4 : return count;
138007 : }
138008 :
138009 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
138010 : // using values that overflow signed values of int.
138011 : size_t
138012 0 : SgRefExp::memoryUsage()
138013 : {
138014 : // This function is required because we need the class name as a type when we call sizeof
138015 : // There might be another way to implement this if we have a traversal that only called a
138016 : // representative object (one call for each type of Sage IIIIR node).
138017 0 : size_t memory = numberOfNodes() * sizeof(SgRefExp);
138018 :
138019 0 : return memory;
138020 : }
138021 :
138022 : /* #line 138023 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
138023 :
138024 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
138025 : void
138026 5342 : SgInitializer::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
138027 : {
138028 : // This function traverses the memory pool for only a specific IR node
138029 : // and calls the visit function of the input class execute a traversal
138030 : // similar to the style of the attribute based traversals within ROSE.
138031 : // This traversal will visit ALL nodes of the AST where as the other
138032 : // attribute based traversals visit only the embedded tree within the AST.
138033 :
138034 : // Initialize array to the address of the first element of the STL vector
138035 : // (which is guaranteed to be contiguous storage).
138036 : // SgInitializer objectArray [] = *(Memory_Block_List.begin());
138037 5342 : if (SgInitializer::pools.empty() == false)
138038 : {
138039 : // Generate an array of memory pools
138040 0 : SgInitializer** objectArray = (SgInitializer**) &(SgInitializer::pools[0]);
138041 :
138042 : // Build a local variable for better performance
138043 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
138044 : #if 0
138045 : // Iterate over the memory pools
138046 : for (unsigned int i=0; i < SgInitializer::pools.size(); i++)
138047 : {
138048 : // objectArray[i] is a single memory pool
138049 : for (int j=0; j < SgInitializer::pool_size; j++)
138050 : {
138051 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
138052 : {
138053 : traversal.visit(&(objectArray[i][j]));
138054 : }
138055 : }
138056 : }
138057 : #else
138058 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
138059 : // compute the list first and then call the visit function on each list element.
138060 :
138061 : // printf ("Inside of SgInitializer::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
138062 :
138063 0 : std::vector<SgInitializer*> nodeList;
138064 :
138065 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
138066 0 : for (unsigned int i=0; i < SgInitializer::pools.size(); i++)
138067 : {
138068 : // objectArray[i] is a single memory pool
138069 0 : for (unsigned j=0; j < SgInitializer::pool_size; j++)
138070 : {
138071 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
138072 : {
138073 0 : nodeList.push_back(&(objectArray[i][j]));
138074 : }
138075 : }
138076 : }
138077 :
138078 : // Iterate over the saved list
138079 0 : size_t nodeListSize = nodeList.size();
138080 0 : for (size_t i=0; i < nodeListSize; i++)
138081 : {
138082 0 : ROSE_ASSERT(nodeList[i] != NULL);
138083 : #if 0
138084 : traversal.visit(nodeList[i]);
138085 : #else
138086 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
138087 : {
138088 0 : traversal.visit(nodeList[i]);
138089 : }
138090 : #endif
138091 : }
138092 : #endif
138093 : }
138094 :
138095 : // This should not be required since all previously static data members are
138096 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
138097 :
138098 5342 : }
138099 :
138100 :
138101 : void
138102 194 : SgInitializer::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
138103 : {
138104 : // This function traverses the memory pool for an IR node and
138105 : // calls the function to execute the visitor object.
138106 :
138107 : // Initialize array to the address of the first element of the STL vector
138108 : // (which is guarenteed to be contiguous storage).
138109 : // SgInitializer objectArray [] = *(Memory_Block_List.begin());
138110 194 : if (SgInitializer::pools.empty() == false)
138111 : {
138112 : // Generate an array of memory pools
138113 0 : SgInitializer** objectArray = (SgInitializer**) &(SgInitializer::pools[0]);
138114 :
138115 : // Build a local variable for better performance
138116 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
138117 :
138118 : // Iterate over the memory pools
138119 0 : for (unsigned int i=0; i < SgInitializer::pools.size(); i++)
138120 : {
138121 : // objectArray[i] is a single memory pool
138122 0 : for (unsigned j=0; j < SgInitializer::pool_size; j++)
138123 : {
138124 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
138125 : {
138126 : // printf ("Found a valid SgInitializer object in the memory pool %d at position %d \n",i,j);
138127 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
138128 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
138129 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
138130 : }
138131 : else
138132 : {
138133 : // printf ("Found a INVALID SgInitializer object in the memory pool \n");
138134 : }
138135 : }
138136 : }
138137 : }
138138 :
138139 : // This should not be required since all previously static data members are
138140 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
138141 :
138142 194 : }
138143 :
138144 : void
138145 0 : SgInitializer::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
138146 : {
138147 : // This function visits only a single IR node of the memory pool.
138148 : // it is typically called once for each type of IR node within
138149 : // the automatically generated function: traverseRepresentativeNodes().
138150 :
138151 : // Initialize array to the address of the first element of the STL vector
138152 : // (which is guarenteed to be contiguous storage).
138153 : // SgInitializer objectArray [] = *(Memory_Block_List.begin());
138154 0 : if (SgInitializer::pools.empty() == false)
138155 : {
138156 : // Generate an array of memory pools
138157 0 : SgInitializer** objectArray = (SgInitializer**) &(SgInitializer::pools[0]);
138158 :
138159 : // Build a local variable for better performance
138160 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
138161 :
138162 : // Iterate over the memory pools
138163 0 : bool done = false;
138164 0 : unsigned i=0;
138165 :
138166 : // find the first valid IR node, call visit function, and then leave
138167 0 : while ( done == false && i < SgInitializer::pools.size() )
138168 : {
138169 : // objectArray[i] is a single memory pool
138170 : unsigned j=0;
138171 0 : while (done == false && j < SgInitializer::pool_size)
138172 : {
138173 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
138174 : {
138175 0 : traversal.visit(&(objectArray[i][j]));
138176 0 : done = true;
138177 : }
138178 0 : j++;
138179 : }
138180 0 : i++;
138181 : }
138182 :
138183 : #if 0
138184 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
138185 : if (done == false)
138186 : {
138187 : printf ("No representative for SgInitializer found in memory pools \n");
138188 : }
138189 : #endif
138190 : }
138191 0 : }
138192 :
138193 :
138194 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
138195 : // using values that overflow signed values of int.
138196 : size_t
138197 4 : SgInitializer::numberOfNodes()
138198 : {
138199 : // This function traverses the memory pool for an IR node and
138200 : // counts the number of IR nodes of a particular Sage III IR
138201 : // nodes type.
138202 :
138203 4 : size_t count = 0;
138204 4 : if (SgInitializer::pools.empty() == false)
138205 : {
138206 : // Generate an array of memory pools (this is actually a STL vector,
138207 : // but it is contiguious, so OK to treat this way).
138208 0 : SgInitializer** objectArray = (SgInitializer**) &(SgInitializer::pools[0]);
138209 :
138210 : // Build a local variable for better performance (make it a loop invariant variable).
138211 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
138212 :
138213 : // Iterate over all of the memory pools for this IR node.
138214 0 : for (unsigned int i=0; i < SgInitializer::pools.size(); i++)
138215 : {
138216 : // objectArray[i] is a single memory pool, iterate over all the
138217 : // IR nodes and only count those that are valid IR nodes used in
138218 : // the AST (i.e. allocated IR nodes).
138219 0 : for (unsigned j=0; j < SgInitializer::pool_size; j++)
138220 : {
138221 : // This is indexing the STL vector of C/C++ style arrays as a doubly
138222 : // indexed array access. It is OK since we have leveraged the semantics
138223 : // of STL vector memory as contigous and cast the memory as an array
138224 : // of arrays to use the 2D array indexing. Hope this is not confusing,
138225 : // but it s very fast as an implementation.
138226 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
138227 : {
138228 0 : count++;
138229 : }
138230 : }
138231 : }
138232 : }
138233 :
138234 :
138235 :
138236 4 : return count;
138237 : }
138238 :
138239 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
138240 : // using values that overflow signed values of int.
138241 : size_t
138242 0 : SgInitializer::memoryUsage()
138243 : {
138244 : // This function is required because we need the class name as a type when we call sizeof
138245 : // There might be another way to implement this if we have a traversal that only called a
138246 : // representative object (one call for each type of Sage IIIIR node).
138247 0 : size_t memory = numberOfNodes() * sizeof(SgInitializer);
138248 :
138249 0 : return memory;
138250 : }
138251 :
138252 : /* #line 138253 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
138253 :
138254 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
138255 : void
138256 5342 : SgAggregateInitializer::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
138257 : {
138258 : // This function traverses the memory pool for only a specific IR node
138259 : // and calls the visit function of the input class execute a traversal
138260 : // similar to the style of the attribute based traversals within ROSE.
138261 : // This traversal will visit ALL nodes of the AST where as the other
138262 : // attribute based traversals visit only the embedded tree within the AST.
138263 :
138264 : // Initialize array to the address of the first element of the STL vector
138265 : // (which is guaranteed to be contiguous storage).
138266 : // SgAggregateInitializer objectArray [] = *(Memory_Block_List.begin());
138267 5342 : if (SgAggregateInitializer::pools.empty() == false)
138268 : {
138269 : // Generate an array of memory pools
138270 199 : SgAggregateInitializer** objectArray = (SgAggregateInitializer**) &(SgAggregateInitializer::pools[0]);
138271 :
138272 : // Build a local variable for better performance
138273 199 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
138274 : #if 0
138275 : // Iterate over the memory pools
138276 : for (unsigned int i=0; i < SgAggregateInitializer::pools.size(); i++)
138277 : {
138278 : // objectArray[i] is a single memory pool
138279 : for (int j=0; j < SgAggregateInitializer::pool_size; j++)
138280 : {
138281 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
138282 : {
138283 : traversal.visit(&(objectArray[i][j]));
138284 : }
138285 : }
138286 : }
138287 : #else
138288 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
138289 : // compute the list first and then call the visit function on each list element.
138290 :
138291 : // printf ("Inside of SgAggregateInitializer::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
138292 :
138293 398 : std::vector<SgAggregateInitializer*> nodeList;
138294 :
138295 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
138296 398 : for (unsigned int i=0; i < SgAggregateInitializer::pools.size(); i++)
138297 : {
138298 : // objectArray[i] is a single memory pool
138299 398199 : for (unsigned j=0; j < SgAggregateInitializer::pool_size; j++)
138300 : {
138301 398000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
138302 : {
138303 2672 : nodeList.push_back(&(objectArray[i][j]));
138304 : }
138305 : }
138306 : }
138307 :
138308 : // Iterate over the saved list
138309 199 : size_t nodeListSize = nodeList.size();
138310 2871 : for (size_t i=0; i < nodeListSize; i++)
138311 : {
138312 2672 : ROSE_ASSERT(nodeList[i] != NULL);
138313 : #if 0
138314 : traversal.visit(nodeList[i]);
138315 : #else
138316 2672 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
138317 : {
138318 2672 : traversal.visit(nodeList[i]);
138319 : }
138320 : #endif
138321 : }
138322 : #endif
138323 : }
138324 :
138325 : // This should not be required since all previously static data members are
138326 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
138327 :
138328 5342 : }
138329 :
138330 :
138331 : void
138332 194 : SgAggregateInitializer::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
138333 : {
138334 : // This function traverses the memory pool for an IR node and
138335 : // calls the function to execute the visitor object.
138336 :
138337 : // Initialize array to the address of the first element of the STL vector
138338 : // (which is guarenteed to be contiguous storage).
138339 : // SgAggregateInitializer objectArray [] = *(Memory_Block_List.begin());
138340 194 : if (SgAggregateInitializer::pools.empty() == false)
138341 : {
138342 : // Generate an array of memory pools
138343 137 : SgAggregateInitializer** objectArray = (SgAggregateInitializer**) &(SgAggregateInitializer::pools[0]);
138344 :
138345 : // Build a local variable for better performance
138346 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
138347 :
138348 : // Iterate over the memory pools
138349 274 : for (unsigned int i=0; i < SgAggregateInitializer::pools.size(); i++)
138350 : {
138351 : // objectArray[i] is a single memory pool
138352 274137 : for (unsigned j=0; j < SgAggregateInitializer::pool_size; j++)
138353 : {
138354 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
138355 : {
138356 : // printf ("Found a valid SgAggregateInitializer object in the memory pool %d at position %d \n",i,j);
138357 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
138358 411 : objectArray[i][j].executeVisitorMemberFunction(visitor);
138359 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
138360 : }
138361 : else
138362 : {
138363 : // printf ("Found a INVALID SgAggregateInitializer object in the memory pool \n");
138364 : }
138365 : }
138366 : }
138367 : }
138368 :
138369 : // This should not be required since all previously static data members are
138370 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
138371 :
138372 194 : }
138373 :
138374 : void
138375 0 : SgAggregateInitializer::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
138376 : {
138377 : // This function visits only a single IR node of the memory pool.
138378 : // it is typically called once for each type of IR node within
138379 : // the automatically generated function: traverseRepresentativeNodes().
138380 :
138381 : // Initialize array to the address of the first element of the STL vector
138382 : // (which is guarenteed to be contiguous storage).
138383 : // SgAggregateInitializer objectArray [] = *(Memory_Block_List.begin());
138384 0 : if (SgAggregateInitializer::pools.empty() == false)
138385 : {
138386 : // Generate an array of memory pools
138387 0 : SgAggregateInitializer** objectArray = (SgAggregateInitializer**) &(SgAggregateInitializer::pools[0]);
138388 :
138389 : // Build a local variable for better performance
138390 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
138391 :
138392 : // Iterate over the memory pools
138393 0 : bool done = false;
138394 0 : unsigned i=0;
138395 :
138396 : // find the first valid IR node, call visit function, and then leave
138397 0 : while ( done == false && i < SgAggregateInitializer::pools.size() )
138398 : {
138399 : // objectArray[i] is a single memory pool
138400 : unsigned j=0;
138401 0 : while (done == false && j < SgAggregateInitializer::pool_size)
138402 : {
138403 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
138404 : {
138405 0 : traversal.visit(&(objectArray[i][j]));
138406 0 : done = true;
138407 : }
138408 0 : j++;
138409 : }
138410 0 : i++;
138411 : }
138412 :
138413 : #if 0
138414 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
138415 : if (done == false)
138416 : {
138417 : printf ("No representative for SgAggregateInitializer found in memory pools \n");
138418 : }
138419 : #endif
138420 : }
138421 0 : }
138422 :
138423 :
138424 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
138425 : // using values that overflow signed values of int.
138426 : size_t
138427 4 : SgAggregateInitializer::numberOfNodes()
138428 : {
138429 : // This function traverses the memory pool for an IR node and
138430 : // counts the number of IR nodes of a particular Sage III IR
138431 : // nodes type.
138432 :
138433 4 : size_t count = 0;
138434 4 : if (SgAggregateInitializer::pools.empty() == false)
138435 : {
138436 : // Generate an array of memory pools (this is actually a STL vector,
138437 : // but it is contiguious, so OK to treat this way).
138438 1 : SgAggregateInitializer** objectArray = (SgAggregateInitializer**) &(SgAggregateInitializer::pools[0]);
138439 :
138440 : // Build a local variable for better performance (make it a loop invariant variable).
138441 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
138442 :
138443 : // Iterate over all of the memory pools for this IR node.
138444 2 : for (unsigned int i=0; i < SgAggregateInitializer::pools.size(); i++)
138445 : {
138446 : // objectArray[i] is a single memory pool, iterate over all the
138447 : // IR nodes and only count those that are valid IR nodes used in
138448 : // the AST (i.e. allocated IR nodes).
138449 2001 : for (unsigned j=0; j < SgAggregateInitializer::pool_size; j++)
138450 : {
138451 : // This is indexing the STL vector of C/C++ style arrays as a doubly
138452 : // indexed array access. It is OK since we have leveraged the semantics
138453 : // of STL vector memory as contigous and cast the memory as an array
138454 : // of arrays to use the 2D array indexing. Hope this is not confusing,
138455 : // but it s very fast as an implementation.
138456 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
138457 : {
138458 3 : count++;
138459 : }
138460 : }
138461 : }
138462 : }
138463 :
138464 :
138465 :
138466 4 : return count;
138467 : }
138468 :
138469 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
138470 : // using values that overflow signed values of int.
138471 : size_t
138472 0 : SgAggregateInitializer::memoryUsage()
138473 : {
138474 : // This function is required because we need the class name as a type when we call sizeof
138475 : // There might be another way to implement this if we have a traversal that only called a
138476 : // representative object (one call for each type of Sage IIIIR node).
138477 0 : size_t memory = numberOfNodes() * sizeof(SgAggregateInitializer);
138478 :
138479 0 : return memory;
138480 : }
138481 :
138482 : /* #line 138483 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
138483 :
138484 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
138485 : void
138486 5342 : SgCompoundInitializer::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
138487 : {
138488 : // This function traverses the memory pool for only a specific IR node
138489 : // and calls the visit function of the input class execute a traversal
138490 : // similar to the style of the attribute based traversals within ROSE.
138491 : // This traversal will visit ALL nodes of the AST where as the other
138492 : // attribute based traversals visit only the embedded tree within the AST.
138493 :
138494 : // Initialize array to the address of the first element of the STL vector
138495 : // (which is guaranteed to be contiguous storage).
138496 : // SgCompoundInitializer objectArray [] = *(Memory_Block_List.begin());
138497 5342 : if (SgCompoundInitializer::pools.empty() == false)
138498 : {
138499 : // Generate an array of memory pools
138500 0 : SgCompoundInitializer** objectArray = (SgCompoundInitializer**) &(SgCompoundInitializer::pools[0]);
138501 :
138502 : // Build a local variable for better performance
138503 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
138504 : #if 0
138505 : // Iterate over the memory pools
138506 : for (unsigned int i=0; i < SgCompoundInitializer::pools.size(); i++)
138507 : {
138508 : // objectArray[i] is a single memory pool
138509 : for (int j=0; j < SgCompoundInitializer::pool_size; j++)
138510 : {
138511 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
138512 : {
138513 : traversal.visit(&(objectArray[i][j]));
138514 : }
138515 : }
138516 : }
138517 : #else
138518 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
138519 : // compute the list first and then call the visit function on each list element.
138520 :
138521 : // printf ("Inside of SgCompoundInitializer::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
138522 :
138523 0 : std::vector<SgCompoundInitializer*> nodeList;
138524 :
138525 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
138526 0 : for (unsigned int i=0; i < SgCompoundInitializer::pools.size(); i++)
138527 : {
138528 : // objectArray[i] is a single memory pool
138529 0 : for (unsigned j=0; j < SgCompoundInitializer::pool_size; j++)
138530 : {
138531 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
138532 : {
138533 0 : nodeList.push_back(&(objectArray[i][j]));
138534 : }
138535 : }
138536 : }
138537 :
138538 : // Iterate over the saved list
138539 0 : size_t nodeListSize = nodeList.size();
138540 0 : for (size_t i=0; i < nodeListSize; i++)
138541 : {
138542 0 : ROSE_ASSERT(nodeList[i] != NULL);
138543 : #if 0
138544 : traversal.visit(nodeList[i]);
138545 : #else
138546 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
138547 : {
138548 0 : traversal.visit(nodeList[i]);
138549 : }
138550 : #endif
138551 : }
138552 : #endif
138553 : }
138554 :
138555 : // This should not be required since all previously static data members are
138556 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
138557 :
138558 5342 : }
138559 :
138560 :
138561 : void
138562 194 : SgCompoundInitializer::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
138563 : {
138564 : // This function traverses the memory pool for an IR node and
138565 : // calls the function to execute the visitor object.
138566 :
138567 : // Initialize array to the address of the first element of the STL vector
138568 : // (which is guarenteed to be contiguous storage).
138569 : // SgCompoundInitializer objectArray [] = *(Memory_Block_List.begin());
138570 194 : if (SgCompoundInitializer::pools.empty() == false)
138571 : {
138572 : // Generate an array of memory pools
138573 0 : SgCompoundInitializer** objectArray = (SgCompoundInitializer**) &(SgCompoundInitializer::pools[0]);
138574 :
138575 : // Build a local variable for better performance
138576 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
138577 :
138578 : // Iterate over the memory pools
138579 0 : for (unsigned int i=0; i < SgCompoundInitializer::pools.size(); i++)
138580 : {
138581 : // objectArray[i] is a single memory pool
138582 0 : for (unsigned j=0; j < SgCompoundInitializer::pool_size; j++)
138583 : {
138584 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
138585 : {
138586 : // printf ("Found a valid SgCompoundInitializer object in the memory pool %d at position %d \n",i,j);
138587 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
138588 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
138589 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
138590 : }
138591 : else
138592 : {
138593 : // printf ("Found a INVALID SgCompoundInitializer object in the memory pool \n");
138594 : }
138595 : }
138596 : }
138597 : }
138598 :
138599 : // This should not be required since all previously static data members are
138600 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
138601 :
138602 194 : }
138603 :
138604 : void
138605 0 : SgCompoundInitializer::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
138606 : {
138607 : // This function visits only a single IR node of the memory pool.
138608 : // it is typically called once for each type of IR node within
138609 : // the automatically generated function: traverseRepresentativeNodes().
138610 :
138611 : // Initialize array to the address of the first element of the STL vector
138612 : // (which is guarenteed to be contiguous storage).
138613 : // SgCompoundInitializer objectArray [] = *(Memory_Block_List.begin());
138614 0 : if (SgCompoundInitializer::pools.empty() == false)
138615 : {
138616 : // Generate an array of memory pools
138617 0 : SgCompoundInitializer** objectArray = (SgCompoundInitializer**) &(SgCompoundInitializer::pools[0]);
138618 :
138619 : // Build a local variable for better performance
138620 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
138621 :
138622 : // Iterate over the memory pools
138623 0 : bool done = false;
138624 0 : unsigned i=0;
138625 :
138626 : // find the first valid IR node, call visit function, and then leave
138627 0 : while ( done == false && i < SgCompoundInitializer::pools.size() )
138628 : {
138629 : // objectArray[i] is a single memory pool
138630 : unsigned j=0;
138631 0 : while (done == false && j < SgCompoundInitializer::pool_size)
138632 : {
138633 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
138634 : {
138635 0 : traversal.visit(&(objectArray[i][j]));
138636 0 : done = true;
138637 : }
138638 0 : j++;
138639 : }
138640 0 : i++;
138641 : }
138642 :
138643 : #if 0
138644 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
138645 : if (done == false)
138646 : {
138647 : printf ("No representative for SgCompoundInitializer found in memory pools \n");
138648 : }
138649 : #endif
138650 : }
138651 0 : }
138652 :
138653 :
138654 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
138655 : // using values that overflow signed values of int.
138656 : size_t
138657 4 : SgCompoundInitializer::numberOfNodes()
138658 : {
138659 : // This function traverses the memory pool for an IR node and
138660 : // counts the number of IR nodes of a particular Sage III IR
138661 : // nodes type.
138662 :
138663 4 : size_t count = 0;
138664 4 : if (SgCompoundInitializer::pools.empty() == false)
138665 : {
138666 : // Generate an array of memory pools (this is actually a STL vector,
138667 : // but it is contiguious, so OK to treat this way).
138668 0 : SgCompoundInitializer** objectArray = (SgCompoundInitializer**) &(SgCompoundInitializer::pools[0]);
138669 :
138670 : // Build a local variable for better performance (make it a loop invariant variable).
138671 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
138672 :
138673 : // Iterate over all of the memory pools for this IR node.
138674 0 : for (unsigned int i=0; i < SgCompoundInitializer::pools.size(); i++)
138675 : {
138676 : // objectArray[i] is a single memory pool, iterate over all the
138677 : // IR nodes and only count those that are valid IR nodes used in
138678 : // the AST (i.e. allocated IR nodes).
138679 0 : for (unsigned j=0; j < SgCompoundInitializer::pool_size; j++)
138680 : {
138681 : // This is indexing the STL vector of C/C++ style arrays as a doubly
138682 : // indexed array access. It is OK since we have leveraged the semantics
138683 : // of STL vector memory as contigous and cast the memory as an array
138684 : // of arrays to use the 2D array indexing. Hope this is not confusing,
138685 : // but it s very fast as an implementation.
138686 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
138687 : {
138688 0 : count++;
138689 : }
138690 : }
138691 : }
138692 : }
138693 :
138694 :
138695 :
138696 4 : return count;
138697 : }
138698 :
138699 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
138700 : // using values that overflow signed values of int.
138701 : size_t
138702 0 : SgCompoundInitializer::memoryUsage()
138703 : {
138704 : // This function is required because we need the class name as a type when we call sizeof
138705 : // There might be another way to implement this if we have a traversal that only called a
138706 : // representative object (one call for each type of Sage IIIIR node).
138707 0 : size_t memory = numberOfNodes() * sizeof(SgCompoundInitializer);
138708 :
138709 0 : return memory;
138710 : }
138711 :
138712 : /* #line 138713 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
138713 :
138714 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
138715 : void
138716 5342 : SgConstructorInitializer::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
138717 : {
138718 : // This function traverses the memory pool for only a specific IR node
138719 : // and calls the visit function of the input class execute a traversal
138720 : // similar to the style of the attribute based traversals within ROSE.
138721 : // This traversal will visit ALL nodes of the AST where as the other
138722 : // attribute based traversals visit only the embedded tree within the AST.
138723 :
138724 : // Initialize array to the address of the first element of the STL vector
138725 : // (which is guaranteed to be contiguous storage).
138726 : // SgConstructorInitializer objectArray [] = *(Memory_Block_List.begin());
138727 5342 : if (SgConstructorInitializer::pools.empty() == false)
138728 : {
138729 : // Generate an array of memory pools
138730 205 : SgConstructorInitializer** objectArray = (SgConstructorInitializer**) &(SgConstructorInitializer::pools[0]);
138731 :
138732 : // Build a local variable for better performance
138733 205 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
138734 : #if 0
138735 : // Iterate over the memory pools
138736 : for (unsigned int i=0; i < SgConstructorInitializer::pools.size(); i++)
138737 : {
138738 : // objectArray[i] is a single memory pool
138739 : for (int j=0; j < SgConstructorInitializer::pool_size; j++)
138740 : {
138741 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
138742 : {
138743 : traversal.visit(&(objectArray[i][j]));
138744 : }
138745 : }
138746 : }
138747 : #else
138748 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
138749 : // compute the list first and then call the visit function on each list element.
138750 :
138751 : // printf ("Inside of SgConstructorInitializer::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
138752 :
138753 410 : std::vector<SgConstructorInitializer*> nodeList;
138754 :
138755 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
138756 410 : for (unsigned int i=0; i < SgConstructorInitializer::pools.size(); i++)
138757 : {
138758 : // objectArray[i] is a single memory pool
138759 410205 : for (unsigned j=0; j < SgConstructorInitializer::pool_size; j++)
138760 : {
138761 410000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
138762 : {
138763 61827 : nodeList.push_back(&(objectArray[i][j]));
138764 : }
138765 : }
138766 : }
138767 :
138768 : // Iterate over the saved list
138769 205 : size_t nodeListSize = nodeList.size();
138770 62032 : for (size_t i=0; i < nodeListSize; i++)
138771 : {
138772 61827 : ROSE_ASSERT(nodeList[i] != NULL);
138773 : #if 0
138774 : traversal.visit(nodeList[i]);
138775 : #else
138776 61827 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
138777 : {
138778 61827 : traversal.visit(nodeList[i]);
138779 : }
138780 : #endif
138781 : }
138782 : #endif
138783 : }
138784 :
138785 : // This should not be required since all previously static data members are
138786 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
138787 :
138788 5342 : }
138789 :
138790 :
138791 : void
138792 194 : SgConstructorInitializer::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
138793 : {
138794 : // This function traverses the memory pool for an IR node and
138795 : // calls the function to execute the visitor object.
138796 :
138797 : // Initialize array to the address of the first element of the STL vector
138798 : // (which is guarenteed to be contiguous storage).
138799 : // SgConstructorInitializer objectArray [] = *(Memory_Block_List.begin());
138800 194 : if (SgConstructorInitializer::pools.empty() == false)
138801 : {
138802 : // Generate an array of memory pools
138803 137 : SgConstructorInitializer** objectArray = (SgConstructorInitializer**) &(SgConstructorInitializer::pools[0]);
138804 :
138805 : // Build a local variable for better performance
138806 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
138807 :
138808 : // Iterate over the memory pools
138809 274 : for (unsigned int i=0; i < SgConstructorInitializer::pools.size(); i++)
138810 : {
138811 : // objectArray[i] is a single memory pool
138812 274137 : for (unsigned j=0; j < SgConstructorInitializer::pool_size; j++)
138813 : {
138814 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
138815 : {
138816 : // printf ("Found a valid SgConstructorInitializer object in the memory pool %d at position %d \n",i,j);
138817 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
138818 66227 : objectArray[i][j].executeVisitorMemberFunction(visitor);
138819 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
138820 : }
138821 : else
138822 : {
138823 : // printf ("Found a INVALID SgConstructorInitializer object in the memory pool \n");
138824 : }
138825 : }
138826 : }
138827 : }
138828 :
138829 : // This should not be required since all previously static data members are
138830 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
138831 :
138832 194 : }
138833 :
138834 : void
138835 0 : SgConstructorInitializer::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
138836 : {
138837 : // This function visits only a single IR node of the memory pool.
138838 : // it is typically called once for each type of IR node within
138839 : // the automatically generated function: traverseRepresentativeNodes().
138840 :
138841 : // Initialize array to the address of the first element of the STL vector
138842 : // (which is guarenteed to be contiguous storage).
138843 : // SgConstructorInitializer objectArray [] = *(Memory_Block_List.begin());
138844 0 : if (SgConstructorInitializer::pools.empty() == false)
138845 : {
138846 : // Generate an array of memory pools
138847 0 : SgConstructorInitializer** objectArray = (SgConstructorInitializer**) &(SgConstructorInitializer::pools[0]);
138848 :
138849 : // Build a local variable for better performance
138850 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
138851 :
138852 : // Iterate over the memory pools
138853 0 : bool done = false;
138854 0 : unsigned i=0;
138855 :
138856 : // find the first valid IR node, call visit function, and then leave
138857 0 : while ( done == false && i < SgConstructorInitializer::pools.size() )
138858 : {
138859 : // objectArray[i] is a single memory pool
138860 : unsigned j=0;
138861 0 : while (done == false && j < SgConstructorInitializer::pool_size)
138862 : {
138863 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
138864 : {
138865 0 : traversal.visit(&(objectArray[i][j]));
138866 0 : done = true;
138867 : }
138868 0 : j++;
138869 : }
138870 0 : i++;
138871 : }
138872 :
138873 : #if 0
138874 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
138875 : if (done == false)
138876 : {
138877 : printf ("No representative for SgConstructorInitializer found in memory pools \n");
138878 : }
138879 : #endif
138880 : }
138881 0 : }
138882 :
138883 :
138884 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
138885 : // using values that overflow signed values of int.
138886 : size_t
138887 4 : SgConstructorInitializer::numberOfNodes()
138888 : {
138889 : // This function traverses the memory pool for an IR node and
138890 : // counts the number of IR nodes of a particular Sage III IR
138891 : // nodes type.
138892 :
138893 4 : size_t count = 0;
138894 4 : if (SgConstructorInitializer::pools.empty() == false)
138895 : {
138896 : // Generate an array of memory pools (this is actually a STL vector,
138897 : // but it is contiguious, so OK to treat this way).
138898 1 : SgConstructorInitializer** objectArray = (SgConstructorInitializer**) &(SgConstructorInitializer::pools[0]);
138899 :
138900 : // Build a local variable for better performance (make it a loop invariant variable).
138901 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
138902 :
138903 : // Iterate over all of the memory pools for this IR node.
138904 2 : for (unsigned int i=0; i < SgConstructorInitializer::pools.size(); i++)
138905 : {
138906 : // objectArray[i] is a single memory pool, iterate over all the
138907 : // IR nodes and only count those that are valid IR nodes used in
138908 : // the AST (i.e. allocated IR nodes).
138909 2001 : for (unsigned j=0; j < SgConstructorInitializer::pool_size; j++)
138910 : {
138911 : // This is indexing the STL vector of C/C++ style arrays as a doubly
138912 : // indexed array access. It is OK since we have leveraged the semantics
138913 : // of STL vector memory as contigous and cast the memory as an array
138914 : // of arrays to use the 2D array indexing. Hope this is not confusing,
138915 : // but it s very fast as an implementation.
138916 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
138917 : {
138918 461 : count++;
138919 : }
138920 : }
138921 : }
138922 : }
138923 :
138924 :
138925 :
138926 4 : return count;
138927 : }
138928 :
138929 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
138930 : // using values that overflow signed values of int.
138931 : size_t
138932 0 : SgConstructorInitializer::memoryUsage()
138933 : {
138934 : // This function is required because we need the class name as a type when we call sizeof
138935 : // There might be another way to implement this if we have a traversal that only called a
138936 : // representative object (one call for each type of Sage IIIIR node).
138937 0 : size_t memory = numberOfNodes() * sizeof(SgConstructorInitializer);
138938 :
138939 0 : return memory;
138940 : }
138941 :
138942 : /* #line 138943 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
138943 :
138944 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
138945 : void
138946 5342 : SgAssignInitializer::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
138947 : {
138948 : // This function traverses the memory pool for only a specific IR node
138949 : // and calls the visit function of the input class execute a traversal
138950 : // similar to the style of the attribute based traversals within ROSE.
138951 : // This traversal will visit ALL nodes of the AST where as the other
138952 : // attribute based traversals visit only the embedded tree within the AST.
138953 :
138954 : // Initialize array to the address of the first element of the STL vector
138955 : // (which is guaranteed to be contiguous storage).
138956 : // SgAssignInitializer objectArray [] = *(Memory_Block_List.begin());
138957 5342 : if (SgAssignInitializer::pools.empty() == false)
138958 : {
138959 : // Generate an array of memory pools
138960 3473 : SgAssignInitializer** objectArray = (SgAssignInitializer**) &(SgAssignInitializer::pools[0]);
138961 :
138962 : // Build a local variable for better performance
138963 3473 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
138964 : #if 0
138965 : // Iterate over the memory pools
138966 : for (unsigned int i=0; i < SgAssignInitializer::pools.size(); i++)
138967 : {
138968 : // objectArray[i] is a single memory pool
138969 : for (int j=0; j < SgAssignInitializer::pool_size; j++)
138970 : {
138971 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
138972 : {
138973 : traversal.visit(&(objectArray[i][j]));
138974 : }
138975 : }
138976 : }
138977 : #else
138978 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
138979 : // compute the list first and then call the visit function on each list element.
138980 :
138981 : // printf ("Inside of SgAssignInitializer::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
138982 :
138983 6946 : std::vector<SgAssignInitializer*> nodeList;
138984 :
138985 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
138986 6947 : for (unsigned int i=0; i < SgAssignInitializer::pools.size(); i++)
138987 : {
138988 : // objectArray[i] is a single memory pool
138989 6951470 : for (unsigned j=0; j < SgAssignInitializer::pool_size; j++)
138990 : {
138991 6948000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
138992 : {
138993 230072 : nodeList.push_back(&(objectArray[i][j]));
138994 : }
138995 : }
138996 : }
138997 :
138998 : // Iterate over the saved list
138999 3473 : size_t nodeListSize = nodeList.size();
139000 233545 : for (size_t i=0; i < nodeListSize; i++)
139001 : {
139002 230072 : ROSE_ASSERT(nodeList[i] != NULL);
139003 : #if 0
139004 : traversal.visit(nodeList[i]);
139005 : #else
139006 230072 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
139007 : {
139008 230072 : traversal.visit(nodeList[i]);
139009 : }
139010 : #endif
139011 : }
139012 : #endif
139013 : }
139014 :
139015 : // This should not be required since all previously static data members are
139016 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
139017 :
139018 5342 : }
139019 :
139020 :
139021 : void
139022 194 : SgAssignInitializer::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
139023 : {
139024 : // This function traverses the memory pool for an IR node and
139025 : // calls the function to execute the visitor object.
139026 :
139027 : // Initialize array to the address of the first element of the STL vector
139028 : // (which is guarenteed to be contiguous storage).
139029 : // SgAssignInitializer objectArray [] = *(Memory_Block_List.begin());
139030 194 : if (SgAssignInitializer::pools.empty() == false)
139031 : {
139032 : // Generate an array of memory pools
139033 188 : SgAssignInitializer** objectArray = (SgAssignInitializer**) &(SgAssignInitializer::pools[0]);
139034 :
139035 : // Build a local variable for better performance
139036 188 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
139037 :
139038 : // Iterate over the memory pools
139039 377 : for (unsigned int i=0; i < SgAssignInitializer::pools.size(); i++)
139040 : {
139041 : // objectArray[i] is a single memory pool
139042 378189 : for (unsigned j=0; j < SgAssignInitializer::pool_size; j++)
139043 : {
139044 378000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
139045 : {
139046 : // printf ("Found a valid SgAssignInitializer object in the memory pool %d at position %d \n",i,j);
139047 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
139048 171587 : objectArray[i][j].executeVisitorMemberFunction(visitor);
139049 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
139050 : }
139051 : else
139052 : {
139053 : // printf ("Found a INVALID SgAssignInitializer object in the memory pool \n");
139054 : }
139055 : }
139056 : }
139057 : }
139058 :
139059 : // This should not be required since all previously static data members are
139060 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
139061 :
139062 194 : }
139063 :
139064 : void
139065 0 : SgAssignInitializer::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
139066 : {
139067 : // This function visits only a single IR node of the memory pool.
139068 : // it is typically called once for each type of IR node within
139069 : // the automatically generated function: traverseRepresentativeNodes().
139070 :
139071 : // Initialize array to the address of the first element of the STL vector
139072 : // (which is guarenteed to be contiguous storage).
139073 : // SgAssignInitializer objectArray [] = *(Memory_Block_List.begin());
139074 0 : if (SgAssignInitializer::pools.empty() == false)
139075 : {
139076 : // Generate an array of memory pools
139077 0 : SgAssignInitializer** objectArray = (SgAssignInitializer**) &(SgAssignInitializer::pools[0]);
139078 :
139079 : // Build a local variable for better performance
139080 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
139081 :
139082 : // Iterate over the memory pools
139083 0 : bool done = false;
139084 0 : unsigned i=0;
139085 :
139086 : // find the first valid IR node, call visit function, and then leave
139087 0 : while ( done == false && i < SgAssignInitializer::pools.size() )
139088 : {
139089 : // objectArray[i] is a single memory pool
139090 : unsigned j=0;
139091 0 : while (done == false && j < SgAssignInitializer::pool_size)
139092 : {
139093 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
139094 : {
139095 0 : traversal.visit(&(objectArray[i][j]));
139096 0 : done = true;
139097 : }
139098 0 : j++;
139099 : }
139100 0 : i++;
139101 : }
139102 :
139103 : #if 0
139104 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
139105 : if (done == false)
139106 : {
139107 : printf ("No representative for SgAssignInitializer found in memory pools \n");
139108 : }
139109 : #endif
139110 : }
139111 0 : }
139112 :
139113 :
139114 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
139115 : // using values that overflow signed values of int.
139116 : size_t
139117 4 : SgAssignInitializer::numberOfNodes()
139118 : {
139119 : // This function traverses the memory pool for an IR node and
139120 : // counts the number of IR nodes of a particular Sage III IR
139121 : // nodes type.
139122 :
139123 4 : size_t count = 0;
139124 4 : if (SgAssignInitializer::pools.empty() == false)
139125 : {
139126 : // Generate an array of memory pools (this is actually a STL vector,
139127 : // but it is contiguious, so OK to treat this way).
139128 1 : SgAssignInitializer** objectArray = (SgAssignInitializer**) &(SgAssignInitializer::pools[0]);
139129 :
139130 : // Build a local variable for better performance (make it a loop invariant variable).
139131 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
139132 :
139133 : // Iterate over all of the memory pools for this IR node.
139134 2 : for (unsigned int i=0; i < SgAssignInitializer::pools.size(); i++)
139135 : {
139136 : // objectArray[i] is a single memory pool, iterate over all the
139137 : // IR nodes and only count those that are valid IR nodes used in
139138 : // the AST (i.e. allocated IR nodes).
139139 2001 : for (unsigned j=0; j < SgAssignInitializer::pool_size; j++)
139140 : {
139141 : // This is indexing the STL vector of C/C++ style arrays as a doubly
139142 : // indexed array access. It is OK since we have leveraged the semantics
139143 : // of STL vector memory as contigous and cast the memory as an array
139144 : // of arrays to use the 2D array indexing. Hope this is not confusing,
139145 : // but it s very fast as an implementation.
139146 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
139147 : {
139148 1193 : count++;
139149 : }
139150 : }
139151 : }
139152 : }
139153 :
139154 :
139155 :
139156 4 : return count;
139157 : }
139158 :
139159 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
139160 : // using values that overflow signed values of int.
139161 : size_t
139162 0 : SgAssignInitializer::memoryUsage()
139163 : {
139164 : // This function is required because we need the class name as a type when we call sizeof
139165 : // There might be another way to implement this if we have a traversal that only called a
139166 : // representative object (one call for each type of Sage IIIIR node).
139167 0 : size_t memory = numberOfNodes() * sizeof(SgAssignInitializer);
139168 :
139169 0 : return memory;
139170 : }
139171 :
139172 : /* #line 139173 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
139173 :
139174 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
139175 : void
139176 5342 : SgDesignatedInitializer::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
139177 : {
139178 : // This function traverses the memory pool for only a specific IR node
139179 : // and calls the visit function of the input class execute a traversal
139180 : // similar to the style of the attribute based traversals within ROSE.
139181 : // This traversal will visit ALL nodes of the AST where as the other
139182 : // attribute based traversals visit only the embedded tree within the AST.
139183 :
139184 : // Initialize array to the address of the first element of the STL vector
139185 : // (which is guaranteed to be contiguous storage).
139186 : // SgDesignatedInitializer objectArray [] = *(Memory_Block_List.begin());
139187 5342 : if (SgDesignatedInitializer::pools.empty() == false)
139188 : {
139189 : // Generate an array of memory pools
139190 0 : SgDesignatedInitializer** objectArray = (SgDesignatedInitializer**) &(SgDesignatedInitializer::pools[0]);
139191 :
139192 : // Build a local variable for better performance
139193 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
139194 : #if 0
139195 : // Iterate over the memory pools
139196 : for (unsigned int i=0; i < SgDesignatedInitializer::pools.size(); i++)
139197 : {
139198 : // objectArray[i] is a single memory pool
139199 : for (int j=0; j < SgDesignatedInitializer::pool_size; j++)
139200 : {
139201 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
139202 : {
139203 : traversal.visit(&(objectArray[i][j]));
139204 : }
139205 : }
139206 : }
139207 : #else
139208 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
139209 : // compute the list first and then call the visit function on each list element.
139210 :
139211 : // printf ("Inside of SgDesignatedInitializer::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
139212 :
139213 0 : std::vector<SgDesignatedInitializer*> nodeList;
139214 :
139215 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
139216 0 : for (unsigned int i=0; i < SgDesignatedInitializer::pools.size(); i++)
139217 : {
139218 : // objectArray[i] is a single memory pool
139219 0 : for (unsigned j=0; j < SgDesignatedInitializer::pool_size; j++)
139220 : {
139221 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
139222 : {
139223 0 : nodeList.push_back(&(objectArray[i][j]));
139224 : }
139225 : }
139226 : }
139227 :
139228 : // Iterate over the saved list
139229 0 : size_t nodeListSize = nodeList.size();
139230 0 : for (size_t i=0; i < nodeListSize; i++)
139231 : {
139232 0 : ROSE_ASSERT(nodeList[i] != NULL);
139233 : #if 0
139234 : traversal.visit(nodeList[i]);
139235 : #else
139236 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
139237 : {
139238 0 : traversal.visit(nodeList[i]);
139239 : }
139240 : #endif
139241 : }
139242 : #endif
139243 : }
139244 :
139245 : // This should not be required since all previously static data members are
139246 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
139247 :
139248 5342 : }
139249 :
139250 :
139251 : void
139252 194 : SgDesignatedInitializer::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
139253 : {
139254 : // This function traverses the memory pool for an IR node and
139255 : // calls the function to execute the visitor object.
139256 :
139257 : // Initialize array to the address of the first element of the STL vector
139258 : // (which is guarenteed to be contiguous storage).
139259 : // SgDesignatedInitializer objectArray [] = *(Memory_Block_List.begin());
139260 194 : if (SgDesignatedInitializer::pools.empty() == false)
139261 : {
139262 : // Generate an array of memory pools
139263 0 : SgDesignatedInitializer** objectArray = (SgDesignatedInitializer**) &(SgDesignatedInitializer::pools[0]);
139264 :
139265 : // Build a local variable for better performance
139266 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
139267 :
139268 : // Iterate over the memory pools
139269 0 : for (unsigned int i=0; i < SgDesignatedInitializer::pools.size(); i++)
139270 : {
139271 : // objectArray[i] is a single memory pool
139272 0 : for (unsigned j=0; j < SgDesignatedInitializer::pool_size; j++)
139273 : {
139274 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
139275 : {
139276 : // printf ("Found a valid SgDesignatedInitializer object in the memory pool %d at position %d \n",i,j);
139277 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
139278 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
139279 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
139280 : }
139281 : else
139282 : {
139283 : // printf ("Found a INVALID SgDesignatedInitializer object in the memory pool \n");
139284 : }
139285 : }
139286 : }
139287 : }
139288 :
139289 : // This should not be required since all previously static data members are
139290 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
139291 :
139292 194 : }
139293 :
139294 : void
139295 0 : SgDesignatedInitializer::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
139296 : {
139297 : // This function visits only a single IR node of the memory pool.
139298 : // it is typically called once for each type of IR node within
139299 : // the automatically generated function: traverseRepresentativeNodes().
139300 :
139301 : // Initialize array to the address of the first element of the STL vector
139302 : // (which is guarenteed to be contiguous storage).
139303 : // SgDesignatedInitializer objectArray [] = *(Memory_Block_List.begin());
139304 0 : if (SgDesignatedInitializer::pools.empty() == false)
139305 : {
139306 : // Generate an array of memory pools
139307 0 : SgDesignatedInitializer** objectArray = (SgDesignatedInitializer**) &(SgDesignatedInitializer::pools[0]);
139308 :
139309 : // Build a local variable for better performance
139310 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
139311 :
139312 : // Iterate over the memory pools
139313 0 : bool done = false;
139314 0 : unsigned i=0;
139315 :
139316 : // find the first valid IR node, call visit function, and then leave
139317 0 : while ( done == false && i < SgDesignatedInitializer::pools.size() )
139318 : {
139319 : // objectArray[i] is a single memory pool
139320 : unsigned j=0;
139321 0 : while (done == false && j < SgDesignatedInitializer::pool_size)
139322 : {
139323 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
139324 : {
139325 0 : traversal.visit(&(objectArray[i][j]));
139326 0 : done = true;
139327 : }
139328 0 : j++;
139329 : }
139330 0 : i++;
139331 : }
139332 :
139333 : #if 0
139334 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
139335 : if (done == false)
139336 : {
139337 : printf ("No representative for SgDesignatedInitializer found in memory pools \n");
139338 : }
139339 : #endif
139340 : }
139341 0 : }
139342 :
139343 :
139344 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
139345 : // using values that overflow signed values of int.
139346 : size_t
139347 4 : SgDesignatedInitializer::numberOfNodes()
139348 : {
139349 : // This function traverses the memory pool for an IR node and
139350 : // counts the number of IR nodes of a particular Sage III IR
139351 : // nodes type.
139352 :
139353 4 : size_t count = 0;
139354 4 : if (SgDesignatedInitializer::pools.empty() == false)
139355 : {
139356 : // Generate an array of memory pools (this is actually a STL vector,
139357 : // but it is contiguious, so OK to treat this way).
139358 0 : SgDesignatedInitializer** objectArray = (SgDesignatedInitializer**) &(SgDesignatedInitializer::pools[0]);
139359 :
139360 : // Build a local variable for better performance (make it a loop invariant variable).
139361 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
139362 :
139363 : // Iterate over all of the memory pools for this IR node.
139364 0 : for (unsigned int i=0; i < SgDesignatedInitializer::pools.size(); i++)
139365 : {
139366 : // objectArray[i] is a single memory pool, iterate over all the
139367 : // IR nodes and only count those that are valid IR nodes used in
139368 : // the AST (i.e. allocated IR nodes).
139369 0 : for (unsigned j=0; j < SgDesignatedInitializer::pool_size; j++)
139370 : {
139371 : // This is indexing the STL vector of C/C++ style arrays as a doubly
139372 : // indexed array access. It is OK since we have leveraged the semantics
139373 : // of STL vector memory as contigous and cast the memory as an array
139374 : // of arrays to use the 2D array indexing. Hope this is not confusing,
139375 : // but it s very fast as an implementation.
139376 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
139377 : {
139378 0 : count++;
139379 : }
139380 : }
139381 : }
139382 : }
139383 :
139384 :
139385 :
139386 4 : return count;
139387 : }
139388 :
139389 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
139390 : // using values that overflow signed values of int.
139391 : size_t
139392 0 : SgDesignatedInitializer::memoryUsage()
139393 : {
139394 : // This function is required because we need the class name as a type when we call sizeof
139395 : // There might be another way to implement this if we have a traversal that only called a
139396 : // representative object (one call for each type of Sage IIIIR node).
139397 0 : size_t memory = numberOfNodes() * sizeof(SgDesignatedInitializer);
139398 :
139399 0 : return memory;
139400 : }
139401 :
139402 : /* #line 139403 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
139403 :
139404 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
139405 : void
139406 5342 : SgBracedInitializer::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
139407 : {
139408 : // This function traverses the memory pool for only a specific IR node
139409 : // and calls the visit function of the input class execute a traversal
139410 : // similar to the style of the attribute based traversals within ROSE.
139411 : // This traversal will visit ALL nodes of the AST where as the other
139412 : // attribute based traversals visit only the embedded tree within the AST.
139413 :
139414 : // Initialize array to the address of the first element of the STL vector
139415 : // (which is guaranteed to be contiguous storage).
139416 : // SgBracedInitializer objectArray [] = *(Memory_Block_List.begin());
139417 5342 : if (SgBracedInitializer::pools.empty() == false)
139418 : {
139419 : // Generate an array of memory pools
139420 138 : SgBracedInitializer** objectArray = (SgBracedInitializer**) &(SgBracedInitializer::pools[0]);
139421 :
139422 : // Build a local variable for better performance
139423 138 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
139424 : #if 0
139425 : // Iterate over the memory pools
139426 : for (unsigned int i=0; i < SgBracedInitializer::pools.size(); i++)
139427 : {
139428 : // objectArray[i] is a single memory pool
139429 : for (int j=0; j < SgBracedInitializer::pool_size; j++)
139430 : {
139431 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
139432 : {
139433 : traversal.visit(&(objectArray[i][j]));
139434 : }
139435 : }
139436 : }
139437 : #else
139438 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
139439 : // compute the list first and then call the visit function on each list element.
139440 :
139441 : // printf ("Inside of SgBracedInitializer::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
139442 :
139443 276 : std::vector<SgBracedInitializer*> nodeList;
139444 :
139445 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
139446 276 : for (unsigned int i=0; i < SgBracedInitializer::pools.size(); i++)
139447 : {
139448 : // objectArray[i] is a single memory pool
139449 276138 : for (unsigned j=0; j < SgBracedInitializer::pool_size; j++)
139450 : {
139451 276000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
139452 : {
139453 138 : nodeList.push_back(&(objectArray[i][j]));
139454 : }
139455 : }
139456 : }
139457 :
139458 : // Iterate over the saved list
139459 138 : size_t nodeListSize = nodeList.size();
139460 276 : for (size_t i=0; i < nodeListSize; i++)
139461 : {
139462 138 : ROSE_ASSERT(nodeList[i] != NULL);
139463 : #if 0
139464 : traversal.visit(nodeList[i]);
139465 : #else
139466 138 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
139467 : {
139468 138 : traversal.visit(nodeList[i]);
139469 : }
139470 : #endif
139471 : }
139472 : #endif
139473 : }
139474 :
139475 : // This should not be required since all previously static data members are
139476 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
139477 :
139478 5342 : }
139479 :
139480 :
139481 : void
139482 194 : SgBracedInitializer::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
139483 : {
139484 : // This function traverses the memory pool for an IR node and
139485 : // calls the function to execute the visitor object.
139486 :
139487 : // Initialize array to the address of the first element of the STL vector
139488 : // (which is guarenteed to be contiguous storage).
139489 : // SgBracedInitializer objectArray [] = *(Memory_Block_List.begin());
139490 194 : if (SgBracedInitializer::pools.empty() == false)
139491 : {
139492 : // Generate an array of memory pools
139493 137 : SgBracedInitializer** objectArray = (SgBracedInitializer**) &(SgBracedInitializer::pools[0]);
139494 :
139495 : // Build a local variable for better performance
139496 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
139497 :
139498 : // Iterate over the memory pools
139499 274 : for (unsigned int i=0; i < SgBracedInitializer::pools.size(); i++)
139500 : {
139501 : // objectArray[i] is a single memory pool
139502 274137 : for (unsigned j=0; j < SgBracedInitializer::pool_size; j++)
139503 : {
139504 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
139505 : {
139506 : // printf ("Found a valid SgBracedInitializer object in the memory pool %d at position %d \n",i,j);
139507 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
139508 137 : objectArray[i][j].executeVisitorMemberFunction(visitor);
139509 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
139510 : }
139511 : else
139512 : {
139513 : // printf ("Found a INVALID SgBracedInitializer object in the memory pool \n");
139514 : }
139515 : }
139516 : }
139517 : }
139518 :
139519 : // This should not be required since all previously static data members are
139520 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
139521 :
139522 194 : }
139523 :
139524 : void
139525 0 : SgBracedInitializer::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
139526 : {
139527 : // This function visits only a single IR node of the memory pool.
139528 : // it is typically called once for each type of IR node within
139529 : // the automatically generated function: traverseRepresentativeNodes().
139530 :
139531 : // Initialize array to the address of the first element of the STL vector
139532 : // (which is guarenteed to be contiguous storage).
139533 : // SgBracedInitializer objectArray [] = *(Memory_Block_List.begin());
139534 0 : if (SgBracedInitializer::pools.empty() == false)
139535 : {
139536 : // Generate an array of memory pools
139537 0 : SgBracedInitializer** objectArray = (SgBracedInitializer**) &(SgBracedInitializer::pools[0]);
139538 :
139539 : // Build a local variable for better performance
139540 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
139541 :
139542 : // Iterate over the memory pools
139543 0 : bool done = false;
139544 0 : unsigned i=0;
139545 :
139546 : // find the first valid IR node, call visit function, and then leave
139547 0 : while ( done == false && i < SgBracedInitializer::pools.size() )
139548 : {
139549 : // objectArray[i] is a single memory pool
139550 : unsigned j=0;
139551 0 : while (done == false && j < SgBracedInitializer::pool_size)
139552 : {
139553 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
139554 : {
139555 0 : traversal.visit(&(objectArray[i][j]));
139556 0 : done = true;
139557 : }
139558 0 : j++;
139559 : }
139560 0 : i++;
139561 : }
139562 :
139563 : #if 0
139564 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
139565 : if (done == false)
139566 : {
139567 : printf ("No representative for SgBracedInitializer found in memory pools \n");
139568 : }
139569 : #endif
139570 : }
139571 0 : }
139572 :
139573 :
139574 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
139575 : // using values that overflow signed values of int.
139576 : size_t
139577 4 : SgBracedInitializer::numberOfNodes()
139578 : {
139579 : // This function traverses the memory pool for an IR node and
139580 : // counts the number of IR nodes of a particular Sage III IR
139581 : // nodes type.
139582 :
139583 4 : size_t count = 0;
139584 4 : if (SgBracedInitializer::pools.empty() == false)
139585 : {
139586 : // Generate an array of memory pools (this is actually a STL vector,
139587 : // but it is contiguious, so OK to treat this way).
139588 1 : SgBracedInitializer** objectArray = (SgBracedInitializer**) &(SgBracedInitializer::pools[0]);
139589 :
139590 : // Build a local variable for better performance (make it a loop invariant variable).
139591 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
139592 :
139593 : // Iterate over all of the memory pools for this IR node.
139594 2 : for (unsigned int i=0; i < SgBracedInitializer::pools.size(); i++)
139595 : {
139596 : // objectArray[i] is a single memory pool, iterate over all the
139597 : // IR nodes and only count those that are valid IR nodes used in
139598 : // the AST (i.e. allocated IR nodes).
139599 2001 : for (unsigned j=0; j < SgBracedInitializer::pool_size; j++)
139600 : {
139601 : // This is indexing the STL vector of C/C++ style arrays as a doubly
139602 : // indexed array access. It is OK since we have leveraged the semantics
139603 : // of STL vector memory as contigous and cast the memory as an array
139604 : // of arrays to use the 2D array indexing. Hope this is not confusing,
139605 : // but it s very fast as an implementation.
139606 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
139607 : {
139608 1 : count++;
139609 : }
139610 : }
139611 : }
139612 : }
139613 :
139614 :
139615 :
139616 4 : return count;
139617 : }
139618 :
139619 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
139620 : // using values that overflow signed values of int.
139621 : size_t
139622 0 : SgBracedInitializer::memoryUsage()
139623 : {
139624 : // This function is required because we need the class name as a type when we call sizeof
139625 : // There might be another way to implement this if we have a traversal that only called a
139626 : // representative object (one call for each type of Sage IIIIR node).
139627 0 : size_t memory = numberOfNodes() * sizeof(SgBracedInitializer);
139628 :
139629 0 : return memory;
139630 : }
139631 :
139632 : /* #line 139633 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
139633 :
139634 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
139635 : void
139636 5342 : SgVarArgStartOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
139637 : {
139638 : // This function traverses the memory pool for only a specific IR node
139639 : // and calls the visit function of the input class execute a traversal
139640 : // similar to the style of the attribute based traversals within ROSE.
139641 : // This traversal will visit ALL nodes of the AST where as the other
139642 : // attribute based traversals visit only the embedded tree within the AST.
139643 :
139644 : // Initialize array to the address of the first element of the STL vector
139645 : // (which is guaranteed to be contiguous storage).
139646 : // SgVarArgStartOp objectArray [] = *(Memory_Block_List.begin());
139647 5342 : if (SgVarArgStartOp::pools.empty() == false)
139648 : {
139649 : // Generate an array of memory pools
139650 0 : SgVarArgStartOp** objectArray = (SgVarArgStartOp**) &(SgVarArgStartOp::pools[0]);
139651 :
139652 : // Build a local variable for better performance
139653 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
139654 : #if 0
139655 : // Iterate over the memory pools
139656 : for (unsigned int i=0; i < SgVarArgStartOp::pools.size(); i++)
139657 : {
139658 : // objectArray[i] is a single memory pool
139659 : for (int j=0; j < SgVarArgStartOp::pool_size; j++)
139660 : {
139661 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
139662 : {
139663 : traversal.visit(&(objectArray[i][j]));
139664 : }
139665 : }
139666 : }
139667 : #else
139668 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
139669 : // compute the list first and then call the visit function on each list element.
139670 :
139671 : // printf ("Inside of SgVarArgStartOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
139672 :
139673 0 : std::vector<SgVarArgStartOp*> nodeList;
139674 :
139675 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
139676 0 : for (unsigned int i=0; i < SgVarArgStartOp::pools.size(); i++)
139677 : {
139678 : // objectArray[i] is a single memory pool
139679 0 : for (unsigned j=0; j < SgVarArgStartOp::pool_size; j++)
139680 : {
139681 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
139682 : {
139683 0 : nodeList.push_back(&(objectArray[i][j]));
139684 : }
139685 : }
139686 : }
139687 :
139688 : // Iterate over the saved list
139689 0 : size_t nodeListSize = nodeList.size();
139690 0 : for (size_t i=0; i < nodeListSize; i++)
139691 : {
139692 0 : ROSE_ASSERT(nodeList[i] != NULL);
139693 : #if 0
139694 : traversal.visit(nodeList[i]);
139695 : #else
139696 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
139697 : {
139698 0 : traversal.visit(nodeList[i]);
139699 : }
139700 : #endif
139701 : }
139702 : #endif
139703 : }
139704 :
139705 : // This should not be required since all previously static data members are
139706 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
139707 :
139708 5342 : }
139709 :
139710 :
139711 : void
139712 194 : SgVarArgStartOp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
139713 : {
139714 : // This function traverses the memory pool for an IR node and
139715 : // calls the function to execute the visitor object.
139716 :
139717 : // Initialize array to the address of the first element of the STL vector
139718 : // (which is guarenteed to be contiguous storage).
139719 : // SgVarArgStartOp objectArray [] = *(Memory_Block_List.begin());
139720 194 : if (SgVarArgStartOp::pools.empty() == false)
139721 : {
139722 : // Generate an array of memory pools
139723 0 : SgVarArgStartOp** objectArray = (SgVarArgStartOp**) &(SgVarArgStartOp::pools[0]);
139724 :
139725 : // Build a local variable for better performance
139726 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
139727 :
139728 : // Iterate over the memory pools
139729 0 : for (unsigned int i=0; i < SgVarArgStartOp::pools.size(); i++)
139730 : {
139731 : // objectArray[i] is a single memory pool
139732 0 : for (unsigned j=0; j < SgVarArgStartOp::pool_size; j++)
139733 : {
139734 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
139735 : {
139736 : // printf ("Found a valid SgVarArgStartOp object in the memory pool %d at position %d \n",i,j);
139737 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
139738 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
139739 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
139740 : }
139741 : else
139742 : {
139743 : // printf ("Found a INVALID SgVarArgStartOp object in the memory pool \n");
139744 : }
139745 : }
139746 : }
139747 : }
139748 :
139749 : // This should not be required since all previously static data members are
139750 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
139751 :
139752 194 : }
139753 :
139754 : void
139755 0 : SgVarArgStartOp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
139756 : {
139757 : // This function visits only a single IR node of the memory pool.
139758 : // it is typically called once for each type of IR node within
139759 : // the automatically generated function: traverseRepresentativeNodes().
139760 :
139761 : // Initialize array to the address of the first element of the STL vector
139762 : // (which is guarenteed to be contiguous storage).
139763 : // SgVarArgStartOp objectArray [] = *(Memory_Block_List.begin());
139764 0 : if (SgVarArgStartOp::pools.empty() == false)
139765 : {
139766 : // Generate an array of memory pools
139767 0 : SgVarArgStartOp** objectArray = (SgVarArgStartOp**) &(SgVarArgStartOp::pools[0]);
139768 :
139769 : // Build a local variable for better performance
139770 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
139771 :
139772 : // Iterate over the memory pools
139773 0 : bool done = false;
139774 0 : unsigned i=0;
139775 :
139776 : // find the first valid IR node, call visit function, and then leave
139777 0 : while ( done == false && i < SgVarArgStartOp::pools.size() )
139778 : {
139779 : // objectArray[i] is a single memory pool
139780 : unsigned j=0;
139781 0 : while (done == false && j < SgVarArgStartOp::pool_size)
139782 : {
139783 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
139784 : {
139785 0 : traversal.visit(&(objectArray[i][j]));
139786 0 : done = true;
139787 : }
139788 0 : j++;
139789 : }
139790 0 : i++;
139791 : }
139792 :
139793 : #if 0
139794 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
139795 : if (done == false)
139796 : {
139797 : printf ("No representative for SgVarArgStartOp found in memory pools \n");
139798 : }
139799 : #endif
139800 : }
139801 0 : }
139802 :
139803 :
139804 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
139805 : // using values that overflow signed values of int.
139806 : size_t
139807 4 : SgVarArgStartOp::numberOfNodes()
139808 : {
139809 : // This function traverses the memory pool for an IR node and
139810 : // counts the number of IR nodes of a particular Sage III IR
139811 : // nodes type.
139812 :
139813 4 : size_t count = 0;
139814 4 : if (SgVarArgStartOp::pools.empty() == false)
139815 : {
139816 : // Generate an array of memory pools (this is actually a STL vector,
139817 : // but it is contiguious, so OK to treat this way).
139818 0 : SgVarArgStartOp** objectArray = (SgVarArgStartOp**) &(SgVarArgStartOp::pools[0]);
139819 :
139820 : // Build a local variable for better performance (make it a loop invariant variable).
139821 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
139822 :
139823 : // Iterate over all of the memory pools for this IR node.
139824 0 : for (unsigned int i=0; i < SgVarArgStartOp::pools.size(); i++)
139825 : {
139826 : // objectArray[i] is a single memory pool, iterate over all the
139827 : // IR nodes and only count those that are valid IR nodes used in
139828 : // the AST (i.e. allocated IR nodes).
139829 0 : for (unsigned j=0; j < SgVarArgStartOp::pool_size; j++)
139830 : {
139831 : // This is indexing the STL vector of C/C++ style arrays as a doubly
139832 : // indexed array access. It is OK since we have leveraged the semantics
139833 : // of STL vector memory as contigous and cast the memory as an array
139834 : // of arrays to use the 2D array indexing. Hope this is not confusing,
139835 : // but it s very fast as an implementation.
139836 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
139837 : {
139838 0 : count++;
139839 : }
139840 : }
139841 : }
139842 : }
139843 :
139844 :
139845 :
139846 4 : return count;
139847 : }
139848 :
139849 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
139850 : // using values that overflow signed values of int.
139851 : size_t
139852 0 : SgVarArgStartOp::memoryUsage()
139853 : {
139854 : // This function is required because we need the class name as a type when we call sizeof
139855 : // There might be another way to implement this if we have a traversal that only called a
139856 : // representative object (one call for each type of Sage IIIIR node).
139857 0 : size_t memory = numberOfNodes() * sizeof(SgVarArgStartOp);
139858 :
139859 0 : return memory;
139860 : }
139861 :
139862 : /* #line 139863 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
139863 :
139864 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
139865 : void
139866 5342 : SgVarArgOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
139867 : {
139868 : // This function traverses the memory pool for only a specific IR node
139869 : // and calls the visit function of the input class execute a traversal
139870 : // similar to the style of the attribute based traversals within ROSE.
139871 : // This traversal will visit ALL nodes of the AST where as the other
139872 : // attribute based traversals visit only the embedded tree within the AST.
139873 :
139874 : // Initialize array to the address of the first element of the STL vector
139875 : // (which is guaranteed to be contiguous storage).
139876 : // SgVarArgOp objectArray [] = *(Memory_Block_List.begin());
139877 5342 : if (SgVarArgOp::pools.empty() == false)
139878 : {
139879 : // Generate an array of memory pools
139880 0 : SgVarArgOp** objectArray = (SgVarArgOp**) &(SgVarArgOp::pools[0]);
139881 :
139882 : // Build a local variable for better performance
139883 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
139884 : #if 0
139885 : // Iterate over the memory pools
139886 : for (unsigned int i=0; i < SgVarArgOp::pools.size(); i++)
139887 : {
139888 : // objectArray[i] is a single memory pool
139889 : for (int j=0; j < SgVarArgOp::pool_size; j++)
139890 : {
139891 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
139892 : {
139893 : traversal.visit(&(objectArray[i][j]));
139894 : }
139895 : }
139896 : }
139897 : #else
139898 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
139899 : // compute the list first and then call the visit function on each list element.
139900 :
139901 : // printf ("Inside of SgVarArgOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
139902 :
139903 0 : std::vector<SgVarArgOp*> nodeList;
139904 :
139905 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
139906 0 : for (unsigned int i=0; i < SgVarArgOp::pools.size(); i++)
139907 : {
139908 : // objectArray[i] is a single memory pool
139909 0 : for (unsigned j=0; j < SgVarArgOp::pool_size; j++)
139910 : {
139911 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
139912 : {
139913 0 : nodeList.push_back(&(objectArray[i][j]));
139914 : }
139915 : }
139916 : }
139917 :
139918 : // Iterate over the saved list
139919 0 : size_t nodeListSize = nodeList.size();
139920 0 : for (size_t i=0; i < nodeListSize; i++)
139921 : {
139922 0 : ROSE_ASSERT(nodeList[i] != NULL);
139923 : #if 0
139924 : traversal.visit(nodeList[i]);
139925 : #else
139926 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
139927 : {
139928 0 : traversal.visit(nodeList[i]);
139929 : }
139930 : #endif
139931 : }
139932 : #endif
139933 : }
139934 :
139935 : // This should not be required since all previously static data members are
139936 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
139937 :
139938 5342 : }
139939 :
139940 :
139941 : void
139942 194 : SgVarArgOp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
139943 : {
139944 : // This function traverses the memory pool for an IR node and
139945 : // calls the function to execute the visitor object.
139946 :
139947 : // Initialize array to the address of the first element of the STL vector
139948 : // (which is guarenteed to be contiguous storage).
139949 : // SgVarArgOp objectArray [] = *(Memory_Block_List.begin());
139950 194 : if (SgVarArgOp::pools.empty() == false)
139951 : {
139952 : // Generate an array of memory pools
139953 0 : SgVarArgOp** objectArray = (SgVarArgOp**) &(SgVarArgOp::pools[0]);
139954 :
139955 : // Build a local variable for better performance
139956 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
139957 :
139958 : // Iterate over the memory pools
139959 0 : for (unsigned int i=0; i < SgVarArgOp::pools.size(); i++)
139960 : {
139961 : // objectArray[i] is a single memory pool
139962 0 : for (unsigned j=0; j < SgVarArgOp::pool_size; j++)
139963 : {
139964 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
139965 : {
139966 : // printf ("Found a valid SgVarArgOp object in the memory pool %d at position %d \n",i,j);
139967 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
139968 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
139969 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
139970 : }
139971 : else
139972 : {
139973 : // printf ("Found a INVALID SgVarArgOp object in the memory pool \n");
139974 : }
139975 : }
139976 : }
139977 : }
139978 :
139979 : // This should not be required since all previously static data members are
139980 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
139981 :
139982 194 : }
139983 :
139984 : void
139985 0 : SgVarArgOp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
139986 : {
139987 : // This function visits only a single IR node of the memory pool.
139988 : // it is typically called once for each type of IR node within
139989 : // the automatically generated function: traverseRepresentativeNodes().
139990 :
139991 : // Initialize array to the address of the first element of the STL vector
139992 : // (which is guarenteed to be contiguous storage).
139993 : // SgVarArgOp objectArray [] = *(Memory_Block_List.begin());
139994 0 : if (SgVarArgOp::pools.empty() == false)
139995 : {
139996 : // Generate an array of memory pools
139997 0 : SgVarArgOp** objectArray = (SgVarArgOp**) &(SgVarArgOp::pools[0]);
139998 :
139999 : // Build a local variable for better performance
140000 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
140001 :
140002 : // Iterate over the memory pools
140003 0 : bool done = false;
140004 0 : unsigned i=0;
140005 :
140006 : // find the first valid IR node, call visit function, and then leave
140007 0 : while ( done == false && i < SgVarArgOp::pools.size() )
140008 : {
140009 : // objectArray[i] is a single memory pool
140010 : unsigned j=0;
140011 0 : while (done == false && j < SgVarArgOp::pool_size)
140012 : {
140013 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
140014 : {
140015 0 : traversal.visit(&(objectArray[i][j]));
140016 0 : done = true;
140017 : }
140018 0 : j++;
140019 : }
140020 0 : i++;
140021 : }
140022 :
140023 : #if 0
140024 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
140025 : if (done == false)
140026 : {
140027 : printf ("No representative for SgVarArgOp found in memory pools \n");
140028 : }
140029 : #endif
140030 : }
140031 0 : }
140032 :
140033 :
140034 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
140035 : // using values that overflow signed values of int.
140036 : size_t
140037 4 : SgVarArgOp::numberOfNodes()
140038 : {
140039 : // This function traverses the memory pool for an IR node and
140040 : // counts the number of IR nodes of a particular Sage III IR
140041 : // nodes type.
140042 :
140043 4 : size_t count = 0;
140044 4 : if (SgVarArgOp::pools.empty() == false)
140045 : {
140046 : // Generate an array of memory pools (this is actually a STL vector,
140047 : // but it is contiguious, so OK to treat this way).
140048 0 : SgVarArgOp** objectArray = (SgVarArgOp**) &(SgVarArgOp::pools[0]);
140049 :
140050 : // Build a local variable for better performance (make it a loop invariant variable).
140051 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
140052 :
140053 : // Iterate over all of the memory pools for this IR node.
140054 0 : for (unsigned int i=0; i < SgVarArgOp::pools.size(); i++)
140055 : {
140056 : // objectArray[i] is a single memory pool, iterate over all the
140057 : // IR nodes and only count those that are valid IR nodes used in
140058 : // the AST (i.e. allocated IR nodes).
140059 0 : for (unsigned j=0; j < SgVarArgOp::pool_size; j++)
140060 : {
140061 : // This is indexing the STL vector of C/C++ style arrays as a doubly
140062 : // indexed array access. It is OK since we have leveraged the semantics
140063 : // of STL vector memory as contigous and cast the memory as an array
140064 : // of arrays to use the 2D array indexing. Hope this is not confusing,
140065 : // but it s very fast as an implementation.
140066 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
140067 : {
140068 0 : count++;
140069 : }
140070 : }
140071 : }
140072 : }
140073 :
140074 :
140075 :
140076 4 : return count;
140077 : }
140078 :
140079 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
140080 : // using values that overflow signed values of int.
140081 : size_t
140082 0 : SgVarArgOp::memoryUsage()
140083 : {
140084 : // This function is required because we need the class name as a type when we call sizeof
140085 : // There might be another way to implement this if we have a traversal that only called a
140086 : // representative object (one call for each type of Sage IIIIR node).
140087 0 : size_t memory = numberOfNodes() * sizeof(SgVarArgOp);
140088 :
140089 0 : return memory;
140090 : }
140091 :
140092 : /* #line 140093 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
140093 :
140094 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
140095 : void
140096 5342 : SgVarArgEndOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
140097 : {
140098 : // This function traverses the memory pool for only a specific IR node
140099 : // and calls the visit function of the input class execute a traversal
140100 : // similar to the style of the attribute based traversals within ROSE.
140101 : // This traversal will visit ALL nodes of the AST where as the other
140102 : // attribute based traversals visit only the embedded tree within the AST.
140103 :
140104 : // Initialize array to the address of the first element of the STL vector
140105 : // (which is guaranteed to be contiguous storage).
140106 : // SgVarArgEndOp objectArray [] = *(Memory_Block_List.begin());
140107 5342 : if (SgVarArgEndOp::pools.empty() == false)
140108 : {
140109 : // Generate an array of memory pools
140110 0 : SgVarArgEndOp** objectArray = (SgVarArgEndOp**) &(SgVarArgEndOp::pools[0]);
140111 :
140112 : // Build a local variable for better performance
140113 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
140114 : #if 0
140115 : // Iterate over the memory pools
140116 : for (unsigned int i=0; i < SgVarArgEndOp::pools.size(); i++)
140117 : {
140118 : // objectArray[i] is a single memory pool
140119 : for (int j=0; j < SgVarArgEndOp::pool_size; j++)
140120 : {
140121 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
140122 : {
140123 : traversal.visit(&(objectArray[i][j]));
140124 : }
140125 : }
140126 : }
140127 : #else
140128 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
140129 : // compute the list first and then call the visit function on each list element.
140130 :
140131 : // printf ("Inside of SgVarArgEndOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
140132 :
140133 0 : std::vector<SgVarArgEndOp*> nodeList;
140134 :
140135 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
140136 0 : for (unsigned int i=0; i < SgVarArgEndOp::pools.size(); i++)
140137 : {
140138 : // objectArray[i] is a single memory pool
140139 0 : for (unsigned j=0; j < SgVarArgEndOp::pool_size; j++)
140140 : {
140141 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
140142 : {
140143 0 : nodeList.push_back(&(objectArray[i][j]));
140144 : }
140145 : }
140146 : }
140147 :
140148 : // Iterate over the saved list
140149 0 : size_t nodeListSize = nodeList.size();
140150 0 : for (size_t i=0; i < nodeListSize; i++)
140151 : {
140152 0 : ROSE_ASSERT(nodeList[i] != NULL);
140153 : #if 0
140154 : traversal.visit(nodeList[i]);
140155 : #else
140156 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
140157 : {
140158 0 : traversal.visit(nodeList[i]);
140159 : }
140160 : #endif
140161 : }
140162 : #endif
140163 : }
140164 :
140165 : // This should not be required since all previously static data members are
140166 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
140167 :
140168 5342 : }
140169 :
140170 :
140171 : void
140172 194 : SgVarArgEndOp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
140173 : {
140174 : // This function traverses the memory pool for an IR node and
140175 : // calls the function to execute the visitor object.
140176 :
140177 : // Initialize array to the address of the first element of the STL vector
140178 : // (which is guarenteed to be contiguous storage).
140179 : // SgVarArgEndOp objectArray [] = *(Memory_Block_List.begin());
140180 194 : if (SgVarArgEndOp::pools.empty() == false)
140181 : {
140182 : // Generate an array of memory pools
140183 0 : SgVarArgEndOp** objectArray = (SgVarArgEndOp**) &(SgVarArgEndOp::pools[0]);
140184 :
140185 : // Build a local variable for better performance
140186 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
140187 :
140188 : // Iterate over the memory pools
140189 0 : for (unsigned int i=0; i < SgVarArgEndOp::pools.size(); i++)
140190 : {
140191 : // objectArray[i] is a single memory pool
140192 0 : for (unsigned j=0; j < SgVarArgEndOp::pool_size; j++)
140193 : {
140194 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
140195 : {
140196 : // printf ("Found a valid SgVarArgEndOp object in the memory pool %d at position %d \n",i,j);
140197 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
140198 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
140199 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
140200 : }
140201 : else
140202 : {
140203 : // printf ("Found a INVALID SgVarArgEndOp object in the memory pool \n");
140204 : }
140205 : }
140206 : }
140207 : }
140208 :
140209 : // This should not be required since all previously static data members are
140210 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
140211 :
140212 194 : }
140213 :
140214 : void
140215 0 : SgVarArgEndOp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
140216 : {
140217 : // This function visits only a single IR node of the memory pool.
140218 : // it is typically called once for each type of IR node within
140219 : // the automatically generated function: traverseRepresentativeNodes().
140220 :
140221 : // Initialize array to the address of the first element of the STL vector
140222 : // (which is guarenteed to be contiguous storage).
140223 : // SgVarArgEndOp objectArray [] = *(Memory_Block_List.begin());
140224 0 : if (SgVarArgEndOp::pools.empty() == false)
140225 : {
140226 : // Generate an array of memory pools
140227 0 : SgVarArgEndOp** objectArray = (SgVarArgEndOp**) &(SgVarArgEndOp::pools[0]);
140228 :
140229 : // Build a local variable for better performance
140230 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
140231 :
140232 : // Iterate over the memory pools
140233 0 : bool done = false;
140234 0 : unsigned i=0;
140235 :
140236 : // find the first valid IR node, call visit function, and then leave
140237 0 : while ( done == false && i < SgVarArgEndOp::pools.size() )
140238 : {
140239 : // objectArray[i] is a single memory pool
140240 : unsigned j=0;
140241 0 : while (done == false && j < SgVarArgEndOp::pool_size)
140242 : {
140243 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
140244 : {
140245 0 : traversal.visit(&(objectArray[i][j]));
140246 0 : done = true;
140247 : }
140248 0 : j++;
140249 : }
140250 0 : i++;
140251 : }
140252 :
140253 : #if 0
140254 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
140255 : if (done == false)
140256 : {
140257 : printf ("No representative for SgVarArgEndOp found in memory pools \n");
140258 : }
140259 : #endif
140260 : }
140261 0 : }
140262 :
140263 :
140264 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
140265 : // using values that overflow signed values of int.
140266 : size_t
140267 4 : SgVarArgEndOp::numberOfNodes()
140268 : {
140269 : // This function traverses the memory pool for an IR node and
140270 : // counts the number of IR nodes of a particular Sage III IR
140271 : // nodes type.
140272 :
140273 4 : size_t count = 0;
140274 4 : if (SgVarArgEndOp::pools.empty() == false)
140275 : {
140276 : // Generate an array of memory pools (this is actually a STL vector,
140277 : // but it is contiguious, so OK to treat this way).
140278 0 : SgVarArgEndOp** objectArray = (SgVarArgEndOp**) &(SgVarArgEndOp::pools[0]);
140279 :
140280 : // Build a local variable for better performance (make it a loop invariant variable).
140281 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
140282 :
140283 : // Iterate over all of the memory pools for this IR node.
140284 0 : for (unsigned int i=0; i < SgVarArgEndOp::pools.size(); i++)
140285 : {
140286 : // objectArray[i] is a single memory pool, iterate over all the
140287 : // IR nodes and only count those that are valid IR nodes used in
140288 : // the AST (i.e. allocated IR nodes).
140289 0 : for (unsigned j=0; j < SgVarArgEndOp::pool_size; j++)
140290 : {
140291 : // This is indexing the STL vector of C/C++ style arrays as a doubly
140292 : // indexed array access. It is OK since we have leveraged the semantics
140293 : // of STL vector memory as contigous and cast the memory as an array
140294 : // of arrays to use the 2D array indexing. Hope this is not confusing,
140295 : // but it s very fast as an implementation.
140296 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
140297 : {
140298 0 : count++;
140299 : }
140300 : }
140301 : }
140302 : }
140303 :
140304 :
140305 :
140306 4 : return count;
140307 : }
140308 :
140309 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
140310 : // using values that overflow signed values of int.
140311 : size_t
140312 0 : SgVarArgEndOp::memoryUsage()
140313 : {
140314 : // This function is required because we need the class name as a type when we call sizeof
140315 : // There might be another way to implement this if we have a traversal that only called a
140316 : // representative object (one call for each type of Sage IIIIR node).
140317 0 : size_t memory = numberOfNodes() * sizeof(SgVarArgEndOp);
140318 :
140319 0 : return memory;
140320 : }
140321 :
140322 : /* #line 140323 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
140323 :
140324 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
140325 : void
140326 5342 : SgVarArgCopyOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
140327 : {
140328 : // This function traverses the memory pool for only a specific IR node
140329 : // and calls the visit function of the input class execute a traversal
140330 : // similar to the style of the attribute based traversals within ROSE.
140331 : // This traversal will visit ALL nodes of the AST where as the other
140332 : // attribute based traversals visit only the embedded tree within the AST.
140333 :
140334 : // Initialize array to the address of the first element of the STL vector
140335 : // (which is guaranteed to be contiguous storage).
140336 : // SgVarArgCopyOp objectArray [] = *(Memory_Block_List.begin());
140337 5342 : if (SgVarArgCopyOp::pools.empty() == false)
140338 : {
140339 : // Generate an array of memory pools
140340 0 : SgVarArgCopyOp** objectArray = (SgVarArgCopyOp**) &(SgVarArgCopyOp::pools[0]);
140341 :
140342 : // Build a local variable for better performance
140343 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
140344 : #if 0
140345 : // Iterate over the memory pools
140346 : for (unsigned int i=0; i < SgVarArgCopyOp::pools.size(); i++)
140347 : {
140348 : // objectArray[i] is a single memory pool
140349 : for (int j=0; j < SgVarArgCopyOp::pool_size; j++)
140350 : {
140351 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
140352 : {
140353 : traversal.visit(&(objectArray[i][j]));
140354 : }
140355 : }
140356 : }
140357 : #else
140358 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
140359 : // compute the list first and then call the visit function on each list element.
140360 :
140361 : // printf ("Inside of SgVarArgCopyOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
140362 :
140363 0 : std::vector<SgVarArgCopyOp*> nodeList;
140364 :
140365 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
140366 0 : for (unsigned int i=0; i < SgVarArgCopyOp::pools.size(); i++)
140367 : {
140368 : // objectArray[i] is a single memory pool
140369 0 : for (unsigned j=0; j < SgVarArgCopyOp::pool_size; j++)
140370 : {
140371 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
140372 : {
140373 0 : nodeList.push_back(&(objectArray[i][j]));
140374 : }
140375 : }
140376 : }
140377 :
140378 : // Iterate over the saved list
140379 0 : size_t nodeListSize = nodeList.size();
140380 0 : for (size_t i=0; i < nodeListSize; i++)
140381 : {
140382 0 : ROSE_ASSERT(nodeList[i] != NULL);
140383 : #if 0
140384 : traversal.visit(nodeList[i]);
140385 : #else
140386 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
140387 : {
140388 0 : traversal.visit(nodeList[i]);
140389 : }
140390 : #endif
140391 : }
140392 : #endif
140393 : }
140394 :
140395 : // This should not be required since all previously static data members are
140396 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
140397 :
140398 5342 : }
140399 :
140400 :
140401 : void
140402 194 : SgVarArgCopyOp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
140403 : {
140404 : // This function traverses the memory pool for an IR node and
140405 : // calls the function to execute the visitor object.
140406 :
140407 : // Initialize array to the address of the first element of the STL vector
140408 : // (which is guarenteed to be contiguous storage).
140409 : // SgVarArgCopyOp objectArray [] = *(Memory_Block_List.begin());
140410 194 : if (SgVarArgCopyOp::pools.empty() == false)
140411 : {
140412 : // Generate an array of memory pools
140413 0 : SgVarArgCopyOp** objectArray = (SgVarArgCopyOp**) &(SgVarArgCopyOp::pools[0]);
140414 :
140415 : // Build a local variable for better performance
140416 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
140417 :
140418 : // Iterate over the memory pools
140419 0 : for (unsigned int i=0; i < SgVarArgCopyOp::pools.size(); i++)
140420 : {
140421 : // objectArray[i] is a single memory pool
140422 0 : for (unsigned j=0; j < SgVarArgCopyOp::pool_size; j++)
140423 : {
140424 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
140425 : {
140426 : // printf ("Found a valid SgVarArgCopyOp object in the memory pool %d at position %d \n",i,j);
140427 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
140428 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
140429 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
140430 : }
140431 : else
140432 : {
140433 : // printf ("Found a INVALID SgVarArgCopyOp object in the memory pool \n");
140434 : }
140435 : }
140436 : }
140437 : }
140438 :
140439 : // This should not be required since all previously static data members are
140440 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
140441 :
140442 194 : }
140443 :
140444 : void
140445 0 : SgVarArgCopyOp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
140446 : {
140447 : // This function visits only a single IR node of the memory pool.
140448 : // it is typically called once for each type of IR node within
140449 : // the automatically generated function: traverseRepresentativeNodes().
140450 :
140451 : // Initialize array to the address of the first element of the STL vector
140452 : // (which is guarenteed to be contiguous storage).
140453 : // SgVarArgCopyOp objectArray [] = *(Memory_Block_List.begin());
140454 0 : if (SgVarArgCopyOp::pools.empty() == false)
140455 : {
140456 : // Generate an array of memory pools
140457 0 : SgVarArgCopyOp** objectArray = (SgVarArgCopyOp**) &(SgVarArgCopyOp::pools[0]);
140458 :
140459 : // Build a local variable for better performance
140460 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
140461 :
140462 : // Iterate over the memory pools
140463 0 : bool done = false;
140464 0 : unsigned i=0;
140465 :
140466 : // find the first valid IR node, call visit function, and then leave
140467 0 : while ( done == false && i < SgVarArgCopyOp::pools.size() )
140468 : {
140469 : // objectArray[i] is a single memory pool
140470 : unsigned j=0;
140471 0 : while (done == false && j < SgVarArgCopyOp::pool_size)
140472 : {
140473 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
140474 : {
140475 0 : traversal.visit(&(objectArray[i][j]));
140476 0 : done = true;
140477 : }
140478 0 : j++;
140479 : }
140480 0 : i++;
140481 : }
140482 :
140483 : #if 0
140484 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
140485 : if (done == false)
140486 : {
140487 : printf ("No representative for SgVarArgCopyOp found in memory pools \n");
140488 : }
140489 : #endif
140490 : }
140491 0 : }
140492 :
140493 :
140494 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
140495 : // using values that overflow signed values of int.
140496 : size_t
140497 4 : SgVarArgCopyOp::numberOfNodes()
140498 : {
140499 : // This function traverses the memory pool for an IR node and
140500 : // counts the number of IR nodes of a particular Sage III IR
140501 : // nodes type.
140502 :
140503 4 : size_t count = 0;
140504 4 : if (SgVarArgCopyOp::pools.empty() == false)
140505 : {
140506 : // Generate an array of memory pools (this is actually a STL vector,
140507 : // but it is contiguious, so OK to treat this way).
140508 0 : SgVarArgCopyOp** objectArray = (SgVarArgCopyOp**) &(SgVarArgCopyOp::pools[0]);
140509 :
140510 : // Build a local variable for better performance (make it a loop invariant variable).
140511 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
140512 :
140513 : // Iterate over all of the memory pools for this IR node.
140514 0 : for (unsigned int i=0; i < SgVarArgCopyOp::pools.size(); i++)
140515 : {
140516 : // objectArray[i] is a single memory pool, iterate over all the
140517 : // IR nodes and only count those that are valid IR nodes used in
140518 : // the AST (i.e. allocated IR nodes).
140519 0 : for (unsigned j=0; j < SgVarArgCopyOp::pool_size; j++)
140520 : {
140521 : // This is indexing the STL vector of C/C++ style arrays as a doubly
140522 : // indexed array access. It is OK since we have leveraged the semantics
140523 : // of STL vector memory as contigous and cast the memory as an array
140524 : // of arrays to use the 2D array indexing. Hope this is not confusing,
140525 : // but it s very fast as an implementation.
140526 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
140527 : {
140528 0 : count++;
140529 : }
140530 : }
140531 : }
140532 : }
140533 :
140534 :
140535 :
140536 4 : return count;
140537 : }
140538 :
140539 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
140540 : // using values that overflow signed values of int.
140541 : size_t
140542 0 : SgVarArgCopyOp::memoryUsage()
140543 : {
140544 : // This function is required because we need the class name as a type when we call sizeof
140545 : // There might be another way to implement this if we have a traversal that only called a
140546 : // representative object (one call for each type of Sage IIIIR node).
140547 0 : size_t memory = numberOfNodes() * sizeof(SgVarArgCopyOp);
140548 :
140549 0 : return memory;
140550 : }
140551 :
140552 : /* #line 140553 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
140553 :
140554 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
140555 : void
140556 5342 : SgVarArgStartOneOperandOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
140557 : {
140558 : // This function traverses the memory pool for only a specific IR node
140559 : // and calls the visit function of the input class execute a traversal
140560 : // similar to the style of the attribute based traversals within ROSE.
140561 : // This traversal will visit ALL nodes of the AST where as the other
140562 : // attribute based traversals visit only the embedded tree within the AST.
140563 :
140564 : // Initialize array to the address of the first element of the STL vector
140565 : // (which is guaranteed to be contiguous storage).
140566 : // SgVarArgStartOneOperandOp objectArray [] = *(Memory_Block_List.begin());
140567 5342 : if (SgVarArgStartOneOperandOp::pools.empty() == false)
140568 : {
140569 : // Generate an array of memory pools
140570 0 : SgVarArgStartOneOperandOp** objectArray = (SgVarArgStartOneOperandOp**) &(SgVarArgStartOneOperandOp::pools[0]);
140571 :
140572 : // Build a local variable for better performance
140573 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
140574 : #if 0
140575 : // Iterate over the memory pools
140576 : for (unsigned int i=0; i < SgVarArgStartOneOperandOp::pools.size(); i++)
140577 : {
140578 : // objectArray[i] is a single memory pool
140579 : for (int j=0; j < SgVarArgStartOneOperandOp::pool_size; j++)
140580 : {
140581 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
140582 : {
140583 : traversal.visit(&(objectArray[i][j]));
140584 : }
140585 : }
140586 : }
140587 : #else
140588 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
140589 : // compute the list first and then call the visit function on each list element.
140590 :
140591 : // printf ("Inside of SgVarArgStartOneOperandOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
140592 :
140593 0 : std::vector<SgVarArgStartOneOperandOp*> nodeList;
140594 :
140595 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
140596 0 : for (unsigned int i=0; i < SgVarArgStartOneOperandOp::pools.size(); i++)
140597 : {
140598 : // objectArray[i] is a single memory pool
140599 0 : for (unsigned j=0; j < SgVarArgStartOneOperandOp::pool_size; j++)
140600 : {
140601 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
140602 : {
140603 0 : nodeList.push_back(&(objectArray[i][j]));
140604 : }
140605 : }
140606 : }
140607 :
140608 : // Iterate over the saved list
140609 0 : size_t nodeListSize = nodeList.size();
140610 0 : for (size_t i=0; i < nodeListSize; i++)
140611 : {
140612 0 : ROSE_ASSERT(nodeList[i] != NULL);
140613 : #if 0
140614 : traversal.visit(nodeList[i]);
140615 : #else
140616 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
140617 : {
140618 0 : traversal.visit(nodeList[i]);
140619 : }
140620 : #endif
140621 : }
140622 : #endif
140623 : }
140624 :
140625 : // This should not be required since all previously static data members are
140626 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
140627 :
140628 5342 : }
140629 :
140630 :
140631 : void
140632 194 : SgVarArgStartOneOperandOp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
140633 : {
140634 : // This function traverses the memory pool for an IR node and
140635 : // calls the function to execute the visitor object.
140636 :
140637 : // Initialize array to the address of the first element of the STL vector
140638 : // (which is guarenteed to be contiguous storage).
140639 : // SgVarArgStartOneOperandOp objectArray [] = *(Memory_Block_List.begin());
140640 194 : if (SgVarArgStartOneOperandOp::pools.empty() == false)
140641 : {
140642 : // Generate an array of memory pools
140643 0 : SgVarArgStartOneOperandOp** objectArray = (SgVarArgStartOneOperandOp**) &(SgVarArgStartOneOperandOp::pools[0]);
140644 :
140645 : // Build a local variable for better performance
140646 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
140647 :
140648 : // Iterate over the memory pools
140649 0 : for (unsigned int i=0; i < SgVarArgStartOneOperandOp::pools.size(); i++)
140650 : {
140651 : // objectArray[i] is a single memory pool
140652 0 : for (unsigned j=0; j < SgVarArgStartOneOperandOp::pool_size; j++)
140653 : {
140654 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
140655 : {
140656 : // printf ("Found a valid SgVarArgStartOneOperandOp object in the memory pool %d at position %d \n",i,j);
140657 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
140658 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
140659 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
140660 : }
140661 : else
140662 : {
140663 : // printf ("Found a INVALID SgVarArgStartOneOperandOp object in the memory pool \n");
140664 : }
140665 : }
140666 : }
140667 : }
140668 :
140669 : // This should not be required since all previously static data members are
140670 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
140671 :
140672 194 : }
140673 :
140674 : void
140675 0 : SgVarArgStartOneOperandOp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
140676 : {
140677 : // This function visits only a single IR node of the memory pool.
140678 : // it is typically called once for each type of IR node within
140679 : // the automatically generated function: traverseRepresentativeNodes().
140680 :
140681 : // Initialize array to the address of the first element of the STL vector
140682 : // (which is guarenteed to be contiguous storage).
140683 : // SgVarArgStartOneOperandOp objectArray [] = *(Memory_Block_List.begin());
140684 0 : if (SgVarArgStartOneOperandOp::pools.empty() == false)
140685 : {
140686 : // Generate an array of memory pools
140687 0 : SgVarArgStartOneOperandOp** objectArray = (SgVarArgStartOneOperandOp**) &(SgVarArgStartOneOperandOp::pools[0]);
140688 :
140689 : // Build a local variable for better performance
140690 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
140691 :
140692 : // Iterate over the memory pools
140693 0 : bool done = false;
140694 0 : unsigned i=0;
140695 :
140696 : // find the first valid IR node, call visit function, and then leave
140697 0 : while ( done == false && i < SgVarArgStartOneOperandOp::pools.size() )
140698 : {
140699 : // objectArray[i] is a single memory pool
140700 : unsigned j=0;
140701 0 : while (done == false && j < SgVarArgStartOneOperandOp::pool_size)
140702 : {
140703 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
140704 : {
140705 0 : traversal.visit(&(objectArray[i][j]));
140706 0 : done = true;
140707 : }
140708 0 : j++;
140709 : }
140710 0 : i++;
140711 : }
140712 :
140713 : #if 0
140714 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
140715 : if (done == false)
140716 : {
140717 : printf ("No representative for SgVarArgStartOneOperandOp found in memory pools \n");
140718 : }
140719 : #endif
140720 : }
140721 0 : }
140722 :
140723 :
140724 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
140725 : // using values that overflow signed values of int.
140726 : size_t
140727 4 : SgVarArgStartOneOperandOp::numberOfNodes()
140728 : {
140729 : // This function traverses the memory pool for an IR node and
140730 : // counts the number of IR nodes of a particular Sage III IR
140731 : // nodes type.
140732 :
140733 4 : size_t count = 0;
140734 4 : if (SgVarArgStartOneOperandOp::pools.empty() == false)
140735 : {
140736 : // Generate an array of memory pools (this is actually a STL vector,
140737 : // but it is contiguious, so OK to treat this way).
140738 0 : SgVarArgStartOneOperandOp** objectArray = (SgVarArgStartOneOperandOp**) &(SgVarArgStartOneOperandOp::pools[0]);
140739 :
140740 : // Build a local variable for better performance (make it a loop invariant variable).
140741 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
140742 :
140743 : // Iterate over all of the memory pools for this IR node.
140744 0 : for (unsigned int i=0; i < SgVarArgStartOneOperandOp::pools.size(); i++)
140745 : {
140746 : // objectArray[i] is a single memory pool, iterate over all the
140747 : // IR nodes and only count those that are valid IR nodes used in
140748 : // the AST (i.e. allocated IR nodes).
140749 0 : for (unsigned j=0; j < SgVarArgStartOneOperandOp::pool_size; j++)
140750 : {
140751 : // This is indexing the STL vector of C/C++ style arrays as a doubly
140752 : // indexed array access. It is OK since we have leveraged the semantics
140753 : // of STL vector memory as contigous and cast the memory as an array
140754 : // of arrays to use the 2D array indexing. Hope this is not confusing,
140755 : // but it s very fast as an implementation.
140756 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
140757 : {
140758 0 : count++;
140759 : }
140760 : }
140761 : }
140762 : }
140763 :
140764 :
140765 :
140766 4 : return count;
140767 : }
140768 :
140769 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
140770 : // using values that overflow signed values of int.
140771 : size_t
140772 0 : SgVarArgStartOneOperandOp::memoryUsage()
140773 : {
140774 : // This function is required because we need the class name as a type when we call sizeof
140775 : // There might be another way to implement this if we have a traversal that only called a
140776 : // representative object (one call for each type of Sage IIIIR node).
140777 0 : size_t memory = numberOfNodes() * sizeof(SgVarArgStartOneOperandOp);
140778 :
140779 0 : return memory;
140780 : }
140781 :
140782 : /* #line 140783 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
140783 :
140784 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
140785 : void
140786 5342 : SgNullExpression::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
140787 : {
140788 : // This function traverses the memory pool for only a specific IR node
140789 : // and calls the visit function of the input class execute a traversal
140790 : // similar to the style of the attribute based traversals within ROSE.
140791 : // This traversal will visit ALL nodes of the AST where as the other
140792 : // attribute based traversals visit only the embedded tree within the AST.
140793 :
140794 : // Initialize array to the address of the first element of the STL vector
140795 : // (which is guaranteed to be contiguous storage).
140796 : // SgNullExpression objectArray [] = *(Memory_Block_List.begin());
140797 5342 : if (SgNullExpression::pools.empty() == false)
140798 : {
140799 : // Generate an array of memory pools
140800 3439 : SgNullExpression** objectArray = (SgNullExpression**) &(SgNullExpression::pools[0]);
140801 :
140802 : // Build a local variable for better performance
140803 3439 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
140804 : #if 0
140805 : // Iterate over the memory pools
140806 : for (unsigned int i=0; i < SgNullExpression::pools.size(); i++)
140807 : {
140808 : // objectArray[i] is a single memory pool
140809 : for (int j=0; j < SgNullExpression::pool_size; j++)
140810 : {
140811 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
140812 : {
140813 : traversal.visit(&(objectArray[i][j]));
140814 : }
140815 : }
140816 : }
140817 : #else
140818 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
140819 : // compute the list first and then call the visit function on each list element.
140820 :
140821 : // printf ("Inside of SgNullExpression::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
140822 :
140823 6878 : std::vector<SgNullExpression*> nodeList;
140824 :
140825 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
140826 6878 : for (unsigned int i=0; i < SgNullExpression::pools.size(); i++)
140827 : {
140828 : // objectArray[i] is a single memory pool
140829 6881440 : for (unsigned j=0; j < SgNullExpression::pool_size; j++)
140830 : {
140831 6878000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
140832 : {
140833 24073 : nodeList.push_back(&(objectArray[i][j]));
140834 : }
140835 : }
140836 : }
140837 :
140838 : // Iterate over the saved list
140839 3439 : size_t nodeListSize = nodeList.size();
140840 27512 : for (size_t i=0; i < nodeListSize; i++)
140841 : {
140842 24073 : ROSE_ASSERT(nodeList[i] != NULL);
140843 : #if 0
140844 : traversal.visit(nodeList[i]);
140845 : #else
140846 24073 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
140847 : {
140848 24073 : traversal.visit(nodeList[i]);
140849 : }
140850 : #endif
140851 : }
140852 : #endif
140853 : }
140854 :
140855 : // This should not be required since all previously static data members are
140856 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
140857 :
140858 5342 : }
140859 :
140860 :
140861 : void
140862 194 : SgNullExpression::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
140863 : {
140864 : // This function traverses the memory pool for an IR node and
140865 : // calls the function to execute the visitor object.
140866 :
140867 : // Initialize array to the address of the first element of the STL vector
140868 : // (which is guarenteed to be contiguous storage).
140869 : // SgNullExpression objectArray [] = *(Memory_Block_List.begin());
140870 194 : if (SgNullExpression::pools.empty() == false)
140871 : {
140872 : // Generate an array of memory pools
140873 137 : SgNullExpression** objectArray = (SgNullExpression**) &(SgNullExpression::pools[0]);
140874 :
140875 : // Build a local variable for better performance
140876 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
140877 :
140878 : // Iterate over the memory pools
140879 274 : for (unsigned int i=0; i < SgNullExpression::pools.size(); i++)
140880 : {
140881 : // objectArray[i] is a single memory pool
140882 274137 : for (unsigned j=0; j < SgNullExpression::pool_size; j++)
140883 : {
140884 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
140885 : {
140886 : // printf ("Found a valid SgNullExpression object in the memory pool %d at position %d \n",i,j);
140887 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
140888 17374 : objectArray[i][j].executeVisitorMemberFunction(visitor);
140889 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
140890 : }
140891 : else
140892 : {
140893 : // printf ("Found a INVALID SgNullExpression object in the memory pool \n");
140894 : }
140895 : }
140896 : }
140897 : }
140898 :
140899 : // This should not be required since all previously static data members are
140900 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
140901 :
140902 194 : }
140903 :
140904 : void
140905 0 : SgNullExpression::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
140906 : {
140907 : // This function visits only a single IR node of the memory pool.
140908 : // it is typically called once for each type of IR node within
140909 : // the automatically generated function: traverseRepresentativeNodes().
140910 :
140911 : // Initialize array to the address of the first element of the STL vector
140912 : // (which is guarenteed to be contiguous storage).
140913 : // SgNullExpression objectArray [] = *(Memory_Block_List.begin());
140914 0 : if (SgNullExpression::pools.empty() == false)
140915 : {
140916 : // Generate an array of memory pools
140917 0 : SgNullExpression** objectArray = (SgNullExpression**) &(SgNullExpression::pools[0]);
140918 :
140919 : // Build a local variable for better performance
140920 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
140921 :
140922 : // Iterate over the memory pools
140923 0 : bool done = false;
140924 0 : unsigned i=0;
140925 :
140926 : // find the first valid IR node, call visit function, and then leave
140927 0 : while ( done == false && i < SgNullExpression::pools.size() )
140928 : {
140929 : // objectArray[i] is a single memory pool
140930 : unsigned j=0;
140931 0 : while (done == false && j < SgNullExpression::pool_size)
140932 : {
140933 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
140934 : {
140935 0 : traversal.visit(&(objectArray[i][j]));
140936 0 : done = true;
140937 : }
140938 0 : j++;
140939 : }
140940 0 : i++;
140941 : }
140942 :
140943 : #if 0
140944 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
140945 : if (done == false)
140946 : {
140947 : printf ("No representative for SgNullExpression found in memory pools \n");
140948 : }
140949 : #endif
140950 : }
140951 0 : }
140952 :
140953 :
140954 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
140955 : // using values that overflow signed values of int.
140956 : size_t
140957 4 : SgNullExpression::numberOfNodes()
140958 : {
140959 : // This function traverses the memory pool for an IR node and
140960 : // counts the number of IR nodes of a particular Sage III IR
140961 : // nodes type.
140962 :
140963 4 : size_t count = 0;
140964 4 : if (SgNullExpression::pools.empty() == false)
140965 : {
140966 : // Generate an array of memory pools (this is actually a STL vector,
140967 : // but it is contiguious, so OK to treat this way).
140968 2 : SgNullExpression** objectArray = (SgNullExpression**) &(SgNullExpression::pools[0]);
140969 :
140970 : // Build a local variable for better performance (make it a loop invariant variable).
140971 2 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
140972 :
140973 : // Iterate over all of the memory pools for this IR node.
140974 4 : for (unsigned int i=0; i < SgNullExpression::pools.size(); i++)
140975 : {
140976 : // objectArray[i] is a single memory pool, iterate over all the
140977 : // IR nodes and only count those that are valid IR nodes used in
140978 : // the AST (i.e. allocated IR nodes).
140979 4002 : for (unsigned j=0; j < SgNullExpression::pool_size; j++)
140980 : {
140981 : // This is indexing the STL vector of C/C++ style arrays as a doubly
140982 : // indexed array access. It is OK since we have leveraged the semantics
140983 : // of STL vector memory as contigous and cast the memory as an array
140984 : // of arrays to use the 2D array indexing. Hope this is not confusing,
140985 : // but it s very fast as an implementation.
140986 4000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
140987 : {
140988 121 : count++;
140989 : }
140990 : }
140991 : }
140992 : }
140993 :
140994 :
140995 :
140996 4 : return count;
140997 : }
140998 :
140999 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
141000 : // using values that overflow signed values of int.
141001 : size_t
141002 0 : SgNullExpression::memoryUsage()
141003 : {
141004 : // This function is required because we need the class name as a type when we call sizeof
141005 : // There might be another way to implement this if we have a traversal that only called a
141006 : // representative object (one call for each type of Sage IIIIR node).
141007 0 : size_t memory = numberOfNodes() * sizeof(SgNullExpression);
141008 :
141009 0 : return memory;
141010 : }
141011 :
141012 : /* #line 141013 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
141013 :
141014 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
141015 : void
141016 5342 : SgVariantExpression::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
141017 : {
141018 : // This function traverses the memory pool for only a specific IR node
141019 : // and calls the visit function of the input class execute a traversal
141020 : // similar to the style of the attribute based traversals within ROSE.
141021 : // This traversal will visit ALL nodes of the AST where as the other
141022 : // attribute based traversals visit only the embedded tree within the AST.
141023 :
141024 : // Initialize array to the address of the first element of the STL vector
141025 : // (which is guaranteed to be contiguous storage).
141026 : // SgVariantExpression objectArray [] = *(Memory_Block_List.begin());
141027 5342 : if (SgVariantExpression::pools.empty() == false)
141028 : {
141029 : // Generate an array of memory pools
141030 7 : SgVariantExpression** objectArray = (SgVariantExpression**) &(SgVariantExpression::pools[0]);
141031 :
141032 : // Build a local variable for better performance
141033 7 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
141034 : #if 0
141035 : // Iterate over the memory pools
141036 : for (unsigned int i=0; i < SgVariantExpression::pools.size(); i++)
141037 : {
141038 : // objectArray[i] is a single memory pool
141039 : for (int j=0; j < SgVariantExpression::pool_size; j++)
141040 : {
141041 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
141042 : {
141043 : traversal.visit(&(objectArray[i][j]));
141044 : }
141045 : }
141046 : }
141047 : #else
141048 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
141049 : // compute the list first and then call the visit function on each list element.
141050 :
141051 : // printf ("Inside of SgVariantExpression::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
141052 :
141053 14 : std::vector<SgVariantExpression*> nodeList;
141054 :
141055 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
141056 14 : for (unsigned int i=0; i < SgVariantExpression::pools.size(); i++)
141057 : {
141058 : // objectArray[i] is a single memory pool
141059 14007 : for (unsigned j=0; j < SgVariantExpression::pool_size; j++)
141060 : {
141061 14000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
141062 : {
141063 0 : nodeList.push_back(&(objectArray[i][j]));
141064 : }
141065 : }
141066 : }
141067 :
141068 : // Iterate over the saved list
141069 7 : size_t nodeListSize = nodeList.size();
141070 7 : for (size_t i=0; i < nodeListSize; i++)
141071 : {
141072 0 : ROSE_ASSERT(nodeList[i] != NULL);
141073 : #if 0
141074 : traversal.visit(nodeList[i]);
141075 : #else
141076 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
141077 : {
141078 0 : traversal.visit(nodeList[i]);
141079 : }
141080 : #endif
141081 : }
141082 : #endif
141083 : }
141084 :
141085 : // This should not be required since all previously static data members are
141086 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
141087 :
141088 5342 : }
141089 :
141090 :
141091 : void
141092 194 : SgVariantExpression::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
141093 : {
141094 : // This function traverses the memory pool for an IR node and
141095 : // calls the function to execute the visitor object.
141096 :
141097 : // Initialize array to the address of the first element of the STL vector
141098 : // (which is guarenteed to be contiguous storage).
141099 : // SgVariantExpression objectArray [] = *(Memory_Block_List.begin());
141100 194 : if (SgVariantExpression::pools.empty() == false)
141101 : {
141102 : // Generate an array of memory pools
141103 2 : SgVariantExpression** objectArray = (SgVariantExpression**) &(SgVariantExpression::pools[0]);
141104 :
141105 : // Build a local variable for better performance
141106 2 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
141107 :
141108 : // Iterate over the memory pools
141109 4 : for (unsigned int i=0; i < SgVariantExpression::pools.size(); i++)
141110 : {
141111 : // objectArray[i] is a single memory pool
141112 4002 : for (unsigned j=0; j < SgVariantExpression::pool_size; j++)
141113 : {
141114 4000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
141115 : {
141116 : // printf ("Found a valid SgVariantExpression object in the memory pool %d at position %d \n",i,j);
141117 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
141118 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
141119 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
141120 : }
141121 : else
141122 : {
141123 : // printf ("Found a INVALID SgVariantExpression object in the memory pool \n");
141124 : }
141125 : }
141126 : }
141127 : }
141128 :
141129 : // This should not be required since all previously static data members are
141130 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
141131 :
141132 194 : }
141133 :
141134 : void
141135 0 : SgVariantExpression::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
141136 : {
141137 : // This function visits only a single IR node of the memory pool.
141138 : // it is typically called once for each type of IR node within
141139 : // the automatically generated function: traverseRepresentativeNodes().
141140 :
141141 : // Initialize array to the address of the first element of the STL vector
141142 : // (which is guarenteed to be contiguous storage).
141143 : // SgVariantExpression objectArray [] = *(Memory_Block_List.begin());
141144 0 : if (SgVariantExpression::pools.empty() == false)
141145 : {
141146 : // Generate an array of memory pools
141147 0 : SgVariantExpression** objectArray = (SgVariantExpression**) &(SgVariantExpression::pools[0]);
141148 :
141149 : // Build a local variable for better performance
141150 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
141151 :
141152 : // Iterate over the memory pools
141153 0 : bool done = false;
141154 0 : unsigned i=0;
141155 :
141156 : // find the first valid IR node, call visit function, and then leave
141157 0 : while ( done == false && i < SgVariantExpression::pools.size() )
141158 : {
141159 : // objectArray[i] is a single memory pool
141160 : unsigned j=0;
141161 0 : while (done == false && j < SgVariantExpression::pool_size)
141162 : {
141163 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
141164 : {
141165 0 : traversal.visit(&(objectArray[i][j]));
141166 0 : done = true;
141167 : }
141168 0 : j++;
141169 : }
141170 0 : i++;
141171 : }
141172 :
141173 : #if 0
141174 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
141175 : if (done == false)
141176 : {
141177 : printf ("No representative for SgVariantExpression found in memory pools \n");
141178 : }
141179 : #endif
141180 : }
141181 0 : }
141182 :
141183 :
141184 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
141185 : // using values that overflow signed values of int.
141186 : size_t
141187 4 : SgVariantExpression::numberOfNodes()
141188 : {
141189 : // This function traverses the memory pool for an IR node and
141190 : // counts the number of IR nodes of a particular Sage III IR
141191 : // nodes type.
141192 :
141193 4 : size_t count = 0;
141194 4 : if (SgVariantExpression::pools.empty() == false)
141195 : {
141196 : // Generate an array of memory pools (this is actually a STL vector,
141197 : // but it is contiguious, so OK to treat this way).
141198 0 : SgVariantExpression** objectArray = (SgVariantExpression**) &(SgVariantExpression::pools[0]);
141199 :
141200 : // Build a local variable for better performance (make it a loop invariant variable).
141201 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
141202 :
141203 : // Iterate over all of the memory pools for this IR node.
141204 0 : for (unsigned int i=0; i < SgVariantExpression::pools.size(); i++)
141205 : {
141206 : // objectArray[i] is a single memory pool, iterate over all the
141207 : // IR nodes and only count those that are valid IR nodes used in
141208 : // the AST (i.e. allocated IR nodes).
141209 0 : for (unsigned j=0; j < SgVariantExpression::pool_size; j++)
141210 : {
141211 : // This is indexing the STL vector of C/C++ style arrays as a doubly
141212 : // indexed array access. It is OK since we have leveraged the semantics
141213 : // of STL vector memory as contigous and cast the memory as an array
141214 : // of arrays to use the 2D array indexing. Hope this is not confusing,
141215 : // but it s very fast as an implementation.
141216 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
141217 : {
141218 0 : count++;
141219 : }
141220 : }
141221 : }
141222 : }
141223 :
141224 :
141225 :
141226 4 : return count;
141227 : }
141228 :
141229 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
141230 : // using values that overflow signed values of int.
141231 : size_t
141232 0 : SgVariantExpression::memoryUsage()
141233 : {
141234 : // This function is required because we need the class name as a type when we call sizeof
141235 : // There might be another way to implement this if we have a traversal that only called a
141236 : // representative object (one call for each type of Sage IIIIR node).
141237 0 : size_t memory = numberOfNodes() * sizeof(SgVariantExpression);
141238 :
141239 0 : return memory;
141240 : }
141241 :
141242 : /* #line 141243 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
141243 :
141244 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
141245 : void
141246 5342 : SgSubscriptExpression::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
141247 : {
141248 : // This function traverses the memory pool for only a specific IR node
141249 : // and calls the visit function of the input class execute a traversal
141250 : // similar to the style of the attribute based traversals within ROSE.
141251 : // This traversal will visit ALL nodes of the AST where as the other
141252 : // attribute based traversals visit only the embedded tree within the AST.
141253 :
141254 : // Initialize array to the address of the first element of the STL vector
141255 : // (which is guaranteed to be contiguous storage).
141256 : // SgSubscriptExpression objectArray [] = *(Memory_Block_List.begin());
141257 5342 : if (SgSubscriptExpression::pools.empty() == false)
141258 : {
141259 : // Generate an array of memory pools
141260 0 : SgSubscriptExpression** objectArray = (SgSubscriptExpression**) &(SgSubscriptExpression::pools[0]);
141261 :
141262 : // Build a local variable for better performance
141263 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
141264 : #if 0
141265 : // Iterate over the memory pools
141266 : for (unsigned int i=0; i < SgSubscriptExpression::pools.size(); i++)
141267 : {
141268 : // objectArray[i] is a single memory pool
141269 : for (int j=0; j < SgSubscriptExpression::pool_size; j++)
141270 : {
141271 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
141272 : {
141273 : traversal.visit(&(objectArray[i][j]));
141274 : }
141275 : }
141276 : }
141277 : #else
141278 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
141279 : // compute the list first and then call the visit function on each list element.
141280 :
141281 : // printf ("Inside of SgSubscriptExpression::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
141282 :
141283 0 : std::vector<SgSubscriptExpression*> nodeList;
141284 :
141285 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
141286 0 : for (unsigned int i=0; i < SgSubscriptExpression::pools.size(); i++)
141287 : {
141288 : // objectArray[i] is a single memory pool
141289 0 : for (unsigned j=0; j < SgSubscriptExpression::pool_size; j++)
141290 : {
141291 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
141292 : {
141293 0 : nodeList.push_back(&(objectArray[i][j]));
141294 : }
141295 : }
141296 : }
141297 :
141298 : // Iterate over the saved list
141299 0 : size_t nodeListSize = nodeList.size();
141300 0 : for (size_t i=0; i < nodeListSize; i++)
141301 : {
141302 0 : ROSE_ASSERT(nodeList[i] != NULL);
141303 : #if 0
141304 : traversal.visit(nodeList[i]);
141305 : #else
141306 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
141307 : {
141308 0 : traversal.visit(nodeList[i]);
141309 : }
141310 : #endif
141311 : }
141312 : #endif
141313 : }
141314 :
141315 : // This should not be required since all previously static data members are
141316 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
141317 :
141318 5342 : }
141319 :
141320 :
141321 : void
141322 194 : SgSubscriptExpression::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
141323 : {
141324 : // This function traverses the memory pool for an IR node and
141325 : // calls the function to execute the visitor object.
141326 :
141327 : // Initialize array to the address of the first element of the STL vector
141328 : // (which is guarenteed to be contiguous storage).
141329 : // SgSubscriptExpression objectArray [] = *(Memory_Block_List.begin());
141330 194 : if (SgSubscriptExpression::pools.empty() == false)
141331 : {
141332 : // Generate an array of memory pools
141333 0 : SgSubscriptExpression** objectArray = (SgSubscriptExpression**) &(SgSubscriptExpression::pools[0]);
141334 :
141335 : // Build a local variable for better performance
141336 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
141337 :
141338 : // Iterate over the memory pools
141339 0 : for (unsigned int i=0; i < SgSubscriptExpression::pools.size(); i++)
141340 : {
141341 : // objectArray[i] is a single memory pool
141342 0 : for (unsigned j=0; j < SgSubscriptExpression::pool_size; j++)
141343 : {
141344 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
141345 : {
141346 : // printf ("Found a valid SgSubscriptExpression object in the memory pool %d at position %d \n",i,j);
141347 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
141348 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
141349 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
141350 : }
141351 : else
141352 : {
141353 : // printf ("Found a INVALID SgSubscriptExpression object in the memory pool \n");
141354 : }
141355 : }
141356 : }
141357 : }
141358 :
141359 : // This should not be required since all previously static data members are
141360 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
141361 :
141362 194 : }
141363 :
141364 : void
141365 0 : SgSubscriptExpression::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
141366 : {
141367 : // This function visits only a single IR node of the memory pool.
141368 : // it is typically called once for each type of IR node within
141369 : // the automatically generated function: traverseRepresentativeNodes().
141370 :
141371 : // Initialize array to the address of the first element of the STL vector
141372 : // (which is guarenteed to be contiguous storage).
141373 : // SgSubscriptExpression objectArray [] = *(Memory_Block_List.begin());
141374 0 : if (SgSubscriptExpression::pools.empty() == false)
141375 : {
141376 : // Generate an array of memory pools
141377 0 : SgSubscriptExpression** objectArray = (SgSubscriptExpression**) &(SgSubscriptExpression::pools[0]);
141378 :
141379 : // Build a local variable for better performance
141380 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
141381 :
141382 : // Iterate over the memory pools
141383 0 : bool done = false;
141384 0 : unsigned i=0;
141385 :
141386 : // find the first valid IR node, call visit function, and then leave
141387 0 : while ( done == false && i < SgSubscriptExpression::pools.size() )
141388 : {
141389 : // objectArray[i] is a single memory pool
141390 : unsigned j=0;
141391 0 : while (done == false && j < SgSubscriptExpression::pool_size)
141392 : {
141393 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
141394 : {
141395 0 : traversal.visit(&(objectArray[i][j]));
141396 0 : done = true;
141397 : }
141398 0 : j++;
141399 : }
141400 0 : i++;
141401 : }
141402 :
141403 : #if 0
141404 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
141405 : if (done == false)
141406 : {
141407 : printf ("No representative for SgSubscriptExpression found in memory pools \n");
141408 : }
141409 : #endif
141410 : }
141411 0 : }
141412 :
141413 :
141414 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
141415 : // using values that overflow signed values of int.
141416 : size_t
141417 4 : SgSubscriptExpression::numberOfNodes()
141418 : {
141419 : // This function traverses the memory pool for an IR node and
141420 : // counts the number of IR nodes of a particular Sage III IR
141421 : // nodes type.
141422 :
141423 4 : size_t count = 0;
141424 4 : if (SgSubscriptExpression::pools.empty() == false)
141425 : {
141426 : // Generate an array of memory pools (this is actually a STL vector,
141427 : // but it is contiguious, so OK to treat this way).
141428 0 : SgSubscriptExpression** objectArray = (SgSubscriptExpression**) &(SgSubscriptExpression::pools[0]);
141429 :
141430 : // Build a local variable for better performance (make it a loop invariant variable).
141431 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
141432 :
141433 : // Iterate over all of the memory pools for this IR node.
141434 0 : for (unsigned int i=0; i < SgSubscriptExpression::pools.size(); i++)
141435 : {
141436 : // objectArray[i] is a single memory pool, iterate over all the
141437 : // IR nodes and only count those that are valid IR nodes used in
141438 : // the AST (i.e. allocated IR nodes).
141439 0 : for (unsigned j=0; j < SgSubscriptExpression::pool_size; j++)
141440 : {
141441 : // This is indexing the STL vector of C/C++ style arrays as a doubly
141442 : // indexed array access. It is OK since we have leveraged the semantics
141443 : // of STL vector memory as contigous and cast the memory as an array
141444 : // of arrays to use the 2D array indexing. Hope this is not confusing,
141445 : // but it s very fast as an implementation.
141446 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
141447 : {
141448 0 : count++;
141449 : }
141450 : }
141451 : }
141452 : }
141453 :
141454 :
141455 :
141456 4 : return count;
141457 : }
141458 :
141459 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
141460 : // using values that overflow signed values of int.
141461 : size_t
141462 0 : SgSubscriptExpression::memoryUsage()
141463 : {
141464 : // This function is required because we need the class name as a type when we call sizeof
141465 : // There might be another way to implement this if we have a traversal that only called a
141466 : // representative object (one call for each type of Sage IIIIR node).
141467 0 : size_t memory = numberOfNodes() * sizeof(SgSubscriptExpression);
141468 :
141469 0 : return memory;
141470 : }
141471 :
141472 : /* #line 141473 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
141473 :
141474 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
141475 : void
141476 5342 : SgColonShapeExp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
141477 : {
141478 : // This function traverses the memory pool for only a specific IR node
141479 : // and calls the visit function of the input class execute a traversal
141480 : // similar to the style of the attribute based traversals within ROSE.
141481 : // This traversal will visit ALL nodes of the AST where as the other
141482 : // attribute based traversals visit only the embedded tree within the AST.
141483 :
141484 : // Initialize array to the address of the first element of the STL vector
141485 : // (which is guaranteed to be contiguous storage).
141486 : // SgColonShapeExp objectArray [] = *(Memory_Block_List.begin());
141487 5342 : if (SgColonShapeExp::pools.empty() == false)
141488 : {
141489 : // Generate an array of memory pools
141490 0 : SgColonShapeExp** objectArray = (SgColonShapeExp**) &(SgColonShapeExp::pools[0]);
141491 :
141492 : // Build a local variable for better performance
141493 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
141494 : #if 0
141495 : // Iterate over the memory pools
141496 : for (unsigned int i=0; i < SgColonShapeExp::pools.size(); i++)
141497 : {
141498 : // objectArray[i] is a single memory pool
141499 : for (int j=0; j < SgColonShapeExp::pool_size; j++)
141500 : {
141501 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
141502 : {
141503 : traversal.visit(&(objectArray[i][j]));
141504 : }
141505 : }
141506 : }
141507 : #else
141508 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
141509 : // compute the list first and then call the visit function on each list element.
141510 :
141511 : // printf ("Inside of SgColonShapeExp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
141512 :
141513 0 : std::vector<SgColonShapeExp*> nodeList;
141514 :
141515 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
141516 0 : for (unsigned int i=0; i < SgColonShapeExp::pools.size(); i++)
141517 : {
141518 : // objectArray[i] is a single memory pool
141519 0 : for (unsigned j=0; j < SgColonShapeExp::pool_size; j++)
141520 : {
141521 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
141522 : {
141523 0 : nodeList.push_back(&(objectArray[i][j]));
141524 : }
141525 : }
141526 : }
141527 :
141528 : // Iterate over the saved list
141529 0 : size_t nodeListSize = nodeList.size();
141530 0 : for (size_t i=0; i < nodeListSize; i++)
141531 : {
141532 0 : ROSE_ASSERT(nodeList[i] != NULL);
141533 : #if 0
141534 : traversal.visit(nodeList[i]);
141535 : #else
141536 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
141537 : {
141538 0 : traversal.visit(nodeList[i]);
141539 : }
141540 : #endif
141541 : }
141542 : #endif
141543 : }
141544 :
141545 : // This should not be required since all previously static data members are
141546 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
141547 :
141548 5342 : }
141549 :
141550 :
141551 : void
141552 194 : SgColonShapeExp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
141553 : {
141554 : // This function traverses the memory pool for an IR node and
141555 : // calls the function to execute the visitor object.
141556 :
141557 : // Initialize array to the address of the first element of the STL vector
141558 : // (which is guarenteed to be contiguous storage).
141559 : // SgColonShapeExp objectArray [] = *(Memory_Block_List.begin());
141560 194 : if (SgColonShapeExp::pools.empty() == false)
141561 : {
141562 : // Generate an array of memory pools
141563 0 : SgColonShapeExp** objectArray = (SgColonShapeExp**) &(SgColonShapeExp::pools[0]);
141564 :
141565 : // Build a local variable for better performance
141566 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
141567 :
141568 : // Iterate over the memory pools
141569 0 : for (unsigned int i=0; i < SgColonShapeExp::pools.size(); i++)
141570 : {
141571 : // objectArray[i] is a single memory pool
141572 0 : for (unsigned j=0; j < SgColonShapeExp::pool_size; j++)
141573 : {
141574 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
141575 : {
141576 : // printf ("Found a valid SgColonShapeExp object in the memory pool %d at position %d \n",i,j);
141577 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
141578 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
141579 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
141580 : }
141581 : else
141582 : {
141583 : // printf ("Found a INVALID SgColonShapeExp object in the memory pool \n");
141584 : }
141585 : }
141586 : }
141587 : }
141588 :
141589 : // This should not be required since all previously static data members are
141590 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
141591 :
141592 194 : }
141593 :
141594 : void
141595 0 : SgColonShapeExp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
141596 : {
141597 : // This function visits only a single IR node of the memory pool.
141598 : // it is typically called once for each type of IR node within
141599 : // the automatically generated function: traverseRepresentativeNodes().
141600 :
141601 : // Initialize array to the address of the first element of the STL vector
141602 : // (which is guarenteed to be contiguous storage).
141603 : // SgColonShapeExp objectArray [] = *(Memory_Block_List.begin());
141604 0 : if (SgColonShapeExp::pools.empty() == false)
141605 : {
141606 : // Generate an array of memory pools
141607 0 : SgColonShapeExp** objectArray = (SgColonShapeExp**) &(SgColonShapeExp::pools[0]);
141608 :
141609 : // Build a local variable for better performance
141610 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
141611 :
141612 : // Iterate over the memory pools
141613 0 : bool done = false;
141614 0 : unsigned i=0;
141615 :
141616 : // find the first valid IR node, call visit function, and then leave
141617 0 : while ( done == false && i < SgColonShapeExp::pools.size() )
141618 : {
141619 : // objectArray[i] is a single memory pool
141620 : unsigned j=0;
141621 0 : while (done == false && j < SgColonShapeExp::pool_size)
141622 : {
141623 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
141624 : {
141625 0 : traversal.visit(&(objectArray[i][j]));
141626 0 : done = true;
141627 : }
141628 0 : j++;
141629 : }
141630 0 : i++;
141631 : }
141632 :
141633 : #if 0
141634 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
141635 : if (done == false)
141636 : {
141637 : printf ("No representative for SgColonShapeExp found in memory pools \n");
141638 : }
141639 : #endif
141640 : }
141641 0 : }
141642 :
141643 :
141644 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
141645 : // using values that overflow signed values of int.
141646 : size_t
141647 4 : SgColonShapeExp::numberOfNodes()
141648 : {
141649 : // This function traverses the memory pool for an IR node and
141650 : // counts the number of IR nodes of a particular Sage III IR
141651 : // nodes type.
141652 :
141653 4 : size_t count = 0;
141654 4 : if (SgColonShapeExp::pools.empty() == false)
141655 : {
141656 : // Generate an array of memory pools (this is actually a STL vector,
141657 : // but it is contiguious, so OK to treat this way).
141658 0 : SgColonShapeExp** objectArray = (SgColonShapeExp**) &(SgColonShapeExp::pools[0]);
141659 :
141660 : // Build a local variable for better performance (make it a loop invariant variable).
141661 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
141662 :
141663 : // Iterate over all of the memory pools for this IR node.
141664 0 : for (unsigned int i=0; i < SgColonShapeExp::pools.size(); i++)
141665 : {
141666 : // objectArray[i] is a single memory pool, iterate over all the
141667 : // IR nodes and only count those that are valid IR nodes used in
141668 : // the AST (i.e. allocated IR nodes).
141669 0 : for (unsigned j=0; j < SgColonShapeExp::pool_size; j++)
141670 : {
141671 : // This is indexing the STL vector of C/C++ style arrays as a doubly
141672 : // indexed array access. It is OK since we have leveraged the semantics
141673 : // of STL vector memory as contigous and cast the memory as an array
141674 : // of arrays to use the 2D array indexing. Hope this is not confusing,
141675 : // but it s very fast as an implementation.
141676 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
141677 : {
141678 0 : count++;
141679 : }
141680 : }
141681 : }
141682 : }
141683 :
141684 :
141685 :
141686 4 : return count;
141687 : }
141688 :
141689 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
141690 : // using values that overflow signed values of int.
141691 : size_t
141692 0 : SgColonShapeExp::memoryUsage()
141693 : {
141694 : // This function is required because we need the class name as a type when we call sizeof
141695 : // There might be another way to implement this if we have a traversal that only called a
141696 : // representative object (one call for each type of Sage IIIIR node).
141697 0 : size_t memory = numberOfNodes() * sizeof(SgColonShapeExp);
141698 :
141699 0 : return memory;
141700 : }
141701 :
141702 : /* #line 141703 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
141703 :
141704 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
141705 : void
141706 5342 : SgAsteriskShapeExp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
141707 : {
141708 : // This function traverses the memory pool for only a specific IR node
141709 : // and calls the visit function of the input class execute a traversal
141710 : // similar to the style of the attribute based traversals within ROSE.
141711 : // This traversal will visit ALL nodes of the AST where as the other
141712 : // attribute based traversals visit only the embedded tree within the AST.
141713 :
141714 : // Initialize array to the address of the first element of the STL vector
141715 : // (which is guaranteed to be contiguous storage).
141716 : // SgAsteriskShapeExp objectArray [] = *(Memory_Block_List.begin());
141717 5342 : if (SgAsteriskShapeExp::pools.empty() == false)
141718 : {
141719 : // Generate an array of memory pools
141720 574 : SgAsteriskShapeExp** objectArray = (SgAsteriskShapeExp**) &(SgAsteriskShapeExp::pools[0]);
141721 :
141722 : // Build a local variable for better performance
141723 574 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
141724 : #if 0
141725 : // Iterate over the memory pools
141726 : for (unsigned int i=0; i < SgAsteriskShapeExp::pools.size(); i++)
141727 : {
141728 : // objectArray[i] is a single memory pool
141729 : for (int j=0; j < SgAsteriskShapeExp::pool_size; j++)
141730 : {
141731 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
141732 : {
141733 : traversal.visit(&(objectArray[i][j]));
141734 : }
141735 : }
141736 : }
141737 : #else
141738 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
141739 : // compute the list first and then call the visit function on each list element.
141740 :
141741 : // printf ("Inside of SgAsteriskShapeExp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
141742 :
141743 1148 : std::vector<SgAsteriskShapeExp*> nodeList;
141744 :
141745 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
141746 1148 : for (unsigned int i=0; i < SgAsteriskShapeExp::pools.size(); i++)
141747 : {
141748 : // objectArray[i] is a single memory pool
141749 1148570 : for (unsigned j=0; j < SgAsteriskShapeExp::pool_size; j++)
141750 : {
141751 1148000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
141752 : {
141753 1374 : nodeList.push_back(&(objectArray[i][j]));
141754 : }
141755 : }
141756 : }
141757 :
141758 : // Iterate over the saved list
141759 574 : size_t nodeListSize = nodeList.size();
141760 1948 : for (size_t i=0; i < nodeListSize; i++)
141761 : {
141762 1374 : ROSE_ASSERT(nodeList[i] != NULL);
141763 : #if 0
141764 : traversal.visit(nodeList[i]);
141765 : #else
141766 1374 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
141767 : {
141768 1374 : traversal.visit(nodeList[i]);
141769 : }
141770 : #endif
141771 : }
141772 : #endif
141773 : }
141774 :
141775 : // This should not be required since all previously static data members are
141776 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
141777 :
141778 5342 : }
141779 :
141780 :
141781 : void
141782 194 : SgAsteriskShapeExp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
141783 : {
141784 : // This function traverses the memory pool for an IR node and
141785 : // calls the function to execute the visitor object.
141786 :
141787 : // Initialize array to the address of the first element of the STL vector
141788 : // (which is guarenteed to be contiguous storage).
141789 : // SgAsteriskShapeExp objectArray [] = *(Memory_Block_List.begin());
141790 194 : if (SgAsteriskShapeExp::pools.empty() == false)
141791 : {
141792 : // Generate an array of memory pools
141793 0 : SgAsteriskShapeExp** objectArray = (SgAsteriskShapeExp**) &(SgAsteriskShapeExp::pools[0]);
141794 :
141795 : // Build a local variable for better performance
141796 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
141797 :
141798 : // Iterate over the memory pools
141799 0 : for (unsigned int i=0; i < SgAsteriskShapeExp::pools.size(); i++)
141800 : {
141801 : // objectArray[i] is a single memory pool
141802 0 : for (unsigned j=0; j < SgAsteriskShapeExp::pool_size; j++)
141803 : {
141804 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
141805 : {
141806 : // printf ("Found a valid SgAsteriskShapeExp object in the memory pool %d at position %d \n",i,j);
141807 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
141808 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
141809 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
141810 : }
141811 : else
141812 : {
141813 : // printf ("Found a INVALID SgAsteriskShapeExp object in the memory pool \n");
141814 : }
141815 : }
141816 : }
141817 : }
141818 :
141819 : // This should not be required since all previously static data members are
141820 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
141821 :
141822 194 : }
141823 :
141824 : void
141825 0 : SgAsteriskShapeExp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
141826 : {
141827 : // This function visits only a single IR node of the memory pool.
141828 : // it is typically called once for each type of IR node within
141829 : // the automatically generated function: traverseRepresentativeNodes().
141830 :
141831 : // Initialize array to the address of the first element of the STL vector
141832 : // (which is guarenteed to be contiguous storage).
141833 : // SgAsteriskShapeExp objectArray [] = *(Memory_Block_List.begin());
141834 0 : if (SgAsteriskShapeExp::pools.empty() == false)
141835 : {
141836 : // Generate an array of memory pools
141837 0 : SgAsteriskShapeExp** objectArray = (SgAsteriskShapeExp**) &(SgAsteriskShapeExp::pools[0]);
141838 :
141839 : // Build a local variable for better performance
141840 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
141841 :
141842 : // Iterate over the memory pools
141843 0 : bool done = false;
141844 0 : unsigned i=0;
141845 :
141846 : // find the first valid IR node, call visit function, and then leave
141847 0 : while ( done == false && i < SgAsteriskShapeExp::pools.size() )
141848 : {
141849 : // objectArray[i] is a single memory pool
141850 : unsigned j=0;
141851 0 : while (done == false && j < SgAsteriskShapeExp::pool_size)
141852 : {
141853 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
141854 : {
141855 0 : traversal.visit(&(objectArray[i][j]));
141856 0 : done = true;
141857 : }
141858 0 : j++;
141859 : }
141860 0 : i++;
141861 : }
141862 :
141863 : #if 0
141864 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
141865 : if (done == false)
141866 : {
141867 : printf ("No representative for SgAsteriskShapeExp found in memory pools \n");
141868 : }
141869 : #endif
141870 : }
141871 0 : }
141872 :
141873 :
141874 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
141875 : // using values that overflow signed values of int.
141876 : size_t
141877 4 : SgAsteriskShapeExp::numberOfNodes()
141878 : {
141879 : // This function traverses the memory pool for an IR node and
141880 : // counts the number of IR nodes of a particular Sage III IR
141881 : // nodes type.
141882 :
141883 4 : size_t count = 0;
141884 4 : if (SgAsteriskShapeExp::pools.empty() == false)
141885 : {
141886 : // Generate an array of memory pools (this is actually a STL vector,
141887 : // but it is contiguious, so OK to treat this way).
141888 0 : SgAsteriskShapeExp** objectArray = (SgAsteriskShapeExp**) &(SgAsteriskShapeExp::pools[0]);
141889 :
141890 : // Build a local variable for better performance (make it a loop invariant variable).
141891 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
141892 :
141893 : // Iterate over all of the memory pools for this IR node.
141894 0 : for (unsigned int i=0; i < SgAsteriskShapeExp::pools.size(); i++)
141895 : {
141896 : // objectArray[i] is a single memory pool, iterate over all the
141897 : // IR nodes and only count those that are valid IR nodes used in
141898 : // the AST (i.e. allocated IR nodes).
141899 0 : for (unsigned j=0; j < SgAsteriskShapeExp::pool_size; j++)
141900 : {
141901 : // This is indexing the STL vector of C/C++ style arrays as a doubly
141902 : // indexed array access. It is OK since we have leveraged the semantics
141903 : // of STL vector memory as contigous and cast the memory as an array
141904 : // of arrays to use the 2D array indexing. Hope this is not confusing,
141905 : // but it s very fast as an implementation.
141906 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
141907 : {
141908 0 : count++;
141909 : }
141910 : }
141911 : }
141912 : }
141913 :
141914 :
141915 :
141916 4 : return count;
141917 : }
141918 :
141919 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
141920 : // using values that overflow signed values of int.
141921 : size_t
141922 0 : SgAsteriskShapeExp::memoryUsage()
141923 : {
141924 : // This function is required because we need the class name as a type when we call sizeof
141925 : // There might be another way to implement this if we have a traversal that only called a
141926 : // representative object (one call for each type of Sage IIIIR node).
141927 0 : size_t memory = numberOfNodes() * sizeof(SgAsteriskShapeExp);
141928 :
141929 0 : return memory;
141930 : }
141931 :
141932 : /* #line 141933 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
141933 :
141934 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
141935 : void
141936 5342 : SgImpliedDo::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
141937 : {
141938 : // This function traverses the memory pool for only a specific IR node
141939 : // and calls the visit function of the input class execute a traversal
141940 : // similar to the style of the attribute based traversals within ROSE.
141941 : // This traversal will visit ALL nodes of the AST where as the other
141942 : // attribute based traversals visit only the embedded tree within the AST.
141943 :
141944 : // Initialize array to the address of the first element of the STL vector
141945 : // (which is guaranteed to be contiguous storage).
141946 : // SgImpliedDo objectArray [] = *(Memory_Block_List.begin());
141947 5342 : if (SgImpliedDo::pools.empty() == false)
141948 : {
141949 : // Generate an array of memory pools
141950 0 : SgImpliedDo** objectArray = (SgImpliedDo**) &(SgImpliedDo::pools[0]);
141951 :
141952 : // Build a local variable for better performance
141953 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
141954 : #if 0
141955 : // Iterate over the memory pools
141956 : for (unsigned int i=0; i < SgImpliedDo::pools.size(); i++)
141957 : {
141958 : // objectArray[i] is a single memory pool
141959 : for (int j=0; j < SgImpliedDo::pool_size; j++)
141960 : {
141961 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
141962 : {
141963 : traversal.visit(&(objectArray[i][j]));
141964 : }
141965 : }
141966 : }
141967 : #else
141968 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
141969 : // compute the list first and then call the visit function on each list element.
141970 :
141971 : // printf ("Inside of SgImpliedDo::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
141972 :
141973 0 : std::vector<SgImpliedDo*> nodeList;
141974 :
141975 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
141976 0 : for (unsigned int i=0; i < SgImpliedDo::pools.size(); i++)
141977 : {
141978 : // objectArray[i] is a single memory pool
141979 0 : for (unsigned j=0; j < SgImpliedDo::pool_size; j++)
141980 : {
141981 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
141982 : {
141983 0 : nodeList.push_back(&(objectArray[i][j]));
141984 : }
141985 : }
141986 : }
141987 :
141988 : // Iterate over the saved list
141989 0 : size_t nodeListSize = nodeList.size();
141990 0 : for (size_t i=0; i < nodeListSize; i++)
141991 : {
141992 0 : ROSE_ASSERT(nodeList[i] != NULL);
141993 : #if 0
141994 : traversal.visit(nodeList[i]);
141995 : #else
141996 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
141997 : {
141998 0 : traversal.visit(nodeList[i]);
141999 : }
142000 : #endif
142001 : }
142002 : #endif
142003 : }
142004 :
142005 : // This should not be required since all previously static data members are
142006 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
142007 :
142008 5342 : }
142009 :
142010 :
142011 : void
142012 194 : SgImpliedDo::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
142013 : {
142014 : // This function traverses the memory pool for an IR node and
142015 : // calls the function to execute the visitor object.
142016 :
142017 : // Initialize array to the address of the first element of the STL vector
142018 : // (which is guarenteed to be contiguous storage).
142019 : // SgImpliedDo objectArray [] = *(Memory_Block_List.begin());
142020 194 : if (SgImpliedDo::pools.empty() == false)
142021 : {
142022 : // Generate an array of memory pools
142023 0 : SgImpliedDo** objectArray = (SgImpliedDo**) &(SgImpliedDo::pools[0]);
142024 :
142025 : // Build a local variable for better performance
142026 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
142027 :
142028 : // Iterate over the memory pools
142029 0 : for (unsigned int i=0; i < SgImpliedDo::pools.size(); i++)
142030 : {
142031 : // objectArray[i] is a single memory pool
142032 0 : for (unsigned j=0; j < SgImpliedDo::pool_size; j++)
142033 : {
142034 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
142035 : {
142036 : // printf ("Found a valid SgImpliedDo object in the memory pool %d at position %d \n",i,j);
142037 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
142038 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
142039 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
142040 : }
142041 : else
142042 : {
142043 : // printf ("Found a INVALID SgImpliedDo object in the memory pool \n");
142044 : }
142045 : }
142046 : }
142047 : }
142048 :
142049 : // This should not be required since all previously static data members are
142050 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
142051 :
142052 194 : }
142053 :
142054 : void
142055 0 : SgImpliedDo::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
142056 : {
142057 : // This function visits only a single IR node of the memory pool.
142058 : // it is typically called once for each type of IR node within
142059 : // the automatically generated function: traverseRepresentativeNodes().
142060 :
142061 : // Initialize array to the address of the first element of the STL vector
142062 : // (which is guarenteed to be contiguous storage).
142063 : // SgImpliedDo objectArray [] = *(Memory_Block_List.begin());
142064 0 : if (SgImpliedDo::pools.empty() == false)
142065 : {
142066 : // Generate an array of memory pools
142067 0 : SgImpliedDo** objectArray = (SgImpliedDo**) &(SgImpliedDo::pools[0]);
142068 :
142069 : // Build a local variable for better performance
142070 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
142071 :
142072 : // Iterate over the memory pools
142073 0 : bool done = false;
142074 0 : unsigned i=0;
142075 :
142076 : // find the first valid IR node, call visit function, and then leave
142077 0 : while ( done == false && i < SgImpliedDo::pools.size() )
142078 : {
142079 : // objectArray[i] is a single memory pool
142080 : unsigned j=0;
142081 0 : while (done == false && j < SgImpliedDo::pool_size)
142082 : {
142083 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
142084 : {
142085 0 : traversal.visit(&(objectArray[i][j]));
142086 0 : done = true;
142087 : }
142088 0 : j++;
142089 : }
142090 0 : i++;
142091 : }
142092 :
142093 : #if 0
142094 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
142095 : if (done == false)
142096 : {
142097 : printf ("No representative for SgImpliedDo found in memory pools \n");
142098 : }
142099 : #endif
142100 : }
142101 0 : }
142102 :
142103 :
142104 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
142105 : // using values that overflow signed values of int.
142106 : size_t
142107 4 : SgImpliedDo::numberOfNodes()
142108 : {
142109 : // This function traverses the memory pool for an IR node and
142110 : // counts the number of IR nodes of a particular Sage III IR
142111 : // nodes type.
142112 :
142113 4 : size_t count = 0;
142114 4 : if (SgImpliedDo::pools.empty() == false)
142115 : {
142116 : // Generate an array of memory pools (this is actually a STL vector,
142117 : // but it is contiguious, so OK to treat this way).
142118 0 : SgImpliedDo** objectArray = (SgImpliedDo**) &(SgImpliedDo::pools[0]);
142119 :
142120 : // Build a local variable for better performance (make it a loop invariant variable).
142121 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
142122 :
142123 : // Iterate over all of the memory pools for this IR node.
142124 0 : for (unsigned int i=0; i < SgImpliedDo::pools.size(); i++)
142125 : {
142126 : // objectArray[i] is a single memory pool, iterate over all the
142127 : // IR nodes and only count those that are valid IR nodes used in
142128 : // the AST (i.e. allocated IR nodes).
142129 0 : for (unsigned j=0; j < SgImpliedDo::pool_size; j++)
142130 : {
142131 : // This is indexing the STL vector of C/C++ style arrays as a doubly
142132 : // indexed array access. It is OK since we have leveraged the semantics
142133 : // of STL vector memory as contigous and cast the memory as an array
142134 : // of arrays to use the 2D array indexing. Hope this is not confusing,
142135 : // but it s very fast as an implementation.
142136 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
142137 : {
142138 0 : count++;
142139 : }
142140 : }
142141 : }
142142 : }
142143 :
142144 :
142145 :
142146 4 : return count;
142147 : }
142148 :
142149 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
142150 : // using values that overflow signed values of int.
142151 : size_t
142152 0 : SgImpliedDo::memoryUsage()
142153 : {
142154 : // This function is required because we need the class name as a type when we call sizeof
142155 : // There might be another way to implement this if we have a traversal that only called a
142156 : // representative object (one call for each type of Sage IIIIR node).
142157 0 : size_t memory = numberOfNodes() * sizeof(SgImpliedDo);
142158 :
142159 0 : return memory;
142160 : }
142161 :
142162 : /* #line 142163 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
142163 :
142164 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
142165 : void
142166 5342 : SgIOItemExpression::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
142167 : {
142168 : // This function traverses the memory pool for only a specific IR node
142169 : // and calls the visit function of the input class execute a traversal
142170 : // similar to the style of the attribute based traversals within ROSE.
142171 : // This traversal will visit ALL nodes of the AST where as the other
142172 : // attribute based traversals visit only the embedded tree within the AST.
142173 :
142174 : // Initialize array to the address of the first element of the STL vector
142175 : // (which is guaranteed to be contiguous storage).
142176 : // SgIOItemExpression objectArray [] = *(Memory_Block_List.begin());
142177 5342 : if (SgIOItemExpression::pools.empty() == false)
142178 : {
142179 : // Generate an array of memory pools
142180 0 : SgIOItemExpression** objectArray = (SgIOItemExpression**) &(SgIOItemExpression::pools[0]);
142181 :
142182 : // Build a local variable for better performance
142183 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
142184 : #if 0
142185 : // Iterate over the memory pools
142186 : for (unsigned int i=0; i < SgIOItemExpression::pools.size(); i++)
142187 : {
142188 : // objectArray[i] is a single memory pool
142189 : for (int j=0; j < SgIOItemExpression::pool_size; j++)
142190 : {
142191 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
142192 : {
142193 : traversal.visit(&(objectArray[i][j]));
142194 : }
142195 : }
142196 : }
142197 : #else
142198 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
142199 : // compute the list first and then call the visit function on each list element.
142200 :
142201 : // printf ("Inside of SgIOItemExpression::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
142202 :
142203 0 : std::vector<SgIOItemExpression*> nodeList;
142204 :
142205 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
142206 0 : for (unsigned int i=0; i < SgIOItemExpression::pools.size(); i++)
142207 : {
142208 : // objectArray[i] is a single memory pool
142209 0 : for (unsigned j=0; j < SgIOItemExpression::pool_size; j++)
142210 : {
142211 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
142212 : {
142213 0 : nodeList.push_back(&(objectArray[i][j]));
142214 : }
142215 : }
142216 : }
142217 :
142218 : // Iterate over the saved list
142219 0 : size_t nodeListSize = nodeList.size();
142220 0 : for (size_t i=0; i < nodeListSize; i++)
142221 : {
142222 0 : ROSE_ASSERT(nodeList[i] != NULL);
142223 : #if 0
142224 : traversal.visit(nodeList[i]);
142225 : #else
142226 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
142227 : {
142228 0 : traversal.visit(nodeList[i]);
142229 : }
142230 : #endif
142231 : }
142232 : #endif
142233 : }
142234 :
142235 : // This should not be required since all previously static data members are
142236 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
142237 :
142238 5342 : }
142239 :
142240 :
142241 : void
142242 194 : SgIOItemExpression::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
142243 : {
142244 : // This function traverses the memory pool for an IR node and
142245 : // calls the function to execute the visitor object.
142246 :
142247 : // Initialize array to the address of the first element of the STL vector
142248 : // (which is guarenteed to be contiguous storage).
142249 : // SgIOItemExpression objectArray [] = *(Memory_Block_List.begin());
142250 194 : if (SgIOItemExpression::pools.empty() == false)
142251 : {
142252 : // Generate an array of memory pools
142253 0 : SgIOItemExpression** objectArray = (SgIOItemExpression**) &(SgIOItemExpression::pools[0]);
142254 :
142255 : // Build a local variable for better performance
142256 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
142257 :
142258 : // Iterate over the memory pools
142259 0 : for (unsigned int i=0; i < SgIOItemExpression::pools.size(); i++)
142260 : {
142261 : // objectArray[i] is a single memory pool
142262 0 : for (unsigned j=0; j < SgIOItemExpression::pool_size; j++)
142263 : {
142264 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
142265 : {
142266 : // printf ("Found a valid SgIOItemExpression object in the memory pool %d at position %d \n",i,j);
142267 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
142268 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
142269 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
142270 : }
142271 : else
142272 : {
142273 : // printf ("Found a INVALID SgIOItemExpression object in the memory pool \n");
142274 : }
142275 : }
142276 : }
142277 : }
142278 :
142279 : // This should not be required since all previously static data members are
142280 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
142281 :
142282 194 : }
142283 :
142284 : void
142285 0 : SgIOItemExpression::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
142286 : {
142287 : // This function visits only a single IR node of the memory pool.
142288 : // it is typically called once for each type of IR node within
142289 : // the automatically generated function: traverseRepresentativeNodes().
142290 :
142291 : // Initialize array to the address of the first element of the STL vector
142292 : // (which is guarenteed to be contiguous storage).
142293 : // SgIOItemExpression objectArray [] = *(Memory_Block_List.begin());
142294 0 : if (SgIOItemExpression::pools.empty() == false)
142295 : {
142296 : // Generate an array of memory pools
142297 0 : SgIOItemExpression** objectArray = (SgIOItemExpression**) &(SgIOItemExpression::pools[0]);
142298 :
142299 : // Build a local variable for better performance
142300 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
142301 :
142302 : // Iterate over the memory pools
142303 0 : bool done = false;
142304 0 : unsigned i=0;
142305 :
142306 : // find the first valid IR node, call visit function, and then leave
142307 0 : while ( done == false && i < SgIOItemExpression::pools.size() )
142308 : {
142309 : // objectArray[i] is a single memory pool
142310 : unsigned j=0;
142311 0 : while (done == false && j < SgIOItemExpression::pool_size)
142312 : {
142313 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
142314 : {
142315 0 : traversal.visit(&(objectArray[i][j]));
142316 0 : done = true;
142317 : }
142318 0 : j++;
142319 : }
142320 0 : i++;
142321 : }
142322 :
142323 : #if 0
142324 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
142325 : if (done == false)
142326 : {
142327 : printf ("No representative for SgIOItemExpression found in memory pools \n");
142328 : }
142329 : #endif
142330 : }
142331 0 : }
142332 :
142333 :
142334 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
142335 : // using values that overflow signed values of int.
142336 : size_t
142337 4 : SgIOItemExpression::numberOfNodes()
142338 : {
142339 : // This function traverses the memory pool for an IR node and
142340 : // counts the number of IR nodes of a particular Sage III IR
142341 : // nodes type.
142342 :
142343 4 : size_t count = 0;
142344 4 : if (SgIOItemExpression::pools.empty() == false)
142345 : {
142346 : // Generate an array of memory pools (this is actually a STL vector,
142347 : // but it is contiguious, so OK to treat this way).
142348 0 : SgIOItemExpression** objectArray = (SgIOItemExpression**) &(SgIOItemExpression::pools[0]);
142349 :
142350 : // Build a local variable for better performance (make it a loop invariant variable).
142351 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
142352 :
142353 : // Iterate over all of the memory pools for this IR node.
142354 0 : for (unsigned int i=0; i < SgIOItemExpression::pools.size(); i++)
142355 : {
142356 : // objectArray[i] is a single memory pool, iterate over all the
142357 : // IR nodes and only count those that are valid IR nodes used in
142358 : // the AST (i.e. allocated IR nodes).
142359 0 : for (unsigned j=0; j < SgIOItemExpression::pool_size; j++)
142360 : {
142361 : // This is indexing the STL vector of C/C++ style arrays as a doubly
142362 : // indexed array access. It is OK since we have leveraged the semantics
142363 : // of STL vector memory as contigous and cast the memory as an array
142364 : // of arrays to use the 2D array indexing. Hope this is not confusing,
142365 : // but it s very fast as an implementation.
142366 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
142367 : {
142368 0 : count++;
142369 : }
142370 : }
142371 : }
142372 : }
142373 :
142374 :
142375 :
142376 4 : return count;
142377 : }
142378 :
142379 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
142380 : // using values that overflow signed values of int.
142381 : size_t
142382 0 : SgIOItemExpression::memoryUsage()
142383 : {
142384 : // This function is required because we need the class name as a type when we call sizeof
142385 : // There might be another way to implement this if we have a traversal that only called a
142386 : // representative object (one call for each type of Sage IIIIR node).
142387 0 : size_t memory = numberOfNodes() * sizeof(SgIOItemExpression);
142388 :
142389 0 : return memory;
142390 : }
142391 :
142392 : /* #line 142393 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
142393 :
142394 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
142395 : void
142396 5342 : SgStatementExpression::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
142397 : {
142398 : // This function traverses the memory pool for only a specific IR node
142399 : // and calls the visit function of the input class execute a traversal
142400 : // similar to the style of the attribute based traversals within ROSE.
142401 : // This traversal will visit ALL nodes of the AST where as the other
142402 : // attribute based traversals visit only the embedded tree within the AST.
142403 :
142404 : // Initialize array to the address of the first element of the STL vector
142405 : // (which is guaranteed to be contiguous storage).
142406 : // SgStatementExpression objectArray [] = *(Memory_Block_List.begin());
142407 5342 : if (SgStatementExpression::pools.empty() == false)
142408 : {
142409 : // Generate an array of memory pools
142410 420 : SgStatementExpression** objectArray = (SgStatementExpression**) &(SgStatementExpression::pools[0]);
142411 :
142412 : // Build a local variable for better performance
142413 420 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
142414 : #if 0
142415 : // Iterate over the memory pools
142416 : for (unsigned int i=0; i < SgStatementExpression::pools.size(); i++)
142417 : {
142418 : // objectArray[i] is a single memory pool
142419 : for (int j=0; j < SgStatementExpression::pool_size; j++)
142420 : {
142421 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
142422 : {
142423 : traversal.visit(&(objectArray[i][j]));
142424 : }
142425 : }
142426 : }
142427 : #else
142428 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
142429 : // compute the list first and then call the visit function on each list element.
142430 :
142431 : // printf ("Inside of SgStatementExpression::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
142432 :
142433 840 : std::vector<SgStatementExpression*> nodeList;
142434 :
142435 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
142436 840 : for (unsigned int i=0; i < SgStatementExpression::pools.size(); i++)
142437 : {
142438 : // objectArray[i] is a single memory pool
142439 840420 : for (unsigned j=0; j < SgStatementExpression::pool_size; j++)
142440 : {
142441 840000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
142442 : {
142443 885 : nodeList.push_back(&(objectArray[i][j]));
142444 : }
142445 : }
142446 : }
142447 :
142448 : // Iterate over the saved list
142449 420 : size_t nodeListSize = nodeList.size();
142450 1305 : for (size_t i=0; i < nodeListSize; i++)
142451 : {
142452 885 : ROSE_ASSERT(nodeList[i] != NULL);
142453 : #if 0
142454 : traversal.visit(nodeList[i]);
142455 : #else
142456 885 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
142457 : {
142458 885 : traversal.visit(nodeList[i]);
142459 : }
142460 : #endif
142461 : }
142462 : #endif
142463 : }
142464 :
142465 : // This should not be required since all previously static data members are
142466 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
142467 :
142468 5342 : }
142469 :
142470 :
142471 : void
142472 194 : SgStatementExpression::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
142473 : {
142474 : // This function traverses the memory pool for an IR node and
142475 : // calls the function to execute the visitor object.
142476 :
142477 : // Initialize array to the address of the first element of the STL vector
142478 : // (which is guarenteed to be contiguous storage).
142479 : // SgStatementExpression objectArray [] = *(Memory_Block_List.begin());
142480 194 : if (SgStatementExpression::pools.empty() == false)
142481 : {
142482 : // Generate an array of memory pools
142483 0 : SgStatementExpression** objectArray = (SgStatementExpression**) &(SgStatementExpression::pools[0]);
142484 :
142485 : // Build a local variable for better performance
142486 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
142487 :
142488 : // Iterate over the memory pools
142489 0 : for (unsigned int i=0; i < SgStatementExpression::pools.size(); i++)
142490 : {
142491 : // objectArray[i] is a single memory pool
142492 0 : for (unsigned j=0; j < SgStatementExpression::pool_size; j++)
142493 : {
142494 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
142495 : {
142496 : // printf ("Found a valid SgStatementExpression object in the memory pool %d at position %d \n",i,j);
142497 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
142498 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
142499 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
142500 : }
142501 : else
142502 : {
142503 : // printf ("Found a INVALID SgStatementExpression object in the memory pool \n");
142504 : }
142505 : }
142506 : }
142507 : }
142508 :
142509 : // This should not be required since all previously static data members are
142510 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
142511 :
142512 194 : }
142513 :
142514 : void
142515 0 : SgStatementExpression::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
142516 : {
142517 : // This function visits only a single IR node of the memory pool.
142518 : // it is typically called once for each type of IR node within
142519 : // the automatically generated function: traverseRepresentativeNodes().
142520 :
142521 : // Initialize array to the address of the first element of the STL vector
142522 : // (which is guarenteed to be contiguous storage).
142523 : // SgStatementExpression objectArray [] = *(Memory_Block_List.begin());
142524 0 : if (SgStatementExpression::pools.empty() == false)
142525 : {
142526 : // Generate an array of memory pools
142527 0 : SgStatementExpression** objectArray = (SgStatementExpression**) &(SgStatementExpression::pools[0]);
142528 :
142529 : // Build a local variable for better performance
142530 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
142531 :
142532 : // Iterate over the memory pools
142533 0 : bool done = false;
142534 0 : unsigned i=0;
142535 :
142536 : // find the first valid IR node, call visit function, and then leave
142537 0 : while ( done == false && i < SgStatementExpression::pools.size() )
142538 : {
142539 : // objectArray[i] is a single memory pool
142540 : unsigned j=0;
142541 0 : while (done == false && j < SgStatementExpression::pool_size)
142542 : {
142543 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
142544 : {
142545 0 : traversal.visit(&(objectArray[i][j]));
142546 0 : done = true;
142547 : }
142548 0 : j++;
142549 : }
142550 0 : i++;
142551 : }
142552 :
142553 : #if 0
142554 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
142555 : if (done == false)
142556 : {
142557 : printf ("No representative for SgStatementExpression found in memory pools \n");
142558 : }
142559 : #endif
142560 : }
142561 0 : }
142562 :
142563 :
142564 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
142565 : // using values that overflow signed values of int.
142566 : size_t
142567 4 : SgStatementExpression::numberOfNodes()
142568 : {
142569 : // This function traverses the memory pool for an IR node and
142570 : // counts the number of IR nodes of a particular Sage III IR
142571 : // nodes type.
142572 :
142573 4 : size_t count = 0;
142574 4 : if (SgStatementExpression::pools.empty() == false)
142575 : {
142576 : // Generate an array of memory pools (this is actually a STL vector,
142577 : // but it is contiguious, so OK to treat this way).
142578 0 : SgStatementExpression** objectArray = (SgStatementExpression**) &(SgStatementExpression::pools[0]);
142579 :
142580 : // Build a local variable for better performance (make it a loop invariant variable).
142581 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
142582 :
142583 : // Iterate over all of the memory pools for this IR node.
142584 0 : for (unsigned int i=0; i < SgStatementExpression::pools.size(); i++)
142585 : {
142586 : // objectArray[i] is a single memory pool, iterate over all the
142587 : // IR nodes and only count those that are valid IR nodes used in
142588 : // the AST (i.e. allocated IR nodes).
142589 0 : for (unsigned j=0; j < SgStatementExpression::pool_size; j++)
142590 : {
142591 : // This is indexing the STL vector of C/C++ style arrays as a doubly
142592 : // indexed array access. It is OK since we have leveraged the semantics
142593 : // of STL vector memory as contigous and cast the memory as an array
142594 : // of arrays to use the 2D array indexing. Hope this is not confusing,
142595 : // but it s very fast as an implementation.
142596 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
142597 : {
142598 0 : count++;
142599 : }
142600 : }
142601 : }
142602 : }
142603 :
142604 :
142605 :
142606 4 : return count;
142607 : }
142608 :
142609 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
142610 : // using values that overflow signed values of int.
142611 : size_t
142612 0 : SgStatementExpression::memoryUsage()
142613 : {
142614 : // This function is required because we need the class name as a type when we call sizeof
142615 : // There might be another way to implement this if we have a traversal that only called a
142616 : // representative object (one call for each type of Sage IIIIR node).
142617 0 : size_t memory = numberOfNodes() * sizeof(SgStatementExpression);
142618 :
142619 0 : return memory;
142620 : }
142621 :
142622 : /* #line 142623 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
142623 :
142624 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
142625 : void
142626 5342 : SgAsmOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
142627 : {
142628 : // This function traverses the memory pool for only a specific IR node
142629 : // and calls the visit function of the input class execute a traversal
142630 : // similar to the style of the attribute based traversals within ROSE.
142631 : // This traversal will visit ALL nodes of the AST where as the other
142632 : // attribute based traversals visit only the embedded tree within the AST.
142633 :
142634 : // Initialize array to the address of the first element of the STL vector
142635 : // (which is guaranteed to be contiguous storage).
142636 : // SgAsmOp objectArray [] = *(Memory_Block_List.begin());
142637 5342 : if (SgAsmOp::pools.empty() == false)
142638 : {
142639 : // Generate an array of memory pools
142640 0 : SgAsmOp** objectArray = (SgAsmOp**) &(SgAsmOp::pools[0]);
142641 :
142642 : // Build a local variable for better performance
142643 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
142644 : #if 0
142645 : // Iterate over the memory pools
142646 : for (unsigned int i=0; i < SgAsmOp::pools.size(); i++)
142647 : {
142648 : // objectArray[i] is a single memory pool
142649 : for (int j=0; j < SgAsmOp::pool_size; j++)
142650 : {
142651 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
142652 : {
142653 : traversal.visit(&(objectArray[i][j]));
142654 : }
142655 : }
142656 : }
142657 : #else
142658 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
142659 : // compute the list first and then call the visit function on each list element.
142660 :
142661 : // printf ("Inside of SgAsmOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
142662 :
142663 0 : std::vector<SgAsmOp*> nodeList;
142664 :
142665 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
142666 0 : for (unsigned int i=0; i < SgAsmOp::pools.size(); i++)
142667 : {
142668 : // objectArray[i] is a single memory pool
142669 0 : for (unsigned j=0; j < SgAsmOp::pool_size; j++)
142670 : {
142671 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
142672 : {
142673 0 : nodeList.push_back(&(objectArray[i][j]));
142674 : }
142675 : }
142676 : }
142677 :
142678 : // Iterate over the saved list
142679 0 : size_t nodeListSize = nodeList.size();
142680 0 : for (size_t i=0; i < nodeListSize; i++)
142681 : {
142682 0 : ROSE_ASSERT(nodeList[i] != NULL);
142683 : #if 0
142684 : traversal.visit(nodeList[i]);
142685 : #else
142686 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
142687 : {
142688 0 : traversal.visit(nodeList[i]);
142689 : }
142690 : #endif
142691 : }
142692 : #endif
142693 : }
142694 :
142695 : // This should not be required since all previously static data members are
142696 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
142697 :
142698 5342 : }
142699 :
142700 :
142701 : void
142702 194 : SgAsmOp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
142703 : {
142704 : // This function traverses the memory pool for an IR node and
142705 : // calls the function to execute the visitor object.
142706 :
142707 : // Initialize array to the address of the first element of the STL vector
142708 : // (which is guarenteed to be contiguous storage).
142709 : // SgAsmOp objectArray [] = *(Memory_Block_List.begin());
142710 194 : if (SgAsmOp::pools.empty() == false)
142711 : {
142712 : // Generate an array of memory pools
142713 0 : SgAsmOp** objectArray = (SgAsmOp**) &(SgAsmOp::pools[0]);
142714 :
142715 : // Build a local variable for better performance
142716 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
142717 :
142718 : // Iterate over the memory pools
142719 0 : for (unsigned int i=0; i < SgAsmOp::pools.size(); i++)
142720 : {
142721 : // objectArray[i] is a single memory pool
142722 0 : for (unsigned j=0; j < SgAsmOp::pool_size; j++)
142723 : {
142724 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
142725 : {
142726 : // printf ("Found a valid SgAsmOp object in the memory pool %d at position %d \n",i,j);
142727 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
142728 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
142729 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
142730 : }
142731 : else
142732 : {
142733 : // printf ("Found a INVALID SgAsmOp object in the memory pool \n");
142734 : }
142735 : }
142736 : }
142737 : }
142738 :
142739 : // This should not be required since all previously static data members are
142740 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
142741 :
142742 194 : }
142743 :
142744 : void
142745 0 : SgAsmOp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
142746 : {
142747 : // This function visits only a single IR node of the memory pool.
142748 : // it is typically called once for each type of IR node within
142749 : // the automatically generated function: traverseRepresentativeNodes().
142750 :
142751 : // Initialize array to the address of the first element of the STL vector
142752 : // (which is guarenteed to be contiguous storage).
142753 : // SgAsmOp objectArray [] = *(Memory_Block_List.begin());
142754 0 : if (SgAsmOp::pools.empty() == false)
142755 : {
142756 : // Generate an array of memory pools
142757 0 : SgAsmOp** objectArray = (SgAsmOp**) &(SgAsmOp::pools[0]);
142758 :
142759 : // Build a local variable for better performance
142760 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
142761 :
142762 : // Iterate over the memory pools
142763 0 : bool done = false;
142764 0 : unsigned i=0;
142765 :
142766 : // find the first valid IR node, call visit function, and then leave
142767 0 : while ( done == false && i < SgAsmOp::pools.size() )
142768 : {
142769 : // objectArray[i] is a single memory pool
142770 : unsigned j=0;
142771 0 : while (done == false && j < SgAsmOp::pool_size)
142772 : {
142773 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
142774 : {
142775 0 : traversal.visit(&(objectArray[i][j]));
142776 0 : done = true;
142777 : }
142778 0 : j++;
142779 : }
142780 0 : i++;
142781 : }
142782 :
142783 : #if 0
142784 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
142785 : if (done == false)
142786 : {
142787 : printf ("No representative for SgAsmOp found in memory pools \n");
142788 : }
142789 : #endif
142790 : }
142791 0 : }
142792 :
142793 :
142794 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
142795 : // using values that overflow signed values of int.
142796 : size_t
142797 4 : SgAsmOp::numberOfNodes()
142798 : {
142799 : // This function traverses the memory pool for an IR node and
142800 : // counts the number of IR nodes of a particular Sage III IR
142801 : // nodes type.
142802 :
142803 4 : size_t count = 0;
142804 4 : if (SgAsmOp::pools.empty() == false)
142805 : {
142806 : // Generate an array of memory pools (this is actually a STL vector,
142807 : // but it is contiguious, so OK to treat this way).
142808 0 : SgAsmOp** objectArray = (SgAsmOp**) &(SgAsmOp::pools[0]);
142809 :
142810 : // Build a local variable for better performance (make it a loop invariant variable).
142811 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
142812 :
142813 : // Iterate over all of the memory pools for this IR node.
142814 0 : for (unsigned int i=0; i < SgAsmOp::pools.size(); i++)
142815 : {
142816 : // objectArray[i] is a single memory pool, iterate over all the
142817 : // IR nodes and only count those that are valid IR nodes used in
142818 : // the AST (i.e. allocated IR nodes).
142819 0 : for (unsigned j=0; j < SgAsmOp::pool_size; j++)
142820 : {
142821 : // This is indexing the STL vector of C/C++ style arrays as a doubly
142822 : // indexed array access. It is OK since we have leveraged the semantics
142823 : // of STL vector memory as contigous and cast the memory as an array
142824 : // of arrays to use the 2D array indexing. Hope this is not confusing,
142825 : // but it s very fast as an implementation.
142826 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
142827 : {
142828 0 : count++;
142829 : }
142830 : }
142831 : }
142832 : }
142833 :
142834 :
142835 :
142836 4 : return count;
142837 : }
142838 :
142839 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
142840 : // using values that overflow signed values of int.
142841 : size_t
142842 0 : SgAsmOp::memoryUsage()
142843 : {
142844 : // This function is required because we need the class name as a type when we call sizeof
142845 : // There might be another way to implement this if we have a traversal that only called a
142846 : // representative object (one call for each type of Sage IIIIR node).
142847 0 : size_t memory = numberOfNodes() * sizeof(SgAsmOp);
142848 :
142849 0 : return memory;
142850 : }
142851 :
142852 : /* #line 142853 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
142853 :
142854 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
142855 : void
142856 5342 : SgLabelRefExp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
142857 : {
142858 : // This function traverses the memory pool for only a specific IR node
142859 : // and calls the visit function of the input class execute a traversal
142860 : // similar to the style of the attribute based traversals within ROSE.
142861 : // This traversal will visit ALL nodes of the AST where as the other
142862 : // attribute based traversals visit only the embedded tree within the AST.
142863 :
142864 : // Initialize array to the address of the first element of the STL vector
142865 : // (which is guaranteed to be contiguous storage).
142866 : // SgLabelRefExp objectArray [] = *(Memory_Block_List.begin());
142867 5342 : if (SgLabelRefExp::pools.empty() == false)
142868 : {
142869 : // Generate an array of memory pools
142870 27 : SgLabelRefExp** objectArray = (SgLabelRefExp**) &(SgLabelRefExp::pools[0]);
142871 :
142872 : // Build a local variable for better performance
142873 27 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
142874 : #if 0
142875 : // Iterate over the memory pools
142876 : for (unsigned int i=0; i < SgLabelRefExp::pools.size(); i++)
142877 : {
142878 : // objectArray[i] is a single memory pool
142879 : for (int j=0; j < SgLabelRefExp::pool_size; j++)
142880 : {
142881 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
142882 : {
142883 : traversal.visit(&(objectArray[i][j]));
142884 : }
142885 : }
142886 : }
142887 : #else
142888 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
142889 : // compute the list first and then call the visit function on each list element.
142890 :
142891 : // printf ("Inside of SgLabelRefExp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
142892 :
142893 54 : std::vector<SgLabelRefExp*> nodeList;
142894 :
142895 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
142896 54 : for (unsigned int i=0; i < SgLabelRefExp::pools.size(); i++)
142897 : {
142898 : // objectArray[i] is a single memory pool
142899 54027 : for (unsigned j=0; j < SgLabelRefExp::pool_size; j++)
142900 : {
142901 54000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
142902 : {
142903 141 : nodeList.push_back(&(objectArray[i][j]));
142904 : }
142905 : }
142906 : }
142907 :
142908 : // Iterate over the saved list
142909 27 : size_t nodeListSize = nodeList.size();
142910 168 : for (size_t i=0; i < nodeListSize; i++)
142911 : {
142912 141 : ROSE_ASSERT(nodeList[i] != NULL);
142913 : #if 0
142914 : traversal.visit(nodeList[i]);
142915 : #else
142916 141 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
142917 : {
142918 141 : traversal.visit(nodeList[i]);
142919 : }
142920 : #endif
142921 : }
142922 : #endif
142923 : }
142924 :
142925 : // This should not be required since all previously static data members are
142926 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
142927 :
142928 5342 : }
142929 :
142930 :
142931 : void
142932 194 : SgLabelRefExp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
142933 : {
142934 : // This function traverses the memory pool for an IR node and
142935 : // calls the function to execute the visitor object.
142936 :
142937 : // Initialize array to the address of the first element of the STL vector
142938 : // (which is guarenteed to be contiguous storage).
142939 : // SgLabelRefExp objectArray [] = *(Memory_Block_List.begin());
142940 194 : if (SgLabelRefExp::pools.empty() == false)
142941 : {
142942 : // Generate an array of memory pools
142943 0 : SgLabelRefExp** objectArray = (SgLabelRefExp**) &(SgLabelRefExp::pools[0]);
142944 :
142945 : // Build a local variable for better performance
142946 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
142947 :
142948 : // Iterate over the memory pools
142949 0 : for (unsigned int i=0; i < SgLabelRefExp::pools.size(); i++)
142950 : {
142951 : // objectArray[i] is a single memory pool
142952 0 : for (unsigned j=0; j < SgLabelRefExp::pool_size; j++)
142953 : {
142954 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
142955 : {
142956 : // printf ("Found a valid SgLabelRefExp object in the memory pool %d at position %d \n",i,j);
142957 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
142958 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
142959 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
142960 : }
142961 : else
142962 : {
142963 : // printf ("Found a INVALID SgLabelRefExp object in the memory pool \n");
142964 : }
142965 : }
142966 : }
142967 : }
142968 :
142969 : // This should not be required since all previously static data members are
142970 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
142971 :
142972 194 : }
142973 :
142974 : void
142975 0 : SgLabelRefExp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
142976 : {
142977 : // This function visits only a single IR node of the memory pool.
142978 : // it is typically called once for each type of IR node within
142979 : // the automatically generated function: traverseRepresentativeNodes().
142980 :
142981 : // Initialize array to the address of the first element of the STL vector
142982 : // (which is guarenteed to be contiguous storage).
142983 : // SgLabelRefExp objectArray [] = *(Memory_Block_List.begin());
142984 0 : if (SgLabelRefExp::pools.empty() == false)
142985 : {
142986 : // Generate an array of memory pools
142987 0 : SgLabelRefExp** objectArray = (SgLabelRefExp**) &(SgLabelRefExp::pools[0]);
142988 :
142989 : // Build a local variable for better performance
142990 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
142991 :
142992 : // Iterate over the memory pools
142993 0 : bool done = false;
142994 0 : unsigned i=0;
142995 :
142996 : // find the first valid IR node, call visit function, and then leave
142997 0 : while ( done == false && i < SgLabelRefExp::pools.size() )
142998 : {
142999 : // objectArray[i] is a single memory pool
143000 : unsigned j=0;
143001 0 : while (done == false && j < SgLabelRefExp::pool_size)
143002 : {
143003 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
143004 : {
143005 0 : traversal.visit(&(objectArray[i][j]));
143006 0 : done = true;
143007 : }
143008 0 : j++;
143009 : }
143010 0 : i++;
143011 : }
143012 :
143013 : #if 0
143014 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
143015 : if (done == false)
143016 : {
143017 : printf ("No representative for SgLabelRefExp found in memory pools \n");
143018 : }
143019 : #endif
143020 : }
143021 0 : }
143022 :
143023 :
143024 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
143025 : // using values that overflow signed values of int.
143026 : size_t
143027 4 : SgLabelRefExp::numberOfNodes()
143028 : {
143029 : // This function traverses the memory pool for an IR node and
143030 : // counts the number of IR nodes of a particular Sage III IR
143031 : // nodes type.
143032 :
143033 4 : size_t count = 0;
143034 4 : if (SgLabelRefExp::pools.empty() == false)
143035 : {
143036 : // Generate an array of memory pools (this is actually a STL vector,
143037 : // but it is contiguious, so OK to treat this way).
143038 0 : SgLabelRefExp** objectArray = (SgLabelRefExp**) &(SgLabelRefExp::pools[0]);
143039 :
143040 : // Build a local variable for better performance (make it a loop invariant variable).
143041 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
143042 :
143043 : // Iterate over all of the memory pools for this IR node.
143044 0 : for (unsigned int i=0; i < SgLabelRefExp::pools.size(); i++)
143045 : {
143046 : // objectArray[i] is a single memory pool, iterate over all the
143047 : // IR nodes and only count those that are valid IR nodes used in
143048 : // the AST (i.e. allocated IR nodes).
143049 0 : for (unsigned j=0; j < SgLabelRefExp::pool_size; j++)
143050 : {
143051 : // This is indexing the STL vector of C/C++ style arrays as a doubly
143052 : // indexed array access. It is OK since we have leveraged the semantics
143053 : // of STL vector memory as contigous and cast the memory as an array
143054 : // of arrays to use the 2D array indexing. Hope this is not confusing,
143055 : // but it s very fast as an implementation.
143056 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
143057 : {
143058 0 : count++;
143059 : }
143060 : }
143061 : }
143062 : }
143063 :
143064 :
143065 :
143066 4 : return count;
143067 : }
143068 :
143069 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
143070 : // using values that overflow signed values of int.
143071 : size_t
143072 0 : SgLabelRefExp::memoryUsage()
143073 : {
143074 : // This function is required because we need the class name as a type when we call sizeof
143075 : // There might be another way to implement this if we have a traversal that only called a
143076 : // representative object (one call for each type of Sage IIIIR node).
143077 0 : size_t memory = numberOfNodes() * sizeof(SgLabelRefExp);
143078 :
143079 0 : return memory;
143080 : }
143081 :
143082 : /* #line 143083 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
143083 :
143084 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
143085 : void
143086 5342 : SgActualArgumentExpression::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
143087 : {
143088 : // This function traverses the memory pool for only a specific IR node
143089 : // and calls the visit function of the input class execute a traversal
143090 : // similar to the style of the attribute based traversals within ROSE.
143091 : // This traversal will visit ALL nodes of the AST where as the other
143092 : // attribute based traversals visit only the embedded tree within the AST.
143093 :
143094 : // Initialize array to the address of the first element of the STL vector
143095 : // (which is guaranteed to be contiguous storage).
143096 : // SgActualArgumentExpression objectArray [] = *(Memory_Block_List.begin());
143097 5342 : if (SgActualArgumentExpression::pools.empty() == false)
143098 : {
143099 : // Generate an array of memory pools
143100 0 : SgActualArgumentExpression** objectArray = (SgActualArgumentExpression**) &(SgActualArgumentExpression::pools[0]);
143101 :
143102 : // Build a local variable for better performance
143103 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
143104 : #if 0
143105 : // Iterate over the memory pools
143106 : for (unsigned int i=0; i < SgActualArgumentExpression::pools.size(); i++)
143107 : {
143108 : // objectArray[i] is a single memory pool
143109 : for (int j=0; j < SgActualArgumentExpression::pool_size; j++)
143110 : {
143111 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
143112 : {
143113 : traversal.visit(&(objectArray[i][j]));
143114 : }
143115 : }
143116 : }
143117 : #else
143118 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
143119 : // compute the list first and then call the visit function on each list element.
143120 :
143121 : // printf ("Inside of SgActualArgumentExpression::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
143122 :
143123 0 : std::vector<SgActualArgumentExpression*> nodeList;
143124 :
143125 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
143126 0 : for (unsigned int i=0; i < SgActualArgumentExpression::pools.size(); i++)
143127 : {
143128 : // objectArray[i] is a single memory pool
143129 0 : for (unsigned j=0; j < SgActualArgumentExpression::pool_size; j++)
143130 : {
143131 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
143132 : {
143133 0 : nodeList.push_back(&(objectArray[i][j]));
143134 : }
143135 : }
143136 : }
143137 :
143138 : // Iterate over the saved list
143139 0 : size_t nodeListSize = nodeList.size();
143140 0 : for (size_t i=0; i < nodeListSize; i++)
143141 : {
143142 0 : ROSE_ASSERT(nodeList[i] != NULL);
143143 : #if 0
143144 : traversal.visit(nodeList[i]);
143145 : #else
143146 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
143147 : {
143148 0 : traversal.visit(nodeList[i]);
143149 : }
143150 : #endif
143151 : }
143152 : #endif
143153 : }
143154 :
143155 : // This should not be required since all previously static data members are
143156 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
143157 :
143158 5342 : }
143159 :
143160 :
143161 : void
143162 194 : SgActualArgumentExpression::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
143163 : {
143164 : // This function traverses the memory pool for an IR node and
143165 : // calls the function to execute the visitor object.
143166 :
143167 : // Initialize array to the address of the first element of the STL vector
143168 : // (which is guarenteed to be contiguous storage).
143169 : // SgActualArgumentExpression objectArray [] = *(Memory_Block_List.begin());
143170 194 : if (SgActualArgumentExpression::pools.empty() == false)
143171 : {
143172 : // Generate an array of memory pools
143173 0 : SgActualArgumentExpression** objectArray = (SgActualArgumentExpression**) &(SgActualArgumentExpression::pools[0]);
143174 :
143175 : // Build a local variable for better performance
143176 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
143177 :
143178 : // Iterate over the memory pools
143179 0 : for (unsigned int i=0; i < SgActualArgumentExpression::pools.size(); i++)
143180 : {
143181 : // objectArray[i] is a single memory pool
143182 0 : for (unsigned j=0; j < SgActualArgumentExpression::pool_size; j++)
143183 : {
143184 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
143185 : {
143186 : // printf ("Found a valid SgActualArgumentExpression object in the memory pool %d at position %d \n",i,j);
143187 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
143188 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
143189 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
143190 : }
143191 : else
143192 : {
143193 : // printf ("Found a INVALID SgActualArgumentExpression object in the memory pool \n");
143194 : }
143195 : }
143196 : }
143197 : }
143198 :
143199 : // This should not be required since all previously static data members are
143200 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
143201 :
143202 194 : }
143203 :
143204 : void
143205 0 : SgActualArgumentExpression::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
143206 : {
143207 : // This function visits only a single IR node of the memory pool.
143208 : // it is typically called once for each type of IR node within
143209 : // the automatically generated function: traverseRepresentativeNodes().
143210 :
143211 : // Initialize array to the address of the first element of the STL vector
143212 : // (which is guarenteed to be contiguous storage).
143213 : // SgActualArgumentExpression objectArray [] = *(Memory_Block_List.begin());
143214 0 : if (SgActualArgumentExpression::pools.empty() == false)
143215 : {
143216 : // Generate an array of memory pools
143217 0 : SgActualArgumentExpression** objectArray = (SgActualArgumentExpression**) &(SgActualArgumentExpression::pools[0]);
143218 :
143219 : // Build a local variable for better performance
143220 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
143221 :
143222 : // Iterate over the memory pools
143223 0 : bool done = false;
143224 0 : unsigned i=0;
143225 :
143226 : // find the first valid IR node, call visit function, and then leave
143227 0 : while ( done == false && i < SgActualArgumentExpression::pools.size() )
143228 : {
143229 : // objectArray[i] is a single memory pool
143230 : unsigned j=0;
143231 0 : while (done == false && j < SgActualArgumentExpression::pool_size)
143232 : {
143233 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
143234 : {
143235 0 : traversal.visit(&(objectArray[i][j]));
143236 0 : done = true;
143237 : }
143238 0 : j++;
143239 : }
143240 0 : i++;
143241 : }
143242 :
143243 : #if 0
143244 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
143245 : if (done == false)
143246 : {
143247 : printf ("No representative for SgActualArgumentExpression found in memory pools \n");
143248 : }
143249 : #endif
143250 : }
143251 0 : }
143252 :
143253 :
143254 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
143255 : // using values that overflow signed values of int.
143256 : size_t
143257 4 : SgActualArgumentExpression::numberOfNodes()
143258 : {
143259 : // This function traverses the memory pool for an IR node and
143260 : // counts the number of IR nodes of a particular Sage III IR
143261 : // nodes type.
143262 :
143263 4 : size_t count = 0;
143264 4 : if (SgActualArgumentExpression::pools.empty() == false)
143265 : {
143266 : // Generate an array of memory pools (this is actually a STL vector,
143267 : // but it is contiguious, so OK to treat this way).
143268 0 : SgActualArgumentExpression** objectArray = (SgActualArgumentExpression**) &(SgActualArgumentExpression::pools[0]);
143269 :
143270 : // Build a local variable for better performance (make it a loop invariant variable).
143271 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
143272 :
143273 : // Iterate over all of the memory pools for this IR node.
143274 0 : for (unsigned int i=0; i < SgActualArgumentExpression::pools.size(); i++)
143275 : {
143276 : // objectArray[i] is a single memory pool, iterate over all the
143277 : // IR nodes and only count those that are valid IR nodes used in
143278 : // the AST (i.e. allocated IR nodes).
143279 0 : for (unsigned j=0; j < SgActualArgumentExpression::pool_size; j++)
143280 : {
143281 : // This is indexing the STL vector of C/C++ style arrays as a doubly
143282 : // indexed array access. It is OK since we have leveraged the semantics
143283 : // of STL vector memory as contigous and cast the memory as an array
143284 : // of arrays to use the 2D array indexing. Hope this is not confusing,
143285 : // but it s very fast as an implementation.
143286 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
143287 : {
143288 0 : count++;
143289 : }
143290 : }
143291 : }
143292 : }
143293 :
143294 :
143295 :
143296 4 : return count;
143297 : }
143298 :
143299 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
143300 : // using values that overflow signed values of int.
143301 : size_t
143302 0 : SgActualArgumentExpression::memoryUsage()
143303 : {
143304 : // This function is required because we need the class name as a type when we call sizeof
143305 : // There might be another way to implement this if we have a traversal that only called a
143306 : // representative object (one call for each type of Sage IIIIR node).
143307 0 : size_t memory = numberOfNodes() * sizeof(SgActualArgumentExpression);
143308 :
143309 0 : return memory;
143310 : }
143311 :
143312 : /* #line 143313 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
143313 :
143314 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
143315 : void
143316 5342 : SgUnknownArrayOrFunctionReference::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
143317 : {
143318 : // This function traverses the memory pool for only a specific IR node
143319 : // and calls the visit function of the input class execute a traversal
143320 : // similar to the style of the attribute based traversals within ROSE.
143321 : // This traversal will visit ALL nodes of the AST where as the other
143322 : // attribute based traversals visit only the embedded tree within the AST.
143323 :
143324 : // Initialize array to the address of the first element of the STL vector
143325 : // (which is guaranteed to be contiguous storage).
143326 : // SgUnknownArrayOrFunctionReference objectArray [] = *(Memory_Block_List.begin());
143327 5342 : if (SgUnknownArrayOrFunctionReference::pools.empty() == false)
143328 : {
143329 : // Generate an array of memory pools
143330 0 : SgUnknownArrayOrFunctionReference** objectArray = (SgUnknownArrayOrFunctionReference**) &(SgUnknownArrayOrFunctionReference::pools[0]);
143331 :
143332 : // Build a local variable for better performance
143333 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
143334 : #if 0
143335 : // Iterate over the memory pools
143336 : for (unsigned int i=0; i < SgUnknownArrayOrFunctionReference::pools.size(); i++)
143337 : {
143338 : // objectArray[i] is a single memory pool
143339 : for (int j=0; j < SgUnknownArrayOrFunctionReference::pool_size; j++)
143340 : {
143341 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
143342 : {
143343 : traversal.visit(&(objectArray[i][j]));
143344 : }
143345 : }
143346 : }
143347 : #else
143348 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
143349 : // compute the list first and then call the visit function on each list element.
143350 :
143351 : // printf ("Inside of SgUnknownArrayOrFunctionReference::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
143352 :
143353 0 : std::vector<SgUnknownArrayOrFunctionReference*> nodeList;
143354 :
143355 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
143356 0 : for (unsigned int i=0; i < SgUnknownArrayOrFunctionReference::pools.size(); i++)
143357 : {
143358 : // objectArray[i] is a single memory pool
143359 0 : for (unsigned j=0; j < SgUnknownArrayOrFunctionReference::pool_size; j++)
143360 : {
143361 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
143362 : {
143363 0 : nodeList.push_back(&(objectArray[i][j]));
143364 : }
143365 : }
143366 : }
143367 :
143368 : // Iterate over the saved list
143369 0 : size_t nodeListSize = nodeList.size();
143370 0 : for (size_t i=0; i < nodeListSize; i++)
143371 : {
143372 0 : ROSE_ASSERT(nodeList[i] != NULL);
143373 : #if 0
143374 : traversal.visit(nodeList[i]);
143375 : #else
143376 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
143377 : {
143378 0 : traversal.visit(nodeList[i]);
143379 : }
143380 : #endif
143381 : }
143382 : #endif
143383 : }
143384 :
143385 : // This should not be required since all previously static data members are
143386 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
143387 :
143388 5342 : }
143389 :
143390 :
143391 : void
143392 194 : SgUnknownArrayOrFunctionReference::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
143393 : {
143394 : // This function traverses the memory pool for an IR node and
143395 : // calls the function to execute the visitor object.
143396 :
143397 : // Initialize array to the address of the first element of the STL vector
143398 : // (which is guarenteed to be contiguous storage).
143399 : // SgUnknownArrayOrFunctionReference objectArray [] = *(Memory_Block_List.begin());
143400 194 : if (SgUnknownArrayOrFunctionReference::pools.empty() == false)
143401 : {
143402 : // Generate an array of memory pools
143403 0 : SgUnknownArrayOrFunctionReference** objectArray = (SgUnknownArrayOrFunctionReference**) &(SgUnknownArrayOrFunctionReference::pools[0]);
143404 :
143405 : // Build a local variable for better performance
143406 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
143407 :
143408 : // Iterate over the memory pools
143409 0 : for (unsigned int i=0; i < SgUnknownArrayOrFunctionReference::pools.size(); i++)
143410 : {
143411 : // objectArray[i] is a single memory pool
143412 0 : for (unsigned j=0; j < SgUnknownArrayOrFunctionReference::pool_size; j++)
143413 : {
143414 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
143415 : {
143416 : // printf ("Found a valid SgUnknownArrayOrFunctionReference object in the memory pool %d at position %d \n",i,j);
143417 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
143418 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
143419 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
143420 : }
143421 : else
143422 : {
143423 : // printf ("Found a INVALID SgUnknownArrayOrFunctionReference object in the memory pool \n");
143424 : }
143425 : }
143426 : }
143427 : }
143428 :
143429 : // This should not be required since all previously static data members are
143430 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
143431 :
143432 194 : }
143433 :
143434 : void
143435 0 : SgUnknownArrayOrFunctionReference::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
143436 : {
143437 : // This function visits only a single IR node of the memory pool.
143438 : // it is typically called once for each type of IR node within
143439 : // the automatically generated function: traverseRepresentativeNodes().
143440 :
143441 : // Initialize array to the address of the first element of the STL vector
143442 : // (which is guarenteed to be contiguous storage).
143443 : // SgUnknownArrayOrFunctionReference objectArray [] = *(Memory_Block_List.begin());
143444 0 : if (SgUnknownArrayOrFunctionReference::pools.empty() == false)
143445 : {
143446 : // Generate an array of memory pools
143447 0 : SgUnknownArrayOrFunctionReference** objectArray = (SgUnknownArrayOrFunctionReference**) &(SgUnknownArrayOrFunctionReference::pools[0]);
143448 :
143449 : // Build a local variable for better performance
143450 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
143451 :
143452 : // Iterate over the memory pools
143453 0 : bool done = false;
143454 0 : unsigned i=0;
143455 :
143456 : // find the first valid IR node, call visit function, and then leave
143457 0 : while ( done == false && i < SgUnknownArrayOrFunctionReference::pools.size() )
143458 : {
143459 : // objectArray[i] is a single memory pool
143460 : unsigned j=0;
143461 0 : while (done == false && j < SgUnknownArrayOrFunctionReference::pool_size)
143462 : {
143463 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
143464 : {
143465 0 : traversal.visit(&(objectArray[i][j]));
143466 0 : done = true;
143467 : }
143468 0 : j++;
143469 : }
143470 0 : i++;
143471 : }
143472 :
143473 : #if 0
143474 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
143475 : if (done == false)
143476 : {
143477 : printf ("No representative for SgUnknownArrayOrFunctionReference found in memory pools \n");
143478 : }
143479 : #endif
143480 : }
143481 0 : }
143482 :
143483 :
143484 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
143485 : // using values that overflow signed values of int.
143486 : size_t
143487 4 : SgUnknownArrayOrFunctionReference::numberOfNodes()
143488 : {
143489 : // This function traverses the memory pool for an IR node and
143490 : // counts the number of IR nodes of a particular Sage III IR
143491 : // nodes type.
143492 :
143493 4 : size_t count = 0;
143494 4 : if (SgUnknownArrayOrFunctionReference::pools.empty() == false)
143495 : {
143496 : // Generate an array of memory pools (this is actually a STL vector,
143497 : // but it is contiguious, so OK to treat this way).
143498 0 : SgUnknownArrayOrFunctionReference** objectArray = (SgUnknownArrayOrFunctionReference**) &(SgUnknownArrayOrFunctionReference::pools[0]);
143499 :
143500 : // Build a local variable for better performance (make it a loop invariant variable).
143501 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
143502 :
143503 : // Iterate over all of the memory pools for this IR node.
143504 0 : for (unsigned int i=0; i < SgUnknownArrayOrFunctionReference::pools.size(); i++)
143505 : {
143506 : // objectArray[i] is a single memory pool, iterate over all the
143507 : // IR nodes and only count those that are valid IR nodes used in
143508 : // the AST (i.e. allocated IR nodes).
143509 0 : for (unsigned j=0; j < SgUnknownArrayOrFunctionReference::pool_size; j++)
143510 : {
143511 : // This is indexing the STL vector of C/C++ style arrays as a doubly
143512 : // indexed array access. It is OK since we have leveraged the semantics
143513 : // of STL vector memory as contigous and cast the memory as an array
143514 : // of arrays to use the 2D array indexing. Hope this is not confusing,
143515 : // but it s very fast as an implementation.
143516 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
143517 : {
143518 0 : count++;
143519 : }
143520 : }
143521 : }
143522 : }
143523 :
143524 :
143525 :
143526 4 : return count;
143527 : }
143528 :
143529 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
143530 : // using values that overflow signed values of int.
143531 : size_t
143532 0 : SgUnknownArrayOrFunctionReference::memoryUsage()
143533 : {
143534 : // This function is required because we need the class name as a type when we call sizeof
143535 : // There might be another way to implement this if we have a traversal that only called a
143536 : // representative object (one call for each type of Sage IIIIR node).
143537 0 : size_t memory = numberOfNodes() * sizeof(SgUnknownArrayOrFunctionReference);
143538 :
143539 0 : return memory;
143540 : }
143541 :
143542 : /* #line 143543 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
143543 :
143544 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
143545 : void
143546 5342 : SgPseudoDestructorRefExp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
143547 : {
143548 : // This function traverses the memory pool for only a specific IR node
143549 : // and calls the visit function of the input class execute a traversal
143550 : // similar to the style of the attribute based traversals within ROSE.
143551 : // This traversal will visit ALL nodes of the AST where as the other
143552 : // attribute based traversals visit only the embedded tree within the AST.
143553 :
143554 : // Initialize array to the address of the first element of the STL vector
143555 : // (which is guaranteed to be contiguous storage).
143556 : // SgPseudoDestructorRefExp objectArray [] = *(Memory_Block_List.begin());
143557 5342 : if (SgPseudoDestructorRefExp::pools.empty() == false)
143558 : {
143559 : // Generate an array of memory pools
143560 0 : SgPseudoDestructorRefExp** objectArray = (SgPseudoDestructorRefExp**) &(SgPseudoDestructorRefExp::pools[0]);
143561 :
143562 : // Build a local variable for better performance
143563 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
143564 : #if 0
143565 : // Iterate over the memory pools
143566 : for (unsigned int i=0; i < SgPseudoDestructorRefExp::pools.size(); i++)
143567 : {
143568 : // objectArray[i] is a single memory pool
143569 : for (int j=0; j < SgPseudoDestructorRefExp::pool_size; j++)
143570 : {
143571 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
143572 : {
143573 : traversal.visit(&(objectArray[i][j]));
143574 : }
143575 : }
143576 : }
143577 : #else
143578 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
143579 : // compute the list first and then call the visit function on each list element.
143580 :
143581 : // printf ("Inside of SgPseudoDestructorRefExp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
143582 :
143583 0 : std::vector<SgPseudoDestructorRefExp*> nodeList;
143584 :
143585 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
143586 0 : for (unsigned int i=0; i < SgPseudoDestructorRefExp::pools.size(); i++)
143587 : {
143588 : // objectArray[i] is a single memory pool
143589 0 : for (unsigned j=0; j < SgPseudoDestructorRefExp::pool_size; j++)
143590 : {
143591 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
143592 : {
143593 0 : nodeList.push_back(&(objectArray[i][j]));
143594 : }
143595 : }
143596 : }
143597 :
143598 : // Iterate over the saved list
143599 0 : size_t nodeListSize = nodeList.size();
143600 0 : for (size_t i=0; i < nodeListSize; i++)
143601 : {
143602 0 : ROSE_ASSERT(nodeList[i] != NULL);
143603 : #if 0
143604 : traversal.visit(nodeList[i]);
143605 : #else
143606 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
143607 : {
143608 0 : traversal.visit(nodeList[i]);
143609 : }
143610 : #endif
143611 : }
143612 : #endif
143613 : }
143614 :
143615 : // This should not be required since all previously static data members are
143616 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
143617 :
143618 5342 : }
143619 :
143620 :
143621 : void
143622 194 : SgPseudoDestructorRefExp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
143623 : {
143624 : // This function traverses the memory pool for an IR node and
143625 : // calls the function to execute the visitor object.
143626 :
143627 : // Initialize array to the address of the first element of the STL vector
143628 : // (which is guarenteed to be contiguous storage).
143629 : // SgPseudoDestructorRefExp objectArray [] = *(Memory_Block_List.begin());
143630 194 : if (SgPseudoDestructorRefExp::pools.empty() == false)
143631 : {
143632 : // Generate an array of memory pools
143633 0 : SgPseudoDestructorRefExp** objectArray = (SgPseudoDestructorRefExp**) &(SgPseudoDestructorRefExp::pools[0]);
143634 :
143635 : // Build a local variable for better performance
143636 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
143637 :
143638 : // Iterate over the memory pools
143639 0 : for (unsigned int i=0; i < SgPseudoDestructorRefExp::pools.size(); i++)
143640 : {
143641 : // objectArray[i] is a single memory pool
143642 0 : for (unsigned j=0; j < SgPseudoDestructorRefExp::pool_size; j++)
143643 : {
143644 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
143645 : {
143646 : // printf ("Found a valid SgPseudoDestructorRefExp object in the memory pool %d at position %d \n",i,j);
143647 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
143648 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
143649 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
143650 : }
143651 : else
143652 : {
143653 : // printf ("Found a INVALID SgPseudoDestructorRefExp object in the memory pool \n");
143654 : }
143655 : }
143656 : }
143657 : }
143658 :
143659 : // This should not be required since all previously static data members are
143660 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
143661 :
143662 194 : }
143663 :
143664 : void
143665 0 : SgPseudoDestructorRefExp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
143666 : {
143667 : // This function visits only a single IR node of the memory pool.
143668 : // it is typically called once for each type of IR node within
143669 : // the automatically generated function: traverseRepresentativeNodes().
143670 :
143671 : // Initialize array to the address of the first element of the STL vector
143672 : // (which is guarenteed to be contiguous storage).
143673 : // SgPseudoDestructorRefExp objectArray [] = *(Memory_Block_List.begin());
143674 0 : if (SgPseudoDestructorRefExp::pools.empty() == false)
143675 : {
143676 : // Generate an array of memory pools
143677 0 : SgPseudoDestructorRefExp** objectArray = (SgPseudoDestructorRefExp**) &(SgPseudoDestructorRefExp::pools[0]);
143678 :
143679 : // Build a local variable for better performance
143680 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
143681 :
143682 : // Iterate over the memory pools
143683 0 : bool done = false;
143684 0 : unsigned i=0;
143685 :
143686 : // find the first valid IR node, call visit function, and then leave
143687 0 : while ( done == false && i < SgPseudoDestructorRefExp::pools.size() )
143688 : {
143689 : // objectArray[i] is a single memory pool
143690 : unsigned j=0;
143691 0 : while (done == false && j < SgPseudoDestructorRefExp::pool_size)
143692 : {
143693 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
143694 : {
143695 0 : traversal.visit(&(objectArray[i][j]));
143696 0 : done = true;
143697 : }
143698 0 : j++;
143699 : }
143700 0 : i++;
143701 : }
143702 :
143703 : #if 0
143704 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
143705 : if (done == false)
143706 : {
143707 : printf ("No representative for SgPseudoDestructorRefExp found in memory pools \n");
143708 : }
143709 : #endif
143710 : }
143711 0 : }
143712 :
143713 :
143714 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
143715 : // using values that overflow signed values of int.
143716 : size_t
143717 4 : SgPseudoDestructorRefExp::numberOfNodes()
143718 : {
143719 : // This function traverses the memory pool for an IR node and
143720 : // counts the number of IR nodes of a particular Sage III IR
143721 : // nodes type.
143722 :
143723 4 : size_t count = 0;
143724 4 : if (SgPseudoDestructorRefExp::pools.empty() == false)
143725 : {
143726 : // Generate an array of memory pools (this is actually a STL vector,
143727 : // but it is contiguious, so OK to treat this way).
143728 0 : SgPseudoDestructorRefExp** objectArray = (SgPseudoDestructorRefExp**) &(SgPseudoDestructorRefExp::pools[0]);
143729 :
143730 : // Build a local variable for better performance (make it a loop invariant variable).
143731 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
143732 :
143733 : // Iterate over all of the memory pools for this IR node.
143734 0 : for (unsigned int i=0; i < SgPseudoDestructorRefExp::pools.size(); i++)
143735 : {
143736 : // objectArray[i] is a single memory pool, iterate over all the
143737 : // IR nodes and only count those that are valid IR nodes used in
143738 : // the AST (i.e. allocated IR nodes).
143739 0 : for (unsigned j=0; j < SgPseudoDestructorRefExp::pool_size; j++)
143740 : {
143741 : // This is indexing the STL vector of C/C++ style arrays as a doubly
143742 : // indexed array access. It is OK since we have leveraged the semantics
143743 : // of STL vector memory as contigous and cast the memory as an array
143744 : // of arrays to use the 2D array indexing. Hope this is not confusing,
143745 : // but it s very fast as an implementation.
143746 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
143747 : {
143748 0 : count++;
143749 : }
143750 : }
143751 : }
143752 : }
143753 :
143754 :
143755 :
143756 4 : return count;
143757 : }
143758 :
143759 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
143760 : // using values that overflow signed values of int.
143761 : size_t
143762 0 : SgPseudoDestructorRefExp::memoryUsage()
143763 : {
143764 : // This function is required because we need the class name as a type when we call sizeof
143765 : // There might be another way to implement this if we have a traversal that only called a
143766 : // representative object (one call for each type of Sage IIIIR node).
143767 0 : size_t memory = numberOfNodes() * sizeof(SgPseudoDestructorRefExp);
143768 :
143769 0 : return memory;
143770 : }
143771 :
143772 : /* #line 143773 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
143773 :
143774 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
143775 : void
143776 5342 : SgCAFCoExpression::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
143777 : {
143778 : // This function traverses the memory pool for only a specific IR node
143779 : // and calls the visit function of the input class execute a traversal
143780 : // similar to the style of the attribute based traversals within ROSE.
143781 : // This traversal will visit ALL nodes of the AST where as the other
143782 : // attribute based traversals visit only the embedded tree within the AST.
143783 :
143784 : // Initialize array to the address of the first element of the STL vector
143785 : // (which is guaranteed to be contiguous storage).
143786 : // SgCAFCoExpression objectArray [] = *(Memory_Block_List.begin());
143787 5342 : if (SgCAFCoExpression::pools.empty() == false)
143788 : {
143789 : // Generate an array of memory pools
143790 0 : SgCAFCoExpression** objectArray = (SgCAFCoExpression**) &(SgCAFCoExpression::pools[0]);
143791 :
143792 : // Build a local variable for better performance
143793 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
143794 : #if 0
143795 : // Iterate over the memory pools
143796 : for (unsigned int i=0; i < SgCAFCoExpression::pools.size(); i++)
143797 : {
143798 : // objectArray[i] is a single memory pool
143799 : for (int j=0; j < SgCAFCoExpression::pool_size; j++)
143800 : {
143801 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
143802 : {
143803 : traversal.visit(&(objectArray[i][j]));
143804 : }
143805 : }
143806 : }
143807 : #else
143808 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
143809 : // compute the list first and then call the visit function on each list element.
143810 :
143811 : // printf ("Inside of SgCAFCoExpression::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
143812 :
143813 0 : std::vector<SgCAFCoExpression*> nodeList;
143814 :
143815 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
143816 0 : for (unsigned int i=0; i < SgCAFCoExpression::pools.size(); i++)
143817 : {
143818 : // objectArray[i] is a single memory pool
143819 0 : for (unsigned j=0; j < SgCAFCoExpression::pool_size; j++)
143820 : {
143821 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
143822 : {
143823 0 : nodeList.push_back(&(objectArray[i][j]));
143824 : }
143825 : }
143826 : }
143827 :
143828 : // Iterate over the saved list
143829 0 : size_t nodeListSize = nodeList.size();
143830 0 : for (size_t i=0; i < nodeListSize; i++)
143831 : {
143832 0 : ROSE_ASSERT(nodeList[i] != NULL);
143833 : #if 0
143834 : traversal.visit(nodeList[i]);
143835 : #else
143836 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
143837 : {
143838 0 : traversal.visit(nodeList[i]);
143839 : }
143840 : #endif
143841 : }
143842 : #endif
143843 : }
143844 :
143845 : // This should not be required since all previously static data members are
143846 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
143847 :
143848 5342 : }
143849 :
143850 :
143851 : void
143852 194 : SgCAFCoExpression::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
143853 : {
143854 : // This function traverses the memory pool for an IR node and
143855 : // calls the function to execute the visitor object.
143856 :
143857 : // Initialize array to the address of the first element of the STL vector
143858 : // (which is guarenteed to be contiguous storage).
143859 : // SgCAFCoExpression objectArray [] = *(Memory_Block_List.begin());
143860 194 : if (SgCAFCoExpression::pools.empty() == false)
143861 : {
143862 : // Generate an array of memory pools
143863 0 : SgCAFCoExpression** objectArray = (SgCAFCoExpression**) &(SgCAFCoExpression::pools[0]);
143864 :
143865 : // Build a local variable for better performance
143866 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
143867 :
143868 : // Iterate over the memory pools
143869 0 : for (unsigned int i=0; i < SgCAFCoExpression::pools.size(); i++)
143870 : {
143871 : // objectArray[i] is a single memory pool
143872 0 : for (unsigned j=0; j < SgCAFCoExpression::pool_size; j++)
143873 : {
143874 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
143875 : {
143876 : // printf ("Found a valid SgCAFCoExpression object in the memory pool %d at position %d \n",i,j);
143877 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
143878 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
143879 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
143880 : }
143881 : else
143882 : {
143883 : // printf ("Found a INVALID SgCAFCoExpression object in the memory pool \n");
143884 : }
143885 : }
143886 : }
143887 : }
143888 :
143889 : // This should not be required since all previously static data members are
143890 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
143891 :
143892 194 : }
143893 :
143894 : void
143895 0 : SgCAFCoExpression::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
143896 : {
143897 : // This function visits only a single IR node of the memory pool.
143898 : // it is typically called once for each type of IR node within
143899 : // the automatically generated function: traverseRepresentativeNodes().
143900 :
143901 : // Initialize array to the address of the first element of the STL vector
143902 : // (which is guarenteed to be contiguous storage).
143903 : // SgCAFCoExpression objectArray [] = *(Memory_Block_List.begin());
143904 0 : if (SgCAFCoExpression::pools.empty() == false)
143905 : {
143906 : // Generate an array of memory pools
143907 0 : SgCAFCoExpression** objectArray = (SgCAFCoExpression**) &(SgCAFCoExpression::pools[0]);
143908 :
143909 : // Build a local variable for better performance
143910 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
143911 :
143912 : // Iterate over the memory pools
143913 0 : bool done = false;
143914 0 : unsigned i=0;
143915 :
143916 : // find the first valid IR node, call visit function, and then leave
143917 0 : while ( done == false && i < SgCAFCoExpression::pools.size() )
143918 : {
143919 : // objectArray[i] is a single memory pool
143920 : unsigned j=0;
143921 0 : while (done == false && j < SgCAFCoExpression::pool_size)
143922 : {
143923 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
143924 : {
143925 0 : traversal.visit(&(objectArray[i][j]));
143926 0 : done = true;
143927 : }
143928 0 : j++;
143929 : }
143930 0 : i++;
143931 : }
143932 :
143933 : #if 0
143934 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
143935 : if (done == false)
143936 : {
143937 : printf ("No representative for SgCAFCoExpression found in memory pools \n");
143938 : }
143939 : #endif
143940 : }
143941 0 : }
143942 :
143943 :
143944 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
143945 : // using values that overflow signed values of int.
143946 : size_t
143947 4 : SgCAFCoExpression::numberOfNodes()
143948 : {
143949 : // This function traverses the memory pool for an IR node and
143950 : // counts the number of IR nodes of a particular Sage III IR
143951 : // nodes type.
143952 :
143953 4 : size_t count = 0;
143954 4 : if (SgCAFCoExpression::pools.empty() == false)
143955 : {
143956 : // Generate an array of memory pools (this is actually a STL vector,
143957 : // but it is contiguious, so OK to treat this way).
143958 0 : SgCAFCoExpression** objectArray = (SgCAFCoExpression**) &(SgCAFCoExpression::pools[0]);
143959 :
143960 : // Build a local variable for better performance (make it a loop invariant variable).
143961 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
143962 :
143963 : // Iterate over all of the memory pools for this IR node.
143964 0 : for (unsigned int i=0; i < SgCAFCoExpression::pools.size(); i++)
143965 : {
143966 : // objectArray[i] is a single memory pool, iterate over all the
143967 : // IR nodes and only count those that are valid IR nodes used in
143968 : // the AST (i.e. allocated IR nodes).
143969 0 : for (unsigned j=0; j < SgCAFCoExpression::pool_size; j++)
143970 : {
143971 : // This is indexing the STL vector of C/C++ style arrays as a doubly
143972 : // indexed array access. It is OK since we have leveraged the semantics
143973 : // of STL vector memory as contigous and cast the memory as an array
143974 : // of arrays to use the 2D array indexing. Hope this is not confusing,
143975 : // but it s very fast as an implementation.
143976 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
143977 : {
143978 0 : count++;
143979 : }
143980 : }
143981 : }
143982 : }
143983 :
143984 :
143985 :
143986 4 : return count;
143987 : }
143988 :
143989 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
143990 : // using values that overflow signed values of int.
143991 : size_t
143992 0 : SgCAFCoExpression::memoryUsage()
143993 : {
143994 : // This function is required because we need the class name as a type when we call sizeof
143995 : // There might be another way to implement this if we have a traversal that only called a
143996 : // representative object (one call for each type of Sage IIIIR node).
143997 0 : size_t memory = numberOfNodes() * sizeof(SgCAFCoExpression);
143998 :
143999 0 : return memory;
144000 : }
144001 :
144002 : /* #line 144003 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
144003 :
144004 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
144005 : void
144006 5342 : SgCudaKernelExecConfig::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
144007 : {
144008 : // This function traverses the memory pool for only a specific IR node
144009 : // and calls the visit function of the input class execute a traversal
144010 : // similar to the style of the attribute based traversals within ROSE.
144011 : // This traversal will visit ALL nodes of the AST where as the other
144012 : // attribute based traversals visit only the embedded tree within the AST.
144013 :
144014 : // Initialize array to the address of the first element of the STL vector
144015 : // (which is guaranteed to be contiguous storage).
144016 : // SgCudaKernelExecConfig objectArray [] = *(Memory_Block_List.begin());
144017 5342 : if (SgCudaKernelExecConfig::pools.empty() == false)
144018 : {
144019 : // Generate an array of memory pools
144020 0 : SgCudaKernelExecConfig** objectArray = (SgCudaKernelExecConfig**) &(SgCudaKernelExecConfig::pools[0]);
144021 :
144022 : // Build a local variable for better performance
144023 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
144024 : #if 0
144025 : // Iterate over the memory pools
144026 : for (unsigned int i=0; i < SgCudaKernelExecConfig::pools.size(); i++)
144027 : {
144028 : // objectArray[i] is a single memory pool
144029 : for (int j=0; j < SgCudaKernelExecConfig::pool_size; j++)
144030 : {
144031 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
144032 : {
144033 : traversal.visit(&(objectArray[i][j]));
144034 : }
144035 : }
144036 : }
144037 : #else
144038 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
144039 : // compute the list first and then call the visit function on each list element.
144040 :
144041 : // printf ("Inside of SgCudaKernelExecConfig::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
144042 :
144043 0 : std::vector<SgCudaKernelExecConfig*> nodeList;
144044 :
144045 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
144046 0 : for (unsigned int i=0; i < SgCudaKernelExecConfig::pools.size(); i++)
144047 : {
144048 : // objectArray[i] is a single memory pool
144049 0 : for (unsigned j=0; j < SgCudaKernelExecConfig::pool_size; j++)
144050 : {
144051 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
144052 : {
144053 0 : nodeList.push_back(&(objectArray[i][j]));
144054 : }
144055 : }
144056 : }
144057 :
144058 : // Iterate over the saved list
144059 0 : size_t nodeListSize = nodeList.size();
144060 0 : for (size_t i=0; i < nodeListSize; i++)
144061 : {
144062 0 : ROSE_ASSERT(nodeList[i] != NULL);
144063 : #if 0
144064 : traversal.visit(nodeList[i]);
144065 : #else
144066 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
144067 : {
144068 0 : traversal.visit(nodeList[i]);
144069 : }
144070 : #endif
144071 : }
144072 : #endif
144073 : }
144074 :
144075 : // This should not be required since all previously static data members are
144076 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
144077 :
144078 5342 : }
144079 :
144080 :
144081 : void
144082 194 : SgCudaKernelExecConfig::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
144083 : {
144084 : // This function traverses the memory pool for an IR node and
144085 : // calls the function to execute the visitor object.
144086 :
144087 : // Initialize array to the address of the first element of the STL vector
144088 : // (which is guarenteed to be contiguous storage).
144089 : // SgCudaKernelExecConfig objectArray [] = *(Memory_Block_List.begin());
144090 194 : if (SgCudaKernelExecConfig::pools.empty() == false)
144091 : {
144092 : // Generate an array of memory pools
144093 0 : SgCudaKernelExecConfig** objectArray = (SgCudaKernelExecConfig**) &(SgCudaKernelExecConfig::pools[0]);
144094 :
144095 : // Build a local variable for better performance
144096 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
144097 :
144098 : // Iterate over the memory pools
144099 0 : for (unsigned int i=0; i < SgCudaKernelExecConfig::pools.size(); i++)
144100 : {
144101 : // objectArray[i] is a single memory pool
144102 0 : for (unsigned j=0; j < SgCudaKernelExecConfig::pool_size; j++)
144103 : {
144104 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
144105 : {
144106 : // printf ("Found a valid SgCudaKernelExecConfig object in the memory pool %d at position %d \n",i,j);
144107 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
144108 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
144109 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
144110 : }
144111 : else
144112 : {
144113 : // printf ("Found a INVALID SgCudaKernelExecConfig object in the memory pool \n");
144114 : }
144115 : }
144116 : }
144117 : }
144118 :
144119 : // This should not be required since all previously static data members are
144120 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
144121 :
144122 194 : }
144123 :
144124 : void
144125 0 : SgCudaKernelExecConfig::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
144126 : {
144127 : // This function visits only a single IR node of the memory pool.
144128 : // it is typically called once for each type of IR node within
144129 : // the automatically generated function: traverseRepresentativeNodes().
144130 :
144131 : // Initialize array to the address of the first element of the STL vector
144132 : // (which is guarenteed to be contiguous storage).
144133 : // SgCudaKernelExecConfig objectArray [] = *(Memory_Block_List.begin());
144134 0 : if (SgCudaKernelExecConfig::pools.empty() == false)
144135 : {
144136 : // Generate an array of memory pools
144137 0 : SgCudaKernelExecConfig** objectArray = (SgCudaKernelExecConfig**) &(SgCudaKernelExecConfig::pools[0]);
144138 :
144139 : // Build a local variable for better performance
144140 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
144141 :
144142 : // Iterate over the memory pools
144143 0 : bool done = false;
144144 0 : unsigned i=0;
144145 :
144146 : // find the first valid IR node, call visit function, and then leave
144147 0 : while ( done == false && i < SgCudaKernelExecConfig::pools.size() )
144148 : {
144149 : // objectArray[i] is a single memory pool
144150 : unsigned j=0;
144151 0 : while (done == false && j < SgCudaKernelExecConfig::pool_size)
144152 : {
144153 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
144154 : {
144155 0 : traversal.visit(&(objectArray[i][j]));
144156 0 : done = true;
144157 : }
144158 0 : j++;
144159 : }
144160 0 : i++;
144161 : }
144162 :
144163 : #if 0
144164 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
144165 : if (done == false)
144166 : {
144167 : printf ("No representative for SgCudaKernelExecConfig found in memory pools \n");
144168 : }
144169 : #endif
144170 : }
144171 0 : }
144172 :
144173 :
144174 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
144175 : // using values that overflow signed values of int.
144176 : size_t
144177 4 : SgCudaKernelExecConfig::numberOfNodes()
144178 : {
144179 : // This function traverses the memory pool for an IR node and
144180 : // counts the number of IR nodes of a particular Sage III IR
144181 : // nodes type.
144182 :
144183 4 : size_t count = 0;
144184 4 : if (SgCudaKernelExecConfig::pools.empty() == false)
144185 : {
144186 : // Generate an array of memory pools (this is actually a STL vector,
144187 : // but it is contiguious, so OK to treat this way).
144188 0 : SgCudaKernelExecConfig** objectArray = (SgCudaKernelExecConfig**) &(SgCudaKernelExecConfig::pools[0]);
144189 :
144190 : // Build a local variable for better performance (make it a loop invariant variable).
144191 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
144192 :
144193 : // Iterate over all of the memory pools for this IR node.
144194 0 : for (unsigned int i=0; i < SgCudaKernelExecConfig::pools.size(); i++)
144195 : {
144196 : // objectArray[i] is a single memory pool, iterate over all the
144197 : // IR nodes and only count those that are valid IR nodes used in
144198 : // the AST (i.e. allocated IR nodes).
144199 0 : for (unsigned j=0; j < SgCudaKernelExecConfig::pool_size; j++)
144200 : {
144201 : // This is indexing the STL vector of C/C++ style arrays as a doubly
144202 : // indexed array access. It is OK since we have leveraged the semantics
144203 : // of STL vector memory as contigous and cast the memory as an array
144204 : // of arrays to use the 2D array indexing. Hope this is not confusing,
144205 : // but it s very fast as an implementation.
144206 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
144207 : {
144208 0 : count++;
144209 : }
144210 : }
144211 : }
144212 : }
144213 :
144214 :
144215 :
144216 4 : return count;
144217 : }
144218 :
144219 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
144220 : // using values that overflow signed values of int.
144221 : size_t
144222 0 : SgCudaKernelExecConfig::memoryUsage()
144223 : {
144224 : // This function is required because we need the class name as a type when we call sizeof
144225 : // There might be another way to implement this if we have a traversal that only called a
144226 : // representative object (one call for each type of Sage IIIIR node).
144227 0 : size_t memory = numberOfNodes() * sizeof(SgCudaKernelExecConfig);
144228 :
144229 0 : return memory;
144230 : }
144231 :
144232 : /* #line 144233 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
144233 :
144234 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
144235 : void
144236 5342 : SgLambdaRefExp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
144237 : {
144238 : // This function traverses the memory pool for only a specific IR node
144239 : // and calls the visit function of the input class execute a traversal
144240 : // similar to the style of the attribute based traversals within ROSE.
144241 : // This traversal will visit ALL nodes of the AST where as the other
144242 : // attribute based traversals visit only the embedded tree within the AST.
144243 :
144244 : // Initialize array to the address of the first element of the STL vector
144245 : // (which is guaranteed to be contiguous storage).
144246 : // SgLambdaRefExp objectArray [] = *(Memory_Block_List.begin());
144247 5342 : if (SgLambdaRefExp::pools.empty() == false)
144248 : {
144249 : // Generate an array of memory pools
144250 0 : SgLambdaRefExp** objectArray = (SgLambdaRefExp**) &(SgLambdaRefExp::pools[0]);
144251 :
144252 : // Build a local variable for better performance
144253 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
144254 : #if 0
144255 : // Iterate over the memory pools
144256 : for (unsigned int i=0; i < SgLambdaRefExp::pools.size(); i++)
144257 : {
144258 : // objectArray[i] is a single memory pool
144259 : for (int j=0; j < SgLambdaRefExp::pool_size; j++)
144260 : {
144261 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
144262 : {
144263 : traversal.visit(&(objectArray[i][j]));
144264 : }
144265 : }
144266 : }
144267 : #else
144268 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
144269 : // compute the list first and then call the visit function on each list element.
144270 :
144271 : // printf ("Inside of SgLambdaRefExp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
144272 :
144273 0 : std::vector<SgLambdaRefExp*> nodeList;
144274 :
144275 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
144276 0 : for (unsigned int i=0; i < SgLambdaRefExp::pools.size(); i++)
144277 : {
144278 : // objectArray[i] is a single memory pool
144279 0 : for (unsigned j=0; j < SgLambdaRefExp::pool_size; j++)
144280 : {
144281 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
144282 : {
144283 0 : nodeList.push_back(&(objectArray[i][j]));
144284 : }
144285 : }
144286 : }
144287 :
144288 : // Iterate over the saved list
144289 0 : size_t nodeListSize = nodeList.size();
144290 0 : for (size_t i=0; i < nodeListSize; i++)
144291 : {
144292 0 : ROSE_ASSERT(nodeList[i] != NULL);
144293 : #if 0
144294 : traversal.visit(nodeList[i]);
144295 : #else
144296 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
144297 : {
144298 0 : traversal.visit(nodeList[i]);
144299 : }
144300 : #endif
144301 : }
144302 : #endif
144303 : }
144304 :
144305 : // This should not be required since all previously static data members are
144306 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
144307 :
144308 5342 : }
144309 :
144310 :
144311 : void
144312 194 : SgLambdaRefExp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
144313 : {
144314 : // This function traverses the memory pool for an IR node and
144315 : // calls the function to execute the visitor object.
144316 :
144317 : // Initialize array to the address of the first element of the STL vector
144318 : // (which is guarenteed to be contiguous storage).
144319 : // SgLambdaRefExp objectArray [] = *(Memory_Block_List.begin());
144320 194 : if (SgLambdaRefExp::pools.empty() == false)
144321 : {
144322 : // Generate an array of memory pools
144323 0 : SgLambdaRefExp** objectArray = (SgLambdaRefExp**) &(SgLambdaRefExp::pools[0]);
144324 :
144325 : // Build a local variable for better performance
144326 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
144327 :
144328 : // Iterate over the memory pools
144329 0 : for (unsigned int i=0; i < SgLambdaRefExp::pools.size(); i++)
144330 : {
144331 : // objectArray[i] is a single memory pool
144332 0 : for (unsigned j=0; j < SgLambdaRefExp::pool_size; j++)
144333 : {
144334 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
144335 : {
144336 : // printf ("Found a valid SgLambdaRefExp object in the memory pool %d at position %d \n",i,j);
144337 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
144338 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
144339 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
144340 : }
144341 : else
144342 : {
144343 : // printf ("Found a INVALID SgLambdaRefExp object in the memory pool \n");
144344 : }
144345 : }
144346 : }
144347 : }
144348 :
144349 : // This should not be required since all previously static data members are
144350 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
144351 :
144352 194 : }
144353 :
144354 : void
144355 0 : SgLambdaRefExp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
144356 : {
144357 : // This function visits only a single IR node of the memory pool.
144358 : // it is typically called once for each type of IR node within
144359 : // the automatically generated function: traverseRepresentativeNodes().
144360 :
144361 : // Initialize array to the address of the first element of the STL vector
144362 : // (which is guarenteed to be contiguous storage).
144363 : // SgLambdaRefExp objectArray [] = *(Memory_Block_List.begin());
144364 0 : if (SgLambdaRefExp::pools.empty() == false)
144365 : {
144366 : // Generate an array of memory pools
144367 0 : SgLambdaRefExp** objectArray = (SgLambdaRefExp**) &(SgLambdaRefExp::pools[0]);
144368 :
144369 : // Build a local variable for better performance
144370 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
144371 :
144372 : // Iterate over the memory pools
144373 0 : bool done = false;
144374 0 : unsigned i=0;
144375 :
144376 : // find the first valid IR node, call visit function, and then leave
144377 0 : while ( done == false && i < SgLambdaRefExp::pools.size() )
144378 : {
144379 : // objectArray[i] is a single memory pool
144380 : unsigned j=0;
144381 0 : while (done == false && j < SgLambdaRefExp::pool_size)
144382 : {
144383 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
144384 : {
144385 0 : traversal.visit(&(objectArray[i][j]));
144386 0 : done = true;
144387 : }
144388 0 : j++;
144389 : }
144390 0 : i++;
144391 : }
144392 :
144393 : #if 0
144394 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
144395 : if (done == false)
144396 : {
144397 : printf ("No representative for SgLambdaRefExp found in memory pools \n");
144398 : }
144399 : #endif
144400 : }
144401 0 : }
144402 :
144403 :
144404 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
144405 : // using values that overflow signed values of int.
144406 : size_t
144407 4 : SgLambdaRefExp::numberOfNodes()
144408 : {
144409 : // This function traverses the memory pool for an IR node and
144410 : // counts the number of IR nodes of a particular Sage III IR
144411 : // nodes type.
144412 :
144413 4 : size_t count = 0;
144414 4 : if (SgLambdaRefExp::pools.empty() == false)
144415 : {
144416 : // Generate an array of memory pools (this is actually a STL vector,
144417 : // but it is contiguious, so OK to treat this way).
144418 0 : SgLambdaRefExp** objectArray = (SgLambdaRefExp**) &(SgLambdaRefExp::pools[0]);
144419 :
144420 : // Build a local variable for better performance (make it a loop invariant variable).
144421 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
144422 :
144423 : // Iterate over all of the memory pools for this IR node.
144424 0 : for (unsigned int i=0; i < SgLambdaRefExp::pools.size(); i++)
144425 : {
144426 : // objectArray[i] is a single memory pool, iterate over all the
144427 : // IR nodes and only count those that are valid IR nodes used in
144428 : // the AST (i.e. allocated IR nodes).
144429 0 : for (unsigned j=0; j < SgLambdaRefExp::pool_size; j++)
144430 : {
144431 : // This is indexing the STL vector of C/C++ style arrays as a doubly
144432 : // indexed array access. It is OK since we have leveraged the semantics
144433 : // of STL vector memory as contigous and cast the memory as an array
144434 : // of arrays to use the 2D array indexing. Hope this is not confusing,
144435 : // but it s very fast as an implementation.
144436 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
144437 : {
144438 0 : count++;
144439 : }
144440 : }
144441 : }
144442 : }
144443 :
144444 :
144445 :
144446 4 : return count;
144447 : }
144448 :
144449 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
144450 : // using values that overflow signed values of int.
144451 : size_t
144452 0 : SgLambdaRefExp::memoryUsage()
144453 : {
144454 : // This function is required because we need the class name as a type when we call sizeof
144455 : // There might be another way to implement this if we have a traversal that only called a
144456 : // representative object (one call for each type of Sage IIIIR node).
144457 0 : size_t memory = numberOfNodes() * sizeof(SgLambdaRefExp);
144458 :
144459 0 : return memory;
144460 : }
144461 :
144462 : /* #line 144463 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
144463 :
144464 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
144465 : void
144466 5342 : SgDictionaryExp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
144467 : {
144468 : // This function traverses the memory pool for only a specific IR node
144469 : // and calls the visit function of the input class execute a traversal
144470 : // similar to the style of the attribute based traversals within ROSE.
144471 : // This traversal will visit ALL nodes of the AST where as the other
144472 : // attribute based traversals visit only the embedded tree within the AST.
144473 :
144474 : // Initialize array to the address of the first element of the STL vector
144475 : // (which is guaranteed to be contiguous storage).
144476 : // SgDictionaryExp objectArray [] = *(Memory_Block_List.begin());
144477 5342 : if (SgDictionaryExp::pools.empty() == false)
144478 : {
144479 : // Generate an array of memory pools
144480 0 : SgDictionaryExp** objectArray = (SgDictionaryExp**) &(SgDictionaryExp::pools[0]);
144481 :
144482 : // Build a local variable for better performance
144483 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
144484 : #if 0
144485 : // Iterate over the memory pools
144486 : for (unsigned int i=0; i < SgDictionaryExp::pools.size(); i++)
144487 : {
144488 : // objectArray[i] is a single memory pool
144489 : for (int j=0; j < SgDictionaryExp::pool_size; j++)
144490 : {
144491 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
144492 : {
144493 : traversal.visit(&(objectArray[i][j]));
144494 : }
144495 : }
144496 : }
144497 : #else
144498 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
144499 : // compute the list first and then call the visit function on each list element.
144500 :
144501 : // printf ("Inside of SgDictionaryExp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
144502 :
144503 0 : std::vector<SgDictionaryExp*> nodeList;
144504 :
144505 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
144506 0 : for (unsigned int i=0; i < SgDictionaryExp::pools.size(); i++)
144507 : {
144508 : // objectArray[i] is a single memory pool
144509 0 : for (unsigned j=0; j < SgDictionaryExp::pool_size; j++)
144510 : {
144511 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
144512 : {
144513 0 : nodeList.push_back(&(objectArray[i][j]));
144514 : }
144515 : }
144516 : }
144517 :
144518 : // Iterate over the saved list
144519 0 : size_t nodeListSize = nodeList.size();
144520 0 : for (size_t i=0; i < nodeListSize; i++)
144521 : {
144522 0 : ROSE_ASSERT(nodeList[i] != NULL);
144523 : #if 0
144524 : traversal.visit(nodeList[i]);
144525 : #else
144526 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
144527 : {
144528 0 : traversal.visit(nodeList[i]);
144529 : }
144530 : #endif
144531 : }
144532 : #endif
144533 : }
144534 :
144535 : // This should not be required since all previously static data members are
144536 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
144537 :
144538 5342 : }
144539 :
144540 :
144541 : void
144542 194 : SgDictionaryExp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
144543 : {
144544 : // This function traverses the memory pool for an IR node and
144545 : // calls the function to execute the visitor object.
144546 :
144547 : // Initialize array to the address of the first element of the STL vector
144548 : // (which is guarenteed to be contiguous storage).
144549 : // SgDictionaryExp objectArray [] = *(Memory_Block_List.begin());
144550 194 : if (SgDictionaryExp::pools.empty() == false)
144551 : {
144552 : // Generate an array of memory pools
144553 0 : SgDictionaryExp** objectArray = (SgDictionaryExp**) &(SgDictionaryExp::pools[0]);
144554 :
144555 : // Build a local variable for better performance
144556 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
144557 :
144558 : // Iterate over the memory pools
144559 0 : for (unsigned int i=0; i < SgDictionaryExp::pools.size(); i++)
144560 : {
144561 : // objectArray[i] is a single memory pool
144562 0 : for (unsigned j=0; j < SgDictionaryExp::pool_size; j++)
144563 : {
144564 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
144565 : {
144566 : // printf ("Found a valid SgDictionaryExp object in the memory pool %d at position %d \n",i,j);
144567 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
144568 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
144569 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
144570 : }
144571 : else
144572 : {
144573 : // printf ("Found a INVALID SgDictionaryExp object in the memory pool \n");
144574 : }
144575 : }
144576 : }
144577 : }
144578 :
144579 : // This should not be required since all previously static data members are
144580 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
144581 :
144582 194 : }
144583 :
144584 : void
144585 0 : SgDictionaryExp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
144586 : {
144587 : // This function visits only a single IR node of the memory pool.
144588 : // it is typically called once for each type of IR node within
144589 : // the automatically generated function: traverseRepresentativeNodes().
144590 :
144591 : // Initialize array to the address of the first element of the STL vector
144592 : // (which is guarenteed to be contiguous storage).
144593 : // SgDictionaryExp objectArray [] = *(Memory_Block_List.begin());
144594 0 : if (SgDictionaryExp::pools.empty() == false)
144595 : {
144596 : // Generate an array of memory pools
144597 0 : SgDictionaryExp** objectArray = (SgDictionaryExp**) &(SgDictionaryExp::pools[0]);
144598 :
144599 : // Build a local variable for better performance
144600 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
144601 :
144602 : // Iterate over the memory pools
144603 0 : bool done = false;
144604 0 : unsigned i=0;
144605 :
144606 : // find the first valid IR node, call visit function, and then leave
144607 0 : while ( done == false && i < SgDictionaryExp::pools.size() )
144608 : {
144609 : // objectArray[i] is a single memory pool
144610 : unsigned j=0;
144611 0 : while (done == false && j < SgDictionaryExp::pool_size)
144612 : {
144613 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
144614 : {
144615 0 : traversal.visit(&(objectArray[i][j]));
144616 0 : done = true;
144617 : }
144618 0 : j++;
144619 : }
144620 0 : i++;
144621 : }
144622 :
144623 : #if 0
144624 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
144625 : if (done == false)
144626 : {
144627 : printf ("No representative for SgDictionaryExp found in memory pools \n");
144628 : }
144629 : #endif
144630 : }
144631 0 : }
144632 :
144633 :
144634 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
144635 : // using values that overflow signed values of int.
144636 : size_t
144637 4 : SgDictionaryExp::numberOfNodes()
144638 : {
144639 : // This function traverses the memory pool for an IR node and
144640 : // counts the number of IR nodes of a particular Sage III IR
144641 : // nodes type.
144642 :
144643 4 : size_t count = 0;
144644 4 : if (SgDictionaryExp::pools.empty() == false)
144645 : {
144646 : // Generate an array of memory pools (this is actually a STL vector,
144647 : // but it is contiguious, so OK to treat this way).
144648 0 : SgDictionaryExp** objectArray = (SgDictionaryExp**) &(SgDictionaryExp::pools[0]);
144649 :
144650 : // Build a local variable for better performance (make it a loop invariant variable).
144651 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
144652 :
144653 : // Iterate over all of the memory pools for this IR node.
144654 0 : for (unsigned int i=0; i < SgDictionaryExp::pools.size(); i++)
144655 : {
144656 : // objectArray[i] is a single memory pool, iterate over all the
144657 : // IR nodes and only count those that are valid IR nodes used in
144658 : // the AST (i.e. allocated IR nodes).
144659 0 : for (unsigned j=0; j < SgDictionaryExp::pool_size; j++)
144660 : {
144661 : // This is indexing the STL vector of C/C++ style arrays as a doubly
144662 : // indexed array access. It is OK since we have leveraged the semantics
144663 : // of STL vector memory as contigous and cast the memory as an array
144664 : // of arrays to use the 2D array indexing. Hope this is not confusing,
144665 : // but it s very fast as an implementation.
144666 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
144667 : {
144668 0 : count++;
144669 : }
144670 : }
144671 : }
144672 : }
144673 :
144674 :
144675 :
144676 4 : return count;
144677 : }
144678 :
144679 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
144680 : // using values that overflow signed values of int.
144681 : size_t
144682 0 : SgDictionaryExp::memoryUsage()
144683 : {
144684 : // This function is required because we need the class name as a type when we call sizeof
144685 : // There might be another way to implement this if we have a traversal that only called a
144686 : // representative object (one call for each type of Sage IIIIR node).
144687 0 : size_t memory = numberOfNodes() * sizeof(SgDictionaryExp);
144688 :
144689 0 : return memory;
144690 : }
144691 :
144692 : /* #line 144693 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
144693 :
144694 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
144695 : void
144696 5342 : SgKeyDatumPair::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
144697 : {
144698 : // This function traverses the memory pool for only a specific IR node
144699 : // and calls the visit function of the input class execute a traversal
144700 : // similar to the style of the attribute based traversals within ROSE.
144701 : // This traversal will visit ALL nodes of the AST where as the other
144702 : // attribute based traversals visit only the embedded tree within the AST.
144703 :
144704 : // Initialize array to the address of the first element of the STL vector
144705 : // (which is guaranteed to be contiguous storage).
144706 : // SgKeyDatumPair objectArray [] = *(Memory_Block_List.begin());
144707 5342 : if (SgKeyDatumPair::pools.empty() == false)
144708 : {
144709 : // Generate an array of memory pools
144710 0 : SgKeyDatumPair** objectArray = (SgKeyDatumPair**) &(SgKeyDatumPair::pools[0]);
144711 :
144712 : // Build a local variable for better performance
144713 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
144714 : #if 0
144715 : // Iterate over the memory pools
144716 : for (unsigned int i=0; i < SgKeyDatumPair::pools.size(); i++)
144717 : {
144718 : // objectArray[i] is a single memory pool
144719 : for (int j=0; j < SgKeyDatumPair::pool_size; j++)
144720 : {
144721 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
144722 : {
144723 : traversal.visit(&(objectArray[i][j]));
144724 : }
144725 : }
144726 : }
144727 : #else
144728 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
144729 : // compute the list first and then call the visit function on each list element.
144730 :
144731 : // printf ("Inside of SgKeyDatumPair::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
144732 :
144733 0 : std::vector<SgKeyDatumPair*> nodeList;
144734 :
144735 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
144736 0 : for (unsigned int i=0; i < SgKeyDatumPair::pools.size(); i++)
144737 : {
144738 : // objectArray[i] is a single memory pool
144739 0 : for (unsigned j=0; j < SgKeyDatumPair::pool_size; j++)
144740 : {
144741 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
144742 : {
144743 0 : nodeList.push_back(&(objectArray[i][j]));
144744 : }
144745 : }
144746 : }
144747 :
144748 : // Iterate over the saved list
144749 0 : size_t nodeListSize = nodeList.size();
144750 0 : for (size_t i=0; i < nodeListSize; i++)
144751 : {
144752 0 : ROSE_ASSERT(nodeList[i] != NULL);
144753 : #if 0
144754 : traversal.visit(nodeList[i]);
144755 : #else
144756 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
144757 : {
144758 0 : traversal.visit(nodeList[i]);
144759 : }
144760 : #endif
144761 : }
144762 : #endif
144763 : }
144764 :
144765 : // This should not be required since all previously static data members are
144766 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
144767 :
144768 5342 : }
144769 :
144770 :
144771 : void
144772 194 : SgKeyDatumPair::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
144773 : {
144774 : // This function traverses the memory pool for an IR node and
144775 : // calls the function to execute the visitor object.
144776 :
144777 : // Initialize array to the address of the first element of the STL vector
144778 : // (which is guarenteed to be contiguous storage).
144779 : // SgKeyDatumPair objectArray [] = *(Memory_Block_List.begin());
144780 194 : if (SgKeyDatumPair::pools.empty() == false)
144781 : {
144782 : // Generate an array of memory pools
144783 0 : SgKeyDatumPair** objectArray = (SgKeyDatumPair**) &(SgKeyDatumPair::pools[0]);
144784 :
144785 : // Build a local variable for better performance
144786 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
144787 :
144788 : // Iterate over the memory pools
144789 0 : for (unsigned int i=0; i < SgKeyDatumPair::pools.size(); i++)
144790 : {
144791 : // objectArray[i] is a single memory pool
144792 0 : for (unsigned j=0; j < SgKeyDatumPair::pool_size; j++)
144793 : {
144794 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
144795 : {
144796 : // printf ("Found a valid SgKeyDatumPair object in the memory pool %d at position %d \n",i,j);
144797 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
144798 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
144799 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
144800 : }
144801 : else
144802 : {
144803 : // printf ("Found a INVALID SgKeyDatumPair object in the memory pool \n");
144804 : }
144805 : }
144806 : }
144807 : }
144808 :
144809 : // This should not be required since all previously static data members are
144810 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
144811 :
144812 194 : }
144813 :
144814 : void
144815 0 : SgKeyDatumPair::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
144816 : {
144817 : // This function visits only a single IR node of the memory pool.
144818 : // it is typically called once for each type of IR node within
144819 : // the automatically generated function: traverseRepresentativeNodes().
144820 :
144821 : // Initialize array to the address of the first element of the STL vector
144822 : // (which is guarenteed to be contiguous storage).
144823 : // SgKeyDatumPair objectArray [] = *(Memory_Block_List.begin());
144824 0 : if (SgKeyDatumPair::pools.empty() == false)
144825 : {
144826 : // Generate an array of memory pools
144827 0 : SgKeyDatumPair** objectArray = (SgKeyDatumPair**) &(SgKeyDatumPair::pools[0]);
144828 :
144829 : // Build a local variable for better performance
144830 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
144831 :
144832 : // Iterate over the memory pools
144833 0 : bool done = false;
144834 0 : unsigned i=0;
144835 :
144836 : // find the first valid IR node, call visit function, and then leave
144837 0 : while ( done == false && i < SgKeyDatumPair::pools.size() )
144838 : {
144839 : // objectArray[i] is a single memory pool
144840 : unsigned j=0;
144841 0 : while (done == false && j < SgKeyDatumPair::pool_size)
144842 : {
144843 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
144844 : {
144845 0 : traversal.visit(&(objectArray[i][j]));
144846 0 : done = true;
144847 : }
144848 0 : j++;
144849 : }
144850 0 : i++;
144851 : }
144852 :
144853 : #if 0
144854 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
144855 : if (done == false)
144856 : {
144857 : printf ("No representative for SgKeyDatumPair found in memory pools \n");
144858 : }
144859 : #endif
144860 : }
144861 0 : }
144862 :
144863 :
144864 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
144865 : // using values that overflow signed values of int.
144866 : size_t
144867 4 : SgKeyDatumPair::numberOfNodes()
144868 : {
144869 : // This function traverses the memory pool for an IR node and
144870 : // counts the number of IR nodes of a particular Sage III IR
144871 : // nodes type.
144872 :
144873 4 : size_t count = 0;
144874 4 : if (SgKeyDatumPair::pools.empty() == false)
144875 : {
144876 : // Generate an array of memory pools (this is actually a STL vector,
144877 : // but it is contiguious, so OK to treat this way).
144878 0 : SgKeyDatumPair** objectArray = (SgKeyDatumPair**) &(SgKeyDatumPair::pools[0]);
144879 :
144880 : // Build a local variable for better performance (make it a loop invariant variable).
144881 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
144882 :
144883 : // Iterate over all of the memory pools for this IR node.
144884 0 : for (unsigned int i=0; i < SgKeyDatumPair::pools.size(); i++)
144885 : {
144886 : // objectArray[i] is a single memory pool, iterate over all the
144887 : // IR nodes and only count those that are valid IR nodes used in
144888 : // the AST (i.e. allocated IR nodes).
144889 0 : for (unsigned j=0; j < SgKeyDatumPair::pool_size; j++)
144890 : {
144891 : // This is indexing the STL vector of C/C++ style arrays as a doubly
144892 : // indexed array access. It is OK since we have leveraged the semantics
144893 : // of STL vector memory as contigous and cast the memory as an array
144894 : // of arrays to use the 2D array indexing. Hope this is not confusing,
144895 : // but it s very fast as an implementation.
144896 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
144897 : {
144898 0 : count++;
144899 : }
144900 : }
144901 : }
144902 : }
144903 :
144904 :
144905 :
144906 4 : return count;
144907 : }
144908 :
144909 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
144910 : // using values that overflow signed values of int.
144911 : size_t
144912 0 : SgKeyDatumPair::memoryUsage()
144913 : {
144914 : // This function is required because we need the class name as a type when we call sizeof
144915 : // There might be another way to implement this if we have a traversal that only called a
144916 : // representative object (one call for each type of Sage IIIIR node).
144917 0 : size_t memory = numberOfNodes() * sizeof(SgKeyDatumPair);
144918 :
144919 0 : return memory;
144920 : }
144921 :
144922 : /* #line 144923 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
144923 :
144924 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
144925 : void
144926 5342 : SgComprehension::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
144927 : {
144928 : // This function traverses the memory pool for only a specific IR node
144929 : // and calls the visit function of the input class execute a traversal
144930 : // similar to the style of the attribute based traversals within ROSE.
144931 : // This traversal will visit ALL nodes of the AST where as the other
144932 : // attribute based traversals visit only the embedded tree within the AST.
144933 :
144934 : // Initialize array to the address of the first element of the STL vector
144935 : // (which is guaranteed to be contiguous storage).
144936 : // SgComprehension objectArray [] = *(Memory_Block_List.begin());
144937 5342 : if (SgComprehension::pools.empty() == false)
144938 : {
144939 : // Generate an array of memory pools
144940 0 : SgComprehension** objectArray = (SgComprehension**) &(SgComprehension::pools[0]);
144941 :
144942 : // Build a local variable for better performance
144943 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
144944 : #if 0
144945 : // Iterate over the memory pools
144946 : for (unsigned int i=0; i < SgComprehension::pools.size(); i++)
144947 : {
144948 : // objectArray[i] is a single memory pool
144949 : for (int j=0; j < SgComprehension::pool_size; j++)
144950 : {
144951 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
144952 : {
144953 : traversal.visit(&(objectArray[i][j]));
144954 : }
144955 : }
144956 : }
144957 : #else
144958 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
144959 : // compute the list first and then call the visit function on each list element.
144960 :
144961 : // printf ("Inside of SgComprehension::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
144962 :
144963 0 : std::vector<SgComprehension*> nodeList;
144964 :
144965 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
144966 0 : for (unsigned int i=0; i < SgComprehension::pools.size(); i++)
144967 : {
144968 : // objectArray[i] is a single memory pool
144969 0 : for (unsigned j=0; j < SgComprehension::pool_size; j++)
144970 : {
144971 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
144972 : {
144973 0 : nodeList.push_back(&(objectArray[i][j]));
144974 : }
144975 : }
144976 : }
144977 :
144978 : // Iterate over the saved list
144979 0 : size_t nodeListSize = nodeList.size();
144980 0 : for (size_t i=0; i < nodeListSize; i++)
144981 : {
144982 0 : ROSE_ASSERT(nodeList[i] != NULL);
144983 : #if 0
144984 : traversal.visit(nodeList[i]);
144985 : #else
144986 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
144987 : {
144988 0 : traversal.visit(nodeList[i]);
144989 : }
144990 : #endif
144991 : }
144992 : #endif
144993 : }
144994 :
144995 : // This should not be required since all previously static data members are
144996 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
144997 :
144998 5342 : }
144999 :
145000 :
145001 : void
145002 194 : SgComprehension::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
145003 : {
145004 : // This function traverses the memory pool for an IR node and
145005 : // calls the function to execute the visitor object.
145006 :
145007 : // Initialize array to the address of the first element of the STL vector
145008 : // (which is guarenteed to be contiguous storage).
145009 : // SgComprehension objectArray [] = *(Memory_Block_List.begin());
145010 194 : if (SgComprehension::pools.empty() == false)
145011 : {
145012 : // Generate an array of memory pools
145013 0 : SgComprehension** objectArray = (SgComprehension**) &(SgComprehension::pools[0]);
145014 :
145015 : // Build a local variable for better performance
145016 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
145017 :
145018 : // Iterate over the memory pools
145019 0 : for (unsigned int i=0; i < SgComprehension::pools.size(); i++)
145020 : {
145021 : // objectArray[i] is a single memory pool
145022 0 : for (unsigned j=0; j < SgComprehension::pool_size; j++)
145023 : {
145024 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
145025 : {
145026 : // printf ("Found a valid SgComprehension object in the memory pool %d at position %d \n",i,j);
145027 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
145028 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
145029 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
145030 : }
145031 : else
145032 : {
145033 : // printf ("Found a INVALID SgComprehension object in the memory pool \n");
145034 : }
145035 : }
145036 : }
145037 : }
145038 :
145039 : // This should not be required since all previously static data members are
145040 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
145041 :
145042 194 : }
145043 :
145044 : void
145045 0 : SgComprehension::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
145046 : {
145047 : // This function visits only a single IR node of the memory pool.
145048 : // it is typically called once for each type of IR node within
145049 : // the automatically generated function: traverseRepresentativeNodes().
145050 :
145051 : // Initialize array to the address of the first element of the STL vector
145052 : // (which is guarenteed to be contiguous storage).
145053 : // SgComprehension objectArray [] = *(Memory_Block_List.begin());
145054 0 : if (SgComprehension::pools.empty() == false)
145055 : {
145056 : // Generate an array of memory pools
145057 0 : SgComprehension** objectArray = (SgComprehension**) &(SgComprehension::pools[0]);
145058 :
145059 : // Build a local variable for better performance
145060 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
145061 :
145062 : // Iterate over the memory pools
145063 0 : bool done = false;
145064 0 : unsigned i=0;
145065 :
145066 : // find the first valid IR node, call visit function, and then leave
145067 0 : while ( done == false && i < SgComprehension::pools.size() )
145068 : {
145069 : // objectArray[i] is a single memory pool
145070 : unsigned j=0;
145071 0 : while (done == false && j < SgComprehension::pool_size)
145072 : {
145073 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
145074 : {
145075 0 : traversal.visit(&(objectArray[i][j]));
145076 0 : done = true;
145077 : }
145078 0 : j++;
145079 : }
145080 0 : i++;
145081 : }
145082 :
145083 : #if 0
145084 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
145085 : if (done == false)
145086 : {
145087 : printf ("No representative for SgComprehension found in memory pools \n");
145088 : }
145089 : #endif
145090 : }
145091 0 : }
145092 :
145093 :
145094 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
145095 : // using values that overflow signed values of int.
145096 : size_t
145097 4 : SgComprehension::numberOfNodes()
145098 : {
145099 : // This function traverses the memory pool for an IR node and
145100 : // counts the number of IR nodes of a particular Sage III IR
145101 : // nodes type.
145102 :
145103 4 : size_t count = 0;
145104 4 : if (SgComprehension::pools.empty() == false)
145105 : {
145106 : // Generate an array of memory pools (this is actually a STL vector,
145107 : // but it is contiguious, so OK to treat this way).
145108 0 : SgComprehension** objectArray = (SgComprehension**) &(SgComprehension::pools[0]);
145109 :
145110 : // Build a local variable for better performance (make it a loop invariant variable).
145111 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
145112 :
145113 : // Iterate over all of the memory pools for this IR node.
145114 0 : for (unsigned int i=0; i < SgComprehension::pools.size(); i++)
145115 : {
145116 : // objectArray[i] is a single memory pool, iterate over all the
145117 : // IR nodes and only count those that are valid IR nodes used in
145118 : // the AST (i.e. allocated IR nodes).
145119 0 : for (unsigned j=0; j < SgComprehension::pool_size; j++)
145120 : {
145121 : // This is indexing the STL vector of C/C++ style arrays as a doubly
145122 : // indexed array access. It is OK since we have leveraged the semantics
145123 : // of STL vector memory as contigous and cast the memory as an array
145124 : // of arrays to use the 2D array indexing. Hope this is not confusing,
145125 : // but it s very fast as an implementation.
145126 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
145127 : {
145128 0 : count++;
145129 : }
145130 : }
145131 : }
145132 : }
145133 :
145134 :
145135 :
145136 4 : return count;
145137 : }
145138 :
145139 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
145140 : // using values that overflow signed values of int.
145141 : size_t
145142 0 : SgComprehension::memoryUsage()
145143 : {
145144 : // This function is required because we need the class name as a type when we call sizeof
145145 : // There might be another way to implement this if we have a traversal that only called a
145146 : // representative object (one call for each type of Sage IIIIR node).
145147 0 : size_t memory = numberOfNodes() * sizeof(SgComprehension);
145148 :
145149 0 : return memory;
145150 : }
145151 :
145152 : /* #line 145153 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
145153 :
145154 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
145155 : void
145156 5342 : SgListComprehension::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
145157 : {
145158 : // This function traverses the memory pool for only a specific IR node
145159 : // and calls the visit function of the input class execute a traversal
145160 : // similar to the style of the attribute based traversals within ROSE.
145161 : // This traversal will visit ALL nodes of the AST where as the other
145162 : // attribute based traversals visit only the embedded tree within the AST.
145163 :
145164 : // Initialize array to the address of the first element of the STL vector
145165 : // (which is guaranteed to be contiguous storage).
145166 : // SgListComprehension objectArray [] = *(Memory_Block_List.begin());
145167 5342 : if (SgListComprehension::pools.empty() == false)
145168 : {
145169 : // Generate an array of memory pools
145170 0 : SgListComprehension** objectArray = (SgListComprehension**) &(SgListComprehension::pools[0]);
145171 :
145172 : // Build a local variable for better performance
145173 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
145174 : #if 0
145175 : // Iterate over the memory pools
145176 : for (unsigned int i=0; i < SgListComprehension::pools.size(); i++)
145177 : {
145178 : // objectArray[i] is a single memory pool
145179 : for (int j=0; j < SgListComprehension::pool_size; j++)
145180 : {
145181 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
145182 : {
145183 : traversal.visit(&(objectArray[i][j]));
145184 : }
145185 : }
145186 : }
145187 : #else
145188 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
145189 : // compute the list first and then call the visit function on each list element.
145190 :
145191 : // printf ("Inside of SgListComprehension::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
145192 :
145193 0 : std::vector<SgListComprehension*> nodeList;
145194 :
145195 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
145196 0 : for (unsigned int i=0; i < SgListComprehension::pools.size(); i++)
145197 : {
145198 : // objectArray[i] is a single memory pool
145199 0 : for (unsigned j=0; j < SgListComprehension::pool_size; j++)
145200 : {
145201 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
145202 : {
145203 0 : nodeList.push_back(&(objectArray[i][j]));
145204 : }
145205 : }
145206 : }
145207 :
145208 : // Iterate over the saved list
145209 0 : size_t nodeListSize = nodeList.size();
145210 0 : for (size_t i=0; i < nodeListSize; i++)
145211 : {
145212 0 : ROSE_ASSERT(nodeList[i] != NULL);
145213 : #if 0
145214 : traversal.visit(nodeList[i]);
145215 : #else
145216 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
145217 : {
145218 0 : traversal.visit(nodeList[i]);
145219 : }
145220 : #endif
145221 : }
145222 : #endif
145223 : }
145224 :
145225 : // This should not be required since all previously static data members are
145226 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
145227 :
145228 5342 : }
145229 :
145230 :
145231 : void
145232 194 : SgListComprehension::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
145233 : {
145234 : // This function traverses the memory pool for an IR node and
145235 : // calls the function to execute the visitor object.
145236 :
145237 : // Initialize array to the address of the first element of the STL vector
145238 : // (which is guarenteed to be contiguous storage).
145239 : // SgListComprehension objectArray [] = *(Memory_Block_List.begin());
145240 194 : if (SgListComprehension::pools.empty() == false)
145241 : {
145242 : // Generate an array of memory pools
145243 0 : SgListComprehension** objectArray = (SgListComprehension**) &(SgListComprehension::pools[0]);
145244 :
145245 : // Build a local variable for better performance
145246 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
145247 :
145248 : // Iterate over the memory pools
145249 0 : for (unsigned int i=0; i < SgListComprehension::pools.size(); i++)
145250 : {
145251 : // objectArray[i] is a single memory pool
145252 0 : for (unsigned j=0; j < SgListComprehension::pool_size; j++)
145253 : {
145254 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
145255 : {
145256 : // printf ("Found a valid SgListComprehension object in the memory pool %d at position %d \n",i,j);
145257 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
145258 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
145259 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
145260 : }
145261 : else
145262 : {
145263 : // printf ("Found a INVALID SgListComprehension object in the memory pool \n");
145264 : }
145265 : }
145266 : }
145267 : }
145268 :
145269 : // This should not be required since all previously static data members are
145270 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
145271 :
145272 194 : }
145273 :
145274 : void
145275 0 : SgListComprehension::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
145276 : {
145277 : // This function visits only a single IR node of the memory pool.
145278 : // it is typically called once for each type of IR node within
145279 : // the automatically generated function: traverseRepresentativeNodes().
145280 :
145281 : // Initialize array to the address of the first element of the STL vector
145282 : // (which is guarenteed to be contiguous storage).
145283 : // SgListComprehension objectArray [] = *(Memory_Block_List.begin());
145284 0 : if (SgListComprehension::pools.empty() == false)
145285 : {
145286 : // Generate an array of memory pools
145287 0 : SgListComprehension** objectArray = (SgListComprehension**) &(SgListComprehension::pools[0]);
145288 :
145289 : // Build a local variable for better performance
145290 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
145291 :
145292 : // Iterate over the memory pools
145293 0 : bool done = false;
145294 0 : unsigned i=0;
145295 :
145296 : // find the first valid IR node, call visit function, and then leave
145297 0 : while ( done == false && i < SgListComprehension::pools.size() )
145298 : {
145299 : // objectArray[i] is a single memory pool
145300 : unsigned j=0;
145301 0 : while (done == false && j < SgListComprehension::pool_size)
145302 : {
145303 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
145304 : {
145305 0 : traversal.visit(&(objectArray[i][j]));
145306 0 : done = true;
145307 : }
145308 0 : j++;
145309 : }
145310 0 : i++;
145311 : }
145312 :
145313 : #if 0
145314 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
145315 : if (done == false)
145316 : {
145317 : printf ("No representative for SgListComprehension found in memory pools \n");
145318 : }
145319 : #endif
145320 : }
145321 0 : }
145322 :
145323 :
145324 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
145325 : // using values that overflow signed values of int.
145326 : size_t
145327 4 : SgListComprehension::numberOfNodes()
145328 : {
145329 : // This function traverses the memory pool for an IR node and
145330 : // counts the number of IR nodes of a particular Sage III IR
145331 : // nodes type.
145332 :
145333 4 : size_t count = 0;
145334 4 : if (SgListComprehension::pools.empty() == false)
145335 : {
145336 : // Generate an array of memory pools (this is actually a STL vector,
145337 : // but it is contiguious, so OK to treat this way).
145338 0 : SgListComprehension** objectArray = (SgListComprehension**) &(SgListComprehension::pools[0]);
145339 :
145340 : // Build a local variable for better performance (make it a loop invariant variable).
145341 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
145342 :
145343 : // Iterate over all of the memory pools for this IR node.
145344 0 : for (unsigned int i=0; i < SgListComprehension::pools.size(); i++)
145345 : {
145346 : // objectArray[i] is a single memory pool, iterate over all the
145347 : // IR nodes and only count those that are valid IR nodes used in
145348 : // the AST (i.e. allocated IR nodes).
145349 0 : for (unsigned j=0; j < SgListComprehension::pool_size; j++)
145350 : {
145351 : // This is indexing the STL vector of C/C++ style arrays as a doubly
145352 : // indexed array access. It is OK since we have leveraged the semantics
145353 : // of STL vector memory as contigous and cast the memory as an array
145354 : // of arrays to use the 2D array indexing. Hope this is not confusing,
145355 : // but it s very fast as an implementation.
145356 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
145357 : {
145358 0 : count++;
145359 : }
145360 : }
145361 : }
145362 : }
145363 :
145364 :
145365 :
145366 4 : return count;
145367 : }
145368 :
145369 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
145370 : // using values that overflow signed values of int.
145371 : size_t
145372 0 : SgListComprehension::memoryUsage()
145373 : {
145374 : // This function is required because we need the class name as a type when we call sizeof
145375 : // There might be another way to implement this if we have a traversal that only called a
145376 : // representative object (one call for each type of Sage IIIIR node).
145377 0 : size_t memory = numberOfNodes() * sizeof(SgListComprehension);
145378 :
145379 0 : return memory;
145380 : }
145381 :
145382 : /* #line 145383 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
145383 :
145384 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
145385 : void
145386 5342 : SgSetComprehension::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
145387 : {
145388 : // This function traverses the memory pool for only a specific IR node
145389 : // and calls the visit function of the input class execute a traversal
145390 : // similar to the style of the attribute based traversals within ROSE.
145391 : // This traversal will visit ALL nodes of the AST where as the other
145392 : // attribute based traversals visit only the embedded tree within the AST.
145393 :
145394 : // Initialize array to the address of the first element of the STL vector
145395 : // (which is guaranteed to be contiguous storage).
145396 : // SgSetComprehension objectArray [] = *(Memory_Block_List.begin());
145397 5342 : if (SgSetComprehension::pools.empty() == false)
145398 : {
145399 : // Generate an array of memory pools
145400 0 : SgSetComprehension** objectArray = (SgSetComprehension**) &(SgSetComprehension::pools[0]);
145401 :
145402 : // Build a local variable for better performance
145403 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
145404 : #if 0
145405 : // Iterate over the memory pools
145406 : for (unsigned int i=0; i < SgSetComprehension::pools.size(); i++)
145407 : {
145408 : // objectArray[i] is a single memory pool
145409 : for (int j=0; j < SgSetComprehension::pool_size; j++)
145410 : {
145411 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
145412 : {
145413 : traversal.visit(&(objectArray[i][j]));
145414 : }
145415 : }
145416 : }
145417 : #else
145418 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
145419 : // compute the list first and then call the visit function on each list element.
145420 :
145421 : // printf ("Inside of SgSetComprehension::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
145422 :
145423 0 : std::vector<SgSetComprehension*> nodeList;
145424 :
145425 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
145426 0 : for (unsigned int i=0; i < SgSetComprehension::pools.size(); i++)
145427 : {
145428 : // objectArray[i] is a single memory pool
145429 0 : for (unsigned j=0; j < SgSetComprehension::pool_size; j++)
145430 : {
145431 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
145432 : {
145433 0 : nodeList.push_back(&(objectArray[i][j]));
145434 : }
145435 : }
145436 : }
145437 :
145438 : // Iterate over the saved list
145439 0 : size_t nodeListSize = nodeList.size();
145440 0 : for (size_t i=0; i < nodeListSize; i++)
145441 : {
145442 0 : ROSE_ASSERT(nodeList[i] != NULL);
145443 : #if 0
145444 : traversal.visit(nodeList[i]);
145445 : #else
145446 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
145447 : {
145448 0 : traversal.visit(nodeList[i]);
145449 : }
145450 : #endif
145451 : }
145452 : #endif
145453 : }
145454 :
145455 : // This should not be required since all previously static data members are
145456 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
145457 :
145458 5342 : }
145459 :
145460 :
145461 : void
145462 194 : SgSetComprehension::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
145463 : {
145464 : // This function traverses the memory pool for an IR node and
145465 : // calls the function to execute the visitor object.
145466 :
145467 : // Initialize array to the address of the first element of the STL vector
145468 : // (which is guarenteed to be contiguous storage).
145469 : // SgSetComprehension objectArray [] = *(Memory_Block_List.begin());
145470 194 : if (SgSetComprehension::pools.empty() == false)
145471 : {
145472 : // Generate an array of memory pools
145473 0 : SgSetComprehension** objectArray = (SgSetComprehension**) &(SgSetComprehension::pools[0]);
145474 :
145475 : // Build a local variable for better performance
145476 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
145477 :
145478 : // Iterate over the memory pools
145479 0 : for (unsigned int i=0; i < SgSetComprehension::pools.size(); i++)
145480 : {
145481 : // objectArray[i] is a single memory pool
145482 0 : for (unsigned j=0; j < SgSetComprehension::pool_size; j++)
145483 : {
145484 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
145485 : {
145486 : // printf ("Found a valid SgSetComprehension object in the memory pool %d at position %d \n",i,j);
145487 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
145488 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
145489 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
145490 : }
145491 : else
145492 : {
145493 : // printf ("Found a INVALID SgSetComprehension object in the memory pool \n");
145494 : }
145495 : }
145496 : }
145497 : }
145498 :
145499 : // This should not be required since all previously static data members are
145500 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
145501 :
145502 194 : }
145503 :
145504 : void
145505 0 : SgSetComprehension::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
145506 : {
145507 : // This function visits only a single IR node of the memory pool.
145508 : // it is typically called once for each type of IR node within
145509 : // the automatically generated function: traverseRepresentativeNodes().
145510 :
145511 : // Initialize array to the address of the first element of the STL vector
145512 : // (which is guarenteed to be contiguous storage).
145513 : // SgSetComprehension objectArray [] = *(Memory_Block_List.begin());
145514 0 : if (SgSetComprehension::pools.empty() == false)
145515 : {
145516 : // Generate an array of memory pools
145517 0 : SgSetComprehension** objectArray = (SgSetComprehension**) &(SgSetComprehension::pools[0]);
145518 :
145519 : // Build a local variable for better performance
145520 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
145521 :
145522 : // Iterate over the memory pools
145523 0 : bool done = false;
145524 0 : unsigned i=0;
145525 :
145526 : // find the first valid IR node, call visit function, and then leave
145527 0 : while ( done == false && i < SgSetComprehension::pools.size() )
145528 : {
145529 : // objectArray[i] is a single memory pool
145530 : unsigned j=0;
145531 0 : while (done == false && j < SgSetComprehension::pool_size)
145532 : {
145533 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
145534 : {
145535 0 : traversal.visit(&(objectArray[i][j]));
145536 0 : done = true;
145537 : }
145538 0 : j++;
145539 : }
145540 0 : i++;
145541 : }
145542 :
145543 : #if 0
145544 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
145545 : if (done == false)
145546 : {
145547 : printf ("No representative for SgSetComprehension found in memory pools \n");
145548 : }
145549 : #endif
145550 : }
145551 0 : }
145552 :
145553 :
145554 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
145555 : // using values that overflow signed values of int.
145556 : size_t
145557 4 : SgSetComprehension::numberOfNodes()
145558 : {
145559 : // This function traverses the memory pool for an IR node and
145560 : // counts the number of IR nodes of a particular Sage III IR
145561 : // nodes type.
145562 :
145563 4 : size_t count = 0;
145564 4 : if (SgSetComprehension::pools.empty() == false)
145565 : {
145566 : // Generate an array of memory pools (this is actually a STL vector,
145567 : // but it is contiguious, so OK to treat this way).
145568 0 : SgSetComprehension** objectArray = (SgSetComprehension**) &(SgSetComprehension::pools[0]);
145569 :
145570 : // Build a local variable for better performance (make it a loop invariant variable).
145571 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
145572 :
145573 : // Iterate over all of the memory pools for this IR node.
145574 0 : for (unsigned int i=0; i < SgSetComprehension::pools.size(); i++)
145575 : {
145576 : // objectArray[i] is a single memory pool, iterate over all the
145577 : // IR nodes and only count those that are valid IR nodes used in
145578 : // the AST (i.e. allocated IR nodes).
145579 0 : for (unsigned j=0; j < SgSetComprehension::pool_size; j++)
145580 : {
145581 : // This is indexing the STL vector of C/C++ style arrays as a doubly
145582 : // indexed array access. It is OK since we have leveraged the semantics
145583 : // of STL vector memory as contigous and cast the memory as an array
145584 : // of arrays to use the 2D array indexing. Hope this is not confusing,
145585 : // but it s very fast as an implementation.
145586 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
145587 : {
145588 0 : count++;
145589 : }
145590 : }
145591 : }
145592 : }
145593 :
145594 :
145595 :
145596 4 : return count;
145597 : }
145598 :
145599 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
145600 : // using values that overflow signed values of int.
145601 : size_t
145602 0 : SgSetComprehension::memoryUsage()
145603 : {
145604 : // This function is required because we need the class name as a type when we call sizeof
145605 : // There might be another way to implement this if we have a traversal that only called a
145606 : // representative object (one call for each type of Sage IIIIR node).
145607 0 : size_t memory = numberOfNodes() * sizeof(SgSetComprehension);
145608 :
145609 0 : return memory;
145610 : }
145611 :
145612 : /* #line 145613 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
145613 :
145614 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
145615 : void
145616 5342 : SgDictionaryComprehension::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
145617 : {
145618 : // This function traverses the memory pool for only a specific IR node
145619 : // and calls the visit function of the input class execute a traversal
145620 : // similar to the style of the attribute based traversals within ROSE.
145621 : // This traversal will visit ALL nodes of the AST where as the other
145622 : // attribute based traversals visit only the embedded tree within the AST.
145623 :
145624 : // Initialize array to the address of the first element of the STL vector
145625 : // (which is guaranteed to be contiguous storage).
145626 : // SgDictionaryComprehension objectArray [] = *(Memory_Block_List.begin());
145627 5342 : if (SgDictionaryComprehension::pools.empty() == false)
145628 : {
145629 : // Generate an array of memory pools
145630 0 : SgDictionaryComprehension** objectArray = (SgDictionaryComprehension**) &(SgDictionaryComprehension::pools[0]);
145631 :
145632 : // Build a local variable for better performance
145633 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
145634 : #if 0
145635 : // Iterate over the memory pools
145636 : for (unsigned int i=0; i < SgDictionaryComprehension::pools.size(); i++)
145637 : {
145638 : // objectArray[i] is a single memory pool
145639 : for (int j=0; j < SgDictionaryComprehension::pool_size; j++)
145640 : {
145641 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
145642 : {
145643 : traversal.visit(&(objectArray[i][j]));
145644 : }
145645 : }
145646 : }
145647 : #else
145648 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
145649 : // compute the list first and then call the visit function on each list element.
145650 :
145651 : // printf ("Inside of SgDictionaryComprehension::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
145652 :
145653 0 : std::vector<SgDictionaryComprehension*> nodeList;
145654 :
145655 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
145656 0 : for (unsigned int i=0; i < SgDictionaryComprehension::pools.size(); i++)
145657 : {
145658 : // objectArray[i] is a single memory pool
145659 0 : for (unsigned j=0; j < SgDictionaryComprehension::pool_size; j++)
145660 : {
145661 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
145662 : {
145663 0 : nodeList.push_back(&(objectArray[i][j]));
145664 : }
145665 : }
145666 : }
145667 :
145668 : // Iterate over the saved list
145669 0 : size_t nodeListSize = nodeList.size();
145670 0 : for (size_t i=0; i < nodeListSize; i++)
145671 : {
145672 0 : ROSE_ASSERT(nodeList[i] != NULL);
145673 : #if 0
145674 : traversal.visit(nodeList[i]);
145675 : #else
145676 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
145677 : {
145678 0 : traversal.visit(nodeList[i]);
145679 : }
145680 : #endif
145681 : }
145682 : #endif
145683 : }
145684 :
145685 : // This should not be required since all previously static data members are
145686 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
145687 :
145688 5342 : }
145689 :
145690 :
145691 : void
145692 194 : SgDictionaryComprehension::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
145693 : {
145694 : // This function traverses the memory pool for an IR node and
145695 : // calls the function to execute the visitor object.
145696 :
145697 : // Initialize array to the address of the first element of the STL vector
145698 : // (which is guarenteed to be contiguous storage).
145699 : // SgDictionaryComprehension objectArray [] = *(Memory_Block_List.begin());
145700 194 : if (SgDictionaryComprehension::pools.empty() == false)
145701 : {
145702 : // Generate an array of memory pools
145703 0 : SgDictionaryComprehension** objectArray = (SgDictionaryComprehension**) &(SgDictionaryComprehension::pools[0]);
145704 :
145705 : // Build a local variable for better performance
145706 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
145707 :
145708 : // Iterate over the memory pools
145709 0 : for (unsigned int i=0; i < SgDictionaryComprehension::pools.size(); i++)
145710 : {
145711 : // objectArray[i] is a single memory pool
145712 0 : for (unsigned j=0; j < SgDictionaryComprehension::pool_size; j++)
145713 : {
145714 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
145715 : {
145716 : // printf ("Found a valid SgDictionaryComprehension object in the memory pool %d at position %d \n",i,j);
145717 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
145718 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
145719 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
145720 : }
145721 : else
145722 : {
145723 : // printf ("Found a INVALID SgDictionaryComprehension object in the memory pool \n");
145724 : }
145725 : }
145726 : }
145727 : }
145728 :
145729 : // This should not be required since all previously static data members are
145730 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
145731 :
145732 194 : }
145733 :
145734 : void
145735 0 : SgDictionaryComprehension::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
145736 : {
145737 : // This function visits only a single IR node of the memory pool.
145738 : // it is typically called once for each type of IR node within
145739 : // the automatically generated function: traverseRepresentativeNodes().
145740 :
145741 : // Initialize array to the address of the first element of the STL vector
145742 : // (which is guarenteed to be contiguous storage).
145743 : // SgDictionaryComprehension objectArray [] = *(Memory_Block_List.begin());
145744 0 : if (SgDictionaryComprehension::pools.empty() == false)
145745 : {
145746 : // Generate an array of memory pools
145747 0 : SgDictionaryComprehension** objectArray = (SgDictionaryComprehension**) &(SgDictionaryComprehension::pools[0]);
145748 :
145749 : // Build a local variable for better performance
145750 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
145751 :
145752 : // Iterate over the memory pools
145753 0 : bool done = false;
145754 0 : unsigned i=0;
145755 :
145756 : // find the first valid IR node, call visit function, and then leave
145757 0 : while ( done == false && i < SgDictionaryComprehension::pools.size() )
145758 : {
145759 : // objectArray[i] is a single memory pool
145760 : unsigned j=0;
145761 0 : while (done == false && j < SgDictionaryComprehension::pool_size)
145762 : {
145763 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
145764 : {
145765 0 : traversal.visit(&(objectArray[i][j]));
145766 0 : done = true;
145767 : }
145768 0 : j++;
145769 : }
145770 0 : i++;
145771 : }
145772 :
145773 : #if 0
145774 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
145775 : if (done == false)
145776 : {
145777 : printf ("No representative for SgDictionaryComprehension found in memory pools \n");
145778 : }
145779 : #endif
145780 : }
145781 0 : }
145782 :
145783 :
145784 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
145785 : // using values that overflow signed values of int.
145786 : size_t
145787 4 : SgDictionaryComprehension::numberOfNodes()
145788 : {
145789 : // This function traverses the memory pool for an IR node and
145790 : // counts the number of IR nodes of a particular Sage III IR
145791 : // nodes type.
145792 :
145793 4 : size_t count = 0;
145794 4 : if (SgDictionaryComprehension::pools.empty() == false)
145795 : {
145796 : // Generate an array of memory pools (this is actually a STL vector,
145797 : // but it is contiguious, so OK to treat this way).
145798 0 : SgDictionaryComprehension** objectArray = (SgDictionaryComprehension**) &(SgDictionaryComprehension::pools[0]);
145799 :
145800 : // Build a local variable for better performance (make it a loop invariant variable).
145801 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
145802 :
145803 : // Iterate over all of the memory pools for this IR node.
145804 0 : for (unsigned int i=0; i < SgDictionaryComprehension::pools.size(); i++)
145805 : {
145806 : // objectArray[i] is a single memory pool, iterate over all the
145807 : // IR nodes and only count those that are valid IR nodes used in
145808 : // the AST (i.e. allocated IR nodes).
145809 0 : for (unsigned j=0; j < SgDictionaryComprehension::pool_size; j++)
145810 : {
145811 : // This is indexing the STL vector of C/C++ style arrays as a doubly
145812 : // indexed array access. It is OK since we have leveraged the semantics
145813 : // of STL vector memory as contigous and cast the memory as an array
145814 : // of arrays to use the 2D array indexing. Hope this is not confusing,
145815 : // but it s very fast as an implementation.
145816 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
145817 : {
145818 0 : count++;
145819 : }
145820 : }
145821 : }
145822 : }
145823 :
145824 :
145825 :
145826 4 : return count;
145827 : }
145828 :
145829 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
145830 : // using values that overflow signed values of int.
145831 : size_t
145832 0 : SgDictionaryComprehension::memoryUsage()
145833 : {
145834 : // This function is required because we need the class name as a type when we call sizeof
145835 : // There might be another way to implement this if we have a traversal that only called a
145836 : // representative object (one call for each type of Sage IIIIR node).
145837 0 : size_t memory = numberOfNodes() * sizeof(SgDictionaryComprehension);
145838 :
145839 0 : return memory;
145840 : }
145841 :
145842 : /* #line 145843 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
145843 :
145844 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
145845 : void
145846 5342 : SgNaryOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
145847 : {
145848 : // This function traverses the memory pool for only a specific IR node
145849 : // and calls the visit function of the input class execute a traversal
145850 : // similar to the style of the attribute based traversals within ROSE.
145851 : // This traversal will visit ALL nodes of the AST where as the other
145852 : // attribute based traversals visit only the embedded tree within the AST.
145853 :
145854 : // Initialize array to the address of the first element of the STL vector
145855 : // (which is guaranteed to be contiguous storage).
145856 : // SgNaryOp objectArray [] = *(Memory_Block_List.begin());
145857 5342 : if (SgNaryOp::pools.empty() == false)
145858 : {
145859 : // Generate an array of memory pools
145860 0 : SgNaryOp** objectArray = (SgNaryOp**) &(SgNaryOp::pools[0]);
145861 :
145862 : // Build a local variable for better performance
145863 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
145864 : #if 0
145865 : // Iterate over the memory pools
145866 : for (unsigned int i=0; i < SgNaryOp::pools.size(); i++)
145867 : {
145868 : // objectArray[i] is a single memory pool
145869 : for (int j=0; j < SgNaryOp::pool_size; j++)
145870 : {
145871 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
145872 : {
145873 : traversal.visit(&(objectArray[i][j]));
145874 : }
145875 : }
145876 : }
145877 : #else
145878 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
145879 : // compute the list first and then call the visit function on each list element.
145880 :
145881 : // printf ("Inside of SgNaryOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
145882 :
145883 0 : std::vector<SgNaryOp*> nodeList;
145884 :
145885 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
145886 0 : for (unsigned int i=0; i < SgNaryOp::pools.size(); i++)
145887 : {
145888 : // objectArray[i] is a single memory pool
145889 0 : for (unsigned j=0; j < SgNaryOp::pool_size; j++)
145890 : {
145891 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
145892 : {
145893 0 : nodeList.push_back(&(objectArray[i][j]));
145894 : }
145895 : }
145896 : }
145897 :
145898 : // Iterate over the saved list
145899 0 : size_t nodeListSize = nodeList.size();
145900 0 : for (size_t i=0; i < nodeListSize; i++)
145901 : {
145902 0 : ROSE_ASSERT(nodeList[i] != NULL);
145903 : #if 0
145904 : traversal.visit(nodeList[i]);
145905 : #else
145906 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
145907 : {
145908 0 : traversal.visit(nodeList[i]);
145909 : }
145910 : #endif
145911 : }
145912 : #endif
145913 : }
145914 :
145915 : // This should not be required since all previously static data members are
145916 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
145917 :
145918 5342 : }
145919 :
145920 :
145921 : void
145922 194 : SgNaryOp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
145923 : {
145924 : // This function traverses the memory pool for an IR node and
145925 : // calls the function to execute the visitor object.
145926 :
145927 : // Initialize array to the address of the first element of the STL vector
145928 : // (which is guarenteed to be contiguous storage).
145929 : // SgNaryOp objectArray [] = *(Memory_Block_List.begin());
145930 194 : if (SgNaryOp::pools.empty() == false)
145931 : {
145932 : // Generate an array of memory pools
145933 0 : SgNaryOp** objectArray = (SgNaryOp**) &(SgNaryOp::pools[0]);
145934 :
145935 : // Build a local variable for better performance
145936 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
145937 :
145938 : // Iterate over the memory pools
145939 0 : for (unsigned int i=0; i < SgNaryOp::pools.size(); i++)
145940 : {
145941 : // objectArray[i] is a single memory pool
145942 0 : for (unsigned j=0; j < SgNaryOp::pool_size; j++)
145943 : {
145944 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
145945 : {
145946 : // printf ("Found a valid SgNaryOp object in the memory pool %d at position %d \n",i,j);
145947 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
145948 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
145949 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
145950 : }
145951 : else
145952 : {
145953 : // printf ("Found a INVALID SgNaryOp object in the memory pool \n");
145954 : }
145955 : }
145956 : }
145957 : }
145958 :
145959 : // This should not be required since all previously static data members are
145960 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
145961 :
145962 194 : }
145963 :
145964 : void
145965 0 : SgNaryOp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
145966 : {
145967 : // This function visits only a single IR node of the memory pool.
145968 : // it is typically called once for each type of IR node within
145969 : // the automatically generated function: traverseRepresentativeNodes().
145970 :
145971 : // Initialize array to the address of the first element of the STL vector
145972 : // (which is guarenteed to be contiguous storage).
145973 : // SgNaryOp objectArray [] = *(Memory_Block_List.begin());
145974 0 : if (SgNaryOp::pools.empty() == false)
145975 : {
145976 : // Generate an array of memory pools
145977 0 : SgNaryOp** objectArray = (SgNaryOp**) &(SgNaryOp::pools[0]);
145978 :
145979 : // Build a local variable for better performance
145980 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
145981 :
145982 : // Iterate over the memory pools
145983 0 : bool done = false;
145984 0 : unsigned i=0;
145985 :
145986 : // find the first valid IR node, call visit function, and then leave
145987 0 : while ( done == false && i < SgNaryOp::pools.size() )
145988 : {
145989 : // objectArray[i] is a single memory pool
145990 : unsigned j=0;
145991 0 : while (done == false && j < SgNaryOp::pool_size)
145992 : {
145993 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
145994 : {
145995 0 : traversal.visit(&(objectArray[i][j]));
145996 0 : done = true;
145997 : }
145998 0 : j++;
145999 : }
146000 0 : i++;
146001 : }
146002 :
146003 : #if 0
146004 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
146005 : if (done == false)
146006 : {
146007 : printf ("No representative for SgNaryOp found in memory pools \n");
146008 : }
146009 : #endif
146010 : }
146011 0 : }
146012 :
146013 :
146014 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
146015 : // using values that overflow signed values of int.
146016 : size_t
146017 4 : SgNaryOp::numberOfNodes()
146018 : {
146019 : // This function traverses the memory pool for an IR node and
146020 : // counts the number of IR nodes of a particular Sage III IR
146021 : // nodes type.
146022 :
146023 4 : size_t count = 0;
146024 4 : if (SgNaryOp::pools.empty() == false)
146025 : {
146026 : // Generate an array of memory pools (this is actually a STL vector,
146027 : // but it is contiguious, so OK to treat this way).
146028 0 : SgNaryOp** objectArray = (SgNaryOp**) &(SgNaryOp::pools[0]);
146029 :
146030 : // Build a local variable for better performance (make it a loop invariant variable).
146031 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
146032 :
146033 : // Iterate over all of the memory pools for this IR node.
146034 0 : for (unsigned int i=0; i < SgNaryOp::pools.size(); i++)
146035 : {
146036 : // objectArray[i] is a single memory pool, iterate over all the
146037 : // IR nodes and only count those that are valid IR nodes used in
146038 : // the AST (i.e. allocated IR nodes).
146039 0 : for (unsigned j=0; j < SgNaryOp::pool_size; j++)
146040 : {
146041 : // This is indexing the STL vector of C/C++ style arrays as a doubly
146042 : // indexed array access. It is OK since we have leveraged the semantics
146043 : // of STL vector memory as contigous and cast the memory as an array
146044 : // of arrays to use the 2D array indexing. Hope this is not confusing,
146045 : // but it s very fast as an implementation.
146046 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
146047 : {
146048 0 : count++;
146049 : }
146050 : }
146051 : }
146052 : }
146053 :
146054 :
146055 :
146056 4 : return count;
146057 : }
146058 :
146059 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
146060 : // using values that overflow signed values of int.
146061 : size_t
146062 0 : SgNaryOp::memoryUsage()
146063 : {
146064 : // This function is required because we need the class name as a type when we call sizeof
146065 : // There might be another way to implement this if we have a traversal that only called a
146066 : // representative object (one call for each type of Sage IIIIR node).
146067 0 : size_t memory = numberOfNodes() * sizeof(SgNaryOp);
146068 :
146069 0 : return memory;
146070 : }
146071 :
146072 : /* #line 146073 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
146073 :
146074 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
146075 : void
146076 5342 : SgNaryBooleanOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
146077 : {
146078 : // This function traverses the memory pool for only a specific IR node
146079 : // and calls the visit function of the input class execute a traversal
146080 : // similar to the style of the attribute based traversals within ROSE.
146081 : // This traversal will visit ALL nodes of the AST where as the other
146082 : // attribute based traversals visit only the embedded tree within the AST.
146083 :
146084 : // Initialize array to the address of the first element of the STL vector
146085 : // (which is guaranteed to be contiguous storage).
146086 : // SgNaryBooleanOp objectArray [] = *(Memory_Block_List.begin());
146087 5342 : if (SgNaryBooleanOp::pools.empty() == false)
146088 : {
146089 : // Generate an array of memory pools
146090 0 : SgNaryBooleanOp** objectArray = (SgNaryBooleanOp**) &(SgNaryBooleanOp::pools[0]);
146091 :
146092 : // Build a local variable for better performance
146093 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
146094 : #if 0
146095 : // Iterate over the memory pools
146096 : for (unsigned int i=0; i < SgNaryBooleanOp::pools.size(); i++)
146097 : {
146098 : // objectArray[i] is a single memory pool
146099 : for (int j=0; j < SgNaryBooleanOp::pool_size; j++)
146100 : {
146101 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
146102 : {
146103 : traversal.visit(&(objectArray[i][j]));
146104 : }
146105 : }
146106 : }
146107 : #else
146108 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
146109 : // compute the list first and then call the visit function on each list element.
146110 :
146111 : // printf ("Inside of SgNaryBooleanOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
146112 :
146113 0 : std::vector<SgNaryBooleanOp*> nodeList;
146114 :
146115 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
146116 0 : for (unsigned int i=0; i < SgNaryBooleanOp::pools.size(); i++)
146117 : {
146118 : // objectArray[i] is a single memory pool
146119 0 : for (unsigned j=0; j < SgNaryBooleanOp::pool_size; j++)
146120 : {
146121 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
146122 : {
146123 0 : nodeList.push_back(&(objectArray[i][j]));
146124 : }
146125 : }
146126 : }
146127 :
146128 : // Iterate over the saved list
146129 0 : size_t nodeListSize = nodeList.size();
146130 0 : for (size_t i=0; i < nodeListSize; i++)
146131 : {
146132 0 : ROSE_ASSERT(nodeList[i] != NULL);
146133 : #if 0
146134 : traversal.visit(nodeList[i]);
146135 : #else
146136 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
146137 : {
146138 0 : traversal.visit(nodeList[i]);
146139 : }
146140 : #endif
146141 : }
146142 : #endif
146143 : }
146144 :
146145 : // This should not be required since all previously static data members are
146146 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
146147 :
146148 5342 : }
146149 :
146150 :
146151 : void
146152 194 : SgNaryBooleanOp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
146153 : {
146154 : // This function traverses the memory pool for an IR node and
146155 : // calls the function to execute the visitor object.
146156 :
146157 : // Initialize array to the address of the first element of the STL vector
146158 : // (which is guarenteed to be contiguous storage).
146159 : // SgNaryBooleanOp objectArray [] = *(Memory_Block_List.begin());
146160 194 : if (SgNaryBooleanOp::pools.empty() == false)
146161 : {
146162 : // Generate an array of memory pools
146163 0 : SgNaryBooleanOp** objectArray = (SgNaryBooleanOp**) &(SgNaryBooleanOp::pools[0]);
146164 :
146165 : // Build a local variable for better performance
146166 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
146167 :
146168 : // Iterate over the memory pools
146169 0 : for (unsigned int i=0; i < SgNaryBooleanOp::pools.size(); i++)
146170 : {
146171 : // objectArray[i] is a single memory pool
146172 0 : for (unsigned j=0; j < SgNaryBooleanOp::pool_size; j++)
146173 : {
146174 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
146175 : {
146176 : // printf ("Found a valid SgNaryBooleanOp object in the memory pool %d at position %d \n",i,j);
146177 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
146178 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
146179 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
146180 : }
146181 : else
146182 : {
146183 : // printf ("Found a INVALID SgNaryBooleanOp object in the memory pool \n");
146184 : }
146185 : }
146186 : }
146187 : }
146188 :
146189 : // This should not be required since all previously static data members are
146190 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
146191 :
146192 194 : }
146193 :
146194 : void
146195 0 : SgNaryBooleanOp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
146196 : {
146197 : // This function visits only a single IR node of the memory pool.
146198 : // it is typically called once for each type of IR node within
146199 : // the automatically generated function: traverseRepresentativeNodes().
146200 :
146201 : // Initialize array to the address of the first element of the STL vector
146202 : // (which is guarenteed to be contiguous storage).
146203 : // SgNaryBooleanOp objectArray [] = *(Memory_Block_List.begin());
146204 0 : if (SgNaryBooleanOp::pools.empty() == false)
146205 : {
146206 : // Generate an array of memory pools
146207 0 : SgNaryBooleanOp** objectArray = (SgNaryBooleanOp**) &(SgNaryBooleanOp::pools[0]);
146208 :
146209 : // Build a local variable for better performance
146210 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
146211 :
146212 : // Iterate over the memory pools
146213 0 : bool done = false;
146214 0 : unsigned i=0;
146215 :
146216 : // find the first valid IR node, call visit function, and then leave
146217 0 : while ( done == false && i < SgNaryBooleanOp::pools.size() )
146218 : {
146219 : // objectArray[i] is a single memory pool
146220 : unsigned j=0;
146221 0 : while (done == false && j < SgNaryBooleanOp::pool_size)
146222 : {
146223 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
146224 : {
146225 0 : traversal.visit(&(objectArray[i][j]));
146226 0 : done = true;
146227 : }
146228 0 : j++;
146229 : }
146230 0 : i++;
146231 : }
146232 :
146233 : #if 0
146234 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
146235 : if (done == false)
146236 : {
146237 : printf ("No representative for SgNaryBooleanOp found in memory pools \n");
146238 : }
146239 : #endif
146240 : }
146241 0 : }
146242 :
146243 :
146244 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
146245 : // using values that overflow signed values of int.
146246 : size_t
146247 4 : SgNaryBooleanOp::numberOfNodes()
146248 : {
146249 : // This function traverses the memory pool for an IR node and
146250 : // counts the number of IR nodes of a particular Sage III IR
146251 : // nodes type.
146252 :
146253 4 : size_t count = 0;
146254 4 : if (SgNaryBooleanOp::pools.empty() == false)
146255 : {
146256 : // Generate an array of memory pools (this is actually a STL vector,
146257 : // but it is contiguious, so OK to treat this way).
146258 0 : SgNaryBooleanOp** objectArray = (SgNaryBooleanOp**) &(SgNaryBooleanOp::pools[0]);
146259 :
146260 : // Build a local variable for better performance (make it a loop invariant variable).
146261 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
146262 :
146263 : // Iterate over all of the memory pools for this IR node.
146264 0 : for (unsigned int i=0; i < SgNaryBooleanOp::pools.size(); i++)
146265 : {
146266 : // objectArray[i] is a single memory pool, iterate over all the
146267 : // IR nodes and only count those that are valid IR nodes used in
146268 : // the AST (i.e. allocated IR nodes).
146269 0 : for (unsigned j=0; j < SgNaryBooleanOp::pool_size; j++)
146270 : {
146271 : // This is indexing the STL vector of C/C++ style arrays as a doubly
146272 : // indexed array access. It is OK since we have leveraged the semantics
146273 : // of STL vector memory as contigous and cast the memory as an array
146274 : // of arrays to use the 2D array indexing. Hope this is not confusing,
146275 : // but it s very fast as an implementation.
146276 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
146277 : {
146278 0 : count++;
146279 : }
146280 : }
146281 : }
146282 : }
146283 :
146284 :
146285 :
146286 4 : return count;
146287 : }
146288 :
146289 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
146290 : // using values that overflow signed values of int.
146291 : size_t
146292 0 : SgNaryBooleanOp::memoryUsage()
146293 : {
146294 : // This function is required because we need the class name as a type when we call sizeof
146295 : // There might be another way to implement this if we have a traversal that only called a
146296 : // representative object (one call for each type of Sage IIIIR node).
146297 0 : size_t memory = numberOfNodes() * sizeof(SgNaryBooleanOp);
146298 :
146299 0 : return memory;
146300 : }
146301 :
146302 : /* #line 146303 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
146303 :
146304 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
146305 : void
146306 5342 : SgNaryComparisonOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
146307 : {
146308 : // This function traverses the memory pool for only a specific IR node
146309 : // and calls the visit function of the input class execute a traversal
146310 : // similar to the style of the attribute based traversals within ROSE.
146311 : // This traversal will visit ALL nodes of the AST where as the other
146312 : // attribute based traversals visit only the embedded tree within the AST.
146313 :
146314 : // Initialize array to the address of the first element of the STL vector
146315 : // (which is guaranteed to be contiguous storage).
146316 : // SgNaryComparisonOp objectArray [] = *(Memory_Block_List.begin());
146317 5342 : if (SgNaryComparisonOp::pools.empty() == false)
146318 : {
146319 : // Generate an array of memory pools
146320 0 : SgNaryComparisonOp** objectArray = (SgNaryComparisonOp**) &(SgNaryComparisonOp::pools[0]);
146321 :
146322 : // Build a local variable for better performance
146323 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
146324 : #if 0
146325 : // Iterate over the memory pools
146326 : for (unsigned int i=0; i < SgNaryComparisonOp::pools.size(); i++)
146327 : {
146328 : // objectArray[i] is a single memory pool
146329 : for (int j=0; j < SgNaryComparisonOp::pool_size; j++)
146330 : {
146331 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
146332 : {
146333 : traversal.visit(&(objectArray[i][j]));
146334 : }
146335 : }
146336 : }
146337 : #else
146338 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
146339 : // compute the list first and then call the visit function on each list element.
146340 :
146341 : // printf ("Inside of SgNaryComparisonOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
146342 :
146343 0 : std::vector<SgNaryComparisonOp*> nodeList;
146344 :
146345 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
146346 0 : for (unsigned int i=0; i < SgNaryComparisonOp::pools.size(); i++)
146347 : {
146348 : // objectArray[i] is a single memory pool
146349 0 : for (unsigned j=0; j < SgNaryComparisonOp::pool_size; j++)
146350 : {
146351 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
146352 : {
146353 0 : nodeList.push_back(&(objectArray[i][j]));
146354 : }
146355 : }
146356 : }
146357 :
146358 : // Iterate over the saved list
146359 0 : size_t nodeListSize = nodeList.size();
146360 0 : for (size_t i=0; i < nodeListSize; i++)
146361 : {
146362 0 : ROSE_ASSERT(nodeList[i] != NULL);
146363 : #if 0
146364 : traversal.visit(nodeList[i]);
146365 : #else
146366 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
146367 : {
146368 0 : traversal.visit(nodeList[i]);
146369 : }
146370 : #endif
146371 : }
146372 : #endif
146373 : }
146374 :
146375 : // This should not be required since all previously static data members are
146376 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
146377 :
146378 5342 : }
146379 :
146380 :
146381 : void
146382 194 : SgNaryComparisonOp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
146383 : {
146384 : // This function traverses the memory pool for an IR node and
146385 : // calls the function to execute the visitor object.
146386 :
146387 : // Initialize array to the address of the first element of the STL vector
146388 : // (which is guarenteed to be contiguous storage).
146389 : // SgNaryComparisonOp objectArray [] = *(Memory_Block_List.begin());
146390 194 : if (SgNaryComparisonOp::pools.empty() == false)
146391 : {
146392 : // Generate an array of memory pools
146393 0 : SgNaryComparisonOp** objectArray = (SgNaryComparisonOp**) &(SgNaryComparisonOp::pools[0]);
146394 :
146395 : // Build a local variable for better performance
146396 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
146397 :
146398 : // Iterate over the memory pools
146399 0 : for (unsigned int i=0; i < SgNaryComparisonOp::pools.size(); i++)
146400 : {
146401 : // objectArray[i] is a single memory pool
146402 0 : for (unsigned j=0; j < SgNaryComparisonOp::pool_size; j++)
146403 : {
146404 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
146405 : {
146406 : // printf ("Found a valid SgNaryComparisonOp object in the memory pool %d at position %d \n",i,j);
146407 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
146408 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
146409 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
146410 : }
146411 : else
146412 : {
146413 : // printf ("Found a INVALID SgNaryComparisonOp object in the memory pool \n");
146414 : }
146415 : }
146416 : }
146417 : }
146418 :
146419 : // This should not be required since all previously static data members are
146420 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
146421 :
146422 194 : }
146423 :
146424 : void
146425 0 : SgNaryComparisonOp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
146426 : {
146427 : // This function visits only a single IR node of the memory pool.
146428 : // it is typically called once for each type of IR node within
146429 : // the automatically generated function: traverseRepresentativeNodes().
146430 :
146431 : // Initialize array to the address of the first element of the STL vector
146432 : // (which is guarenteed to be contiguous storage).
146433 : // SgNaryComparisonOp objectArray [] = *(Memory_Block_List.begin());
146434 0 : if (SgNaryComparisonOp::pools.empty() == false)
146435 : {
146436 : // Generate an array of memory pools
146437 0 : SgNaryComparisonOp** objectArray = (SgNaryComparisonOp**) &(SgNaryComparisonOp::pools[0]);
146438 :
146439 : // Build a local variable for better performance
146440 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
146441 :
146442 : // Iterate over the memory pools
146443 0 : bool done = false;
146444 0 : unsigned i=0;
146445 :
146446 : // find the first valid IR node, call visit function, and then leave
146447 0 : while ( done == false && i < SgNaryComparisonOp::pools.size() )
146448 : {
146449 : // objectArray[i] is a single memory pool
146450 : unsigned j=0;
146451 0 : while (done == false && j < SgNaryComparisonOp::pool_size)
146452 : {
146453 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
146454 : {
146455 0 : traversal.visit(&(objectArray[i][j]));
146456 0 : done = true;
146457 : }
146458 0 : j++;
146459 : }
146460 0 : i++;
146461 : }
146462 :
146463 : #if 0
146464 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
146465 : if (done == false)
146466 : {
146467 : printf ("No representative for SgNaryComparisonOp found in memory pools \n");
146468 : }
146469 : #endif
146470 : }
146471 0 : }
146472 :
146473 :
146474 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
146475 : // using values that overflow signed values of int.
146476 : size_t
146477 4 : SgNaryComparisonOp::numberOfNodes()
146478 : {
146479 : // This function traverses the memory pool for an IR node and
146480 : // counts the number of IR nodes of a particular Sage III IR
146481 : // nodes type.
146482 :
146483 4 : size_t count = 0;
146484 4 : if (SgNaryComparisonOp::pools.empty() == false)
146485 : {
146486 : // Generate an array of memory pools (this is actually a STL vector,
146487 : // but it is contiguious, so OK to treat this way).
146488 0 : SgNaryComparisonOp** objectArray = (SgNaryComparisonOp**) &(SgNaryComparisonOp::pools[0]);
146489 :
146490 : // Build a local variable for better performance (make it a loop invariant variable).
146491 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
146492 :
146493 : // Iterate over all of the memory pools for this IR node.
146494 0 : for (unsigned int i=0; i < SgNaryComparisonOp::pools.size(); i++)
146495 : {
146496 : // objectArray[i] is a single memory pool, iterate over all the
146497 : // IR nodes and only count those that are valid IR nodes used in
146498 : // the AST (i.e. allocated IR nodes).
146499 0 : for (unsigned j=0; j < SgNaryComparisonOp::pool_size; j++)
146500 : {
146501 : // This is indexing the STL vector of C/C++ style arrays as a doubly
146502 : // indexed array access. It is OK since we have leveraged the semantics
146503 : // of STL vector memory as contigous and cast the memory as an array
146504 : // of arrays to use the 2D array indexing. Hope this is not confusing,
146505 : // but it s very fast as an implementation.
146506 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
146507 : {
146508 0 : count++;
146509 : }
146510 : }
146511 : }
146512 : }
146513 :
146514 :
146515 :
146516 4 : return count;
146517 : }
146518 :
146519 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
146520 : // using values that overflow signed values of int.
146521 : size_t
146522 0 : SgNaryComparisonOp::memoryUsage()
146523 : {
146524 : // This function is required because we need the class name as a type when we call sizeof
146525 : // There might be another way to implement this if we have a traversal that only called a
146526 : // representative object (one call for each type of Sage IIIIR node).
146527 0 : size_t memory = numberOfNodes() * sizeof(SgNaryComparisonOp);
146528 :
146529 0 : return memory;
146530 : }
146531 :
146532 : /* #line 146533 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
146533 :
146534 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
146535 : void
146536 5342 : SgStringConversion::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
146537 : {
146538 : // This function traverses the memory pool for only a specific IR node
146539 : // and calls the visit function of the input class execute a traversal
146540 : // similar to the style of the attribute based traversals within ROSE.
146541 : // This traversal will visit ALL nodes of the AST where as the other
146542 : // attribute based traversals visit only the embedded tree within the AST.
146543 :
146544 : // Initialize array to the address of the first element of the STL vector
146545 : // (which is guaranteed to be contiguous storage).
146546 : // SgStringConversion objectArray [] = *(Memory_Block_List.begin());
146547 5342 : if (SgStringConversion::pools.empty() == false)
146548 : {
146549 : // Generate an array of memory pools
146550 0 : SgStringConversion** objectArray = (SgStringConversion**) &(SgStringConversion::pools[0]);
146551 :
146552 : // Build a local variable for better performance
146553 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
146554 : #if 0
146555 : // Iterate over the memory pools
146556 : for (unsigned int i=0; i < SgStringConversion::pools.size(); i++)
146557 : {
146558 : // objectArray[i] is a single memory pool
146559 : for (int j=0; j < SgStringConversion::pool_size; j++)
146560 : {
146561 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
146562 : {
146563 : traversal.visit(&(objectArray[i][j]));
146564 : }
146565 : }
146566 : }
146567 : #else
146568 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
146569 : // compute the list first and then call the visit function on each list element.
146570 :
146571 : // printf ("Inside of SgStringConversion::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
146572 :
146573 0 : std::vector<SgStringConversion*> nodeList;
146574 :
146575 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
146576 0 : for (unsigned int i=0; i < SgStringConversion::pools.size(); i++)
146577 : {
146578 : // objectArray[i] is a single memory pool
146579 0 : for (unsigned j=0; j < SgStringConversion::pool_size; j++)
146580 : {
146581 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
146582 : {
146583 0 : nodeList.push_back(&(objectArray[i][j]));
146584 : }
146585 : }
146586 : }
146587 :
146588 : // Iterate over the saved list
146589 0 : size_t nodeListSize = nodeList.size();
146590 0 : for (size_t i=0; i < nodeListSize; i++)
146591 : {
146592 0 : ROSE_ASSERT(nodeList[i] != NULL);
146593 : #if 0
146594 : traversal.visit(nodeList[i]);
146595 : #else
146596 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
146597 : {
146598 0 : traversal.visit(nodeList[i]);
146599 : }
146600 : #endif
146601 : }
146602 : #endif
146603 : }
146604 :
146605 : // This should not be required since all previously static data members are
146606 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
146607 :
146608 5342 : }
146609 :
146610 :
146611 : void
146612 194 : SgStringConversion::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
146613 : {
146614 : // This function traverses the memory pool for an IR node and
146615 : // calls the function to execute the visitor object.
146616 :
146617 : // Initialize array to the address of the first element of the STL vector
146618 : // (which is guarenteed to be contiguous storage).
146619 : // SgStringConversion objectArray [] = *(Memory_Block_List.begin());
146620 194 : if (SgStringConversion::pools.empty() == false)
146621 : {
146622 : // Generate an array of memory pools
146623 0 : SgStringConversion** objectArray = (SgStringConversion**) &(SgStringConversion::pools[0]);
146624 :
146625 : // Build a local variable for better performance
146626 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
146627 :
146628 : // Iterate over the memory pools
146629 0 : for (unsigned int i=0; i < SgStringConversion::pools.size(); i++)
146630 : {
146631 : // objectArray[i] is a single memory pool
146632 0 : for (unsigned j=0; j < SgStringConversion::pool_size; j++)
146633 : {
146634 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
146635 : {
146636 : // printf ("Found a valid SgStringConversion object in the memory pool %d at position %d \n",i,j);
146637 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
146638 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
146639 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
146640 : }
146641 : else
146642 : {
146643 : // printf ("Found a INVALID SgStringConversion object in the memory pool \n");
146644 : }
146645 : }
146646 : }
146647 : }
146648 :
146649 : // This should not be required since all previously static data members are
146650 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
146651 :
146652 194 : }
146653 :
146654 : void
146655 0 : SgStringConversion::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
146656 : {
146657 : // This function visits only a single IR node of the memory pool.
146658 : // it is typically called once for each type of IR node within
146659 : // the automatically generated function: traverseRepresentativeNodes().
146660 :
146661 : // Initialize array to the address of the first element of the STL vector
146662 : // (which is guarenteed to be contiguous storage).
146663 : // SgStringConversion objectArray [] = *(Memory_Block_List.begin());
146664 0 : if (SgStringConversion::pools.empty() == false)
146665 : {
146666 : // Generate an array of memory pools
146667 0 : SgStringConversion** objectArray = (SgStringConversion**) &(SgStringConversion::pools[0]);
146668 :
146669 : // Build a local variable for better performance
146670 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
146671 :
146672 : // Iterate over the memory pools
146673 0 : bool done = false;
146674 0 : unsigned i=0;
146675 :
146676 : // find the first valid IR node, call visit function, and then leave
146677 0 : while ( done == false && i < SgStringConversion::pools.size() )
146678 : {
146679 : // objectArray[i] is a single memory pool
146680 : unsigned j=0;
146681 0 : while (done == false && j < SgStringConversion::pool_size)
146682 : {
146683 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
146684 : {
146685 0 : traversal.visit(&(objectArray[i][j]));
146686 0 : done = true;
146687 : }
146688 0 : j++;
146689 : }
146690 0 : i++;
146691 : }
146692 :
146693 : #if 0
146694 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
146695 : if (done == false)
146696 : {
146697 : printf ("No representative for SgStringConversion found in memory pools \n");
146698 : }
146699 : #endif
146700 : }
146701 0 : }
146702 :
146703 :
146704 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
146705 : // using values that overflow signed values of int.
146706 : size_t
146707 4 : SgStringConversion::numberOfNodes()
146708 : {
146709 : // This function traverses the memory pool for an IR node and
146710 : // counts the number of IR nodes of a particular Sage III IR
146711 : // nodes type.
146712 :
146713 4 : size_t count = 0;
146714 4 : if (SgStringConversion::pools.empty() == false)
146715 : {
146716 : // Generate an array of memory pools (this is actually a STL vector,
146717 : // but it is contiguious, so OK to treat this way).
146718 0 : SgStringConversion** objectArray = (SgStringConversion**) &(SgStringConversion::pools[0]);
146719 :
146720 : // Build a local variable for better performance (make it a loop invariant variable).
146721 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
146722 :
146723 : // Iterate over all of the memory pools for this IR node.
146724 0 : for (unsigned int i=0; i < SgStringConversion::pools.size(); i++)
146725 : {
146726 : // objectArray[i] is a single memory pool, iterate over all the
146727 : // IR nodes and only count those that are valid IR nodes used in
146728 : // the AST (i.e. allocated IR nodes).
146729 0 : for (unsigned j=0; j < SgStringConversion::pool_size; j++)
146730 : {
146731 : // This is indexing the STL vector of C/C++ style arrays as a doubly
146732 : // indexed array access. It is OK since we have leveraged the semantics
146733 : // of STL vector memory as contigous and cast the memory as an array
146734 : // of arrays to use the 2D array indexing. Hope this is not confusing,
146735 : // but it s very fast as an implementation.
146736 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
146737 : {
146738 0 : count++;
146739 : }
146740 : }
146741 : }
146742 : }
146743 :
146744 :
146745 :
146746 4 : return count;
146747 : }
146748 :
146749 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
146750 : // using values that overflow signed values of int.
146751 : size_t
146752 0 : SgStringConversion::memoryUsage()
146753 : {
146754 : // This function is required because we need the class name as a type when we call sizeof
146755 : // There might be another way to implement this if we have a traversal that only called a
146756 : // representative object (one call for each type of Sage IIIIR node).
146757 0 : size_t memory = numberOfNodes() * sizeof(SgStringConversion);
146758 :
146759 0 : return memory;
146760 : }
146761 :
146762 : /* #line 146763 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
146763 :
146764 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
146765 : void
146766 5342 : SgYieldExpression::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
146767 : {
146768 : // This function traverses the memory pool for only a specific IR node
146769 : // and calls the visit function of the input class execute a traversal
146770 : // similar to the style of the attribute based traversals within ROSE.
146771 : // This traversal will visit ALL nodes of the AST where as the other
146772 : // attribute based traversals visit only the embedded tree within the AST.
146773 :
146774 : // Initialize array to the address of the first element of the STL vector
146775 : // (which is guaranteed to be contiguous storage).
146776 : // SgYieldExpression objectArray [] = *(Memory_Block_List.begin());
146777 5342 : if (SgYieldExpression::pools.empty() == false)
146778 : {
146779 : // Generate an array of memory pools
146780 0 : SgYieldExpression** objectArray = (SgYieldExpression**) &(SgYieldExpression::pools[0]);
146781 :
146782 : // Build a local variable for better performance
146783 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
146784 : #if 0
146785 : // Iterate over the memory pools
146786 : for (unsigned int i=0; i < SgYieldExpression::pools.size(); i++)
146787 : {
146788 : // objectArray[i] is a single memory pool
146789 : for (int j=0; j < SgYieldExpression::pool_size; j++)
146790 : {
146791 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
146792 : {
146793 : traversal.visit(&(objectArray[i][j]));
146794 : }
146795 : }
146796 : }
146797 : #else
146798 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
146799 : // compute the list first and then call the visit function on each list element.
146800 :
146801 : // printf ("Inside of SgYieldExpression::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
146802 :
146803 0 : std::vector<SgYieldExpression*> nodeList;
146804 :
146805 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
146806 0 : for (unsigned int i=0; i < SgYieldExpression::pools.size(); i++)
146807 : {
146808 : // objectArray[i] is a single memory pool
146809 0 : for (unsigned j=0; j < SgYieldExpression::pool_size; j++)
146810 : {
146811 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
146812 : {
146813 0 : nodeList.push_back(&(objectArray[i][j]));
146814 : }
146815 : }
146816 : }
146817 :
146818 : // Iterate over the saved list
146819 0 : size_t nodeListSize = nodeList.size();
146820 0 : for (size_t i=0; i < nodeListSize; i++)
146821 : {
146822 0 : ROSE_ASSERT(nodeList[i] != NULL);
146823 : #if 0
146824 : traversal.visit(nodeList[i]);
146825 : #else
146826 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
146827 : {
146828 0 : traversal.visit(nodeList[i]);
146829 : }
146830 : #endif
146831 : }
146832 : #endif
146833 : }
146834 :
146835 : // This should not be required since all previously static data members are
146836 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
146837 :
146838 5342 : }
146839 :
146840 :
146841 : void
146842 194 : SgYieldExpression::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
146843 : {
146844 : // This function traverses the memory pool for an IR node and
146845 : // calls the function to execute the visitor object.
146846 :
146847 : // Initialize array to the address of the first element of the STL vector
146848 : // (which is guarenteed to be contiguous storage).
146849 : // SgYieldExpression objectArray [] = *(Memory_Block_List.begin());
146850 194 : if (SgYieldExpression::pools.empty() == false)
146851 : {
146852 : // Generate an array of memory pools
146853 0 : SgYieldExpression** objectArray = (SgYieldExpression**) &(SgYieldExpression::pools[0]);
146854 :
146855 : // Build a local variable for better performance
146856 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
146857 :
146858 : // Iterate over the memory pools
146859 0 : for (unsigned int i=0; i < SgYieldExpression::pools.size(); i++)
146860 : {
146861 : // objectArray[i] is a single memory pool
146862 0 : for (unsigned j=0; j < SgYieldExpression::pool_size; j++)
146863 : {
146864 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
146865 : {
146866 : // printf ("Found a valid SgYieldExpression object in the memory pool %d at position %d \n",i,j);
146867 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
146868 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
146869 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
146870 : }
146871 : else
146872 : {
146873 : // printf ("Found a INVALID SgYieldExpression object in the memory pool \n");
146874 : }
146875 : }
146876 : }
146877 : }
146878 :
146879 : // This should not be required since all previously static data members are
146880 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
146881 :
146882 194 : }
146883 :
146884 : void
146885 0 : SgYieldExpression::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
146886 : {
146887 : // This function visits only a single IR node of the memory pool.
146888 : // it is typically called once for each type of IR node within
146889 : // the automatically generated function: traverseRepresentativeNodes().
146890 :
146891 : // Initialize array to the address of the first element of the STL vector
146892 : // (which is guarenteed to be contiguous storage).
146893 : // SgYieldExpression objectArray [] = *(Memory_Block_List.begin());
146894 0 : if (SgYieldExpression::pools.empty() == false)
146895 : {
146896 : // Generate an array of memory pools
146897 0 : SgYieldExpression** objectArray = (SgYieldExpression**) &(SgYieldExpression::pools[0]);
146898 :
146899 : // Build a local variable for better performance
146900 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
146901 :
146902 : // Iterate over the memory pools
146903 0 : bool done = false;
146904 0 : unsigned i=0;
146905 :
146906 : // find the first valid IR node, call visit function, and then leave
146907 0 : while ( done == false && i < SgYieldExpression::pools.size() )
146908 : {
146909 : // objectArray[i] is a single memory pool
146910 : unsigned j=0;
146911 0 : while (done == false && j < SgYieldExpression::pool_size)
146912 : {
146913 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
146914 : {
146915 0 : traversal.visit(&(objectArray[i][j]));
146916 0 : done = true;
146917 : }
146918 0 : j++;
146919 : }
146920 0 : i++;
146921 : }
146922 :
146923 : #if 0
146924 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
146925 : if (done == false)
146926 : {
146927 : printf ("No representative for SgYieldExpression found in memory pools \n");
146928 : }
146929 : #endif
146930 : }
146931 0 : }
146932 :
146933 :
146934 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
146935 : // using values that overflow signed values of int.
146936 : size_t
146937 4 : SgYieldExpression::numberOfNodes()
146938 : {
146939 : // This function traverses the memory pool for an IR node and
146940 : // counts the number of IR nodes of a particular Sage III IR
146941 : // nodes type.
146942 :
146943 4 : size_t count = 0;
146944 4 : if (SgYieldExpression::pools.empty() == false)
146945 : {
146946 : // Generate an array of memory pools (this is actually a STL vector,
146947 : // but it is contiguious, so OK to treat this way).
146948 0 : SgYieldExpression** objectArray = (SgYieldExpression**) &(SgYieldExpression::pools[0]);
146949 :
146950 : // Build a local variable for better performance (make it a loop invariant variable).
146951 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
146952 :
146953 : // Iterate over all of the memory pools for this IR node.
146954 0 : for (unsigned int i=0; i < SgYieldExpression::pools.size(); i++)
146955 : {
146956 : // objectArray[i] is a single memory pool, iterate over all the
146957 : // IR nodes and only count those that are valid IR nodes used in
146958 : // the AST (i.e. allocated IR nodes).
146959 0 : for (unsigned j=0; j < SgYieldExpression::pool_size; j++)
146960 : {
146961 : // This is indexing the STL vector of C/C++ style arrays as a doubly
146962 : // indexed array access. It is OK since we have leveraged the semantics
146963 : // of STL vector memory as contigous and cast the memory as an array
146964 : // of arrays to use the 2D array indexing. Hope this is not confusing,
146965 : // but it s very fast as an implementation.
146966 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
146967 : {
146968 0 : count++;
146969 : }
146970 : }
146971 : }
146972 : }
146973 :
146974 :
146975 :
146976 4 : return count;
146977 : }
146978 :
146979 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
146980 : // using values that overflow signed values of int.
146981 : size_t
146982 0 : SgYieldExpression::memoryUsage()
146983 : {
146984 : // This function is required because we need the class name as a type when we call sizeof
146985 : // There might be another way to implement this if we have a traversal that only called a
146986 : // representative object (one call for each type of Sage IIIIR node).
146987 0 : size_t memory = numberOfNodes() * sizeof(SgYieldExpression);
146988 :
146989 0 : return memory;
146990 : }
146991 :
146992 : /* #line 146993 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
146993 :
146994 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
146995 : void
146996 5342 : SgTemplateFunctionRefExp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
146997 : {
146998 : // This function traverses the memory pool for only a specific IR node
146999 : // and calls the visit function of the input class execute a traversal
147000 : // similar to the style of the attribute based traversals within ROSE.
147001 : // This traversal will visit ALL nodes of the AST where as the other
147002 : // attribute based traversals visit only the embedded tree within the AST.
147003 :
147004 : // Initialize array to the address of the first element of the STL vector
147005 : // (which is guaranteed to be contiguous storage).
147006 : // SgTemplateFunctionRefExp objectArray [] = *(Memory_Block_List.begin());
147007 5342 : if (SgTemplateFunctionRefExp::pools.empty() == false)
147008 : {
147009 : // Generate an array of memory pools
147010 138 : SgTemplateFunctionRefExp** objectArray = (SgTemplateFunctionRefExp**) &(SgTemplateFunctionRefExp::pools[0]);
147011 :
147012 : // Build a local variable for better performance
147013 138 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
147014 : #if 0
147015 : // Iterate over the memory pools
147016 : for (unsigned int i=0; i < SgTemplateFunctionRefExp::pools.size(); i++)
147017 : {
147018 : // objectArray[i] is a single memory pool
147019 : for (int j=0; j < SgTemplateFunctionRefExp::pool_size; j++)
147020 : {
147021 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
147022 : {
147023 : traversal.visit(&(objectArray[i][j]));
147024 : }
147025 : }
147026 : }
147027 : #else
147028 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
147029 : // compute the list first and then call the visit function on each list element.
147030 :
147031 : // printf ("Inside of SgTemplateFunctionRefExp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
147032 :
147033 276 : std::vector<SgTemplateFunctionRefExp*> nodeList;
147034 :
147035 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
147036 276 : for (unsigned int i=0; i < SgTemplateFunctionRefExp::pools.size(); i++)
147037 : {
147038 : // objectArray[i] is a single memory pool
147039 276138 : for (unsigned j=0; j < SgTemplateFunctionRefExp::pool_size; j++)
147040 : {
147041 276000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
147042 : {
147043 36571 : nodeList.push_back(&(objectArray[i][j]));
147044 : }
147045 : }
147046 : }
147047 :
147048 : // Iterate over the saved list
147049 138 : size_t nodeListSize = nodeList.size();
147050 36709 : for (size_t i=0; i < nodeListSize; i++)
147051 : {
147052 36571 : ROSE_ASSERT(nodeList[i] != NULL);
147053 : #if 0
147054 : traversal.visit(nodeList[i]);
147055 : #else
147056 36571 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
147057 : {
147058 36571 : traversal.visit(nodeList[i]);
147059 : }
147060 : #endif
147061 : }
147062 : #endif
147063 : }
147064 :
147065 : // This should not be required since all previously static data members are
147066 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
147067 :
147068 5342 : }
147069 :
147070 :
147071 : void
147072 194 : SgTemplateFunctionRefExp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
147073 : {
147074 : // This function traverses the memory pool for an IR node and
147075 : // calls the function to execute the visitor object.
147076 :
147077 : // Initialize array to the address of the first element of the STL vector
147078 : // (which is guarenteed to be contiguous storage).
147079 : // SgTemplateFunctionRefExp objectArray [] = *(Memory_Block_List.begin());
147080 194 : if (SgTemplateFunctionRefExp::pools.empty() == false)
147081 : {
147082 : // Generate an array of memory pools
147083 137 : SgTemplateFunctionRefExp** objectArray = (SgTemplateFunctionRefExp**) &(SgTemplateFunctionRefExp::pools[0]);
147084 :
147085 : // Build a local variable for better performance
147086 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
147087 :
147088 : // Iterate over the memory pools
147089 274 : for (unsigned int i=0; i < SgTemplateFunctionRefExp::pools.size(); i++)
147090 : {
147091 : // objectArray[i] is a single memory pool
147092 274137 : for (unsigned j=0; j < SgTemplateFunctionRefExp::pool_size; j++)
147093 : {
147094 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
147095 : {
147096 : // printf ("Found a valid SgTemplateFunctionRefExp object in the memory pool %d at position %d \n",i,j);
147097 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
147098 34899 : objectArray[i][j].executeVisitorMemberFunction(visitor);
147099 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
147100 : }
147101 : else
147102 : {
147103 : // printf ("Found a INVALID SgTemplateFunctionRefExp object in the memory pool \n");
147104 : }
147105 : }
147106 : }
147107 : }
147108 :
147109 : // This should not be required since all previously static data members are
147110 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
147111 :
147112 194 : }
147113 :
147114 : void
147115 0 : SgTemplateFunctionRefExp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
147116 : {
147117 : // This function visits only a single IR node of the memory pool.
147118 : // it is typically called once for each type of IR node within
147119 : // the automatically generated function: traverseRepresentativeNodes().
147120 :
147121 : // Initialize array to the address of the first element of the STL vector
147122 : // (which is guarenteed to be contiguous storage).
147123 : // SgTemplateFunctionRefExp objectArray [] = *(Memory_Block_List.begin());
147124 0 : if (SgTemplateFunctionRefExp::pools.empty() == false)
147125 : {
147126 : // Generate an array of memory pools
147127 0 : SgTemplateFunctionRefExp** objectArray = (SgTemplateFunctionRefExp**) &(SgTemplateFunctionRefExp::pools[0]);
147128 :
147129 : // Build a local variable for better performance
147130 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
147131 :
147132 : // Iterate over the memory pools
147133 0 : bool done = false;
147134 0 : unsigned i=0;
147135 :
147136 : // find the first valid IR node, call visit function, and then leave
147137 0 : while ( done == false && i < SgTemplateFunctionRefExp::pools.size() )
147138 : {
147139 : // objectArray[i] is a single memory pool
147140 : unsigned j=0;
147141 0 : while (done == false && j < SgTemplateFunctionRefExp::pool_size)
147142 : {
147143 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
147144 : {
147145 0 : traversal.visit(&(objectArray[i][j]));
147146 0 : done = true;
147147 : }
147148 0 : j++;
147149 : }
147150 0 : i++;
147151 : }
147152 :
147153 : #if 0
147154 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
147155 : if (done == false)
147156 : {
147157 : printf ("No representative for SgTemplateFunctionRefExp found in memory pools \n");
147158 : }
147159 : #endif
147160 : }
147161 0 : }
147162 :
147163 :
147164 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
147165 : // using values that overflow signed values of int.
147166 : size_t
147167 4 : SgTemplateFunctionRefExp::numberOfNodes()
147168 : {
147169 : // This function traverses the memory pool for an IR node and
147170 : // counts the number of IR nodes of a particular Sage III IR
147171 : // nodes type.
147172 :
147173 4 : size_t count = 0;
147174 4 : if (SgTemplateFunctionRefExp::pools.empty() == false)
147175 : {
147176 : // Generate an array of memory pools (this is actually a STL vector,
147177 : // but it is contiguious, so OK to treat this way).
147178 1 : SgTemplateFunctionRefExp** objectArray = (SgTemplateFunctionRefExp**) &(SgTemplateFunctionRefExp::pools[0]);
147179 :
147180 : // Build a local variable for better performance (make it a loop invariant variable).
147181 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
147182 :
147183 : // Iterate over all of the memory pools for this IR node.
147184 2 : for (unsigned int i=0; i < SgTemplateFunctionRefExp::pools.size(); i++)
147185 : {
147186 : // objectArray[i] is a single memory pool, iterate over all the
147187 : // IR nodes and only count those that are valid IR nodes used in
147188 : // the AST (i.e. allocated IR nodes).
147189 2001 : for (unsigned j=0; j < SgTemplateFunctionRefExp::pool_size; j++)
147190 : {
147191 : // This is indexing the STL vector of C/C++ style arrays as a doubly
147192 : // indexed array access. It is OK since we have leveraged the semantics
147193 : // of STL vector memory as contigous and cast the memory as an array
147194 : // of arrays to use the 2D array indexing. Hope this is not confusing,
147195 : // but it s very fast as an implementation.
147196 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
147197 : {
147198 225 : count++;
147199 : }
147200 : }
147201 : }
147202 : }
147203 :
147204 :
147205 :
147206 4 : return count;
147207 : }
147208 :
147209 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
147210 : // using values that overflow signed values of int.
147211 : size_t
147212 0 : SgTemplateFunctionRefExp::memoryUsage()
147213 : {
147214 : // This function is required because we need the class name as a type when we call sizeof
147215 : // There might be another way to implement this if we have a traversal that only called a
147216 : // representative object (one call for each type of Sage IIIIR node).
147217 0 : size_t memory = numberOfNodes() * sizeof(SgTemplateFunctionRefExp);
147218 :
147219 0 : return memory;
147220 : }
147221 :
147222 : /* #line 147223 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
147223 :
147224 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
147225 : void
147226 5342 : SgTemplateMemberFunctionRefExp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
147227 : {
147228 : // This function traverses the memory pool for only a specific IR node
147229 : // and calls the visit function of the input class execute a traversal
147230 : // similar to the style of the attribute based traversals within ROSE.
147231 : // This traversal will visit ALL nodes of the AST where as the other
147232 : // attribute based traversals visit only the embedded tree within the AST.
147233 :
147234 : // Initialize array to the address of the first element of the STL vector
147235 : // (which is guaranteed to be contiguous storage).
147236 : // SgTemplateMemberFunctionRefExp objectArray [] = *(Memory_Block_List.begin());
147237 5342 : if (SgTemplateMemberFunctionRefExp::pools.empty() == false)
147238 : {
147239 : // Generate an array of memory pools
147240 138 : SgTemplateMemberFunctionRefExp** objectArray = (SgTemplateMemberFunctionRefExp**) &(SgTemplateMemberFunctionRefExp::pools[0]);
147241 :
147242 : // Build a local variable for better performance
147243 138 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
147244 : #if 0
147245 : // Iterate over the memory pools
147246 : for (unsigned int i=0; i < SgTemplateMemberFunctionRefExp::pools.size(); i++)
147247 : {
147248 : // objectArray[i] is a single memory pool
147249 : for (int j=0; j < SgTemplateMemberFunctionRefExp::pool_size; j++)
147250 : {
147251 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
147252 : {
147253 : traversal.visit(&(objectArray[i][j]));
147254 : }
147255 : }
147256 : }
147257 : #else
147258 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
147259 : // compute the list first and then call the visit function on each list element.
147260 :
147261 : // printf ("Inside of SgTemplateMemberFunctionRefExp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
147262 :
147263 276 : std::vector<SgTemplateMemberFunctionRefExp*> nodeList;
147264 :
147265 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
147266 276 : for (unsigned int i=0; i < SgTemplateMemberFunctionRefExp::pools.size(); i++)
147267 : {
147268 : // objectArray[i] is a single memory pool
147269 276138 : for (unsigned j=0; j < SgTemplateMemberFunctionRefExp::pool_size; j++)
147270 : {
147271 276000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
147272 : {
147273 97382 : nodeList.push_back(&(objectArray[i][j]));
147274 : }
147275 : }
147276 : }
147277 :
147278 : // Iterate over the saved list
147279 138 : size_t nodeListSize = nodeList.size();
147280 97520 : for (size_t i=0; i < nodeListSize; i++)
147281 : {
147282 97382 : ROSE_ASSERT(nodeList[i] != NULL);
147283 : #if 0
147284 : traversal.visit(nodeList[i]);
147285 : #else
147286 97382 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
147287 : {
147288 97382 : traversal.visit(nodeList[i]);
147289 : }
147290 : #endif
147291 : }
147292 : #endif
147293 : }
147294 :
147295 : // This should not be required since all previously static data members are
147296 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
147297 :
147298 5342 : }
147299 :
147300 :
147301 : void
147302 194 : SgTemplateMemberFunctionRefExp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
147303 : {
147304 : // This function traverses the memory pool for an IR node and
147305 : // calls the function to execute the visitor object.
147306 :
147307 : // Initialize array to the address of the first element of the STL vector
147308 : // (which is guarenteed to be contiguous storage).
147309 : // SgTemplateMemberFunctionRefExp objectArray [] = *(Memory_Block_List.begin());
147310 194 : if (SgTemplateMemberFunctionRefExp::pools.empty() == false)
147311 : {
147312 : // Generate an array of memory pools
147313 137 : SgTemplateMemberFunctionRefExp** objectArray = (SgTemplateMemberFunctionRefExp**) &(SgTemplateMemberFunctionRefExp::pools[0]);
147314 :
147315 : // Build a local variable for better performance
147316 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
147317 :
147318 : // Iterate over the memory pools
147319 274 : for (unsigned int i=0; i < SgTemplateMemberFunctionRefExp::pools.size(); i++)
147320 : {
147321 : // objectArray[i] is a single memory pool
147322 274137 : for (unsigned j=0; j < SgTemplateMemberFunctionRefExp::pool_size; j++)
147323 : {
147324 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
147325 : {
147326 : // printf ("Found a valid SgTemplateMemberFunctionRefExp object in the memory pool %d at position %d \n",i,j);
147327 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
147328 107632 : objectArray[i][j].executeVisitorMemberFunction(visitor);
147329 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
147330 : }
147331 : else
147332 : {
147333 : // printf ("Found a INVALID SgTemplateMemberFunctionRefExp object in the memory pool \n");
147334 : }
147335 : }
147336 : }
147337 : }
147338 :
147339 : // This should not be required since all previously static data members are
147340 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
147341 :
147342 194 : }
147343 :
147344 : void
147345 0 : SgTemplateMemberFunctionRefExp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
147346 : {
147347 : // This function visits only a single IR node of the memory pool.
147348 : // it is typically called once for each type of IR node within
147349 : // the automatically generated function: traverseRepresentativeNodes().
147350 :
147351 : // Initialize array to the address of the first element of the STL vector
147352 : // (which is guarenteed to be contiguous storage).
147353 : // SgTemplateMemberFunctionRefExp objectArray [] = *(Memory_Block_List.begin());
147354 0 : if (SgTemplateMemberFunctionRefExp::pools.empty() == false)
147355 : {
147356 : // Generate an array of memory pools
147357 0 : SgTemplateMemberFunctionRefExp** objectArray = (SgTemplateMemberFunctionRefExp**) &(SgTemplateMemberFunctionRefExp::pools[0]);
147358 :
147359 : // Build a local variable for better performance
147360 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
147361 :
147362 : // Iterate over the memory pools
147363 0 : bool done = false;
147364 0 : unsigned i=0;
147365 :
147366 : // find the first valid IR node, call visit function, and then leave
147367 0 : while ( done == false && i < SgTemplateMemberFunctionRefExp::pools.size() )
147368 : {
147369 : // objectArray[i] is a single memory pool
147370 : unsigned j=0;
147371 0 : while (done == false && j < SgTemplateMemberFunctionRefExp::pool_size)
147372 : {
147373 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
147374 : {
147375 0 : traversal.visit(&(objectArray[i][j]));
147376 0 : done = true;
147377 : }
147378 0 : j++;
147379 : }
147380 0 : i++;
147381 : }
147382 :
147383 : #if 0
147384 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
147385 : if (done == false)
147386 : {
147387 : printf ("No representative for SgTemplateMemberFunctionRefExp found in memory pools \n");
147388 : }
147389 : #endif
147390 : }
147391 0 : }
147392 :
147393 :
147394 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
147395 : // using values that overflow signed values of int.
147396 : size_t
147397 4 : SgTemplateMemberFunctionRefExp::numberOfNodes()
147398 : {
147399 : // This function traverses the memory pool for an IR node and
147400 : // counts the number of IR nodes of a particular Sage III IR
147401 : // nodes type.
147402 :
147403 4 : size_t count = 0;
147404 4 : if (SgTemplateMemberFunctionRefExp::pools.empty() == false)
147405 : {
147406 : // Generate an array of memory pools (this is actually a STL vector,
147407 : // but it is contiguious, so OK to treat this way).
147408 1 : SgTemplateMemberFunctionRefExp** objectArray = (SgTemplateMemberFunctionRefExp**) &(SgTemplateMemberFunctionRefExp::pools[0]);
147409 :
147410 : // Build a local variable for better performance (make it a loop invariant variable).
147411 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
147412 :
147413 : // Iterate over all of the memory pools for this IR node.
147414 2 : for (unsigned int i=0; i < SgTemplateMemberFunctionRefExp::pools.size(); i++)
147415 : {
147416 : // objectArray[i] is a single memory pool, iterate over all the
147417 : // IR nodes and only count those that are valid IR nodes used in
147418 : // the AST (i.e. allocated IR nodes).
147419 2001 : for (unsigned j=0; j < SgTemplateMemberFunctionRefExp::pool_size; j++)
147420 : {
147421 : // This is indexing the STL vector of C/C++ style arrays as a doubly
147422 : // indexed array access. It is OK since we have leveraged the semantics
147423 : // of STL vector memory as contigous and cast the memory as an array
147424 : // of arrays to use the 2D array indexing. Hope this is not confusing,
147425 : // but it s very fast as an implementation.
147426 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
147427 : {
147428 738 : count++;
147429 : }
147430 : }
147431 : }
147432 : }
147433 :
147434 :
147435 :
147436 4 : return count;
147437 : }
147438 :
147439 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
147440 : // using values that overflow signed values of int.
147441 : size_t
147442 0 : SgTemplateMemberFunctionRefExp::memoryUsage()
147443 : {
147444 : // This function is required because we need the class name as a type when we call sizeof
147445 : // There might be another way to implement this if we have a traversal that only called a
147446 : // representative object (one call for each type of Sage IIIIR node).
147447 0 : size_t memory = numberOfNodes() * sizeof(SgTemplateMemberFunctionRefExp);
147448 :
147449 0 : return memory;
147450 : }
147451 :
147452 : /* #line 147453 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
147453 :
147454 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
147455 : void
147456 5342 : SgAlignOfOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
147457 : {
147458 : // This function traverses the memory pool for only a specific IR node
147459 : // and calls the visit function of the input class execute a traversal
147460 : // similar to the style of the attribute based traversals within ROSE.
147461 : // This traversal will visit ALL nodes of the AST where as the other
147462 : // attribute based traversals visit only the embedded tree within the AST.
147463 :
147464 : // Initialize array to the address of the first element of the STL vector
147465 : // (which is guaranteed to be contiguous storage).
147466 : // SgAlignOfOp objectArray [] = *(Memory_Block_List.begin());
147467 5342 : if (SgAlignOfOp::pools.empty() == false)
147468 : {
147469 : // Generate an array of memory pools
147470 138 : SgAlignOfOp** objectArray = (SgAlignOfOp**) &(SgAlignOfOp::pools[0]);
147471 :
147472 : // Build a local variable for better performance
147473 138 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
147474 : #if 0
147475 : // Iterate over the memory pools
147476 : for (unsigned int i=0; i < SgAlignOfOp::pools.size(); i++)
147477 : {
147478 : // objectArray[i] is a single memory pool
147479 : for (int j=0; j < SgAlignOfOp::pool_size; j++)
147480 : {
147481 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
147482 : {
147483 : traversal.visit(&(objectArray[i][j]));
147484 : }
147485 : }
147486 : }
147487 : #else
147488 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
147489 : // compute the list first and then call the visit function on each list element.
147490 :
147491 : // printf ("Inside of SgAlignOfOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
147492 :
147493 276 : std::vector<SgAlignOfOp*> nodeList;
147494 :
147495 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
147496 276 : for (unsigned int i=0; i < SgAlignOfOp::pools.size(); i++)
147497 : {
147498 : // objectArray[i] is a single memory pool
147499 276138 : for (unsigned j=0; j < SgAlignOfOp::pool_size; j++)
147500 : {
147501 276000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
147502 : {
147503 722 : nodeList.push_back(&(objectArray[i][j]));
147504 : }
147505 : }
147506 : }
147507 :
147508 : // Iterate over the saved list
147509 138 : size_t nodeListSize = nodeList.size();
147510 860 : for (size_t i=0; i < nodeListSize; i++)
147511 : {
147512 722 : ROSE_ASSERT(nodeList[i] != NULL);
147513 : #if 0
147514 : traversal.visit(nodeList[i]);
147515 : #else
147516 722 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
147517 : {
147518 722 : traversal.visit(nodeList[i]);
147519 : }
147520 : #endif
147521 : }
147522 : #endif
147523 : }
147524 :
147525 : // This should not be required since all previously static data members are
147526 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
147527 :
147528 5342 : }
147529 :
147530 :
147531 : void
147532 194 : SgAlignOfOp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
147533 : {
147534 : // This function traverses the memory pool for an IR node and
147535 : // calls the function to execute the visitor object.
147536 :
147537 : // Initialize array to the address of the first element of the STL vector
147538 : // (which is guarenteed to be contiguous storage).
147539 : // SgAlignOfOp objectArray [] = *(Memory_Block_List.begin());
147540 194 : if (SgAlignOfOp::pools.empty() == false)
147541 : {
147542 : // Generate an array of memory pools
147543 137 : SgAlignOfOp** objectArray = (SgAlignOfOp**) &(SgAlignOfOp::pools[0]);
147544 :
147545 : // Build a local variable for better performance
147546 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
147547 :
147548 : // Iterate over the memory pools
147549 274 : for (unsigned int i=0; i < SgAlignOfOp::pools.size(); i++)
147550 : {
147551 : // objectArray[i] is a single memory pool
147552 274137 : for (unsigned j=0; j < SgAlignOfOp::pool_size; j++)
147553 : {
147554 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
147555 : {
147556 : // printf ("Found a valid SgAlignOfOp object in the memory pool %d at position %d \n",i,j);
147557 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
147558 703 : objectArray[i][j].executeVisitorMemberFunction(visitor);
147559 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
147560 : }
147561 : else
147562 : {
147563 : // printf ("Found a INVALID SgAlignOfOp object in the memory pool \n");
147564 : }
147565 : }
147566 : }
147567 : }
147568 :
147569 : // This should not be required since all previously static data members are
147570 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
147571 :
147572 194 : }
147573 :
147574 : void
147575 0 : SgAlignOfOp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
147576 : {
147577 : // This function visits only a single IR node of the memory pool.
147578 : // it is typically called once for each type of IR node within
147579 : // the automatically generated function: traverseRepresentativeNodes().
147580 :
147581 : // Initialize array to the address of the first element of the STL vector
147582 : // (which is guarenteed to be contiguous storage).
147583 : // SgAlignOfOp objectArray [] = *(Memory_Block_List.begin());
147584 0 : if (SgAlignOfOp::pools.empty() == false)
147585 : {
147586 : // Generate an array of memory pools
147587 0 : SgAlignOfOp** objectArray = (SgAlignOfOp**) &(SgAlignOfOp::pools[0]);
147588 :
147589 : // Build a local variable for better performance
147590 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
147591 :
147592 : // Iterate over the memory pools
147593 0 : bool done = false;
147594 0 : unsigned i=0;
147595 :
147596 : // find the first valid IR node, call visit function, and then leave
147597 0 : while ( done == false && i < SgAlignOfOp::pools.size() )
147598 : {
147599 : // objectArray[i] is a single memory pool
147600 : unsigned j=0;
147601 0 : while (done == false && j < SgAlignOfOp::pool_size)
147602 : {
147603 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
147604 : {
147605 0 : traversal.visit(&(objectArray[i][j]));
147606 0 : done = true;
147607 : }
147608 0 : j++;
147609 : }
147610 0 : i++;
147611 : }
147612 :
147613 : #if 0
147614 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
147615 : if (done == false)
147616 : {
147617 : printf ("No representative for SgAlignOfOp found in memory pools \n");
147618 : }
147619 : #endif
147620 : }
147621 0 : }
147622 :
147623 :
147624 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
147625 : // using values that overflow signed values of int.
147626 : size_t
147627 4 : SgAlignOfOp::numberOfNodes()
147628 : {
147629 : // This function traverses the memory pool for an IR node and
147630 : // counts the number of IR nodes of a particular Sage III IR
147631 : // nodes type.
147632 :
147633 4 : size_t count = 0;
147634 4 : if (SgAlignOfOp::pools.empty() == false)
147635 : {
147636 : // Generate an array of memory pools (this is actually a STL vector,
147637 : // but it is contiguious, so OK to treat this way).
147638 1 : SgAlignOfOp** objectArray = (SgAlignOfOp**) &(SgAlignOfOp::pools[0]);
147639 :
147640 : // Build a local variable for better performance (make it a loop invariant variable).
147641 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
147642 :
147643 : // Iterate over all of the memory pools for this IR node.
147644 2 : for (unsigned int i=0; i < SgAlignOfOp::pools.size(); i++)
147645 : {
147646 : // objectArray[i] is a single memory pool, iterate over all the
147647 : // IR nodes and only count those that are valid IR nodes used in
147648 : // the AST (i.e. allocated IR nodes).
147649 2001 : for (unsigned j=0; j < SgAlignOfOp::pool_size; j++)
147650 : {
147651 : // This is indexing the STL vector of C/C++ style arrays as a doubly
147652 : // indexed array access. It is OK since we have leveraged the semantics
147653 : // of STL vector memory as contigous and cast the memory as an array
147654 : // of arrays to use the 2D array indexing. Hope this is not confusing,
147655 : // but it s very fast as an implementation.
147656 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
147657 : {
147658 5 : count++;
147659 : }
147660 : }
147661 : }
147662 : }
147663 :
147664 :
147665 :
147666 4 : return count;
147667 : }
147668 :
147669 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
147670 : // using values that overflow signed values of int.
147671 : size_t
147672 0 : SgAlignOfOp::memoryUsage()
147673 : {
147674 : // This function is required because we need the class name as a type when we call sizeof
147675 : // There might be another way to implement this if we have a traversal that only called a
147676 : // representative object (one call for each type of Sage IIIIR node).
147677 0 : size_t memory = numberOfNodes() * sizeof(SgAlignOfOp);
147678 :
147679 0 : return memory;
147680 : }
147681 :
147682 : /* #line 147683 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
147683 :
147684 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
147685 : void
147686 5342 : SgRangeExp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
147687 : {
147688 : // This function traverses the memory pool for only a specific IR node
147689 : // and calls the visit function of the input class execute a traversal
147690 : // similar to the style of the attribute based traversals within ROSE.
147691 : // This traversal will visit ALL nodes of the AST where as the other
147692 : // attribute based traversals visit only the embedded tree within the AST.
147693 :
147694 : // Initialize array to the address of the first element of the STL vector
147695 : // (which is guaranteed to be contiguous storage).
147696 : // SgRangeExp objectArray [] = *(Memory_Block_List.begin());
147697 5342 : if (SgRangeExp::pools.empty() == false)
147698 : {
147699 : // Generate an array of memory pools
147700 0 : SgRangeExp** objectArray = (SgRangeExp**) &(SgRangeExp::pools[0]);
147701 :
147702 : // Build a local variable for better performance
147703 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
147704 : #if 0
147705 : // Iterate over the memory pools
147706 : for (unsigned int i=0; i < SgRangeExp::pools.size(); i++)
147707 : {
147708 : // objectArray[i] is a single memory pool
147709 : for (int j=0; j < SgRangeExp::pool_size; j++)
147710 : {
147711 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
147712 : {
147713 : traversal.visit(&(objectArray[i][j]));
147714 : }
147715 : }
147716 : }
147717 : #else
147718 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
147719 : // compute the list first and then call the visit function on each list element.
147720 :
147721 : // printf ("Inside of SgRangeExp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
147722 :
147723 0 : std::vector<SgRangeExp*> nodeList;
147724 :
147725 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
147726 0 : for (unsigned int i=0; i < SgRangeExp::pools.size(); i++)
147727 : {
147728 : // objectArray[i] is a single memory pool
147729 0 : for (unsigned j=0; j < SgRangeExp::pool_size; j++)
147730 : {
147731 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
147732 : {
147733 0 : nodeList.push_back(&(objectArray[i][j]));
147734 : }
147735 : }
147736 : }
147737 :
147738 : // Iterate over the saved list
147739 0 : size_t nodeListSize = nodeList.size();
147740 0 : for (size_t i=0; i < nodeListSize; i++)
147741 : {
147742 0 : ROSE_ASSERT(nodeList[i] != NULL);
147743 : #if 0
147744 : traversal.visit(nodeList[i]);
147745 : #else
147746 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
147747 : {
147748 0 : traversal.visit(nodeList[i]);
147749 : }
147750 : #endif
147751 : }
147752 : #endif
147753 : }
147754 :
147755 : // This should not be required since all previously static data members are
147756 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
147757 :
147758 5342 : }
147759 :
147760 :
147761 : void
147762 194 : SgRangeExp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
147763 : {
147764 : // This function traverses the memory pool for an IR node and
147765 : // calls the function to execute the visitor object.
147766 :
147767 : // Initialize array to the address of the first element of the STL vector
147768 : // (which is guarenteed to be contiguous storage).
147769 : // SgRangeExp objectArray [] = *(Memory_Block_List.begin());
147770 194 : if (SgRangeExp::pools.empty() == false)
147771 : {
147772 : // Generate an array of memory pools
147773 0 : SgRangeExp** objectArray = (SgRangeExp**) &(SgRangeExp::pools[0]);
147774 :
147775 : // Build a local variable for better performance
147776 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
147777 :
147778 : // Iterate over the memory pools
147779 0 : for (unsigned int i=0; i < SgRangeExp::pools.size(); i++)
147780 : {
147781 : // objectArray[i] is a single memory pool
147782 0 : for (unsigned j=0; j < SgRangeExp::pool_size; j++)
147783 : {
147784 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
147785 : {
147786 : // printf ("Found a valid SgRangeExp object in the memory pool %d at position %d \n",i,j);
147787 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
147788 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
147789 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
147790 : }
147791 : else
147792 : {
147793 : // printf ("Found a INVALID SgRangeExp object in the memory pool \n");
147794 : }
147795 : }
147796 : }
147797 : }
147798 :
147799 : // This should not be required since all previously static data members are
147800 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
147801 :
147802 194 : }
147803 :
147804 : void
147805 0 : SgRangeExp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
147806 : {
147807 : // This function visits only a single IR node of the memory pool.
147808 : // it is typically called once for each type of IR node within
147809 : // the automatically generated function: traverseRepresentativeNodes().
147810 :
147811 : // Initialize array to the address of the first element of the STL vector
147812 : // (which is guarenteed to be contiguous storage).
147813 : // SgRangeExp objectArray [] = *(Memory_Block_List.begin());
147814 0 : if (SgRangeExp::pools.empty() == false)
147815 : {
147816 : // Generate an array of memory pools
147817 0 : SgRangeExp** objectArray = (SgRangeExp**) &(SgRangeExp::pools[0]);
147818 :
147819 : // Build a local variable for better performance
147820 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
147821 :
147822 : // Iterate over the memory pools
147823 0 : bool done = false;
147824 0 : unsigned i=0;
147825 :
147826 : // find the first valid IR node, call visit function, and then leave
147827 0 : while ( done == false && i < SgRangeExp::pools.size() )
147828 : {
147829 : // objectArray[i] is a single memory pool
147830 : unsigned j=0;
147831 0 : while (done == false && j < SgRangeExp::pool_size)
147832 : {
147833 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
147834 : {
147835 0 : traversal.visit(&(objectArray[i][j]));
147836 0 : done = true;
147837 : }
147838 0 : j++;
147839 : }
147840 0 : i++;
147841 : }
147842 :
147843 : #if 0
147844 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
147845 : if (done == false)
147846 : {
147847 : printf ("No representative for SgRangeExp found in memory pools \n");
147848 : }
147849 : #endif
147850 : }
147851 0 : }
147852 :
147853 :
147854 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
147855 : // using values that overflow signed values of int.
147856 : size_t
147857 4 : SgRangeExp::numberOfNodes()
147858 : {
147859 : // This function traverses the memory pool for an IR node and
147860 : // counts the number of IR nodes of a particular Sage III IR
147861 : // nodes type.
147862 :
147863 4 : size_t count = 0;
147864 4 : if (SgRangeExp::pools.empty() == false)
147865 : {
147866 : // Generate an array of memory pools (this is actually a STL vector,
147867 : // but it is contiguious, so OK to treat this way).
147868 0 : SgRangeExp** objectArray = (SgRangeExp**) &(SgRangeExp::pools[0]);
147869 :
147870 : // Build a local variable for better performance (make it a loop invariant variable).
147871 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
147872 :
147873 : // Iterate over all of the memory pools for this IR node.
147874 0 : for (unsigned int i=0; i < SgRangeExp::pools.size(); i++)
147875 : {
147876 : // objectArray[i] is a single memory pool, iterate over all the
147877 : // IR nodes and only count those that are valid IR nodes used in
147878 : // the AST (i.e. allocated IR nodes).
147879 0 : for (unsigned j=0; j < SgRangeExp::pool_size; j++)
147880 : {
147881 : // This is indexing the STL vector of C/C++ style arrays as a doubly
147882 : // indexed array access. It is OK since we have leveraged the semantics
147883 : // of STL vector memory as contigous and cast the memory as an array
147884 : // of arrays to use the 2D array indexing. Hope this is not confusing,
147885 : // but it s very fast as an implementation.
147886 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
147887 : {
147888 0 : count++;
147889 : }
147890 : }
147891 : }
147892 : }
147893 :
147894 :
147895 :
147896 4 : return count;
147897 : }
147898 :
147899 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
147900 : // using values that overflow signed values of int.
147901 : size_t
147902 0 : SgRangeExp::memoryUsage()
147903 : {
147904 : // This function is required because we need the class name as a type when we call sizeof
147905 : // There might be another way to implement this if we have a traversal that only called a
147906 : // representative object (one call for each type of Sage IIIIR node).
147907 0 : size_t memory = numberOfNodes() * sizeof(SgRangeExp);
147908 :
147909 0 : return memory;
147910 : }
147911 :
147912 : /* #line 147913 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
147913 :
147914 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
147915 : void
147916 5342 : SgMagicColonExp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
147917 : {
147918 : // This function traverses the memory pool for only a specific IR node
147919 : // and calls the visit function of the input class execute a traversal
147920 : // similar to the style of the attribute based traversals within ROSE.
147921 : // This traversal will visit ALL nodes of the AST where as the other
147922 : // attribute based traversals visit only the embedded tree within the AST.
147923 :
147924 : // Initialize array to the address of the first element of the STL vector
147925 : // (which is guaranteed to be contiguous storage).
147926 : // SgMagicColonExp objectArray [] = *(Memory_Block_List.begin());
147927 5342 : if (SgMagicColonExp::pools.empty() == false)
147928 : {
147929 : // Generate an array of memory pools
147930 0 : SgMagicColonExp** objectArray = (SgMagicColonExp**) &(SgMagicColonExp::pools[0]);
147931 :
147932 : // Build a local variable for better performance
147933 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
147934 : #if 0
147935 : // Iterate over the memory pools
147936 : for (unsigned int i=0; i < SgMagicColonExp::pools.size(); i++)
147937 : {
147938 : // objectArray[i] is a single memory pool
147939 : for (int j=0; j < SgMagicColonExp::pool_size; j++)
147940 : {
147941 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
147942 : {
147943 : traversal.visit(&(objectArray[i][j]));
147944 : }
147945 : }
147946 : }
147947 : #else
147948 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
147949 : // compute the list first and then call the visit function on each list element.
147950 :
147951 : // printf ("Inside of SgMagicColonExp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
147952 :
147953 0 : std::vector<SgMagicColonExp*> nodeList;
147954 :
147955 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
147956 0 : for (unsigned int i=0; i < SgMagicColonExp::pools.size(); i++)
147957 : {
147958 : // objectArray[i] is a single memory pool
147959 0 : for (unsigned j=0; j < SgMagicColonExp::pool_size; j++)
147960 : {
147961 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
147962 : {
147963 0 : nodeList.push_back(&(objectArray[i][j]));
147964 : }
147965 : }
147966 : }
147967 :
147968 : // Iterate over the saved list
147969 0 : size_t nodeListSize = nodeList.size();
147970 0 : for (size_t i=0; i < nodeListSize; i++)
147971 : {
147972 0 : ROSE_ASSERT(nodeList[i] != NULL);
147973 : #if 0
147974 : traversal.visit(nodeList[i]);
147975 : #else
147976 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
147977 : {
147978 0 : traversal.visit(nodeList[i]);
147979 : }
147980 : #endif
147981 : }
147982 : #endif
147983 : }
147984 :
147985 : // This should not be required since all previously static data members are
147986 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
147987 :
147988 5342 : }
147989 :
147990 :
147991 : void
147992 194 : SgMagicColonExp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
147993 : {
147994 : // This function traverses the memory pool for an IR node and
147995 : // calls the function to execute the visitor object.
147996 :
147997 : // Initialize array to the address of the first element of the STL vector
147998 : // (which is guarenteed to be contiguous storage).
147999 : // SgMagicColonExp objectArray [] = *(Memory_Block_List.begin());
148000 194 : if (SgMagicColonExp::pools.empty() == false)
148001 : {
148002 : // Generate an array of memory pools
148003 0 : SgMagicColonExp** objectArray = (SgMagicColonExp**) &(SgMagicColonExp::pools[0]);
148004 :
148005 : // Build a local variable for better performance
148006 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
148007 :
148008 : // Iterate over the memory pools
148009 0 : for (unsigned int i=0; i < SgMagicColonExp::pools.size(); i++)
148010 : {
148011 : // objectArray[i] is a single memory pool
148012 0 : for (unsigned j=0; j < SgMagicColonExp::pool_size; j++)
148013 : {
148014 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
148015 : {
148016 : // printf ("Found a valid SgMagicColonExp object in the memory pool %d at position %d \n",i,j);
148017 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
148018 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
148019 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
148020 : }
148021 : else
148022 : {
148023 : // printf ("Found a INVALID SgMagicColonExp object in the memory pool \n");
148024 : }
148025 : }
148026 : }
148027 : }
148028 :
148029 : // This should not be required since all previously static data members are
148030 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
148031 :
148032 194 : }
148033 :
148034 : void
148035 0 : SgMagicColonExp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
148036 : {
148037 : // This function visits only a single IR node of the memory pool.
148038 : // it is typically called once for each type of IR node within
148039 : // the automatically generated function: traverseRepresentativeNodes().
148040 :
148041 : // Initialize array to the address of the first element of the STL vector
148042 : // (which is guarenteed to be contiguous storage).
148043 : // SgMagicColonExp objectArray [] = *(Memory_Block_List.begin());
148044 0 : if (SgMagicColonExp::pools.empty() == false)
148045 : {
148046 : // Generate an array of memory pools
148047 0 : SgMagicColonExp** objectArray = (SgMagicColonExp**) &(SgMagicColonExp::pools[0]);
148048 :
148049 : // Build a local variable for better performance
148050 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
148051 :
148052 : // Iterate over the memory pools
148053 0 : bool done = false;
148054 0 : unsigned i=0;
148055 :
148056 : // find the first valid IR node, call visit function, and then leave
148057 0 : while ( done == false && i < SgMagicColonExp::pools.size() )
148058 : {
148059 : // objectArray[i] is a single memory pool
148060 : unsigned j=0;
148061 0 : while (done == false && j < SgMagicColonExp::pool_size)
148062 : {
148063 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
148064 : {
148065 0 : traversal.visit(&(objectArray[i][j]));
148066 0 : done = true;
148067 : }
148068 0 : j++;
148069 : }
148070 0 : i++;
148071 : }
148072 :
148073 : #if 0
148074 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
148075 : if (done == false)
148076 : {
148077 : printf ("No representative for SgMagicColonExp found in memory pools \n");
148078 : }
148079 : #endif
148080 : }
148081 0 : }
148082 :
148083 :
148084 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
148085 : // using values that overflow signed values of int.
148086 : size_t
148087 4 : SgMagicColonExp::numberOfNodes()
148088 : {
148089 : // This function traverses the memory pool for an IR node and
148090 : // counts the number of IR nodes of a particular Sage III IR
148091 : // nodes type.
148092 :
148093 4 : size_t count = 0;
148094 4 : if (SgMagicColonExp::pools.empty() == false)
148095 : {
148096 : // Generate an array of memory pools (this is actually a STL vector,
148097 : // but it is contiguious, so OK to treat this way).
148098 0 : SgMagicColonExp** objectArray = (SgMagicColonExp**) &(SgMagicColonExp::pools[0]);
148099 :
148100 : // Build a local variable for better performance (make it a loop invariant variable).
148101 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
148102 :
148103 : // Iterate over all of the memory pools for this IR node.
148104 0 : for (unsigned int i=0; i < SgMagicColonExp::pools.size(); i++)
148105 : {
148106 : // objectArray[i] is a single memory pool, iterate over all the
148107 : // IR nodes and only count those that are valid IR nodes used in
148108 : // the AST (i.e. allocated IR nodes).
148109 0 : for (unsigned j=0; j < SgMagicColonExp::pool_size; j++)
148110 : {
148111 : // This is indexing the STL vector of C/C++ style arrays as a doubly
148112 : // indexed array access. It is OK since we have leveraged the semantics
148113 : // of STL vector memory as contigous and cast the memory as an array
148114 : // of arrays to use the 2D array indexing. Hope this is not confusing,
148115 : // but it s very fast as an implementation.
148116 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
148117 : {
148118 0 : count++;
148119 : }
148120 : }
148121 : }
148122 : }
148123 :
148124 :
148125 :
148126 4 : return count;
148127 : }
148128 :
148129 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
148130 : // using values that overflow signed values of int.
148131 : size_t
148132 0 : SgMagicColonExp::memoryUsage()
148133 : {
148134 : // This function is required because we need the class name as a type when we call sizeof
148135 : // There might be another way to implement this if we have a traversal that only called a
148136 : // representative object (one call for each type of Sage IIIIR node).
148137 0 : size_t memory = numberOfNodes() * sizeof(SgMagicColonExp);
148138 :
148139 0 : return memory;
148140 : }
148141 :
148142 : /* #line 148143 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
148143 :
148144 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
148145 : void
148146 5342 : SgTypeTraitBuiltinOperator::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
148147 : {
148148 : // This function traverses the memory pool for only a specific IR node
148149 : // and calls the visit function of the input class execute a traversal
148150 : // similar to the style of the attribute based traversals within ROSE.
148151 : // This traversal will visit ALL nodes of the AST where as the other
148152 : // attribute based traversals visit only the embedded tree within the AST.
148153 :
148154 : // Initialize array to the address of the first element of the STL vector
148155 : // (which is guaranteed to be contiguous storage).
148156 : // SgTypeTraitBuiltinOperator objectArray [] = *(Memory_Block_List.begin());
148157 5342 : if (SgTypeTraitBuiltinOperator::pools.empty() == false)
148158 : {
148159 : // Generate an array of memory pools
148160 138 : SgTypeTraitBuiltinOperator** objectArray = (SgTypeTraitBuiltinOperator**) &(SgTypeTraitBuiltinOperator::pools[0]);
148161 :
148162 : // Build a local variable for better performance
148163 138 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
148164 : #if 0
148165 : // Iterate over the memory pools
148166 : for (unsigned int i=0; i < SgTypeTraitBuiltinOperator::pools.size(); i++)
148167 : {
148168 : // objectArray[i] is a single memory pool
148169 : for (int j=0; j < SgTypeTraitBuiltinOperator::pool_size; j++)
148170 : {
148171 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
148172 : {
148173 : traversal.visit(&(objectArray[i][j]));
148174 : }
148175 : }
148176 : }
148177 : #else
148178 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
148179 : // compute the list first and then call the visit function on each list element.
148180 :
148181 : // printf ("Inside of SgTypeTraitBuiltinOperator::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
148182 :
148183 276 : std::vector<SgTypeTraitBuiltinOperator*> nodeList;
148184 :
148185 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
148186 276 : for (unsigned int i=0; i < SgTypeTraitBuiltinOperator::pools.size(); i++)
148187 : {
148188 : // objectArray[i] is a single memory pool
148189 276138 : for (unsigned j=0; j < SgTypeTraitBuiltinOperator::pool_size; j++)
148190 : {
148191 276000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
148192 : {
148193 5868 : nodeList.push_back(&(objectArray[i][j]));
148194 : }
148195 : }
148196 : }
148197 :
148198 : // Iterate over the saved list
148199 138 : size_t nodeListSize = nodeList.size();
148200 6006 : for (size_t i=0; i < nodeListSize; i++)
148201 : {
148202 5868 : ROSE_ASSERT(nodeList[i] != NULL);
148203 : #if 0
148204 : traversal.visit(nodeList[i]);
148205 : #else
148206 5868 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
148207 : {
148208 5868 : traversal.visit(nodeList[i]);
148209 : }
148210 : #endif
148211 : }
148212 : #endif
148213 : }
148214 :
148215 : // This should not be required since all previously static data members are
148216 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
148217 :
148218 5342 : }
148219 :
148220 :
148221 : void
148222 194 : SgTypeTraitBuiltinOperator::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
148223 : {
148224 : // This function traverses the memory pool for an IR node and
148225 : // calls the function to execute the visitor object.
148226 :
148227 : // Initialize array to the address of the first element of the STL vector
148228 : // (which is guarenteed to be contiguous storage).
148229 : // SgTypeTraitBuiltinOperator objectArray [] = *(Memory_Block_List.begin());
148230 194 : if (SgTypeTraitBuiltinOperator::pools.empty() == false)
148231 : {
148232 : // Generate an array of memory pools
148233 137 : SgTypeTraitBuiltinOperator** objectArray = (SgTypeTraitBuiltinOperator**) &(SgTypeTraitBuiltinOperator::pools[0]);
148234 :
148235 : // Build a local variable for better performance
148236 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
148237 :
148238 : // Iterate over the memory pools
148239 274 : for (unsigned int i=0; i < SgTypeTraitBuiltinOperator::pools.size(); i++)
148240 : {
148241 : // objectArray[i] is a single memory pool
148242 274137 : for (unsigned j=0; j < SgTypeTraitBuiltinOperator::pool_size; j++)
148243 : {
148244 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
148245 : {
148246 : // printf ("Found a valid SgTypeTraitBuiltinOperator object in the memory pool %d at position %d \n",i,j);
148247 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
148248 5898 : objectArray[i][j].executeVisitorMemberFunction(visitor);
148249 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
148250 : }
148251 : else
148252 : {
148253 : // printf ("Found a INVALID SgTypeTraitBuiltinOperator object in the memory pool \n");
148254 : }
148255 : }
148256 : }
148257 : }
148258 :
148259 : // This should not be required since all previously static data members are
148260 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
148261 :
148262 194 : }
148263 :
148264 : void
148265 0 : SgTypeTraitBuiltinOperator::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
148266 : {
148267 : // This function visits only a single IR node of the memory pool.
148268 : // it is typically called once for each type of IR node within
148269 : // the automatically generated function: traverseRepresentativeNodes().
148270 :
148271 : // Initialize array to the address of the first element of the STL vector
148272 : // (which is guarenteed to be contiguous storage).
148273 : // SgTypeTraitBuiltinOperator objectArray [] = *(Memory_Block_List.begin());
148274 0 : if (SgTypeTraitBuiltinOperator::pools.empty() == false)
148275 : {
148276 : // Generate an array of memory pools
148277 0 : SgTypeTraitBuiltinOperator** objectArray = (SgTypeTraitBuiltinOperator**) &(SgTypeTraitBuiltinOperator::pools[0]);
148278 :
148279 : // Build a local variable for better performance
148280 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
148281 :
148282 : // Iterate over the memory pools
148283 0 : bool done = false;
148284 0 : unsigned i=0;
148285 :
148286 : // find the first valid IR node, call visit function, and then leave
148287 0 : while ( done == false && i < SgTypeTraitBuiltinOperator::pools.size() )
148288 : {
148289 : // objectArray[i] is a single memory pool
148290 : unsigned j=0;
148291 0 : while (done == false && j < SgTypeTraitBuiltinOperator::pool_size)
148292 : {
148293 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
148294 : {
148295 0 : traversal.visit(&(objectArray[i][j]));
148296 0 : done = true;
148297 : }
148298 0 : j++;
148299 : }
148300 0 : i++;
148301 : }
148302 :
148303 : #if 0
148304 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
148305 : if (done == false)
148306 : {
148307 : printf ("No representative for SgTypeTraitBuiltinOperator found in memory pools \n");
148308 : }
148309 : #endif
148310 : }
148311 0 : }
148312 :
148313 :
148314 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
148315 : // using values that overflow signed values of int.
148316 : size_t
148317 4 : SgTypeTraitBuiltinOperator::numberOfNodes()
148318 : {
148319 : // This function traverses the memory pool for an IR node and
148320 : // counts the number of IR nodes of a particular Sage III IR
148321 : // nodes type.
148322 :
148323 4 : size_t count = 0;
148324 4 : if (SgTypeTraitBuiltinOperator::pools.empty() == false)
148325 : {
148326 : // Generate an array of memory pools (this is actually a STL vector,
148327 : // but it is contiguious, so OK to treat this way).
148328 1 : SgTypeTraitBuiltinOperator** objectArray = (SgTypeTraitBuiltinOperator**) &(SgTypeTraitBuiltinOperator::pools[0]);
148329 :
148330 : // Build a local variable for better performance (make it a loop invariant variable).
148331 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
148332 :
148333 : // Iterate over all of the memory pools for this IR node.
148334 2 : for (unsigned int i=0; i < SgTypeTraitBuiltinOperator::pools.size(); i++)
148335 : {
148336 : // objectArray[i] is a single memory pool, iterate over all the
148337 : // IR nodes and only count those that are valid IR nodes used in
148338 : // the AST (i.e. allocated IR nodes).
148339 2001 : for (unsigned j=0; j < SgTypeTraitBuiltinOperator::pool_size; j++)
148340 : {
148341 : // This is indexing the STL vector of C/C++ style arrays as a doubly
148342 : // indexed array access. It is OK since we have leveraged the semantics
148343 : // of STL vector memory as contigous and cast the memory as an array
148344 : // of arrays to use the 2D array indexing. Hope this is not confusing,
148345 : // but it s very fast as an implementation.
148346 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
148347 : {
148348 42 : count++;
148349 : }
148350 : }
148351 : }
148352 : }
148353 :
148354 :
148355 :
148356 4 : return count;
148357 : }
148358 :
148359 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
148360 : // using values that overflow signed values of int.
148361 : size_t
148362 0 : SgTypeTraitBuiltinOperator::memoryUsage()
148363 : {
148364 : // This function is required because we need the class name as a type when we call sizeof
148365 : // There might be another way to implement this if we have a traversal that only called a
148366 : // representative object (one call for each type of Sage IIIIR node).
148367 0 : size_t memory = numberOfNodes() * sizeof(SgTypeTraitBuiltinOperator);
148368 :
148369 0 : return memory;
148370 : }
148371 :
148372 : /* #line 148373 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
148373 :
148374 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
148375 : void
148376 5342 : SgCompoundLiteralExp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
148377 : {
148378 : // This function traverses the memory pool for only a specific IR node
148379 : // and calls the visit function of the input class execute a traversal
148380 : // similar to the style of the attribute based traversals within ROSE.
148381 : // This traversal will visit ALL nodes of the AST where as the other
148382 : // attribute based traversals visit only the embedded tree within the AST.
148383 :
148384 : // Initialize array to the address of the first element of the STL vector
148385 : // (which is guaranteed to be contiguous storage).
148386 : // SgCompoundLiteralExp objectArray [] = *(Memory_Block_List.begin());
148387 5342 : if (SgCompoundLiteralExp::pools.empty() == false)
148388 : {
148389 : // Generate an array of memory pools
148390 0 : SgCompoundLiteralExp** objectArray = (SgCompoundLiteralExp**) &(SgCompoundLiteralExp::pools[0]);
148391 :
148392 : // Build a local variable for better performance
148393 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
148394 : #if 0
148395 : // Iterate over the memory pools
148396 : for (unsigned int i=0; i < SgCompoundLiteralExp::pools.size(); i++)
148397 : {
148398 : // objectArray[i] is a single memory pool
148399 : for (int j=0; j < SgCompoundLiteralExp::pool_size; j++)
148400 : {
148401 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
148402 : {
148403 : traversal.visit(&(objectArray[i][j]));
148404 : }
148405 : }
148406 : }
148407 : #else
148408 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
148409 : // compute the list first and then call the visit function on each list element.
148410 :
148411 : // printf ("Inside of SgCompoundLiteralExp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
148412 :
148413 0 : std::vector<SgCompoundLiteralExp*> nodeList;
148414 :
148415 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
148416 0 : for (unsigned int i=0; i < SgCompoundLiteralExp::pools.size(); i++)
148417 : {
148418 : // objectArray[i] is a single memory pool
148419 0 : for (unsigned j=0; j < SgCompoundLiteralExp::pool_size; j++)
148420 : {
148421 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
148422 : {
148423 0 : nodeList.push_back(&(objectArray[i][j]));
148424 : }
148425 : }
148426 : }
148427 :
148428 : // Iterate over the saved list
148429 0 : size_t nodeListSize = nodeList.size();
148430 0 : for (size_t i=0; i < nodeListSize; i++)
148431 : {
148432 0 : ROSE_ASSERT(nodeList[i] != NULL);
148433 : #if 0
148434 : traversal.visit(nodeList[i]);
148435 : #else
148436 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
148437 : {
148438 0 : traversal.visit(nodeList[i]);
148439 : }
148440 : #endif
148441 : }
148442 : #endif
148443 : }
148444 :
148445 : // This should not be required since all previously static data members are
148446 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
148447 :
148448 5342 : }
148449 :
148450 :
148451 : void
148452 194 : SgCompoundLiteralExp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
148453 : {
148454 : // This function traverses the memory pool for an IR node and
148455 : // calls the function to execute the visitor object.
148456 :
148457 : // Initialize array to the address of the first element of the STL vector
148458 : // (which is guarenteed to be contiguous storage).
148459 : // SgCompoundLiteralExp objectArray [] = *(Memory_Block_List.begin());
148460 194 : if (SgCompoundLiteralExp::pools.empty() == false)
148461 : {
148462 : // Generate an array of memory pools
148463 0 : SgCompoundLiteralExp** objectArray = (SgCompoundLiteralExp**) &(SgCompoundLiteralExp::pools[0]);
148464 :
148465 : // Build a local variable for better performance
148466 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
148467 :
148468 : // Iterate over the memory pools
148469 0 : for (unsigned int i=0; i < SgCompoundLiteralExp::pools.size(); i++)
148470 : {
148471 : // objectArray[i] is a single memory pool
148472 0 : for (unsigned j=0; j < SgCompoundLiteralExp::pool_size; j++)
148473 : {
148474 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
148475 : {
148476 : // printf ("Found a valid SgCompoundLiteralExp object in the memory pool %d at position %d \n",i,j);
148477 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
148478 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
148479 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
148480 : }
148481 : else
148482 : {
148483 : // printf ("Found a INVALID SgCompoundLiteralExp object in the memory pool \n");
148484 : }
148485 : }
148486 : }
148487 : }
148488 :
148489 : // This should not be required since all previously static data members are
148490 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
148491 :
148492 194 : }
148493 :
148494 : void
148495 0 : SgCompoundLiteralExp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
148496 : {
148497 : // This function visits only a single IR node of the memory pool.
148498 : // it is typically called once for each type of IR node within
148499 : // the automatically generated function: traverseRepresentativeNodes().
148500 :
148501 : // Initialize array to the address of the first element of the STL vector
148502 : // (which is guarenteed to be contiguous storage).
148503 : // SgCompoundLiteralExp objectArray [] = *(Memory_Block_List.begin());
148504 0 : if (SgCompoundLiteralExp::pools.empty() == false)
148505 : {
148506 : // Generate an array of memory pools
148507 0 : SgCompoundLiteralExp** objectArray = (SgCompoundLiteralExp**) &(SgCompoundLiteralExp::pools[0]);
148508 :
148509 : // Build a local variable for better performance
148510 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
148511 :
148512 : // Iterate over the memory pools
148513 0 : bool done = false;
148514 0 : unsigned i=0;
148515 :
148516 : // find the first valid IR node, call visit function, and then leave
148517 0 : while ( done == false && i < SgCompoundLiteralExp::pools.size() )
148518 : {
148519 : // objectArray[i] is a single memory pool
148520 : unsigned j=0;
148521 0 : while (done == false && j < SgCompoundLiteralExp::pool_size)
148522 : {
148523 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
148524 : {
148525 0 : traversal.visit(&(objectArray[i][j]));
148526 0 : done = true;
148527 : }
148528 0 : j++;
148529 : }
148530 0 : i++;
148531 : }
148532 :
148533 : #if 0
148534 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
148535 : if (done == false)
148536 : {
148537 : printf ("No representative for SgCompoundLiteralExp found in memory pools \n");
148538 : }
148539 : #endif
148540 : }
148541 0 : }
148542 :
148543 :
148544 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
148545 : // using values that overflow signed values of int.
148546 : size_t
148547 4 : SgCompoundLiteralExp::numberOfNodes()
148548 : {
148549 : // This function traverses the memory pool for an IR node and
148550 : // counts the number of IR nodes of a particular Sage III IR
148551 : // nodes type.
148552 :
148553 4 : size_t count = 0;
148554 4 : if (SgCompoundLiteralExp::pools.empty() == false)
148555 : {
148556 : // Generate an array of memory pools (this is actually a STL vector,
148557 : // but it is contiguious, so OK to treat this way).
148558 0 : SgCompoundLiteralExp** objectArray = (SgCompoundLiteralExp**) &(SgCompoundLiteralExp::pools[0]);
148559 :
148560 : // Build a local variable for better performance (make it a loop invariant variable).
148561 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
148562 :
148563 : // Iterate over all of the memory pools for this IR node.
148564 0 : for (unsigned int i=0; i < SgCompoundLiteralExp::pools.size(); i++)
148565 : {
148566 : // objectArray[i] is a single memory pool, iterate over all the
148567 : // IR nodes and only count those that are valid IR nodes used in
148568 : // the AST (i.e. allocated IR nodes).
148569 0 : for (unsigned j=0; j < SgCompoundLiteralExp::pool_size; j++)
148570 : {
148571 : // This is indexing the STL vector of C/C++ style arrays as a doubly
148572 : // indexed array access. It is OK since we have leveraged the semantics
148573 : // of STL vector memory as contigous and cast the memory as an array
148574 : // of arrays to use the 2D array indexing. Hope this is not confusing,
148575 : // but it s very fast as an implementation.
148576 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
148577 : {
148578 0 : count++;
148579 : }
148580 : }
148581 : }
148582 : }
148583 :
148584 :
148585 :
148586 4 : return count;
148587 : }
148588 :
148589 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
148590 : // using values that overflow signed values of int.
148591 : size_t
148592 0 : SgCompoundLiteralExp::memoryUsage()
148593 : {
148594 : // This function is required because we need the class name as a type when we call sizeof
148595 : // There might be another way to implement this if we have a traversal that only called a
148596 : // representative object (one call for each type of Sage IIIIR node).
148597 0 : size_t memory = numberOfNodes() * sizeof(SgCompoundLiteralExp);
148598 :
148599 0 : return memory;
148600 : }
148601 :
148602 : /* #line 148603 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
148603 :
148604 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
148605 : void
148606 5342 : SgTypeExpression::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
148607 : {
148608 : // This function traverses the memory pool for only a specific IR node
148609 : // and calls the visit function of the input class execute a traversal
148610 : // similar to the style of the attribute based traversals within ROSE.
148611 : // This traversal will visit ALL nodes of the AST where as the other
148612 : // attribute based traversals visit only the embedded tree within the AST.
148613 :
148614 : // Initialize array to the address of the first element of the STL vector
148615 : // (which is guaranteed to be contiguous storage).
148616 : // SgTypeExpression objectArray [] = *(Memory_Block_List.begin());
148617 5342 : if (SgTypeExpression::pools.empty() == false)
148618 : {
148619 : // Generate an array of memory pools
148620 0 : SgTypeExpression** objectArray = (SgTypeExpression**) &(SgTypeExpression::pools[0]);
148621 :
148622 : // Build a local variable for better performance
148623 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
148624 : #if 0
148625 : // Iterate over the memory pools
148626 : for (unsigned int i=0; i < SgTypeExpression::pools.size(); i++)
148627 : {
148628 : // objectArray[i] is a single memory pool
148629 : for (int j=0; j < SgTypeExpression::pool_size; j++)
148630 : {
148631 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
148632 : {
148633 : traversal.visit(&(objectArray[i][j]));
148634 : }
148635 : }
148636 : }
148637 : #else
148638 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
148639 : // compute the list first and then call the visit function on each list element.
148640 :
148641 : // printf ("Inside of SgTypeExpression::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
148642 :
148643 0 : std::vector<SgTypeExpression*> nodeList;
148644 :
148645 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
148646 0 : for (unsigned int i=0; i < SgTypeExpression::pools.size(); i++)
148647 : {
148648 : // objectArray[i] is a single memory pool
148649 0 : for (unsigned j=0; j < SgTypeExpression::pool_size; j++)
148650 : {
148651 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
148652 : {
148653 0 : nodeList.push_back(&(objectArray[i][j]));
148654 : }
148655 : }
148656 : }
148657 :
148658 : // Iterate over the saved list
148659 0 : size_t nodeListSize = nodeList.size();
148660 0 : for (size_t i=0; i < nodeListSize; i++)
148661 : {
148662 0 : ROSE_ASSERT(nodeList[i] != NULL);
148663 : #if 0
148664 : traversal.visit(nodeList[i]);
148665 : #else
148666 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
148667 : {
148668 0 : traversal.visit(nodeList[i]);
148669 : }
148670 : #endif
148671 : }
148672 : #endif
148673 : }
148674 :
148675 : // This should not be required since all previously static data members are
148676 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
148677 :
148678 5342 : }
148679 :
148680 :
148681 : void
148682 194 : SgTypeExpression::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
148683 : {
148684 : // This function traverses the memory pool for an IR node and
148685 : // calls the function to execute the visitor object.
148686 :
148687 : // Initialize array to the address of the first element of the STL vector
148688 : // (which is guarenteed to be contiguous storage).
148689 : // SgTypeExpression objectArray [] = *(Memory_Block_List.begin());
148690 194 : if (SgTypeExpression::pools.empty() == false)
148691 : {
148692 : // Generate an array of memory pools
148693 0 : SgTypeExpression** objectArray = (SgTypeExpression**) &(SgTypeExpression::pools[0]);
148694 :
148695 : // Build a local variable for better performance
148696 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
148697 :
148698 : // Iterate over the memory pools
148699 0 : for (unsigned int i=0; i < SgTypeExpression::pools.size(); i++)
148700 : {
148701 : // objectArray[i] is a single memory pool
148702 0 : for (unsigned j=0; j < SgTypeExpression::pool_size; j++)
148703 : {
148704 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
148705 : {
148706 : // printf ("Found a valid SgTypeExpression object in the memory pool %d at position %d \n",i,j);
148707 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
148708 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
148709 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
148710 : }
148711 : else
148712 : {
148713 : // printf ("Found a INVALID SgTypeExpression object in the memory pool \n");
148714 : }
148715 : }
148716 : }
148717 : }
148718 :
148719 : // This should not be required since all previously static data members are
148720 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
148721 :
148722 194 : }
148723 :
148724 : void
148725 0 : SgTypeExpression::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
148726 : {
148727 : // This function visits only a single IR node of the memory pool.
148728 : // it is typically called once for each type of IR node within
148729 : // the automatically generated function: traverseRepresentativeNodes().
148730 :
148731 : // Initialize array to the address of the first element of the STL vector
148732 : // (which is guarenteed to be contiguous storage).
148733 : // SgTypeExpression objectArray [] = *(Memory_Block_List.begin());
148734 0 : if (SgTypeExpression::pools.empty() == false)
148735 : {
148736 : // Generate an array of memory pools
148737 0 : SgTypeExpression** objectArray = (SgTypeExpression**) &(SgTypeExpression::pools[0]);
148738 :
148739 : // Build a local variable for better performance
148740 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
148741 :
148742 : // Iterate over the memory pools
148743 0 : bool done = false;
148744 0 : unsigned i=0;
148745 :
148746 : // find the first valid IR node, call visit function, and then leave
148747 0 : while ( done == false && i < SgTypeExpression::pools.size() )
148748 : {
148749 : // objectArray[i] is a single memory pool
148750 : unsigned j=0;
148751 0 : while (done == false && j < SgTypeExpression::pool_size)
148752 : {
148753 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
148754 : {
148755 0 : traversal.visit(&(objectArray[i][j]));
148756 0 : done = true;
148757 : }
148758 0 : j++;
148759 : }
148760 0 : i++;
148761 : }
148762 :
148763 : #if 0
148764 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
148765 : if (done == false)
148766 : {
148767 : printf ("No representative for SgTypeExpression found in memory pools \n");
148768 : }
148769 : #endif
148770 : }
148771 0 : }
148772 :
148773 :
148774 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
148775 : // using values that overflow signed values of int.
148776 : size_t
148777 4 : SgTypeExpression::numberOfNodes()
148778 : {
148779 : // This function traverses the memory pool for an IR node and
148780 : // counts the number of IR nodes of a particular Sage III IR
148781 : // nodes type.
148782 :
148783 4 : size_t count = 0;
148784 4 : if (SgTypeExpression::pools.empty() == false)
148785 : {
148786 : // Generate an array of memory pools (this is actually a STL vector,
148787 : // but it is contiguious, so OK to treat this way).
148788 0 : SgTypeExpression** objectArray = (SgTypeExpression**) &(SgTypeExpression::pools[0]);
148789 :
148790 : // Build a local variable for better performance (make it a loop invariant variable).
148791 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
148792 :
148793 : // Iterate over all of the memory pools for this IR node.
148794 0 : for (unsigned int i=0; i < SgTypeExpression::pools.size(); i++)
148795 : {
148796 : // objectArray[i] is a single memory pool, iterate over all the
148797 : // IR nodes and only count those that are valid IR nodes used in
148798 : // the AST (i.e. allocated IR nodes).
148799 0 : for (unsigned j=0; j < SgTypeExpression::pool_size; j++)
148800 : {
148801 : // This is indexing the STL vector of C/C++ style arrays as a doubly
148802 : // indexed array access. It is OK since we have leveraged the semantics
148803 : // of STL vector memory as contigous and cast the memory as an array
148804 : // of arrays to use the 2D array indexing. Hope this is not confusing,
148805 : // but it s very fast as an implementation.
148806 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
148807 : {
148808 0 : count++;
148809 : }
148810 : }
148811 : }
148812 : }
148813 :
148814 :
148815 :
148816 4 : return count;
148817 : }
148818 :
148819 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
148820 : // using values that overflow signed values of int.
148821 : size_t
148822 0 : SgTypeExpression::memoryUsage()
148823 : {
148824 : // This function is required because we need the class name as a type when we call sizeof
148825 : // There might be another way to implement this if we have a traversal that only called a
148826 : // representative object (one call for each type of Sage IIIIR node).
148827 0 : size_t memory = numberOfNodes() * sizeof(SgTypeExpression);
148828 :
148829 0 : return memory;
148830 : }
148831 :
148832 : /* #line 148833 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
148833 :
148834 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
148835 : void
148836 5342 : SgClassExp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
148837 : {
148838 : // This function traverses the memory pool for only a specific IR node
148839 : // and calls the visit function of the input class execute a traversal
148840 : // similar to the style of the attribute based traversals within ROSE.
148841 : // This traversal will visit ALL nodes of the AST where as the other
148842 : // attribute based traversals visit only the embedded tree within the AST.
148843 :
148844 : // Initialize array to the address of the first element of the STL vector
148845 : // (which is guaranteed to be contiguous storage).
148846 : // SgClassExp objectArray [] = *(Memory_Block_List.begin());
148847 5342 : if (SgClassExp::pools.empty() == false)
148848 : {
148849 : // Generate an array of memory pools
148850 0 : SgClassExp** objectArray = (SgClassExp**) &(SgClassExp::pools[0]);
148851 :
148852 : // Build a local variable for better performance
148853 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
148854 : #if 0
148855 : // Iterate over the memory pools
148856 : for (unsigned int i=0; i < SgClassExp::pools.size(); i++)
148857 : {
148858 : // objectArray[i] is a single memory pool
148859 : for (int j=0; j < SgClassExp::pool_size; j++)
148860 : {
148861 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
148862 : {
148863 : traversal.visit(&(objectArray[i][j]));
148864 : }
148865 : }
148866 : }
148867 : #else
148868 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
148869 : // compute the list first and then call the visit function on each list element.
148870 :
148871 : // printf ("Inside of SgClassExp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
148872 :
148873 0 : std::vector<SgClassExp*> nodeList;
148874 :
148875 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
148876 0 : for (unsigned int i=0; i < SgClassExp::pools.size(); i++)
148877 : {
148878 : // objectArray[i] is a single memory pool
148879 0 : for (unsigned j=0; j < SgClassExp::pool_size; j++)
148880 : {
148881 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
148882 : {
148883 0 : nodeList.push_back(&(objectArray[i][j]));
148884 : }
148885 : }
148886 : }
148887 :
148888 : // Iterate over the saved list
148889 0 : size_t nodeListSize = nodeList.size();
148890 0 : for (size_t i=0; i < nodeListSize; i++)
148891 : {
148892 0 : ROSE_ASSERT(nodeList[i] != NULL);
148893 : #if 0
148894 : traversal.visit(nodeList[i]);
148895 : #else
148896 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
148897 : {
148898 0 : traversal.visit(nodeList[i]);
148899 : }
148900 : #endif
148901 : }
148902 : #endif
148903 : }
148904 :
148905 : // This should not be required since all previously static data members are
148906 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
148907 :
148908 5342 : }
148909 :
148910 :
148911 : void
148912 194 : SgClassExp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
148913 : {
148914 : // This function traverses the memory pool for an IR node and
148915 : // calls the function to execute the visitor object.
148916 :
148917 : // Initialize array to the address of the first element of the STL vector
148918 : // (which is guarenteed to be contiguous storage).
148919 : // SgClassExp objectArray [] = *(Memory_Block_List.begin());
148920 194 : if (SgClassExp::pools.empty() == false)
148921 : {
148922 : // Generate an array of memory pools
148923 0 : SgClassExp** objectArray = (SgClassExp**) &(SgClassExp::pools[0]);
148924 :
148925 : // Build a local variable for better performance
148926 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
148927 :
148928 : // Iterate over the memory pools
148929 0 : for (unsigned int i=0; i < SgClassExp::pools.size(); i++)
148930 : {
148931 : // objectArray[i] is a single memory pool
148932 0 : for (unsigned j=0; j < SgClassExp::pool_size; j++)
148933 : {
148934 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
148935 : {
148936 : // printf ("Found a valid SgClassExp object in the memory pool %d at position %d \n",i,j);
148937 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
148938 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
148939 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
148940 : }
148941 : else
148942 : {
148943 : // printf ("Found a INVALID SgClassExp object in the memory pool \n");
148944 : }
148945 : }
148946 : }
148947 : }
148948 :
148949 : // This should not be required since all previously static data members are
148950 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
148951 :
148952 194 : }
148953 :
148954 : void
148955 0 : SgClassExp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
148956 : {
148957 : // This function visits only a single IR node of the memory pool.
148958 : // it is typically called once for each type of IR node within
148959 : // the automatically generated function: traverseRepresentativeNodes().
148960 :
148961 : // Initialize array to the address of the first element of the STL vector
148962 : // (which is guarenteed to be contiguous storage).
148963 : // SgClassExp objectArray [] = *(Memory_Block_List.begin());
148964 0 : if (SgClassExp::pools.empty() == false)
148965 : {
148966 : // Generate an array of memory pools
148967 0 : SgClassExp** objectArray = (SgClassExp**) &(SgClassExp::pools[0]);
148968 :
148969 : // Build a local variable for better performance
148970 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
148971 :
148972 : // Iterate over the memory pools
148973 0 : bool done = false;
148974 0 : unsigned i=0;
148975 :
148976 : // find the first valid IR node, call visit function, and then leave
148977 0 : while ( done == false && i < SgClassExp::pools.size() )
148978 : {
148979 : // objectArray[i] is a single memory pool
148980 : unsigned j=0;
148981 0 : while (done == false && j < SgClassExp::pool_size)
148982 : {
148983 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
148984 : {
148985 0 : traversal.visit(&(objectArray[i][j]));
148986 0 : done = true;
148987 : }
148988 0 : j++;
148989 : }
148990 0 : i++;
148991 : }
148992 :
148993 : #if 0
148994 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
148995 : if (done == false)
148996 : {
148997 : printf ("No representative for SgClassExp found in memory pools \n");
148998 : }
148999 : #endif
149000 : }
149001 0 : }
149002 :
149003 :
149004 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
149005 : // using values that overflow signed values of int.
149006 : size_t
149007 4 : SgClassExp::numberOfNodes()
149008 : {
149009 : // This function traverses the memory pool for an IR node and
149010 : // counts the number of IR nodes of a particular Sage III IR
149011 : // nodes type.
149012 :
149013 4 : size_t count = 0;
149014 4 : if (SgClassExp::pools.empty() == false)
149015 : {
149016 : // Generate an array of memory pools (this is actually a STL vector,
149017 : // but it is contiguious, so OK to treat this way).
149018 0 : SgClassExp** objectArray = (SgClassExp**) &(SgClassExp::pools[0]);
149019 :
149020 : // Build a local variable for better performance (make it a loop invariant variable).
149021 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
149022 :
149023 : // Iterate over all of the memory pools for this IR node.
149024 0 : for (unsigned int i=0; i < SgClassExp::pools.size(); i++)
149025 : {
149026 : // objectArray[i] is a single memory pool, iterate over all the
149027 : // IR nodes and only count those that are valid IR nodes used in
149028 : // the AST (i.e. allocated IR nodes).
149029 0 : for (unsigned j=0; j < SgClassExp::pool_size; j++)
149030 : {
149031 : // This is indexing the STL vector of C/C++ style arrays as a doubly
149032 : // indexed array access. It is OK since we have leveraged the semantics
149033 : // of STL vector memory as contigous and cast the memory as an array
149034 : // of arrays to use the 2D array indexing. Hope this is not confusing,
149035 : // but it s very fast as an implementation.
149036 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
149037 : {
149038 0 : count++;
149039 : }
149040 : }
149041 : }
149042 : }
149043 :
149044 :
149045 :
149046 4 : return count;
149047 : }
149048 :
149049 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
149050 : // using values that overflow signed values of int.
149051 : size_t
149052 0 : SgClassExp::memoryUsage()
149053 : {
149054 : // This function is required because we need the class name as a type when we call sizeof
149055 : // There might be another way to implement this if we have a traversal that only called a
149056 : // representative object (one call for each type of Sage IIIIR node).
149057 0 : size_t memory = numberOfNodes() * sizeof(SgClassExp);
149058 :
149059 0 : return memory;
149060 : }
149061 :
149062 : /* #line 149063 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
149063 :
149064 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
149065 : void
149066 5342 : SgFunctionParameterRefExp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
149067 : {
149068 : // This function traverses the memory pool for only a specific IR node
149069 : // and calls the visit function of the input class execute a traversal
149070 : // similar to the style of the attribute based traversals within ROSE.
149071 : // This traversal will visit ALL nodes of the AST where as the other
149072 : // attribute based traversals visit only the embedded tree within the AST.
149073 :
149074 : // Initialize array to the address of the first element of the STL vector
149075 : // (which is guaranteed to be contiguous storage).
149076 : // SgFunctionParameterRefExp objectArray [] = *(Memory_Block_List.begin());
149077 5342 : if (SgFunctionParameterRefExp::pools.empty() == false)
149078 : {
149079 : // Generate an array of memory pools
149080 138 : SgFunctionParameterRefExp** objectArray = (SgFunctionParameterRefExp**) &(SgFunctionParameterRefExp::pools[0]);
149081 :
149082 : // Build a local variable for better performance
149083 138 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
149084 : #if 0
149085 : // Iterate over the memory pools
149086 : for (unsigned int i=0; i < SgFunctionParameterRefExp::pools.size(); i++)
149087 : {
149088 : // objectArray[i] is a single memory pool
149089 : for (int j=0; j < SgFunctionParameterRefExp::pool_size; j++)
149090 : {
149091 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
149092 : {
149093 : traversal.visit(&(objectArray[i][j]));
149094 : }
149095 : }
149096 : }
149097 : #else
149098 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
149099 : // compute the list first and then call the visit function on each list element.
149100 :
149101 : // printf ("Inside of SgFunctionParameterRefExp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
149102 :
149103 276 : std::vector<SgFunctionParameterRefExp*> nodeList;
149104 :
149105 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
149106 276 : for (unsigned int i=0; i < SgFunctionParameterRefExp::pools.size(); i++)
149107 : {
149108 : // objectArray[i] is a single memory pool
149109 276138 : for (unsigned j=0; j < SgFunctionParameterRefExp::pool_size; j++)
149110 : {
149111 276000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
149112 : {
149113 8441 : nodeList.push_back(&(objectArray[i][j]));
149114 : }
149115 : }
149116 : }
149117 :
149118 : // Iterate over the saved list
149119 138 : size_t nodeListSize = nodeList.size();
149120 8579 : for (size_t i=0; i < nodeListSize; i++)
149121 : {
149122 8441 : ROSE_ASSERT(nodeList[i] != NULL);
149123 : #if 0
149124 : traversal.visit(nodeList[i]);
149125 : #else
149126 8441 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
149127 : {
149128 8441 : traversal.visit(nodeList[i]);
149129 : }
149130 : #endif
149131 : }
149132 : #endif
149133 : }
149134 :
149135 : // This should not be required since all previously static data members are
149136 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
149137 :
149138 5342 : }
149139 :
149140 :
149141 : void
149142 194 : SgFunctionParameterRefExp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
149143 : {
149144 : // This function traverses the memory pool for an IR node and
149145 : // calls the function to execute the visitor object.
149146 :
149147 : // Initialize array to the address of the first element of the STL vector
149148 : // (which is guarenteed to be contiguous storage).
149149 : // SgFunctionParameterRefExp objectArray [] = *(Memory_Block_List.begin());
149150 194 : if (SgFunctionParameterRefExp::pools.empty() == false)
149151 : {
149152 : // Generate an array of memory pools
149153 137 : SgFunctionParameterRefExp** objectArray = (SgFunctionParameterRefExp**) &(SgFunctionParameterRefExp::pools[0]);
149154 :
149155 : // Build a local variable for better performance
149156 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
149157 :
149158 : // Iterate over the memory pools
149159 274 : for (unsigned int i=0; i < SgFunctionParameterRefExp::pools.size(); i++)
149160 : {
149161 : // objectArray[i] is a single memory pool
149162 274137 : for (unsigned j=0; j < SgFunctionParameterRefExp::pool_size; j++)
149163 : {
149164 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
149165 : {
149166 : // printf ("Found a valid SgFunctionParameterRefExp object in the memory pool %d at position %d \n",i,j);
149167 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
149168 9179 : objectArray[i][j].executeVisitorMemberFunction(visitor);
149169 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
149170 : }
149171 : else
149172 : {
149173 : // printf ("Found a INVALID SgFunctionParameterRefExp object in the memory pool \n");
149174 : }
149175 : }
149176 : }
149177 : }
149178 :
149179 : // This should not be required since all previously static data members are
149180 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
149181 :
149182 194 : }
149183 :
149184 : void
149185 0 : SgFunctionParameterRefExp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
149186 : {
149187 : // This function visits only a single IR node of the memory pool.
149188 : // it is typically called once for each type of IR node within
149189 : // the automatically generated function: traverseRepresentativeNodes().
149190 :
149191 : // Initialize array to the address of the first element of the STL vector
149192 : // (which is guarenteed to be contiguous storage).
149193 : // SgFunctionParameterRefExp objectArray [] = *(Memory_Block_List.begin());
149194 0 : if (SgFunctionParameterRefExp::pools.empty() == false)
149195 : {
149196 : // Generate an array of memory pools
149197 0 : SgFunctionParameterRefExp** objectArray = (SgFunctionParameterRefExp**) &(SgFunctionParameterRefExp::pools[0]);
149198 :
149199 : // Build a local variable for better performance
149200 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
149201 :
149202 : // Iterate over the memory pools
149203 0 : bool done = false;
149204 0 : unsigned i=0;
149205 :
149206 : // find the first valid IR node, call visit function, and then leave
149207 0 : while ( done == false && i < SgFunctionParameterRefExp::pools.size() )
149208 : {
149209 : // objectArray[i] is a single memory pool
149210 : unsigned j=0;
149211 0 : while (done == false && j < SgFunctionParameterRefExp::pool_size)
149212 : {
149213 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
149214 : {
149215 0 : traversal.visit(&(objectArray[i][j]));
149216 0 : done = true;
149217 : }
149218 0 : j++;
149219 : }
149220 0 : i++;
149221 : }
149222 :
149223 : #if 0
149224 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
149225 : if (done == false)
149226 : {
149227 : printf ("No representative for SgFunctionParameterRefExp found in memory pools \n");
149228 : }
149229 : #endif
149230 : }
149231 0 : }
149232 :
149233 :
149234 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
149235 : // using values that overflow signed values of int.
149236 : size_t
149237 4 : SgFunctionParameterRefExp::numberOfNodes()
149238 : {
149239 : // This function traverses the memory pool for an IR node and
149240 : // counts the number of IR nodes of a particular Sage III IR
149241 : // nodes type.
149242 :
149243 4 : size_t count = 0;
149244 4 : if (SgFunctionParameterRefExp::pools.empty() == false)
149245 : {
149246 : // Generate an array of memory pools (this is actually a STL vector,
149247 : // but it is contiguious, so OK to treat this way).
149248 1 : SgFunctionParameterRefExp** objectArray = (SgFunctionParameterRefExp**) &(SgFunctionParameterRefExp::pools[0]);
149249 :
149250 : // Build a local variable for better performance (make it a loop invariant variable).
149251 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
149252 :
149253 : // Iterate over all of the memory pools for this IR node.
149254 2 : for (unsigned int i=0; i < SgFunctionParameterRefExp::pools.size(); i++)
149255 : {
149256 : // objectArray[i] is a single memory pool, iterate over all the
149257 : // IR nodes and only count those that are valid IR nodes used in
149258 : // the AST (i.e. allocated IR nodes).
149259 2001 : for (unsigned j=0; j < SgFunctionParameterRefExp::pool_size; j++)
149260 : {
149261 : // This is indexing the STL vector of C/C++ style arrays as a doubly
149262 : // indexed array access. It is OK since we have leveraged the semantics
149263 : // of STL vector memory as contigous and cast the memory as an array
149264 : // of arrays to use the 2D array indexing. Hope this is not confusing,
149265 : // but it s very fast as an implementation.
149266 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
149267 : {
149268 67 : count++;
149269 : }
149270 : }
149271 : }
149272 : }
149273 :
149274 :
149275 :
149276 4 : return count;
149277 : }
149278 :
149279 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
149280 : // using values that overflow signed values of int.
149281 : size_t
149282 0 : SgFunctionParameterRefExp::memoryUsage()
149283 : {
149284 : // This function is required because we need the class name as a type when we call sizeof
149285 : // There might be another way to implement this if we have a traversal that only called a
149286 : // representative object (one call for each type of Sage IIIIR node).
149287 0 : size_t memory = numberOfNodes() * sizeof(SgFunctionParameterRefExp);
149288 :
149289 0 : return memory;
149290 : }
149291 :
149292 : /* #line 149293 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
149293 :
149294 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
149295 : void
149296 5342 : SgLambdaExp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
149297 : {
149298 : // This function traverses the memory pool for only a specific IR node
149299 : // and calls the visit function of the input class execute a traversal
149300 : // similar to the style of the attribute based traversals within ROSE.
149301 : // This traversal will visit ALL nodes of the AST where as the other
149302 : // attribute based traversals visit only the embedded tree within the AST.
149303 :
149304 : // Initialize array to the address of the first element of the STL vector
149305 : // (which is guaranteed to be contiguous storage).
149306 : // SgLambdaExp objectArray [] = *(Memory_Block_List.begin());
149307 5342 : if (SgLambdaExp::pools.empty() == false)
149308 : {
149309 : // Generate an array of memory pools
149310 0 : SgLambdaExp** objectArray = (SgLambdaExp**) &(SgLambdaExp::pools[0]);
149311 :
149312 : // Build a local variable for better performance
149313 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
149314 : #if 0
149315 : // Iterate over the memory pools
149316 : for (unsigned int i=0; i < SgLambdaExp::pools.size(); i++)
149317 : {
149318 : // objectArray[i] is a single memory pool
149319 : for (int j=0; j < SgLambdaExp::pool_size; j++)
149320 : {
149321 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
149322 : {
149323 : traversal.visit(&(objectArray[i][j]));
149324 : }
149325 : }
149326 : }
149327 : #else
149328 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
149329 : // compute the list first and then call the visit function on each list element.
149330 :
149331 : // printf ("Inside of SgLambdaExp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
149332 :
149333 0 : std::vector<SgLambdaExp*> nodeList;
149334 :
149335 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
149336 0 : for (unsigned int i=0; i < SgLambdaExp::pools.size(); i++)
149337 : {
149338 : // objectArray[i] is a single memory pool
149339 0 : for (unsigned j=0; j < SgLambdaExp::pool_size; j++)
149340 : {
149341 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
149342 : {
149343 0 : nodeList.push_back(&(objectArray[i][j]));
149344 : }
149345 : }
149346 : }
149347 :
149348 : // Iterate over the saved list
149349 0 : size_t nodeListSize = nodeList.size();
149350 0 : for (size_t i=0; i < nodeListSize; i++)
149351 : {
149352 0 : ROSE_ASSERT(nodeList[i] != NULL);
149353 : #if 0
149354 : traversal.visit(nodeList[i]);
149355 : #else
149356 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
149357 : {
149358 0 : traversal.visit(nodeList[i]);
149359 : }
149360 : #endif
149361 : }
149362 : #endif
149363 : }
149364 :
149365 : // This should not be required since all previously static data members are
149366 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
149367 :
149368 5342 : }
149369 :
149370 :
149371 : void
149372 194 : SgLambdaExp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
149373 : {
149374 : // This function traverses the memory pool for an IR node and
149375 : // calls the function to execute the visitor object.
149376 :
149377 : // Initialize array to the address of the first element of the STL vector
149378 : // (which is guarenteed to be contiguous storage).
149379 : // SgLambdaExp objectArray [] = *(Memory_Block_List.begin());
149380 194 : if (SgLambdaExp::pools.empty() == false)
149381 : {
149382 : // Generate an array of memory pools
149383 0 : SgLambdaExp** objectArray = (SgLambdaExp**) &(SgLambdaExp::pools[0]);
149384 :
149385 : // Build a local variable for better performance
149386 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
149387 :
149388 : // Iterate over the memory pools
149389 0 : for (unsigned int i=0; i < SgLambdaExp::pools.size(); i++)
149390 : {
149391 : // objectArray[i] is a single memory pool
149392 0 : for (unsigned j=0; j < SgLambdaExp::pool_size; j++)
149393 : {
149394 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
149395 : {
149396 : // printf ("Found a valid SgLambdaExp object in the memory pool %d at position %d \n",i,j);
149397 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
149398 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
149399 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
149400 : }
149401 : else
149402 : {
149403 : // printf ("Found a INVALID SgLambdaExp object in the memory pool \n");
149404 : }
149405 : }
149406 : }
149407 : }
149408 :
149409 : // This should not be required since all previously static data members are
149410 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
149411 :
149412 194 : }
149413 :
149414 : void
149415 0 : SgLambdaExp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
149416 : {
149417 : // This function visits only a single IR node of the memory pool.
149418 : // it is typically called once for each type of IR node within
149419 : // the automatically generated function: traverseRepresentativeNodes().
149420 :
149421 : // Initialize array to the address of the first element of the STL vector
149422 : // (which is guarenteed to be contiguous storage).
149423 : // SgLambdaExp objectArray [] = *(Memory_Block_List.begin());
149424 0 : if (SgLambdaExp::pools.empty() == false)
149425 : {
149426 : // Generate an array of memory pools
149427 0 : SgLambdaExp** objectArray = (SgLambdaExp**) &(SgLambdaExp::pools[0]);
149428 :
149429 : // Build a local variable for better performance
149430 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
149431 :
149432 : // Iterate over the memory pools
149433 0 : bool done = false;
149434 0 : unsigned i=0;
149435 :
149436 : // find the first valid IR node, call visit function, and then leave
149437 0 : while ( done == false && i < SgLambdaExp::pools.size() )
149438 : {
149439 : // objectArray[i] is a single memory pool
149440 : unsigned j=0;
149441 0 : while (done == false && j < SgLambdaExp::pool_size)
149442 : {
149443 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
149444 : {
149445 0 : traversal.visit(&(objectArray[i][j]));
149446 0 : done = true;
149447 : }
149448 0 : j++;
149449 : }
149450 0 : i++;
149451 : }
149452 :
149453 : #if 0
149454 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
149455 : if (done == false)
149456 : {
149457 : printf ("No representative for SgLambdaExp found in memory pools \n");
149458 : }
149459 : #endif
149460 : }
149461 0 : }
149462 :
149463 :
149464 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
149465 : // using values that overflow signed values of int.
149466 : size_t
149467 4 : SgLambdaExp::numberOfNodes()
149468 : {
149469 : // This function traverses the memory pool for an IR node and
149470 : // counts the number of IR nodes of a particular Sage III IR
149471 : // nodes type.
149472 :
149473 4 : size_t count = 0;
149474 4 : if (SgLambdaExp::pools.empty() == false)
149475 : {
149476 : // Generate an array of memory pools (this is actually a STL vector,
149477 : // but it is contiguious, so OK to treat this way).
149478 0 : SgLambdaExp** objectArray = (SgLambdaExp**) &(SgLambdaExp::pools[0]);
149479 :
149480 : // Build a local variable for better performance (make it a loop invariant variable).
149481 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
149482 :
149483 : // Iterate over all of the memory pools for this IR node.
149484 0 : for (unsigned int i=0; i < SgLambdaExp::pools.size(); i++)
149485 : {
149486 : // objectArray[i] is a single memory pool, iterate over all the
149487 : // IR nodes and only count those that are valid IR nodes used in
149488 : // the AST (i.e. allocated IR nodes).
149489 0 : for (unsigned j=0; j < SgLambdaExp::pool_size; j++)
149490 : {
149491 : // This is indexing the STL vector of C/C++ style arrays as a doubly
149492 : // indexed array access. It is OK since we have leveraged the semantics
149493 : // of STL vector memory as contigous and cast the memory as an array
149494 : // of arrays to use the 2D array indexing. Hope this is not confusing,
149495 : // but it s very fast as an implementation.
149496 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
149497 : {
149498 0 : count++;
149499 : }
149500 : }
149501 : }
149502 : }
149503 :
149504 :
149505 :
149506 4 : return count;
149507 : }
149508 :
149509 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
149510 : // using values that overflow signed values of int.
149511 : size_t
149512 0 : SgLambdaExp::memoryUsage()
149513 : {
149514 : // This function is required because we need the class name as a type when we call sizeof
149515 : // There might be another way to implement this if we have a traversal that only called a
149516 : // representative object (one call for each type of Sage IIIIR node).
149517 0 : size_t memory = numberOfNodes() * sizeof(SgLambdaExp);
149518 :
149519 0 : return memory;
149520 : }
149521 :
149522 : /* #line 149523 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
149523 :
149524 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
149525 : void
149526 5342 : SgNoexceptOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
149527 : {
149528 : // This function traverses the memory pool for only a specific IR node
149529 : // and calls the visit function of the input class execute a traversal
149530 : // similar to the style of the attribute based traversals within ROSE.
149531 : // This traversal will visit ALL nodes of the AST where as the other
149532 : // attribute based traversals visit only the embedded tree within the AST.
149533 :
149534 : // Initialize array to the address of the first element of the STL vector
149535 : // (which is guaranteed to be contiguous storage).
149536 : // SgNoexceptOp objectArray [] = *(Memory_Block_List.begin());
149537 5342 : if (SgNoexceptOp::pools.empty() == false)
149538 : {
149539 : // Generate an array of memory pools
149540 138 : SgNoexceptOp** objectArray = (SgNoexceptOp**) &(SgNoexceptOp::pools[0]);
149541 :
149542 : // Build a local variable for better performance
149543 138 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
149544 : #if 0
149545 : // Iterate over the memory pools
149546 : for (unsigned int i=0; i < SgNoexceptOp::pools.size(); i++)
149547 : {
149548 : // objectArray[i] is a single memory pool
149549 : for (int j=0; j < SgNoexceptOp::pool_size; j++)
149550 : {
149551 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
149552 : {
149553 : traversal.visit(&(objectArray[i][j]));
149554 : }
149555 : }
149556 : }
149557 : #else
149558 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
149559 : // compute the list first and then call the visit function on each list element.
149560 :
149561 : // printf ("Inside of SgNoexceptOp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
149562 :
149563 276 : std::vector<SgNoexceptOp*> nodeList;
149564 :
149565 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
149566 276 : for (unsigned int i=0; i < SgNoexceptOp::pools.size(); i++)
149567 : {
149568 : // objectArray[i] is a single memory pool
149569 276138 : for (unsigned j=0; j < SgNoexceptOp::pool_size; j++)
149570 : {
149571 276000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
149572 : {
149573 2516 : nodeList.push_back(&(objectArray[i][j]));
149574 : }
149575 : }
149576 : }
149577 :
149578 : // Iterate over the saved list
149579 138 : size_t nodeListSize = nodeList.size();
149580 2654 : for (size_t i=0; i < nodeListSize; i++)
149581 : {
149582 2516 : ROSE_ASSERT(nodeList[i] != NULL);
149583 : #if 0
149584 : traversal.visit(nodeList[i]);
149585 : #else
149586 2516 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
149587 : {
149588 2516 : traversal.visit(nodeList[i]);
149589 : }
149590 : #endif
149591 : }
149592 : #endif
149593 : }
149594 :
149595 : // This should not be required since all previously static data members are
149596 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
149597 :
149598 5342 : }
149599 :
149600 :
149601 : void
149602 194 : SgNoexceptOp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
149603 : {
149604 : // This function traverses the memory pool for an IR node and
149605 : // calls the function to execute the visitor object.
149606 :
149607 : // Initialize array to the address of the first element of the STL vector
149608 : // (which is guarenteed to be contiguous storage).
149609 : // SgNoexceptOp objectArray [] = *(Memory_Block_List.begin());
149610 194 : if (SgNoexceptOp::pools.empty() == false)
149611 : {
149612 : // Generate an array of memory pools
149613 137 : SgNoexceptOp** objectArray = (SgNoexceptOp**) &(SgNoexceptOp::pools[0]);
149614 :
149615 : // Build a local variable for better performance
149616 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
149617 :
149618 : // Iterate over the memory pools
149619 274 : for (unsigned int i=0; i < SgNoexceptOp::pools.size(); i++)
149620 : {
149621 : // objectArray[i] is a single memory pool
149622 274137 : for (unsigned j=0; j < SgNoexceptOp::pool_size; j++)
149623 : {
149624 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
149625 : {
149626 : // printf ("Found a valid SgNoexceptOp object in the memory pool %d at position %d \n",i,j);
149627 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
149628 2484 : objectArray[i][j].executeVisitorMemberFunction(visitor);
149629 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
149630 : }
149631 : else
149632 : {
149633 : // printf ("Found a INVALID SgNoexceptOp object in the memory pool \n");
149634 : }
149635 : }
149636 : }
149637 : }
149638 :
149639 : // This should not be required since all previously static data members are
149640 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
149641 :
149642 194 : }
149643 :
149644 : void
149645 0 : SgNoexceptOp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
149646 : {
149647 : // This function visits only a single IR node of the memory pool.
149648 : // it is typically called once for each type of IR node within
149649 : // the automatically generated function: traverseRepresentativeNodes().
149650 :
149651 : // Initialize array to the address of the first element of the STL vector
149652 : // (which is guarenteed to be contiguous storage).
149653 : // SgNoexceptOp objectArray [] = *(Memory_Block_List.begin());
149654 0 : if (SgNoexceptOp::pools.empty() == false)
149655 : {
149656 : // Generate an array of memory pools
149657 0 : SgNoexceptOp** objectArray = (SgNoexceptOp**) &(SgNoexceptOp::pools[0]);
149658 :
149659 : // Build a local variable for better performance
149660 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
149661 :
149662 : // Iterate over the memory pools
149663 0 : bool done = false;
149664 0 : unsigned i=0;
149665 :
149666 : // find the first valid IR node, call visit function, and then leave
149667 0 : while ( done == false && i < SgNoexceptOp::pools.size() )
149668 : {
149669 : // objectArray[i] is a single memory pool
149670 : unsigned j=0;
149671 0 : while (done == false && j < SgNoexceptOp::pool_size)
149672 : {
149673 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
149674 : {
149675 0 : traversal.visit(&(objectArray[i][j]));
149676 0 : done = true;
149677 : }
149678 0 : j++;
149679 : }
149680 0 : i++;
149681 : }
149682 :
149683 : #if 0
149684 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
149685 : if (done == false)
149686 : {
149687 : printf ("No representative for SgNoexceptOp found in memory pools \n");
149688 : }
149689 : #endif
149690 : }
149691 0 : }
149692 :
149693 :
149694 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
149695 : // using values that overflow signed values of int.
149696 : size_t
149697 4 : SgNoexceptOp::numberOfNodes()
149698 : {
149699 : // This function traverses the memory pool for an IR node and
149700 : // counts the number of IR nodes of a particular Sage III IR
149701 : // nodes type.
149702 :
149703 4 : size_t count = 0;
149704 4 : if (SgNoexceptOp::pools.empty() == false)
149705 : {
149706 : // Generate an array of memory pools (this is actually a STL vector,
149707 : // but it is contiguious, so OK to treat this way).
149708 1 : SgNoexceptOp** objectArray = (SgNoexceptOp**) &(SgNoexceptOp::pools[0]);
149709 :
149710 : // Build a local variable for better performance (make it a loop invariant variable).
149711 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
149712 :
149713 : // Iterate over all of the memory pools for this IR node.
149714 2 : for (unsigned int i=0; i < SgNoexceptOp::pools.size(); i++)
149715 : {
149716 : // objectArray[i] is a single memory pool, iterate over all the
149717 : // IR nodes and only count those that are valid IR nodes used in
149718 : // the AST (i.e. allocated IR nodes).
149719 2001 : for (unsigned j=0; j < SgNoexceptOp::pool_size; j++)
149720 : {
149721 : // This is indexing the STL vector of C/C++ style arrays as a doubly
149722 : // indexed array access. It is OK since we have leveraged the semantics
149723 : // of STL vector memory as contigous and cast the memory as an array
149724 : // of arrays to use the 2D array indexing. Hope this is not confusing,
149725 : // but it s very fast as an implementation.
149726 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
149727 : {
149728 18 : count++;
149729 : }
149730 : }
149731 : }
149732 : }
149733 :
149734 :
149735 :
149736 4 : return count;
149737 : }
149738 :
149739 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
149740 : // using values that overflow signed values of int.
149741 : size_t
149742 0 : SgNoexceptOp::memoryUsage()
149743 : {
149744 : // This function is required because we need the class name as a type when we call sizeof
149745 : // There might be another way to implement this if we have a traversal that only called a
149746 : // representative object (one call for each type of Sage IIIIR node).
149747 0 : size_t memory = numberOfNodes() * sizeof(SgNoexceptOp);
149748 :
149749 0 : return memory;
149750 : }
149751 :
149752 : /* #line 149753 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
149753 :
149754 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
149755 : void
149756 5342 : SgNonrealRefExp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
149757 : {
149758 : // This function traverses the memory pool for only a specific IR node
149759 : // and calls the visit function of the input class execute a traversal
149760 : // similar to the style of the attribute based traversals within ROSE.
149761 : // This traversal will visit ALL nodes of the AST where as the other
149762 : // attribute based traversals visit only the embedded tree within the AST.
149763 :
149764 : // Initialize array to the address of the first element of the STL vector
149765 : // (which is guaranteed to be contiguous storage).
149766 : // SgNonrealRefExp objectArray [] = *(Memory_Block_List.begin());
149767 5342 : if (SgNonrealRefExp::pools.empty() == false)
149768 : {
149769 : // Generate an array of memory pools
149770 138 : SgNonrealRefExp** objectArray = (SgNonrealRefExp**) &(SgNonrealRefExp::pools[0]);
149771 :
149772 : // Build a local variable for better performance
149773 138 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
149774 : #if 0
149775 : // Iterate over the memory pools
149776 : for (unsigned int i=0; i < SgNonrealRefExp::pools.size(); i++)
149777 : {
149778 : // objectArray[i] is a single memory pool
149779 : for (int j=0; j < SgNonrealRefExp::pool_size; j++)
149780 : {
149781 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
149782 : {
149783 : traversal.visit(&(objectArray[i][j]));
149784 : }
149785 : }
149786 : }
149787 : #else
149788 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
149789 : // compute the list first and then call the visit function on each list element.
149790 :
149791 : // printf ("Inside of SgNonrealRefExp::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
149792 :
149793 276 : std::vector<SgNonrealRefExp*> nodeList;
149794 :
149795 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
149796 285 : for (unsigned int i=0; i < SgNonrealRefExp::pools.size(); i++)
149797 : {
149798 : // objectArray[i] is a single memory pool
149799 294147 : for (unsigned j=0; j < SgNonrealRefExp::pool_size; j++)
149800 : {
149801 294000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
149802 : {
149803 216626 : nodeList.push_back(&(objectArray[i][j]));
149804 : }
149805 : }
149806 : }
149807 :
149808 : // Iterate over the saved list
149809 138 : size_t nodeListSize = nodeList.size();
149810 216764 : for (size_t i=0; i < nodeListSize; i++)
149811 : {
149812 216626 : ROSE_ASSERT(nodeList[i] != NULL);
149813 : #if 0
149814 : traversal.visit(nodeList[i]);
149815 : #else
149816 216626 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
149817 : {
149818 216626 : traversal.visit(nodeList[i]);
149819 : }
149820 : #endif
149821 : }
149822 : #endif
149823 : }
149824 :
149825 : // This should not be required since all previously static data members are
149826 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
149827 :
149828 5342 : }
149829 :
149830 :
149831 : void
149832 194 : SgNonrealRefExp::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
149833 : {
149834 : // This function traverses the memory pool for an IR node and
149835 : // calls the function to execute the visitor object.
149836 :
149837 : // Initialize array to the address of the first element of the STL vector
149838 : // (which is guarenteed to be contiguous storage).
149839 : // SgNonrealRefExp objectArray [] = *(Memory_Block_List.begin());
149840 194 : if (SgNonrealRefExp::pools.empty() == false)
149841 : {
149842 : // Generate an array of memory pools
149843 137 : SgNonrealRefExp** objectArray = (SgNonrealRefExp**) &(SgNonrealRefExp::pools[0]);
149844 :
149845 : // Build a local variable for better performance
149846 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
149847 :
149848 : // Iterate over the memory pools
149849 292 : for (unsigned int i=0; i < SgNonrealRefExp::pools.size(); i++)
149850 : {
149851 : // objectArray[i] is a single memory pool
149852 310155 : for (unsigned j=0; j < SgNonrealRefExp::pool_size; j++)
149853 : {
149854 310000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
149855 : {
149856 : // printf ("Found a valid SgNonrealRefExp object in the memory pool %d at position %d \n",i,j);
149857 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
149858 219810 : objectArray[i][j].executeVisitorMemberFunction(visitor);
149859 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
149860 : }
149861 : else
149862 : {
149863 : // printf ("Found a INVALID SgNonrealRefExp object in the memory pool \n");
149864 : }
149865 : }
149866 : }
149867 : }
149868 :
149869 : // This should not be required since all previously static data members are
149870 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
149871 :
149872 194 : }
149873 :
149874 : void
149875 0 : SgNonrealRefExp::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
149876 : {
149877 : // This function visits only a single IR node of the memory pool.
149878 : // it is typically called once for each type of IR node within
149879 : // the automatically generated function: traverseRepresentativeNodes().
149880 :
149881 : // Initialize array to the address of the first element of the STL vector
149882 : // (which is guarenteed to be contiguous storage).
149883 : // SgNonrealRefExp objectArray [] = *(Memory_Block_List.begin());
149884 0 : if (SgNonrealRefExp::pools.empty() == false)
149885 : {
149886 : // Generate an array of memory pools
149887 0 : SgNonrealRefExp** objectArray = (SgNonrealRefExp**) &(SgNonrealRefExp::pools[0]);
149888 :
149889 : // Build a local variable for better performance
149890 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
149891 :
149892 : // Iterate over the memory pools
149893 0 : bool done = false;
149894 0 : unsigned i=0;
149895 :
149896 : // find the first valid IR node, call visit function, and then leave
149897 0 : while ( done == false && i < SgNonrealRefExp::pools.size() )
149898 : {
149899 : // objectArray[i] is a single memory pool
149900 : unsigned j=0;
149901 0 : while (done == false && j < SgNonrealRefExp::pool_size)
149902 : {
149903 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
149904 : {
149905 0 : traversal.visit(&(objectArray[i][j]));
149906 0 : done = true;
149907 : }
149908 0 : j++;
149909 : }
149910 0 : i++;
149911 : }
149912 :
149913 : #if 0
149914 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
149915 : if (done == false)
149916 : {
149917 : printf ("No representative for SgNonrealRefExp found in memory pools \n");
149918 : }
149919 : #endif
149920 : }
149921 0 : }
149922 :
149923 :
149924 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
149925 : // using values that overflow signed values of int.
149926 : size_t
149927 4 : SgNonrealRefExp::numberOfNodes()
149928 : {
149929 : // This function traverses the memory pool for an IR node and
149930 : // counts the number of IR nodes of a particular Sage III IR
149931 : // nodes type.
149932 :
149933 4 : size_t count = 0;
149934 4 : if (SgNonrealRefExp::pools.empty() == false)
149935 : {
149936 : // Generate an array of memory pools (this is actually a STL vector,
149937 : // but it is contiguious, so OK to treat this way).
149938 1 : SgNonrealRefExp** objectArray = (SgNonrealRefExp**) &(SgNonrealRefExp::pools[0]);
149939 :
149940 : // Build a local variable for better performance (make it a loop invariant variable).
149941 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
149942 :
149943 : // Iterate over all of the memory pools for this IR node.
149944 2 : for (unsigned int i=0; i < SgNonrealRefExp::pools.size(); i++)
149945 : {
149946 : // objectArray[i] is a single memory pool, iterate over all the
149947 : // IR nodes and only count those that are valid IR nodes used in
149948 : // the AST (i.e. allocated IR nodes).
149949 2001 : for (unsigned j=0; j < SgNonrealRefExp::pool_size; j++)
149950 : {
149951 : // This is indexing the STL vector of C/C++ style arrays as a doubly
149952 : // indexed array access. It is OK since we have leveraged the semantics
149953 : // of STL vector memory as contigous and cast the memory as an array
149954 : // of arrays to use the 2D array indexing. Hope this is not confusing,
149955 : // but it s very fast as an implementation.
149956 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
149957 : {
149958 1494 : count++;
149959 : }
149960 : }
149961 : }
149962 : }
149963 :
149964 :
149965 :
149966 4 : return count;
149967 : }
149968 :
149969 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
149970 : // using values that overflow signed values of int.
149971 : size_t
149972 0 : SgNonrealRefExp::memoryUsage()
149973 : {
149974 : // This function is required because we need the class name as a type when we call sizeof
149975 : // There might be another way to implement this if we have a traversal that only called a
149976 : // representative object (one call for each type of Sage IIIIR node).
149977 0 : size_t memory = numberOfNodes() * sizeof(SgNonrealRefExp);
149978 :
149979 0 : return memory;
149980 : }
149981 :
149982 : /* #line 149983 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
149983 :
149984 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
149985 : void
149986 5342 : SgFoldExpression::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
149987 : {
149988 : // This function traverses the memory pool for only a specific IR node
149989 : // and calls the visit function of the input class execute a traversal
149990 : // similar to the style of the attribute based traversals within ROSE.
149991 : // This traversal will visit ALL nodes of the AST where as the other
149992 : // attribute based traversals visit only the embedded tree within the AST.
149993 :
149994 : // Initialize array to the address of the first element of the STL vector
149995 : // (which is guaranteed to be contiguous storage).
149996 : // SgFoldExpression objectArray [] = *(Memory_Block_List.begin());
149997 5342 : if (SgFoldExpression::pools.empty() == false)
149998 : {
149999 : // Generate an array of memory pools
150000 0 : SgFoldExpression** objectArray = (SgFoldExpression**) &(SgFoldExpression::pools[0]);
150001 :
150002 : // Build a local variable for better performance
150003 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
150004 : #if 0
150005 : // Iterate over the memory pools
150006 : for (unsigned int i=0; i < SgFoldExpression::pools.size(); i++)
150007 : {
150008 : // objectArray[i] is a single memory pool
150009 : for (int j=0; j < SgFoldExpression::pool_size; j++)
150010 : {
150011 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
150012 : {
150013 : traversal.visit(&(objectArray[i][j]));
150014 : }
150015 : }
150016 : }
150017 : #else
150018 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
150019 : // compute the list first and then call the visit function on each list element.
150020 :
150021 : // printf ("Inside of SgFoldExpression::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
150022 :
150023 0 : std::vector<SgFoldExpression*> nodeList;
150024 :
150025 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
150026 0 : for (unsigned int i=0; i < SgFoldExpression::pools.size(); i++)
150027 : {
150028 : // objectArray[i] is a single memory pool
150029 0 : for (unsigned j=0; j < SgFoldExpression::pool_size; j++)
150030 : {
150031 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
150032 : {
150033 0 : nodeList.push_back(&(objectArray[i][j]));
150034 : }
150035 : }
150036 : }
150037 :
150038 : // Iterate over the saved list
150039 0 : size_t nodeListSize = nodeList.size();
150040 0 : for (size_t i=0; i < nodeListSize; i++)
150041 : {
150042 0 : ROSE_ASSERT(nodeList[i] != NULL);
150043 : #if 0
150044 : traversal.visit(nodeList[i]);
150045 : #else
150046 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
150047 : {
150048 0 : traversal.visit(nodeList[i]);
150049 : }
150050 : #endif
150051 : }
150052 : #endif
150053 : }
150054 :
150055 : // This should not be required since all previously static data members are
150056 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
150057 :
150058 5342 : }
150059 :
150060 :
150061 : void
150062 194 : SgFoldExpression::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
150063 : {
150064 : // This function traverses the memory pool for an IR node and
150065 : // calls the function to execute the visitor object.
150066 :
150067 : // Initialize array to the address of the first element of the STL vector
150068 : // (which is guarenteed to be contiguous storage).
150069 : // SgFoldExpression objectArray [] = *(Memory_Block_List.begin());
150070 194 : if (SgFoldExpression::pools.empty() == false)
150071 : {
150072 : // Generate an array of memory pools
150073 0 : SgFoldExpression** objectArray = (SgFoldExpression**) &(SgFoldExpression::pools[0]);
150074 :
150075 : // Build a local variable for better performance
150076 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
150077 :
150078 : // Iterate over the memory pools
150079 0 : for (unsigned int i=0; i < SgFoldExpression::pools.size(); i++)
150080 : {
150081 : // objectArray[i] is a single memory pool
150082 0 : for (unsigned j=0; j < SgFoldExpression::pool_size; j++)
150083 : {
150084 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
150085 : {
150086 : // printf ("Found a valid SgFoldExpression object in the memory pool %d at position %d \n",i,j);
150087 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
150088 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
150089 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
150090 : }
150091 : else
150092 : {
150093 : // printf ("Found a INVALID SgFoldExpression object in the memory pool \n");
150094 : }
150095 : }
150096 : }
150097 : }
150098 :
150099 : // This should not be required since all previously static data members are
150100 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
150101 :
150102 194 : }
150103 :
150104 : void
150105 0 : SgFoldExpression::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
150106 : {
150107 : // This function visits only a single IR node of the memory pool.
150108 : // it is typically called once for each type of IR node within
150109 : // the automatically generated function: traverseRepresentativeNodes().
150110 :
150111 : // Initialize array to the address of the first element of the STL vector
150112 : // (which is guarenteed to be contiguous storage).
150113 : // SgFoldExpression objectArray [] = *(Memory_Block_List.begin());
150114 0 : if (SgFoldExpression::pools.empty() == false)
150115 : {
150116 : // Generate an array of memory pools
150117 0 : SgFoldExpression** objectArray = (SgFoldExpression**) &(SgFoldExpression::pools[0]);
150118 :
150119 : // Build a local variable for better performance
150120 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
150121 :
150122 : // Iterate over the memory pools
150123 0 : bool done = false;
150124 0 : unsigned i=0;
150125 :
150126 : // find the first valid IR node, call visit function, and then leave
150127 0 : while ( done == false && i < SgFoldExpression::pools.size() )
150128 : {
150129 : // objectArray[i] is a single memory pool
150130 : unsigned j=0;
150131 0 : while (done == false && j < SgFoldExpression::pool_size)
150132 : {
150133 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
150134 : {
150135 0 : traversal.visit(&(objectArray[i][j]));
150136 0 : done = true;
150137 : }
150138 0 : j++;
150139 : }
150140 0 : i++;
150141 : }
150142 :
150143 : #if 0
150144 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
150145 : if (done == false)
150146 : {
150147 : printf ("No representative for SgFoldExpression found in memory pools \n");
150148 : }
150149 : #endif
150150 : }
150151 0 : }
150152 :
150153 :
150154 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
150155 : // using values that overflow signed values of int.
150156 : size_t
150157 4 : SgFoldExpression::numberOfNodes()
150158 : {
150159 : // This function traverses the memory pool for an IR node and
150160 : // counts the number of IR nodes of a particular Sage III IR
150161 : // nodes type.
150162 :
150163 4 : size_t count = 0;
150164 4 : if (SgFoldExpression::pools.empty() == false)
150165 : {
150166 : // Generate an array of memory pools (this is actually a STL vector,
150167 : // but it is contiguious, so OK to treat this way).
150168 0 : SgFoldExpression** objectArray = (SgFoldExpression**) &(SgFoldExpression::pools[0]);
150169 :
150170 : // Build a local variable for better performance (make it a loop invariant variable).
150171 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
150172 :
150173 : // Iterate over all of the memory pools for this IR node.
150174 0 : for (unsigned int i=0; i < SgFoldExpression::pools.size(); i++)
150175 : {
150176 : // objectArray[i] is a single memory pool, iterate over all the
150177 : // IR nodes and only count those that are valid IR nodes used in
150178 : // the AST (i.e. allocated IR nodes).
150179 0 : for (unsigned j=0; j < SgFoldExpression::pool_size; j++)
150180 : {
150181 : // This is indexing the STL vector of C/C++ style arrays as a doubly
150182 : // indexed array access. It is OK since we have leveraged the semantics
150183 : // of STL vector memory as contigous and cast the memory as an array
150184 : // of arrays to use the 2D array indexing. Hope this is not confusing,
150185 : // but it s very fast as an implementation.
150186 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
150187 : {
150188 0 : count++;
150189 : }
150190 : }
150191 : }
150192 : }
150193 :
150194 :
150195 :
150196 4 : return count;
150197 : }
150198 :
150199 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
150200 : // using values that overflow signed values of int.
150201 : size_t
150202 0 : SgFoldExpression::memoryUsage()
150203 : {
150204 : // This function is required because we need the class name as a type when we call sizeof
150205 : // There might be another way to implement this if we have a traversal that only called a
150206 : // representative object (one call for each type of Sage IIIIR node).
150207 0 : size_t memory = numberOfNodes() * sizeof(SgFoldExpression);
150208 :
150209 0 : return memory;
150210 : }
150211 :
150212 : /* #line 150213 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
150213 :
150214 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
150215 : void
150216 5342 : SgAwaitExpression::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
150217 : {
150218 : // This function traverses the memory pool for only a specific IR node
150219 : // and calls the visit function of the input class execute a traversal
150220 : // similar to the style of the attribute based traversals within ROSE.
150221 : // This traversal will visit ALL nodes of the AST where as the other
150222 : // attribute based traversals visit only the embedded tree within the AST.
150223 :
150224 : // Initialize array to the address of the first element of the STL vector
150225 : // (which is guaranteed to be contiguous storage).
150226 : // SgAwaitExpression objectArray [] = *(Memory_Block_List.begin());
150227 5342 : if (SgAwaitExpression::pools.empty() == false)
150228 : {
150229 : // Generate an array of memory pools
150230 0 : SgAwaitExpression** objectArray = (SgAwaitExpression**) &(SgAwaitExpression::pools[0]);
150231 :
150232 : // Build a local variable for better performance
150233 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
150234 : #if 0
150235 : // Iterate over the memory pools
150236 : for (unsigned int i=0; i < SgAwaitExpression::pools.size(); i++)
150237 : {
150238 : // objectArray[i] is a single memory pool
150239 : for (int j=0; j < SgAwaitExpression::pool_size; j++)
150240 : {
150241 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
150242 : {
150243 : traversal.visit(&(objectArray[i][j]));
150244 : }
150245 : }
150246 : }
150247 : #else
150248 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
150249 : // compute the list first and then call the visit function on each list element.
150250 :
150251 : // printf ("Inside of SgAwaitExpression::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
150252 :
150253 0 : std::vector<SgAwaitExpression*> nodeList;
150254 :
150255 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
150256 0 : for (unsigned int i=0; i < SgAwaitExpression::pools.size(); i++)
150257 : {
150258 : // objectArray[i] is a single memory pool
150259 0 : for (unsigned j=0; j < SgAwaitExpression::pool_size; j++)
150260 : {
150261 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
150262 : {
150263 0 : nodeList.push_back(&(objectArray[i][j]));
150264 : }
150265 : }
150266 : }
150267 :
150268 : // Iterate over the saved list
150269 0 : size_t nodeListSize = nodeList.size();
150270 0 : for (size_t i=0; i < nodeListSize; i++)
150271 : {
150272 0 : ROSE_ASSERT(nodeList[i] != NULL);
150273 : #if 0
150274 : traversal.visit(nodeList[i]);
150275 : #else
150276 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
150277 : {
150278 0 : traversal.visit(nodeList[i]);
150279 : }
150280 : #endif
150281 : }
150282 : #endif
150283 : }
150284 :
150285 : // This should not be required since all previously static data members are
150286 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
150287 :
150288 5342 : }
150289 :
150290 :
150291 : void
150292 194 : SgAwaitExpression::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
150293 : {
150294 : // This function traverses the memory pool for an IR node and
150295 : // calls the function to execute the visitor object.
150296 :
150297 : // Initialize array to the address of the first element of the STL vector
150298 : // (which is guarenteed to be contiguous storage).
150299 : // SgAwaitExpression objectArray [] = *(Memory_Block_List.begin());
150300 194 : if (SgAwaitExpression::pools.empty() == false)
150301 : {
150302 : // Generate an array of memory pools
150303 0 : SgAwaitExpression** objectArray = (SgAwaitExpression**) &(SgAwaitExpression::pools[0]);
150304 :
150305 : // Build a local variable for better performance
150306 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
150307 :
150308 : // Iterate over the memory pools
150309 0 : for (unsigned int i=0; i < SgAwaitExpression::pools.size(); i++)
150310 : {
150311 : // objectArray[i] is a single memory pool
150312 0 : for (unsigned j=0; j < SgAwaitExpression::pool_size; j++)
150313 : {
150314 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
150315 : {
150316 : // printf ("Found a valid SgAwaitExpression object in the memory pool %d at position %d \n",i,j);
150317 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
150318 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
150319 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
150320 : }
150321 : else
150322 : {
150323 : // printf ("Found a INVALID SgAwaitExpression object in the memory pool \n");
150324 : }
150325 : }
150326 : }
150327 : }
150328 :
150329 : // This should not be required since all previously static data members are
150330 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
150331 :
150332 194 : }
150333 :
150334 : void
150335 0 : SgAwaitExpression::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
150336 : {
150337 : // This function visits only a single IR node of the memory pool.
150338 : // it is typically called once for each type of IR node within
150339 : // the automatically generated function: traverseRepresentativeNodes().
150340 :
150341 : // Initialize array to the address of the first element of the STL vector
150342 : // (which is guarenteed to be contiguous storage).
150343 : // SgAwaitExpression objectArray [] = *(Memory_Block_List.begin());
150344 0 : if (SgAwaitExpression::pools.empty() == false)
150345 : {
150346 : // Generate an array of memory pools
150347 0 : SgAwaitExpression** objectArray = (SgAwaitExpression**) &(SgAwaitExpression::pools[0]);
150348 :
150349 : // Build a local variable for better performance
150350 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
150351 :
150352 : // Iterate over the memory pools
150353 0 : bool done = false;
150354 0 : unsigned i=0;
150355 :
150356 : // find the first valid IR node, call visit function, and then leave
150357 0 : while ( done == false && i < SgAwaitExpression::pools.size() )
150358 : {
150359 : // objectArray[i] is a single memory pool
150360 : unsigned j=0;
150361 0 : while (done == false && j < SgAwaitExpression::pool_size)
150362 : {
150363 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
150364 : {
150365 0 : traversal.visit(&(objectArray[i][j]));
150366 0 : done = true;
150367 : }
150368 0 : j++;
150369 : }
150370 0 : i++;
150371 : }
150372 :
150373 : #if 0
150374 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
150375 : if (done == false)
150376 : {
150377 : printf ("No representative for SgAwaitExpression found in memory pools \n");
150378 : }
150379 : #endif
150380 : }
150381 0 : }
150382 :
150383 :
150384 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
150385 : // using values that overflow signed values of int.
150386 : size_t
150387 4 : SgAwaitExpression::numberOfNodes()
150388 : {
150389 : // This function traverses the memory pool for an IR node and
150390 : // counts the number of IR nodes of a particular Sage III IR
150391 : // nodes type.
150392 :
150393 4 : size_t count = 0;
150394 4 : if (SgAwaitExpression::pools.empty() == false)
150395 : {
150396 : // Generate an array of memory pools (this is actually a STL vector,
150397 : // but it is contiguious, so OK to treat this way).
150398 0 : SgAwaitExpression** objectArray = (SgAwaitExpression**) &(SgAwaitExpression::pools[0]);
150399 :
150400 : // Build a local variable for better performance (make it a loop invariant variable).
150401 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
150402 :
150403 : // Iterate over all of the memory pools for this IR node.
150404 0 : for (unsigned int i=0; i < SgAwaitExpression::pools.size(); i++)
150405 : {
150406 : // objectArray[i] is a single memory pool, iterate over all the
150407 : // IR nodes and only count those that are valid IR nodes used in
150408 : // the AST (i.e. allocated IR nodes).
150409 0 : for (unsigned j=0; j < SgAwaitExpression::pool_size; j++)
150410 : {
150411 : // This is indexing the STL vector of C/C++ style arrays as a doubly
150412 : // indexed array access. It is OK since we have leveraged the semantics
150413 : // of STL vector memory as contigous and cast the memory as an array
150414 : // of arrays to use the 2D array indexing. Hope this is not confusing,
150415 : // but it s very fast as an implementation.
150416 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
150417 : {
150418 0 : count++;
150419 : }
150420 : }
150421 : }
150422 : }
150423 :
150424 :
150425 :
150426 4 : return count;
150427 : }
150428 :
150429 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
150430 : // using values that overflow signed values of int.
150431 : size_t
150432 0 : SgAwaitExpression::memoryUsage()
150433 : {
150434 : // This function is required because we need the class name as a type when we call sizeof
150435 : // There might be another way to implement this if we have a traversal that only called a
150436 : // representative object (one call for each type of Sage IIIIR node).
150437 0 : size_t memory = numberOfNodes() * sizeof(SgAwaitExpression);
150438 :
150439 0 : return memory;
150440 : }
150441 :
150442 : /* #line 150443 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
150443 :
150444 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
150445 : void
150446 5342 : SgChooseExpression::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
150447 : {
150448 : // This function traverses the memory pool for only a specific IR node
150449 : // and calls the visit function of the input class execute a traversal
150450 : // similar to the style of the attribute based traversals within ROSE.
150451 : // This traversal will visit ALL nodes of the AST where as the other
150452 : // attribute based traversals visit only the embedded tree within the AST.
150453 :
150454 : // Initialize array to the address of the first element of the STL vector
150455 : // (which is guaranteed to be contiguous storage).
150456 : // SgChooseExpression objectArray [] = *(Memory_Block_List.begin());
150457 5342 : if (SgChooseExpression::pools.empty() == false)
150458 : {
150459 : // Generate an array of memory pools
150460 0 : SgChooseExpression** objectArray = (SgChooseExpression**) &(SgChooseExpression::pools[0]);
150461 :
150462 : // Build a local variable for better performance
150463 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
150464 : #if 0
150465 : // Iterate over the memory pools
150466 : for (unsigned int i=0; i < SgChooseExpression::pools.size(); i++)
150467 : {
150468 : // objectArray[i] is a single memory pool
150469 : for (int j=0; j < SgChooseExpression::pool_size; j++)
150470 : {
150471 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
150472 : {
150473 : traversal.visit(&(objectArray[i][j]));
150474 : }
150475 : }
150476 : }
150477 : #else
150478 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
150479 : // compute the list first and then call the visit function on each list element.
150480 :
150481 : // printf ("Inside of SgChooseExpression::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
150482 :
150483 0 : std::vector<SgChooseExpression*> nodeList;
150484 :
150485 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
150486 0 : for (unsigned int i=0; i < SgChooseExpression::pools.size(); i++)
150487 : {
150488 : // objectArray[i] is a single memory pool
150489 0 : for (unsigned j=0; j < SgChooseExpression::pool_size; j++)
150490 : {
150491 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
150492 : {
150493 0 : nodeList.push_back(&(objectArray[i][j]));
150494 : }
150495 : }
150496 : }
150497 :
150498 : // Iterate over the saved list
150499 0 : size_t nodeListSize = nodeList.size();
150500 0 : for (size_t i=0; i < nodeListSize; i++)
150501 : {
150502 0 : ROSE_ASSERT(nodeList[i] != NULL);
150503 : #if 0
150504 : traversal.visit(nodeList[i]);
150505 : #else
150506 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
150507 : {
150508 0 : traversal.visit(nodeList[i]);
150509 : }
150510 : #endif
150511 : }
150512 : #endif
150513 : }
150514 :
150515 : // This should not be required since all previously static data members are
150516 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
150517 :
150518 5342 : }
150519 :
150520 :
150521 : void
150522 194 : SgChooseExpression::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
150523 : {
150524 : // This function traverses the memory pool for an IR node and
150525 : // calls the function to execute the visitor object.
150526 :
150527 : // Initialize array to the address of the first element of the STL vector
150528 : // (which is guarenteed to be contiguous storage).
150529 : // SgChooseExpression objectArray [] = *(Memory_Block_List.begin());
150530 194 : if (SgChooseExpression::pools.empty() == false)
150531 : {
150532 : // Generate an array of memory pools
150533 0 : SgChooseExpression** objectArray = (SgChooseExpression**) &(SgChooseExpression::pools[0]);
150534 :
150535 : // Build a local variable for better performance
150536 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
150537 :
150538 : // Iterate over the memory pools
150539 0 : for (unsigned int i=0; i < SgChooseExpression::pools.size(); i++)
150540 : {
150541 : // objectArray[i] is a single memory pool
150542 0 : for (unsigned j=0; j < SgChooseExpression::pool_size; j++)
150543 : {
150544 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
150545 : {
150546 : // printf ("Found a valid SgChooseExpression object in the memory pool %d at position %d \n",i,j);
150547 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
150548 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
150549 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
150550 : }
150551 : else
150552 : {
150553 : // printf ("Found a INVALID SgChooseExpression object in the memory pool \n");
150554 : }
150555 : }
150556 : }
150557 : }
150558 :
150559 : // This should not be required since all previously static data members are
150560 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
150561 :
150562 194 : }
150563 :
150564 : void
150565 0 : SgChooseExpression::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
150566 : {
150567 : // This function visits only a single IR node of the memory pool.
150568 : // it is typically called once for each type of IR node within
150569 : // the automatically generated function: traverseRepresentativeNodes().
150570 :
150571 : // Initialize array to the address of the first element of the STL vector
150572 : // (which is guarenteed to be contiguous storage).
150573 : // SgChooseExpression objectArray [] = *(Memory_Block_List.begin());
150574 0 : if (SgChooseExpression::pools.empty() == false)
150575 : {
150576 : // Generate an array of memory pools
150577 0 : SgChooseExpression** objectArray = (SgChooseExpression**) &(SgChooseExpression::pools[0]);
150578 :
150579 : // Build a local variable for better performance
150580 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
150581 :
150582 : // Iterate over the memory pools
150583 0 : bool done = false;
150584 0 : unsigned i=0;
150585 :
150586 : // find the first valid IR node, call visit function, and then leave
150587 0 : while ( done == false && i < SgChooseExpression::pools.size() )
150588 : {
150589 : // objectArray[i] is a single memory pool
150590 : unsigned j=0;
150591 0 : while (done == false && j < SgChooseExpression::pool_size)
150592 : {
150593 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
150594 : {
150595 0 : traversal.visit(&(objectArray[i][j]));
150596 0 : done = true;
150597 : }
150598 0 : j++;
150599 : }
150600 0 : i++;
150601 : }
150602 :
150603 : #if 0
150604 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
150605 : if (done == false)
150606 : {
150607 : printf ("No representative for SgChooseExpression found in memory pools \n");
150608 : }
150609 : #endif
150610 : }
150611 0 : }
150612 :
150613 :
150614 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
150615 : // using values that overflow signed values of int.
150616 : size_t
150617 4 : SgChooseExpression::numberOfNodes()
150618 : {
150619 : // This function traverses the memory pool for an IR node and
150620 : // counts the number of IR nodes of a particular Sage III IR
150621 : // nodes type.
150622 :
150623 4 : size_t count = 0;
150624 4 : if (SgChooseExpression::pools.empty() == false)
150625 : {
150626 : // Generate an array of memory pools (this is actually a STL vector,
150627 : // but it is contiguious, so OK to treat this way).
150628 0 : SgChooseExpression** objectArray = (SgChooseExpression**) &(SgChooseExpression::pools[0]);
150629 :
150630 : // Build a local variable for better performance (make it a loop invariant variable).
150631 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
150632 :
150633 : // Iterate over all of the memory pools for this IR node.
150634 0 : for (unsigned int i=0; i < SgChooseExpression::pools.size(); i++)
150635 : {
150636 : // objectArray[i] is a single memory pool, iterate over all the
150637 : // IR nodes and only count those that are valid IR nodes used in
150638 : // the AST (i.e. allocated IR nodes).
150639 0 : for (unsigned j=0; j < SgChooseExpression::pool_size; j++)
150640 : {
150641 : // This is indexing the STL vector of C/C++ style arrays as a doubly
150642 : // indexed array access. It is OK since we have leveraged the semantics
150643 : // of STL vector memory as contigous and cast the memory as an array
150644 : // of arrays to use the 2D array indexing. Hope this is not confusing,
150645 : // but it s very fast as an implementation.
150646 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
150647 : {
150648 0 : count++;
150649 : }
150650 : }
150651 : }
150652 : }
150653 :
150654 :
150655 :
150656 4 : return count;
150657 : }
150658 :
150659 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
150660 : // using values that overflow signed values of int.
150661 : size_t
150662 0 : SgChooseExpression::memoryUsage()
150663 : {
150664 : // This function is required because we need the class name as a type when we call sizeof
150665 : // There might be another way to implement this if we have a traversal that only called a
150666 : // representative object (one call for each type of Sage IIIIR node).
150667 0 : size_t memory = numberOfNodes() * sizeof(SgChooseExpression);
150668 :
150669 0 : return memory;
150670 : }
150671 :
150672 : /* #line 150673 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
150673 :
150674 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
150675 : void
150676 5342 : SgSymbol::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
150677 : {
150678 : // This function traverses the memory pool for only a specific IR node
150679 : // and calls the visit function of the input class execute a traversal
150680 : // similar to the style of the attribute based traversals within ROSE.
150681 : // This traversal will visit ALL nodes of the AST where as the other
150682 : // attribute based traversals visit only the embedded tree within the AST.
150683 :
150684 : // Initialize array to the address of the first element of the STL vector
150685 : // (which is guaranteed to be contiguous storage).
150686 : // SgSymbol objectArray [] = *(Memory_Block_List.begin());
150687 5342 : if (SgSymbol::pools.empty() == false)
150688 : {
150689 : // Generate an array of memory pools
150690 0 : SgSymbol** objectArray = (SgSymbol**) &(SgSymbol::pools[0]);
150691 :
150692 : // Build a local variable for better performance
150693 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
150694 : #if 0
150695 : // Iterate over the memory pools
150696 : for (unsigned int i=0; i < SgSymbol::pools.size(); i++)
150697 : {
150698 : // objectArray[i] is a single memory pool
150699 : for (int j=0; j < SgSymbol::pool_size; j++)
150700 : {
150701 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
150702 : {
150703 : traversal.visit(&(objectArray[i][j]));
150704 : }
150705 : }
150706 : }
150707 : #else
150708 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
150709 : // compute the list first and then call the visit function on each list element.
150710 :
150711 : // printf ("Inside of SgSymbol::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
150712 :
150713 0 : std::vector<SgSymbol*> nodeList;
150714 :
150715 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
150716 0 : for (unsigned int i=0; i < SgSymbol::pools.size(); i++)
150717 : {
150718 : // objectArray[i] is a single memory pool
150719 0 : for (unsigned j=0; j < SgSymbol::pool_size; j++)
150720 : {
150721 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
150722 : {
150723 0 : nodeList.push_back(&(objectArray[i][j]));
150724 : }
150725 : }
150726 : }
150727 :
150728 : // Iterate over the saved list
150729 0 : size_t nodeListSize = nodeList.size();
150730 0 : for (size_t i=0; i < nodeListSize; i++)
150731 : {
150732 0 : ROSE_ASSERT(nodeList[i] != NULL);
150733 : #if 0
150734 : traversal.visit(nodeList[i]);
150735 : #else
150736 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
150737 : {
150738 0 : traversal.visit(nodeList[i]);
150739 : }
150740 : #endif
150741 : }
150742 : #endif
150743 : }
150744 :
150745 : // This should not be required since all previously static data members are
150746 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
150747 :
150748 5342 : }
150749 :
150750 :
150751 : void
150752 194 : SgSymbol::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
150753 : {
150754 : // This function traverses the memory pool for an IR node and
150755 : // calls the function to execute the visitor object.
150756 :
150757 : // Initialize array to the address of the first element of the STL vector
150758 : // (which is guarenteed to be contiguous storage).
150759 : // SgSymbol objectArray [] = *(Memory_Block_List.begin());
150760 194 : if (SgSymbol::pools.empty() == false)
150761 : {
150762 : // Generate an array of memory pools
150763 0 : SgSymbol** objectArray = (SgSymbol**) &(SgSymbol::pools[0]);
150764 :
150765 : // Build a local variable for better performance
150766 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
150767 :
150768 : // Iterate over the memory pools
150769 0 : for (unsigned int i=0; i < SgSymbol::pools.size(); i++)
150770 : {
150771 : // objectArray[i] is a single memory pool
150772 0 : for (unsigned j=0; j < SgSymbol::pool_size; j++)
150773 : {
150774 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
150775 : {
150776 : // printf ("Found a valid SgSymbol object in the memory pool %d at position %d \n",i,j);
150777 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
150778 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
150779 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
150780 : }
150781 : else
150782 : {
150783 : // printf ("Found a INVALID SgSymbol object in the memory pool \n");
150784 : }
150785 : }
150786 : }
150787 : }
150788 :
150789 : // This should not be required since all previously static data members are
150790 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
150791 :
150792 194 : }
150793 :
150794 : void
150795 0 : SgSymbol::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
150796 : {
150797 : // This function visits only a single IR node of the memory pool.
150798 : // it is typically called once for each type of IR node within
150799 : // the automatically generated function: traverseRepresentativeNodes().
150800 :
150801 : // Initialize array to the address of the first element of the STL vector
150802 : // (which is guarenteed to be contiguous storage).
150803 : // SgSymbol objectArray [] = *(Memory_Block_List.begin());
150804 0 : if (SgSymbol::pools.empty() == false)
150805 : {
150806 : // Generate an array of memory pools
150807 0 : SgSymbol** objectArray = (SgSymbol**) &(SgSymbol::pools[0]);
150808 :
150809 : // Build a local variable for better performance
150810 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
150811 :
150812 : // Iterate over the memory pools
150813 0 : bool done = false;
150814 0 : unsigned i=0;
150815 :
150816 : // find the first valid IR node, call visit function, and then leave
150817 0 : while ( done == false && i < SgSymbol::pools.size() )
150818 : {
150819 : // objectArray[i] is a single memory pool
150820 : unsigned j=0;
150821 0 : while (done == false && j < SgSymbol::pool_size)
150822 : {
150823 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
150824 : {
150825 0 : traversal.visit(&(objectArray[i][j]));
150826 0 : done = true;
150827 : }
150828 0 : j++;
150829 : }
150830 0 : i++;
150831 : }
150832 :
150833 : #if 0
150834 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
150835 : if (done == false)
150836 : {
150837 : printf ("No representative for SgSymbol found in memory pools \n");
150838 : }
150839 : #endif
150840 : }
150841 0 : }
150842 :
150843 :
150844 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
150845 : // using values that overflow signed values of int.
150846 : size_t
150847 4 : SgSymbol::numberOfNodes()
150848 : {
150849 : // This function traverses the memory pool for an IR node and
150850 : // counts the number of IR nodes of a particular Sage III IR
150851 : // nodes type.
150852 :
150853 4 : size_t count = 0;
150854 4 : if (SgSymbol::pools.empty() == false)
150855 : {
150856 : // Generate an array of memory pools (this is actually a STL vector,
150857 : // but it is contiguious, so OK to treat this way).
150858 0 : SgSymbol** objectArray = (SgSymbol**) &(SgSymbol::pools[0]);
150859 :
150860 : // Build a local variable for better performance (make it a loop invariant variable).
150861 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
150862 :
150863 : // Iterate over all of the memory pools for this IR node.
150864 0 : for (unsigned int i=0; i < SgSymbol::pools.size(); i++)
150865 : {
150866 : // objectArray[i] is a single memory pool, iterate over all the
150867 : // IR nodes and only count those that are valid IR nodes used in
150868 : // the AST (i.e. allocated IR nodes).
150869 0 : for (unsigned j=0; j < SgSymbol::pool_size; j++)
150870 : {
150871 : // This is indexing the STL vector of C/C++ style arrays as a doubly
150872 : // indexed array access. It is OK since we have leveraged the semantics
150873 : // of STL vector memory as contigous and cast the memory as an array
150874 : // of arrays to use the 2D array indexing. Hope this is not confusing,
150875 : // but it s very fast as an implementation.
150876 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
150877 : {
150878 0 : count++;
150879 : }
150880 : }
150881 : }
150882 : }
150883 :
150884 :
150885 :
150886 4 : return count;
150887 : }
150888 :
150889 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
150890 : // using values that overflow signed values of int.
150891 : size_t
150892 0 : SgSymbol::memoryUsage()
150893 : {
150894 : // This function is required because we need the class name as a type when we call sizeof
150895 : // There might be another way to implement this if we have a traversal that only called a
150896 : // representative object (one call for each type of Sage IIIIR node).
150897 0 : size_t memory = numberOfNodes() * sizeof(SgSymbol);
150898 :
150899 0 : return memory;
150900 : }
150901 :
150902 : /* #line 150903 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
150903 :
150904 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
150905 : void
150906 5351 : SgVariableSymbol::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
150907 : {
150908 : // This function traverses the memory pool for only a specific IR node
150909 : // and calls the visit function of the input class execute a traversal
150910 : // similar to the style of the attribute based traversals within ROSE.
150911 : // This traversal will visit ALL nodes of the AST where as the other
150912 : // attribute based traversals visit only the embedded tree within the AST.
150913 :
150914 : // Initialize array to the address of the first element of the STL vector
150915 : // (which is guaranteed to be contiguous storage).
150916 : // SgVariableSymbol objectArray [] = *(Memory_Block_List.begin());
150917 5351 : if (SgVariableSymbol::pools.empty() == false)
150918 : {
150919 : // Generate an array of memory pools
150920 4785 : SgVariableSymbol** objectArray = (SgVariableSymbol**) &(SgVariableSymbol::pools[0]);
150921 :
150922 : // Build a local variable for better performance
150923 4785 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
150924 : #if 0
150925 : // Iterate over the memory pools
150926 : for (unsigned int i=0; i < SgVariableSymbol::pools.size(); i++)
150927 : {
150928 : // objectArray[i] is a single memory pool
150929 : for (int j=0; j < SgVariableSymbol::pool_size; j++)
150930 : {
150931 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
150932 : {
150933 : traversal.visit(&(objectArray[i][j]));
150934 : }
150935 : }
150936 : }
150937 : #else
150938 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
150939 : // compute the list first and then call the visit function on each list element.
150940 :
150941 : // printf ("Inside of SgVariableSymbol::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
150942 :
150943 9570 : std::vector<SgVariableSymbol*> nodeList;
150944 :
150945 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
150946 9825 : for (unsigned int i=0; i < SgVariableSymbol::pools.size(); i++)
150947 : {
150948 : // objectArray[i] is a single memory pool
150949 10085000 : for (unsigned j=0; j < SgVariableSymbol::pool_size; j++)
150950 : {
150951 10080000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
150952 : {
150953 889152 : nodeList.push_back(&(objectArray[i][j]));
150954 : }
150955 : }
150956 : }
150957 :
150958 : // Iterate over the saved list
150959 4785 : size_t nodeListSize = nodeList.size();
150960 893937 : for (size_t i=0; i < nodeListSize; i++)
150961 : {
150962 889152 : ROSE_ASSERT(nodeList[i] != NULL);
150963 : #if 0
150964 : traversal.visit(nodeList[i]);
150965 : #else
150966 889152 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
150967 : {
150968 889152 : traversal.visit(nodeList[i]);
150969 : }
150970 : #endif
150971 : }
150972 : #endif
150973 : }
150974 :
150975 : // This should not be required since all previously static data members are
150976 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
150977 :
150978 5351 : }
150979 :
150980 :
150981 : void
150982 194 : SgVariableSymbol::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
150983 : {
150984 : // This function traverses the memory pool for an IR node and
150985 : // calls the function to execute the visitor object.
150986 :
150987 : // Initialize array to the address of the first element of the STL vector
150988 : // (which is guarenteed to be contiguous storage).
150989 : // SgVariableSymbol objectArray [] = *(Memory_Block_List.begin());
150990 194 : if (SgVariableSymbol::pools.empty() == false)
150991 : {
150992 : // Generate an array of memory pools
150993 194 : SgVariableSymbol** objectArray = (SgVariableSymbol**) &(SgVariableSymbol::pools[0]);
150994 :
150995 : // Build a local variable for better performance
150996 194 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
150997 :
150998 : // Iterate over the memory pools
150999 662 : for (unsigned int i=0; i < SgVariableSymbol::pools.size(); i++)
151000 : {
151001 : // objectArray[i] is a single memory pool
151002 936468 : for (unsigned j=0; j < SgVariableSymbol::pool_size; j++)
151003 : {
151004 936000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
151005 : {
151006 : // printf ("Found a valid SgVariableSymbol object in the memory pool %d at position %d \n",i,j);
151007 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
151008 588259 : objectArray[i][j].executeVisitorMemberFunction(visitor);
151009 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
151010 : }
151011 : else
151012 : {
151013 : // printf ("Found a INVALID SgVariableSymbol object in the memory pool \n");
151014 : }
151015 : }
151016 : }
151017 : }
151018 :
151019 : // This should not be required since all previously static data members are
151020 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
151021 :
151022 194 : }
151023 :
151024 : void
151025 0 : SgVariableSymbol::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
151026 : {
151027 : // This function visits only a single IR node of the memory pool.
151028 : // it is typically called once for each type of IR node within
151029 : // the automatically generated function: traverseRepresentativeNodes().
151030 :
151031 : // Initialize array to the address of the first element of the STL vector
151032 : // (which is guarenteed to be contiguous storage).
151033 : // SgVariableSymbol objectArray [] = *(Memory_Block_List.begin());
151034 0 : if (SgVariableSymbol::pools.empty() == false)
151035 : {
151036 : // Generate an array of memory pools
151037 0 : SgVariableSymbol** objectArray = (SgVariableSymbol**) &(SgVariableSymbol::pools[0]);
151038 :
151039 : // Build a local variable for better performance
151040 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
151041 :
151042 : // Iterate over the memory pools
151043 0 : bool done = false;
151044 0 : unsigned i=0;
151045 :
151046 : // find the first valid IR node, call visit function, and then leave
151047 0 : while ( done == false && i < SgVariableSymbol::pools.size() )
151048 : {
151049 : // objectArray[i] is a single memory pool
151050 : unsigned j=0;
151051 0 : while (done == false && j < SgVariableSymbol::pool_size)
151052 : {
151053 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
151054 : {
151055 0 : traversal.visit(&(objectArray[i][j]));
151056 0 : done = true;
151057 : }
151058 0 : j++;
151059 : }
151060 0 : i++;
151061 : }
151062 :
151063 : #if 0
151064 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
151065 : if (done == false)
151066 : {
151067 : printf ("No representative for SgVariableSymbol found in memory pools \n");
151068 : }
151069 : #endif
151070 : }
151071 0 : }
151072 :
151073 :
151074 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
151075 : // using values that overflow signed values of int.
151076 : size_t
151077 4 : SgVariableSymbol::numberOfNodes()
151078 : {
151079 : // This function traverses the memory pool for an IR node and
151080 : // counts the number of IR nodes of a particular Sage III IR
151081 : // nodes type.
151082 :
151083 4 : size_t count = 0;
151084 4 : if (SgVariableSymbol::pools.empty() == false)
151085 : {
151086 : // Generate an array of memory pools (this is actually a STL vector,
151087 : // but it is contiguious, so OK to treat this way).
151088 3 : SgVariableSymbol** objectArray = (SgVariableSymbol**) &(SgVariableSymbol::pools[0]);
151089 :
151090 : // Build a local variable for better performance (make it a loop invariant variable).
151091 3 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
151092 :
151093 : // Iterate over all of the memory pools for this IR node.
151094 8 : for (unsigned int i=0; i < SgVariableSymbol::pools.size(); i++)
151095 : {
151096 : // objectArray[i] is a single memory pool, iterate over all the
151097 : // IR nodes and only count those that are valid IR nodes used in
151098 : // the AST (i.e. allocated IR nodes).
151099 10005 : for (unsigned j=0; j < SgVariableSymbol::pool_size; j++)
151100 : {
151101 : // This is indexing the STL vector of C/C++ style arrays as a doubly
151102 : // indexed array access. It is OK since we have leveraged the semantics
151103 : // of STL vector memory as contigous and cast the memory as an array
151104 : // of arrays to use the 2D array indexing. Hope this is not confusing,
151105 : // but it s very fast as an implementation.
151106 10000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
151107 : {
151108 4230 : count++;
151109 : }
151110 : }
151111 : }
151112 : }
151113 :
151114 :
151115 :
151116 4 : return count;
151117 : }
151118 :
151119 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
151120 : // using values that overflow signed values of int.
151121 : size_t
151122 0 : SgVariableSymbol::memoryUsage()
151123 : {
151124 : // This function is required because we need the class name as a type when we call sizeof
151125 : // There might be another way to implement this if we have a traversal that only called a
151126 : // representative object (one call for each type of Sage IIIIR node).
151127 0 : size_t memory = numberOfNodes() * sizeof(SgVariableSymbol);
151128 :
151129 0 : return memory;
151130 : }
151131 :
151132 : /* #line 151133 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
151133 :
151134 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
151135 : void
151136 5349 : SgTemplateVariableSymbol::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
151137 : {
151138 : // This function traverses the memory pool for only a specific IR node
151139 : // and calls the visit function of the input class execute a traversal
151140 : // similar to the style of the attribute based traversals within ROSE.
151141 : // This traversal will visit ALL nodes of the AST where as the other
151142 : // attribute based traversals visit only the embedded tree within the AST.
151143 :
151144 : // Initialize array to the address of the first element of the STL vector
151145 : // (which is guaranteed to be contiguous storage).
151146 : // SgTemplateVariableSymbol objectArray [] = *(Memory_Block_List.begin());
151147 5349 : if (SgTemplateVariableSymbol::pools.empty() == false)
151148 : {
151149 : // Generate an array of memory pools
151150 145 : SgTemplateVariableSymbol** objectArray = (SgTemplateVariableSymbol**) &(SgTemplateVariableSymbol::pools[0]);
151151 :
151152 : // Build a local variable for better performance
151153 145 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
151154 : #if 0
151155 : // Iterate over the memory pools
151156 : for (unsigned int i=0; i < SgTemplateVariableSymbol::pools.size(); i++)
151157 : {
151158 : // objectArray[i] is a single memory pool
151159 : for (int j=0; j < SgTemplateVariableSymbol::pool_size; j++)
151160 : {
151161 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
151162 : {
151163 : traversal.visit(&(objectArray[i][j]));
151164 : }
151165 : }
151166 : }
151167 : #else
151168 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
151169 : // compute the list first and then call the visit function on each list element.
151170 :
151171 : // printf ("Inside of SgTemplateVariableSymbol::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
151172 :
151173 290 : std::vector<SgTemplateVariableSymbol*> nodeList;
151174 :
151175 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
151176 290 : for (unsigned int i=0; i < SgTemplateVariableSymbol::pools.size(); i++)
151177 : {
151178 : // objectArray[i] is a single memory pool
151179 290145 : for (unsigned j=0; j < SgTemplateVariableSymbol::pool_size; j++)
151180 : {
151181 290000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
151182 : {
151183 10694 : nodeList.push_back(&(objectArray[i][j]));
151184 : }
151185 : }
151186 : }
151187 :
151188 : // Iterate over the saved list
151189 145 : size_t nodeListSize = nodeList.size();
151190 10839 : for (size_t i=0; i < nodeListSize; i++)
151191 : {
151192 10694 : ROSE_ASSERT(nodeList[i] != NULL);
151193 : #if 0
151194 : traversal.visit(nodeList[i]);
151195 : #else
151196 10694 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
151197 : {
151198 10694 : traversal.visit(nodeList[i]);
151199 : }
151200 : #endif
151201 : }
151202 : #endif
151203 : }
151204 :
151205 : // This should not be required since all previously static data members are
151206 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
151207 :
151208 5349 : }
151209 :
151210 :
151211 : void
151212 194 : SgTemplateVariableSymbol::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
151213 : {
151214 : // This function traverses the memory pool for an IR node and
151215 : // calls the function to execute the visitor object.
151216 :
151217 : // Initialize array to the address of the first element of the STL vector
151218 : // (which is guarenteed to be contiguous storage).
151219 : // SgTemplateVariableSymbol objectArray [] = *(Memory_Block_List.begin());
151220 194 : if (SgTemplateVariableSymbol::pools.empty() == false)
151221 : {
151222 : // Generate an array of memory pools
151223 137 : SgTemplateVariableSymbol** objectArray = (SgTemplateVariableSymbol**) &(SgTemplateVariableSymbol::pools[0]);
151224 :
151225 : // Build a local variable for better performance
151226 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
151227 :
151228 : // Iterate over the memory pools
151229 274 : for (unsigned int i=0; i < SgTemplateVariableSymbol::pools.size(); i++)
151230 : {
151231 : // objectArray[i] is a single memory pool
151232 274137 : for (unsigned j=0; j < SgTemplateVariableSymbol::pool_size; j++)
151233 : {
151234 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
151235 : {
151236 : // printf ("Found a valid SgTemplateVariableSymbol object in the memory pool %d at position %d \n",i,j);
151237 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
151238 11765 : objectArray[i][j].executeVisitorMemberFunction(visitor);
151239 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
151240 : }
151241 : else
151242 : {
151243 : // printf ("Found a INVALID SgTemplateVariableSymbol object in the memory pool \n");
151244 : }
151245 : }
151246 : }
151247 : }
151248 :
151249 : // This should not be required since all previously static data members are
151250 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
151251 :
151252 194 : }
151253 :
151254 : void
151255 0 : SgTemplateVariableSymbol::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
151256 : {
151257 : // This function visits only a single IR node of the memory pool.
151258 : // it is typically called once for each type of IR node within
151259 : // the automatically generated function: traverseRepresentativeNodes().
151260 :
151261 : // Initialize array to the address of the first element of the STL vector
151262 : // (which is guarenteed to be contiguous storage).
151263 : // SgTemplateVariableSymbol objectArray [] = *(Memory_Block_List.begin());
151264 0 : if (SgTemplateVariableSymbol::pools.empty() == false)
151265 : {
151266 : // Generate an array of memory pools
151267 0 : SgTemplateVariableSymbol** objectArray = (SgTemplateVariableSymbol**) &(SgTemplateVariableSymbol::pools[0]);
151268 :
151269 : // Build a local variable for better performance
151270 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
151271 :
151272 : // Iterate over the memory pools
151273 0 : bool done = false;
151274 0 : unsigned i=0;
151275 :
151276 : // find the first valid IR node, call visit function, and then leave
151277 0 : while ( done == false && i < SgTemplateVariableSymbol::pools.size() )
151278 : {
151279 : // objectArray[i] is a single memory pool
151280 : unsigned j=0;
151281 0 : while (done == false && j < SgTemplateVariableSymbol::pool_size)
151282 : {
151283 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
151284 : {
151285 0 : traversal.visit(&(objectArray[i][j]));
151286 0 : done = true;
151287 : }
151288 0 : j++;
151289 : }
151290 0 : i++;
151291 : }
151292 :
151293 : #if 0
151294 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
151295 : if (done == false)
151296 : {
151297 : printf ("No representative for SgTemplateVariableSymbol found in memory pools \n");
151298 : }
151299 : #endif
151300 : }
151301 0 : }
151302 :
151303 :
151304 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
151305 : // using values that overflow signed values of int.
151306 : size_t
151307 4 : SgTemplateVariableSymbol::numberOfNodes()
151308 : {
151309 : // This function traverses the memory pool for an IR node and
151310 : // counts the number of IR nodes of a particular Sage III IR
151311 : // nodes type.
151312 :
151313 4 : size_t count = 0;
151314 4 : if (SgTemplateVariableSymbol::pools.empty() == false)
151315 : {
151316 : // Generate an array of memory pools (this is actually a STL vector,
151317 : // but it is contiguious, so OK to treat this way).
151318 1 : SgTemplateVariableSymbol** objectArray = (SgTemplateVariableSymbol**) &(SgTemplateVariableSymbol::pools[0]);
151319 :
151320 : // Build a local variable for better performance (make it a loop invariant variable).
151321 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
151322 :
151323 : // Iterate over all of the memory pools for this IR node.
151324 2 : for (unsigned int i=0; i < SgTemplateVariableSymbol::pools.size(); i++)
151325 : {
151326 : // objectArray[i] is a single memory pool, iterate over all the
151327 : // IR nodes and only count those that are valid IR nodes used in
151328 : // the AST (i.e. allocated IR nodes).
151329 2001 : for (unsigned j=0; j < SgTemplateVariableSymbol::pool_size; j++)
151330 : {
151331 : // This is indexing the STL vector of C/C++ style arrays as a doubly
151332 : // indexed array access. It is OK since we have leveraged the semantics
151333 : // of STL vector memory as contigous and cast the memory as an array
151334 : // of arrays to use the 2D array indexing. Hope this is not confusing,
151335 : // but it s very fast as an implementation.
151336 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
151337 : {
151338 86 : count++;
151339 : }
151340 : }
151341 : }
151342 : }
151343 :
151344 :
151345 :
151346 4 : return count;
151347 : }
151348 :
151349 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
151350 : // using values that overflow signed values of int.
151351 : size_t
151352 0 : SgTemplateVariableSymbol::memoryUsage()
151353 : {
151354 : // This function is required because we need the class name as a type when we call sizeof
151355 : // There might be another way to implement this if we have a traversal that only called a
151356 : // representative object (one call for each type of Sage IIIIR node).
151357 0 : size_t memory = numberOfNodes() * sizeof(SgTemplateVariableSymbol);
151358 :
151359 0 : return memory;
151360 : }
151361 :
151362 : /* #line 151363 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
151363 :
151364 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
151365 : void
151366 5342 : SgNonrealSymbol::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
151367 : {
151368 : // This function traverses the memory pool for only a specific IR node
151369 : // and calls the visit function of the input class execute a traversal
151370 : // similar to the style of the attribute based traversals within ROSE.
151371 : // This traversal will visit ALL nodes of the AST where as the other
151372 : // attribute based traversals visit only the embedded tree within the AST.
151373 :
151374 : // Initialize array to the address of the first element of the STL vector
151375 : // (which is guaranteed to be contiguous storage).
151376 : // SgNonrealSymbol objectArray [] = *(Memory_Block_List.begin());
151377 5342 : if (SgNonrealSymbol::pools.empty() == false)
151378 : {
151379 : // Generate an array of memory pools
151380 145 : SgNonrealSymbol** objectArray = (SgNonrealSymbol**) &(SgNonrealSymbol::pools[0]);
151381 :
151382 : // Build a local variable for better performance
151383 145 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
151384 : #if 0
151385 : // Iterate over the memory pools
151386 : for (unsigned int i=0; i < SgNonrealSymbol::pools.size(); i++)
151387 : {
151388 : // objectArray[i] is a single memory pool
151389 : for (int j=0; j < SgNonrealSymbol::pool_size; j++)
151390 : {
151391 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
151392 : {
151393 : traversal.visit(&(objectArray[i][j]));
151394 : }
151395 : }
151396 : }
151397 : #else
151398 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
151399 : // compute the list first and then call the visit function on each list element.
151400 :
151401 : // printf ("Inside of SgNonrealSymbol::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
151402 :
151403 290 : std::vector<SgNonrealSymbol*> nodeList;
151404 :
151405 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
151406 566 : for (unsigned int i=0; i < SgNonrealSymbol::pools.size(); i++)
151407 : {
151408 : // objectArray[i] is a single memory pool
151409 842421 : for (unsigned j=0; j < SgNonrealSymbol::pool_size; j++)
151410 : {
151411 842000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
151412 : {
151413 682838 : nodeList.push_back(&(objectArray[i][j]));
151414 : }
151415 : }
151416 : }
151417 :
151418 : // Iterate over the saved list
151419 145 : size_t nodeListSize = nodeList.size();
151420 682983 : for (size_t i=0; i < nodeListSize; i++)
151421 : {
151422 682838 : ROSE_ASSERT(nodeList[i] != NULL);
151423 : #if 0
151424 : traversal.visit(nodeList[i]);
151425 : #else
151426 682838 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
151427 : {
151428 682838 : traversal.visit(nodeList[i]);
151429 : }
151430 : #endif
151431 : }
151432 : #endif
151433 : }
151434 :
151435 : // This should not be required since all previously static data members are
151436 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
151437 :
151438 5342 : }
151439 :
151440 :
151441 : void
151442 194 : SgNonrealSymbol::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
151443 : {
151444 : // This function traverses the memory pool for an IR node and
151445 : // calls the function to execute the visitor object.
151446 :
151447 : // Initialize array to the address of the first element of the STL vector
151448 : // (which is guarenteed to be contiguous storage).
151449 : // SgNonrealSymbol objectArray [] = *(Memory_Block_List.begin());
151450 194 : if (SgNonrealSymbol::pools.empty() == false)
151451 : {
151452 : // Generate an array of memory pools
151453 137 : SgNonrealSymbol** objectArray = (SgNonrealSymbol**) &(SgNonrealSymbol::pools[0]);
151454 :
151455 : // Build a local variable for better performance
151456 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
151457 :
151458 : // Iterate over the memory pools
151459 548 : for (unsigned int i=0; i < SgNonrealSymbol::pools.size(); i++)
151460 : {
151461 : // objectArray[i] is a single memory pool
151462 822411 : for (unsigned j=0; j < SgNonrealSymbol::pool_size; j++)
151463 : {
151464 822000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
151465 : {
151466 : // printf ("Found a valid SgNonrealSymbol object in the memory pool %d at position %d \n",i,j);
151467 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
151468 704852 : objectArray[i][j].executeVisitorMemberFunction(visitor);
151469 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
151470 : }
151471 : else
151472 : {
151473 : // printf ("Found a INVALID SgNonrealSymbol object in the memory pool \n");
151474 : }
151475 : }
151476 : }
151477 : }
151478 :
151479 : // This should not be required since all previously static data members are
151480 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
151481 :
151482 194 : }
151483 :
151484 : void
151485 0 : SgNonrealSymbol::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
151486 : {
151487 : // This function visits only a single IR node of the memory pool.
151488 : // it is typically called once for each type of IR node within
151489 : // the automatically generated function: traverseRepresentativeNodes().
151490 :
151491 : // Initialize array to the address of the first element of the STL vector
151492 : // (which is guarenteed to be contiguous storage).
151493 : // SgNonrealSymbol objectArray [] = *(Memory_Block_List.begin());
151494 0 : if (SgNonrealSymbol::pools.empty() == false)
151495 : {
151496 : // Generate an array of memory pools
151497 0 : SgNonrealSymbol** objectArray = (SgNonrealSymbol**) &(SgNonrealSymbol::pools[0]);
151498 :
151499 : // Build a local variable for better performance
151500 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
151501 :
151502 : // Iterate over the memory pools
151503 0 : bool done = false;
151504 0 : unsigned i=0;
151505 :
151506 : // find the first valid IR node, call visit function, and then leave
151507 0 : while ( done == false && i < SgNonrealSymbol::pools.size() )
151508 : {
151509 : // objectArray[i] is a single memory pool
151510 : unsigned j=0;
151511 0 : while (done == false && j < SgNonrealSymbol::pool_size)
151512 : {
151513 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
151514 : {
151515 0 : traversal.visit(&(objectArray[i][j]));
151516 0 : done = true;
151517 : }
151518 0 : j++;
151519 : }
151520 0 : i++;
151521 : }
151522 :
151523 : #if 0
151524 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
151525 : if (done == false)
151526 : {
151527 : printf ("No representative for SgNonrealSymbol found in memory pools \n");
151528 : }
151529 : #endif
151530 : }
151531 0 : }
151532 :
151533 :
151534 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
151535 : // using values that overflow signed values of int.
151536 : size_t
151537 4 : SgNonrealSymbol::numberOfNodes()
151538 : {
151539 : // This function traverses the memory pool for an IR node and
151540 : // counts the number of IR nodes of a particular Sage III IR
151541 : // nodes type.
151542 :
151543 4 : size_t count = 0;
151544 4 : if (SgNonrealSymbol::pools.empty() == false)
151545 : {
151546 : // Generate an array of memory pools (this is actually a STL vector,
151547 : // but it is contiguious, so OK to treat this way).
151548 1 : SgNonrealSymbol** objectArray = (SgNonrealSymbol**) &(SgNonrealSymbol::pools[0]);
151549 :
151550 : // Build a local variable for better performance (make it a loop invariant variable).
151551 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
151552 :
151553 : // Iterate over all of the memory pools for this IR node.
151554 4 : for (unsigned int i=0; i < SgNonrealSymbol::pools.size(); i++)
151555 : {
151556 : // objectArray[i] is a single memory pool, iterate over all the
151557 : // IR nodes and only count those that are valid IR nodes used in
151558 : // the AST (i.e. allocated IR nodes).
151559 6003 : for (unsigned j=0; j < SgNonrealSymbol::pool_size; j++)
151560 : {
151561 : // This is indexing the STL vector of C/C++ style arrays as a doubly
151562 : // indexed array access. It is OK since we have leveraged the semantics
151563 : // of STL vector memory as contigous and cast the memory as an array
151564 : // of arrays to use the 2D array indexing. Hope this is not confusing,
151565 : // but it s very fast as an implementation.
151566 6000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
151567 : {
151568 5080 : count++;
151569 : }
151570 : }
151571 : }
151572 : }
151573 :
151574 :
151575 :
151576 4 : return count;
151577 : }
151578 :
151579 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
151580 : // using values that overflow signed values of int.
151581 : size_t
151582 0 : SgNonrealSymbol::memoryUsage()
151583 : {
151584 : // This function is required because we need the class name as a type when we call sizeof
151585 : // There might be another way to implement this if we have a traversal that only called a
151586 : // representative object (one call for each type of Sage IIIIR node).
151587 0 : size_t memory = numberOfNodes() * sizeof(SgNonrealSymbol);
151588 :
151589 0 : return memory;
151590 : }
151591 :
151592 : /* #line 151593 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
151593 :
151594 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
151595 : void
151596 5344 : SgFunctionSymbol::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
151597 : {
151598 : // This function traverses the memory pool for only a specific IR node
151599 : // and calls the visit function of the input class execute a traversal
151600 : // similar to the style of the attribute based traversals within ROSE.
151601 : // This traversal will visit ALL nodes of the AST where as the other
151602 : // attribute based traversals visit only the embedded tree within the AST.
151603 :
151604 : // Initialize array to the address of the first element of the STL vector
151605 : // (which is guaranteed to be contiguous storage).
151606 : // SgFunctionSymbol objectArray [] = *(Memory_Block_List.begin());
151607 5344 : if (SgFunctionSymbol::pools.empty() == false)
151608 : {
151609 : // Generate an array of memory pools
151610 5305 : SgFunctionSymbol** objectArray = (SgFunctionSymbol**) &(SgFunctionSymbol::pools[0]);
151611 :
151612 : // Build a local variable for better performance
151613 5305 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
151614 : #if 0
151615 : // Iterate over the memory pools
151616 : for (unsigned int i=0; i < SgFunctionSymbol::pools.size(); i++)
151617 : {
151618 : // objectArray[i] is a single memory pool
151619 : for (int j=0; j < SgFunctionSymbol::pool_size; j++)
151620 : {
151621 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
151622 : {
151623 : traversal.visit(&(objectArray[i][j]));
151624 : }
151625 : }
151626 : }
151627 : #else
151628 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
151629 : // compute the list first and then call the visit function on each list element.
151630 :
151631 : // printf ("Inside of SgFunctionSymbol::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
151632 :
151633 10610 : std::vector<SgFunctionSymbol*> nodeList;
151634 :
151635 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
151636 15289 : for (unsigned int i=0; i < SgFunctionSymbol::pools.size(); i++)
151637 : {
151638 : // objectArray[i] is a single memory pool
151639 19978000 : for (unsigned j=0; j < SgFunctionSymbol::pool_size; j++)
151640 : {
151641 19968000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
151642 : {
151643 12062100 : nodeList.push_back(&(objectArray[i][j]));
151644 : }
151645 : }
151646 : }
151647 :
151648 : // Iterate over the saved list
151649 5305 : size_t nodeListSize = nodeList.size();
151650 12067400 : for (size_t i=0; i < nodeListSize; i++)
151651 : {
151652 12062100 : ROSE_ASSERT(nodeList[i] != NULL);
151653 : #if 0
151654 : traversal.visit(nodeList[i]);
151655 : #else
151656 12062100 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
151657 : {
151658 12062100 : traversal.visit(nodeList[i]);
151659 : }
151660 : #endif
151661 : }
151662 : #endif
151663 : }
151664 :
151665 : // This should not be required since all previously static data members are
151666 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
151667 :
151668 5344 : }
151669 :
151670 :
151671 : void
151672 194 : SgFunctionSymbol::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
151673 : {
151674 : // This function traverses the memory pool for an IR node and
151675 : // calls the function to execute the visitor object.
151676 :
151677 : // Initialize array to the address of the first element of the STL vector
151678 : // (which is guarenteed to be contiguous storage).
151679 : // SgFunctionSymbol objectArray [] = *(Memory_Block_List.begin());
151680 194 : if (SgFunctionSymbol::pools.empty() == false)
151681 : {
151682 : // Generate an array of memory pools
151683 194 : SgFunctionSymbol** objectArray = (SgFunctionSymbol**) &(SgFunctionSymbol::pools[0]);
151684 :
151685 : // Build a local variable for better performance
151686 194 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
151687 :
151688 : // Iterate over the memory pools
151689 582 : for (unsigned int i=0; i < SgFunctionSymbol::pools.size(); i++)
151690 : {
151691 : // objectArray[i] is a single memory pool
151692 776388 : for (unsigned j=0; j < SgFunctionSymbol::pool_size; j++)
151693 : {
151694 776000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
151695 : {
151696 : // printf ("Found a valid SgFunctionSymbol object in the memory pool %d at position %d \n",i,j);
151697 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
151698 627371 : objectArray[i][j].executeVisitorMemberFunction(visitor);
151699 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
151700 : }
151701 : else
151702 : {
151703 : // printf ("Found a INVALID SgFunctionSymbol object in the memory pool \n");
151704 : }
151705 : }
151706 : }
151707 : }
151708 :
151709 : // This should not be required since all previously static data members are
151710 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
151711 :
151712 194 : }
151713 :
151714 : void
151715 0 : SgFunctionSymbol::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
151716 : {
151717 : // This function visits only a single IR node of the memory pool.
151718 : // it is typically called once for each type of IR node within
151719 : // the automatically generated function: traverseRepresentativeNodes().
151720 :
151721 : // Initialize array to the address of the first element of the STL vector
151722 : // (which is guarenteed to be contiguous storage).
151723 : // SgFunctionSymbol objectArray [] = *(Memory_Block_List.begin());
151724 0 : if (SgFunctionSymbol::pools.empty() == false)
151725 : {
151726 : // Generate an array of memory pools
151727 0 : SgFunctionSymbol** objectArray = (SgFunctionSymbol**) &(SgFunctionSymbol::pools[0]);
151728 :
151729 : // Build a local variable for better performance
151730 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
151731 :
151732 : // Iterate over the memory pools
151733 0 : bool done = false;
151734 0 : unsigned i=0;
151735 :
151736 : // find the first valid IR node, call visit function, and then leave
151737 0 : while ( done == false && i < SgFunctionSymbol::pools.size() )
151738 : {
151739 : // objectArray[i] is a single memory pool
151740 : unsigned j=0;
151741 0 : while (done == false && j < SgFunctionSymbol::pool_size)
151742 : {
151743 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
151744 : {
151745 0 : traversal.visit(&(objectArray[i][j]));
151746 0 : done = true;
151747 : }
151748 0 : j++;
151749 : }
151750 0 : i++;
151751 : }
151752 :
151753 : #if 0
151754 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
151755 : if (done == false)
151756 : {
151757 : printf ("No representative for SgFunctionSymbol found in memory pools \n");
151758 : }
151759 : #endif
151760 : }
151761 0 : }
151762 :
151763 :
151764 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
151765 : // using values that overflow signed values of int.
151766 : size_t
151767 4 : SgFunctionSymbol::numberOfNodes()
151768 : {
151769 : // This function traverses the memory pool for an IR node and
151770 : // counts the number of IR nodes of a particular Sage III IR
151771 : // nodes type.
151772 :
151773 4 : size_t count = 0;
151774 4 : if (SgFunctionSymbol::pools.empty() == false)
151775 : {
151776 : // Generate an array of memory pools (this is actually a STL vector,
151777 : // but it is contiguious, so OK to treat this way).
151778 4 : SgFunctionSymbol** objectArray = (SgFunctionSymbol**) &(SgFunctionSymbol::pools[0]);
151779 :
151780 : // Build a local variable for better performance (make it a loop invariant variable).
151781 4 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
151782 :
151783 : // Iterate over all of the memory pools for this IR node.
151784 10 : for (unsigned int i=0; i < SgFunctionSymbol::pools.size(); i++)
151785 : {
151786 : // objectArray[i] is a single memory pool, iterate over all the
151787 : // IR nodes and only count those that are valid IR nodes used in
151788 : // the AST (i.e. allocated IR nodes).
151789 12006 : for (unsigned j=0; j < SgFunctionSymbol::pool_size; j++)
151790 : {
151791 : // This is indexing the STL vector of C/C++ style arrays as a doubly
151792 : // indexed array access. It is OK since we have leveraged the semantics
151793 : // of STL vector memory as contigous and cast the memory as an array
151794 : // of arrays to use the 2D array indexing. Hope this is not confusing,
151795 : // but it s very fast as an implementation.
151796 12000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
151797 : {
151798 5960 : count++;
151799 : }
151800 : }
151801 : }
151802 : }
151803 :
151804 :
151805 :
151806 4 : return count;
151807 : }
151808 :
151809 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
151810 : // using values that overflow signed values of int.
151811 : size_t
151812 0 : SgFunctionSymbol::memoryUsage()
151813 : {
151814 : // This function is required because we need the class name as a type when we call sizeof
151815 : // There might be another way to implement this if we have a traversal that only called a
151816 : // representative object (one call for each type of Sage IIIIR node).
151817 0 : size_t memory = numberOfNodes() * sizeof(SgFunctionSymbol);
151818 :
151819 0 : return memory;
151820 : }
151821 :
151822 : /* #line 151823 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
151823 :
151824 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
151825 : void
151826 5344 : SgMemberFunctionSymbol::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
151827 : {
151828 : // This function traverses the memory pool for only a specific IR node
151829 : // and calls the visit function of the input class execute a traversal
151830 : // similar to the style of the attribute based traversals within ROSE.
151831 : // This traversal will visit ALL nodes of the AST where as the other
151832 : // attribute based traversals visit only the embedded tree within the AST.
151833 :
151834 : // Initialize array to the address of the first element of the STL vector
151835 : // (which is guaranteed to be contiguous storage).
151836 : // SgMemberFunctionSymbol objectArray [] = *(Memory_Block_List.begin());
151837 5344 : if (SgMemberFunctionSymbol::pools.empty() == false)
151838 : {
151839 : // Generate an array of memory pools
151840 228 : SgMemberFunctionSymbol** objectArray = (SgMemberFunctionSymbol**) &(SgMemberFunctionSymbol::pools[0]);
151841 :
151842 : // Build a local variable for better performance
151843 228 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
151844 : #if 0
151845 : // Iterate over the memory pools
151846 : for (unsigned int i=0; i < SgMemberFunctionSymbol::pools.size(); i++)
151847 : {
151848 : // objectArray[i] is a single memory pool
151849 : for (int j=0; j < SgMemberFunctionSymbol::pool_size; j++)
151850 : {
151851 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
151852 : {
151853 : traversal.visit(&(objectArray[i][j]));
151854 : }
151855 : }
151856 : }
151857 : #else
151858 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
151859 : // compute the list first and then call the visit function on each list element.
151860 :
151861 : // printf ("Inside of SgMemberFunctionSymbol::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
151862 :
151863 456 : std::vector<SgMemberFunctionSymbol*> nodeList;
151864 :
151865 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
151866 465 : for (unsigned int i=0; i < SgMemberFunctionSymbol::pools.size(); i++)
151867 : {
151868 : // objectArray[i] is a single memory pool
151869 474237 : for (unsigned j=0; j < SgMemberFunctionSymbol::pool_size; j++)
151870 : {
151871 474000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
151872 : {
151873 235417 : nodeList.push_back(&(objectArray[i][j]));
151874 : }
151875 : }
151876 : }
151877 :
151878 : // Iterate over the saved list
151879 228 : size_t nodeListSize = nodeList.size();
151880 235645 : for (size_t i=0; i < nodeListSize; i++)
151881 : {
151882 235417 : ROSE_ASSERT(nodeList[i] != NULL);
151883 : #if 0
151884 : traversal.visit(nodeList[i]);
151885 : #else
151886 235417 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
151887 : {
151888 235417 : traversal.visit(nodeList[i]);
151889 : }
151890 : #endif
151891 : }
151892 : #endif
151893 : }
151894 :
151895 : // This should not be required since all previously static data members are
151896 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
151897 :
151898 5344 : }
151899 :
151900 :
151901 : void
151902 194 : SgMemberFunctionSymbol::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
151903 : {
151904 : // This function traverses the memory pool for an IR node and
151905 : // calls the function to execute the visitor object.
151906 :
151907 : // Initialize array to the address of the first element of the STL vector
151908 : // (which is guarenteed to be contiguous storage).
151909 : // SgMemberFunctionSymbol objectArray [] = *(Memory_Block_List.begin());
151910 194 : if (SgMemberFunctionSymbol::pools.empty() == false)
151911 : {
151912 : // Generate an array of memory pools
151913 137 : SgMemberFunctionSymbol** objectArray = (SgMemberFunctionSymbol**) &(SgMemberFunctionSymbol::pools[0]);
151914 :
151915 : // Build a local variable for better performance
151916 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
151917 :
151918 : // Iterate over the memory pools
151919 292 : for (unsigned int i=0; i < SgMemberFunctionSymbol::pools.size(); i++)
151920 : {
151921 : // objectArray[i] is a single memory pool
151922 310155 : for (unsigned j=0; j < SgMemberFunctionSymbol::pool_size; j++)
151923 : {
151924 310000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
151925 : {
151926 : // printf ("Found a valid SgMemberFunctionSymbol object in the memory pool %d at position %d \n",i,j);
151927 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
151928 269492 : objectArray[i][j].executeVisitorMemberFunction(visitor);
151929 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
151930 : }
151931 : else
151932 : {
151933 : // printf ("Found a INVALID SgMemberFunctionSymbol object in the memory pool \n");
151934 : }
151935 : }
151936 : }
151937 : }
151938 :
151939 : // This should not be required since all previously static data members are
151940 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
151941 :
151942 194 : }
151943 :
151944 : void
151945 0 : SgMemberFunctionSymbol::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
151946 : {
151947 : // This function visits only a single IR node of the memory pool.
151948 : // it is typically called once for each type of IR node within
151949 : // the automatically generated function: traverseRepresentativeNodes().
151950 :
151951 : // Initialize array to the address of the first element of the STL vector
151952 : // (which is guarenteed to be contiguous storage).
151953 : // SgMemberFunctionSymbol objectArray [] = *(Memory_Block_List.begin());
151954 0 : if (SgMemberFunctionSymbol::pools.empty() == false)
151955 : {
151956 : // Generate an array of memory pools
151957 0 : SgMemberFunctionSymbol** objectArray = (SgMemberFunctionSymbol**) &(SgMemberFunctionSymbol::pools[0]);
151958 :
151959 : // Build a local variable for better performance
151960 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
151961 :
151962 : // Iterate over the memory pools
151963 0 : bool done = false;
151964 0 : unsigned i=0;
151965 :
151966 : // find the first valid IR node, call visit function, and then leave
151967 0 : while ( done == false && i < SgMemberFunctionSymbol::pools.size() )
151968 : {
151969 : // objectArray[i] is a single memory pool
151970 : unsigned j=0;
151971 0 : while (done == false && j < SgMemberFunctionSymbol::pool_size)
151972 : {
151973 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
151974 : {
151975 0 : traversal.visit(&(objectArray[i][j]));
151976 0 : done = true;
151977 : }
151978 0 : j++;
151979 : }
151980 0 : i++;
151981 : }
151982 :
151983 : #if 0
151984 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
151985 : if (done == false)
151986 : {
151987 : printf ("No representative for SgMemberFunctionSymbol found in memory pools \n");
151988 : }
151989 : #endif
151990 : }
151991 0 : }
151992 :
151993 :
151994 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
151995 : // using values that overflow signed values of int.
151996 : size_t
151997 4 : SgMemberFunctionSymbol::numberOfNodes()
151998 : {
151999 : // This function traverses the memory pool for an IR node and
152000 : // counts the number of IR nodes of a particular Sage III IR
152001 : // nodes type.
152002 :
152003 4 : size_t count = 0;
152004 4 : if (SgMemberFunctionSymbol::pools.empty() == false)
152005 : {
152006 : // Generate an array of memory pools (this is actually a STL vector,
152007 : // but it is contiguious, so OK to treat this way).
152008 1 : SgMemberFunctionSymbol** objectArray = (SgMemberFunctionSymbol**) &(SgMemberFunctionSymbol::pools[0]);
152009 :
152010 : // Build a local variable for better performance (make it a loop invariant variable).
152011 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
152012 :
152013 : // Iterate over all of the memory pools for this IR node.
152014 2 : for (unsigned int i=0; i < SgMemberFunctionSymbol::pools.size(); i++)
152015 : {
152016 : // objectArray[i] is a single memory pool, iterate over all the
152017 : // IR nodes and only count those that are valid IR nodes used in
152018 : // the AST (i.e. allocated IR nodes).
152019 2001 : for (unsigned j=0; j < SgMemberFunctionSymbol::pool_size; j++)
152020 : {
152021 : // This is indexing the STL vector of C/C++ style arrays as a doubly
152022 : // indexed array access. It is OK since we have leveraged the semantics
152023 : // of STL vector memory as contigous and cast the memory as an array
152024 : // of arrays to use the 2D array indexing. Hope this is not confusing,
152025 : // but it s very fast as an implementation.
152026 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
152027 : {
152028 1953 : count++;
152029 : }
152030 : }
152031 : }
152032 : }
152033 :
152034 :
152035 :
152036 4 : return count;
152037 : }
152038 :
152039 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
152040 : // using values that overflow signed values of int.
152041 : size_t
152042 0 : SgMemberFunctionSymbol::memoryUsage()
152043 : {
152044 : // This function is required because we need the class name as a type when we call sizeof
152045 : // There might be another way to implement this if we have a traversal that only called a
152046 : // representative object (one call for each type of Sage IIIIR node).
152047 0 : size_t memory = numberOfNodes() * sizeof(SgMemberFunctionSymbol);
152048 :
152049 0 : return memory;
152050 : }
152051 :
152052 : /* #line 152053 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
152053 :
152054 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
152055 : void
152056 5342 : SgTemplateMemberFunctionSymbol::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
152057 : {
152058 : // This function traverses the memory pool for only a specific IR node
152059 : // and calls the visit function of the input class execute a traversal
152060 : // similar to the style of the attribute based traversals within ROSE.
152061 : // This traversal will visit ALL nodes of the AST where as the other
152062 : // attribute based traversals visit only the embedded tree within the AST.
152063 :
152064 : // Initialize array to the address of the first element of the STL vector
152065 : // (which is guaranteed to be contiguous storage).
152066 : // SgTemplateMemberFunctionSymbol objectArray [] = *(Memory_Block_List.begin());
152067 5342 : if (SgTemplateMemberFunctionSymbol::pools.empty() == false)
152068 : {
152069 : // Generate an array of memory pools
152070 145 : SgTemplateMemberFunctionSymbol** objectArray = (SgTemplateMemberFunctionSymbol**) &(SgTemplateMemberFunctionSymbol::pools[0]);
152071 :
152072 : // Build a local variable for better performance
152073 145 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
152074 : #if 0
152075 : // Iterate over the memory pools
152076 : for (unsigned int i=0; i < SgTemplateMemberFunctionSymbol::pools.size(); i++)
152077 : {
152078 : // objectArray[i] is a single memory pool
152079 : for (int j=0; j < SgTemplateMemberFunctionSymbol::pool_size; j++)
152080 : {
152081 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
152082 : {
152083 : traversal.visit(&(objectArray[i][j]));
152084 : }
152085 : }
152086 : }
152087 : #else
152088 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
152089 : // compute the list first and then call the visit function on each list element.
152090 :
152091 : // printf ("Inside of SgTemplateMemberFunctionSymbol::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
152092 :
152093 290 : std::vector<SgTemplateMemberFunctionSymbol*> nodeList;
152094 :
152095 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
152096 290 : for (unsigned int i=0; i < SgTemplateMemberFunctionSymbol::pools.size(); i++)
152097 : {
152098 : // objectArray[i] is a single memory pool
152099 290145 : for (unsigned j=0; j < SgTemplateMemberFunctionSymbol::pool_size; j++)
152100 : {
152101 290000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
152102 : {
152103 136422 : nodeList.push_back(&(objectArray[i][j]));
152104 : }
152105 : }
152106 : }
152107 :
152108 : // Iterate over the saved list
152109 145 : size_t nodeListSize = nodeList.size();
152110 136567 : for (size_t i=0; i < nodeListSize; i++)
152111 : {
152112 136422 : ROSE_ASSERT(nodeList[i] != NULL);
152113 : #if 0
152114 : traversal.visit(nodeList[i]);
152115 : #else
152116 136422 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
152117 : {
152118 136422 : traversal.visit(nodeList[i]);
152119 : }
152120 : #endif
152121 : }
152122 : #endif
152123 : }
152124 :
152125 : // This should not be required since all previously static data members are
152126 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
152127 :
152128 5342 : }
152129 :
152130 :
152131 : void
152132 194 : SgTemplateMemberFunctionSymbol::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
152133 : {
152134 : // This function traverses the memory pool for an IR node and
152135 : // calls the function to execute the visitor object.
152136 :
152137 : // Initialize array to the address of the first element of the STL vector
152138 : // (which is guarenteed to be contiguous storage).
152139 : // SgTemplateMemberFunctionSymbol objectArray [] = *(Memory_Block_List.begin());
152140 194 : if (SgTemplateMemberFunctionSymbol::pools.empty() == false)
152141 : {
152142 : // Generate an array of memory pools
152143 137 : SgTemplateMemberFunctionSymbol** objectArray = (SgTemplateMemberFunctionSymbol**) &(SgTemplateMemberFunctionSymbol::pools[0]);
152144 :
152145 : // Build a local variable for better performance
152146 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
152147 :
152148 : // Iterate over the memory pools
152149 274 : for (unsigned int i=0; i < SgTemplateMemberFunctionSymbol::pools.size(); i++)
152150 : {
152151 : // objectArray[i] is a single memory pool
152152 274137 : for (unsigned j=0; j < SgTemplateMemberFunctionSymbol::pool_size; j++)
152153 : {
152154 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
152155 : {
152156 : // printf ("Found a valid SgTemplateMemberFunctionSymbol object in the memory pool %d at position %d \n",i,j);
152157 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
152158 148443 : objectArray[i][j].executeVisitorMemberFunction(visitor);
152159 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
152160 : }
152161 : else
152162 : {
152163 : // printf ("Found a INVALID SgTemplateMemberFunctionSymbol object in the memory pool \n");
152164 : }
152165 : }
152166 : }
152167 : }
152168 :
152169 : // This should not be required since all previously static data members are
152170 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
152171 :
152172 194 : }
152173 :
152174 : void
152175 0 : SgTemplateMemberFunctionSymbol::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
152176 : {
152177 : // This function visits only a single IR node of the memory pool.
152178 : // it is typically called once for each type of IR node within
152179 : // the automatically generated function: traverseRepresentativeNodes().
152180 :
152181 : // Initialize array to the address of the first element of the STL vector
152182 : // (which is guarenteed to be contiguous storage).
152183 : // SgTemplateMemberFunctionSymbol objectArray [] = *(Memory_Block_List.begin());
152184 0 : if (SgTemplateMemberFunctionSymbol::pools.empty() == false)
152185 : {
152186 : // Generate an array of memory pools
152187 0 : SgTemplateMemberFunctionSymbol** objectArray = (SgTemplateMemberFunctionSymbol**) &(SgTemplateMemberFunctionSymbol::pools[0]);
152188 :
152189 : // Build a local variable for better performance
152190 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
152191 :
152192 : // Iterate over the memory pools
152193 0 : bool done = false;
152194 0 : unsigned i=0;
152195 :
152196 : // find the first valid IR node, call visit function, and then leave
152197 0 : while ( done == false && i < SgTemplateMemberFunctionSymbol::pools.size() )
152198 : {
152199 : // objectArray[i] is a single memory pool
152200 : unsigned j=0;
152201 0 : while (done == false && j < SgTemplateMemberFunctionSymbol::pool_size)
152202 : {
152203 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
152204 : {
152205 0 : traversal.visit(&(objectArray[i][j]));
152206 0 : done = true;
152207 : }
152208 0 : j++;
152209 : }
152210 0 : i++;
152211 : }
152212 :
152213 : #if 0
152214 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
152215 : if (done == false)
152216 : {
152217 : printf ("No representative for SgTemplateMemberFunctionSymbol found in memory pools \n");
152218 : }
152219 : #endif
152220 : }
152221 0 : }
152222 :
152223 :
152224 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
152225 : // using values that overflow signed values of int.
152226 : size_t
152227 4 : SgTemplateMemberFunctionSymbol::numberOfNodes()
152228 : {
152229 : // This function traverses the memory pool for an IR node and
152230 : // counts the number of IR nodes of a particular Sage III IR
152231 : // nodes type.
152232 :
152233 4 : size_t count = 0;
152234 4 : if (SgTemplateMemberFunctionSymbol::pools.empty() == false)
152235 : {
152236 : // Generate an array of memory pools (this is actually a STL vector,
152237 : // but it is contiguious, so OK to treat this way).
152238 1 : SgTemplateMemberFunctionSymbol** objectArray = (SgTemplateMemberFunctionSymbol**) &(SgTemplateMemberFunctionSymbol::pools[0]);
152239 :
152240 : // Build a local variable for better performance (make it a loop invariant variable).
152241 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
152242 :
152243 : // Iterate over all of the memory pools for this IR node.
152244 2 : for (unsigned int i=0; i < SgTemplateMemberFunctionSymbol::pools.size(); i++)
152245 : {
152246 : // objectArray[i] is a single memory pool, iterate over all the
152247 : // IR nodes and only count those that are valid IR nodes used in
152248 : // the AST (i.e. allocated IR nodes).
152249 2001 : for (unsigned j=0; j < SgTemplateMemberFunctionSymbol::pool_size; j++)
152250 : {
152251 : // This is indexing the STL vector of C/C++ style arrays as a doubly
152252 : // indexed array access. It is OK since we have leveraged the semantics
152253 : // of STL vector memory as contigous and cast the memory as an array
152254 : // of arrays to use the 2D array indexing. Hope this is not confusing,
152255 : // but it s very fast as an implementation.
152256 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
152257 : {
152258 1047 : count++;
152259 : }
152260 : }
152261 : }
152262 : }
152263 :
152264 :
152265 :
152266 4 : return count;
152267 : }
152268 :
152269 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
152270 : // using values that overflow signed values of int.
152271 : size_t
152272 0 : SgTemplateMemberFunctionSymbol::memoryUsage()
152273 : {
152274 : // This function is required because we need the class name as a type when we call sizeof
152275 : // There might be another way to implement this if we have a traversal that only called a
152276 : // representative object (one call for each type of Sage IIIIR node).
152277 0 : size_t memory = numberOfNodes() * sizeof(SgTemplateMemberFunctionSymbol);
152278 :
152279 0 : return memory;
152280 : }
152281 :
152282 : /* #line 152283 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
152283 :
152284 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
152285 : void
152286 5342 : SgTemplateFunctionSymbol::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
152287 : {
152288 : // This function traverses the memory pool for only a specific IR node
152289 : // and calls the visit function of the input class execute a traversal
152290 : // similar to the style of the attribute based traversals within ROSE.
152291 : // This traversal will visit ALL nodes of the AST where as the other
152292 : // attribute based traversals visit only the embedded tree within the AST.
152293 :
152294 : // Initialize array to the address of the first element of the STL vector
152295 : // (which is guaranteed to be contiguous storage).
152296 : // SgTemplateFunctionSymbol objectArray [] = *(Memory_Block_List.begin());
152297 5342 : if (SgTemplateFunctionSymbol::pools.empty() == false)
152298 : {
152299 : // Generate an array of memory pools
152300 138 : SgTemplateFunctionSymbol** objectArray = (SgTemplateFunctionSymbol**) &(SgTemplateFunctionSymbol::pools[0]);
152301 :
152302 : // Build a local variable for better performance
152303 138 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
152304 : #if 0
152305 : // Iterate over the memory pools
152306 : for (unsigned int i=0; i < SgTemplateFunctionSymbol::pools.size(); i++)
152307 : {
152308 : // objectArray[i] is a single memory pool
152309 : for (int j=0; j < SgTemplateFunctionSymbol::pool_size; j++)
152310 : {
152311 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
152312 : {
152313 : traversal.visit(&(objectArray[i][j]));
152314 : }
152315 : }
152316 : }
152317 : #else
152318 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
152319 : // compute the list first and then call the visit function on each list element.
152320 :
152321 : // printf ("Inside of SgTemplateFunctionSymbol::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
152322 :
152323 276 : std::vector<SgTemplateFunctionSymbol*> nodeList;
152324 :
152325 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
152326 276 : for (unsigned int i=0; i < SgTemplateFunctionSymbol::pools.size(); i++)
152327 : {
152328 : // objectArray[i] is a single memory pool
152329 276138 : for (unsigned j=0; j < SgTemplateFunctionSymbol::pool_size; j++)
152330 : {
152331 276000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
152332 : {
152333 47067 : nodeList.push_back(&(objectArray[i][j]));
152334 : }
152335 : }
152336 : }
152337 :
152338 : // Iterate over the saved list
152339 138 : size_t nodeListSize = nodeList.size();
152340 47205 : for (size_t i=0; i < nodeListSize; i++)
152341 : {
152342 47067 : ROSE_ASSERT(nodeList[i] != NULL);
152343 : #if 0
152344 : traversal.visit(nodeList[i]);
152345 : #else
152346 47067 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
152347 : {
152348 47067 : traversal.visit(nodeList[i]);
152349 : }
152350 : #endif
152351 : }
152352 : #endif
152353 : }
152354 :
152355 : // This should not be required since all previously static data members are
152356 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
152357 :
152358 5342 : }
152359 :
152360 :
152361 : void
152362 194 : SgTemplateFunctionSymbol::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
152363 : {
152364 : // This function traverses the memory pool for an IR node and
152365 : // calls the function to execute the visitor object.
152366 :
152367 : // Initialize array to the address of the first element of the STL vector
152368 : // (which is guarenteed to be contiguous storage).
152369 : // SgTemplateFunctionSymbol objectArray [] = *(Memory_Block_List.begin());
152370 194 : if (SgTemplateFunctionSymbol::pools.empty() == false)
152371 : {
152372 : // Generate an array of memory pools
152373 137 : SgTemplateFunctionSymbol** objectArray = (SgTemplateFunctionSymbol**) &(SgTemplateFunctionSymbol::pools[0]);
152374 :
152375 : // Build a local variable for better performance
152376 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
152377 :
152378 : // Iterate over the memory pools
152379 274 : for (unsigned int i=0; i < SgTemplateFunctionSymbol::pools.size(); i++)
152380 : {
152381 : // objectArray[i] is a single memory pool
152382 274137 : for (unsigned j=0; j < SgTemplateFunctionSymbol::pool_size; j++)
152383 : {
152384 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
152385 : {
152386 : // printf ("Found a valid SgTemplateFunctionSymbol object in the memory pool %d at position %d \n",i,j);
152387 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
152388 47426 : objectArray[i][j].executeVisitorMemberFunction(visitor);
152389 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
152390 : }
152391 : else
152392 : {
152393 : // printf ("Found a INVALID SgTemplateFunctionSymbol object in the memory pool \n");
152394 : }
152395 : }
152396 : }
152397 : }
152398 :
152399 : // This should not be required since all previously static data members are
152400 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
152401 :
152402 194 : }
152403 :
152404 : void
152405 0 : SgTemplateFunctionSymbol::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
152406 : {
152407 : // This function visits only a single IR node of the memory pool.
152408 : // it is typically called once for each type of IR node within
152409 : // the automatically generated function: traverseRepresentativeNodes().
152410 :
152411 : // Initialize array to the address of the first element of the STL vector
152412 : // (which is guarenteed to be contiguous storage).
152413 : // SgTemplateFunctionSymbol objectArray [] = *(Memory_Block_List.begin());
152414 0 : if (SgTemplateFunctionSymbol::pools.empty() == false)
152415 : {
152416 : // Generate an array of memory pools
152417 0 : SgTemplateFunctionSymbol** objectArray = (SgTemplateFunctionSymbol**) &(SgTemplateFunctionSymbol::pools[0]);
152418 :
152419 : // Build a local variable for better performance
152420 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
152421 :
152422 : // Iterate over the memory pools
152423 0 : bool done = false;
152424 0 : unsigned i=0;
152425 :
152426 : // find the first valid IR node, call visit function, and then leave
152427 0 : while ( done == false && i < SgTemplateFunctionSymbol::pools.size() )
152428 : {
152429 : // objectArray[i] is a single memory pool
152430 : unsigned j=0;
152431 0 : while (done == false && j < SgTemplateFunctionSymbol::pool_size)
152432 : {
152433 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
152434 : {
152435 0 : traversal.visit(&(objectArray[i][j]));
152436 0 : done = true;
152437 : }
152438 0 : j++;
152439 : }
152440 0 : i++;
152441 : }
152442 :
152443 : #if 0
152444 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
152445 : if (done == false)
152446 : {
152447 : printf ("No representative for SgTemplateFunctionSymbol found in memory pools \n");
152448 : }
152449 : #endif
152450 : }
152451 0 : }
152452 :
152453 :
152454 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
152455 : // using values that overflow signed values of int.
152456 : size_t
152457 4 : SgTemplateFunctionSymbol::numberOfNodes()
152458 : {
152459 : // This function traverses the memory pool for an IR node and
152460 : // counts the number of IR nodes of a particular Sage III IR
152461 : // nodes type.
152462 :
152463 4 : size_t count = 0;
152464 4 : if (SgTemplateFunctionSymbol::pools.empty() == false)
152465 : {
152466 : // Generate an array of memory pools (this is actually a STL vector,
152467 : // but it is contiguious, so OK to treat this way).
152468 1 : SgTemplateFunctionSymbol** objectArray = (SgTemplateFunctionSymbol**) &(SgTemplateFunctionSymbol::pools[0]);
152469 :
152470 : // Build a local variable for better performance (make it a loop invariant variable).
152471 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
152472 :
152473 : // Iterate over all of the memory pools for this IR node.
152474 2 : for (unsigned int i=0; i < SgTemplateFunctionSymbol::pools.size(); i++)
152475 : {
152476 : // objectArray[i] is a single memory pool, iterate over all the
152477 : // IR nodes and only count those that are valid IR nodes used in
152478 : // the AST (i.e. allocated IR nodes).
152479 2001 : for (unsigned j=0; j < SgTemplateFunctionSymbol::pool_size; j++)
152480 : {
152481 : // This is indexing the STL vector of C/C++ style arrays as a doubly
152482 : // indexed array access. It is OK since we have leveraged the semantics
152483 : // of STL vector memory as contigous and cast the memory as an array
152484 : // of arrays to use the 2D array indexing. Hope this is not confusing,
152485 : // but it s very fast as an implementation.
152486 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
152487 : {
152488 340 : count++;
152489 : }
152490 : }
152491 : }
152492 : }
152493 :
152494 :
152495 :
152496 4 : return count;
152497 : }
152498 :
152499 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
152500 : // using values that overflow signed values of int.
152501 : size_t
152502 0 : SgTemplateFunctionSymbol::memoryUsage()
152503 : {
152504 : // This function is required because we need the class name as a type when we call sizeof
152505 : // There might be another way to implement this if we have a traversal that only called a
152506 : // representative object (one call for each type of Sage IIIIR node).
152507 0 : size_t memory = numberOfNodes() * sizeof(SgTemplateFunctionSymbol);
152508 :
152509 0 : return memory;
152510 : }
152511 :
152512 : /* #line 152513 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
152513 :
152514 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
152515 : void
152516 5342 : SgRenameSymbol::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
152517 : {
152518 : // This function traverses the memory pool for only a specific IR node
152519 : // and calls the visit function of the input class execute a traversal
152520 : // similar to the style of the attribute based traversals within ROSE.
152521 : // This traversal will visit ALL nodes of the AST where as the other
152522 : // attribute based traversals visit only the embedded tree within the AST.
152523 :
152524 : // Initialize array to the address of the first element of the STL vector
152525 : // (which is guaranteed to be contiguous storage).
152526 : // SgRenameSymbol objectArray [] = *(Memory_Block_List.begin());
152527 5342 : if (SgRenameSymbol::pools.empty() == false)
152528 : {
152529 : // Generate an array of memory pools
152530 0 : SgRenameSymbol** objectArray = (SgRenameSymbol**) &(SgRenameSymbol::pools[0]);
152531 :
152532 : // Build a local variable for better performance
152533 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
152534 : #if 0
152535 : // Iterate over the memory pools
152536 : for (unsigned int i=0; i < SgRenameSymbol::pools.size(); i++)
152537 : {
152538 : // objectArray[i] is a single memory pool
152539 : for (int j=0; j < SgRenameSymbol::pool_size; j++)
152540 : {
152541 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
152542 : {
152543 : traversal.visit(&(objectArray[i][j]));
152544 : }
152545 : }
152546 : }
152547 : #else
152548 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
152549 : // compute the list first and then call the visit function on each list element.
152550 :
152551 : // printf ("Inside of SgRenameSymbol::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
152552 :
152553 0 : std::vector<SgRenameSymbol*> nodeList;
152554 :
152555 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
152556 0 : for (unsigned int i=0; i < SgRenameSymbol::pools.size(); i++)
152557 : {
152558 : // objectArray[i] is a single memory pool
152559 0 : for (unsigned j=0; j < SgRenameSymbol::pool_size; j++)
152560 : {
152561 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
152562 : {
152563 0 : nodeList.push_back(&(objectArray[i][j]));
152564 : }
152565 : }
152566 : }
152567 :
152568 : // Iterate over the saved list
152569 0 : size_t nodeListSize = nodeList.size();
152570 0 : for (size_t i=0; i < nodeListSize; i++)
152571 : {
152572 0 : ROSE_ASSERT(nodeList[i] != NULL);
152573 : #if 0
152574 : traversal.visit(nodeList[i]);
152575 : #else
152576 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
152577 : {
152578 0 : traversal.visit(nodeList[i]);
152579 : }
152580 : #endif
152581 : }
152582 : #endif
152583 : }
152584 :
152585 : // This should not be required since all previously static data members are
152586 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
152587 :
152588 5342 : }
152589 :
152590 :
152591 : void
152592 194 : SgRenameSymbol::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
152593 : {
152594 : // This function traverses the memory pool for an IR node and
152595 : // calls the function to execute the visitor object.
152596 :
152597 : // Initialize array to the address of the first element of the STL vector
152598 : // (which is guarenteed to be contiguous storage).
152599 : // SgRenameSymbol objectArray [] = *(Memory_Block_List.begin());
152600 194 : if (SgRenameSymbol::pools.empty() == false)
152601 : {
152602 : // Generate an array of memory pools
152603 0 : SgRenameSymbol** objectArray = (SgRenameSymbol**) &(SgRenameSymbol::pools[0]);
152604 :
152605 : // Build a local variable for better performance
152606 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
152607 :
152608 : // Iterate over the memory pools
152609 0 : for (unsigned int i=0; i < SgRenameSymbol::pools.size(); i++)
152610 : {
152611 : // objectArray[i] is a single memory pool
152612 0 : for (unsigned j=0; j < SgRenameSymbol::pool_size; j++)
152613 : {
152614 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
152615 : {
152616 : // printf ("Found a valid SgRenameSymbol object in the memory pool %d at position %d \n",i,j);
152617 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
152618 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
152619 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
152620 : }
152621 : else
152622 : {
152623 : // printf ("Found a INVALID SgRenameSymbol object in the memory pool \n");
152624 : }
152625 : }
152626 : }
152627 : }
152628 :
152629 : // This should not be required since all previously static data members are
152630 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
152631 :
152632 194 : }
152633 :
152634 : void
152635 0 : SgRenameSymbol::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
152636 : {
152637 : // This function visits only a single IR node of the memory pool.
152638 : // it is typically called once for each type of IR node within
152639 : // the automatically generated function: traverseRepresentativeNodes().
152640 :
152641 : // Initialize array to the address of the first element of the STL vector
152642 : // (which is guarenteed to be contiguous storage).
152643 : // SgRenameSymbol objectArray [] = *(Memory_Block_List.begin());
152644 0 : if (SgRenameSymbol::pools.empty() == false)
152645 : {
152646 : // Generate an array of memory pools
152647 0 : SgRenameSymbol** objectArray = (SgRenameSymbol**) &(SgRenameSymbol::pools[0]);
152648 :
152649 : // Build a local variable for better performance
152650 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
152651 :
152652 : // Iterate over the memory pools
152653 0 : bool done = false;
152654 0 : unsigned i=0;
152655 :
152656 : // find the first valid IR node, call visit function, and then leave
152657 0 : while ( done == false && i < SgRenameSymbol::pools.size() )
152658 : {
152659 : // objectArray[i] is a single memory pool
152660 : unsigned j=0;
152661 0 : while (done == false && j < SgRenameSymbol::pool_size)
152662 : {
152663 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
152664 : {
152665 0 : traversal.visit(&(objectArray[i][j]));
152666 0 : done = true;
152667 : }
152668 0 : j++;
152669 : }
152670 0 : i++;
152671 : }
152672 :
152673 : #if 0
152674 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
152675 : if (done == false)
152676 : {
152677 : printf ("No representative for SgRenameSymbol found in memory pools \n");
152678 : }
152679 : #endif
152680 : }
152681 0 : }
152682 :
152683 :
152684 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
152685 : // using values that overflow signed values of int.
152686 : size_t
152687 4 : SgRenameSymbol::numberOfNodes()
152688 : {
152689 : // This function traverses the memory pool for an IR node and
152690 : // counts the number of IR nodes of a particular Sage III IR
152691 : // nodes type.
152692 :
152693 4 : size_t count = 0;
152694 4 : if (SgRenameSymbol::pools.empty() == false)
152695 : {
152696 : // Generate an array of memory pools (this is actually a STL vector,
152697 : // but it is contiguious, so OK to treat this way).
152698 0 : SgRenameSymbol** objectArray = (SgRenameSymbol**) &(SgRenameSymbol::pools[0]);
152699 :
152700 : // Build a local variable for better performance (make it a loop invariant variable).
152701 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
152702 :
152703 : // Iterate over all of the memory pools for this IR node.
152704 0 : for (unsigned int i=0; i < SgRenameSymbol::pools.size(); i++)
152705 : {
152706 : // objectArray[i] is a single memory pool, iterate over all the
152707 : // IR nodes and only count those that are valid IR nodes used in
152708 : // the AST (i.e. allocated IR nodes).
152709 0 : for (unsigned j=0; j < SgRenameSymbol::pool_size; j++)
152710 : {
152711 : // This is indexing the STL vector of C/C++ style arrays as a doubly
152712 : // indexed array access. It is OK since we have leveraged the semantics
152713 : // of STL vector memory as contigous and cast the memory as an array
152714 : // of arrays to use the 2D array indexing. Hope this is not confusing,
152715 : // but it s very fast as an implementation.
152716 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
152717 : {
152718 0 : count++;
152719 : }
152720 : }
152721 : }
152722 : }
152723 :
152724 :
152725 :
152726 4 : return count;
152727 : }
152728 :
152729 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
152730 : // using values that overflow signed values of int.
152731 : size_t
152732 0 : SgRenameSymbol::memoryUsage()
152733 : {
152734 : // This function is required because we need the class name as a type when we call sizeof
152735 : // There might be another way to implement this if we have a traversal that only called a
152736 : // representative object (one call for each type of Sage IIIIR node).
152737 0 : size_t memory = numberOfNodes() * sizeof(SgRenameSymbol);
152738 :
152739 0 : return memory;
152740 : }
152741 :
152742 : /* #line 152743 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
152743 :
152744 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
152745 : void
152746 5342 : SgFunctionTypeSymbol::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
152747 : {
152748 : // This function traverses the memory pool for only a specific IR node
152749 : // and calls the visit function of the input class execute a traversal
152750 : // similar to the style of the attribute based traversals within ROSE.
152751 : // This traversal will visit ALL nodes of the AST where as the other
152752 : // attribute based traversals visit only the embedded tree within the AST.
152753 :
152754 : // Initialize array to the address of the first element of the STL vector
152755 : // (which is guaranteed to be contiguous storage).
152756 : // SgFunctionTypeSymbol objectArray [] = *(Memory_Block_List.begin());
152757 5342 : if (SgFunctionTypeSymbol::pools.empty() == false)
152758 : {
152759 : // Generate an array of memory pools
152760 5303 : SgFunctionTypeSymbol** objectArray = (SgFunctionTypeSymbol**) &(SgFunctionTypeSymbol::pools[0]);
152761 :
152762 : // Build a local variable for better performance
152763 5303 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
152764 : #if 0
152765 : // Iterate over the memory pools
152766 : for (unsigned int i=0; i < SgFunctionTypeSymbol::pools.size(); i++)
152767 : {
152768 : // objectArray[i] is a single memory pool
152769 : for (int j=0; j < SgFunctionTypeSymbol::pool_size; j++)
152770 : {
152771 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
152772 : {
152773 : traversal.visit(&(objectArray[i][j]));
152774 : }
152775 : }
152776 : }
152777 : #else
152778 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
152779 : // compute the list first and then call the visit function on each list element.
152780 :
152781 : // printf ("Inside of SgFunctionTypeSymbol::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
152782 :
152783 10606 : std::vector<SgFunctionTypeSymbol*> nodeList;
152784 :
152785 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
152786 11112 : for (unsigned int i=0; i < SgFunctionTypeSymbol::pools.size(); i++)
152787 : {
152788 : // objectArray[i] is a single memory pool
152789 11623800 : for (unsigned j=0; j < SgFunctionTypeSymbol::pool_size; j++)
152790 : {
152791 11618000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
152792 : {
152793 5153760 : nodeList.push_back(&(objectArray[i][j]));
152794 : }
152795 : }
152796 : }
152797 :
152798 : // Iterate over the saved list
152799 5303 : size_t nodeListSize = nodeList.size();
152800 5159070 : for (size_t i=0; i < nodeListSize; i++)
152801 : {
152802 5153760 : ROSE_ASSERT(nodeList[i] != NULL);
152803 : #if 0
152804 : traversal.visit(nodeList[i]);
152805 : #else
152806 5153760 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
152807 : {
152808 5153760 : traversal.visit(nodeList[i]);
152809 : }
152810 : #endif
152811 : }
152812 : #endif
152813 : }
152814 :
152815 : // This should not be required since all previously static data members are
152816 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
152817 :
152818 5342 : }
152819 :
152820 :
152821 : void
152822 194 : SgFunctionTypeSymbol::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
152823 : {
152824 : // This function traverses the memory pool for an IR node and
152825 : // calls the function to execute the visitor object.
152826 :
152827 : // Initialize array to the address of the first element of the STL vector
152828 : // (which is guarenteed to be contiguous storage).
152829 : // SgFunctionTypeSymbol objectArray [] = *(Memory_Block_List.begin());
152830 194 : if (SgFunctionTypeSymbol::pools.empty() == false)
152831 : {
152832 : // Generate an array of memory pools
152833 194 : SgFunctionTypeSymbol** objectArray = (SgFunctionTypeSymbol**) &(SgFunctionTypeSymbol::pools[0]);
152834 :
152835 : // Build a local variable for better performance
152836 194 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
152837 :
152838 : // Iterate over the memory pools
152839 936 : for (unsigned int i=0; i < SgFunctionTypeSymbol::pools.size(); i++)
152840 : {
152841 : // objectArray[i] is a single memory pool
152842 1484740 : for (unsigned j=0; j < SgFunctionTypeSymbol::pool_size; j++)
152843 : {
152844 1484000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
152845 : {
152846 : // printf ("Found a valid SgFunctionTypeSymbol object in the memory pool %d at position %d \n",i,j);
152847 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
152848 1199240 : objectArray[i][j].executeVisitorMemberFunction(visitor);
152849 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
152850 : }
152851 : else
152852 : {
152853 : // printf ("Found a INVALID SgFunctionTypeSymbol object in the memory pool \n");
152854 : }
152855 : }
152856 : }
152857 : }
152858 :
152859 : // This should not be required since all previously static data members are
152860 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
152861 :
152862 194 : }
152863 :
152864 : void
152865 0 : SgFunctionTypeSymbol::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
152866 : {
152867 : // This function visits only a single IR node of the memory pool.
152868 : // it is typically called once for each type of IR node within
152869 : // the automatically generated function: traverseRepresentativeNodes().
152870 :
152871 : // Initialize array to the address of the first element of the STL vector
152872 : // (which is guarenteed to be contiguous storage).
152873 : // SgFunctionTypeSymbol objectArray [] = *(Memory_Block_List.begin());
152874 0 : if (SgFunctionTypeSymbol::pools.empty() == false)
152875 : {
152876 : // Generate an array of memory pools
152877 0 : SgFunctionTypeSymbol** objectArray = (SgFunctionTypeSymbol**) &(SgFunctionTypeSymbol::pools[0]);
152878 :
152879 : // Build a local variable for better performance
152880 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
152881 :
152882 : // Iterate over the memory pools
152883 0 : bool done = false;
152884 0 : unsigned i=0;
152885 :
152886 : // find the first valid IR node, call visit function, and then leave
152887 0 : while ( done == false && i < SgFunctionTypeSymbol::pools.size() )
152888 : {
152889 : // objectArray[i] is a single memory pool
152890 : unsigned j=0;
152891 0 : while (done == false && j < SgFunctionTypeSymbol::pool_size)
152892 : {
152893 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
152894 : {
152895 0 : traversal.visit(&(objectArray[i][j]));
152896 0 : done = true;
152897 : }
152898 0 : j++;
152899 : }
152900 0 : i++;
152901 : }
152902 :
152903 : #if 0
152904 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
152905 : if (done == false)
152906 : {
152907 : printf ("No representative for SgFunctionTypeSymbol found in memory pools \n");
152908 : }
152909 : #endif
152910 : }
152911 0 : }
152912 :
152913 :
152914 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
152915 : // using values that overflow signed values of int.
152916 : size_t
152917 4 : SgFunctionTypeSymbol::numberOfNodes()
152918 : {
152919 : // This function traverses the memory pool for an IR node and
152920 : // counts the number of IR nodes of a particular Sage III IR
152921 : // nodes type.
152922 :
152923 4 : size_t count = 0;
152924 4 : if (SgFunctionTypeSymbol::pools.empty() == false)
152925 : {
152926 : // Generate an array of memory pools (this is actually a STL vector,
152927 : // but it is contiguious, so OK to treat this way).
152928 4 : SgFunctionTypeSymbol** objectArray = (SgFunctionTypeSymbol**) &(SgFunctionTypeSymbol::pools[0]);
152929 :
152930 : // Build a local variable for better performance (make it a loop invariant variable).
152931 4 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
152932 :
152933 : // Iterate over all of the memory pools for this IR node.
152934 12 : for (unsigned int i=0; i < SgFunctionTypeSymbol::pools.size(); i++)
152935 : {
152936 : // objectArray[i] is a single memory pool, iterate over all the
152937 : // IR nodes and only count those that are valid IR nodes used in
152938 : // the AST (i.e. allocated IR nodes).
152939 16008 : for (unsigned j=0; j < SgFunctionTypeSymbol::pool_size; j++)
152940 : {
152941 : // This is indexing the STL vector of C/C++ style arrays as a doubly
152942 : // indexed array access. It is OK since we have leveraged the semantics
152943 : // of STL vector memory as contigous and cast the memory as an array
152944 : // of arrays to use the 2D array indexing. Hope this is not confusing,
152945 : // but it s very fast as an implementation.
152946 16000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
152947 : {
152948 9187 : count++;
152949 : }
152950 : }
152951 : }
152952 : }
152953 :
152954 :
152955 :
152956 4 : return count;
152957 : }
152958 :
152959 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
152960 : // using values that overflow signed values of int.
152961 : size_t
152962 0 : SgFunctionTypeSymbol::memoryUsage()
152963 : {
152964 : // This function is required because we need the class name as a type when we call sizeof
152965 : // There might be another way to implement this if we have a traversal that only called a
152966 : // representative object (one call for each type of Sage IIIIR node).
152967 0 : size_t memory = numberOfNodes() * sizeof(SgFunctionTypeSymbol);
152968 :
152969 0 : return memory;
152970 : }
152971 :
152972 : /* #line 152973 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
152973 :
152974 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
152975 : void
152976 5344 : SgClassSymbol::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
152977 : {
152978 : // This function traverses the memory pool for only a specific IR node
152979 : // and calls the visit function of the input class execute a traversal
152980 : // similar to the style of the attribute based traversals within ROSE.
152981 : // This traversal will visit ALL nodes of the AST where as the other
152982 : // attribute based traversals visit only the embedded tree within the AST.
152983 :
152984 : // Initialize array to the address of the first element of the STL vector
152985 : // (which is guaranteed to be contiguous storage).
152986 : // SgClassSymbol objectArray [] = *(Memory_Block_List.begin());
152987 5344 : if (SgClassSymbol::pools.empty() == false)
152988 : {
152989 : // Generate an array of memory pools
152990 3107 : SgClassSymbol** objectArray = (SgClassSymbol**) &(SgClassSymbol::pools[0]);
152991 :
152992 : // Build a local variable for better performance
152993 3107 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
152994 : #if 0
152995 : // Iterate over the memory pools
152996 : for (unsigned int i=0; i < SgClassSymbol::pools.size(); i++)
152997 : {
152998 : // objectArray[i] is a single memory pool
152999 : for (int j=0; j < SgClassSymbol::pool_size; j++)
153000 : {
153001 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
153002 : {
153003 : traversal.visit(&(objectArray[i][j]));
153004 : }
153005 : }
153006 : }
153007 : #else
153008 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
153009 : // compute the list first and then call the visit function on each list element.
153010 :
153011 : // printf ("Inside of SgClassSymbol::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
153012 :
153013 6214 : std::vector<SgClassSymbol*> nodeList;
153014 :
153015 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
153016 6214 : for (unsigned int i=0; i < SgClassSymbol::pools.size(); i++)
153017 : {
153018 : // objectArray[i] is a single memory pool
153019 6217110 : for (unsigned j=0; j < SgClassSymbol::pool_size; j++)
153020 : {
153021 6214000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
153022 : {
153023 196437 : nodeList.push_back(&(objectArray[i][j]));
153024 : }
153025 : }
153026 : }
153027 :
153028 : // Iterate over the saved list
153029 3107 : size_t nodeListSize = nodeList.size();
153030 199544 : for (size_t i=0; i < nodeListSize; i++)
153031 : {
153032 196437 : ROSE_ASSERT(nodeList[i] != NULL);
153033 : #if 0
153034 : traversal.visit(nodeList[i]);
153035 : #else
153036 196437 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
153037 : {
153038 196437 : traversal.visit(nodeList[i]);
153039 : }
153040 : #endif
153041 : }
153042 : #endif
153043 : }
153044 :
153045 : // This should not be required since all previously static data members are
153046 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
153047 :
153048 5344 : }
153049 :
153050 :
153051 : void
153052 194 : SgClassSymbol::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
153053 : {
153054 : // This function traverses the memory pool for an IR node and
153055 : // calls the function to execute the visitor object.
153056 :
153057 : // Initialize array to the address of the first element of the STL vector
153058 : // (which is guarenteed to be contiguous storage).
153059 : // SgClassSymbol objectArray [] = *(Memory_Block_List.begin());
153060 194 : if (SgClassSymbol::pools.empty() == false)
153061 : {
153062 : // Generate an array of memory pools
153063 137 : SgClassSymbol** objectArray = (SgClassSymbol**) &(SgClassSymbol::pools[0]);
153064 :
153065 : // Build a local variable for better performance
153066 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
153067 :
153068 : // Iterate over the memory pools
153069 274 : for (unsigned int i=0; i < SgClassSymbol::pools.size(); i++)
153070 : {
153071 : // objectArray[i] is a single memory pool
153072 274137 : for (unsigned j=0; j < SgClassSymbol::pool_size; j++)
153073 : {
153074 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
153075 : {
153076 : // printf ("Found a valid SgClassSymbol object in the memory pool %d at position %d \n",i,j);
153077 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
153078 116994 : objectArray[i][j].executeVisitorMemberFunction(visitor);
153079 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
153080 : }
153081 : else
153082 : {
153083 : // printf ("Found a INVALID SgClassSymbol object in the memory pool \n");
153084 : }
153085 : }
153086 : }
153087 : }
153088 :
153089 : // This should not be required since all previously static data members are
153090 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
153091 :
153092 194 : }
153093 :
153094 : void
153095 0 : SgClassSymbol::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
153096 : {
153097 : // This function visits only a single IR node of the memory pool.
153098 : // it is typically called once for each type of IR node within
153099 : // the automatically generated function: traverseRepresentativeNodes().
153100 :
153101 : // Initialize array to the address of the first element of the STL vector
153102 : // (which is guarenteed to be contiguous storage).
153103 : // SgClassSymbol objectArray [] = *(Memory_Block_List.begin());
153104 0 : if (SgClassSymbol::pools.empty() == false)
153105 : {
153106 : // Generate an array of memory pools
153107 0 : SgClassSymbol** objectArray = (SgClassSymbol**) &(SgClassSymbol::pools[0]);
153108 :
153109 : // Build a local variable for better performance
153110 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
153111 :
153112 : // Iterate over the memory pools
153113 0 : bool done = false;
153114 0 : unsigned i=0;
153115 :
153116 : // find the first valid IR node, call visit function, and then leave
153117 0 : while ( done == false && i < SgClassSymbol::pools.size() )
153118 : {
153119 : // objectArray[i] is a single memory pool
153120 : unsigned j=0;
153121 0 : while (done == false && j < SgClassSymbol::pool_size)
153122 : {
153123 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
153124 : {
153125 0 : traversal.visit(&(objectArray[i][j]));
153126 0 : done = true;
153127 : }
153128 0 : j++;
153129 : }
153130 0 : i++;
153131 : }
153132 :
153133 : #if 0
153134 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
153135 : if (done == false)
153136 : {
153137 : printf ("No representative for SgClassSymbol found in memory pools \n");
153138 : }
153139 : #endif
153140 : }
153141 0 : }
153142 :
153143 :
153144 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
153145 : // using values that overflow signed values of int.
153146 : size_t
153147 4 : SgClassSymbol::numberOfNodes()
153148 : {
153149 : // This function traverses the memory pool for an IR node and
153150 : // counts the number of IR nodes of a particular Sage III IR
153151 : // nodes type.
153152 :
153153 4 : size_t count = 0;
153154 4 : if (SgClassSymbol::pools.empty() == false)
153155 : {
153156 : // Generate an array of memory pools (this is actually a STL vector,
153157 : // but it is contiguious, so OK to treat this way).
153158 2 : SgClassSymbol** objectArray = (SgClassSymbol**) &(SgClassSymbol::pools[0]);
153159 :
153160 : // Build a local variable for better performance (make it a loop invariant variable).
153161 2 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
153162 :
153163 : // Iterate over all of the memory pools for this IR node.
153164 4 : for (unsigned int i=0; i < SgClassSymbol::pools.size(); i++)
153165 : {
153166 : // objectArray[i] is a single memory pool, iterate over all the
153167 : // IR nodes and only count those that are valid IR nodes used in
153168 : // the AST (i.e. allocated IR nodes).
153169 4002 : for (unsigned j=0; j < SgClassSymbol::pool_size; j++)
153170 : {
153171 : // This is indexing the STL vector of C/C++ style arrays as a doubly
153172 : // indexed array access. It is OK since we have leveraged the semantics
153173 : // of STL vector memory as contigous and cast the memory as an array
153174 : // of arrays to use the 2D array indexing. Hope this is not confusing,
153175 : // but it s very fast as an implementation.
153176 4000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
153177 : {
153178 852 : count++;
153179 : }
153180 : }
153181 : }
153182 : }
153183 :
153184 :
153185 :
153186 4 : return count;
153187 : }
153188 :
153189 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
153190 : // using values that overflow signed values of int.
153191 : size_t
153192 0 : SgClassSymbol::memoryUsage()
153193 : {
153194 : // This function is required because we need the class name as a type when we call sizeof
153195 : // There might be another way to implement this if we have a traversal that only called a
153196 : // representative object (one call for each type of Sage IIIIR node).
153197 0 : size_t memory = numberOfNodes() * sizeof(SgClassSymbol);
153198 :
153199 0 : return memory;
153200 : }
153201 :
153202 : /* #line 153203 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
153203 :
153204 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
153205 : void
153206 5342 : SgTemplateClassSymbol::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
153207 : {
153208 : // This function traverses the memory pool for only a specific IR node
153209 : // and calls the visit function of the input class execute a traversal
153210 : // similar to the style of the attribute based traversals within ROSE.
153211 : // This traversal will visit ALL nodes of the AST where as the other
153212 : // attribute based traversals visit only the embedded tree within the AST.
153213 :
153214 : // Initialize array to the address of the first element of the STL vector
153215 : // (which is guaranteed to be contiguous storage).
153216 : // SgTemplateClassSymbol objectArray [] = *(Memory_Block_List.begin());
153217 5342 : if (SgTemplateClassSymbol::pools.empty() == false)
153218 : {
153219 : // Generate an array of memory pools
153220 145 : SgTemplateClassSymbol** objectArray = (SgTemplateClassSymbol**) &(SgTemplateClassSymbol::pools[0]);
153221 :
153222 : // Build a local variable for better performance
153223 145 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
153224 : #if 0
153225 : // Iterate over the memory pools
153226 : for (unsigned int i=0; i < SgTemplateClassSymbol::pools.size(); i++)
153227 : {
153228 : // objectArray[i] is a single memory pool
153229 : for (int j=0; j < SgTemplateClassSymbol::pool_size; j++)
153230 : {
153231 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
153232 : {
153233 : traversal.visit(&(objectArray[i][j]));
153234 : }
153235 : }
153236 : }
153237 : #else
153238 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
153239 : // compute the list first and then call the visit function on each list element.
153240 :
153241 : // printf ("Inside of SgTemplateClassSymbol::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
153242 :
153243 290 : std::vector<SgTemplateClassSymbol*> nodeList;
153244 :
153245 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
153246 290 : for (unsigned int i=0; i < SgTemplateClassSymbol::pools.size(); i++)
153247 : {
153248 : // objectArray[i] is a single memory pool
153249 290145 : for (unsigned j=0; j < SgTemplateClassSymbol::pool_size; j++)
153250 : {
153251 290000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
153252 : {
153253 76786 : nodeList.push_back(&(objectArray[i][j]));
153254 : }
153255 : }
153256 : }
153257 :
153258 : // Iterate over the saved list
153259 145 : size_t nodeListSize = nodeList.size();
153260 76931 : for (size_t i=0; i < nodeListSize; i++)
153261 : {
153262 76786 : ROSE_ASSERT(nodeList[i] != NULL);
153263 : #if 0
153264 : traversal.visit(nodeList[i]);
153265 : #else
153266 76786 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
153267 : {
153268 76786 : traversal.visit(nodeList[i]);
153269 : }
153270 : #endif
153271 : }
153272 : #endif
153273 : }
153274 :
153275 : // This should not be required since all previously static data members are
153276 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
153277 :
153278 5342 : }
153279 :
153280 :
153281 : void
153282 194 : SgTemplateClassSymbol::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
153283 : {
153284 : // This function traverses the memory pool for an IR node and
153285 : // calls the function to execute the visitor object.
153286 :
153287 : // Initialize array to the address of the first element of the STL vector
153288 : // (which is guarenteed to be contiguous storage).
153289 : // SgTemplateClassSymbol objectArray [] = *(Memory_Block_List.begin());
153290 194 : if (SgTemplateClassSymbol::pools.empty() == false)
153291 : {
153292 : // Generate an array of memory pools
153293 137 : SgTemplateClassSymbol** objectArray = (SgTemplateClassSymbol**) &(SgTemplateClassSymbol::pools[0]);
153294 :
153295 : // Build a local variable for better performance
153296 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
153297 :
153298 : // Iterate over the memory pools
153299 274 : for (unsigned int i=0; i < SgTemplateClassSymbol::pools.size(); i++)
153300 : {
153301 : // objectArray[i] is a single memory pool
153302 274137 : for (unsigned j=0; j < SgTemplateClassSymbol::pool_size; j++)
153303 : {
153304 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
153305 : {
153306 : // printf ("Found a valid SgTemplateClassSymbol object in the memory pool %d at position %d \n",i,j);
153307 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
153308 78742 : objectArray[i][j].executeVisitorMemberFunction(visitor);
153309 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
153310 : }
153311 : else
153312 : {
153313 : // printf ("Found a INVALID SgTemplateClassSymbol object in the memory pool \n");
153314 : }
153315 : }
153316 : }
153317 : }
153318 :
153319 : // This should not be required since all previously static data members are
153320 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
153321 :
153322 194 : }
153323 :
153324 : void
153325 0 : SgTemplateClassSymbol::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
153326 : {
153327 : // This function visits only a single IR node of the memory pool.
153328 : // it is typically called once for each type of IR node within
153329 : // the automatically generated function: traverseRepresentativeNodes().
153330 :
153331 : // Initialize array to the address of the first element of the STL vector
153332 : // (which is guarenteed to be contiguous storage).
153333 : // SgTemplateClassSymbol objectArray [] = *(Memory_Block_List.begin());
153334 0 : if (SgTemplateClassSymbol::pools.empty() == false)
153335 : {
153336 : // Generate an array of memory pools
153337 0 : SgTemplateClassSymbol** objectArray = (SgTemplateClassSymbol**) &(SgTemplateClassSymbol::pools[0]);
153338 :
153339 : // Build a local variable for better performance
153340 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
153341 :
153342 : // Iterate over the memory pools
153343 0 : bool done = false;
153344 0 : unsigned i=0;
153345 :
153346 : // find the first valid IR node, call visit function, and then leave
153347 0 : while ( done == false && i < SgTemplateClassSymbol::pools.size() )
153348 : {
153349 : // objectArray[i] is a single memory pool
153350 : unsigned j=0;
153351 0 : while (done == false && j < SgTemplateClassSymbol::pool_size)
153352 : {
153353 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
153354 : {
153355 0 : traversal.visit(&(objectArray[i][j]));
153356 0 : done = true;
153357 : }
153358 0 : j++;
153359 : }
153360 0 : i++;
153361 : }
153362 :
153363 : #if 0
153364 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
153365 : if (done == false)
153366 : {
153367 : printf ("No representative for SgTemplateClassSymbol found in memory pools \n");
153368 : }
153369 : #endif
153370 : }
153371 0 : }
153372 :
153373 :
153374 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
153375 : // using values that overflow signed values of int.
153376 : size_t
153377 4 : SgTemplateClassSymbol::numberOfNodes()
153378 : {
153379 : // This function traverses the memory pool for an IR node and
153380 : // counts the number of IR nodes of a particular Sage III IR
153381 : // nodes type.
153382 :
153383 4 : size_t count = 0;
153384 4 : if (SgTemplateClassSymbol::pools.empty() == false)
153385 : {
153386 : // Generate an array of memory pools (this is actually a STL vector,
153387 : // but it is contiguious, so OK to treat this way).
153388 1 : SgTemplateClassSymbol** objectArray = (SgTemplateClassSymbol**) &(SgTemplateClassSymbol::pools[0]);
153389 :
153390 : // Build a local variable for better performance (make it a loop invariant variable).
153391 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
153392 :
153393 : // Iterate over all of the memory pools for this IR node.
153394 2 : for (unsigned int i=0; i < SgTemplateClassSymbol::pools.size(); i++)
153395 : {
153396 : // objectArray[i] is a single memory pool, iterate over all the
153397 : // IR nodes and only count those that are valid IR nodes used in
153398 : // the AST (i.e. allocated IR nodes).
153399 2001 : for (unsigned j=0; j < SgTemplateClassSymbol::pool_size; j++)
153400 : {
153401 : // This is indexing the STL vector of C/C++ style arrays as a doubly
153402 : // indexed array access. It is OK since we have leveraged the semantics
153403 : // of STL vector memory as contigous and cast the memory as an array
153404 : // of arrays to use the 2D array indexing. Hope this is not confusing,
153405 : // but it s very fast as an implementation.
153406 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
153407 : {
153408 572 : count++;
153409 : }
153410 : }
153411 : }
153412 : }
153413 :
153414 :
153415 :
153416 4 : return count;
153417 : }
153418 :
153419 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
153420 : // using values that overflow signed values of int.
153421 : size_t
153422 0 : SgTemplateClassSymbol::memoryUsage()
153423 : {
153424 : // This function is required because we need the class name as a type when we call sizeof
153425 : // There might be another way to implement this if we have a traversal that only called a
153426 : // representative object (one call for each type of Sage IIIIR node).
153427 0 : size_t memory = numberOfNodes() * sizeof(SgTemplateClassSymbol);
153428 :
153429 0 : return memory;
153430 : }
153431 :
153432 : /* #line 153433 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
153433 :
153434 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
153435 : void
153436 5342 : SgTemplateSymbol::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
153437 : {
153438 : // This function traverses the memory pool for only a specific IR node
153439 : // and calls the visit function of the input class execute a traversal
153440 : // similar to the style of the attribute based traversals within ROSE.
153441 : // This traversal will visit ALL nodes of the AST where as the other
153442 : // attribute based traversals visit only the embedded tree within the AST.
153443 :
153444 : // Initialize array to the address of the first element of the STL vector
153445 : // (which is guaranteed to be contiguous storage).
153446 : // SgTemplateSymbol objectArray [] = *(Memory_Block_List.begin());
153447 5342 : if (SgTemplateSymbol::pools.empty() == false)
153448 : {
153449 : // Generate an array of memory pools
153450 0 : SgTemplateSymbol** objectArray = (SgTemplateSymbol**) &(SgTemplateSymbol::pools[0]);
153451 :
153452 : // Build a local variable for better performance
153453 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
153454 : #if 0
153455 : // Iterate over the memory pools
153456 : for (unsigned int i=0; i < SgTemplateSymbol::pools.size(); i++)
153457 : {
153458 : // objectArray[i] is a single memory pool
153459 : for (int j=0; j < SgTemplateSymbol::pool_size; j++)
153460 : {
153461 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
153462 : {
153463 : traversal.visit(&(objectArray[i][j]));
153464 : }
153465 : }
153466 : }
153467 : #else
153468 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
153469 : // compute the list first and then call the visit function on each list element.
153470 :
153471 : // printf ("Inside of SgTemplateSymbol::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
153472 :
153473 0 : std::vector<SgTemplateSymbol*> nodeList;
153474 :
153475 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
153476 0 : for (unsigned int i=0; i < SgTemplateSymbol::pools.size(); i++)
153477 : {
153478 : // objectArray[i] is a single memory pool
153479 0 : for (unsigned j=0; j < SgTemplateSymbol::pool_size; j++)
153480 : {
153481 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
153482 : {
153483 0 : nodeList.push_back(&(objectArray[i][j]));
153484 : }
153485 : }
153486 : }
153487 :
153488 : // Iterate over the saved list
153489 0 : size_t nodeListSize = nodeList.size();
153490 0 : for (size_t i=0; i < nodeListSize; i++)
153491 : {
153492 0 : ROSE_ASSERT(nodeList[i] != NULL);
153493 : #if 0
153494 : traversal.visit(nodeList[i]);
153495 : #else
153496 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
153497 : {
153498 0 : traversal.visit(nodeList[i]);
153499 : }
153500 : #endif
153501 : }
153502 : #endif
153503 : }
153504 :
153505 : // This should not be required since all previously static data members are
153506 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
153507 :
153508 5342 : }
153509 :
153510 :
153511 : void
153512 194 : SgTemplateSymbol::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
153513 : {
153514 : // This function traverses the memory pool for an IR node and
153515 : // calls the function to execute the visitor object.
153516 :
153517 : // Initialize array to the address of the first element of the STL vector
153518 : // (which is guarenteed to be contiguous storage).
153519 : // SgTemplateSymbol objectArray [] = *(Memory_Block_List.begin());
153520 194 : if (SgTemplateSymbol::pools.empty() == false)
153521 : {
153522 : // Generate an array of memory pools
153523 0 : SgTemplateSymbol** objectArray = (SgTemplateSymbol**) &(SgTemplateSymbol::pools[0]);
153524 :
153525 : // Build a local variable for better performance
153526 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
153527 :
153528 : // Iterate over the memory pools
153529 0 : for (unsigned int i=0; i < SgTemplateSymbol::pools.size(); i++)
153530 : {
153531 : // objectArray[i] is a single memory pool
153532 0 : for (unsigned j=0; j < SgTemplateSymbol::pool_size; j++)
153533 : {
153534 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
153535 : {
153536 : // printf ("Found a valid SgTemplateSymbol object in the memory pool %d at position %d \n",i,j);
153537 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
153538 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
153539 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
153540 : }
153541 : else
153542 : {
153543 : // printf ("Found a INVALID SgTemplateSymbol object in the memory pool \n");
153544 : }
153545 : }
153546 : }
153547 : }
153548 :
153549 : // This should not be required since all previously static data members are
153550 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
153551 :
153552 194 : }
153553 :
153554 : void
153555 0 : SgTemplateSymbol::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
153556 : {
153557 : // This function visits only a single IR node of the memory pool.
153558 : // it is typically called once for each type of IR node within
153559 : // the automatically generated function: traverseRepresentativeNodes().
153560 :
153561 : // Initialize array to the address of the first element of the STL vector
153562 : // (which is guarenteed to be contiguous storage).
153563 : // SgTemplateSymbol objectArray [] = *(Memory_Block_List.begin());
153564 0 : if (SgTemplateSymbol::pools.empty() == false)
153565 : {
153566 : // Generate an array of memory pools
153567 0 : SgTemplateSymbol** objectArray = (SgTemplateSymbol**) &(SgTemplateSymbol::pools[0]);
153568 :
153569 : // Build a local variable for better performance
153570 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
153571 :
153572 : // Iterate over the memory pools
153573 0 : bool done = false;
153574 0 : unsigned i=0;
153575 :
153576 : // find the first valid IR node, call visit function, and then leave
153577 0 : while ( done == false && i < SgTemplateSymbol::pools.size() )
153578 : {
153579 : // objectArray[i] is a single memory pool
153580 : unsigned j=0;
153581 0 : while (done == false && j < SgTemplateSymbol::pool_size)
153582 : {
153583 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
153584 : {
153585 0 : traversal.visit(&(objectArray[i][j]));
153586 0 : done = true;
153587 : }
153588 0 : j++;
153589 : }
153590 0 : i++;
153591 : }
153592 :
153593 : #if 0
153594 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
153595 : if (done == false)
153596 : {
153597 : printf ("No representative for SgTemplateSymbol found in memory pools \n");
153598 : }
153599 : #endif
153600 : }
153601 0 : }
153602 :
153603 :
153604 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
153605 : // using values that overflow signed values of int.
153606 : size_t
153607 4 : SgTemplateSymbol::numberOfNodes()
153608 : {
153609 : // This function traverses the memory pool for an IR node and
153610 : // counts the number of IR nodes of a particular Sage III IR
153611 : // nodes type.
153612 :
153613 4 : size_t count = 0;
153614 4 : if (SgTemplateSymbol::pools.empty() == false)
153615 : {
153616 : // Generate an array of memory pools (this is actually a STL vector,
153617 : // but it is contiguious, so OK to treat this way).
153618 0 : SgTemplateSymbol** objectArray = (SgTemplateSymbol**) &(SgTemplateSymbol::pools[0]);
153619 :
153620 : // Build a local variable for better performance (make it a loop invariant variable).
153621 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
153622 :
153623 : // Iterate over all of the memory pools for this IR node.
153624 0 : for (unsigned int i=0; i < SgTemplateSymbol::pools.size(); i++)
153625 : {
153626 : // objectArray[i] is a single memory pool, iterate over all the
153627 : // IR nodes and only count those that are valid IR nodes used in
153628 : // the AST (i.e. allocated IR nodes).
153629 0 : for (unsigned j=0; j < SgTemplateSymbol::pool_size; j++)
153630 : {
153631 : // This is indexing the STL vector of C/C++ style arrays as a doubly
153632 : // indexed array access. It is OK since we have leveraged the semantics
153633 : // of STL vector memory as contigous and cast the memory as an array
153634 : // of arrays to use the 2D array indexing. Hope this is not confusing,
153635 : // but it s very fast as an implementation.
153636 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
153637 : {
153638 0 : count++;
153639 : }
153640 : }
153641 : }
153642 : }
153643 :
153644 :
153645 :
153646 4 : return count;
153647 : }
153648 :
153649 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
153650 : // using values that overflow signed values of int.
153651 : size_t
153652 0 : SgTemplateSymbol::memoryUsage()
153653 : {
153654 : // This function is required because we need the class name as a type when we call sizeof
153655 : // There might be another way to implement this if we have a traversal that only called a
153656 : // representative object (one call for each type of Sage IIIIR node).
153657 0 : size_t memory = numberOfNodes() * sizeof(SgTemplateSymbol);
153658 :
153659 0 : return memory;
153660 : }
153661 :
153662 : /* #line 153663 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
153663 :
153664 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
153665 : void
153666 5342 : SgEnumSymbol::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
153667 : {
153668 : // This function traverses the memory pool for only a specific IR node
153669 : // and calls the visit function of the input class execute a traversal
153670 : // similar to the style of the attribute based traversals within ROSE.
153671 : // This traversal will visit ALL nodes of the AST where as the other
153672 : // attribute based traversals visit only the embedded tree within the AST.
153673 :
153674 : // Initialize array to the address of the first element of the STL vector
153675 : // (which is guaranteed to be contiguous storage).
153676 : // SgEnumSymbol objectArray [] = *(Memory_Block_List.begin());
153677 5342 : if (SgEnumSymbol::pools.empty() == false)
153678 : {
153679 : // Generate an array of memory pools
153680 2726 : SgEnumSymbol** objectArray = (SgEnumSymbol**) &(SgEnumSymbol::pools[0]);
153681 :
153682 : // Build a local variable for better performance
153683 2726 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
153684 : #if 0
153685 : // Iterate over the memory pools
153686 : for (unsigned int i=0; i < SgEnumSymbol::pools.size(); i++)
153687 : {
153688 : // objectArray[i] is a single memory pool
153689 : for (int j=0; j < SgEnumSymbol::pool_size; j++)
153690 : {
153691 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
153692 : {
153693 : traversal.visit(&(objectArray[i][j]));
153694 : }
153695 : }
153696 : }
153697 : #else
153698 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
153699 : // compute the list first and then call the visit function on each list element.
153700 :
153701 : // printf ("Inside of SgEnumSymbol::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
153702 :
153703 5452 : std::vector<SgEnumSymbol*> nodeList;
153704 :
153705 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
153706 5452 : for (unsigned int i=0; i < SgEnumSymbol::pools.size(); i++)
153707 : {
153708 : // objectArray[i] is a single memory pool
153709 5454730 : for (unsigned j=0; j < SgEnumSymbol::pool_size; j++)
153710 : {
153711 5452000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
153712 : {
153713 21561 : nodeList.push_back(&(objectArray[i][j]));
153714 : }
153715 : }
153716 : }
153717 :
153718 : // Iterate over the saved list
153719 2726 : size_t nodeListSize = nodeList.size();
153720 24287 : for (size_t i=0; i < nodeListSize; i++)
153721 : {
153722 21561 : ROSE_ASSERT(nodeList[i] != NULL);
153723 : #if 0
153724 : traversal.visit(nodeList[i]);
153725 : #else
153726 21561 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
153727 : {
153728 21561 : traversal.visit(nodeList[i]);
153729 : }
153730 : #endif
153731 : }
153732 : #endif
153733 : }
153734 :
153735 : // This should not be required since all previously static data members are
153736 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
153737 :
153738 5342 : }
153739 :
153740 :
153741 : void
153742 194 : SgEnumSymbol::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
153743 : {
153744 : // This function traverses the memory pool for an IR node and
153745 : // calls the function to execute the visitor object.
153746 :
153747 : // Initialize array to the address of the first element of the STL vector
153748 : // (which is guarenteed to be contiguous storage).
153749 : // SgEnumSymbol objectArray [] = *(Memory_Block_List.begin());
153750 194 : if (SgEnumSymbol::pools.empty() == false)
153751 : {
153752 : // Generate an array of memory pools
153753 137 : SgEnumSymbol** objectArray = (SgEnumSymbol**) &(SgEnumSymbol::pools[0]);
153754 :
153755 : // Build a local variable for better performance
153756 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
153757 :
153758 : // Iterate over the memory pools
153759 274 : for (unsigned int i=0; i < SgEnumSymbol::pools.size(); i++)
153760 : {
153761 : // objectArray[i] is a single memory pool
153762 274137 : for (unsigned j=0; j < SgEnumSymbol::pool_size; j++)
153763 : {
153764 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
153765 : {
153766 : // printf ("Found a valid SgEnumSymbol object in the memory pool %d at position %d \n",i,j);
153767 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
153768 12142 : objectArray[i][j].executeVisitorMemberFunction(visitor);
153769 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
153770 : }
153771 : else
153772 : {
153773 : // printf ("Found a INVALID SgEnumSymbol object in the memory pool \n");
153774 : }
153775 : }
153776 : }
153777 : }
153778 :
153779 : // This should not be required since all previously static data members are
153780 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
153781 :
153782 194 : }
153783 :
153784 : void
153785 0 : SgEnumSymbol::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
153786 : {
153787 : // This function visits only a single IR node of the memory pool.
153788 : // it is typically called once for each type of IR node within
153789 : // the automatically generated function: traverseRepresentativeNodes().
153790 :
153791 : // Initialize array to the address of the first element of the STL vector
153792 : // (which is guarenteed to be contiguous storage).
153793 : // SgEnumSymbol objectArray [] = *(Memory_Block_List.begin());
153794 0 : if (SgEnumSymbol::pools.empty() == false)
153795 : {
153796 : // Generate an array of memory pools
153797 0 : SgEnumSymbol** objectArray = (SgEnumSymbol**) &(SgEnumSymbol::pools[0]);
153798 :
153799 : // Build a local variable for better performance
153800 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
153801 :
153802 : // Iterate over the memory pools
153803 0 : bool done = false;
153804 0 : unsigned i=0;
153805 :
153806 : // find the first valid IR node, call visit function, and then leave
153807 0 : while ( done == false && i < SgEnumSymbol::pools.size() )
153808 : {
153809 : // objectArray[i] is a single memory pool
153810 : unsigned j=0;
153811 0 : while (done == false && j < SgEnumSymbol::pool_size)
153812 : {
153813 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
153814 : {
153815 0 : traversal.visit(&(objectArray[i][j]));
153816 0 : done = true;
153817 : }
153818 0 : j++;
153819 : }
153820 0 : i++;
153821 : }
153822 :
153823 : #if 0
153824 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
153825 : if (done == false)
153826 : {
153827 : printf ("No representative for SgEnumSymbol found in memory pools \n");
153828 : }
153829 : #endif
153830 : }
153831 0 : }
153832 :
153833 :
153834 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
153835 : // using values that overflow signed values of int.
153836 : size_t
153837 4 : SgEnumSymbol::numberOfNodes()
153838 : {
153839 : // This function traverses the memory pool for an IR node and
153840 : // counts the number of IR nodes of a particular Sage III IR
153841 : // nodes type.
153842 :
153843 4 : size_t count = 0;
153844 4 : if (SgEnumSymbol::pools.empty() == false)
153845 : {
153846 : // Generate an array of memory pools (this is actually a STL vector,
153847 : // but it is contiguious, so OK to treat this way).
153848 1 : SgEnumSymbol** objectArray = (SgEnumSymbol**) &(SgEnumSymbol::pools[0]);
153849 :
153850 : // Build a local variable for better performance (make it a loop invariant variable).
153851 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
153852 :
153853 : // Iterate over all of the memory pools for this IR node.
153854 2 : for (unsigned int i=0; i < SgEnumSymbol::pools.size(); i++)
153855 : {
153856 : // objectArray[i] is a single memory pool, iterate over all the
153857 : // IR nodes and only count those that are valid IR nodes used in
153858 : // the AST (i.e. allocated IR nodes).
153859 2001 : for (unsigned j=0; j < SgEnumSymbol::pool_size; j++)
153860 : {
153861 : // This is indexing the STL vector of C/C++ style arrays as a doubly
153862 : // indexed array access. It is OK since we have leveraged the semantics
153863 : // of STL vector memory as contigous and cast the memory as an array
153864 : // of arrays to use the 2D array indexing. Hope this is not confusing,
153865 : // but it s very fast as an implementation.
153866 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
153867 : {
153868 88 : count++;
153869 : }
153870 : }
153871 : }
153872 : }
153873 :
153874 :
153875 :
153876 4 : return count;
153877 : }
153878 :
153879 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
153880 : // using values that overflow signed values of int.
153881 : size_t
153882 0 : SgEnumSymbol::memoryUsage()
153883 : {
153884 : // This function is required because we need the class name as a type when we call sizeof
153885 : // There might be another way to implement this if we have a traversal that only called a
153886 : // representative object (one call for each type of Sage IIIIR node).
153887 0 : size_t memory = numberOfNodes() * sizeof(SgEnumSymbol);
153888 :
153889 0 : return memory;
153890 : }
153891 :
153892 : /* #line 153893 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
153893 :
153894 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
153895 : void
153896 5342 : SgEnumFieldSymbol::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
153897 : {
153898 : // This function traverses the memory pool for only a specific IR node
153899 : // and calls the visit function of the input class execute a traversal
153900 : // similar to the style of the attribute based traversals within ROSE.
153901 : // This traversal will visit ALL nodes of the AST where as the other
153902 : // attribute based traversals visit only the embedded tree within the AST.
153903 :
153904 : // Initialize array to the address of the first element of the STL vector
153905 : // (which is guaranteed to be contiguous storage).
153906 : // SgEnumFieldSymbol objectArray [] = *(Memory_Block_List.begin());
153907 5342 : if (SgEnumFieldSymbol::pools.empty() == false)
153908 : {
153909 : // Generate an array of memory pools
153910 2726 : SgEnumFieldSymbol** objectArray = (SgEnumFieldSymbol**) &(SgEnumFieldSymbol::pools[0]);
153911 :
153912 : // Build a local variable for better performance
153913 2726 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
153914 : #if 0
153915 : // Iterate over the memory pools
153916 : for (unsigned int i=0; i < SgEnumFieldSymbol::pools.size(); i++)
153917 : {
153918 : // objectArray[i] is a single memory pool
153919 : for (int j=0; j < SgEnumFieldSymbol::pool_size; j++)
153920 : {
153921 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
153922 : {
153923 : traversal.visit(&(objectArray[i][j]));
153924 : }
153925 : }
153926 : }
153927 : #else
153928 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
153929 : // compute the list first and then call the visit function on each list element.
153930 :
153931 : // printf ("Inside of SgEnumFieldSymbol::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
153932 :
153933 5452 : std::vector<SgEnumFieldSymbol*> nodeList;
153934 :
153935 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
153936 5452 : for (unsigned int i=0; i < SgEnumFieldSymbol::pools.size(); i++)
153937 : {
153938 : // objectArray[i] is a single memory pool
153939 5454730 : for (unsigned j=0; j < SgEnumFieldSymbol::pool_size; j++)
153940 : {
153941 5452000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
153942 : {
153943 103290 : nodeList.push_back(&(objectArray[i][j]));
153944 : }
153945 : }
153946 : }
153947 :
153948 : // Iterate over the saved list
153949 2726 : size_t nodeListSize = nodeList.size();
153950 106016 : for (size_t i=0; i < nodeListSize; i++)
153951 : {
153952 103290 : ROSE_ASSERT(nodeList[i] != NULL);
153953 : #if 0
153954 : traversal.visit(nodeList[i]);
153955 : #else
153956 103290 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
153957 : {
153958 103290 : traversal.visit(nodeList[i]);
153959 : }
153960 : #endif
153961 : }
153962 : #endif
153963 : }
153964 :
153965 : // This should not be required since all previously static data members are
153966 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
153967 :
153968 5342 : }
153969 :
153970 :
153971 : void
153972 194 : SgEnumFieldSymbol::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
153973 : {
153974 : // This function traverses the memory pool for an IR node and
153975 : // calls the function to execute the visitor object.
153976 :
153977 : // Initialize array to the address of the first element of the STL vector
153978 : // (which is guarenteed to be contiguous storage).
153979 : // SgEnumFieldSymbol objectArray [] = *(Memory_Block_List.begin());
153980 194 : if (SgEnumFieldSymbol::pools.empty() == false)
153981 : {
153982 : // Generate an array of memory pools
153983 137 : SgEnumFieldSymbol** objectArray = (SgEnumFieldSymbol**) &(SgEnumFieldSymbol::pools[0]);
153984 :
153985 : // Build a local variable for better performance
153986 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
153987 :
153988 : // Iterate over the memory pools
153989 274 : for (unsigned int i=0; i < SgEnumFieldSymbol::pools.size(); i++)
153990 : {
153991 : // objectArray[i] is a single memory pool
153992 274137 : for (unsigned j=0; j < SgEnumFieldSymbol::pool_size; j++)
153993 : {
153994 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
153995 : {
153996 : // printf ("Found a valid SgEnumFieldSymbol object in the memory pool %d at position %d \n",i,j);
153997 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
153998 38530 : objectArray[i][j].executeVisitorMemberFunction(visitor);
153999 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
154000 : }
154001 : else
154002 : {
154003 : // printf ("Found a INVALID SgEnumFieldSymbol object in the memory pool \n");
154004 : }
154005 : }
154006 : }
154007 : }
154008 :
154009 : // This should not be required since all previously static data members are
154010 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
154011 :
154012 194 : }
154013 :
154014 : void
154015 0 : SgEnumFieldSymbol::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
154016 : {
154017 : // This function visits only a single IR node of the memory pool.
154018 : // it is typically called once for each type of IR node within
154019 : // the automatically generated function: traverseRepresentativeNodes().
154020 :
154021 : // Initialize array to the address of the first element of the STL vector
154022 : // (which is guarenteed to be contiguous storage).
154023 : // SgEnumFieldSymbol objectArray [] = *(Memory_Block_List.begin());
154024 0 : if (SgEnumFieldSymbol::pools.empty() == false)
154025 : {
154026 : // Generate an array of memory pools
154027 0 : SgEnumFieldSymbol** objectArray = (SgEnumFieldSymbol**) &(SgEnumFieldSymbol::pools[0]);
154028 :
154029 : // Build a local variable for better performance
154030 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
154031 :
154032 : // Iterate over the memory pools
154033 0 : bool done = false;
154034 0 : unsigned i=0;
154035 :
154036 : // find the first valid IR node, call visit function, and then leave
154037 0 : while ( done == false && i < SgEnumFieldSymbol::pools.size() )
154038 : {
154039 : // objectArray[i] is a single memory pool
154040 : unsigned j=0;
154041 0 : while (done == false && j < SgEnumFieldSymbol::pool_size)
154042 : {
154043 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
154044 : {
154045 0 : traversal.visit(&(objectArray[i][j]));
154046 0 : done = true;
154047 : }
154048 0 : j++;
154049 : }
154050 0 : i++;
154051 : }
154052 :
154053 : #if 0
154054 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
154055 : if (done == false)
154056 : {
154057 : printf ("No representative for SgEnumFieldSymbol found in memory pools \n");
154058 : }
154059 : #endif
154060 : }
154061 0 : }
154062 :
154063 :
154064 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
154065 : // using values that overflow signed values of int.
154066 : size_t
154067 4 : SgEnumFieldSymbol::numberOfNodes()
154068 : {
154069 : // This function traverses the memory pool for an IR node and
154070 : // counts the number of IR nodes of a particular Sage III IR
154071 : // nodes type.
154072 :
154073 4 : size_t count = 0;
154074 4 : if (SgEnumFieldSymbol::pools.empty() == false)
154075 : {
154076 : // Generate an array of memory pools (this is actually a STL vector,
154077 : // but it is contiguious, so OK to treat this way).
154078 1 : SgEnumFieldSymbol** objectArray = (SgEnumFieldSymbol**) &(SgEnumFieldSymbol::pools[0]);
154079 :
154080 : // Build a local variable for better performance (make it a loop invariant variable).
154081 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
154082 :
154083 : // Iterate over all of the memory pools for this IR node.
154084 2 : for (unsigned int i=0; i < SgEnumFieldSymbol::pools.size(); i++)
154085 : {
154086 : // objectArray[i] is a single memory pool, iterate over all the
154087 : // IR nodes and only count those that are valid IR nodes used in
154088 : // the AST (i.e. allocated IR nodes).
154089 2001 : for (unsigned j=0; j < SgEnumFieldSymbol::pool_size; j++)
154090 : {
154091 : // This is indexing the STL vector of C/C++ style arrays as a doubly
154092 : // indexed array access. It is OK since we have leveraged the semantics
154093 : // of STL vector memory as contigous and cast the memory as an array
154094 : // of arrays to use the 2D array indexing. Hope this is not confusing,
154095 : // but it s very fast as an implementation.
154096 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
154097 : {
154098 279 : count++;
154099 : }
154100 : }
154101 : }
154102 : }
154103 :
154104 :
154105 :
154106 4 : return count;
154107 : }
154108 :
154109 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
154110 : // using values that overflow signed values of int.
154111 : size_t
154112 0 : SgEnumFieldSymbol::memoryUsage()
154113 : {
154114 : // This function is required because we need the class name as a type when we call sizeof
154115 : // There might be another way to implement this if we have a traversal that only called a
154116 : // representative object (one call for each type of Sage IIIIR node).
154117 0 : size_t memory = numberOfNodes() * sizeof(SgEnumFieldSymbol);
154118 :
154119 0 : return memory;
154120 : }
154121 :
154122 : /* #line 154123 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
154123 :
154124 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
154125 : void
154126 5342 : SgTypedefSymbol::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
154127 : {
154128 : // This function traverses the memory pool for only a specific IR node
154129 : // and calls the visit function of the input class execute a traversal
154130 : // similar to the style of the attribute based traversals within ROSE.
154131 : // This traversal will visit ALL nodes of the AST where as the other
154132 : // attribute based traversals visit only the embedded tree within the AST.
154133 :
154134 : // Initialize array to the address of the first element of the STL vector
154135 : // (which is guaranteed to be contiguous storage).
154136 : // SgTypedefSymbol objectArray [] = *(Memory_Block_List.begin());
154137 5342 : if (SgTypedefSymbol::pools.empty() == false)
154138 : {
154139 : // Generate an array of memory pools
154140 4602 : SgTypedefSymbol** objectArray = (SgTypedefSymbol**) &(SgTypedefSymbol::pools[0]);
154141 :
154142 : // Build a local variable for better performance
154143 4602 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
154144 : #if 0
154145 : // Iterate over the memory pools
154146 : for (unsigned int i=0; i < SgTypedefSymbol::pools.size(); i++)
154147 : {
154148 : // objectArray[i] is a single memory pool
154149 : for (int j=0; j < SgTypedefSymbol::pool_size; j++)
154150 : {
154151 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
154152 : {
154153 : traversal.visit(&(objectArray[i][j]));
154154 : }
154155 : }
154156 : }
154157 : #else
154158 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
154159 : // compute the list first and then call the visit function on each list element.
154160 :
154161 : // printf ("Inside of SgTypedefSymbol::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
154162 :
154163 9204 : std::vector<SgTypedefSymbol*> nodeList;
154164 :
154165 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
154166 9204 : for (unsigned int i=0; i < SgTypedefSymbol::pools.size(); i++)
154167 : {
154168 : // objectArray[i] is a single memory pool
154169 9208600 : for (unsigned j=0; j < SgTypedefSymbol::pool_size; j++)
154170 : {
154171 9204000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
154172 : {
154173 808545 : nodeList.push_back(&(objectArray[i][j]));
154174 : }
154175 : }
154176 : }
154177 :
154178 : // Iterate over the saved list
154179 4602 : size_t nodeListSize = nodeList.size();
154180 813147 : for (size_t i=0; i < nodeListSize; i++)
154181 : {
154182 808545 : ROSE_ASSERT(nodeList[i] != NULL);
154183 : #if 0
154184 : traversal.visit(nodeList[i]);
154185 : #else
154186 808545 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
154187 : {
154188 808545 : traversal.visit(nodeList[i]);
154189 : }
154190 : #endif
154191 : }
154192 : #endif
154193 : }
154194 :
154195 : // This should not be required since all previously static data members are
154196 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
154197 :
154198 5342 : }
154199 :
154200 :
154201 : void
154202 194 : SgTypedefSymbol::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
154203 : {
154204 : // This function traverses the memory pool for an IR node and
154205 : // calls the function to execute the visitor object.
154206 :
154207 : // Initialize array to the address of the first element of the STL vector
154208 : // (which is guarenteed to be contiguous storage).
154209 : // SgTypedefSymbol objectArray [] = *(Memory_Block_List.begin());
154210 194 : if (SgTypedefSymbol::pools.empty() == false)
154211 : {
154212 : // Generate an array of memory pools
154213 194 : SgTypedefSymbol** objectArray = (SgTypedefSymbol**) &(SgTypedefSymbol::pools[0]);
154214 :
154215 : // Build a local variable for better performance
154216 194 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
154217 :
154218 : // Iterate over the memory pools
154219 388 : for (unsigned int i=0; i < SgTypedefSymbol::pools.size(); i++)
154220 : {
154221 : // objectArray[i] is a single memory pool
154222 388194 : for (unsigned j=0; j < SgTypedefSymbol::pool_size; j++)
154223 : {
154224 388000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
154225 : {
154226 : // printf ("Found a valid SgTypedefSymbol object in the memory pool %d at position %d \n",i,j);
154227 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
154228 223774 : objectArray[i][j].executeVisitorMemberFunction(visitor);
154229 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
154230 : }
154231 : else
154232 : {
154233 : // printf ("Found a INVALID SgTypedefSymbol object in the memory pool \n");
154234 : }
154235 : }
154236 : }
154237 : }
154238 :
154239 : // This should not be required since all previously static data members are
154240 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
154241 :
154242 194 : }
154243 :
154244 : void
154245 0 : SgTypedefSymbol::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
154246 : {
154247 : // This function visits only a single IR node of the memory pool.
154248 : // it is typically called once for each type of IR node within
154249 : // the automatically generated function: traverseRepresentativeNodes().
154250 :
154251 : // Initialize array to the address of the first element of the STL vector
154252 : // (which is guarenteed to be contiguous storage).
154253 : // SgTypedefSymbol objectArray [] = *(Memory_Block_List.begin());
154254 0 : if (SgTypedefSymbol::pools.empty() == false)
154255 : {
154256 : // Generate an array of memory pools
154257 0 : SgTypedefSymbol** objectArray = (SgTypedefSymbol**) &(SgTypedefSymbol::pools[0]);
154258 :
154259 : // Build a local variable for better performance
154260 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
154261 :
154262 : // Iterate over the memory pools
154263 0 : bool done = false;
154264 0 : unsigned i=0;
154265 :
154266 : // find the first valid IR node, call visit function, and then leave
154267 0 : while ( done == false && i < SgTypedefSymbol::pools.size() )
154268 : {
154269 : // objectArray[i] is a single memory pool
154270 : unsigned j=0;
154271 0 : while (done == false && j < SgTypedefSymbol::pool_size)
154272 : {
154273 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
154274 : {
154275 0 : traversal.visit(&(objectArray[i][j]));
154276 0 : done = true;
154277 : }
154278 0 : j++;
154279 : }
154280 0 : i++;
154281 : }
154282 :
154283 : #if 0
154284 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
154285 : if (done == false)
154286 : {
154287 : printf ("No representative for SgTypedefSymbol found in memory pools \n");
154288 : }
154289 : #endif
154290 : }
154291 0 : }
154292 :
154293 :
154294 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
154295 : // using values that overflow signed values of int.
154296 : size_t
154297 4 : SgTypedefSymbol::numberOfNodes()
154298 : {
154299 : // This function traverses the memory pool for an IR node and
154300 : // counts the number of IR nodes of a particular Sage III IR
154301 : // nodes type.
154302 :
154303 4 : size_t count = 0;
154304 4 : if (SgTypedefSymbol::pools.empty() == false)
154305 : {
154306 : // Generate an array of memory pools (this is actually a STL vector,
154307 : // but it is contiguious, so OK to treat this way).
154308 2 : SgTypedefSymbol** objectArray = (SgTypedefSymbol**) &(SgTypedefSymbol::pools[0]);
154309 :
154310 : // Build a local variable for better performance (make it a loop invariant variable).
154311 2 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
154312 :
154313 : // Iterate over all of the memory pools for this IR node.
154314 4 : for (unsigned int i=0; i < SgTypedefSymbol::pools.size(); i++)
154315 : {
154316 : // objectArray[i] is a single memory pool, iterate over all the
154317 : // IR nodes and only count those that are valid IR nodes used in
154318 : // the AST (i.e. allocated IR nodes).
154319 4002 : for (unsigned j=0; j < SgTypedefSymbol::pool_size; j++)
154320 : {
154321 : // This is indexing the STL vector of C/C++ style arrays as a doubly
154322 : // indexed array access. It is OK since we have leveraged the semantics
154323 : // of STL vector memory as contigous and cast the memory as an array
154324 : // of arrays to use the 2D array indexing. Hope this is not confusing,
154325 : // but it s very fast as an implementation.
154326 4000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
154327 : {
154328 1719 : count++;
154329 : }
154330 : }
154331 : }
154332 : }
154333 :
154334 :
154335 :
154336 4 : return count;
154337 : }
154338 :
154339 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
154340 : // using values that overflow signed values of int.
154341 : size_t
154342 0 : SgTypedefSymbol::memoryUsage()
154343 : {
154344 : // This function is required because we need the class name as a type when we call sizeof
154345 : // There might be another way to implement this if we have a traversal that only called a
154346 : // representative object (one call for each type of Sage IIIIR node).
154347 0 : size_t memory = numberOfNodes() * sizeof(SgTypedefSymbol);
154348 :
154349 0 : return memory;
154350 : }
154351 :
154352 : /* #line 154353 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
154353 :
154354 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
154355 : void
154356 5342 : SgTemplateTypedefSymbol::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
154357 : {
154358 : // This function traverses the memory pool for only a specific IR node
154359 : // and calls the visit function of the input class execute a traversal
154360 : // similar to the style of the attribute based traversals within ROSE.
154361 : // This traversal will visit ALL nodes of the AST where as the other
154362 : // attribute based traversals visit only the embedded tree within the AST.
154363 :
154364 : // Initialize array to the address of the first element of the STL vector
154365 : // (which is guaranteed to be contiguous storage).
154366 : // SgTemplateTypedefSymbol objectArray [] = *(Memory_Block_List.begin());
154367 5342 : if (SgTemplateTypedefSymbol::pools.empty() == false)
154368 : {
154369 : // Generate an array of memory pools
154370 138 : SgTemplateTypedefSymbol** objectArray = (SgTemplateTypedefSymbol**) &(SgTemplateTypedefSymbol::pools[0]);
154371 :
154372 : // Build a local variable for better performance
154373 138 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
154374 : #if 0
154375 : // Iterate over the memory pools
154376 : for (unsigned int i=0; i < SgTemplateTypedefSymbol::pools.size(); i++)
154377 : {
154378 : // objectArray[i] is a single memory pool
154379 : for (int j=0; j < SgTemplateTypedefSymbol::pool_size; j++)
154380 : {
154381 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
154382 : {
154383 : traversal.visit(&(objectArray[i][j]));
154384 : }
154385 : }
154386 : }
154387 : #else
154388 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
154389 : // compute the list first and then call the visit function on each list element.
154390 :
154391 : // printf ("Inside of SgTemplateTypedefSymbol::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
154392 :
154393 276 : std::vector<SgTemplateTypedefSymbol*> nodeList;
154394 :
154395 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
154396 276 : for (unsigned int i=0; i < SgTemplateTypedefSymbol::pools.size(); i++)
154397 : {
154398 : // objectArray[i] is a single memory pool
154399 276138 : for (unsigned j=0; j < SgTemplateTypedefSymbol::pool_size; j++)
154400 : {
154401 276000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
154402 : {
154403 20850 : nodeList.push_back(&(objectArray[i][j]));
154404 : }
154405 : }
154406 : }
154407 :
154408 : // Iterate over the saved list
154409 138 : size_t nodeListSize = nodeList.size();
154410 20988 : for (size_t i=0; i < nodeListSize; i++)
154411 : {
154412 20850 : ROSE_ASSERT(nodeList[i] != NULL);
154413 : #if 0
154414 : traversal.visit(nodeList[i]);
154415 : #else
154416 20850 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
154417 : {
154418 20850 : traversal.visit(nodeList[i]);
154419 : }
154420 : #endif
154421 : }
154422 : #endif
154423 : }
154424 :
154425 : // This should not be required since all previously static data members are
154426 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
154427 :
154428 5342 : }
154429 :
154430 :
154431 : void
154432 194 : SgTemplateTypedefSymbol::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
154433 : {
154434 : // This function traverses the memory pool for an IR node and
154435 : // calls the function to execute the visitor object.
154436 :
154437 : // Initialize array to the address of the first element of the STL vector
154438 : // (which is guarenteed to be contiguous storage).
154439 : // SgTemplateTypedefSymbol objectArray [] = *(Memory_Block_List.begin());
154440 194 : if (SgTemplateTypedefSymbol::pools.empty() == false)
154441 : {
154442 : // Generate an array of memory pools
154443 137 : SgTemplateTypedefSymbol** objectArray = (SgTemplateTypedefSymbol**) &(SgTemplateTypedefSymbol::pools[0]);
154444 :
154445 : // Build a local variable for better performance
154446 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
154447 :
154448 : // Iterate over the memory pools
154449 274 : for (unsigned int i=0; i < SgTemplateTypedefSymbol::pools.size(); i++)
154450 : {
154451 : // objectArray[i] is a single memory pool
154452 274137 : for (unsigned j=0; j < SgTemplateTypedefSymbol::pool_size; j++)
154453 : {
154454 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
154455 : {
154456 : // printf ("Found a valid SgTemplateTypedefSymbol object in the memory pool %d at position %d \n",i,j);
154457 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
154458 21957 : objectArray[i][j].executeVisitorMemberFunction(visitor);
154459 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
154460 : }
154461 : else
154462 : {
154463 : // printf ("Found a INVALID SgTemplateTypedefSymbol object in the memory pool \n");
154464 : }
154465 : }
154466 : }
154467 : }
154468 :
154469 : // This should not be required since all previously static data members are
154470 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
154471 :
154472 194 : }
154473 :
154474 : void
154475 0 : SgTemplateTypedefSymbol::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
154476 : {
154477 : // This function visits only a single IR node of the memory pool.
154478 : // it is typically called once for each type of IR node within
154479 : // the automatically generated function: traverseRepresentativeNodes().
154480 :
154481 : // Initialize array to the address of the first element of the STL vector
154482 : // (which is guarenteed to be contiguous storage).
154483 : // SgTemplateTypedefSymbol objectArray [] = *(Memory_Block_List.begin());
154484 0 : if (SgTemplateTypedefSymbol::pools.empty() == false)
154485 : {
154486 : // Generate an array of memory pools
154487 0 : SgTemplateTypedefSymbol** objectArray = (SgTemplateTypedefSymbol**) &(SgTemplateTypedefSymbol::pools[0]);
154488 :
154489 : // Build a local variable for better performance
154490 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
154491 :
154492 : // Iterate over the memory pools
154493 0 : bool done = false;
154494 0 : unsigned i=0;
154495 :
154496 : // find the first valid IR node, call visit function, and then leave
154497 0 : while ( done == false && i < SgTemplateTypedefSymbol::pools.size() )
154498 : {
154499 : // objectArray[i] is a single memory pool
154500 : unsigned j=0;
154501 0 : while (done == false && j < SgTemplateTypedefSymbol::pool_size)
154502 : {
154503 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
154504 : {
154505 0 : traversal.visit(&(objectArray[i][j]));
154506 0 : done = true;
154507 : }
154508 0 : j++;
154509 : }
154510 0 : i++;
154511 : }
154512 :
154513 : #if 0
154514 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
154515 : if (done == false)
154516 : {
154517 : printf ("No representative for SgTemplateTypedefSymbol found in memory pools \n");
154518 : }
154519 : #endif
154520 : }
154521 0 : }
154522 :
154523 :
154524 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
154525 : // using values that overflow signed values of int.
154526 : size_t
154527 4 : SgTemplateTypedefSymbol::numberOfNodes()
154528 : {
154529 : // This function traverses the memory pool for an IR node and
154530 : // counts the number of IR nodes of a particular Sage III IR
154531 : // nodes type.
154532 :
154533 4 : size_t count = 0;
154534 4 : if (SgTemplateTypedefSymbol::pools.empty() == false)
154535 : {
154536 : // Generate an array of memory pools (this is actually a STL vector,
154537 : // but it is contiguious, so OK to treat this way).
154538 1 : SgTemplateTypedefSymbol** objectArray = (SgTemplateTypedefSymbol**) &(SgTemplateTypedefSymbol::pools[0]);
154539 :
154540 : // Build a local variable for better performance (make it a loop invariant variable).
154541 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
154542 :
154543 : // Iterate over all of the memory pools for this IR node.
154544 2 : for (unsigned int i=0; i < SgTemplateTypedefSymbol::pools.size(); i++)
154545 : {
154546 : // objectArray[i] is a single memory pool, iterate over all the
154547 : // IR nodes and only count those that are valid IR nodes used in
154548 : // the AST (i.e. allocated IR nodes).
154549 2001 : for (unsigned j=0; j < SgTemplateTypedefSymbol::pool_size; j++)
154550 : {
154551 : // This is indexing the STL vector of C/C++ style arrays as a doubly
154552 : // indexed array access. It is OK since we have leveraged the semantics
154553 : // of STL vector memory as contigous and cast the memory as an array
154554 : // of arrays to use the 2D array indexing. Hope this is not confusing,
154555 : // but it s very fast as an implementation.
154556 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
154557 : {
154558 160 : count++;
154559 : }
154560 : }
154561 : }
154562 : }
154563 :
154564 :
154565 :
154566 4 : return count;
154567 : }
154568 :
154569 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
154570 : // using values that overflow signed values of int.
154571 : size_t
154572 0 : SgTemplateTypedefSymbol::memoryUsage()
154573 : {
154574 : // This function is required because we need the class name as a type when we call sizeof
154575 : // There might be another way to implement this if we have a traversal that only called a
154576 : // representative object (one call for each type of Sage IIIIR node).
154577 0 : size_t memory = numberOfNodes() * sizeof(SgTemplateTypedefSymbol);
154578 :
154579 0 : return memory;
154580 : }
154581 :
154582 : /* #line 154583 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
154583 :
154584 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
154585 : void
154586 5342 : SgLabelSymbol::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
154587 : {
154588 : // This function traverses the memory pool for only a specific IR node
154589 : // and calls the visit function of the input class execute a traversal
154590 : // similar to the style of the attribute based traversals within ROSE.
154591 : // This traversal will visit ALL nodes of the AST where as the other
154592 : // attribute based traversals visit only the embedded tree within the AST.
154593 :
154594 : // Initialize array to the address of the first element of the STL vector
154595 : // (which is guaranteed to be contiguous storage).
154596 : // SgLabelSymbol objectArray [] = *(Memory_Block_List.begin());
154597 5342 : if (SgLabelSymbol::pools.empty() == false)
154598 : {
154599 : // Generate an array of memory pools
154600 50 : SgLabelSymbol** objectArray = (SgLabelSymbol**) &(SgLabelSymbol::pools[0]);
154601 :
154602 : // Build a local variable for better performance
154603 50 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
154604 : #if 0
154605 : // Iterate over the memory pools
154606 : for (unsigned int i=0; i < SgLabelSymbol::pools.size(); i++)
154607 : {
154608 : // objectArray[i] is a single memory pool
154609 : for (int j=0; j < SgLabelSymbol::pool_size; j++)
154610 : {
154611 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
154612 : {
154613 : traversal.visit(&(objectArray[i][j]));
154614 : }
154615 : }
154616 : }
154617 : #else
154618 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
154619 : // compute the list first and then call the visit function on each list element.
154620 :
154621 : // printf ("Inside of SgLabelSymbol::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
154622 :
154623 100 : std::vector<SgLabelSymbol*> nodeList;
154624 :
154625 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
154626 100 : for (unsigned int i=0; i < SgLabelSymbol::pools.size(); i++)
154627 : {
154628 : // objectArray[i] is a single memory pool
154629 100050 : for (unsigned j=0; j < SgLabelSymbol::pool_size; j++)
154630 : {
154631 100000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
154632 : {
154633 107 : nodeList.push_back(&(objectArray[i][j]));
154634 : }
154635 : }
154636 : }
154637 :
154638 : // Iterate over the saved list
154639 50 : size_t nodeListSize = nodeList.size();
154640 157 : for (size_t i=0; i < nodeListSize; i++)
154641 : {
154642 107 : ROSE_ASSERT(nodeList[i] != NULL);
154643 : #if 0
154644 : traversal.visit(nodeList[i]);
154645 : #else
154646 107 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
154647 : {
154648 107 : traversal.visit(nodeList[i]);
154649 : }
154650 : #endif
154651 : }
154652 : #endif
154653 : }
154654 :
154655 : // This should not be required since all previously static data members are
154656 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
154657 :
154658 5342 : }
154659 :
154660 :
154661 : void
154662 194 : SgLabelSymbol::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
154663 : {
154664 : // This function traverses the memory pool for an IR node and
154665 : // calls the function to execute the visitor object.
154666 :
154667 : // Initialize array to the address of the first element of the STL vector
154668 : // (which is guarenteed to be contiguous storage).
154669 : // SgLabelSymbol objectArray [] = *(Memory_Block_List.begin());
154670 194 : if (SgLabelSymbol::pools.empty() == false)
154671 : {
154672 : // Generate an array of memory pools
154673 18 : SgLabelSymbol** objectArray = (SgLabelSymbol**) &(SgLabelSymbol::pools[0]);
154674 :
154675 : // Build a local variable for better performance
154676 18 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
154677 :
154678 : // Iterate over the memory pools
154679 36 : for (unsigned int i=0; i < SgLabelSymbol::pools.size(); i++)
154680 : {
154681 : // objectArray[i] is a single memory pool
154682 36018 : for (unsigned j=0; j < SgLabelSymbol::pool_size; j++)
154683 : {
154684 36000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
154685 : {
154686 : // printf ("Found a valid SgLabelSymbol object in the memory pool %d at position %d \n",i,j);
154687 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
154688 36 : objectArray[i][j].executeVisitorMemberFunction(visitor);
154689 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
154690 : }
154691 : else
154692 : {
154693 : // printf ("Found a INVALID SgLabelSymbol object in the memory pool \n");
154694 : }
154695 : }
154696 : }
154697 : }
154698 :
154699 : // This should not be required since all previously static data members are
154700 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
154701 :
154702 194 : }
154703 :
154704 : void
154705 0 : SgLabelSymbol::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
154706 : {
154707 : // This function visits only a single IR node of the memory pool.
154708 : // it is typically called once for each type of IR node within
154709 : // the automatically generated function: traverseRepresentativeNodes().
154710 :
154711 : // Initialize array to the address of the first element of the STL vector
154712 : // (which is guarenteed to be contiguous storage).
154713 : // SgLabelSymbol objectArray [] = *(Memory_Block_List.begin());
154714 0 : if (SgLabelSymbol::pools.empty() == false)
154715 : {
154716 : // Generate an array of memory pools
154717 0 : SgLabelSymbol** objectArray = (SgLabelSymbol**) &(SgLabelSymbol::pools[0]);
154718 :
154719 : // Build a local variable for better performance
154720 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
154721 :
154722 : // Iterate over the memory pools
154723 0 : bool done = false;
154724 0 : unsigned i=0;
154725 :
154726 : // find the first valid IR node, call visit function, and then leave
154727 0 : while ( done == false && i < SgLabelSymbol::pools.size() )
154728 : {
154729 : // objectArray[i] is a single memory pool
154730 : unsigned j=0;
154731 0 : while (done == false && j < SgLabelSymbol::pool_size)
154732 : {
154733 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
154734 : {
154735 0 : traversal.visit(&(objectArray[i][j]));
154736 0 : done = true;
154737 : }
154738 0 : j++;
154739 : }
154740 0 : i++;
154741 : }
154742 :
154743 : #if 0
154744 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
154745 : if (done == false)
154746 : {
154747 : printf ("No representative for SgLabelSymbol found in memory pools \n");
154748 : }
154749 : #endif
154750 : }
154751 0 : }
154752 :
154753 :
154754 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
154755 : // using values that overflow signed values of int.
154756 : size_t
154757 4 : SgLabelSymbol::numberOfNodes()
154758 : {
154759 : // This function traverses the memory pool for an IR node and
154760 : // counts the number of IR nodes of a particular Sage III IR
154761 : // nodes type.
154762 :
154763 4 : size_t count = 0;
154764 4 : if (SgLabelSymbol::pools.empty() == false)
154765 : {
154766 : // Generate an array of memory pools (this is actually a STL vector,
154767 : // but it is contiguious, so OK to treat this way).
154768 0 : SgLabelSymbol** objectArray = (SgLabelSymbol**) &(SgLabelSymbol::pools[0]);
154769 :
154770 : // Build a local variable for better performance (make it a loop invariant variable).
154771 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
154772 :
154773 : // Iterate over all of the memory pools for this IR node.
154774 0 : for (unsigned int i=0; i < SgLabelSymbol::pools.size(); i++)
154775 : {
154776 : // objectArray[i] is a single memory pool, iterate over all the
154777 : // IR nodes and only count those that are valid IR nodes used in
154778 : // the AST (i.e. allocated IR nodes).
154779 0 : for (unsigned j=0; j < SgLabelSymbol::pool_size; j++)
154780 : {
154781 : // This is indexing the STL vector of C/C++ style arrays as a doubly
154782 : // indexed array access. It is OK since we have leveraged the semantics
154783 : // of STL vector memory as contigous and cast the memory as an array
154784 : // of arrays to use the 2D array indexing. Hope this is not confusing,
154785 : // but it s very fast as an implementation.
154786 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
154787 : {
154788 0 : count++;
154789 : }
154790 : }
154791 : }
154792 : }
154793 :
154794 :
154795 :
154796 4 : return count;
154797 : }
154798 :
154799 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
154800 : // using values that overflow signed values of int.
154801 : size_t
154802 0 : SgLabelSymbol::memoryUsage()
154803 : {
154804 : // This function is required because we need the class name as a type when we call sizeof
154805 : // There might be another way to implement this if we have a traversal that only called a
154806 : // representative object (one call for each type of Sage IIIIR node).
154807 0 : size_t memory = numberOfNodes() * sizeof(SgLabelSymbol);
154808 :
154809 0 : return memory;
154810 : }
154811 :
154812 : /* #line 154813 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
154813 :
154814 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
154815 : void
154816 5342 : SgDefaultSymbol::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
154817 : {
154818 : // This function traverses the memory pool for only a specific IR node
154819 : // and calls the visit function of the input class execute a traversal
154820 : // similar to the style of the attribute based traversals within ROSE.
154821 : // This traversal will visit ALL nodes of the AST where as the other
154822 : // attribute based traversals visit only the embedded tree within the AST.
154823 :
154824 : // Initialize array to the address of the first element of the STL vector
154825 : // (which is guaranteed to be contiguous storage).
154826 : // SgDefaultSymbol objectArray [] = *(Memory_Block_List.begin());
154827 5342 : if (SgDefaultSymbol::pools.empty() == false)
154828 : {
154829 : // Generate an array of memory pools
154830 0 : SgDefaultSymbol** objectArray = (SgDefaultSymbol**) &(SgDefaultSymbol::pools[0]);
154831 :
154832 : // Build a local variable for better performance
154833 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
154834 : #if 0
154835 : // Iterate over the memory pools
154836 : for (unsigned int i=0; i < SgDefaultSymbol::pools.size(); i++)
154837 : {
154838 : // objectArray[i] is a single memory pool
154839 : for (int j=0; j < SgDefaultSymbol::pool_size; j++)
154840 : {
154841 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
154842 : {
154843 : traversal.visit(&(objectArray[i][j]));
154844 : }
154845 : }
154846 : }
154847 : #else
154848 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
154849 : // compute the list first and then call the visit function on each list element.
154850 :
154851 : // printf ("Inside of SgDefaultSymbol::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
154852 :
154853 0 : std::vector<SgDefaultSymbol*> nodeList;
154854 :
154855 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
154856 0 : for (unsigned int i=0; i < SgDefaultSymbol::pools.size(); i++)
154857 : {
154858 : // objectArray[i] is a single memory pool
154859 0 : for (unsigned j=0; j < SgDefaultSymbol::pool_size; j++)
154860 : {
154861 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
154862 : {
154863 0 : nodeList.push_back(&(objectArray[i][j]));
154864 : }
154865 : }
154866 : }
154867 :
154868 : // Iterate over the saved list
154869 0 : size_t nodeListSize = nodeList.size();
154870 0 : for (size_t i=0; i < nodeListSize; i++)
154871 : {
154872 0 : ROSE_ASSERT(nodeList[i] != NULL);
154873 : #if 0
154874 : traversal.visit(nodeList[i]);
154875 : #else
154876 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
154877 : {
154878 0 : traversal.visit(nodeList[i]);
154879 : }
154880 : #endif
154881 : }
154882 : #endif
154883 : }
154884 :
154885 : // This should not be required since all previously static data members are
154886 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
154887 :
154888 5342 : }
154889 :
154890 :
154891 : void
154892 194 : SgDefaultSymbol::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
154893 : {
154894 : // This function traverses the memory pool for an IR node and
154895 : // calls the function to execute the visitor object.
154896 :
154897 : // Initialize array to the address of the first element of the STL vector
154898 : // (which is guarenteed to be contiguous storage).
154899 : // SgDefaultSymbol objectArray [] = *(Memory_Block_List.begin());
154900 194 : if (SgDefaultSymbol::pools.empty() == false)
154901 : {
154902 : // Generate an array of memory pools
154903 0 : SgDefaultSymbol** objectArray = (SgDefaultSymbol**) &(SgDefaultSymbol::pools[0]);
154904 :
154905 : // Build a local variable for better performance
154906 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
154907 :
154908 : // Iterate over the memory pools
154909 0 : for (unsigned int i=0; i < SgDefaultSymbol::pools.size(); i++)
154910 : {
154911 : // objectArray[i] is a single memory pool
154912 0 : for (unsigned j=0; j < SgDefaultSymbol::pool_size; j++)
154913 : {
154914 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
154915 : {
154916 : // printf ("Found a valid SgDefaultSymbol object in the memory pool %d at position %d \n",i,j);
154917 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
154918 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
154919 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
154920 : }
154921 : else
154922 : {
154923 : // printf ("Found a INVALID SgDefaultSymbol object in the memory pool \n");
154924 : }
154925 : }
154926 : }
154927 : }
154928 :
154929 : // This should not be required since all previously static data members are
154930 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
154931 :
154932 194 : }
154933 :
154934 : void
154935 0 : SgDefaultSymbol::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
154936 : {
154937 : // This function visits only a single IR node of the memory pool.
154938 : // it is typically called once for each type of IR node within
154939 : // the automatically generated function: traverseRepresentativeNodes().
154940 :
154941 : // Initialize array to the address of the first element of the STL vector
154942 : // (which is guarenteed to be contiguous storage).
154943 : // SgDefaultSymbol objectArray [] = *(Memory_Block_List.begin());
154944 0 : if (SgDefaultSymbol::pools.empty() == false)
154945 : {
154946 : // Generate an array of memory pools
154947 0 : SgDefaultSymbol** objectArray = (SgDefaultSymbol**) &(SgDefaultSymbol::pools[0]);
154948 :
154949 : // Build a local variable for better performance
154950 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
154951 :
154952 : // Iterate over the memory pools
154953 0 : bool done = false;
154954 0 : unsigned i=0;
154955 :
154956 : // find the first valid IR node, call visit function, and then leave
154957 0 : while ( done == false && i < SgDefaultSymbol::pools.size() )
154958 : {
154959 : // objectArray[i] is a single memory pool
154960 : unsigned j=0;
154961 0 : while (done == false && j < SgDefaultSymbol::pool_size)
154962 : {
154963 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
154964 : {
154965 0 : traversal.visit(&(objectArray[i][j]));
154966 0 : done = true;
154967 : }
154968 0 : j++;
154969 : }
154970 0 : i++;
154971 : }
154972 :
154973 : #if 0
154974 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
154975 : if (done == false)
154976 : {
154977 : printf ("No representative for SgDefaultSymbol found in memory pools \n");
154978 : }
154979 : #endif
154980 : }
154981 0 : }
154982 :
154983 :
154984 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
154985 : // using values that overflow signed values of int.
154986 : size_t
154987 4 : SgDefaultSymbol::numberOfNodes()
154988 : {
154989 : // This function traverses the memory pool for an IR node and
154990 : // counts the number of IR nodes of a particular Sage III IR
154991 : // nodes type.
154992 :
154993 4 : size_t count = 0;
154994 4 : if (SgDefaultSymbol::pools.empty() == false)
154995 : {
154996 : // Generate an array of memory pools (this is actually a STL vector,
154997 : // but it is contiguious, so OK to treat this way).
154998 0 : SgDefaultSymbol** objectArray = (SgDefaultSymbol**) &(SgDefaultSymbol::pools[0]);
154999 :
155000 : // Build a local variable for better performance (make it a loop invariant variable).
155001 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
155002 :
155003 : // Iterate over all of the memory pools for this IR node.
155004 0 : for (unsigned int i=0; i < SgDefaultSymbol::pools.size(); i++)
155005 : {
155006 : // objectArray[i] is a single memory pool, iterate over all the
155007 : // IR nodes and only count those that are valid IR nodes used in
155008 : // the AST (i.e. allocated IR nodes).
155009 0 : for (unsigned j=0; j < SgDefaultSymbol::pool_size; j++)
155010 : {
155011 : // This is indexing the STL vector of C/C++ style arrays as a doubly
155012 : // indexed array access. It is OK since we have leveraged the semantics
155013 : // of STL vector memory as contigous and cast the memory as an array
155014 : // of arrays to use the 2D array indexing. Hope this is not confusing,
155015 : // but it s very fast as an implementation.
155016 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
155017 : {
155018 0 : count++;
155019 : }
155020 : }
155021 : }
155022 : }
155023 :
155024 :
155025 :
155026 4 : return count;
155027 : }
155028 :
155029 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
155030 : // using values that overflow signed values of int.
155031 : size_t
155032 0 : SgDefaultSymbol::memoryUsage()
155033 : {
155034 : // This function is required because we need the class name as a type when we call sizeof
155035 : // There might be another way to implement this if we have a traversal that only called a
155036 : // representative object (one call for each type of Sage IIIIR node).
155037 0 : size_t memory = numberOfNodes() * sizeof(SgDefaultSymbol);
155038 :
155039 0 : return memory;
155040 : }
155041 :
155042 : /* #line 155043 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
155043 :
155044 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
155045 : void
155046 5342 : SgNamespaceSymbol::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
155047 : {
155048 : // This function traverses the memory pool for only a specific IR node
155049 : // and calls the visit function of the input class execute a traversal
155050 : // similar to the style of the attribute based traversals within ROSE.
155051 : // This traversal will visit ALL nodes of the AST where as the other
155052 : // attribute based traversals visit only the embedded tree within the AST.
155053 :
155054 : // Initialize array to the address of the first element of the STL vector
155055 : // (which is guaranteed to be contiguous storage).
155056 : // SgNamespaceSymbol objectArray [] = *(Memory_Block_List.begin());
155057 5342 : if (SgNamespaceSymbol::pools.empty() == false)
155058 : {
155059 : // Generate an array of memory pools
155060 208 : SgNamespaceSymbol** objectArray = (SgNamespaceSymbol**) &(SgNamespaceSymbol::pools[0]);
155061 :
155062 : // Build a local variable for better performance
155063 208 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
155064 : #if 0
155065 : // Iterate over the memory pools
155066 : for (unsigned int i=0; i < SgNamespaceSymbol::pools.size(); i++)
155067 : {
155068 : // objectArray[i] is a single memory pool
155069 : for (int j=0; j < SgNamespaceSymbol::pool_size; j++)
155070 : {
155071 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
155072 : {
155073 : traversal.visit(&(objectArray[i][j]));
155074 : }
155075 : }
155076 : }
155077 : #else
155078 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
155079 : // compute the list first and then call the visit function on each list element.
155080 :
155081 : // printf ("Inside of SgNamespaceSymbol::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
155082 :
155083 416 : std::vector<SgNamespaceSymbol*> nodeList;
155084 :
155085 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
155086 416 : for (unsigned int i=0; i < SgNamespaceSymbol::pools.size(); i++)
155087 : {
155088 : // objectArray[i] is a single memory pool
155089 416208 : for (unsigned j=0; j < SgNamespaceSymbol::pool_size; j++)
155090 : {
155091 416000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
155092 : {
155093 2068 : nodeList.push_back(&(objectArray[i][j]));
155094 : }
155095 : }
155096 : }
155097 :
155098 : // Iterate over the saved list
155099 208 : size_t nodeListSize = nodeList.size();
155100 2276 : for (size_t i=0; i < nodeListSize; i++)
155101 : {
155102 2068 : ROSE_ASSERT(nodeList[i] != NULL);
155103 : #if 0
155104 : traversal.visit(nodeList[i]);
155105 : #else
155106 2068 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
155107 : {
155108 2068 : traversal.visit(nodeList[i]);
155109 : }
155110 : #endif
155111 : }
155112 : #endif
155113 : }
155114 :
155115 : // This should not be required since all previously static data members are
155116 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
155117 :
155118 5342 : }
155119 :
155120 :
155121 : void
155122 194 : SgNamespaceSymbol::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
155123 : {
155124 : // This function traverses the memory pool for an IR node and
155125 : // calls the function to execute the visitor object.
155126 :
155127 : // Initialize array to the address of the first element of the STL vector
155128 : // (which is guarenteed to be contiguous storage).
155129 : // SgNamespaceSymbol objectArray [] = *(Memory_Block_List.begin());
155130 194 : if (SgNamespaceSymbol::pools.empty() == false)
155131 : {
155132 : // Generate an array of memory pools
155133 137 : SgNamespaceSymbol** objectArray = (SgNamespaceSymbol**) &(SgNamespaceSymbol::pools[0]);
155134 :
155135 : // Build a local variable for better performance
155136 137 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
155137 :
155138 : // Iterate over the memory pools
155139 274 : for (unsigned int i=0; i < SgNamespaceSymbol::pools.size(); i++)
155140 : {
155141 : // objectArray[i] is a single memory pool
155142 274137 : for (unsigned j=0; j < SgNamespaceSymbol::pool_size; j++)
155143 : {
155144 274000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
155145 : {
155146 : // printf ("Found a valid SgNamespaceSymbol object in the memory pool %d at position %d \n",i,j);
155147 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
155148 1918 : objectArray[i][j].executeVisitorMemberFunction(visitor);
155149 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
155150 : }
155151 : else
155152 : {
155153 : // printf ("Found a INVALID SgNamespaceSymbol object in the memory pool \n");
155154 : }
155155 : }
155156 : }
155157 : }
155158 :
155159 : // This should not be required since all previously static data members are
155160 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
155161 :
155162 194 : }
155163 :
155164 : void
155165 0 : SgNamespaceSymbol::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
155166 : {
155167 : // This function visits only a single IR node of the memory pool.
155168 : // it is typically called once for each type of IR node within
155169 : // the automatically generated function: traverseRepresentativeNodes().
155170 :
155171 : // Initialize array to the address of the first element of the STL vector
155172 : // (which is guarenteed to be contiguous storage).
155173 : // SgNamespaceSymbol objectArray [] = *(Memory_Block_List.begin());
155174 0 : if (SgNamespaceSymbol::pools.empty() == false)
155175 : {
155176 : // Generate an array of memory pools
155177 0 : SgNamespaceSymbol** objectArray = (SgNamespaceSymbol**) &(SgNamespaceSymbol::pools[0]);
155178 :
155179 : // Build a local variable for better performance
155180 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
155181 :
155182 : // Iterate over the memory pools
155183 0 : bool done = false;
155184 0 : unsigned i=0;
155185 :
155186 : // find the first valid IR node, call visit function, and then leave
155187 0 : while ( done == false && i < SgNamespaceSymbol::pools.size() )
155188 : {
155189 : // objectArray[i] is a single memory pool
155190 : unsigned j=0;
155191 0 : while (done == false && j < SgNamespaceSymbol::pool_size)
155192 : {
155193 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
155194 : {
155195 0 : traversal.visit(&(objectArray[i][j]));
155196 0 : done = true;
155197 : }
155198 0 : j++;
155199 : }
155200 0 : i++;
155201 : }
155202 :
155203 : #if 0
155204 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
155205 : if (done == false)
155206 : {
155207 : printf ("No representative for SgNamespaceSymbol found in memory pools \n");
155208 : }
155209 : #endif
155210 : }
155211 0 : }
155212 :
155213 :
155214 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
155215 : // using values that overflow signed values of int.
155216 : size_t
155217 4 : SgNamespaceSymbol::numberOfNodes()
155218 : {
155219 : // This function traverses the memory pool for an IR node and
155220 : // counts the number of IR nodes of a particular Sage III IR
155221 : // nodes type.
155222 :
155223 4 : size_t count = 0;
155224 4 : if (SgNamespaceSymbol::pools.empty() == false)
155225 : {
155226 : // Generate an array of memory pools (this is actually a STL vector,
155227 : // but it is contiguious, so OK to treat this way).
155228 1 : SgNamespaceSymbol** objectArray = (SgNamespaceSymbol**) &(SgNamespaceSymbol::pools[0]);
155229 :
155230 : // Build a local variable for better performance (make it a loop invariant variable).
155231 1 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
155232 :
155233 : // Iterate over all of the memory pools for this IR node.
155234 2 : for (unsigned int i=0; i < SgNamespaceSymbol::pools.size(); i++)
155235 : {
155236 : // objectArray[i] is a single memory pool, iterate over all the
155237 : // IR nodes and only count those that are valid IR nodes used in
155238 : // the AST (i.e. allocated IR nodes).
155239 2001 : for (unsigned j=0; j < SgNamespaceSymbol::pool_size; j++)
155240 : {
155241 : // This is indexing the STL vector of C/C++ style arrays as a doubly
155242 : // indexed array access. It is OK since we have leveraged the semantics
155243 : // of STL vector memory as contigous and cast the memory as an array
155244 : // of arrays to use the 2D array indexing. Hope this is not confusing,
155245 : // but it s very fast as an implementation.
155246 2000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
155247 : {
155248 14 : count++;
155249 : }
155250 : }
155251 : }
155252 : }
155253 :
155254 :
155255 :
155256 4 : return count;
155257 : }
155258 :
155259 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
155260 : // using values that overflow signed values of int.
155261 : size_t
155262 0 : SgNamespaceSymbol::memoryUsage()
155263 : {
155264 : // This function is required because we need the class name as a type when we call sizeof
155265 : // There might be another way to implement this if we have a traversal that only called a
155266 : // representative object (one call for each type of Sage IIIIR node).
155267 0 : size_t memory = numberOfNodes() * sizeof(SgNamespaceSymbol);
155268 :
155269 0 : return memory;
155270 : }
155271 :
155272 : /* #line 155273 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
155273 :
155274 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
155275 : void
155276 5342 : SgIntrinsicSymbol::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
155277 : {
155278 : // This function traverses the memory pool for only a specific IR node
155279 : // and calls the visit function of the input class execute a traversal
155280 : // similar to the style of the attribute based traversals within ROSE.
155281 : // This traversal will visit ALL nodes of the AST where as the other
155282 : // attribute based traversals visit only the embedded tree within the AST.
155283 :
155284 : // Initialize array to the address of the first element of the STL vector
155285 : // (which is guaranteed to be contiguous storage).
155286 : // SgIntrinsicSymbol objectArray [] = *(Memory_Block_List.begin());
155287 5342 : if (SgIntrinsicSymbol::pools.empty() == false)
155288 : {
155289 : // Generate an array of memory pools
155290 0 : SgIntrinsicSymbol** objectArray = (SgIntrinsicSymbol**) &(SgIntrinsicSymbol::pools[0]);
155291 :
155292 : // Build a local variable for better performance
155293 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
155294 : #if 0
155295 : // Iterate over the memory pools
155296 : for (unsigned int i=0; i < SgIntrinsicSymbol::pools.size(); i++)
155297 : {
155298 : // objectArray[i] is a single memory pool
155299 : for (int j=0; j < SgIntrinsicSymbol::pool_size; j++)
155300 : {
155301 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
155302 : {
155303 : traversal.visit(&(objectArray[i][j]));
155304 : }
155305 : }
155306 : }
155307 : #else
155308 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
155309 : // compute the list first and then call the visit function on each list element.
155310 :
155311 : // printf ("Inside of SgIntrinsicSymbol::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
155312 :
155313 0 : std::vector<SgIntrinsicSymbol*> nodeList;
155314 :
155315 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
155316 0 : for (unsigned int i=0; i < SgIntrinsicSymbol::pools.size(); i++)
155317 : {
155318 : // objectArray[i] is a single memory pool
155319 0 : for (unsigned j=0; j < SgIntrinsicSymbol::pool_size; j++)
155320 : {
155321 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
155322 : {
155323 0 : nodeList.push_back(&(objectArray[i][j]));
155324 : }
155325 : }
155326 : }
155327 :
155328 : // Iterate over the saved list
155329 0 : size_t nodeListSize = nodeList.size();
155330 0 : for (size_t i=0; i < nodeListSize; i++)
155331 : {
155332 0 : ROSE_ASSERT(nodeList[i] != NULL);
155333 : #if 0
155334 : traversal.visit(nodeList[i]);
155335 : #else
155336 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
155337 : {
155338 0 : traversal.visit(nodeList[i]);
155339 : }
155340 : #endif
155341 : }
155342 : #endif
155343 : }
155344 :
155345 : // This should not be required since all previously static data members are
155346 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
155347 :
155348 5342 : }
155349 :
155350 :
155351 : void
155352 194 : SgIntrinsicSymbol::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
155353 : {
155354 : // This function traverses the memory pool for an IR node and
155355 : // calls the function to execute the visitor object.
155356 :
155357 : // Initialize array to the address of the first element of the STL vector
155358 : // (which is guarenteed to be contiguous storage).
155359 : // SgIntrinsicSymbol objectArray [] = *(Memory_Block_List.begin());
155360 194 : if (SgIntrinsicSymbol::pools.empty() == false)
155361 : {
155362 : // Generate an array of memory pools
155363 0 : SgIntrinsicSymbol** objectArray = (SgIntrinsicSymbol**) &(SgIntrinsicSymbol::pools[0]);
155364 :
155365 : // Build a local variable for better performance
155366 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
155367 :
155368 : // Iterate over the memory pools
155369 0 : for (unsigned int i=0; i < SgIntrinsicSymbol::pools.size(); i++)
155370 : {
155371 : // objectArray[i] is a single memory pool
155372 0 : for (unsigned j=0; j < SgIntrinsicSymbol::pool_size; j++)
155373 : {
155374 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
155375 : {
155376 : // printf ("Found a valid SgIntrinsicSymbol object in the memory pool %d at position %d \n",i,j);
155377 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
155378 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
155379 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
155380 : }
155381 : else
155382 : {
155383 : // printf ("Found a INVALID SgIntrinsicSymbol object in the memory pool \n");
155384 : }
155385 : }
155386 : }
155387 : }
155388 :
155389 : // This should not be required since all previously static data members are
155390 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
155391 :
155392 194 : }
155393 :
155394 : void
155395 0 : SgIntrinsicSymbol::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
155396 : {
155397 : // This function visits only a single IR node of the memory pool.
155398 : // it is typically called once for each type of IR node within
155399 : // the automatically generated function: traverseRepresentativeNodes().
155400 :
155401 : // Initialize array to the address of the first element of the STL vector
155402 : // (which is guarenteed to be contiguous storage).
155403 : // SgIntrinsicSymbol objectArray [] = *(Memory_Block_List.begin());
155404 0 : if (SgIntrinsicSymbol::pools.empty() == false)
155405 : {
155406 : // Generate an array of memory pools
155407 0 : SgIntrinsicSymbol** objectArray = (SgIntrinsicSymbol**) &(SgIntrinsicSymbol::pools[0]);
155408 :
155409 : // Build a local variable for better performance
155410 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
155411 :
155412 : // Iterate over the memory pools
155413 0 : bool done = false;
155414 0 : unsigned i=0;
155415 :
155416 : // find the first valid IR node, call visit function, and then leave
155417 0 : while ( done == false && i < SgIntrinsicSymbol::pools.size() )
155418 : {
155419 : // objectArray[i] is a single memory pool
155420 : unsigned j=0;
155421 0 : while (done == false && j < SgIntrinsicSymbol::pool_size)
155422 : {
155423 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
155424 : {
155425 0 : traversal.visit(&(objectArray[i][j]));
155426 0 : done = true;
155427 : }
155428 0 : j++;
155429 : }
155430 0 : i++;
155431 : }
155432 :
155433 : #if 0
155434 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
155435 : if (done == false)
155436 : {
155437 : printf ("No representative for SgIntrinsicSymbol found in memory pools \n");
155438 : }
155439 : #endif
155440 : }
155441 0 : }
155442 :
155443 :
155444 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
155445 : // using values that overflow signed values of int.
155446 : size_t
155447 4 : SgIntrinsicSymbol::numberOfNodes()
155448 : {
155449 : // This function traverses the memory pool for an IR node and
155450 : // counts the number of IR nodes of a particular Sage III IR
155451 : // nodes type.
155452 :
155453 4 : size_t count = 0;
155454 4 : if (SgIntrinsicSymbol::pools.empty() == false)
155455 : {
155456 : // Generate an array of memory pools (this is actually a STL vector,
155457 : // but it is contiguious, so OK to treat this way).
155458 0 : SgIntrinsicSymbol** objectArray = (SgIntrinsicSymbol**) &(SgIntrinsicSymbol::pools[0]);
155459 :
155460 : // Build a local variable for better performance (make it a loop invariant variable).
155461 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
155462 :
155463 : // Iterate over all of the memory pools for this IR node.
155464 0 : for (unsigned int i=0; i < SgIntrinsicSymbol::pools.size(); i++)
155465 : {
155466 : // objectArray[i] is a single memory pool, iterate over all the
155467 : // IR nodes and only count those that are valid IR nodes used in
155468 : // the AST (i.e. allocated IR nodes).
155469 0 : for (unsigned j=0; j < SgIntrinsicSymbol::pool_size; j++)
155470 : {
155471 : // This is indexing the STL vector of C/C++ style arrays as a doubly
155472 : // indexed array access. It is OK since we have leveraged the semantics
155473 : // of STL vector memory as contigous and cast the memory as an array
155474 : // of arrays to use the 2D array indexing. Hope this is not confusing,
155475 : // but it s very fast as an implementation.
155476 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
155477 : {
155478 0 : count++;
155479 : }
155480 : }
155481 : }
155482 : }
155483 :
155484 :
155485 :
155486 4 : return count;
155487 : }
155488 :
155489 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
155490 : // using values that overflow signed values of int.
155491 : size_t
155492 0 : SgIntrinsicSymbol::memoryUsage()
155493 : {
155494 : // This function is required because we need the class name as a type when we call sizeof
155495 : // There might be another way to implement this if we have a traversal that only called a
155496 : // representative object (one call for each type of Sage IIIIR node).
155497 0 : size_t memory = numberOfNodes() * sizeof(SgIntrinsicSymbol);
155498 :
155499 0 : return memory;
155500 : }
155501 :
155502 : /* #line 155503 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
155503 :
155504 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
155505 : void
155506 5342 : SgModuleSymbol::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
155507 : {
155508 : // This function traverses the memory pool for only a specific IR node
155509 : // and calls the visit function of the input class execute a traversal
155510 : // similar to the style of the attribute based traversals within ROSE.
155511 : // This traversal will visit ALL nodes of the AST where as the other
155512 : // attribute based traversals visit only the embedded tree within the AST.
155513 :
155514 : // Initialize array to the address of the first element of the STL vector
155515 : // (which is guaranteed to be contiguous storage).
155516 : // SgModuleSymbol objectArray [] = *(Memory_Block_List.begin());
155517 5342 : if (SgModuleSymbol::pools.empty() == false)
155518 : {
155519 : // Generate an array of memory pools
155520 0 : SgModuleSymbol** objectArray = (SgModuleSymbol**) &(SgModuleSymbol::pools[0]);
155521 :
155522 : // Build a local variable for better performance
155523 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
155524 : #if 0
155525 : // Iterate over the memory pools
155526 : for (unsigned int i=0; i < SgModuleSymbol::pools.size(); i++)
155527 : {
155528 : // objectArray[i] is a single memory pool
155529 : for (int j=0; j < SgModuleSymbol::pool_size; j++)
155530 : {
155531 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
155532 : {
155533 : traversal.visit(&(objectArray[i][j]));
155534 : }
155535 : }
155536 : }
155537 : #else
155538 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
155539 : // compute the list first and then call the visit function on each list element.
155540 :
155541 : // printf ("Inside of SgModuleSymbol::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
155542 :
155543 0 : std::vector<SgModuleSymbol*> nodeList;
155544 :
155545 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
155546 0 : for (unsigned int i=0; i < SgModuleSymbol::pools.size(); i++)
155547 : {
155548 : // objectArray[i] is a single memory pool
155549 0 : for (unsigned j=0; j < SgModuleSymbol::pool_size; j++)
155550 : {
155551 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
155552 : {
155553 0 : nodeList.push_back(&(objectArray[i][j]));
155554 : }
155555 : }
155556 : }
155557 :
155558 : // Iterate over the saved list
155559 0 : size_t nodeListSize = nodeList.size();
155560 0 : for (size_t i=0; i < nodeListSize; i++)
155561 : {
155562 0 : ROSE_ASSERT(nodeList[i] != NULL);
155563 : #if 0
155564 : traversal.visit(nodeList[i]);
155565 : #else
155566 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
155567 : {
155568 0 : traversal.visit(nodeList[i]);
155569 : }
155570 : #endif
155571 : }
155572 : #endif
155573 : }
155574 :
155575 : // This should not be required since all previously static data members are
155576 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
155577 :
155578 5342 : }
155579 :
155580 :
155581 : void
155582 194 : SgModuleSymbol::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
155583 : {
155584 : // This function traverses the memory pool for an IR node and
155585 : // calls the function to execute the visitor object.
155586 :
155587 : // Initialize array to the address of the first element of the STL vector
155588 : // (which is guarenteed to be contiguous storage).
155589 : // SgModuleSymbol objectArray [] = *(Memory_Block_List.begin());
155590 194 : if (SgModuleSymbol::pools.empty() == false)
155591 : {
155592 : // Generate an array of memory pools
155593 0 : SgModuleSymbol** objectArray = (SgModuleSymbol**) &(SgModuleSymbol::pools[0]);
155594 :
155595 : // Build a local variable for better performance
155596 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
155597 :
155598 : // Iterate over the memory pools
155599 0 : for (unsigned int i=0; i < SgModuleSymbol::pools.size(); i++)
155600 : {
155601 : // objectArray[i] is a single memory pool
155602 0 : for (unsigned j=0; j < SgModuleSymbol::pool_size; j++)
155603 : {
155604 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
155605 : {
155606 : // printf ("Found a valid SgModuleSymbol object in the memory pool %d at position %d \n",i,j);
155607 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
155608 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
155609 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
155610 : }
155611 : else
155612 : {
155613 : // printf ("Found a INVALID SgModuleSymbol object in the memory pool \n");
155614 : }
155615 : }
155616 : }
155617 : }
155618 :
155619 : // This should not be required since all previously static data members are
155620 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
155621 :
155622 194 : }
155623 :
155624 : void
155625 0 : SgModuleSymbol::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
155626 : {
155627 : // This function visits only a single IR node of the memory pool.
155628 : // it is typically called once for each type of IR node within
155629 : // the automatically generated function: traverseRepresentativeNodes().
155630 :
155631 : // Initialize array to the address of the first element of the STL vector
155632 : // (which is guarenteed to be contiguous storage).
155633 : // SgModuleSymbol objectArray [] = *(Memory_Block_List.begin());
155634 0 : if (SgModuleSymbol::pools.empty() == false)
155635 : {
155636 : // Generate an array of memory pools
155637 0 : SgModuleSymbol** objectArray = (SgModuleSymbol**) &(SgModuleSymbol::pools[0]);
155638 :
155639 : // Build a local variable for better performance
155640 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
155641 :
155642 : // Iterate over the memory pools
155643 0 : bool done = false;
155644 0 : unsigned i=0;
155645 :
155646 : // find the first valid IR node, call visit function, and then leave
155647 0 : while ( done == false && i < SgModuleSymbol::pools.size() )
155648 : {
155649 : // objectArray[i] is a single memory pool
155650 : unsigned j=0;
155651 0 : while (done == false && j < SgModuleSymbol::pool_size)
155652 : {
155653 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
155654 : {
155655 0 : traversal.visit(&(objectArray[i][j]));
155656 0 : done = true;
155657 : }
155658 0 : j++;
155659 : }
155660 0 : i++;
155661 : }
155662 :
155663 : #if 0
155664 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
155665 : if (done == false)
155666 : {
155667 : printf ("No representative for SgModuleSymbol found in memory pools \n");
155668 : }
155669 : #endif
155670 : }
155671 0 : }
155672 :
155673 :
155674 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
155675 : // using values that overflow signed values of int.
155676 : size_t
155677 4 : SgModuleSymbol::numberOfNodes()
155678 : {
155679 : // This function traverses the memory pool for an IR node and
155680 : // counts the number of IR nodes of a particular Sage III IR
155681 : // nodes type.
155682 :
155683 4 : size_t count = 0;
155684 4 : if (SgModuleSymbol::pools.empty() == false)
155685 : {
155686 : // Generate an array of memory pools (this is actually a STL vector,
155687 : // but it is contiguious, so OK to treat this way).
155688 0 : SgModuleSymbol** objectArray = (SgModuleSymbol**) &(SgModuleSymbol::pools[0]);
155689 :
155690 : // Build a local variable for better performance (make it a loop invariant variable).
155691 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
155692 :
155693 : // Iterate over all of the memory pools for this IR node.
155694 0 : for (unsigned int i=0; i < SgModuleSymbol::pools.size(); i++)
155695 : {
155696 : // objectArray[i] is a single memory pool, iterate over all the
155697 : // IR nodes and only count those that are valid IR nodes used in
155698 : // the AST (i.e. allocated IR nodes).
155699 0 : for (unsigned j=0; j < SgModuleSymbol::pool_size; j++)
155700 : {
155701 : // This is indexing the STL vector of C/C++ style arrays as a doubly
155702 : // indexed array access. It is OK since we have leveraged the semantics
155703 : // of STL vector memory as contigous and cast the memory as an array
155704 : // of arrays to use the 2D array indexing. Hope this is not confusing,
155705 : // but it s very fast as an implementation.
155706 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
155707 : {
155708 0 : count++;
155709 : }
155710 : }
155711 : }
155712 : }
155713 :
155714 :
155715 :
155716 4 : return count;
155717 : }
155718 :
155719 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
155720 : // using values that overflow signed values of int.
155721 : size_t
155722 0 : SgModuleSymbol::memoryUsage()
155723 : {
155724 : // This function is required because we need the class name as a type when we call sizeof
155725 : // There might be another way to implement this if we have a traversal that only called a
155726 : // representative object (one call for each type of Sage IIIIR node).
155727 0 : size_t memory = numberOfNodes() * sizeof(SgModuleSymbol);
155728 :
155729 0 : return memory;
155730 : }
155731 :
155732 : /* #line 155733 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
155733 :
155734 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
155735 : void
155736 5342 : SgInterfaceSymbol::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
155737 : {
155738 : // This function traverses the memory pool for only a specific IR node
155739 : // and calls the visit function of the input class execute a traversal
155740 : // similar to the style of the attribute based traversals within ROSE.
155741 : // This traversal will visit ALL nodes of the AST where as the other
155742 : // attribute based traversals visit only the embedded tree within the AST.
155743 :
155744 : // Initialize array to the address of the first element of the STL vector
155745 : // (which is guaranteed to be contiguous storage).
155746 : // SgInterfaceSymbol objectArray [] = *(Memory_Block_List.begin());
155747 5342 : if (SgInterfaceSymbol::pools.empty() == false)
155748 : {
155749 : // Generate an array of memory pools
155750 0 : SgInterfaceSymbol** objectArray = (SgInterfaceSymbol**) &(SgInterfaceSymbol::pools[0]);
155751 :
155752 : // Build a local variable for better performance
155753 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
155754 : #if 0
155755 : // Iterate over the memory pools
155756 : for (unsigned int i=0; i < SgInterfaceSymbol::pools.size(); i++)
155757 : {
155758 : // objectArray[i] is a single memory pool
155759 : for (int j=0; j < SgInterfaceSymbol::pool_size; j++)
155760 : {
155761 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
155762 : {
155763 : traversal.visit(&(objectArray[i][j]));
155764 : }
155765 : }
155766 : }
155767 : #else
155768 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
155769 : // compute the list first and then call the visit function on each list element.
155770 :
155771 : // printf ("Inside of SgInterfaceSymbol::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
155772 :
155773 0 : std::vector<SgInterfaceSymbol*> nodeList;
155774 :
155775 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
155776 0 : for (unsigned int i=0; i < SgInterfaceSymbol::pools.size(); i++)
155777 : {
155778 : // objectArray[i] is a single memory pool
155779 0 : for (unsigned j=0; j < SgInterfaceSymbol::pool_size; j++)
155780 : {
155781 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
155782 : {
155783 0 : nodeList.push_back(&(objectArray[i][j]));
155784 : }
155785 : }
155786 : }
155787 :
155788 : // Iterate over the saved list
155789 0 : size_t nodeListSize = nodeList.size();
155790 0 : for (size_t i=0; i < nodeListSize; i++)
155791 : {
155792 0 : ROSE_ASSERT(nodeList[i] != NULL);
155793 : #if 0
155794 : traversal.visit(nodeList[i]);
155795 : #else
155796 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
155797 : {
155798 0 : traversal.visit(nodeList[i]);
155799 : }
155800 : #endif
155801 : }
155802 : #endif
155803 : }
155804 :
155805 : // This should not be required since all previously static data members are
155806 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
155807 :
155808 5342 : }
155809 :
155810 :
155811 : void
155812 194 : SgInterfaceSymbol::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
155813 : {
155814 : // This function traverses the memory pool for an IR node and
155815 : // calls the function to execute the visitor object.
155816 :
155817 : // Initialize array to the address of the first element of the STL vector
155818 : // (which is guarenteed to be contiguous storage).
155819 : // SgInterfaceSymbol objectArray [] = *(Memory_Block_List.begin());
155820 194 : if (SgInterfaceSymbol::pools.empty() == false)
155821 : {
155822 : // Generate an array of memory pools
155823 0 : SgInterfaceSymbol** objectArray = (SgInterfaceSymbol**) &(SgInterfaceSymbol::pools[0]);
155824 :
155825 : // Build a local variable for better performance
155826 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
155827 :
155828 : // Iterate over the memory pools
155829 0 : for (unsigned int i=0; i < SgInterfaceSymbol::pools.size(); i++)
155830 : {
155831 : // objectArray[i] is a single memory pool
155832 0 : for (unsigned j=0; j < SgInterfaceSymbol::pool_size; j++)
155833 : {
155834 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
155835 : {
155836 : // printf ("Found a valid SgInterfaceSymbol object in the memory pool %d at position %d \n",i,j);
155837 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
155838 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
155839 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
155840 : }
155841 : else
155842 : {
155843 : // printf ("Found a INVALID SgInterfaceSymbol object in the memory pool \n");
155844 : }
155845 : }
155846 : }
155847 : }
155848 :
155849 : // This should not be required since all previously static data members are
155850 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
155851 :
155852 194 : }
155853 :
155854 : void
155855 0 : SgInterfaceSymbol::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
155856 : {
155857 : // This function visits only a single IR node of the memory pool.
155858 : // it is typically called once for each type of IR node within
155859 : // the automatically generated function: traverseRepresentativeNodes().
155860 :
155861 : // Initialize array to the address of the first element of the STL vector
155862 : // (which is guarenteed to be contiguous storage).
155863 : // SgInterfaceSymbol objectArray [] = *(Memory_Block_List.begin());
155864 0 : if (SgInterfaceSymbol::pools.empty() == false)
155865 : {
155866 : // Generate an array of memory pools
155867 0 : SgInterfaceSymbol** objectArray = (SgInterfaceSymbol**) &(SgInterfaceSymbol::pools[0]);
155868 :
155869 : // Build a local variable for better performance
155870 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
155871 :
155872 : // Iterate over the memory pools
155873 0 : bool done = false;
155874 0 : unsigned i=0;
155875 :
155876 : // find the first valid IR node, call visit function, and then leave
155877 0 : while ( done == false && i < SgInterfaceSymbol::pools.size() )
155878 : {
155879 : // objectArray[i] is a single memory pool
155880 : unsigned j=0;
155881 0 : while (done == false && j < SgInterfaceSymbol::pool_size)
155882 : {
155883 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
155884 : {
155885 0 : traversal.visit(&(objectArray[i][j]));
155886 0 : done = true;
155887 : }
155888 0 : j++;
155889 : }
155890 0 : i++;
155891 : }
155892 :
155893 : #if 0
155894 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
155895 : if (done == false)
155896 : {
155897 : printf ("No representative for SgInterfaceSymbol found in memory pools \n");
155898 : }
155899 : #endif
155900 : }
155901 0 : }
155902 :
155903 :
155904 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
155905 : // using values that overflow signed values of int.
155906 : size_t
155907 4 : SgInterfaceSymbol::numberOfNodes()
155908 : {
155909 : // This function traverses the memory pool for an IR node and
155910 : // counts the number of IR nodes of a particular Sage III IR
155911 : // nodes type.
155912 :
155913 4 : size_t count = 0;
155914 4 : if (SgInterfaceSymbol::pools.empty() == false)
155915 : {
155916 : // Generate an array of memory pools (this is actually a STL vector,
155917 : // but it is contiguious, so OK to treat this way).
155918 0 : SgInterfaceSymbol** objectArray = (SgInterfaceSymbol**) &(SgInterfaceSymbol::pools[0]);
155919 :
155920 : // Build a local variable for better performance (make it a loop invariant variable).
155921 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
155922 :
155923 : // Iterate over all of the memory pools for this IR node.
155924 0 : for (unsigned int i=0; i < SgInterfaceSymbol::pools.size(); i++)
155925 : {
155926 : // objectArray[i] is a single memory pool, iterate over all the
155927 : // IR nodes and only count those that are valid IR nodes used in
155928 : // the AST (i.e. allocated IR nodes).
155929 0 : for (unsigned j=0; j < SgInterfaceSymbol::pool_size; j++)
155930 : {
155931 : // This is indexing the STL vector of C/C++ style arrays as a doubly
155932 : // indexed array access. It is OK since we have leveraged the semantics
155933 : // of STL vector memory as contigous and cast the memory as an array
155934 : // of arrays to use the 2D array indexing. Hope this is not confusing,
155935 : // but it s very fast as an implementation.
155936 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
155937 : {
155938 0 : count++;
155939 : }
155940 : }
155941 : }
155942 : }
155943 :
155944 :
155945 :
155946 4 : return count;
155947 : }
155948 :
155949 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
155950 : // using values that overflow signed values of int.
155951 : size_t
155952 0 : SgInterfaceSymbol::memoryUsage()
155953 : {
155954 : // This function is required because we need the class name as a type when we call sizeof
155955 : // There might be another way to implement this if we have a traversal that only called a
155956 : // representative object (one call for each type of Sage IIIIR node).
155957 0 : size_t memory = numberOfNodes() * sizeof(SgInterfaceSymbol);
155958 :
155959 0 : return memory;
155960 : }
155961 :
155962 : /* #line 155963 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
155963 :
155964 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
155965 : void
155966 5342 : SgCommonSymbol::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
155967 : {
155968 : // This function traverses the memory pool for only a specific IR node
155969 : // and calls the visit function of the input class execute a traversal
155970 : // similar to the style of the attribute based traversals within ROSE.
155971 : // This traversal will visit ALL nodes of the AST where as the other
155972 : // attribute based traversals visit only the embedded tree within the AST.
155973 :
155974 : // Initialize array to the address of the first element of the STL vector
155975 : // (which is guaranteed to be contiguous storage).
155976 : // SgCommonSymbol objectArray [] = *(Memory_Block_List.begin());
155977 5342 : if (SgCommonSymbol::pools.empty() == false)
155978 : {
155979 : // Generate an array of memory pools
155980 0 : SgCommonSymbol** objectArray = (SgCommonSymbol**) &(SgCommonSymbol::pools[0]);
155981 :
155982 : // Build a local variable for better performance
155983 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
155984 : #if 0
155985 : // Iterate over the memory pools
155986 : for (unsigned int i=0; i < SgCommonSymbol::pools.size(); i++)
155987 : {
155988 : // objectArray[i] is a single memory pool
155989 : for (int j=0; j < SgCommonSymbol::pool_size; j++)
155990 : {
155991 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
155992 : {
155993 : traversal.visit(&(objectArray[i][j]));
155994 : }
155995 : }
155996 : }
155997 : #else
155998 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
155999 : // compute the list first and then call the visit function on each list element.
156000 :
156001 : // printf ("Inside of SgCommonSymbol::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
156002 :
156003 0 : std::vector<SgCommonSymbol*> nodeList;
156004 :
156005 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
156006 0 : for (unsigned int i=0; i < SgCommonSymbol::pools.size(); i++)
156007 : {
156008 : // objectArray[i] is a single memory pool
156009 0 : for (unsigned j=0; j < SgCommonSymbol::pool_size; j++)
156010 : {
156011 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
156012 : {
156013 0 : nodeList.push_back(&(objectArray[i][j]));
156014 : }
156015 : }
156016 : }
156017 :
156018 : // Iterate over the saved list
156019 0 : size_t nodeListSize = nodeList.size();
156020 0 : for (size_t i=0; i < nodeListSize; i++)
156021 : {
156022 0 : ROSE_ASSERT(nodeList[i] != NULL);
156023 : #if 0
156024 : traversal.visit(nodeList[i]);
156025 : #else
156026 0 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
156027 : {
156028 0 : traversal.visit(nodeList[i]);
156029 : }
156030 : #endif
156031 : }
156032 : #endif
156033 : }
156034 :
156035 : // This should not be required since all previously static data members are
156036 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
156037 :
156038 5342 : }
156039 :
156040 :
156041 : void
156042 194 : SgCommonSymbol::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
156043 : {
156044 : // This function traverses the memory pool for an IR node and
156045 : // calls the function to execute the visitor object.
156046 :
156047 : // Initialize array to the address of the first element of the STL vector
156048 : // (which is guarenteed to be contiguous storage).
156049 : // SgCommonSymbol objectArray [] = *(Memory_Block_List.begin());
156050 194 : if (SgCommonSymbol::pools.empty() == false)
156051 : {
156052 : // Generate an array of memory pools
156053 0 : SgCommonSymbol** objectArray = (SgCommonSymbol**) &(SgCommonSymbol::pools[0]);
156054 :
156055 : // Build a local variable for better performance
156056 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
156057 :
156058 : // Iterate over the memory pools
156059 0 : for (unsigned int i=0; i < SgCommonSymbol::pools.size(); i++)
156060 : {
156061 : // objectArray[i] is a single memory pool
156062 0 : for (unsigned j=0; j < SgCommonSymbol::pool_size; j++)
156063 : {
156064 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
156065 : {
156066 : // printf ("Found a valid SgCommonSymbol object in the memory pool %d at position %d \n",i,j);
156067 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
156068 0 : objectArray[i][j].executeVisitorMemberFunction(visitor);
156069 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
156070 : }
156071 : else
156072 : {
156073 : // printf ("Found a INVALID SgCommonSymbol object in the memory pool \n");
156074 : }
156075 : }
156076 : }
156077 : }
156078 :
156079 : // This should not be required since all previously static data members are
156080 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
156081 :
156082 194 : }
156083 :
156084 : void
156085 0 : SgCommonSymbol::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
156086 : {
156087 : // This function visits only a single IR node of the memory pool.
156088 : // it is typically called once for each type of IR node within
156089 : // the automatically generated function: traverseRepresentativeNodes().
156090 :
156091 : // Initialize array to the address of the first element of the STL vector
156092 : // (which is guarenteed to be contiguous storage).
156093 : // SgCommonSymbol objectArray [] = *(Memory_Block_List.begin());
156094 0 : if (SgCommonSymbol::pools.empty() == false)
156095 : {
156096 : // Generate an array of memory pools
156097 0 : SgCommonSymbol** objectArray = (SgCommonSymbol**) &(SgCommonSymbol::pools[0]);
156098 :
156099 : // Build a local variable for better performance
156100 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
156101 :
156102 : // Iterate over the memory pools
156103 0 : bool done = false;
156104 0 : unsigned i=0;
156105 :
156106 : // find the first valid IR node, call visit function, and then leave
156107 0 : while ( done == false && i < SgCommonSymbol::pools.size() )
156108 : {
156109 : // objectArray[i] is a single memory pool
156110 : unsigned j=0;
156111 0 : while (done == false && j < SgCommonSymbol::pool_size)
156112 : {
156113 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
156114 : {
156115 0 : traversal.visit(&(objectArray[i][j]));
156116 0 : done = true;
156117 : }
156118 0 : j++;
156119 : }
156120 0 : i++;
156121 : }
156122 :
156123 : #if 0
156124 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
156125 : if (done == false)
156126 : {
156127 : printf ("No representative for SgCommonSymbol found in memory pools \n");
156128 : }
156129 : #endif
156130 : }
156131 0 : }
156132 :
156133 :
156134 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
156135 : // using values that overflow signed values of int.
156136 : size_t
156137 4 : SgCommonSymbol::numberOfNodes()
156138 : {
156139 : // This function traverses the memory pool for an IR node and
156140 : // counts the number of IR nodes of a particular Sage III IR
156141 : // nodes type.
156142 :
156143 4 : size_t count = 0;
156144 4 : if (SgCommonSymbol::pools.empty() == false)
156145 : {
156146 : // Generate an array of memory pools (this is actually a STL vector,
156147 : // but it is contiguious, so OK to treat this way).
156148 0 : SgCommonSymbol** objectArray = (SgCommonSymbol**) &(SgCommonSymbol::pools[0]);
156149 :
156150 : // Build a local variable for better performance (make it a loop invariant variable).
156151 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
156152 :
156153 : // Iterate over all of the memory pools for this IR node.
156154 0 : for (unsigned int i=0; i < SgCommonSymbol::pools.size(); i++)
156155 : {
156156 : // objectArray[i] is a single memory pool, iterate over all the
156157 : // IR nodes and only count those that are valid IR nodes used in
156158 : // the AST (i.e. allocated IR nodes).
156159 0 : for (unsigned j=0; j < SgCommonSymbol::pool_size; j++)
156160 : {
156161 : // This is indexing the STL vector of C/C++ style arrays as a doubly
156162 : // indexed array access. It is OK since we have leveraged the semantics
156163 : // of STL vector memory as contigous and cast the memory as an array
156164 : // of arrays to use the 2D array indexing. Hope this is not confusing,
156165 : // but it s very fast as an implementation.
156166 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
156167 : {
156168 0 : count++;
156169 : }
156170 : }
156171 : }
156172 : }
156173 :
156174 :
156175 :
156176 4 : return count;
156177 : }
156178 :
156179 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
156180 : // using values that overflow signed values of int.
156181 : size_t
156182 0 : SgCommonSymbol::memoryUsage()
156183 : {
156184 : // This function is required because we need the class name as a type when we call sizeof
156185 : // There might be another way to implement this if we have a traversal that only called a
156186 : // representative object (one call for each type of Sage IIIIR node).
156187 0 : size_t memory = numberOfNodes() * sizeof(SgCommonSymbol);
156188 :
156189 0 : return memory;
156190 : }
156191 :
156192 : /* #line 156193 "../../../src/frontend/SageIII//Cxx_GrammarTraverseMemoryPool.C" */
156193 :
156194 : /* #line 1 "/home/yyan7/compiler/rexompiler/src/ROSETTA/Grammar/grammarTraverseMemoryPool.macro" */
156195 : void
156196 5342 : SgAliasSymbol::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal)
156197 : {
156198 : // This function traverses the memory pool for only a specific IR node
156199 : // and calls the visit function of the input class execute a traversal
156200 : // similar to the style of the attribute based traversals within ROSE.
156201 : // This traversal will visit ALL nodes of the AST where as the other
156202 : // attribute based traversals visit only the embedded tree within the AST.
156203 :
156204 : // Initialize array to the address of the first element of the STL vector
156205 : // (which is guaranteed to be contiguous storage).
156206 : // SgAliasSymbol objectArray [] = *(Memory_Block_List.begin());
156207 5342 : if (SgAliasSymbol::pools.empty() == false)
156208 : {
156209 : // Generate an array of memory pools
156210 5303 : SgAliasSymbol** objectArray = (SgAliasSymbol**) &(SgAliasSymbol::pools[0]);
156211 :
156212 : // Build a local variable for better performance
156213 5303 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
156214 : #if 0
156215 : // Iterate over the memory pools
156216 : for (unsigned int i=0; i < SgAliasSymbol::pools.size(); i++)
156217 : {
156218 : // objectArray[i] is a single memory pool
156219 : for (int j=0; j < SgAliasSymbol::pool_size; j++)
156220 : {
156221 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
156222 : {
156223 : traversal.visit(&(objectArray[i][j]));
156224 : }
156225 : }
156226 : }
156227 : #else
156228 : // DQ (10/26/2016): To avoid operations in the visit functions that might change the list,
156229 : // compute the list first and then call the visit function on each list element.
156230 :
156231 : // printf ("Inside of SgAliasSymbol::traverseMemoryPoolNodes(ROSE_VisitTraversal & traversal) \n");
156232 :
156233 10606 : std::vector<SgAliasSymbol*> nodeList;
156234 :
156235 : // Iterate over the memory pools to build the saved list of IR nodes for this type.
156236 15782 : for (unsigned int i=0; i < SgAliasSymbol::pools.size(); i++)
156237 : {
156238 : // objectArray[i] is a single memory pool
156239 20968500 : for (unsigned j=0; j < SgAliasSymbol::pool_size; j++)
156240 : {
156241 20958000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
156242 : {
156243 13798800 : nodeList.push_back(&(objectArray[i][j]));
156244 : }
156245 : }
156246 : }
156247 :
156248 : // Iterate over the saved list
156249 5303 : size_t nodeListSize = nodeList.size();
156250 13804100 : for (size_t i=0; i < nodeListSize; i++)
156251 : {
156252 13798800 : ROSE_ASSERT(nodeList[i] != NULL);
156253 : #if 0
156254 : traversal.visit(nodeList[i]);
156255 : #else
156256 13798800 : if (nodeList[i]->p_freepointer == IS_VALID_POINTER)
156257 : {
156258 13798800 : traversal.visit(nodeList[i]);
156259 : }
156260 : #endif
156261 : }
156262 : #endif
156263 : }
156264 :
156265 : // This should not be required since all previously static data members are
156266 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
156267 :
156268 5342 : }
156269 :
156270 :
156271 : void
156272 194 : SgAliasSymbol::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern & visitor )
156273 : {
156274 : // This function traverses the memory pool for an IR node and
156275 : // calls the function to execute the visitor object.
156276 :
156277 : // Initialize array to the address of the first element of the STL vector
156278 : // (which is guarenteed to be contiguous storage).
156279 : // SgAliasSymbol objectArray [] = *(Memory_Block_List.begin());
156280 194 : if (SgAliasSymbol::pools.empty() == false)
156281 : {
156282 : // Generate an array of memory pools
156283 194 : SgAliasSymbol** objectArray = (SgAliasSymbol**) &(SgAliasSymbol::pools[0]);
156284 :
156285 : // Build a local variable for better performance
156286 194 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
156287 :
156288 : // Iterate over the memory pools
156289 1336 : for (unsigned int i=0; i < SgAliasSymbol::pools.size(); i++)
156290 : {
156291 : // objectArray[i] is a single memory pool
156292 2285140 : for (unsigned j=0; j < SgAliasSymbol::pool_size; j++)
156293 : {
156294 2284000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
156295 : {
156296 : // printf ("Found a valid SgAliasSymbol object in the memory pool %d at position %d \n",i,j);
156297 : // printf ("Calling executeVisitorMemberFunction(visitor) \n");
156298 2042220 : objectArray[i][j].executeVisitorMemberFunction(visitor);
156299 : // printf ("DONE: executeVisitorMemberFunction(visitor) \n");
156300 : }
156301 : else
156302 : {
156303 : // printf ("Found a INVALID SgAliasSymbol object in the memory pool \n");
156304 : }
156305 : }
156306 : }
156307 : }
156308 :
156309 : // This should not be required since all previously static data members are
156310 : // now static pointers and ALL IR nodes are allocated from the IR memory pools.
156311 :
156312 194 : }
156313 :
156314 : void
156315 0 : SgAliasSymbol::visitRepresentativeNode(ROSE_VisitTraversal & traversal)
156316 : {
156317 : // This function visits only a single IR node of the memory pool.
156318 : // it is typically called once for each type of IR node within
156319 : // the automatically generated function: traverseRepresentativeNodes().
156320 :
156321 : // Initialize array to the address of the first element of the STL vector
156322 : // (which is guarenteed to be contiguous storage).
156323 : // SgAliasSymbol objectArray [] = *(Memory_Block_List.begin());
156324 0 : if (SgAliasSymbol::pools.empty() == false)
156325 : {
156326 : // Generate an array of memory pools
156327 0 : SgAliasSymbol** objectArray = (SgAliasSymbol**) &(SgAliasSymbol::pools[0]);
156328 :
156329 : // Build a local variable for better performance
156330 0 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
156331 :
156332 : // Iterate over the memory pools
156333 0 : bool done = false;
156334 0 : unsigned i=0;
156335 :
156336 : // find the first valid IR node, call visit function, and then leave
156337 0 : while ( done == false && i < SgAliasSymbol::pools.size() )
156338 : {
156339 : // objectArray[i] is a single memory pool
156340 : unsigned j=0;
156341 0 : while (done == false && j < SgAliasSymbol::pool_size)
156342 : {
156343 0 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
156344 : {
156345 0 : traversal.visit(&(objectArray[i][j]));
156346 0 : done = true;
156347 : }
156348 0 : j++;
156349 : }
156350 0 : i++;
156351 : }
156352 :
156353 : #if 0
156354 : // DQ (10/28/2020): Commented out this output spew that happens in the output of IR node statistics.
156355 : if (done == false)
156356 : {
156357 : printf ("No representative for SgAliasSymbol found in memory pools \n");
156358 : }
156359 : #endif
156360 : }
156361 0 : }
156362 :
156363 :
156364 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
156365 : // using values that overflow signed values of int.
156366 : size_t
156367 4 : SgAliasSymbol::numberOfNodes()
156368 : {
156369 : // This function traverses the memory pool for an IR node and
156370 : // counts the number of IR nodes of a particular Sage III IR
156371 : // nodes type.
156372 :
156373 4 : size_t count = 0;
156374 4 : if (SgAliasSymbol::pools.empty() == false)
156375 : {
156376 : // Generate an array of memory pools (this is actually a STL vector,
156377 : // but it is contiguious, so OK to treat this way).
156378 4 : SgAliasSymbol** objectArray = (SgAliasSymbol**) &(SgAliasSymbol::pools[0]);
156379 :
156380 : // Build a local variable for better performance (make it a loop invariant variable).
156381 4 : const SgNode* IS_VALID_POINTER = AST_FileIO::IS_VALID_POINTER();
156382 :
156383 : // Iterate over all of the memory pools for this IR node.
156384 14 : for (unsigned int i=0; i < SgAliasSymbol::pools.size(); i++)
156385 : {
156386 : // objectArray[i] is a single memory pool, iterate over all the
156387 : // IR nodes and only count those that are valid IR nodes used in
156388 : // the AST (i.e. allocated IR nodes).
156389 20010 : for (unsigned j=0; j < SgAliasSymbol::pool_size; j++)
156390 : {
156391 : // This is indexing the STL vector of C/C++ style arrays as a doubly
156392 : // indexed array access. It is OK since we have leveraged the semantics
156393 : // of STL vector memory as contigous and cast the memory as an array
156394 : // of arrays to use the 2D array indexing. Hope this is not confusing,
156395 : // but it s very fast as an implementation.
156396 20000 : if (objectArray[i][j].p_freepointer == IS_VALID_POINTER)
156397 : {
156398 13989 : count++;
156399 : }
156400 : }
156401 : }
156402 : }
156403 :
156404 :
156405 :
156406 4 : return count;
156407 : }
156408 :
156409 : // DQ (6/7/2010): Change the return type to size_t to support larger number of IR nodes
156410 : // using values that overflow signed values of int.
156411 : size_t
156412 0 : SgAliasSymbol::memoryUsage()
156413 : {
156414 : // This function is required because we need the class name as a type when we call sizeof
156415 : // There might be another way to implement this if we have a traversal that only called a
156416 : // representative object (one call for each type of Sage IIIIR node).
156417 0 : size_t memory = numberOfNodes() * sizeof(SgAliasSymbol);
156418 :
156419 0 : return memory;
156420 : }
156421 :
156422 :
|