• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /freebsd-12-stable/contrib/llvm-project/llvm/lib/Transforms/Instrumentation/

Lines Matching defs:IRB

635   Value *createSlowPathCmp(IRBuilder<> &IRB, Value *AddrLong,
641 Value *memToShadow(Value *Shadow, IRBuilder<> &IRB);
770 bool InstrumentGlobals(IRBuilder<> &IRB, Module &M, bool *CtorComdat);
771 void InstrumentGlobalsCOFF(IRBuilder<> &IRB, Module &M,
774 void InstrumentGlobalsELF(IRBuilder<> &IRB, Module &M,
778 void InstrumentGlobalsMachO(IRBuilder<> &IRB, Module &M,
782 InstrumentGlobalsWithMetadataArray(IRBuilder<> &IRB, Module &M,
976 IRBuilder<> IRB(InstBefore);
977 Value *DynamicAreaPtr = IRB.CreatePtrToInt(SavedStack, IntptrTy);
987 Value *DynamicAreaOffset = IRB.CreateCall(DynamicAreaOffsetFunc, {});
989 DynamicAreaPtr = IRB.CreateAdd(IRB.CreatePtrToInt(SavedStack, IntptrTy),
993 IRB.CreateCall(
995 {IRB.CreateLoad(IntptrTy, DynamicAllocaLayout), DynamicAreaPtr});
1096 IRBuilder<> &IRB, Value *ShadowBase);
1098 size_t Begin, size_t End, IRBuilder<> &IRB,
1102 size_t End, IRBuilder<> &IRB, Value *ShadowBase);
1104 void poisonAlloca(Value *V, uint64_t Size, IRBuilder<> &IRB, bool DoPoison);
1106 Value *createAllocaForLayout(IRBuilder<> &IRB, const ASanStackFrameLayout &L,
1108 PHINode *createPHI(IRBuilder<> &IRB, Value *Cond, Value *ValueIfTrue,
1285 Value *AddressSanitizer::memToShadow(Value *Shadow, IRBuilder<> &IRB) {
1287 Shadow = IRB.CreateLShr(Shadow, Mapping.Scale);
1296 return IRB.CreateOr(Shadow, ShadowBase);
1298 return IRB.CreateAdd(Shadow, ShadowBase);
1303 IRBuilder<> IRB(MI);
1305 IRB.CreateCall(
1307 {IRB.CreatePointerCast(MI->getOperand(0), IRB.getInt8PtrTy()),
1308 IRB.CreatePointerCast(MI->getOperand(1), IRB.getInt8PtrTy()),
1309 IRB.CreateIntCast(MI->getOperand(2), IntptrTy, false)});
1311 IRB.CreateCall(
1313 {IRB.CreatePointerCast(MI->getOperand(0), IRB.getInt8PtrTy()),
1314 IRB.CreateIntCast(MI->getOperand(1), IRB.getInt32Ty(), false),
1315 IRB.CreateIntCast(MI->getOperand(2), IntptrTy, false)});
1482 IRBuilder<> IRB(I);
1487 i = IRB.CreatePointerCast(i, IntptrTy);
1489 IRB.CreateCall(F, Param);
1533 IRBuilder<> IRB(I);
1534 Value *MaskElem = IRB.CreateExtractElement(Mask, Idx);
1539 IRBuilder<> IRB(InsertBefore);
1541 IRB.CreateGEP(VTy, Addr, {Zero, ConstantInt::get(IntptrTy, Idx)});
1613 IRBuilder<> IRB(InsertBefore);
1614 Value *ExpVal = Exp == 0 ? nullptr : ConstantInt::get(IRB.getInt32Ty(), Exp);
1618 Call = IRB.CreateCall(AsanErrorCallbackSized[IsWrite][0],
1621 Call = IRB.CreateCall(AsanErrorCallbackSized[IsWrite][1],
1626 IRB.CreateCall(AsanErrorCallback[IsWrite][0][AccessSizeIndex], Addr);
1628 Call = IRB.CreateCall(AsanErrorCallback[IsWrite][1][AccessSizeIndex],
1635 IRB.CreateCall(EmptyAsm, {});
1639 Value *AddressSanitizer::createSlowPathCmp(IRBuilder<> &IRB, Value *AddrLong,
1645 IRB.CreateAnd(AddrLong, ConstantInt::get(IntptrTy, Granularity - 1));
1648 LastAccessedByte = IRB.CreateAdd(
1652 IRB.CreateIntCast(LastAccessedByte, ShadowValue->getType(), false);
1654 return IRB.CreateICmpSGE(LastAccessedByte, ShadowValue);
1664 IRBuilder<> IRB(InsertBefore);
1665 Value *AddrLong = IRB.CreatePointerCast(Addr, IntptrTy);
1670 IRB.CreateCall(AsanMemoryAccessCallback[IsWrite][0][AccessSizeIndex],
1673 IRB.CreateCall(AsanMemoryAccessCallback[IsWrite][1][AccessSizeIndex],
1674 {AddrLong, ConstantInt::get(IRB.getInt32Ty(), Exp)});
1681 AddrLong = IRB.CreateAnd(AddrLong, ~kMyriadCacheBitMask32);
1683 Value *Tag = IRB.CreateLShr(AddrLong, kMyriadTagShift);
1686 IRB.CreateICmpEQ(Tag, ConstantInt::get(IntptrTy, kMyriadDDRTag));
1692 IRB.SetInsertPoint(TagCheckTerm);
1699 Value *ShadowPtr = memToShadow(AddrLong, IRB);
1702 IRB.CreateLoad(ShadowTy, IRB.CreateIntToPtr(ShadowPtr, ShadowPtrTy));
1704 Value *Cmp = IRB.CreateICmpNE(ShadowValue, CmpVal);
1715 IRB.SetInsertPoint(CheckTerm);
1716 Value *Cmp2 = createSlowPathCmp(IRB, AddrLong, ShadowValue, TypeSize);
1742 IRBuilder<> IRB(InsertBefore);
1744 Value *AddrLong = IRB.CreatePointerCast(Addr, IntptrTy);
1747 IRB.CreateCall(AsanMemoryAccessCallbackSized[IsWrite][0],
1750 IRB.CreateCall(AsanMemoryAccessCallbackSized[IsWrite][1],
1751 {AddrLong, Size, ConstantInt::get(IRB.getInt32Ty(), Exp)});
1753 Value *LastByte = IRB.CreateIntToPtr(
1754 IRB.CreateAdd(AddrLong, ConstantInt::get(IntptrTy, TypeSize / 8 - 1)),
1764 IRBuilder<> IRB(&GlobalInit.front(),
1769 IRB.CreateCall(AsanPoisonGlobals, ModuleNameAddr);
1952 IRBuilder<> IRB(*C);
1956 M.getOrInsertFunction(kAsanPoisonGlobalsName, IRB.getVoidTy(), IntptrTy);
1958 M.getOrInsertFunction(kAsanUnpoisonGlobalsName, IRB.getVoidTy());
1962 kAsanRegisterGlobalsName, IRB.getVoidTy(), IntptrTy, IntptrTy);
1964 kAsanUnregisterGlobalsName, IRB.getVoidTy(), IntptrTy, IntptrTy);
1969 kAsanRegisterImageGlobalsName, IRB.getVoidTy(), IntptrTy);
1971 kAsanUnregisterImageGlobalsName, IRB.getVoidTy(), IntptrTy);
1974 M.getOrInsertFunction(kAsanRegisterElfGlobalsName, IRB.getVoidTy(),
1977 M.getOrInsertFunction(kAsanUnregisterElfGlobalsName, IRB.getVoidTy(),
2043 IRBuilder<> &IRB, Module &M, ArrayRef<GlobalVariable *> ExtendedGlobals,
2067 IRBuilder<> &IRB, Module &M, ArrayRef<GlobalVariable *> ExtendedGlobals,
2111 IRB.CreateCall(AsanRegisterElfGlobals,
2112 {IRB.CreatePointerCast(RegisteredFlag, IntptrTy),
2113 IRB.CreatePointerCast(StartELFMetadata, IntptrTy),
2114 IRB.CreatePointerCast(StopELFMetadata, IntptrTy)});
2120 {IRB.CreatePointerCast(RegisteredFlag, IntptrTy),
2121 IRB.CreatePointerCast(StartELFMetadata, IntptrTy),
2122 IRB.CreatePointerCast(StopELFMetadata, IntptrTy)});
2126 IRBuilder<> &IRB, Module &M, ArrayRef<GlobalVariable *> ExtendedGlobals,
2172 IRB.CreateCall(AsanRegisterImageGlobals,
2173 {IRB.CreatePointerCast(RegisteredFlag, IntptrTy)});
2179 {IRB.CreatePointerCast(RegisteredFlag, IntptrTy)});
2183 IRBuilder<> &IRB, Module &M, ArrayRef<GlobalVariable *> ExtendedGlobals,
2199 IRB.CreateCall(AsanRegisterGlobals,
2200 {IRB.CreatePointerCast(AllGlobals, IntptrTy),
2207 {IRB.CreatePointerCast(AllGlobals, IntptrTy),
2216 bool ModuleAddressSanitizer::InstrumentGlobals(IRBuilder<> &IRB, Module &M,
2282 Type *RightRedZoneTy = ArrayType::get(IRB.getInt8Ty(), RightRedzoneSize);
2319 Indices2[0] = IRB.getInt32(0);
2320 Indices2[1] = IRB.getInt32(0);
2336 Constant *ODRIndicator = ConstantExpr::getNullValue(IRB.getInt8PtrTy());
2352 IRB.getInt8PtrTy());
2357 new GlobalVariable(M, IRB.getInt8Ty(), false, Linkage,
2358 Constant::getNullValue(IRB.getInt8Ty()),
2401 InstrumentGlobalsELF(IRB, M, NewGlobals, Initializers, ELFUniqueModuleId);
2404 InstrumentGlobalsCOFF(IRB, M, NewGlobals, Initializers);
2406 InstrumentGlobalsMachO(IRB, M, NewGlobals, Initializers);
2408 InstrumentGlobalsWithMetadataArray(IRB, M, NewGlobals, Initializers);
2447 IRBuilder<> IRB(AsanCtorFunction->getEntryBlock().getTerminator());
2448 InstrumentGlobals(IRB, M, &CtorComdat);
2473 IRBuilder<> IRB(*C);
2491 FunctionType::get(IRB.getVoidTy(), Args2, false));
2495 FunctionType::get(IRB.getVoidTy(), Args2, false));
2503 FunctionType::get(IRB.getVoidTy(), Args1, false));
2508 FunctionType::get(IRB.getVoidTy(), Args1, false));
2516 IRB.getInt8PtrTy(), IRB.getInt8PtrTy(),
2517 IRB.getInt8PtrTy(), IntptrTy);
2519 IRB.getInt8PtrTy(), IRB.getInt8PtrTy(),
2520 IRB.getInt8PtrTy(), IntptrTy);
2522 IRB.getInt8PtrTy(), IRB.getInt8PtrTy(),
2523 IRB.getInt32Ty(), IntptrTy);
2526 M.getOrInsertFunction(kAsanHandleNoReturnName, IRB.getVoidTy());
2529 M.getOrInsertFunction(kAsanPtrCmp, IRB.getVoidTy(), IntptrTy, IntptrTy);
2531 M.getOrInsertFunction(kAsanPtrSub, IRB.getVoidTy(), IntptrTy, IntptrTy);
2533 EmptyAsm = InlineAsm::get(FunctionType::get(IRB.getVoidTy(), false),
2538 ArrayType::get(IRB.getInt8Ty(), 0));
2552 IRBuilder<> IRB(&F.front(), F.front().begin());
2553 IRB.CreateCall(AsanInitFunction, {});
2564 IRBuilder<> IRB(&F.front().front());
2574 IRB.CreateCall(Asm, {AsanShadowGlobal}, ".asan.shadow");
2577 IRB.CreatePointerCast(AsanShadowGlobal, IntptrTy, ".asan.shadow");
2582 LocalDynamicShadow = IRB.CreateLoad(IntptrTy, GlobalDynamicAddress);
2732 IRBuilder<> IRB(CI);
2733 IRB.CreateCall(AsanHandleNoReturnFunc, {});
2763 IRBuilder<> IRB(*C);
2770 IRB.getVoidTy(), IntptrTy, IntptrTy);
2774 kAsanPoisonStackMemoryName, IRB.getVoidTy(), IntptrTy, IntptrTy);
2776 kAsanUnpoisonStackMemoryName, IRB.getVoidTy(), IntptrTy, IntptrTy);
2784 M.getOrInsertFunction(Name.str(), IRB.getVoidTy(), IntptrTy, IntptrTy);
2788 kAsanAllocaPoison, IRB.getVoidTy(), IntptrTy, IntptrTy);
2790 kAsanAllocasUnpoison, IRB.getVoidTy(), IntptrTy, IntptrTy);
2796 IRBuilder<> &IRB,
2836 Value *Ptr = IRB.CreateAdd(ShadowBase, ConstantInt::get(IntptrTy, i));
2837 Value *Poison = IRB.getIntN(StoreSizeInBytes * 8, Val);
2838 IRB.CreateAlignedStore(
2839 Poison, IRB.CreateIntToPtr(Ptr, Poison->getType()->getPointerTo()), 1);
2847 IRBuilder<> &IRB, Value *ShadowBase) {
2848 copyToShadow(ShadowMask, ShadowBytes, 0, ShadowMask.size(), IRB, ShadowBase);
2854 IRBuilder<> &IRB, Value *ShadowBase) {
2871 copyToShadowInline(ShadowMask, ShadowBytes, Done, i, IRB, ShadowBase);
2872 IRB.CreateCall(AsanSetShadowFunc[Val],
2873 {IRB.CreateAdd(ShadowBase, ConstantInt::get(IntptrTy, i)),
2879 copyToShadowInline(ShadowMask, ShadowBytes, Done, End, IRB, ShadowBase);
2899 IRBuilder<> IRB(CopyInsertPoint);
2907 AllocaInst *AI = IRB.CreateAlloca(
2915 IRB.CreateMemCpy(AI, Alignment, &Arg, Alignment, AllocSize);
2920 PHINode *FunctionStackPoisoner::createPHI(IRBuilder<> &IRB, Value *Cond,
2924 PHINode *PHI = IRB.CreatePHI(IntptrTy, 2);
2933 IRBuilder<> &IRB, const ASanStackFrameLayout &L, bool Dynamic) {
2936 Alloca = IRB.CreateAlloca(IRB.getInt8Ty(),
2937 ConstantInt::get(IRB.getInt64Ty(), L.FrameSize),
2940 Alloca = IRB.CreateAlloca(ArrayType::get(IRB.getInt8Ty(), L.FrameSize),
2947 return IRB.CreatePointerCast(Alloca, IntptrTy);
2952 IRBuilder<> IRB(dyn_cast<Instruction>(FirstBB.begin()));
2953 DynamicAllocaLayout = IRB.CreateAlloca(IntptrTy, nullptr);
2954 IRB.CreateStore(Constant::getNullValue(IntptrTy), DynamicAllocaLayout);
2971 IRBuilder<> IRB(APC.InsBefore);
2972 poisonAlloca(APC.AI, APC.Size, IRB, APC.DoPoison);
2997 IRBuilder<> IRB(InsBefore);
3070 DoDynamicAlloca ? nullptr : createAllocaForLayout(IRB, L, false);
3079 IRB.CreateAlloca(IntptrTy, nullptr, "asan_local_stack_base");
3085 kAsanOptionDetectUseAfterReturn, IRB.getInt32Ty());
3086 Value *UseAfterReturnIsEnabled = IRB.CreateICmpNE(
3087 IRB.CreateLoad(IRB.getInt32Ty(), OptionDetectUseAfterReturn),
3088 Constant::getNullValue(IRB.getInt32Ty()));
3097 IRB.SetInsertPoint(InsBefore);
3098 FakeStack = createPHI(IRB, UseAfterReturnIsEnabled, FakeStackValue, Term,
3102 IRB.CreateICmpEQ(FakeStack, Constant::getNullValue(IntptrTy));
3108 IRB.SetInsertPoint(InsBefore);
3109 LocalStackBase = createPHI(IRB, NoFakeStack, AllocaValue, Term, FakeStack);
3110 IRB.CreateStore(LocalStackBase, LocalStackBaseAlloca);
3117 DoDynamicAlloca ? createAllocaForLayout(IRB, L, true) : StaticAlloca;
3126 Value *NewAllocaPtr = IRB.CreateIntToPtr(
3127 IRB.CreateAdd(LocalStackBase, ConstantInt::get(IntptrTy, Desc.Offset)),
3134 Value *BasePlus0 = IRB.CreateIntToPtr(LocalStackBase, IntptrPtrTy);
3135 IRB.CreateStore(ConstantInt::get(IntptrTy, kCurrentStackFrameMagic),
3138 Value *BasePlus1 = IRB.CreateIntToPtr(
3139 IRB.CreateAdd(LocalStackBase,
3145 Value *Description = IRB.CreatePointerCast(StackDescriptionGlobal, IntptrTy);
3146 IRB.CreateStore(Description, BasePlus1);
3148 Value *BasePlus2 = IRB.CreateIntToPtr(
3149 IRB.CreateAdd(LocalStackBase,
3152 IRB.CreateStore(IRB.CreatePointerCast(&F, IntptrTy), BasePlus2);
3157 Value *ShadowBase = ASan.memToShadow(LocalStackBase, IRB);
3160 copyToShadow(ShadowAfterScope, ShadowAfterScope, IRB, ShadowBase);
3172 IRBuilder<> IRB(APC.InsBefore);
3175 IRB, ShadowBase);
3239 IRBuilder<> &IRB, bool DoPoison) {
3241 Value *AddrArg = IRB.CreatePointerCast(V, IntptrTy);
3243 IRB.CreateCall(
3257 IRBuilder<> IRB(AI);
3273 IRB.CreateMul(IRB.CreateIntCast(AI->getArraySize(), IntptrTy, false),
3277 Value *PartialSize = IRB.CreateAnd(OldSize, AllocaRzMask);
3280 Value *Misalign = IRB.CreateSub(AllocaRzSize, PartialSize);
3283 Value *Cond = IRB.CreateICmpNE(Misalign, AllocaRzSize);
3284 Value *PartialPadding = IRB.CreateSelect(Cond, Misalign, Zero);
3289 Value *AdditionalChunkSize = IRB.CreateAdd(
3292 Value *NewSize = IRB.CreateAdd(OldSize, AdditionalChunkSize);
3295 AllocaInst *NewAlloca = IRB.CreateAlloca(IRB.getInt8Ty(), NewSize);
3299 Value *NewAddress = IRB.CreateAdd(IRB.CreatePtrToInt(NewAlloca, IntptrTy),
3303 IRB.CreateCall(AsanAllocaPoisonFunc, {NewAddress, OldSize});
3307 IRB.CreateStore(IRB.CreatePtrToInt(NewAlloca, IntptrTy), DynamicAllocaLayout);
3309 Value *NewAddressPtr = IRB.CreateIntToPtr(NewAddress, AI->getType());