Changes in / [cf5e5b1:ae32d96]
- Location:
- src
- Files:
-
- 5 edited
-
ControlStruct/Mutate.cc (modified) (1 diff)
-
ControlStruct/Mutate.h (modified) (2 diffs)
-
ResolvExpr/AlternativeFinder.cc (modified) (3 diffs)
-
SymTab/Validate.cc (modified) (3 diffs)
-
main.cc (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
src/ControlStruct/Mutate.cc
rcf5e5b1 rae32d96 27 27 #include "SynTree/Visitor.h" // for acceptAll 28 28 29 using namespace std; 30 29 31 namespace ControlStruct { 30 void fixLabels( std::list< Declaration * > & translationUnit ) { 32 void mutate( std::list< Declaration * > translationUnit ) { 33 // hoist initialization out of for statements 34 PassVisitor<ForExprMutator> formut; 35 36 // normalizes label definitions and generates multi-level exit labels 31 37 PassVisitor<LabelFixer> lfix; 38 39 mutateAll( translationUnit, formut ); 32 40 acceptAll( translationUnit, lfix ); 33 }34 35 void hoistControlDecls( std::list< Declaration * > & translationUnit ) {36 PassVisitor<ForExprMutator> formut;37 mutateAll( translationUnit, formut );38 41 } 39 42 } // namespace CodeGen -
src/ControlStruct/Mutate.h
rcf5e5b1 rae32d96 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // Mutate.h -- 7 // Mutate.h -- 8 8 // 9 9 // Author : Rodolfo G. Esteves … … 20 20 class Declaration; 21 21 22 /// Desugars Cforall control structures23 22 namespace ControlStruct { 24 /// normalizes label definitions and generates multi-level exit labels 25 void fixLabels( std::list< Declaration * > & translationUnit ); 26 27 /// hoist initialization out of for statements 28 void hoistControlDecls( std::list< Declaration * > & translationUnit ); 23 /// Desugars Cforall control structures 24 void mutate( std::list< Declaration* > translationUnit ); 29 25 } // namespace ControlStruct 30 26 -
src/ResolvExpr/AlternativeFinder.cc
rcf5e5b1 rae32d96 299 299 // it's okay for the aggregate expression to have reference type -- cast it to the base type to treat the aggregate as the referenced value 300 300 std::unique_ptr<Expression> aggrExpr( alt.expr->clone() ); 301 alt.env.apply( aggrExpr-> result);302 Type * aggrType = aggrExpr-> result;301 alt.env.apply( aggrExpr->get_result() ); 302 Type * aggrType = aggrExpr->get_result(); 303 303 if ( dynamic_cast< ReferenceType * >( aggrType ) ) { 304 304 aggrType = aggrType->stripReferences(); … … 306 306 } 307 307 308 if ( StructInstType *structInst = dynamic_cast< StructInstType* >( aggrExpr-> result) ) {308 if ( StructInstType *structInst = dynamic_cast< StructInstType* >( aggrExpr->get_result() ) ) { 309 309 NameExpr nameExpr( "" ); 310 310 addAggMembers( structInst, aggrExpr.get(), alt.cost+Cost::safe, alt.env, &nameExpr ); 311 } else if ( UnionInstType *unionInst = dynamic_cast< UnionInstType* >( aggrExpr-> result) ) {311 } else if ( UnionInstType *unionInst = dynamic_cast< UnionInstType* >( aggrExpr->get_result() ) ) { 312 312 NameExpr nameExpr( "" ); 313 313 addAggMembers( unionInst, aggrExpr.get(), alt.cost+Cost::safe, alt.env, &nameExpr ); … … 320 320 NameExpr * nameExpr = dynamic_cast< NameExpr * >( member ); 321 321 if ( ! nameExpr ) return; 322 const std::string & name = nameExpr-> name;322 const std::string & name = nameExpr->get_name(); 323 323 std::list< Declaration* > members; 324 324 aggInst->lookup( name, members ); -
src/SymTab/Validate.cc
rcf5e5b1 rae32d96 48 48 #include "CodeGen/CodeGenerator.h" // for genName 49 49 #include "CodeGen/OperatorTable.h" // for isCtorDtor, isCtorDtorAssign 50 #include "ControlStruct/Mutate.h" // for ForExprMutator51 50 #include "Common/PassVisitor.h" // for PassVisitor, WithDeclsToAdd 52 51 #include "Common/ScopedMap.h" // for ScopedMap … … 77 76 class SwitchStmt; 78 77 78 79 79 #define debugPrint( x ) if ( doDebug ) { std::cout << x; } 80 80 … … 275 275 Concurrency::applyKeywords( translationUnit ); 276 276 acceptAll( translationUnit, fpd ); // must happen before autogenerateRoutines, after Concurrency::applyKeywords because uniqueIds must be set on declaration before resolution 277 ControlStruct::hoistControlDecls( translationUnit ); // hoist initialization out of for statements; must happen before autogenerateRoutines278 277 autogenerateRoutines( translationUnit ); // moved up, used to be below compoundLiteral - currently needs EnumAndPointerDecay 279 278 Concurrency::implementMutexFuncs( translationUnit ); -
src/main.cc
rcf5e5b1 rae32d96 264 264 } // if 265 265 266 PASS( " fixLabels", ControlStruct::fixLabels( translationUnit ) );266 PASS( "mutate", ControlStruct::mutate( translationUnit ) ); 267 267 PASS( "fixNames", CodeGen::fixNames( translationUnit ) ); 268 268 PASS( "genInit", InitTweak::genInit( translationUnit ) );
Note:
See TracChangeset
for help on using the changeset viewer.