Changes in / [7b2c8c3c:34c32f0]
- Location:
- src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Pass.impl.hpp
r7b2c8c3c r34c32f0 1050 1050 VISIT_START( node ); 1051 1051 1052 <<<<<<< HEAD 1053 VISIT( 1054 maybe_accept( node, &MutexStmt::mutexObjs ); 1055 { 1056 // mutex statements introduce a level of scope (for the initialization) 1057 guard_symtab guard { *this }; 1058 maybe_accept( node, &MutexStmt::stmt ); 1059 1060 } 1061 ) 1062 ======= 1052 1063 if ( __visit_children() ) { 1053 1064 // mutex statements introduce a level of scope (for the initialization) … … 1056 1067 maybe_accept( node, &MutexStmt::mutexObjs ); 1057 1068 } 1069 >>>>>>> e21f2536b7495654ded040259b42b7e2325b8360 1058 1070 1059 1071 VISIT_END( Stmt, node ); -
src/ControlStruct/MultiLevelExit.cpp
r7b2c8c3c r34c32f0 71 71 bool isFallDefaultTarget() const { return kind == SwitchStmtK; } 72 72 73 // These routines set a target as being "used" by a BranchStmt 73 74 Label useContExit() { assert( kind <= WhileStmtK ); return useTarget(secondTarget); } 74 75 Label useBreakExit() { assert( kind != CaseStmtK ); return useTarget(firstTarget); } … … 76 77 Label useFallDefaultExit() { assert( kind == SwitchStmtK ); return useTarget(secondTarget); } 77 78 79 // These routines check if a specific label for a statement is used by a BranchStmt 78 80 bool isContUsed() const { assert( kind <= WhileStmtK ); return secondTarget.used; } 79 81 bool isBreakUsed() const { assert( kind != CaseStmtK ); return firstTarget.used; } … … 164 166 const CompoundStmt * stmt ) { 165 167 visit_children = false; 168 169 // if the stmt is labelled then generate a label to check in postvisit if the label is used 166 170 bool isLabeled = !stmt->labels.empty(); 167 171 if ( isLabeled ) { … … 217 221 } 218 222 223 // This routine updates targets on enclosing control structures to indicate which 224 // label is used by the BranchStmt that is passed 219 225 const BranchStmt * MultiLevelExitCore::postvisit( const BranchStmt * stmt ) { 220 226 vector<Entry>::reverse_iterator targetEntry = 221 227 enclosing_control_structures.rend(); 228 229 // Labels on different stmts require different approaches to access 222 230 switch ( stmt->kind ) { 223 231 case BranchStmt::Goto: … … 253 261 break; 254 262 } 263 // handle fallthrough in case/switch stmts 255 264 case BranchStmt::FallThrough: { 256 265 targetEntry = findEnclosingControlStructure( isFallthroughTarget ); … … 530 539 } 531 540 541 // if continue is used insert a continue label into the back of the body of the loop 532 542 if ( entry.isContUsed() ) { 533 543 CompoundStmt * new_body = new CompoundStmt( body->location ); 544 // {} 534 545 new_body->kids.push_back( body ); 546 // { 547 // body 548 // } 535 549 new_body->kids.push_back( 536 550 labelledNullStmt( body->location, entry.useContExit() ) ); 551 // { 552 // body 553 // ContinueLabel: {} 554 // } 537 555 return new_body; 538 556 } … … 548 566 Label contLabel = newLabel( "loopContinue", loopStmt ); 549 567 enclosing_control_structures.emplace_back( loopStmt, breakLabel, contLabel ); 568 // labels are added temporarily to see if they are used and then added permanently in postvisit if ther are used 569 // children will tag labels as being used during their traversal which occurs before postvisit 570 571 // GuardAction calls the lambda after the node is done being visited 550 572 GuardAction( [this](){ enclosing_control_structures.pop_back(); } ); 551 573 } … … 560 582 return mutate_field( 561 583 loopStmt, &LoopNode::body, mutateLoop( loopStmt->body, entry ) ); 584 // this call to mutate_field compares loopStmt->body and the result of mutateLoop 585 // if they are the same the node isn't mutated, if they differ then the new mutated node is returned 586 // the stmts will only differ if a label is used 562 587 } 563 588
Note:
See TracChangeset
for help on using the changeset viewer.