Lines Matching full:try

12 /// This pass inserts BLOCK, LOOP, and TRY markers to mark the start of scopes,
96 // For each BLOCK|LOOP|TRY, the corresponding END_(BLOCK|LOOP|TRY) or DELEGATE
97 // (in case of TRY).
99 // For each END_(BLOCK|LOOP|TRY) or DELEGATE, the corresponding
100 // BLOCK|LOOP|TRY.
102 // <TRY marker, EH pad> map
104 // <EH pad, TRY marker> map
150 "Insert BLOCK/LOOP/TRY markers for WebAssembly scopes", false,
250 // try) signatures when we implement the multi-value proposal later.
314 // If there is a previously placed BLOCK/TRY marker and its corresponding in placeBlockMarker()
319 MI.getOpcode() == WebAssembly::TRY) { in placeBlockMarker()
329 // All END_(BLOCK|LOOP|TRY) markers should be before the BLOCK. in placeBlockMarker()
365 // END_BLOCK should precede existing LOOP and TRY markers. in placeBlockMarker()
367 MI.getOpcode() == WebAssembly::TRY) in placeBlockMarker()
487 // If this try is at the bottom of the function, insert a dummy block at the in placeTryMarker()
518 // Decide where in Header to put the TRY. in placeTryMarker()
520 // Instructions that should go before the TRY. in placeTryMarker()
522 // Instructions that should go after the TRY. in placeTryMarker()
526 // loop is above MBB, it should be after the TRY, because the loop is nested in placeTryMarker()
527 // in this TRY. Otherwise it should be before the TRY. in placeTryMarker()
538 // All previously inserted BLOCK/TRY markers should be after the TRY because in placeTryMarker()
541 MI.getOpcode() == WebAssembly::TRY) in placeTryMarker()
545 // All END_(BLOCK/LOOP/TRY) markers should be before the TRY. in placeTryMarker()
552 // Terminators should go after the TRY. in placeTryMarker()
557 // If Header unwinds to MBB (= Header contains 'invoke'), the try block should in placeTryMarker()
558 // contain the call within it. So the call should go after the TRY. The in placeTryMarker()
584 // Local expression tree should go after the TRY. in placeTryMarker()
586 // BB's terminator, but in TRY's case, we should start from the previous in placeTryMarker()
601 // Add the TRY. in placeTryMarker()
605 TII.get(WebAssembly::TRY)) in placeTryMarker()
625 // where TRY marker is, this loop is contained within the 'catch' part, so in placeTryMarker()
626 // the END_TRY marker should go after that. Otherwise, the whole try-catch in placeTryMarker()
629 // For a LOOP to be after TRY, LOOP's BB should be after TRY's BB; if they in placeTryMarker()
630 // are in the same BB, LOOP is always before TRY. in placeTryMarker()
642 // Mark the end of the TRY. in placeTryMarker()
650 // mappings: (BB with 'end_try' -> BB with 'try') and (BB with 'catch' -> BB in placeTryMarker()
651 // with 'try'). We need to create 'catch' -> 'try' mapping here too because in placeTryMarker()
655 // try in placeTryMarker()
671 // try in removeUnnecessaryInstrs()
683 // try in removeUnnecessaryInstrs()
684 // try in removeUnnecessaryInstrs()
710 MachineInstr *Try = EHPadToTry[Cont]; in removeUnnecessaryInstrs() local
711 MachineInstr *EndTry = BeginToEnd[Try]; in removeUnnecessaryInstrs()
742 // When there are block / end_block markers that overlap with try / end_try in removeUnnecessaryInstrs()
743 // markers, and the block and try markers' return types are the same, the in removeUnnecessaryInstrs()
744 // block /end_block markers are not necessary, because try / end_try markers in removeUnnecessaryInstrs()
747 // try in removeUnnecessaryInstrs()
756 if (MI.getOpcode() != WebAssembly::TRY) in removeUnnecessaryInstrs()
758 MachineInstr *Try = &MI, *EndTry = BeginToEnd[Try]; in removeUnnecessaryInstrs() local
762 MachineBasicBlock *TryBB = Try->getParent(); in removeUnnecessaryInstrs()
764 int64_t RetType = Try->getOperand(0).getImm(); in removeUnnecessaryInstrs()
765 for (auto B = Try->getIterator(), E = std::next(EndTry->getIterator()); in removeUnnecessaryInstrs()
844 // Wrap the given range of instruction with try-delegate. RangeBegin and
856 // after the nested TRY. in addTryDelegate()
869 // Create the nested try instruction. in addTryDelegate()
872 MachineInstr *Try = BuildMI(*BeginBB, TryPos, RangeBegin->getDebugLoc(), in addTryDelegate() local
873 TII.get(WebAssembly::TRY)) in addTryDelegate()
964 registerTryScope(Try, Delegate, nullptr); in addTryDelegate()
968 // Linearizing the control flow by placing TRY / END_TRY markers can create in fixCallUnwindMismatches()
976 // discussed how to define the semantics when 'delegate''s target is a non-try in fixCallUnwindMismatches()
978 // outer try-catch. But anyway our LLVM backend currently does not generate in fixCallUnwindMismatches()
981 // try in fixCallUnwindMismatches()
982 // try in fixCallUnwindMismatches()
984 // try in fixCallUnwindMismatches()
985 // try in fixCallUnwindMismatches()
1011 // And the CFG is sorted in this order. Then after placing TRY markers, it in fixCallUnwindMismatches()
1013 // try in fixCallUnwindMismatches()
1014 // try in fixCallUnwindMismatches()
1026 // call with an inner try-delegate that rethrows the exception to the right in fixCallUnwindMismatches()
1029 // try in fixCallUnwindMismatches()
1030 // try in fixCallUnwindMismatches()
1032 // try ;; (new) in fixCallUnwindMismatches()
1055 // And the CFG is sorted in this order. Then after placing TRY markers, it in fixCallUnwindMismatches()
1057 // try in fixCallUnwindMismatches()
1068 // try in fixCallUnwindMismatches()
1070 // try ;; (new) in fixCallUnwindMismatches()
1082 // can be wrapped together in one nested try-delegate scope. (In 1, this in fixCallUnwindMismatches()
1088 // Range of intructions to be wrapped in a new nested try/catch. A range in fixCallUnwindMismatches()
1091 // In original CFG, <unwind destination BB, a vector of try ranges> in fixCallUnwindMismatches()
1100 if (MI.getOpcode() == WebAssembly::TRY) in fixCallUnwindMismatches()
1205 if (MI.getOpcode() == WebAssembly::TRY) in fixCallUnwindMismatches()
1221 // Now we fix the mismatches by wrapping calls with inner try-delegates. in fixCallUnwindMismatches()
1233 // are going to wrap the invoke with try-delegate, making the 'delegate' in fixCallUnwindMismatches()
1258 // try in fixCatchUnwindMismatches()
1259 // try in fixCatchUnwindMismatches()
1278 // try-delegate, so we wrap the whole try-catch-end with a try-delegate and in fixCatchUnwindMismatches()
1280 // try in fixCatchUnwindMismatches()
1281 // try ;; (new) in fixCatchUnwindMismatches()
1282 // try in fixCatchUnwindMismatches()
1301 if (MI.getOpcode() == WebAssembly::TRY) in fixCatchUnwindMismatches()
1358 MachineInstr *Try = EHPadToTry[EHPad]; in fixCatchUnwindMismatches() local
1359 MachineInstr *EndTry = BeginToEnd[Try]; in fixCatchUnwindMismatches()
1360 addTryDelegate(Try, EndTry, UnwindDest); in fixCatchUnwindMismatches()
1364 // Adding a try-delegate wrapping an existing try-catch-end can make existing in fixCatchUnwindMismatches()
1372 // try in fixCatchUnwindMismatches()
1380 // Suppose this try-catch-end has a catch unwind mismatch, so we need to wrap in fixCatchUnwindMismatches()
1381 // this with a try-delegate. Then this becomes: in fixCatchUnwindMismatches()
1388 // try ;; (new instruction) in fixCatchUnwindMismatches()
1389 // try in fixCatchUnwindMismatches()
1406 // in between, so we try to find the next BB with 'end_block' instruction. In in fixCatchUnwindMismatches()
1495 // If a 'try''s return type is fixed, both its try body and catch body in fixEndsAtEndOfFunction()
1534 /// Insert LOOP/TRY/BLOCK markers at appropriate places.
1546 // Place the TRY for MBB if MBB is the EH pad of an exception. in placeMarkers()
1589 // corresponding try's end_try BB because Stack contains each marker's end BB. in getDelegateDepth()
1600 // fine, but delegate has to exactly target the correct try. in getDelegateDepth()
1636 case WebAssembly::TRY: in rewriteDepthImmediates()
1639 "Block/try marker should be balanced"); in rewriteDepthImmediates()
1713 // Place the BLOCK/LOOP/TRY markers to indicate the beginnings of scopes. in runOnMachineFunction()
1716 // Remove unnecessary instructions possibly introduced by try/end_trys. in runOnMachineFunction()
1724 // Fix up block/loop/try signatures at the end of the function to conform to in runOnMachineFunction()