Lines Matching refs:Builder
67 void linkExceptionRegistration(IRBuilder<> &Builder, Function *Handler);
68 void unlinkExceptionRegistration(IRBuilder<> &Builder);
72 Value *emitEHLSDA(IRBuilder<> &Builder, Function *F);
77 void rewriteSetJmpCallSite(IRBuilder<> &Builder, Function &F, CallSite CS,
281 IRBuilder<> Builder(&F->getEntryBlock(), F->getEntryBlock().begin());
282 Type *Int8PtrType = Builder.getInt8PtrTy();
283 Type *Int32Ty = Builder.getInt32Ty();
284 Type *VoidTy = Builder.getVoidTy();
288 RegNode = Builder.CreateAlloca(RegNodeTy);
290 Value *SP = Builder.CreateCall(
292 Builder.CreateStore(SP, Builder.CreateStructGEP(RegNodeTy, RegNode, 0));
296 insertStateNumberStore(&*Builder.GetInsertPoint(), ParentBaseState);
299 Link = Builder.CreateStructGEP(RegNodeTy, RegNode, 1);
300 linkExceptionRegistration(Builder, Trampoline);
315 RegNode = Builder.CreateAlloca(RegNodeTy);
317 EHGuardNode = Builder.CreateAlloca(Int32Ty);
320 Value *SP = Builder.CreateCall(
322 Builder.CreateStore(SP, Builder.CreateStructGEP(RegNodeTy, RegNode, 0));
326 insertStateNumberStore(&*Builder.GetInsertPoint(), ParentBaseState);
328 Value *LSDA = emitEHLSDA(Builder, F);
329 LSDA = Builder.CreatePtrToInt(LSDA, Int32Ty);
334 Value *Val = Builder.CreateLoad(Int32Ty, Cookie, "cookie");
335 LSDA = Builder.CreateXor(LSDA, Val);
337 Builder.CreateStore(LSDA, Builder.CreateStructGEP(RegNodeTy, RegNode, 3));
341 Value *Val = Builder.CreateLoad(Int32Ty, Cookie);
342 Value *FrameAddr = Builder.CreateCall(
344 Builder.getInt32(0), "frameaddr");
345 Value *FrameAddrI32 = Builder.CreatePtrToInt(FrameAddr, Int32Ty);
346 FrameAddrI32 = Builder.CreateXor(FrameAddrI32, Val);
347 Builder.CreateStore(FrameAddrI32, EHGuardNode);
351 Link = Builder.CreateStructGEP(RegNodeTy, RegNode, 2);
352 linkExceptionRegistration(Builder, PersonalityFn);
369 Builder.SetInsertPoint(T);
370 unlinkExceptionRegistration(Builder);
374 Value *WinEHStatePass::emitEHLSDA(IRBuilder<> &Builder, Function *F) {
375 Value *FI8 = Builder.CreateBitCast(F, Type::getInt8PtrTy(F->getContext()));
376 return Builder.CreateCall(
405 IRBuilder<> Builder(EntryBB);
406 Value *LSDA = emitEHLSDA(Builder, ParentFunc);
408 Builder.CreateBitCast(PersonalityFn, TargetFuncTy->getPointerTo());
411 CallInst *Call = Builder.CreateCall(CastPersonality, Args);
416 Builder.CreateRet(Call);
420 void WinEHStatePass::linkExceptionRegistration(IRBuilder<> &Builder,
427 Value *HandlerI8 = Builder.CreateBitCast(Handler, Builder.getInt8PtrTy());
428 Builder.CreateStore(HandlerI8, Builder.CreateStructGEP(LinkTy, Link, 1));
432 Value *Next = Builder.CreateLoad(FSZero);
433 Builder.CreateStore(Next, Builder.CreateStructGEP(LinkTy, Link, 0));
435 Builder.CreateStore(Link, FSZero);
438 void WinEHStatePass::unlinkExceptionRegistration(IRBuilder<> &Builder) {
442 Builder.Insert(GEP);
448 Builder.CreateLoad(Builder.CreateStructGEP(LinkTy, Link, 0));
451 Builder.CreateStore(Next, FSZero);
458 void WinEHStatePass::rewriteSetJmpCallSite(IRBuilder<> &Builder, Function &F,
473 OptionalArgs.push_back(emitEHLSDA(Builder, &F));
485 Builder.CreateBitCast(CS.getArgOperand(0), Builder.getInt8PtrTy()));
486 Args.push_back(Builder.getInt32(OptionalArgs.size()));
492 CallInst *NewCI = Builder.CreateCall(SetJmp3, Args, OpBundles);
497 NewCS = Builder.CreateInvoke(
636 IRBuilder<> Builder(RegNode->getNextNode());
637 Value *RegNodeI8 = Builder.CreateBitCast(RegNode, Builder.getInt8PtrTy());
638 Builder.CreateCall(
643 IRBuilder<> Builder(EHGuardNode->getNextNode());
645 Builder.CreateBitCast(EHGuardNode, Builder.getInt8PtrTy());
646 Builder.CreateCall(
778 IRBuilder<> Builder(CS.getInstruction());
782 Builder.CreateStructGEP(nullptr, RegNode, StateFieldIndex);
783 State = Builder.CreateLoad(StateField);
785 State = Builder.getInt32(getStateForCallSite(BlockColors, FuncInfo, CS));
787 rewriteSetJmpCallSite(Builder, F, CS, State);
792 IRBuilder<> Builder(IP);
794 Builder.CreateStructGEP(nullptr, RegNode, StateFieldIndex);
795 Builder.CreateStore(Builder.getInt32(State), StateField);