Lines Matching refs:IRB
470 IRBuilder<> IRB(M->getContext()); in getAddrIntType() local
471 return IRB.getIntNTy(M->getDataLayout().getPointerSizeInBits()); in getAddrIntType()
485 IRBuilder<> IRB(M->getContext()); in getAddrSizeInt() local
486 return IRB.getIntN(M->getDataLayout().getPointerSizeInBits(), C); in getAddrSizeInt()
519 IRBuilder<> IRB(C); in wrapInvoke() local
520 IRB.SetInsertPoint(CI); in wrapInvoke()
524 IRB.CreateStore(getAddrSizeInt(M, 0), ThrewGV); in wrapInvoke()
532 CallInst *NewCall = IRB.CreateCall(getInvokeWrapper(CI), Args); in wrapInvoke()
572 IRB.CreateLoad(getAddrIntType(M), ThrewGV, ThrewGV->getName() + ".val"); in wrapInvoke()
573 IRB.CreateStore(getAddrSizeInt(M, 0), ThrewGV); in wrapInvoke()
713 IRBuilder<> IRB(C); in wrapTestSetjmp() local
714 IRB.SetCurrentDebugLocation(DL); in wrapTestSetjmp()
717 IRB.SetInsertPoint(BB); in wrapTestSetjmp()
721 Value *ThrewCmp = IRB.CreateICmpNE(Threw, getAddrSizeInt(M, 0)); in wrapTestSetjmp()
722 Value *ThrewValue = IRB.CreateLoad(IRB.getInt32Ty(), ThrewValueGV, in wrapTestSetjmp()
724 Value *ThrewValueCmp = IRB.CreateICmpNE(ThrewValue, IRB.getInt32(0)); in wrapTestSetjmp()
725 Value *Cmp1 = IRB.CreateAnd(ThrewCmp, ThrewValueCmp, "cmp1"); in wrapTestSetjmp()
726 IRB.CreateCondBr(Cmp1, ThenBB1, ElseBB1); in wrapTestSetjmp()
732 IRB.SetInsertPoint(CallEmLongjmpBB); in wrapTestSetjmp()
733 CallEmLongjmpBBThrewPHI = IRB.CreatePHI(getAddrIntType(M), 4, "threw.phi"); in wrapTestSetjmp()
735 IRB.CreatePHI(IRB.getInt32Ty(), 4, "threwvalue.phi"); in wrapTestSetjmp()
738 IRB.CreateCall(EmLongjmpF, in wrapTestSetjmp()
740 IRB.CreateUnreachable(); in wrapTestSetjmp()
748 IRB.SetInsertPoint(ThenBB1); in wrapTestSetjmp()
751 IRB.CreateIntToPtr(Threw, getAddrPtrType(M), Threw->getName() + ".p"); in wrapTestSetjmp()
752 Value *LoadedThrew = IRB.CreateLoad(getAddrIntType(M), ThrewPtr, in wrapTestSetjmp()
754 Value *ThenLabel = IRB.CreateCall( in wrapTestSetjmp()
756 Value *Cmp2 = IRB.CreateICmpEQ(ThenLabel, IRB.getInt32(0)); in wrapTestSetjmp()
757 IRB.CreateCondBr(Cmp2, CallEmLongjmpBB, EndBB2); in wrapTestSetjmp()
760 IRB.SetInsertPoint(EndBB2); in wrapTestSetjmp()
761 IRB.CreateCall(SetTempRet0F, ThrewValue); in wrapTestSetjmp()
762 IRB.CreateBr(EndBB1); in wrapTestSetjmp()
764 IRB.SetInsertPoint(ElseBB1); in wrapTestSetjmp()
765 IRB.CreateBr(EndBB1); in wrapTestSetjmp()
768 IRB.SetInsertPoint(EndBB1); in wrapTestSetjmp()
769 PHINode *LabelPHI = IRB.CreatePHI(IRB.getInt32Ty(), 2, "label"); in wrapTestSetjmp()
772 LabelPHI->addIncoming(IRB.getInt32(-1), ElseBB1); in wrapTestSetjmp()
777 LongjmpResult = IRB.CreateCall(GetTempRet0F, std::nullopt, "longjmp_result"); in wrapTestSetjmp()
822 IRBuilder<> IRB(C); in replaceLongjmpWith() local
829 IRB.SetInsertPoint(CI); in replaceLongjmpWith()
833 IRB.CreatePtrToInt(CI->getArgOperand(0), getAddrIntType(M), "env"); in replaceLongjmpWith()
835 Env = IRB.CreateBitCast(CI->getArgOperand(0), IRB.getPtrTy(), "env"); in replaceLongjmpWith()
836 IRB.CreateCall(NewF, {Env, CI->getArgOperand(1)}); in replaceLongjmpWith()
847 IRB.CreateBitCast(NewF, LongjmpF->getType(), "longjmp.cast"); in replaceLongjmpWith()
867 IRBuilder<> IRB(M.getContext()); in nullifySetjmp() local
883 CI->replaceAllUsesWith(IRB.getInt32(0)); in nullifySetjmp()
893 IRBuilder<> IRB(C); in runOnModule() local
933 ThrewValueGV = getGlobalVariable(M, IRB.getInt32Ty(), TM, "__threwValue"); in runOnModule()
935 FunctionType::get(IRB.getInt32Ty(), false), "getTempRet0", &M); in runOnModule()
937 FunctionType::get(IRB.getVoidTy(), IRB.getInt32Ty(), false), in runOnModule()
948 FunctionType::get(IRB.getVoidTy(), IRB.getPtrTy(), false); in runOnModule()
954 FunctionType::get(IRB.getInt32Ty(), IRB.getPtrTy(), false); in runOnModule()
994 IRB.getVoidTy(), {getAddrIntType(&M), IRB.getInt32Ty()}, false); in runOnModule()
998 Type *Int8PtrTy = IRB.getPtrTy(); in runOnModule()
1001 IRB.getVoidTy(), {Int8PtrTy, IRB.getInt32Ty()}, false); in runOnModule()
1007 Type *Int8PtrTy = IRB.getPtrTy(); in runOnModule()
1008 Type *Int32PtrTy = IRB.getPtrTy(); in runOnModule()
1009 Type *Int32Ty = IRB.getInt32Ty(); in runOnModule()
1076 IRBuilder<> IRB(C); in runEHOnFunction() local
1093 IRB.SetInsertPoint(II); in runEHOnFunction()
1127 IRB.SetInsertPoint(RethrowLongjmpBB); in runEHOnFunction()
1129 IRB.CreatePHI(getAddrIntType(&M), 4, "threw.phi"); in runEHOnFunction()
1131 Value *ThrewValue = IRB.CreateLoad(IRB.getInt32Ty(), ThrewValueGV, in runEHOnFunction()
1133 IRB.CreateCall(EmLongjmpF, {RethrowLongjmpBBThrewPHI, ThrewValue}); in runEHOnFunction()
1134 IRB.CreateUnreachable(); in runEHOnFunction()
1139 IRB.SetInsertPoint(II); // Restore the insert point back in runEHOnFunction()
1142 IRB.CreateICmpEQ(Threw, getAddrSizeInt(&M, 1), "cmp.eq.one"); in runEHOnFunction()
1144 IRB.CreateICmpEQ(Threw, getAddrSizeInt(&M, 0), "cmp.eq.zero"); in runEHOnFunction()
1145 Value *Or = IRB.CreateOr(CmpEqZero, CmpEqOne, "or"); in runEHOnFunction()
1146 IRB.CreateCondBr(Or, Tail, RethrowLongjmpBB); in runEHOnFunction()
1147 IRB.SetInsertPoint(Tail); in runEHOnFunction()
1152 Value *Cmp = IRB.CreateICmpEQ(Threw, getAddrSizeInt(&M, 1), "cmp"); in runEHOnFunction()
1153 IRB.CreateCondBr(Cmp, II->getUnwindDest(), II->getNormalDest()); in runEHOnFunction()
1173 IRB.SetInsertPoint(RI); in runEHOnFunction()
1174 Value *Low = IRB.CreateExtractValue(Input, 0, "low"); in runEHOnFunction()
1176 IRB.CreateCall(ResumeF, {Low}); in runEHOnFunction()
1178 IRB.CreateUnreachable(); in runEHOnFunction()
1196 IRB.SetInsertPoint(CI); in runEHOnFunction()
1198 IRB.CreateCall(EHTypeIDF, CI->getArgOperand(0), "typeid"); in runEHOnFunction()
1215 IRB.SetInsertPoint(LPI); in runEHOnFunction()
1227 CallInst *FMCI = IRB.CreateCall(FMCF, FMCArgs, "fmc"); in runEHOnFunction()
1229 Value *Pair0 = IRB.CreateInsertValue(Poison, FMCI, 0, "pair0"); in runEHOnFunction()
1230 Value *TempRet0 = IRB.CreateCall(GetTempRet0F, std::nullopt, "tempret0"); in runEHOnFunction()
1231 Value *Pair1 = IRB.CreateInsertValue(Pair0, TempRet0, 1, "pair1"); in runEHOnFunction()
1269 IRBuilder<> IRB(C); in runSjLjOnFunction() local
1287 BinaryOperator::Create(Instruction::Add, IRB.getInt32(4), IRB.getInt32(0), in runSjLjOnFunction()
1293 IRB.SetInsertPoint(SetjmpTableSize); in runSjLjOnFunction()
1294 auto *SetjmpTable = IRB.CreateMalloc(IntPtrTy, IRB.getInt32Ty(), size, in runSjLjOnFunction()
1304 IRB.CreateStore(IRB.getInt32(0), SetjmpTable); in runSjLjOnFunction()
1338 IRB.SetInsertPoint(Tail, Tail->getFirstNonPHIIt()); in runSjLjOnFunction()
1339 PHINode *SetjmpRet = IRB.CreatePHI(IRB.getInt32Ty(), 2, "setjmp.ret"); in runSjLjOnFunction()
1342 SetjmpRet->addIncoming(IRB.getInt32(0), BB); in runSjLjOnFunction()
1351 IRB.SetInsertPoint(CI); in runSjLjOnFunction()
1352 Value *Args[] = {CI->getArgOperand(0), IRB.getInt32(SetjmpRetPHIs.size()), in runSjLjOnFunction()
1355 IRB.CreateCall(SaveSetjmpF, Args, "setjmpTable"); in runSjLjOnFunction()
1357 IRB.CreateCall(GetTempRet0F, std::nullopt, "setjmpTableSize"); in runSjLjOnFunction()
1404 IRB.SetInsertPoint(I); in runSjLjOnFunction()
1405 auto *Free = IRB.CreateFree(SetjmpTable, Bundles); in runSjLjOnFunction()
1461 IRBuilder<> IRB(C); in handleLongjmpableCallsForEmscriptenSjLj() local
1589 IRB.SetInsertPoint(RethrowExnBB); in handleLongjmpableCallsForEmscriptenSjLj()
1591 IRB.CreateCall(getFindMatchingCatch(M, 0), {}, "exn"); in handleLongjmpableCallsForEmscriptenSjLj()
1592 IRB.CreateCall(ResumeF, {Exn}); in handleLongjmpableCallsForEmscriptenSjLj()
1593 IRB.CreateUnreachable(); in handleLongjmpableCallsForEmscriptenSjLj()
1596 IRB.SetInsertPoint(CI); in handleLongjmpableCallsForEmscriptenSjLj()
1599 IRB.CreateICmpEQ(Threw, getAddrSizeInt(&M, 1), "cmp.eq.one"); in handleLongjmpableCallsForEmscriptenSjLj()
1600 IRB.CreateCondBr(CmpEqOne, RethrowExnBB, NormalBB); in handleLongjmpableCallsForEmscriptenSjLj()
1602 IRB.SetInsertPoint(NormalBB); in handleLongjmpableCallsForEmscriptenSjLj()
1603 IRB.CreateBr(Tail); in handleLongjmpableCallsForEmscriptenSjLj()
1626 IRB.SetInsertPoint(EndBB); in handleLongjmpableCallsForEmscriptenSjLj()
1627 IRB.SetCurrentDebugLocation(EndBB->back().getDebugLoc()); in handleLongjmpableCallsForEmscriptenSjLj()
1628 SwitchInst *SI = IRB.CreateSwitch(Label, Tail, SetjmpRetPHIs.size()); in handleLongjmpableCallsForEmscriptenSjLj()
1634 SI->addCase(IRB.getInt32(I + 1), SetjmpRetPHIs[I]->getParent()); in handleLongjmpableCallsForEmscriptenSjLj()
1665 IRBuilder<> IRB(C); in handleLongjmpableCallsForWasmSjLj() local
1674 FunctionType::get(IRB.getInt32Ty(), /* isVarArg */ true); in handleLongjmpableCallsForWasmSjLj()
1677 cast<Constant>(IRB.CreateBitCast(PersF, IRB.getPtrTy()))); in handleLongjmpableCallsForWasmSjLj()
1683 IRB.SetCurrentDebugLocation(FirstDL); in handleLongjmpableCallsForWasmSjLj()
1709 IRB.SetInsertPoint(CatchDispatchLongjmpBB); in handleLongjmpableCallsForWasmSjLj()
1711 IRB.CreateCatchSwitch(ConstantTokenNone::get(C), nullptr, 1); in handleLongjmpableCallsForWasmSjLj()
1716 IRB.SetInsertPoint(CatchLongjmpBB); in handleLongjmpableCallsForWasmSjLj()
1717 CatchPadInst *CatchPad = IRB.CreateCatchPad(CatchSwitchLongjmp, {}); in handleLongjmpableCallsForWasmSjLj()
1724 IRB.CreateCall(CatchF, {IRB.getInt32(WebAssembly::C_LONGJMP)}, "thrown"); in handleLongjmpableCallsForWasmSjLj()
1726 IRB.CreateConstGEP2_32(LongjmpArgsTy, LongjmpArgs, 0, 0, "env_gep"); in handleLongjmpableCallsForWasmSjLj()
1728 IRB.CreateConstGEP2_32(LongjmpArgsTy, LongjmpArgs, 0, 1, "val_gep"); in handleLongjmpableCallsForWasmSjLj()
1730 Instruction *Env = IRB.CreateLoad(IRB.getPtrTy(), EnvField, "env"); in handleLongjmpableCallsForWasmSjLj()
1732 Instruction *Val = IRB.CreateLoad(IRB.getInt32Ty(), ValField, "val"); in handleLongjmpableCallsForWasmSjLj()
1740 Value *EnvP = IRB.CreateBitCast(Env, getAddrPtrType(&M), "env.p"); in handleLongjmpableCallsForWasmSjLj()
1741 Value *SetjmpID = IRB.CreateLoad(getAddrIntType(&M), EnvP, "setjmp.id"); in handleLongjmpableCallsForWasmSjLj()
1743 IRB.CreateCall(TestSetjmpF, {SetjmpID, SetjmpTable, SetjmpTableSize}, in handleLongjmpableCallsForWasmSjLj()
1745 Value *Cmp = IRB.CreateICmpEQ(Label, IRB.getInt32(0)); in handleLongjmpableCallsForWasmSjLj()
1746 IRB.CreateCondBr(Cmp, ThenBB, EndBB); in handleLongjmpableCallsForWasmSjLj()
1748 IRB.SetInsertPoint(ThenBB); in handleLongjmpableCallsForWasmSjLj()
1749 CallInst *WasmLongjmpCI = IRB.CreateCall( in handleLongjmpableCallsForWasmSjLj()
1751 IRB.CreateUnreachable(); in handleLongjmpableCallsForWasmSjLj()
1753 IRB.SetInsertPoint(EndBB); in handleLongjmpableCallsForWasmSjLj()
1755 IRB.CreateCatchRet(CatchPad, SetjmpDispatchBB); in handleLongjmpableCallsForWasmSjLj()
1765 IRB.SetInsertPoint(SetjmpDispatchBB); in handleLongjmpableCallsForWasmSjLj()
1766 PHINode *LabelPHI = IRB.CreatePHI(IRB.getInt32Ty(), 2, "label.phi"); in handleLongjmpableCallsForWasmSjLj()
1768 LabelPHI->addIncoming(IRB.getInt32(-1), Entry); in handleLongjmpableCallsForWasmSjLj()
1769 SwitchInst *SI = IRB.CreateSwitch(LabelPHI, OrigEntry, SetjmpRetPHIs.size()); in handleLongjmpableCallsForWasmSjLj()
1775 SI->addCase(IRB.getInt32(I + 1), SetjmpRetPHIs[I]->getParent()); in handleLongjmpableCallsForWasmSjLj()
1849 IRB.SetInsertPoint(CSI); in handleLongjmpableCallsForWasmSjLj()
1851 auto *NewCSI = IRB.CreateCatchSwitch(CSI->getParentPad(), in handleLongjmpableCallsForWasmSjLj()
1861 IRB.SetInsertPoint(CRI); in handleLongjmpableCallsForWasmSjLj()
1863 IRB.CreateCleanupRet(CRI->getCleanupPad(), CatchDispatchLongjmpBB); in handleLongjmpableCallsForWasmSjLj()