| [51587aa] | 1 | // | 
|---|
|  | 2 | // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo | 
|---|
|  | 3 | // | 
|---|
|  | 4 | // The contents of this file are covered under the licence agreement in the | 
|---|
|  | 5 | // file "LICENCE" distributed with Cforall. | 
|---|
|  | 6 | // | 
|---|
|  | 7 | // FlattenTuple.cc -- | 
|---|
|  | 8 | // | 
|---|
| [843054c2] | 9 | // Author           : Rodolfo G. Esteves | 
|---|
| [51587aa] | 10 | // Created On       : Mon May 18 07:44:20 2015 | 
|---|
|  | 11 | // Last Modified By : Peter A. Buhr | 
|---|
|  | 12 | // Last Modified On : Mon May 18 11:26:56 2015 | 
|---|
|  | 13 | // Update Count     : 1 | 
|---|
|  | 14 | // | 
|---|
|  | 15 |  | 
|---|
| [51b73452] | 16 | #include <list> | 
|---|
|  | 17 | #include <vector> | 
|---|
|  | 18 | #include <cassert> | 
|---|
|  | 19 | #include <algorithm> | 
|---|
|  | 20 |  | 
|---|
|  | 21 | #include "FlattenTuple.h" | 
|---|
|  | 22 |  | 
|---|
|  | 23 | namespace Tuples { | 
|---|
| [51587aa] | 24 | FlattenTuple::FlattenTuple() { | 
|---|
|  | 25 | } | 
|---|
|  | 26 |  | 
|---|
|  | 27 | FlattenTuple::~FlattenTuple() { | 
|---|
|  | 28 | } | 
|---|
|  | 29 |  | 
|---|
|  | 30 | Expression *FlattenTuple::mutate( TupleExpr *tupleExpr ) { | 
|---|
|  | 31 | CollectArgs c; | 
|---|
| [51b73452] | 32 |  | 
|---|
| [51587aa] | 33 | acceptAll( tupleExpr->get_exprs(), c ); | 
|---|
|  | 34 | tupleExpr->set_exprs( c.get_args() ); | 
|---|
|  | 35 |  | 
|---|
|  | 36 | return tupleExpr; | 
|---|
|  | 37 | } | 
|---|
|  | 38 |  | 
|---|
| [2a4b088] | 39 | void FlattenTuple::CollectArgs::visit( UntypedExpr         *expr )  {  currentArgs.insert( currentArgs.end(), expr );  } | 
|---|
|  | 40 | void FlattenTuple::CollectArgs::visit( NameExpr            *expr )  {  currentArgs.insert( currentArgs.end(), expr );  } | 
|---|
|  | 41 | void FlattenTuple::CollectArgs::visit( CastExpr            *expr )  {  currentArgs.insert( currentArgs.end(), expr );  } | 
|---|
|  | 42 | void FlattenTuple::CollectArgs::visit( AddressExpr         *expr )  {  currentArgs.insert( currentArgs.end(), expr );  } | 
|---|
|  | 43 | void FlattenTuple::CollectArgs::visit( UntypedMemberExpr   *expr )  {  currentArgs.insert( currentArgs.end(), expr );  } | 
|---|
|  | 44 | void FlattenTuple::CollectArgs::visit( MemberExpr          *expr )  {  currentArgs.insert( currentArgs.end(), expr );  } | 
|---|
|  | 45 | void FlattenTuple::CollectArgs::visit( VariableExpr        *expr )  {  currentArgs.insert( currentArgs.end(), expr );  } | 
|---|
|  | 46 | void FlattenTuple::CollectArgs::visit( ConstantExpr        *expr )  {  currentArgs.insert( currentArgs.end(), expr );  } | 
|---|
|  | 47 | void FlattenTuple::CollectArgs::visit( SizeofExpr          *expr )  {  currentArgs.insert( currentArgs.end(), expr );  } | 
|---|
|  | 48 | void FlattenTuple::CollectArgs::visit( AlignofExpr         *expr )  {  currentArgs.insert( currentArgs.end(), expr );  } | 
|---|
|  | 49 | void FlattenTuple::CollectArgs::visit( UntypedOffsetofExpr *expr )  {  currentArgs.insert( currentArgs.end(), expr );  } | 
|---|
|  | 50 | void FlattenTuple::CollectArgs::visit( OffsetofExpr        *expr )  {  currentArgs.insert( currentArgs.end(), expr );  } | 
|---|
| [afc1045] | 51 | void FlattenTuple::CollectArgs::visit( OffsetPackExpr      *expr )  {  currentArgs.insert( currentArgs.end(), expr );  } | 
|---|
| [2a4b088] | 52 | void FlattenTuple::CollectArgs::visit( AttrExpr            *expr )  {  currentArgs.insert( currentArgs.end(), expr );  } | 
|---|
|  | 53 | void FlattenTuple::CollectArgs::visit( LogicalExpr         *expr )  {  currentArgs.insert( currentArgs.end(), expr );  } | 
|---|
|  | 54 | void FlattenTuple::CollectArgs::visit( ConditionalExpr     *expr )  {  currentArgs.insert( currentArgs.end(), expr );  } | 
|---|
|  | 55 | void FlattenTuple::CollectArgs::visit( CommaExpr           *expr )  {  currentArgs.insert( currentArgs.end(), expr );  } | 
|---|
|  | 56 | void FlattenTuple::CollectArgs::visit( TypeExpr            *expr )  {  currentArgs.insert( currentArgs.end(), expr );  } | 
|---|
|  | 57 | void FlattenTuple::CollectArgs::visit( UntypedValofExpr    *expr )  {  currentArgs.insert( currentArgs.end(), expr );  } | 
|---|
| [51587aa] | 58 |  | 
|---|
|  | 59 | void FlattenTuple::CollectArgs::visit( TupleExpr *tupleExpr) { | 
|---|
|  | 60 | acceptAll( tupleExpr->get_exprs(), *this ); | 
|---|
|  | 61 | //currentArgs.splice( currentArgs.end(), c.get_args() ); | 
|---|
|  | 62 | } | 
|---|
| [51b73452] | 63 | } // namespace Tuples | 
|---|
| [51587aa] | 64 |  | 
|---|
|  | 65 | // Local Variables: // | 
|---|
|  | 66 | // tab-width: 4 // | 
|---|
|  | 67 | // mode: c++ // | 
|---|
|  | 68 | // compile-command: "make install" // | 
|---|
|  | 69 | // End: // | 
|---|